AbstractCycleManager
Short summary
An abstract CycleManager implementation to provide basic functionality. Does not update the state of the cyclemanager, it only provides some protected update functions.
.. <info> If used in the same step, the order/precedence of method calls should be like this: configurations enter executeCommand evaluate waitFor proceed proceedWith acknowledge leave .. </info>config
| Access | Abstract | Final | Extends | Implements |
|---|---|---|---|---|
| Yes | No | CNM_AssertionInterfaces.AbstractAssertor | CNM_CycleManagerInterfaces.ISingleExecutionCycleManager, CNM_CycleManagerInterfaces.ICycleManagerDefaultParameters, ICycleManagerStepParameters |
UML Diagram
Parameters
none
Properties
configuration
Type: CNM_CycleManagerInterfaces.ICycleManagerConfigurationScope
An interface to provide configurations for cycle manager in a fluent way.…
current
Type: DINT
This property returns the current step of the cycle manager.…
currentErrorStep
Type: DINT
currentPauseEnabled
Type: BOOL
currentSteppingEnabled
Type: BOOL
currentStepWidth
Type: DINT
currentStopRequestMode
Type: CNM_CycleManagerInterfaces.StepStopRequestMode
currentTimeout
Type: TIME
This property sets the maximum execution time for the current step. …
currentTimeoutStep
Type: DINT
defaultErrorStep
Type: DINT
This property stes the next step in case of an error after a step change.…
defaultPauseEnabled
Type: BOOL
This property sets the default pause enabling state after a step change.…
defaultRequireSuccessStep
Type: BOOL
Specifies whether the SUCCESS step of the state machine can be skipped when the transition condition to SUCCESS is already fulfilled.…
defaultSteppingEnabled
Type: BOOL
This property sets the default stepping mode configuration after a step change.…
defaultStepWidth
Type: DINT
This property sets the default the step width.…
defaultStopRequestMode
Type: CNM_CycleManagerInterfaces.StepStopRequestMode
This property sets the default step mode configuration.…
defaultTimeout
Type: TIME
This property sets the maximum execution time for steps. …
defaultTimeoutStep
Type: DINT
This property sets the default step that will be set if the current step reaches a timeout.…
errors
Type: CNM_CycleManagerInterfaces.ICycleError
This property returns an ICycleError interface fluently to provide error handling methods.…
executeStep
Type: BOOL
This property returns the execute flag for the current step, …
isAnyActionRegistered
Type: BOOL
This boolean is true when at least one of these actions are registered:…
isInErrorStep
Type: BOOL
This property returns TRUE if the step was reached by evaluating an error.…
last
Type: DINT
This property returns the last step of the cycle manager, useful for error steps.…
next
Type: DINT
This property sets the next step of the cycle manager.…
state
Type: CNM_ReturnTypes.SingleExecutionState
This property returns the current state of the cycle manager according to its step.…
step
Type: CNM_CycleManagerInterfaces.ICycleSteps
This property returns the current, next and last step of the cycle manager via fluent interface with the ICylceSteps interfaces…
Methods
acknowledge
- Return type:
VOID
This method acknowledges an error in the state machine and resets the current step to the step befor the error occured.…
assertionWasWrong
- Parameters:
caller(CNM_AbstractObject.IObject): caller object of the methodmessage(CNM_AssertionInterfaces.AssertMessage): alarm messageadditionalText(Tc2_System.T_MaxString): debugging information
- Return type:
VOID
This method is called if an assertion was FALSE…
enter
- Parameters:
invoke(CNM_CommandInterfaces.ISingleAttempt): command to executeerrorStep(DINT): step to proceed with in case of error
- Return type:
VOID
This method performs the given invoke only in the first cycle of the current step.…
evaluate
- Parameters:
state(CNM_ReturnTypes.SingleExecutionState): the state which is to be evaluatederrorStep(DINT): step to proceed with in case of error
- Return type:
VOID
This method evaluates an execution state to calculate the next step.…
executeCommand
- Parameters:
command(CNM_CommandInterfaces.ICommand): command to executeerrorStep(DINT): step to proceed with in case of error
- Return type:
VOID
This method performs the given command and evaluates the return value.…
getStateFromStep
- Parameters:
step(DINT)
- Return type: CNM_ReturnTypes.SingleExecutionState
handle
- Parameters:
alarm(CNM_MessageInterfaces.IAlarm): the alarm event that should be thrownresumeWithLastStep(BOOL): if this flag is set AND we got to the current step because of an ERROR state, then the cyclemanager will automatically will go back to the last step
- Return type:
VOID
This method throws an alarm and waits for it to be confirmed. …
handleCycleManagerError
- Parameters:
resume(BOOL): if true, will acknowledge error and return to previous step
- Return type:
VOID
This method handles the resume function of the cycle manager.…
handleCycleManagerExecute
- Parameters:
execute(BOOL): control bit to start or abort the cycle manager
- Return type:
BOOL
This method handles the execution of the cycle manager.…
handleCycleManagerPause
- Parameters:
pause(BOOL): if true and Pausing Enabled and busy will proceed with PAUSE
- Return type:
VOID
This method handles the pausing of the cycle manager. …
handleCycleManagerTimeout
- Parameters:
step(BOOL): must be TRUE if stepping is enabled to proceed steps automatically
- Return type:
BOOL
This method handles the timeout of the current step.…
handleStepChange
- Parameters:
step(BOOL): must be TRUE if stepping is enabled to proceed steps automaticallystopRequest(BOOL): used for StopRequest evaluation if configured
- Return type:
VOID
This method handles the step change, call early in handling.…
initializeNewStep
- Parameters:
errorStep(BOOL)
- Return type:
VOID
leave
- Parameters:
invoke(CNM_CommandInterfaces.ISingleAttempt): command to executeerrorStep(DINT): step to proceed with in case of errorforceOnError(BOOL): whether the invoke should be called even if there was an error in the current step
- Return type:
VOID
This method performs the given invoke only in the last cycle of the current step.…
proceed
- Return type:
VOID
This method changes the current step in the cycle manager to the next in order (current + stepWidth) .…
proceedWith
- Parameters:
step(DINT): step to move to
- Return type:
VOID
This method changes the current step in the cycle manager to the given step.…
resetCurrentStepParametersToDefaults
- Return type:
VOID
resetInternalVariables
- Return type:
VOID
update
- Parameters:
execute(BOOL): control bit to start or abort the cycle managerstopRequest(BOOL): used for StopRequest evaluation if configuredpause(BOOL): if true and Pausing Enabled and busy will proceed with PAUSEresume(BOOL): if true, will acknowledge error and return to previous stepstepControl(BOOL): must be TRUE if stepping is enabled to proceed steps automatically
- Return type:
VOID
This method handles all updates of the cycle manager.…
updateCycleManager
- Return type:
VOID
This method updates the step and state of the cycle manager.…
waitFor
- Parameters:
value(BOOL): the value to wait for
- Return type:
VOID
This method waits for a boolean signal until the step can be changed.…
Code
Declaration
FUNCTION_BLOCK ABSTRACT AbstractCycleManager
EXTENDS CNM_AssertionInterfaces.AbstractAssertor
IMPLEMENTS CNM_CycleManagerInterfaces.ISingleExecutionCycleManager,
CNM_CycleManagerInterfaces.ICycleManagerDefaultParameters,
ICycleManagerStepParameters
//config
VAR
sequenceErrorStep :DINT := STEP_ERROR;
sequencePauseEnabled :BOOL := FALSE;
sequenceSteppingEnabled :BOOL := FALSE;
sequenceTimeOut :TIME := T#0S;
sequenceStopRequestMode :CNM_CycleManagerInterfaces.StepStopRequestMode := CNM_CycleManagerInterfaces.StepStopRequestMode.IGNORE;
sequenceTimeoutStep :DINT := STEP_ERROR;
sequenceStepWidth :DINT := 1;
sequenceRequireSuccessStep :BOOL := FALSE;
stepErrorStep :DINT := STEP_ERROR;
stepPauseEnabled :BOOL := FALSE;
stepSteppingEnabled :BOOL := FALSE;
stepTimeOut :TIME := T#0S;
stepCurrentStopRequestMode :CNM_CycleManagerInterfaces.StepStopRequestMode := CNM_CycleManagerInterfaces.StepStopRequestMode.IGNORE;
stepTimeoutStep :DINT := STEP_ERROR;
stepStepWidth :DINT := 1;
END_VAR
VAR
lastStepBeforePause : DINT;
lastStep : DINT;
currentStep : DINT := CNM_ReturnTypes.DefaultSteps.STEP.IDLE;
nextStep : DINT := CNM_ReturnTypes.DefaultSteps.STEP.IDLE;
nextStepSpecifiedByUser :BOOL := FALSE;
lastExecute : BOOL;
externalExecute : BOOL;
currentState : CNM_ReturnTypes.SingleExecutionState := CNM_ReturnTypes.SingleExecutionState.IDLE;
wasError : BOOL;
wasTimeoutError : BOOL;
gotHereByError : BOOL;
stepLastCycle : DINT;
wasNotSuccess: BOOL;
wasSuccess: BOOL;
firstCycle : BOOL;
timeoutTimer : TON;
//used for cycle time optimizations
registeredEnter : BOOL;
registeredCommand : BOOL;
registeredEval : BOOL;
registeredLeave : BOOL;
END_VAR
VAR CONSTANT
STEP_IDLE :DINT := CNM_ReturnTypes.DefaultSteps.STEP.IDLE;
STEP_INIT :DINT := CNM_ReturnTypes.DefaultSteps.STEP.INIT;
STEP_ERROR :DINT := CNM_ReturnTypes.DefaultSteps.STEP.ERROR;
STEP_ABORT :DINT := CNM_ReturnTypes.DefaultSteps.STEP.ABORT;
STEP_PAUSE :DINT := CNM_ReturnTypes.DefaultSteps.STEP.PAUSE;
STEP_SUCCESS :DINT := CNM_ReturnTypes.DefaultSteps.STEP.SUCCESS;
END_VAR