Module 13 · SFC basics

SFC: steps, transitions, actions

Most machines work in sequences: clamp, drill, retract, unclamp. A Sequential Function Chart draws that sequence as boxes and bars, so anyone can see where the machine is and what it waits for. Learn to read and simulate SFC, then see how each PLC brand and the Logivyx Sequence Designer implement it.

≈ 35 min6 lessons1 hands-on labQuiz · pass 80 %Free

By the end of this module you can

  • Identify steps, the initial step, transitions and actions in a chart
  • Apply the rules of evolution: when a transition fires and what changes
  • Choose action qualifiers N, S, R and P
  • Read alternative branches and step times
  • Relate IEC SFC to Siemens GRAPH, Rockwell SFC, Mitsubishi SFC and the Logivyx Sequence Designer

Step

A box: a state the machine is in ("Clamping"). A step is active or inactive. The initial step (double border) is active when the program starts.

Transition

A short bar between steps with a condition ("clamp closed"). It decides when the machine moves on.

Action

A box beside a step: what to do while the step is active ("N Clamp" = clamp output on).

Steps and transitions always alternate: step, transition, step. The chart reads top to bottom; a line going back up (with an arrow) makes the sequence repeat.

  1. A transition is enabled when the step(s) directly above it are active.
  2. An enabled transition fires as soon as its condition is TRUE.
  3. When it fires, the step above is deactivated and the step below activated, in the same scan.
  4. A step stays active, doing its actions, until its outgoing transition fires. A condition that is TRUE while its step is not active does nothing.

Here is a drilling station. Work it through by hand: press START with a part present, then operate the sensors in the right order. Transition bars turn amber when enabled and green when their condition is also true.

Try pressing START with no part present, or switching "Drill at bottom" during clamping: nothing happens, because those transitions are not enabled or their conditions are false. That predictability is the point of SFC.

QualifierMeaningExample
NNon-stored: TRUE while the step is active, FALSE when it endsDrill_Down in the drilling step
SSet (stored): turns on and stays on after the step endsClamp set in "Clamp"…
RReset: turns off a stored action…and reset in "Unclamp"
PPulse: once, when the step becomes active (P1); P0 = once when it endsCount := Count + 1
L / DTime limited / time delayedHorn for 2 s; valve after 1 s

In the drilling chart, Clamp is repeated as N in three steps. With S in step 10 and R in step 40 it would be written once, but then you must make sure every path through the chart, including faults, eventually resets it.

A step can have several outgoing transitions: an alternative branch (selection divergence). Only one branch is taken; if more than one condition is true, the leftmost (first) has priority. The branches join again later (convergence). Each step also has a step time, S10.T, and an active flag S10.X, usable in conditions.

A second kind of branch, the parallel branch (simultaneous divergence, drawn with a double line), activates several steps at once, for example two stations working at the same time. It is covered in Level 7.

IEC 61131-3 defines SFC with steps (S.X, S.T), transitions and action blocks with qualifiers N, R, S, L, D, P, SD, DS, SL, P1, P0. Transition conditions and actions are written in ST, ladder or FBD.

Logivyx Sequence Designer (Tools → Sequence Designer…) is SFC-style with machine-builder conveniences: one active step per sequence; step 0 = Idle, which waits for the sequence's Start condition; up to two transitions T1 and T2 per step (T1 checked first) plus a TimeOut → Step; actions in ON ACTIVATE (once on entry, like P1), WHILE ON (every scan, like N but values are not reset automatically) and ON DEACTIVATE (once on exit, like P0); Time (s) = minimum time in the step before T1/T2 are checked. It generates a CASE-based ST routine and a <Sequence>_Seq_Step tag with the active step number. For two things happening at once, use two sequences.

S7-GRAPH is Siemens' SFC, available on S7-1500 and S7-300/400 (not on S7-1200). A GRAPH FB contains steps and transitions; each step has actions (qualifiers N, S, R, D, L, CALL…), an interlock condition and a supervision condition (for example a timeout that raises an error and stops the sequence). Transitions are written in LAD or FBD. The GRAPH overview shows the active step online, and the instance DB exposes step and error information to the HMI.

SFC routines in Studio 5000 (ControlLogix, CompactLogix): steps are SFC_STEP tags (.X, .T, .Count, .DN with preset time, .LimitHigh alarm), transitions are BOOL expressions written in ST, and actions (SFC_ACTION) contain ST with qualifiers N, S, R, L, D, P, P1, P0 and others. Selection and simultaneous branches are supported. The routine's execution options control what happens when the SFC restarts.

SFC programs in GX Works3 (MELSAP3 on iQ-R; check SFC support for your iQ-F model): a program is made of blocks; each block contains steps (S0 is the initial step) and transitions. Step actions and transition conditions are written in ladder or ST. Step state can be read with BLm\Sn devices, and instructions such as SCHG and the SFC control relays let the main program start, stop or force steps.

This lab explores the sequence in the Logivyx demo project, so you see a complete machine cycle before building your own in module 14.

Lab

The demo's Auto_Cycle

  1. Open the demo project (Help → Open Demo Project…) and Tools → Sequence Designer…. Open the Auto_Cycle sequence.
  2. Find its Start condition. Which tags must be TRUE for the cycle to leave Idle?
  3. Click a step card and read its properties: Step Number, Time, TimeOut and TimeOut → Step. Find a step whose timeout leads to an alarm step (numbered step + 1).
  4. Open a step's ON ACTIVATE and WHILE ON actions. Which outputs does it set?
  5. Find a step with both T1 and T2. When is T2 taken?
  6. F5, switch the mode selector to AUTO and press CYCLE START. Click 🧮 Logic Diag → View Sequence: the active step is green, and blinks red if its timeout is exceeded.
  7. Leave Run mode and close the project without saving.