IF NOTxInitGraphPPUExecuteTHEN
// graph execute oper(in_name: = 'StampingPlantExecute', in_operation: = 'Stamping Plant Execute', in_pre Conditions: = pre Condition Array, in_postConditions: = post Condition Array, in_inverse Operation: = 'Stamping PlantRecover', in_is RecoveryState: = TRUE); nextGraphElem.addObject ('SortingPlantExecute'); previousGraphElem.addObject('Start'); graphElem(in_name:='StampingPlantExecute',in_dataType:=tGRAPH,in_nextElements:=nextGraphElem,in_previousElements:=previousGraphElem); graphElem.operation:=oper; graphElemArray.addObject(graphElem);
oper(in_name:='SortingPlantExecute',in_operation:='SortingPlantExecute', in_preConditions:=preConditionArray,in_postConditions:=postConditionArray,in_inverseOperation:='SortingPlantRecover',in_isRecoveryState:= TRUE); nextGraphElem.addObject('RESET'); previousGraphElem.addObject('StampingPlantExecute'); graphElem(in_name:='SortingPlantExecute',in_dataType:=tGRAPH,in_nextElements:=nextGraphElem,in_previousElements:=previousGraphElem); graphElem.operation:=oper; graphElemArray.addObject(graphElem);
oper(in_name:='RESET',in_operation:='RESET',in_preConditions:=preConditionArray,in_postConditions:=postConditionArray,in_inverseOperation:='no'); nextGraphElem.addObject('StampingPlantExecute'); previousGraphElem.addObject('SortingPlantExecute'); graphElem(in_name:='RESET',in_dataType:=tOPERATION,in_nextElements:=nextGraphElem, in_previousElements:=previousGraphElem); graphElem.operation:=oper; graphElemArray.addObject(graphElem);
graphPPUExecute(in_allGraphElements:=graphElemArray,in_name:='PPUExecute');
xInitGraphPPUExecute := TRUE;
END_IF
execute := tOPERATING; isStopped := FALSE;
currentGraphElementArray := graphPPUExecute.getCurrentNodes(); allGraphElementArray := graphPPUExecute.getAllGraphElements(); graphPPUExecute.updateCurrentNodes();
FOR i:=1 TOcurrentGraphElementArray.numberOfObjects() BY 1 DO graphElement := currentGraphElementArray.objectAtIndex(i); operation := graphElement.operation;
IFoperation.getOperation() = 'StampingPlantExecute' THEN operationState := stampingPlant.execute(); ELSIFoperation.getOperation() = 'SortingPlantExecute' THEN operationState := sortingPlant.execute(); ELSIFoperation.getOperation() = 'RESET' THEN stampingPlant.reset(); sortingPlant.reset(); m_SubgraphArray.removeAllObjects(); operationState := tNORESPONSE; END_IF
IFoperationState = tOPERATINGTHEN graphElement.timeUpdated := FALSE; graphElement.updateTimer(); ELSIFoperationState = tFINISHEDTHEN IF NOTgraphElement.timeUpdatedTHEN
timeOperation := operation.timeOperation; timeOperation.updateTime(graphElement.returnTime()); operation.timeOperation := timeOperation; graphElement.timeUpdated := TRUE; graphElement.operation := operation; graphElement.resetTimer(); allGraphElementArray.replaceObject(graphElement); graphPPUExecute.setAllGraphElements(allGraphElementArray);
END_IF ELSIFoperationState = tERRORTHEN errorDetected := TRUE; END_IF
currentTimeOperation := graphElement.returnTime(); timeOperation := operation.timeOperation; averageTimeOperation := timeOperation.getAverage();
IFaverageTimeOperation> 1 THEN IFcurrentTimeOperation> (averageTimeOperation + 200) THEN errorDetected := TRUE; ELSE errorDetected := errorDetected OR FALSE; END_IF END_IF
graphPPUExecute.updateCurrentGraphElement(graphElement);
END_FOR
IFerrorDetectedTHEN execute := tERROR; ELSIFgraphPPUExecute.isFinished() THEN execute := tFINISHED; END_IF |