S7-Graph Interlock vs Transition: Step Logic in Siemens S7-300

David Krause15 min read
SiemensTechnical ReferenceTIA Portal
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

S7-Graph Interlock vs Transition: Step Logic in Siemens S7-300/400 Sequencers

S7-GRAPH is the Siemens IEC 61131-3 compliant graphical sequential function chart (SFC) language option for the STEP 7 / TIA Portal programming environment. It targets S7-300, S7-400, and (since V5.4 / TIA V13) S7-1500 controllers and is the canonical tool for state-machine style machine control where the operating sequence is more important than the combinatorial logic that surrounds it. A frequent point of confusion for first-time users is the functional split between the transition (the condition that activates a step) and the interlock (the condition that gates the actions of a step). This reference clarifies that split, documents every action qualifier available in the FB-generated instance DB, and gives field-proven patterns for combining automatic sequences with manual operator control.

Source documents: All statements here align with the Siemens S7-GRAPH V5.3 for S7-300/400 - Programming Sequential Control Systems manual, available as PDF attachment 1137630 on the Siemens Industry Online Support portal. Cross-reference the chapter "Working with Steps and Transitions" and "Actions and Action Qualifiers" before commissioning.

1. S7-GRAPH Architecture Overview

When a Graph FB is compiled, the STEP 7 compiler generates an instance DB containing the entire sequencer state - currently active step(s), elapsed time per step, interlock bits, supervision flags, and the action control words. The user program then calls the FB (e.g., FB 70 "Sequencer" by convention) once per OB1 / OB35 cycle and writes Boolean inputs into the FB's IN parameters while reading the action outputs from the instance DB or directly from the Boolean tag set the actions drive.

The two core structural elements of any chain (Kette) or alternative branch (Verzweigung) are:

  • Step (Schritt, S_n) - a stable state. The machine is "doing" something while the step is active.
  • Transition (Transition, T_n) - the Boolean condition tested to leave a step and activate the next one.

A third, optional element is associated with each step:

  • Interlock (Interlock, C_n) - a Boolean condition that does not control step activation but gates execution of interlock-dependent actions inside that step.

Each step may carry one or more actions (Aktionen). Every action has a qualifier (Q) and a target operand. The qualifier determines when the action fires; the interlock determines whether actions tagged as interlock-dependent fire at all.

2. Transition Logic - What Activates the Next Step

A transition is a Boolean expression composed of contacts, comparisons, and the standard STEP 7 FBD/LAD operators. While the upstream step is active, the sequencer re-evaluates the transition once per cycle. The instant the expression evaluates TRUE, the following happens within the same OB scan:

  1. The currently active step is exited (its "active" bit S_n.X is cleared).
  2. The next step's active bit is set.
  3. All non-stored actions in the just-exited step that had qualifier N are reset.
  4. The step's elapsed-time counter S_n.T is reset to 0 unless the step is configured as a permanent step.
  5. The transition's "traversed" status is logged in the diagnostic DB for S7-PDIAG and ProAgent.

The transition only cares about the single bit "is the expression TRUE right now?". It does not know about interlocks, supervisions, or operator override flags - those are evaluated independently.

2.1 Transition Expression Syntax

Inside a transition cell the user may write any FBD-compatible Boolean network. The most common patterns are:

Pattern Example Meaning
Single tag I 0.0 Advance when input I0.0 is TRUE.
AND of tags I 0.0 & I 0.1 Advance when both inputs are TRUE.
OR of tags I 0.0 OR I 0.1 Advance when either is TRUE.
Falling edge FN I 0.2 Advance on falling edge of I0.2.
Comparison MW10 > 50 Advance when word memory > 50.
Time tag T 5 Advance when IEC timer T5 Q bit is TRUE.

2.2 Why "just add another condition" is the wrong first instinct

The naive way to conditionally act inside a step is to add the condition to the transition that precedes the step. This works, but it forces the sequence into a coarser grain: instead of one step expressing "valve open", the program must split into "valve open while X" and "valve open while NOT X". That explosion of steps inflates the chain, makes the diagnostic view unreadable, and breaks the 1:1 mapping between the mechanical sequence and the Graph chain. The interlock exists specifically to avoid this.

3. Interlock Function - Conditional Action Execution Within a Step

The interlock C_n is a Boolean expression attached to step S_n. Unlike the transition, the interlock does not affect step activation: the step remains active regardless of the interlock state, and the transition after the step is evaluated exactly as if the interlock did not exist. The interlock's sole purpose is to suppress or enable interlock-dependent actions.

An action is declared interlock-dependent by writing the qualifier followed by C, for example:

A1 "Motor_Run" NC Q 0.0;

The trailing C means "qualifier N, only fire when this step is active AND the interlock is satisfied." If you omit the C the action fires unconditionally as long as the step is active.

3.1 Step Activation Truth Table

Step active Interlock C_n Transition T_n TRUE? Action with NC fires? Action with N fires? Step leaves to next?
FALSE - - No No No
TRUE FALSE FALSE No Yes No
TRUE FALSE TRUE No Yes Yes
TRUE TRUE FALSE Yes Yes No
TRUE TRUE TRUE Yes Yes Yes

The decisive row is row 2 / 4: with the interlock not satisfied, unconditional actions still execute and the transition can still fire. This is the property that makes interlocks powerful - they can suppress a physical action without freezing the sequence.

3.2 Practical Example: Suppress Cylinder Extend on Door Open

Imagine a step S5 "Extend cylinder" where the cylinder should only move if a safety door is closed.

Wrong approach (transition-only): add I0.0 (DoorClosed) AND I0.7 (AutoStart) to the transition. Result: the cylinder simply does not extend when the door is open, but the operator cannot see why, and downstream steps depending on cylinder-extended feedback will never run.

Right approach (interlock):

// Step S5 "Extend cylinder"
// Interlock C5:   "Door closed AND E-Stop OK AND Air pressure > 4 bar"
C5    I 0.0 & I 0.3 & (IW 64 > 40.0);
A1    "Extend_Cyl"    NC    Q 1.4;   // only extends when C5 satisfied
A2    "Step_Active"   N     M 50.0; // always visible to HMI
A3    "Fault_Latch"   S     M 51.0; // sticky fault - interlock drops while S5 active

When the door opens mid-step, the cylinder retracts (or simply stops, depending on the valve), but the step remains active. As soon as the door closes, extension resumes. The HMI bit M50.0 stays lit so the operator always knows which step the machine is in. A non-stored "fault" A3 can latch an alarm the moment the interlock drops.

4. Action Qualifier Reference

The qualifier is a single letter (or letter pair) that controls the timing relationship between step activation and the output. The full set, per the S7-GRAPH V5.3 manual, is:

Qualifier Behavior Typical use
N Non-stored: output TRUE while step active, FALSE when step exits. Energize coil, run motor.
S Set (stored): output latched TRUE the moment step becomes active; never auto-cleared. One-shot trip, latched alarm.
R Reset: output cleared the moment step becomes active; only re-set by another S-action. Fault reset, permissive kill.
D Time-delayed: after the step has been active for the configured delay, output TRUE for the configured pulse width. Soft-start ramp, debounced trigger.
L Time-limited: output TRUE while step active, but auto-reset after the configured duration. Lubrication shot, valve purge.
NC Non-stored, interlock-dependent. Safety-gated motion.
SC Stored, interlock-dependent. Latched fault while unsafe.
RC Reset, interlock-dependent. Conditional reset on permissive.
DC / LC D or L variants that additionally require the interlock to be TRUE. Gated timed action.
CS / CR Initial-condition set / reset on sequencer startup. Power-on default state.

The S qualifier is particularly powerful and dangerous: a stored action stays TRUE after the step exits, even across mode changes. Always pair every S action with a corresponding R action in another step.

5. Supervision (Timeout) - The Interlock's Older Sibling

Each step can carry an optional supervision (Uberwachung) expression U_n. The supervision is conceptually the opposite of the transition: instead of testing "can we leave?", it tests "have we been here too long?". When the step becomes active, an internal timer starts. If the supervision condition goes FALSE while the timer is running, no action is taken. If the step is still active after the configured time and the supervision expression is FALSE, the supervision fault bit is set:

  • S_n.U or S_n.SA (supervision activated flag)
  • S_n.SB (supervision error / timeout flag)

The recommended pattern is to OR the supervision error bit into the sequencer's acknowledge input and into the HMI fault page. A typical use: in step "Wait for clamp closed", supervise that I0.5 (ClampClosed) == TRUE within 5 s; if not, fault "Clamp failed to close".

5.1 Supervision vs. Interlock vs. Transition

Element Evaluated when? Effect on step Effect on actions Fault output
Transition T_n Every scan while S_n active Deactivates S_n, activates S_(n+1) Indirect (step exit) None
Interlock C_n Every scan while S_n active None Gates NC/SC/RC/DC/LC actions None built-in (use NC action)
Supervision U_n Every scan while S_n active, with timer None None Sets S_n.SB

6. Transition vs Interlock: Side-by-Side Comparison

The question from the original poster (Martin) - "what's the difference between putting the condition in the interlock vs. putting it in series with the transition?" - reduces to four engineering tradeoffs:

  1. Step count: Interlock keeps the chain compact (one step). Transition forces a new step per condition combination.
  2. Operator visibility: With an interlock the operator sees "machine is stuck in step 5 waiting for door" because the active step indicator is unaffected. With a transition-only approach the machine appears "idle" (no active step), which is harder to diagnose.
  3. HMI fault reporting: An interlock can be wired directly to an alarm via an NC action; a transition-based guard requires external logic to detect the stuck state.
  4. Mode switches: An interlock automatically re-fires actions as soon as the condition returns, no extra logic needed. A transition-only design would need a self-holding step or a re-entry logic block.

Rule of thumb: if the condition is safety-related, likely to flap, or should produce an alarm, use the interlock. If the condition is the natural completion signal of the step (cylinder reached end position, operator pressed Start), use the transition.

7. Manual / Automatic Control Patterns

The Siemens manual and experienced practitioners both recommend that automatic outputs not be driven directly from inside the Graph chain if any form of manual jog, inch, or maintenance mode is required. The reason: Graph action bits are pure outputs of the sequencer; if a maintenance operator also needs to drive the same coil from an HMI button, you have to OR the two sources somewhere, which makes the wiring hard to read.

7.1 Recommended Pattern - Output Map Outside the Sequencer

// FB70 instance DB contains action bits "Motor_Run.A", "Valve1.A", ...
// FC200 "OutputResolver" combines Auto + Manual:

A "Motor_AutoRun"   = DB70.DBX10.0;   // from Graph action
A "Motor_ManReq"    = I 100.0;        // from HMI jog button
A "EStopOK"         = I 0.3;

O "Motor_AutoRun";
O "Motor_ManReq";
A "EStopOK";
= Q 1.0;                              // physical motor contactor

// Manual lockout:
A "Mode_Sel" == 1;                    // 0 = Auto, 1 = Manual
JC NO01;
L 0;
T Q 1.0;
NO01: NOP 0;

This pattern keeps the sequencer simple, lets the operator jog freely in manual mode without disturbing Graph state, and centralizes E-Stop logic. A second FC feeds the Graph FB's SW_AUTO, SW_MAN, SW_TAP, and step-selection parameters from the HMI.

7.2 Pattern - All Outputs Inside the Sequencer

If the machine has no manual mode (typical for high-volume packaging or process skids), driving outputs directly from actions is acceptable and produces a more compact program. The risk: any future addition of an HMI jog forces a refactor of every affected step.

8. Best-Practice Philosophies for S7-Graph Programs

Drawing on field experience and the design guidance in the S7-GRAPH V5.3 manual:

  1. One mechanical state, one step. Resist the urge to "save steps" by combining two physical motions into one step with two actions. The diagnostic view becomes useless.
  2. Transitions for completion, interlocks for permission. If the machine has finished, leave. If the machine cannot proceed safely, stay.
  3. Use S/R pairs, not bare S. Every stored action needs a matching reset action; otherwise the only way to clear the bit is a power cycle.
  4. Always supervise steps that wait on a field device. Cylinders, motors, and analog setpoints all need a "must happen within X seconds" rule.
  5. Keep the chain shallow. A flat chain of 30 steps is far easier to follow than a 10-step chain with 5 alternative branches and 3 parallel branches.
  6. Comment every transition with the event, not the tag. "Cylinder extended" beats "I 0.5" in 6 months when you have forgotten what I0.5 is.
  7. Export the chain to ProAgent / S7-PDIAG. The sequencer generates all the necessary tags automatically; you only need to enable the option in the FB properties.
  8. Never branch on a transition whose preceding interlock can drop mid-step. If C5 can fall FALSE, an alternative branch off T5 may activate the wrong path.

9. Commissioning and Verification Steps

Before signing off an S7-GRAPH block:

  1. Open the FB in STEP 7 / TIA Portal and confirm the operating mode switch SW_AUTO, SW_MAN, SW_TAP, and SW_TIP are correctly mapped to your mode-selector bits.
  2. Force every transition expression TRUE one at a time using the VAT table; verify the active step indicator advances and that the active step bit S_n.X follows the chain.
  3. With the machine in a safe state, drop the interlock of one step while it is active and confirm (a) the interlock-dependent action drops, (b) unconditional actions stay asserted, (c) the step does not exit prematurely, and (d) the HMI displays the correct step name.
  4. For each supervised step, simulate the no-completion condition and verify that S_n.SB latches the supervision fault and that the HMI annunciates the correct message.
  5. Test the mode switch Auto ↔ Manual mid-step; the chain must hold its current step and not jump or reset.
  6. Power-cycle the PLC. Verify that INIT_SQ (initialize sequencer) brings the chain to the configured initial step and that all CS/CR actions fire correctly.

10. Common Pitfalls and Troubleshooting Matrix

Symptom Likely cause Fix
Step never advances, transition is TRUE on the VAT but stays FALSE in the chain. The FB is being called in OB1 with the wrong instance DB, or the FB is not being called at all. Verify the call in OB1 references the same DB number as the Graph FB instance.
NC action fires when interlock is supposed to be FALSE. Interlock expression evaluates to TRUE due to a default tag value or uninitialized memory. Initialize all interlocks on first scan; check for overlapping tag ranges.
Stored output never clears. Missing R-action. Add an R-action in a later step, or call ACK_SF from the operator panel.
Supervision fault trips immediately on entry. Supervision timer set to zero, or condition already FALSE at step entry. Set U-time to a realistic value; verify the supervision expression is TRUE on entry.
Manual jog works, but auto runs the machine in the wrong state. Output map FC not gated by mode selector. Add the Auto/Manual gate (see section 7.1).
Two steps active simultaneously. An alternative branch's transition can be TRUE on both paths in the same scan (race condition). Add mutually exclusive transitions; use step-number qualifiers in the transitions.
Operator cannot see which step is active. HMI not polling the sequencer's S_NO / S_ACT word. Enable the standard diagnostic DB and bind S_NO to the HMI step-number tag.

11. Training and Reference Resources

Beyond the on-disk help (which the original poster rightly described as opaque in places), the following official Siemens resources are available:

  • S7-GRAPH V5.3 for S7-300/400 - Programming Sequential Control Systems - the canonical reference. Download PDF (1137630) from the Siemens Industry Online Support portal. Read chapters 3 (Working with Steps and Transitions), 5 (Actions and Action Qualifiers), and 6 (Monitoring and Diagnostics).
  • SITRAIN self-study courses - Siemens' blended-learning catalog covers S7-GRAPH via web modules plus a one-day classroom component.
  • Function Manual "S7-GRAPH V5.4 / V5.5 for S7-300/400 and WinAC" - the more recent revision; structure is identical to V5.3, but adds coverage of the TIA Portal integration for S7-300/400 and the S7-1500 instruction set.
  • S7-PDIAG / ProAgent - the optional add-on that auto-generates the HMI fault masks from the supervision events; recommended for any machine going to production.

What is the practical difference between an S7-Graph transition and an interlock?

A transition (T_n) is the Boolean condition that deactivates the current step and activates the next one. An interlock (C_n) is a separate Boolean condition attached to a step that gates only interlock-dependent actions (qualifiers NC, SC, RC, DC, LC). The interlock does not change the active step; it only suppresses or enables specific outputs while the step remains active.

Can I use the interlock as a safety interlock for an S7-Graph step?

Yes, but only for SIL 1 / Category 2 applications or below. For higher safety integrity, route the safety signal into an F-CPU (e.g., S7-300F / S7-1500F) or a safety relay and bring its permissive output into the Graph interlock. The interlock logic itself is not fail-safe - it executes in the standard user program.

How do I trigger an action only while both the step is active and an interlock is TRUE?

Use the NC, SC, RC, DC, or LC qualifier. Example: A1 "Motor_On" NC Q 0.0; - the motor output follows step activation, gated by the interlock. If the interlock drops mid-step, the motor turns off but the step remains active.

What is the S/R qualifier pair in S7-Graph?

S (Set) latches the assigned operand TRUE the instant the step becomes active; it stays TRUE even after the step exits. R (Reset) clears the operand the instant the step becomes active. Always pair every S action with a matching R action in a later step, otherwise the bit can only be cleared by a power cycle or by an explicit reset FB input.

Should outputs be driven from inside the S7-Graph chain or from a separate output block?

If the machine has any form of manual jog, inch, or maintenance mode, drive outputs from a separate FC that OR-combines the Graph action bits with manual request bits and gates both by E-Stop and mode selector. If the machine is pure automatic with no manual override, driving outputs directly from action qualifiers is acceptable and produces a more compact program.

Back to blog