TwinCAT 3 PLC

Sequence of processing in SFC

In online mode the particular action types will be processed according a defined sequence, see the table below.

Following terms are used:

  • Active step: A step, whose step action is being executed, is called "active". In Online mode active steps are filled with blue color.
  • Initial step: In the first cycle after a SFC POU has been called, the initial step automatically gets active and the associated step action is executed.
  • IEC actions are executed at least twice: The first time when they have got active, the second time - in the following cycle - when they have been deactivated.
  • Alternative Branches: If the step preceding the horizontal start line of alternative branches is active, then the first transition of each particular branch will be evaluated from left to right. The first transition from the left whose transition condition has value TRUE will be searched and the respective branch will be executed, that is the subsequent step within this branch will get active.
  • Parallel Branches: If the double-line at the beginning line of parallel branches is active and the preceding transition condition has the value TRUE, then in all parallel branches each the first step will get active. The branches now will be processed parallel to one another. The step subsequent to the double-line at the end of the branching will become active when all previous steps are active and the transition condition after the double-line has the value TRUE.

Processing order of elements in a sequence:

1. Reset of the IEC actions

All action control flags of the IEC actions get reset (not however the flags of IEC actions that are called within actions!).

2. Step Exit Actions ("step deactivated")

All steps are checked in the order which they assume in the sequence chart (top to bottom and left to right) to determine whether the requirement for execution of the step exit action is provided, and - if that is the case - this will be executed.

An exit action will be executed, if the step is going to get deactivated, that is if its entry and step actions - if existing - have been executed during the last cycle, and if the transition for the following step is TRUE.

3. Step Entry Actions Eingangsaktionen ("step activated ")

All steps are tested in the order which they assume in the sequence to determine whether the requirement for execution of the step entry action is provided and - if that is the case - this will be executed. An entry action will be executed, if the step-preceding transition condition is TRUE and thus the step has been activated.

4. Timeout check, Step Active Actions

For all steps , the following is done in the order which they assume in the sequence:

- (not yet implemented) If applicable, the elapsed time is copied into the corresponding implicit step status variable <stepname>.t

- (not yet implemented) If applicable, any timeout is tested and the SFC error flags are serviced as required.

- For non-IEC steps, the corresponding step active action is now executed.

5. IECActions

IEC actions that are used in the sequence are executed in alphabetical order. This is done in two passes through the list of actions. In the first pass, all the IEC actions that are deactivated in the current cycle are executed. In the second pass, all the IEC actions that are active in the current cycle are executed.

6. Transition check, Activating next steps

Transitions are evaluated: If the step in the current cycle was active and the following transition returns TRUE (and if applicable the minimum active time has already elapsed), then the following step is activated.

Note_A4

NOTICE!

The following must be noticeed concerning implementation of actions:

It can come about that an action is carried out several times in one cycle because it is associated with multiple sequences. (For example, an SFC could have two IEC actions A and B, which are both implemented in SFC, and which both call IEC action C; then in IEC actions A and B can both be active in the same cycle and furthermore in both actions IEC action C can be active; then C would be called twice).

If the same IEC action is used simultaneously in different levels of an SFC, this could lead to undesired effects due to the processing sequence described above. For this reason, an error message is issued in this case. It can possibly arise during processing of projects created with older versions of the programming system.

Note_A4

Notice the possibility of using implicit variables for controlling the status of steps and actions resp. the execution of the chart.