Processing Order in SFCΒΆ

Basic element behavior

Processing order
  1. Reset IEC actions

    CODESYS resets the internal action control flags of the action qualifiers (N, R, S, L, D, P, SD, DS, SL). These flags control IEC actions. However, flags are not reset when they are called within actions.

  2. Execute exit actions

    CODESYS verifies whether all steps fulfill the condition for executing the exit action for each step. The order of verification follows the layout in the SFC diagram, from top to bottom and from left to right.

    CODESYS executes an exit action when the step is deactivated (after any entry and step actions have been executed in the preceding cycle and the condition for the subsequent step yields TRUE).

  3. Execute entry actions

    CODESYS verifies whether all steps fulfill the condition for executing the entry action for each step. The order of verification follows the layout in the SFC diagram, from top to bottom and from left to right. If the conditions are fulfilled, then CODESYS executes the entry actions.

    CODESYS executes an entry action as soon as the transition of the preceding step has been processed and yields TRUE, thus indicating that the step has been activated.

  4. Time check / Execute step actions

    CODESYS performs the following check for each step in the order of the SFC layout:

    • CODESYS copies the elapsed time of the active step to the respective implicit step variable <step name>.t. (not yet implemented)
    • If a timeout occurs, then CODESYS sets the respective error flags. (not yet implemented)
    • For non-IEC steps: CODESYS executes the step action.
  5. Execute IEC actions

    CODESYS executes the IEC actions in alphabetical order, passing through the list of actions two times. In the first pass, CODESYS executes the IEC actions for each step that was deactivated in the preceding cycle. In the second pass, the IEC actions are executed for each active step.

  6. Transition check / Activate next steps

    The transitions are passed as follows: If a step is active in the current cycle and the subsequent transition yields TRUE and any defined minimum time of the step has elapsed, then the subsequent step is activated.

Hint

Please note when executing actions:

An action can be executed multiple times within the same cycle if you use it in multiple SFC diagrams. For example, if a sequential function chart includes two IEC actions A and B, both of which are programmed in SFC and call an IEC action C, then the IEC action C is called two times.

If you use the same IEC action at the same time in different levels of an SFC diagram, then this can lead to unpredictable results when processing. For this reason, CODESYS issues a corresponding error message. This error message can appear for projects that have been created in an earlier version of the development system.

Note

Please note: It is possible to use implicit variables to monitor the processing status of steps and actions and to control processing.

See also