How to Program S7-1500 Sequencers in TIA Portal Using S7-GRAPH

To implement an S7-GRAPH sequential function chart (SFC) in a SIMATIC S7-1500 PLC using TIA Portal, create an S7-GRAPH Function Block (FB), define sequential step transitions using logical expressions, and evaluate control interlocks and supervisions. Control flags manage sequencer execution by enabling step advancement, monitoring process faults, and executing mathematical or assignment actions directly within active steps.

Table of Contents

Technical Cause: Why Custom Ladder/SCL State Machines Fail

Implementing complex sequential processes using standard Ladder Logic (LAD) or Structured Control Language (SCL) state-integer variables often introduces race conditions, state machine locking, and diagnostic opacity. When multiple steps depend on non-atomic condition checks, transitions can bypass required interlocks or cause unintended parallel state execution.

S7-GRAPH implements standard IEC 61131-3 Sequential Function Charts directly inside the S7-1500 execution engine. By encapsulating step activations, transition conditions, interlocks, and supervisions into discrete state objects, S7-GRAPH enforces strict sequential evaluation and built-in fault tracking without requiring custom diagnostic logic.

Prerequisites

Before programming an S7-GRAPH sequencer in TIA Portal for an S7-1500, verify the following configuration requirements:

  • Engineering Software: TIA Portal STEP 7 Professional (V12 SP1 or higher).
  • Target Hardware: Siemens SIMATIC S7-1500 CPU (e.g., CPU 1511, 1513, 1516, or S7-PLCSIM).
  • Memory Allocation: Dedicated Instance Data Block (DB) assigned to the S7-GRAPH Function Block (FB).

Programming an S7-1500 Graph Sequencer in TIA Portal

Follow these steps to create a basic three-step sequential process with START and STOP commands using standard boolean inputs (I0.0 through I0.7).

Step 1: Create the S7-GRAPH Block

  1. Open TIA Portal and navigate to the project tree.
  2. Expand the S7-1500 CPU node and select Add new block.
  3. Choose Function block (FB), set the language to GRAPH, and click OK.
  4. Define the initial step (Step1) and sequential transitions (Trans1, Trans2, Trans3).

Step 2: Configure Sequencer Steps and Transitions

Map process conditions to transition logic to control movement through the sequence:

  • Initial State (Step1): The sequencer awaits the primary transition condition.
  • Transition 1 (Trans1): Set condition to input I0.0. When I0.0 is TRUE, execution advances from Step1 to Step2.
  • Transition 2 (Trans2): Set condition to input I0.1. When I0.1 is TRUE, execution advances from Step2 to Step3.
  • Transition 3 (Trans3): Set condition to input I0.2. When I0.2 is TRUE, execution advances from Step3 back to the initial step or sequence completion.

Plaintext

+-----------------+
       |  Step1 (Init)   |
       +-----------------+
                |
                | Trans1: I0.0 = TRUE
                v
       +-----------------+
       |      Step2      |  <--- Interlock Condition: I0.3 = TRUE
       +-----------------+
                |
                | Trans2: I0.1 = TRUE
                v
       +-----------------+
       |      Step3      |  <--- Supervision Condition: I0.4 = TRUE
       +-----------------+
                |
                | Trans3: I0.2 = TRUE
                v
       +-----------------+
       |   Sequence End  |
       +-----------------+

Configuring Interlocks and Supervisions

S7-GRAPH provides built-in mechanisms to handle process safety and operational requirements: Interlocks and Supervisions.

Method 1: Programming an Interlock Condition

An Interlock conditions the execution of specific actions within an active step.

  • Behavior: If the interlock condition is violated (FALSE), an interlock fault alarm triggers, and linked step actions are suspended. However, the sequencer does not stop state advancement; transition conditions remain active.
  • Deactivation: Interlock alarms clear automatically when the step becomes inactive or when an optional operator acknowledgment occurs.
  • Configuration Example: In Step2, assign an interlock linked to input I0.3. Connect output action Q0.1 (e.g., motor run or laser enable) to this interlock condition. Output Q0.1 energizes only while Step2 is active and I0.3 is TRUE.

Method 2: Programming a Supervision Condition

A Supervision monitors the overall validity or execution time limit of an active step.

  • Behavior: If a supervision condition evaluates to TRUE (fault detected), the step generates a supervision alarm and freezes sequencer advancement. The active step remains active, and downstream transitions are blocked until the supervision fault is cleared.
  • Configuration Example: In Step3, assign a supervision logic block controlled by input I0.4 (e.g., an emergency stop, guard door contact, or pressure fault). If I0.4 becomes TRUE while Step3 is active, the sequencer stops at Step3 and prevents Trans3 from triggering.

Executing Math and Logic Actions in Steps

Actions within S7-GRAPH steps are not limited to setting or resetting boolean bits. Complex assignments, shift operations, mathematical functions, and data transfers can be executed directly inside active steps using standard qualifiers.

Action Qualifiers and Syntax Examples

To execute logic when a step is active, select the N qualifier (Non-stored / Active while step is active) or S qualifier (Set / Stored) and enter structured syntax directly into the action field.

Action TypeQualifierS7-GRAPH Action SyntaxFunctional OperationData TransferN``"Tag_1" := "Tag_2"Copies value from Tag_2 into Tag_1 continuously while step is active.Rotate RightN``"Tag_2" := ROR("Tag_1", 3)Rotates Tag_1 right by 3 bit positions and stores the result in Tag_2.Bit ShiftN``"Tag_Out" := SHL("Tag_In", 2)Shifts Tag_In left by 2 bit positions while the step remains active.Timer StartL``T1 (PT := T#5s)Starts an internal step timer T1 with a preset duration of 5 seconds.

Sequencer Control Input Signal Mapping

To manage execution during runtime, map physical inputs or HMI variables to the standard control interface parameters of the generated S7-GRAPH block instance:

Plaintext

Inputs:
  I0.0  -> Transition 1 (Step 1 to Step 2)
  I0.1  -> Transition 2 (Step 2 to Step 3)
  I0.2  -> Transition 3 (Step 3 to End)
  I0.3  -> Interlock Condition on Step 2 (Controls Output Q0.1)
  I0.4  -> Supervision Condition on Step 3 (Blocks Transition 3)
  I0.6  -> Sequencer HALT / STOP Command
  I0.7  -> Sequencer START / RESTART Command

Verification

Confirm proper S7-GRAPH operation using TIA Portal Watch Tables or the GRAPH Online Test tool:

  1. Sequencer Advancement: Force input I0.0 to TRUE in a Watch Table; confirm Step1 deactivates and Step2 becomes active.
  2. Interlock Test: While in Step2, toggle I0.3 to FALSE. Verify that output Q0.1 de-energizes instantly while Step2 remains the active step.
  3. Supervision Fault Test: Force input I0.4 to TRUE while in Step3. Toggle I0.2 to TRUE and verify that the sequencer refuses to advance out of Step3. Clear I0.4 and confirm Trans3 triggers successfully.

Limitations and Operational Cautions

  • Safety Controller Separation: S7-GRAPH supervision conditions are designed for operational process diagnostics. Do not use S7-GRAPH supervisions as a replacement for hardware-based safety relays or PROFIsafe safety programs (e.g., S7-1500F Safety F-FBs).
  • Instance DB Memory: Modifying GRAPH step structures or adding steps during runtime requires re-initialization of the block's Instance Data Block, which will reset active steps to default states unless memory reserve is configured.
  • Timer Evaluation Scope: Timers configured within S7-GRAPH steps reset automatically when the step deactivates unless explicitly assigned with a stored (S) qualifier.

Engineer FAQ

Can S7-GRAPH programs be executed on S7-1200 controllers?

No. S7-GRAPH is natively supported on S7-1500, S7-300, S7-400, and WinAC controllers in TIA Portal, but it is not available on SIMATIC S7-1200 PLCs.

What happens to active steps if the PLC transitions from STOP to RUN?

Upon entering RUN mode, the S7-GRAPH sequencer initializes to the designated initial step (INIT_STEP) unless retentive step flags or custom initialization logic are programmed in the FB control interface.

How do I restart an S7-GRAPH sequencer after a supervision fault?

Clear the condition that caused the supervision logic to evaluate to TRUE, then issue an acknowledgment signal to the ACK_EF (Acknowledge Errors) parameter on the S7-GRAPH instance block.

Related Articles

Related Tags

Code: C277

6 respuestas