Sequencer Programming With GRAPH and SIMATIC S7
Sequencer Programming With GRAPH and SIMATIC S7
Sequencer Programming With GRAPH and SIMATIC S7
siemens.com/sce
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved.
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
SIMATIC Controller
• SIMATIC ET 200SP Open Controller CPU 1515SP PC2 F with WinCC RT Advanced 512 PTs
Order no.: 6ES7677-2SB42-4AB1
• SIMATIC ET 200SP Distributed Controller CPU 1512SP F-1 PN Safety
Order no.: 6ES7512-1SK00-4AB2
• SIMATIC CPU 1516F PN/DP Safety with Software
Order no.: 6ES7516-3FN00-4AB2
• SIMATIC S7 CPU 1516-3 PN/DP with Software
Order no.: 6ES7516-3AN00-4AB3
• SIMATIC CPU 1512C PN with Software and PM 1507
Order no.: 6ES7512-1CK00-4AB1
• SIMATIC CPU 1512C PN with Software, PM 1507 and CP 1542-5 (CP PROFIBUS)
Order no.: 6ES7512-1CK00-4AB2
• SIMATIC CPU 1512C PN with Software
Order no.: 6ES7512-1CK00-4AB6
• SIMATIC CPU 1512C PN-1 without Power Supply / with CP for PROFIBUS DP
Order no.: 6ES7512-1CK00-4AB7
• SIMATIC S7-1200 Basic Controller, CPU 1215C; DC/DC/DC
Order no.: 6ES7215-1AG40-4AB1
• SIMATIC S7-1200 Basic Controller, CPU 1215C; AC/DC/RELAY
Order no.: 6ES7215-1BG40-4AB1
• SIMATIC S7-1200 Basic Controller, CPU 1215C; DC/DC/RELAY
Order no.: 6ES7215-1HG40-4AB1
Please note that these trainer packages are replaced with successor packages when necessary.
An overview of the currently available SCE packages is provided under: siemens.com/sce/tp
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 2
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Training courses
For regional Siemens SCE training courses, contact your regional SCE representative:
siemens.com/sce/contact
This document is only to be used for initial training on Siemens products/systems. This means it can be
copied in whole or in part and given to trainees/students for use within the scope of their training/course
of study. Disseminating or duplicating this document and sharing its content is permitted within public
training and advanced training facilities for training purposes or as part of a course of study.
Exceptions require written consent from Siemens. Send all related requests to
scesupportfinder.i-ia@siemens.com.
Offenders will be held liable. All rights including translation are reserved, particularly if a patent is granted
or a utility model or design is registered.
Use for industrial customer courses is expressly prohibited. We do not consent to commercial use of the
training documents.
We wish to thank the TU Dresden, the Michael Dziallas Engineering company and all other involved
persons for the support in the preparation of this SCE Learn-/Training Document.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 3
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Table of Content
1 Goal ...................................................................................................................................................... 6
2 Requirement ......................................................................................................................................... 6
4 Theory ................................................................................................................................................... 8
5 Task ...................................................................................................................................................... 9
6 Planning .............................................................................................................................................. 16
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 4
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 5
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
1 Goal
In this chapter, you will learn how to program a sequence control with the graphic programming tool S7-
GRAPH and about the basic elements of a control program written with GRAFCET.
The module shows the procedure in the following steps using the sorting station as an example.
– Presentation of the task with the motion sequences and switching states.
– Creation of a control program according to the produced GRAFCETs of the sorting station, which is
implemented using the S7-GRAPH programming language.
The functioning of the created program will be checked using the testing and diagnostics functions of
S7-GRAPH.
2 Requirement
This chapter builds on the hardware configuration of a SIMATIC S7. However, any hardware
configurations that have digital input and output boards can be used. You can use the following project
for this chapter, for example:
sce-012-101-hardware-config-s7-1516f …..zap15_1
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 6
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
3 SIMATIC S7 controller, e.g. CPU 1516F-3 PN/DP – Firmware V2.0 or higher with memory card and
16DI/16DO and 2AI/1AO
2 SIMATIC STEP 7
1 Engineering station Professional (TIA
Portal) V15.1 or higher
4 Ethernet connection
Panel
3 SIMATIC S7-1500 controller
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 7
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
4 Theory
4.1 Notes on S7-GRAPH programming language
S7-GRAPH
– Has been certified according to IEC 61131-3 and PLCopen Base Level since
November 2001.
– Siemens is thus the first manufacturer to receive the PLCopen certificate for the
S7-GRAPH (SFC - Sequential Function Chart) sequencer programming.
– Programmers that use S7-GRAPH create their programs strictly according to the international
standard IEC 61131-3.
Data formats, language elements and graphic representation conform to IEC 61131-3
throughout.
– The S7-GRAPH programming language extends the range of functions of STEP 7 to include a
graphic programming option for sequence controls.
– With S7-GRAPH, you can program sequence controls clearly and quickly. The process is broken
down into individual steps and the sequence is graphically represented.
– The step-enabling conditions for advancing to the next steps (transitions) can be created in the LAD
or FBD programming language.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 8
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
5 Task
5.1 Description of control task
The automated sorting station (see Figure 1) is used to separate plastic and metal components. A
component is fed to the conveyor via a chute. The conveyor starts as soon as the component has been
detected. If a component made of metal is on the conveyor, it is detected, transported up to the height
of the metal magazine and pushed by a cylinder into the metal magazine. If no metal is detected, the
component is made of plastic. The plastic component is transported to the end of the belt, where it falls
into the plastic magazine. As soon as a component is sorted, the next component can be fed.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 9
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
5.3 Switching on
The station is switched on with the main switch -Q0. Relay -K0 (main switch "ON") is energized and
provides the supply voltage for the sensors and actuators.
This operating state is indicated by indicator light -P1 (main switch on)
The selected operating mode is indicated by indicator lights -P2 (manual mode) and -P3 (automatic
mode).
When the initial state of the pushbutton and the feedback of the EMERGENCY STOP function is
present again, the release takes place and the sorting station can be put back into operation.
Activation of the EMERGENCY STOP is indicated by indicator light -P4 (EMERGENCY STOP
activated).
After pushbutton -S6 (cylinder -M4 extend) is pressed, cylinder -M4 is extended.
After pushbutton -S5 (cylinder -M4 retract) is pressed, the cylinder is retracted.
The extension and retraction of the cylinder continue only as long as the pushbutton is pressed, and the
end position has not yet been reached.
When the two pushbuttons are pressed simultaneously, no motion should take place.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 10
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
With pushbutton -S3 (manual mode conveyor -M1 forwards), motor -Q1 (conveyor motor -M1 forwards
fixed speed) is moved forward in jog mode. With pushbutton -S4 (manual mode conveyor -M1
backwards), motor -Q2 (conveyor motor -M1 backwards fixed speed) is moved backward in jog mode.
When the two pushbuttons are pressed simultaneously, no motion should take place.
For safety reasons, only the preset speed may be used here. Output -Q3 (conveyor motor -M1 variable
speed) must therefore be deactivated.
Initial state
When the station starts or after the EMERGENCY STOP is tripped, the station must be moved in
manual mode to a defined operating state (initial state). In the initial state, the conveyor is empty and
stopped and the cylinder is retracted.
If the station is in the initial state, automatic mode starts when pushbutton -S1 (automatic start) is
pressed. When pushbutton -S2 (automatic stop) is pressed, automatic mode is stopped again as soon
as the initial state has been reached.
If EMERGENCY STOP has been tripped or the operating mode has been changed, automatic mode is
stopped immediately (without return to the initial state).
The current state is indicated by indicator light -P6 (automatic mode started).
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 11
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Automatic mode
If light sensor -B4 (part at slide) detects a component, the conveyor motor starts. The component slides
onto the transport conveyor and is further conveyed.
If inductive sensor -B5 detected a metal component, this is transported up to light sensor -B6 (part in
front of cylinder -M4). The conveyor is then switched off. As soon as -B3 (sensor motor -M1 active) no
longer supplies a signal, the cylinder control (see below) is activated and moves the component into the
metal magazine. As soon as the cylinder is retracted again, the sorting station is back in the initial state.
If a metal component was not detected by sensor -B5, the component is interpreted as a plastic
component and is transported to the end of the conveyor. It is detected there by light sensor -B7 and
conveyed after a delay time into the plastic magazine at the end of the conveyor.
Cylinder control
If a metal component reaches light sensor -B6 (part in front of cylinder -M4) and the conveyor has been
stopped, cylinder -M4 moves to the front-end position -B2 (cylinder -M4 extended), thereby pushing the
metal component from the conveyor into the metal magazine. Cylinder -M4 then moves to the rear-end
position -B1 (cylinder -M4 retracted).
Fixed speed requires signal "1" at -Q1 "Conveyor motor -M1 forwards fixed speed" or -Q2 "Conveyor
motor -M1 backwards fixed speed". For variable speed, -Q3 "Conveyor motor -M1 variable speed" must
be activated and a "manipulated value for motor speed" (analog value +/-10 V corresponds to +/- 50
rpm or 10 m/s) must be specified at -U1. Signal "1" must not be present at -Q1 "Conveyor motor -M1
forwards fixed speed" or -Q2 "Conveyor motor -M1 backwards fixed speed". Otherwise, -U1 has no
effect on the speed of the conveyor.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 12
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
If switch -S0 (mode selector manual/automatic) is set to Manual, the indicator light -P2 (manual mode)
lights up. If switch -S0 is set to Automatic, the indicator light -P3 (automatic mode) lights up.
If the EMERGENCY STOP function has tripped, -P4 (EMERGENCY STOP activated) lights up.
If automatic mode has been selected and the station is in the initial state, -P5 (automatic mode started)
flashes to signal that automatic mode can be started. As soon as automatic mode has been started, -P5
lights up.
Indicator light -P6 (cylinder -M4 retracted) lights up as soon as end position sensor -B1 (cylinder -M4
retracted) has been reached. Indicator light -P7 (cylinder -M4 extended) lights up as soon as cylinder -
M4 has reached the front-end position sensor -B2 (cylinder -M4 extended). Indicator lights -P6 and -P7
are not lit if the cylinder is located in neither of the two end positions.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 13
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 14
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
NO Normally Open
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 15
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
6 Planning
In order to represent the individual requirements of the task,
the sequence diagram of the sorting station is divided into five subareas.
– The conditions for the release of the controller are defined in the first part of the sequence diagram.
– The third part of the sequence diagram shows the control of the signal lamps.
– The fourth part of the sequence diagram describes the selection of operating modes and manual
mode.
– The automatic mode of the sorting station is presented in the fifth part of the sequence diagram.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 16
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
GRAFCET RELEASE
G_Signal_Lamps
„initialize sequencer SIGNAL_LAMPS“
{INT}
G_Clock_Pulse
„initialize sequencer CLOCK_PULSE“
{INT}
2
-P1 :=1 „switch on display main switch on
3
Release „operational release“
The conditions for switching the station on and off, the operational release and the EMERGENCY
STOP function are represented in this GRAFCET.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 17
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
GRAFCET CLOCK_PULSE
100
101
Takt „clock pulse 1Hz“
GRAFCET SIGNAL_LAMPS
20
̅̅̅̅̅̅
−𝐴1
21
-P4 „display emergency stop activated“
̅̅̅̅̅̅
−𝑆0
−𝑆0
−𝐵1
−𝐵2
Only after switching on the main switch are the signal lamps for EMERGENCY STOP, the operating
mode and the cylinder position activated.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 18
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
GRAFCET OPERATING_MODES
−𝑆3 ∗ ̅̅̅̅̅̅
−𝑆4 ∗ 𝐵1
11 „inching operation
„initialize sequencer 14
G_Automatic {INT} -Q1 conveyor -M1
AUTOMATIC_MODE“
forwards“
̅̅̅̅̅̅ ∗ 𝐵1
−𝑆4 ∗ −𝑆3
0.2𝑠/𝑋11 „inching operation
-Q2 conveyor -M1
backwards“
𝑃𝑢𝑙𝑠𝑒
̅̅̅̅̅̅ ∗ −𝐵1
−𝑆5 ∗ −𝑆6 ̅̅̅̅̅̅
12 „display automatic
-P5 „inching operation
mode flash“
-M2 cylinder -M4
retract“
̅̅̅̅̅̅ ∗ −𝐵2
−𝑆6 ∗ −𝑆5 ̅̅̅̅̅̅
̅̅̅̅̅̅̅̅̅̅̅ + −𝑆0
𝑅𝑒𝑙𝑒𝑎𝑠𝑒 ̅̅̅̅̅̅ „inching operation
„automatic mode off“ -M3 cylinder -M4
extend“
−𝑆1 „start automatic mode“
„sequencer
G_Automatic {} AUTOMATIC_
13 Automatic_Mode_ „starting command for MODE off“
Start automatic mode“
̅̅̅̅̅̅̅̅̅̅̅ + −𝑆0
𝑅𝑒𝑙𝑒𝑎𝑠𝑒 ̅̅̅̅̅̅ „automatic mode off“ ̅̅̅̅̅̅̅̅̅̅̅ + −𝑆0
𝑅𝑒𝑙𝑒𝑎𝑠𝑒 „manual mode off“
The conditions for the operating mode selection and for starting of automatic mode and manual mode
are represented in this GRAFCET.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 19
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
GRAFCET AUTOMATIC_MODE
30
̅̅̅̅̅̅ ∗ −𝐵6
𝑆𝑡𝑎𝑟𝑡 ∗ −𝐵4 ∗ −𝐵5 ̅̅̅̅̅̅ ∗ −𝐵7
̅̅̅̅̅̅ ∗ −𝐵1 „start conditions:
starting command, sensor part at slide
and plant in home position“
−𝐵1
12 „conveyor
-Q1 forwards“
−𝐵1 −𝐵1
32 „conveyor 12 „conveyor
-Q1 forwards“ -Q1 forwards“
33
„conveyor stopped“
̅̅̅̅ 1
−𝐵
35 „cylinder -M4 retract“
-M2
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 20
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The next step is to select the target directory where the retrieved project will be stored. Confirm
your selection with "OK". (→ Target directory → OK)
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 21
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
(→ Import )
→ Select the desired symbol table (e.g. in .xlsx format) and confirm the selection with "Open".
→ When the import is finished, you will see a confirmation window and have an opportunity to view
the log file for the import. Click → OK.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 22
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ You have now imported the tag table of the sorting station. Save your project under the name
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 23
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 24
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Name your new function block "AUTOMATIC_MODE", set the language to GRAPH and manually
choose the number 50 for the FB number. Select the "Add new and open" check box. You are
then taken automatically to your created function block in the project view. Click "OK". (→ Name:
AUTOMATIC_MODE → Language: GRAPH → Manual → Number: 50 → Add new and open →
OK)
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 25
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ To check the specific properties of the GRAPH block, select "Properties" and select "Attributes"
under "General" (→ Properties → General → Attributes). Select the attributes as shown here.
Note:
– You can find detailed information on the attributes in the manuals or the online help.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 26
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ We need only the first three input tags. The rest of the input tags and all the output tags can be
deleted.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 27
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ According to EN 81346-2 the minus sign is placed before the letter (-B1) of the product aspect,
thus in the case of -B1 the component that signals the retracted cylinder, independent of the
wiring. For output assignments, e.g. -Q1, the component that is being controlled.
→ The GRAPH function blocks created by us are to be created in just as function-related a manner
with the same designations.
→ The same tag designations can be used for global tags as well as local tags in the TIA Portal,
which is why we can take the needed tags from the GRAFCET for the automatic mode and from
the Tag table sorting station.
→ Select the last row of the input tags with the right mouse buttons and select menu item "Add row"
(→ Input → ACK_EF → Add row)
→ Add parameter #Start as the input interface under Input in the added line and confirm the input
with the Enter key. Data type "Bool" is assigned automatically. This will be retained. Enter the
associated comment "Start command".
→ Add additional binary input parameters #-B1, #-B2, #-B4 to #-B7 under Input and check their data
types. Add descriptive comments for these.
→ Add the binary output parameters #-Q1, #-M2 and #-M3 under Output and check their data types.
Add descriptive comments for these.
→ Alternatively, you can also copy and paste these from the tag table.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 28
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Step field
A sequencer consists of a series of steps that are activated in a fixed sequence depending on the
conditions for the transition to the next step.
A step is exited when any pending faults are eliminated or confirmed and the transition condition
following the step is satisfied.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 29
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
The next step, which follows the transition whose condition is met, becomes active.
Simultaneous branches allow multiple steps following the transition to be enabled simultaneously.
A jump to any step of this or another sequencer of the same function block is available at the end of the
sequencer. This allows a cyclic operation of the sequencer. A sequence end can also be placed at the
end of the sequencer. The sequence ends here when the sequence end is reached.
Active step
The step becomes active when the conditions of the previous transition are satisfied. In addition, it
becomes active as soon as it is defined as the initial step and the sequencer has been initialized or
when it is called by an event-dependent action.
Objects of S7-GRAPH
Different views of the sequencer can be selected with the first five buttons of the toolbar.
The sixth button is used to create a new sequencer in the seventh button to delete a sequencer.
Elements of a sequencer
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 30
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The step number and the designation of the step tag must now be changed. To do so, click inside
the step field and enter a new number and designation.
→ Open the action table using the " " button in the step field.
→ Open the input window using the " " button at the transition.
→ Insert an AND logic operation with six inputs in the window of Transition 1.
→ Designate T1 – Trans1: as "start conditions", and designate the S30 – Step 30: as "initial step" in
the action table.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 31
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ To create the interconnection, drag the "Start" tag from the interface to the first input of the AND
logic operation.
→ Interconnect the AND logic operation according to the specification in the GRAFCET.
Note:
– To avoid confusion with the global tags from the "Tag table sorting station", the local tags should be
moved from the interface description using Drag & Drop. Local tags always start with a number
sign #.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 32
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag "Step and transition" onto the double arrow below Transition 1 to insert the next step with
transition. The numbering continues automatically.
→ Use Drag & Drop to move Steps S32 to S35 with their respective transitions into the work window.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 33
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ After Step 31, the sequencer is divided using an alternative branch. Use Drag & Drop to move "
Open alternative branch" onto the green square below Step 31. The alternative branch
with Transition 7 is inserted.
→ Use Drag & Drop to move "Step and transition" onto the double arrow below Transition 7 to insert
Step 36 with Transition 8.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 34
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Set an interlock condition "-(C)-" under Interlock and choose "Set as long as step is active" as
qualifier.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 35
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Note:
– You can find detailed information on interlock conditions/interlock in the manuals or the online help.
→ Tag "-B1" can now be set as the condition for the interlock in the single step view. Drag tag "-B1"
onto the input of Interlock C.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 36
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag tag "-B5" for Transition 2 and tag "-B7" for Transition 7as the step-enabling condition for the
step below.
→ Switch to the sequencer view and enter the designation "sensor metal part" for Transition 2 and
"sensor part at end of conveyor" for Transition 7.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 37
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Select and copy the first row in the action window from Step 31.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 38
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ As shown previously for Step 31, the interlock condition "-B1" must now be set as Interlock C in
Step 32 and Step 36 in the single step view by dragging from the interface. The -(C)- to the left
of the step field indicates that an interlock is programmed in this step.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 39
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The conveyor will be stopped in Step 33. An action does not have to be programmed here,
because the advancement to Step 33 causes conveyor operation "-Q1" in Step 32 to stop due the
"Set as long as step is active" qualifier. After a wait time of 0.5 seconds, the next step is to be
activated.
→ Drag the comparator "Greater than step activation time" onto the green square in the window
of Transition 4 and enter T#500MS for the time.
→ Identify the action window with "conveyor stopped" and the transition window with "waiting time
0.5s"
→ In Step 34, cylinder -M4 for pushing the metal part is to be extended by the control of "-M3" shown
here, but only as long as it has not reached its end position.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 40
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Double-click Step 34 or press the single step view button in order to input the interlock
condition in the single step view.
→ Tag "-B2" can now be set as the condition for the interlock in the single step view. Drag tag "-B2"
onto the input of Interlock C. Negate tag "-B2" because the cylinder is only driven as long as it has
not reached its end position.
→ The transition to Step 34 of the GRAFCET means: When the cylinder has reached its front-end
position "-B2", a wait time of 0.5 seconds begins. An intermediate step must be inserted for this in
S7-GRAPH.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 41
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Change the step number and the tag designations of the inserted step.
→ Change the transition number and the tag designations of the inserted transition.
→ First, drag an AND logic operation onto Transition 51 as the step-enabling condition,
and then drag tag "-B2" onto the first input of the AND logic operation. Now drag the comparator
"Greater than step activation time" onto the green square at the second input and enter
T#500MS for the time.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 42
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ In Step 35, cylinder -M4 for pushing the metal part is to be retracted by the control of "-M2" shown
here, but only as long as it has not reached its end position.
→ Tag "-B1" can now be set as the condition for the interlock in the single step view. Drag tag "-B1"
onto the input of Interlock C. Negate tag "-B1" because the cylinder is only driven as long as it has
not reached its end position.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 43
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Switch to the sequence view and enter the designation "cylinder retracted" for Transition 6.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 44
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag a jump to the double arrow and select Step 30 as the jump destination.
→ The transition after Step 36 of the GRAFCET means that a wait time of 2 seconds begins when
the plastic part has passed light sensor "-B7". In other words, when "-B7" is no longer activated,
the wait time starts. An intermediate step must be inserted for this in S7-GRAPH like for Step 34.
→ Repeat the procedure used for Step 34. (→ Select and copy Step 36 and Transition 8. → Select
Transition 8 and insert the copied step with transition. → Change step number to S361 and step
tag to Step36_1. → Change transition number to T81 and tag designation Trans8_1.)
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 45
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag tag "-B7" with Negation onto Transition 8 as the step-enabling condition.
→ First, drag an AND logic operation onto Transition 81 as the step-enabling condition,
and then drag tag "-B7" with a negation onto the first input of the AND logic operation. Now drag
the comparator "Greater than step activation time" onto the green square at the second input
and enter T#2S for the time.
→ Drag a jump to the double arrow and select Step 30 as the jump destination.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 46
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 47
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 48
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Use Drag & Drop to move your "AUTOMATIC_MODE [FB50]" function block onto the green line in
Network 1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 49
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The instance data block for this call of FB50 is created automatically. Accept the default name and
confirm with “OK”.
→ A block with the interface you defined, the instance data block and I/Os EN and ENO are inserted
in Network 1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 50
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Select the "Tag table sorting station" in the project tree and move the desired global tags from the
Details view to the interface of the block using Drag & Drop (→ Tag table sorting station → Details
view → -S0 → Start)
→ Or enter the starting letters (e.g. "-B") of the desired global tag and select the global input tag "-
B1" from the displayed list.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 51
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Negate input "-B2", because this sensor is wired as a normally closed contact. The controller
recognizes that the cylinder is in extended position ("-B2" is activated) when no voltage is present
at the terminal of input I0.6, i.e. a 0 signal is present.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 52
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 53
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
"Program blocks" folder and select the button “ ” for compiling in the menu. (→ →
Program blocks → )
→ The "Info", "Compile" area shows which blocks were successfully compiled.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 54
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 55
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 56
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ If the starting conditions are satisfied, the sequencer jumps to Step 31 and sets "-Q1" to TRUE.
→ If a metal part is now detected by sensor "-B5", the sequencer jumps to Step 32
and "-Q1" remains set to TRUE.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 57
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ If sensor "-B6" now detects the metal part in front of the cylinder, the conveyor stops and the wait
time of 0.5 seconds starts. After the time elapses, the sequencer jumps ahead to Step 34.
→ The cylinder extends and after it reaches the end position, the sequencer jumps to the next step
(Step 341). The time of 0.5 seconds starts. As long as an interlock is active, the step is displayed
in orange. After the time elapses, the sequencer jumps ahead to Step 35.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 58
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ When the cylinder has retracted, the sequencer jumps to Step 30 and waits for the next part.
A new cycle can begin.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 59
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ All inputs and settings have the same effect as the corresponding FB parameters.
→ The inputs in the "Sequence control" dialog window can differ from the settings that the
programmer has made for compiling the sequencer. The settings made here take precedence
over the other settings that were made when compiling.
Proceed as follows:
→ Once you have controlled your sequencer in manual mode, you can return to automatic mode.
→ In semi-automatic mode, you have the option of using the "Ignore transition" button to advance the
sequencer even when transition conditions are not satisfied.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 60
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
In order for the process, which may have changed in the meantime, to run automatically again and to
find the possible synchronization points, the synchronization function is available with two options:
→ To use this function, switch the sequencer to manual mode and enable the synchronization.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 61
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Right-click the suggested step to select it. In this example, it is assumed that the cylinder is
extended.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 62
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ In the project tree under Program blocks, click on "Add new block" to create a new function block.
→ Name your function block "SIGNAL_LAMPS", set the language to GRAPH and manually choose
the number 30 for the FB number. Select the "Add new and open" check box. You are then taken
automatically to your created function block in the project view. Click "OK".
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 63
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ You can find the interface description of your function block in the upper section of your
programming view. Based on the default settings in the TIA Portal, the local tags of the standard
interface parameters have already been created. If necessary, these default settings can be
changed in the settings of the TIA Portal.
→ We need only the first three input tags. The rest of the input tags and all the output tags can be
deleted.
→ The same tag designations can be used for global tags as well as local tags in the TIA Portal,
which is why we can take the needed tags from the GRAFCET for controlling the signal lamps
from previously created blocks (e.g.: FB50) or the Tag table sorting station.
→ Select the last row of the input tags with the right mouse button and select menu item "Add row"
(→ Input: ACK_EF → Add row).
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 64
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Add parameter #-A1 as the input interface under Input in the added line and confirm the input with
the Enter key. Data type "Bool" is assigned automatically. This will be retained. Finally, enter the
associated comment "notification EmergOFF".
→ Add additional binary input parameters #-K0, #-S0, #-B1 and #-B2 under Input and check their
data types. Add descriptive comments for these.
→ Add the binary output parameters #-P2, #-P3, #-P4, #-P6 and #-P7 under Output and check their
data types. Add descriptive comments for these.
→ Alternatively, you can also copy and paste these from the tag table.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 65
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The step number and the designation of the step tag must now be changed. To do so, click inside
the step field and enter a new number and designation.
→ Open the action table using the " " button in the step field.
→ Open the input window using the " " button at the transition.
→ Designate T1 – Trans1: as "main switch on", and designate S20 – Step 20: as "initial step" in the
action table.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 66
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag "Step and transition" onto the double arrow below Transition 1 to insert the next step with
transition. The numbering continues automatically.
→ In Step 21 of the GRAFCET for controlling the indicator lights, five actions with five different
interlocks are specified. Because only one interlock per step can be programmed in S7-GRAPH,
additional parallel steps must be inserted using simultaneous branches. The five actions with
interlock are then distributed among five parallel steps.
→ Drag "Open simultaneous branch" onto the green square in the window of Transition 1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 67
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag "Open simultaneous branch" onto the green square above Step 22.
→ Drag "Open simultaneous branch" onto the green square above Steps 23 and 24.
→ Drag "Close branch" onto the green square below Steps 22 to 25.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 68
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag a jump to the double arrow and select Step 20 as the jump destination.
→ Insert "-K0" with a negation as the step-enabling condition in the window of Transition 2.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 69
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ To keep a uniform structure, the inserted steps should be renamed as shown here.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 70
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The GRAPH function block is now finished and can be called for testing in OB1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 71
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Interconnect the tags of the block with the global tags of the sorting station.
→ Negate input "-B2", because this sensor is wired as a normally closed contact. The controller
recognizes that the cylinder is in extended position ("-B2" is activated) when no voltage is present
at the terminal of input I0.6, i.e. a 0 signal is present.
→ To save your project, select the button in the menu. To compile all blocks, click the
"Program blocks" folder and select the button for compiling in the menu. (→ →
Program blocks → )
→ After successful compilation, the complete controller with the created program, as previously
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 72
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ In the project tree under Program blocks, click on "Add new block" to create a new function block.
→ Name your new function block "CLOCK_PULSE", set the language to GRAPH and manually
choose the number 20 for the FB number. Select the "Add new and open" check box. You are
then taken automatically to your created function block in the project view. Click "OK".
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 73
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ You can find the interface description of your function block in the upper section of your
programming view. Based on the default settings in the TIA Portal, the local tags of the standard
interface parameters have already been created. If necessary, these default settings can be
changed in the settings of the TIA Portal.
→ We need only the first three input tags. The rest of the input tags and all the output tags can be
deleted.
→ Add the binary output parameter #Clock_Pulse under Output and check the data type. Enter
"clock pulse 1Hz" as comment.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 74
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The step number and the designation of the step tag must now be changed. To do so, click inside
the step field and enter a new number and designation.
→ Open the action table using the " " button in the step field.
→ Open the input window using the " " button at the transition.
→ Now drag the comparator "Greater than step activation time" onto the green square as the step-
enabling condition and enter T#500MS for the time.
→ Designate T1 – Trans1: as "pulse off time", and designate S100 – Step 100: as "initial step" in the
action table.
→ Drag "Step and transition" onto the double arrow below Transition 1 to insert the next step with
transition. The numbering continues automatically.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 75
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Open the action table using the " " button in the step field.
→ Open the input window using the " " button at the transition.
→ Now drag the comparator "Greater than step activation time" onto the green square as the step-
enabling condition and enter T#500MS for the time.
→ Designate T2 – Trans2: as "pulse on time", and designate S101 – Step 101: as "clock pulse 1 Hz".
→ Drag a jump to the double arrow and select Step 100 as the jump destination.
→ The GRAPH function block is now finished and can be called for testing in OB1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 76
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Interconnect the pulse tag of the block with the global tag "-P1" of the sorting station.
→ Then, click the "Program blocks" folder and select the button for compiling all blocks in the
→ After successful compilation, the complete controller with the created program, as previously
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 77
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
An event defines when an action is to be executed. You must specify an event for some action
qualifiers.
Below are the actions that always need an event, together with the associated events and a description:
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 78
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Qualifier Description
N Set to 1 as long as step is active:
The signal state of the operand is "1" as long as the step is active. The specified block is
called as long as the step is active. The step is also regarded as active in the cycle in
which the S1 event occurs. This qualifier is also used for block calls. Functions (FC) with
syntax:
CALL "<FCName>" (parameter list)
Function blocks (FB) with syntax:
CALL "<FBName>", "<DBName>" (parameter list)
S Set to 1
As soon as the step is active, the operand is set to "1" and then remains at "1".
R Set to 0:
As soon as the step is active, the operand is set to "0" and then remains at "0".
Qualifier Description
D On delay:
n seconds after the step activation, the operand is set to "1" and remains at "1" for the
duration of the step activation. This does not apply if the duration of the step activation is
shorter than n seconds. You can specify the time as a constant or as a PLC tag of data
type TIME/DWORD.
L Set for limited time:
When the step is active, the operand is set to "1" for n seconds. The operand is then
reset. The operand is also reset if the step activation time is less than the time duration.
You can specify the time as a constant or as a PLC tag of data type TIME/DWORD.
TF Turn off timer:
The timer status is set to "1" as soon as the step is activated. The timer runs when the
step is deactivated, and timer status is set to "0" only after the time expires.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 79
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
You can additionally combine actions for which you use the "S1", "V1", "A1", or "R1" event with an
interlock. The actions are then only executed if the conditions of the interlock are satisfied.
Interlock
An interlock is a programmable condition that influences the execution of individual actions. If the
combination of conditions is satisfied, actions combined with interlock are executed. Otherwise the
execution is prevented.
– The fault does not affect the advancement to the next step, however.
A programmed interlock is indicated in each view type with the letter C to the left of the step.
Interlock
No fault
condition
satisfied
L1 L0
Interlock condition
Fault
not satisfied
t
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 80
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Supervision
A supervision is a programmable condition that can prevent the advancement from one step to the next.
If the combination of conditions is satisfied, there is a fault and event V1 is signaled.
– The step activation time (step activation time U) is paused as soon as the condition is satisfied.
If the combination of conditions is not satisfied, there is a fault: If the condition of the following transition
is satisfied, the sequencer advances to the next step.
A programmed supervision is indicated in each view type with the letter V to the left of the step.
You can use supervision conditions, for example, to monitor the step activation time; in other words, the
time that has elapsed since activation of the step.
Supervision Fault
condition satisfied
V1 V0
Supervision condition not
satisfied No fault t
V1: Supervision error occurs
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 81
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
A registration is an event that is triggered outside the block. Registrations are queried via a positive
signal edge at either the "REG_S" or "REG_EF" input parameter.
If the registration occurs via the "REG_S" input parameter, the event is only forwarded to the active step
that is indicated at the "S_NO" output parameter.
If the registration occurs via the "REG_EF" input parameter, the event is forwarded to all currently
active steps.
The following figure shows the signal evaluation for an alarm and the registration:
1
A1
R1
0
t
Note:
– You can find detailed information on all actions, events and event-controlled actions in the manuals
or the online help.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 82
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ In the project tree under Program blocks, click on "Add new block" to create a new function block.
→ Name your new function block "RELEASE", set the language to GRAPH and manually choose the
number 10 for the FB number. Select the "Add new and open" check box. You are then taken
automatically to your created function block in the project view. Click "OK".
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 83
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ You can find the interface description of your function block in the upper section of your
programming view. Based on the default settings in the TIA Portal, the local tags of the standard
interface parameters have already been created. If necessary, these default settings can be
changed in the settings of the TIA Portal.
→ Here again, we need only the first three input tags. The rest of the input tags and all the output
tags can be deleted.
→ The same tag designations can be used for global tags as well as local tags in the TIA Portal,
which is why we can take the needed tags from the GRAFCET for controlling the signal lamps,
from previously created blocks (e.g.: FB50, FB30, FB20) or from the Tag table sorting station.
→ Select the last row of the input tags with the right mouse button and select menu item "Add row"
(→ Input: ACK_EF → Add row).
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 84
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ You can copy and paste the input tags #-A1, #-K0, #-S0 from the SIGNAL_LAMPS block.
→ Add additional binary input parameters #-S0 to #-S6 under Input and check their data types. Add
descriptive comments for these.
→ Alternatively, you can also copy and paste these from the tag table.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 85
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Open the action table using the " " button in the step field.
→ Open the input window using the " " button at the transition.
→ Designate T1 – Trans1: as "main switch on", and designate S20 – Step 20: as "system off" in the
action table.
→ In the GRAFCET for release of the controller, the first action in the first step is to retentively turn
off the indicator light " main switch on" on activation of the step.
→ For this, program indicator light "-P1" using event S1 and qualifier R.
→ Programmable events:
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 86
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Drag "Step and transition" onto the double arrow below Transition 1 to insert the next step with
transition. The numbering continues automatically.
→ Open the action table and designate S2 – Step 2: as " main switch on".
→ In the GRAFCET for release of the controller, the first action in the second step is to retentively
switch on the indicator light " main switch on" on activation of the step.
→ For this, program indicator light "-P1" using event S1 and qualifier S.
Use Drag & Drop to move "Open alternative branch" onto the green square below Step 2. The
alternative branch with Transition 3 is inserted.
→ Insert "-K0" with a negation as the step-enabling condition in the window of Transition 2.
→ Drag a jump to the double arrow and select Step 1 as the jump destination.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 87
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Open the input window using the " " button at Transition 3.
→ Insert an AND logic operation with eight inputs in the window of Transition 3.
→ Interconnect the AND logic operation according to the specification in the GRAFCET.
→ Open the action table for Step 3 using the " " button in the step field.
→ Drag "Step and transition" onto the double arrow below Transition 3 to insert the next step with
transition. The numbering continues automatically.
→ Open the input window using the " " button at Transition 4 and designate T4 – Trans4: as
"emergency stop operated or main switch off".
→ Drag a jump to the double arrow below Transition 4 and select Step 1 as the jump destination.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 88
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The GRAPH function block is now finished and can be called for testing in OB1.
→ Interconnect the tags of the block with the global tags of the sorting station.
→ Create the local Temp tags shown here in the interface of OB1.
→ Interconnect the tags of the block with the local Temp tags of OB1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 89
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ In the project tree under Program blocks, click on "Add new block" to create a new function block.
→ Name your new function block "OPERATING_MODES". Then set the language to GRAPH and
manually choose the number 40 for the function block number. Select the "Add new and open"
check box. You are then taken automatically to your created function block in the project view.
Click "OK".
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 90
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ You can find the interface description of your function block in the upper section of your
programming view. Based on the default settings in the TIA Portal, the local tags of the standard
interface parameters have already been created. If necessary, these default settings can be
changed in the settings of the TIA Portal.
→ We need only the first three input tags. The rest of the input tags and all the output tags can be
deleted.
→ The same tag designations can be used for global tags as well as local tags in the TIA Portal,
which is why we can take the needed tags from the GRAFCET for controlling the signal lamps,
from previously created blocks (e.g.: FB50, FB30, FB20, FB10) or from the Tag table sorting
station.
→ Select the last row of the input tags with the right mouse button and select menu item "Add row"
(→ Input: ACK_EF → Add row).
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 91
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ All tags, except for the output tags #-P5 and #Automatic_Mode_Start, can be copied and pasted
from the previously created function blocks.
→ Alternatively, you can also copy and paste these from the tag table.
→ The procedure for creating a GRAPH function block is already familiar from the previous GRAPH
function block programming.
→ Try to create the GRAPH function block FB40 according to the specified GRAFCET of the
operating mode selection on your own.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 92
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 93
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 94
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Transitions T7 and T8
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 95
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 96
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 97
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ The GRAPH function block is now finished and can be called together with the other blocks in
OB1.
→ Open OB1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 98
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Create a local TEMP tag named "#Clock_pulse" in the interface of OB1 and interconnect it with
the block of the clock pulse.
→ Interconnect the tags of the block with the global tags of the sorting station.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 99
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Interconnect the tags of the block with the global tags of the sorting station.
→ Interconnect the tags of the block with the local Temp tags of OB1.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 100
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Interconnect the tags of the block with the global tags of the sorting station.
→ Interconnect the tags of the block with the local Temp tags of OB1.
→ The OR logic operation is needed at input OFF_SQ because the sequencer can be switched off
from either the release or the operating mode selection.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 101
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
→ Then, click the "Program blocks" folder and select the button for compiling all blocks in the
→ After successful compilation, the complete controller with the created program, as previously
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 102
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 103
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 104
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
8 Exercise
8.1 Task – Exercise
In this exercise, the function block PRG_SORTING_STATION [FB1] is to be added to the created
control program
The existing block calls in OB1 are to be implemented in function block PRG_SORTING_STATION
[FB1]. The block is to be library-suitable, meaning that only local tags are to be used in the block.
The block calls of the GRAPH function blocks will therefore be implemented with a parameter instance.
Only the function block PRG_SORTING_STATION [FB1] together with the associated data block is
permitted to be called in OB1.
The automatic mode is to be changed in such a way that it does not have to be restarted for each part
but rather continues operating cyclically.
8.2 Planning
Plan the implementation of the tasks on your own.
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 105
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
9 Additional information
You can find additional information as an orientation aid to familiarize yourself or deepen your
knowledge, for example: Getting Started, videos, tutorials, apps, manuals, programming guidelines and
trial software/firmware, at the following link:
Advanced Programming
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 106
sce-052-100-graph-s7-1500-r1903-en.docx
Learn-/Training Document | TIA Portal Module 052-100, Edition 10/2019 | Digital Industries, FA
Additional information
Siemens Automation Cooperates with Education
siemens.com/sce
SCE Learn-/Training Document
siemens.com/sce/module
SCE Trainer Packages
siemens.com/sce/tp
SCE Contact Partners
siemens.com/sce/contact
Digital Enterprise
siemens.com/digital-enterprise
Industrie 4.0
siemens.com/future-of-manufacturing
Totally Integrated Automation (TIA)
siemens.com/tia
TIA Portal
siemens.com/tia-portal
SIMATIC Controller
siemens.com/controller
SIMATIC Technical Documentation
siemens.com/simatic-docu
Industry Online Support
support.industry.siemens.com
Industry Mall catalog and ordering system
mall.industry.siemens.com
Siemens
Digital Industries, FA
P.O. Box 4848
90026 Nuremberg
Germany
siemens.com/sce
For unrestricted use in educational and R&D institutions. © Siemens 2019. All rights reserved. 107
sce-052-100-graph-s7-1500-r1903-en.docx