Skip to main content

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​

  1. Step initialization: Setting up conditions when entering a step
  2. Output control: Activating outputs or devices at step start
  3. Data logging: Recording step entry events
  4. 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​

NameTypeCommentKind
invokeCNM_CommandInterfaces.ISingleAttemptcommand to executeinput
errorStepDINTstep to proceed with in case of errorinput

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