enter
Short summary
This method performs the given invoke only in the first cycle of the current step.
Purpose and usage
This method provides step entry functionality for the cycle manager. It executes a single-attempt command only on the first cycle when entering a step, making it ideal for initialization operations, setting outputs, or triggering one-time actions at the beginning of a step.
The method ensures the command is executed exactly once per step entry, regardless of how many cycles the step remains active.
Typical usage patterns
- Step initialization: Setting up conditions when entering a step
- Output control: Activating outputs or devices at step start
- Data logging: Recording step entry events
- Communication: Sending messages or signals on step entry
When to use
- When you need one-time execution at the beginning of a step
- For initializing variables or conditions when entering a step
- When activating outputs that should remain active during the step
- For triggering events that should only happen once per step entry
Behaviour details
- Command is executed only in the first cycle of the current step
- Subsequent cycles in the same step do not re-execute the command
- If command fails, cycle manager proceeds to specified errorStep
- If command succeeds, normal step progression continues
Parameter validation
- invoke must be a valid ISingleAttempt command instance
- errorStep should be a valid step number (typically negative for system steps)
Example:
// Initialize outputs when entering step
STEP_START_CONVEYOR:
cyclemanager.enter(activateConveyorCommand, CONVEYOR_ERROR_STEP);
cyclemanager.proceed();
// Set variables on step entry
STEP_PREPARE_OPERATION:
cyclemanager.enter(setOperationParametersCommand);
cyclemanager.waitFor(parameters_ready);
// Trigger communication on step entry
STEP_NOTIFY_MES:
cyclemanager.enter(sendMESUpdateCommand, COMMUNICATION_ERROR_STEP);
cyclemanager.proceed();
// Complex step with multiple entry actions
STEP_COMPLEX_INIT:
cyclemanager.enter(initializeSystemCommand);
IF cyclemanager.executeStep THEN
// Additional logic after first cycle
monitor_initialization_progress();
END_IF;
cyclemanager.waitFor(initialization_complete);
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| invoke | CNM_CommandInterfaces.ISingleAttempt | command to execute | input |
| errorStep | DINT | step to proceed with in case of error | input |
Code
Declaration
METHOD enter
VAR_INPUT
(* command to execute *)
invoke :CNM_CommandInterfaces.ISingleAttempt;
(* step to proceed with in case of error *)
errorStep :DINT := CNM_ReturnTypes.DefaultSteps.STEP.ERROR;
END_VAR