OATs - IEC 61131 - Sequential Function Chart - How it works

Sequential Function charts are build from three main elements - steps, transitions and actions. Steps are roughly related to a state while the transitions maintain the conditions how the activity flows from state to state. The third component, actions, are connected to one or more states and define the effect on other variables. Such connections are called actions associations as they define how one ore more steps influence certain actions. You can select from several action attributes for the action associations to tune the overall behaviour.

Quite often the steps and transitions are regarded the main part of an SFC. They are not. The actions are the meat of any SFC. Steps and transitions only tell the flow of activity among the steps and define which actions will be active or inactive.

Extracting the actions out of the steps and making them independent items is one of the most important features which created the IEC 61131-3 programming power. This way exactly the same action (not a copy) can be connected or associated to several steps. Very often an action is associated to two steps. One that activates the action at the right moment and one that deactivates it in another situation.

A function block in SFC consists of steps connected by transitions. Transitions may also be used for selections of alternate sequences, simultaneous sequences and loops.

Each step contains two elements, a Boolean variable X and a variable T of data type TIME. The Boolean variable X tells if or not a step is activated. The variable T holds the duration for the activation of a step. The value tells how long the step is activated or has been activated. Both variables can only be read.

When a step is no longer activated the T variable keeps the duration of the last activation. This can be used to calculate the duration between some events. This is a very easy to handle time measurement tool.

Some steps can be marked as initial steps. This implies an initial condition with the respective Boolean variables X set to TRUE.

The direction of transitions is always from top to bottom.

A transition from one step to the next will occur when the transition between both steps becomes TRUE. Convergences of simultaneous steps are somewhat special. They also include a synchronisation.

The real work of an SFC is done in actions. Please note that actions are parts of a SFC. And even more important, actions are NOT contained in steps. Each step may have associations with actions. Such action associations require an action attribute telling how the step influences the action. Using proper action attributes several steps can influence the same action. This is the normal case, not an exception.

In a typical sample SFC one of the first steps could activate some action by an action association using the S attribute. When the flow of step activations reaches that step the action gets "set." According to the rules for the S-attribute the actions remains "set" even after the step looses activity. Only an action association to the same action but with a R-attribute can "reset" the action. In the typical sample SFC this would happen in one of the last steps.

The action controls have two more Boolean variables Q and A. Both variables can only be read.

OATs also makes the step flag X, step time T and the action control outputs Q and A accessible. If "Step10" is the name of a STEP you can use "Step10.X" which is a BOOL and "Step10.T" which is a TIME. And if "ValveCtrl" is the name of an ACTION you can use "ValveCtrl.Q" and "ValveCtrl.A" which are both BOOL.

Sequences of Steps

The picture shows a simple sequence of four steps S1 to S4 connected by three transitions T1 to T3.

Step S1 is marked as an initial step. All steps and transitions have to follow each other in such a way that any two steps are connected by one single transition. Each transition leads from one step to one other step. Between two steps there is only one transition.

A complete sequence of steps, possibly including divergences and convergences, is called a network by IEC 61131-3. A SFC may contain one or more such networks. Each network must include at least one initial step.

Divergence and convergence of Sequence Selections

Divergences of sequences can be used to select one of several partial sequences depending on as many conditions. The conditions are contained in transitions.

Convergences of sequences continue several partial sequences in a common part. Each of the alternate sequences must have a transition to the first step of the common part.

Usually divergence and convergence of sequence will be found in pairs. But IEC 61131-3 does not enforce this.

The next picture shows a divergence after step S1 over transitions T1, T4, T6 and T9 to steps S2, S5, S6 and S4. And it also shows a convergence to Step S4 over transitions T3, T5, T8 and T9.

Also for divergences and convergences steps and transitions have to follow each other in such a way that steps are connected over a single transition. At a divergence N transitions lead from a single step to N other steps - see T1, T4, T6 and T9 in the picture. At a convergence M transitions lead from M steps to a single other step - see T3, T5, T8 and T9 in the sample. Transition T9 is used for both the divergence and the convergence. Nevertheless the rule of alternating steps and transitions holds.

Divergence and Convergence of Simultaneous Sequences

Divergences of simultaneous sequences are used when after a transition more than a single step should be activated.

Convergences of simultaneous sequences combine over a single transition from more than a single step to a single other step. This includes a synchronisation.

The transition over a convergences of simultaneous sequences will only happen when all steps above the transition are activated, i.e. all partial sequences have reached the transition of the convergence.

Usually divergence and convergence of simultaneous sequences will be found in pairs. But IEC 61131-3 does not enforce this.

Also in divergences and convergences of simultaneous sequences steps and transitions need to follow each other. The transition of a simultaneous divergence leads to at least two other steps - T1 in the sample. The transition of a simultaneous convergence leads from at least two steps to one other step - T3 in the sample.

The transition from step S1 to the steps S2, S5 and S6 happens when the transition T1 becomes TRUE. Step S1 becomes inactive and steps S2, S5 and S6 become active.

The transition from steps S3, S5 and S7 to step S4 happens when the steps S3, S5 and S7 are all active and the value of transition T3 is TRUE. The first condition is a synchronisation.

Step S5 is a sequence with only a single step. Nevertheless the rule of alternating steps and transitions holds.

If a simultaneous sequence contains an initial step, all simultaneous sequences must have an initial step. Otherwise the condition for the convergence of simultaneous sequences could never be fulfilled.

Matching a divergence with a convergence of simultaneous sequences is a common error.

This will never work. The simultaneous convergence require both steps S2 and S3 active (synchronisation) and transition T3 true. But the divergence will select only one of the paths to S2 or S3.

Loops of Sequences

Jumps to build loops in IEC 61131-3 are only a special case of sequence selections by divergences and convergences.

The next pictures shows a jump at transition T4 to form a loop back to step S1.

The rule of alternating steps and transitions is fulfilled here.

Main usage of loops are cyclic sequential programs.

The last transition Tn leads from Sn back to step S1.

OATs uses a slightly different graphical view for loops to ease editing. Although a loop is not a basic SFC element OATs lets you insert a complete loop as such and handles it like a SFC element. This makes programming of loops much easier and more clearly displays such loops.


A transition contains the condition which controls the deactivation of one or more steps prior the transition to one or more steps after the transition. A transition is either a Boolean variable or a function with a Boolean result. The value of a transition condition is either the value of the Boolean variable or the value returned from the function. A transition "fires" when the value becomes TRUE.

Transitions need not consist of a Boolean variable only. An transition can contain a ladder diagram or a function block diagram as well.

OATs even allows small Boolean expressions to be used to define a transition. Let "S10" be the name of a SFC step. Then the expression "S10.T > T#5s" is a valid transition.

Actions and Action Controls

Actions within the SFC of IEC 61131-3 contain either a Boolean variable, or some statements in Instruction List or Structured Text or networks in Function Block Diagram or Ladder Diagram.

Actions are associated by use of action attributes with steps of a Sequential Function Chart. More than a single step may control an action simultaneously or in sequence. Actions are not the content of steps.

The next picture shows a typical usage of a Boolean action. Within step S1 the Boolean variable aBOOL is set using the S attribute and later on in step S3 the R attribute is used to reset the variable.

A step may have associations to more than one action.

Actions need not consist of a Boolean variable only. An action could contain a ladder diagram or a function block diagram as well. Several action controls can link the same action to different SFC steps. In such cases the action controls define how an action is running, stopped, delayed or else.

The above sample activates an action named Controller in step S12 and deactivates the same action in step S27. The Controller action itself could be a complex ladder diagram. And the Controller action remains activated, i.e. will be executed, after the step S12 looses activation.

If a step does not have an action association it can be regarded as a waiting function for the transition condition which leads to the next step.

Copyright 2003-2010 Ing.-Büro Dr. Friedrich Haase