handleCycleManagerExecute
Short summary
This method handles the execution of the cycle manager. Should be the first thing to do at the start of each cycle.
- Return type:
BOOL
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| execute | BOOL | control bit to start or abort the cycle manager | input |
Code
Declaration
METHOD PROTECTED handleCycleManagerExecute : BOOL
VAR_INPUT
(*control bit to start or abort the cycle manager*)
execute :BOOL;
END_VAR
Implementation
IF(THIS^.lastExecute <> execute)THEN
IF(execute)THEN
//first cylce / init
THIS^.currentState := CNM_ReturnTypes.SingleExecutionState.BUSY;
THIS^.step.next := STEP_INIT;
THIS^.firstCycle := TRUE;
ELSE
//falling execute / reset
IF(THIS^.currentState = CNM_ReturnTypes.SingleExecutionState.BUSY OR THIS^.currentState = CNM_ReturnTypes.SingleExecutionState.PAUSED)THEN
THIS^.currentState := CNM_ReturnTypes.SingleExecutionState.ABORTED;
THIS^.currentStep := STEP_ABORT;
ELSE
THIS^.currentStep := STEP_IDLE;
THIS^.step.next := STEP_IDLE;
THIS^.lastStep := STEP_IDLE;
END_IF
THIS^.externalExecute := FALSE;
END_IF
ELSIF(THIS^.currentStep = STEP_ABORT)THEN
//only one cycle in ABORT Step
THIS^.currentStep := STEP_IDLE;
END_IF
THIS^.lastExecute := execute;
handleCycleManagerExecute := execute;