You are on page 1of 27

Introduction and Basics

Sequencer 1 Initial step S1 Open alternative branch Open simultaneous branch Transition T1 S2 S5 S6 T4 S8 T6 T9 Sequencer 2 S7

T2 S4

T5

T7 S9

Close simultaneous branch Close alternative branch T3

T9 S8 Jump to step 8

Branch stop

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 1

SITRAIN Training for


Automation and Drives

Contents

Page 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

Objectives ........................................................................................................................................ Types of Controls .......................................................................................................................... Principle of a Logic Control System Program .................................................................................... Sequential control system .................................................................................................................... Sequencer: Representation to IEC 61131-3 ...................................................................................... Basic Elements of a Sequencer to IEC 61131-3: Step ..................................................................... Basic Elements of a Sequencer to IEC 61131-3: Transition ............................................................. The S7-GRAPH Software Package...................................................................................................... S7-GRAPH - Technical Data ........................................................................................................... Basic Elements of a Sequencer: Step and Transition ...................................................................... Creating a Sequencer Function Block .............................................................................................. The S7-GRAPH Interface (1) ......................................................................................................... The S7-GRAPH Interface (2) ......................................................................................................... Representation Types of a Sequencer.................................................................................................. Additional Elements of the Sequencer.................................................................................................... Branches .......................................................................................................................................... Sequencers ...................................................................................................................................... Names for Steps and Transitions; Numbering .................................................................................. Simple Standard Actions in Steps .................................................................................................... Creating Executable Blocks ............................................................................................................. Saving Sequencers ........................................................................................................................ Integrating FB Call in OB1 ................................................................................................................. Permanent Instructions ..................................................................................................................... Exercise 1 : Task Description ............................................................................................................ Symbols used ..................................................................................................................................... Exercise 2 : Configuring Linear Sequencers ...................................................................................... SITRAIN Training for Automation and Drives

Page 1

ST-7GRAPH Introduction and Basics

Objectives

Basic elements of sequencer structures Standard step and transition programming Operating basics for the GRAPH7 Editor Compiler settings for compiling

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 2

SITRAIN Training for


Automation and Drives

SITRAIN Training for Automation and Drives

Page 2

ST-7GRAPH Introduction and Basics

Types of Controls
Programmable controllers

Logic control

Sequential control system

Time-driven sequential controls

Process-driven controls

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 3

SITRAIN Training for


Automation and Drives

Definitions

As implied by the name, logic controls provide the states of the outputs through logic combinations of inputs. The functions primarily used are basic logic functions of Boolean algebra (AND; OR; NOT XOR) and set and reset functions. Programming languages such as ladder diagram and function block diagram are used for defining the relationships between inputs and outputs. What distinguishes a logic control from a sequential control is the time-invariant, unmodifiable relationship between inputs and outputs. This means that regardless of the state history, the initial state is only a function of the inputs and not a function of the timer state or process state. Conversely, the sequential control processes the individual control operations and tasks step by step, in a specific sequence. Execution is controlled by a socalled sequence processor. The individual dwelling states of the sequencer are called steps. Changing from one step to the subsequent one (or to several subsequent steps) is called transition. Transition is only performed if specific criteria called step enabling conditions have been met. The criteria for step enabling conditions can be either characteristic sizes for describing the process state or time intervals. Control technology differentiates between time-driven and process-driven sequential control systems.

SITRAIN Training for Automation and Drives

Page 3

ST-7GRAPH Introduction and Basics

Principle of a Logic Control System Program


Diagram of a fill-level control

Pump 1

PROCESS
Inlet valve

CONTROL
Hardware User program

Inputs Outputs

overflow Full

Correction

Query input signals Generate limit values Control pumps etc.

Empty
M

Messages Outlet valve

Pump 2

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 4

SITRAIN Training for


Automation and Drives

General

The most common automation task is gating input signals whose results of logic operation (RLOs) are assigned to outputs for actuators and displays. In principle, for such tasks to be carried out you differentiate between logic controls and sequential controls. The whole process is generally divided into individual technological functions. Partial functions of this whole process are implemented as logic controls if they are not executed in any specific chronological order and they trigger reactions that are temporally independent of one another. For example, a fill level controller (see diagram) with upper limit monitoring, control and activation of pumps and valves with message output functionality is programmed as a logic control system. The individual program sections - such as querying input signals, supplying RLOs and assigning them to outputs for actuators and displays - are not temporally interconnected or processed stepby-step. Therefore, the logic controller program mainly consists of a description of the static connections between input and output signals.

Example

SITRAIN Training for Automation and Drives

Page 4

ST-7GRAPH Introduction and Basics

Sequential Control System


S1: T2: S2: T3: S3: T4 : S4: T1: Go to initial position Initiator triggered? Completion report for Bay 1 Acknowledge switch bay 1?... Conveyor drive right Light barrier reached? Remove part Conditions for initial position?

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 5

SITRAIN Training for


Automation and Drives

General

A sequential control is a program which executes a temporally defined series of events until completion (sequentially). The control task is divided into individual steps and programmed as a sequencer. Actions are assigned to each step to activate and control command output. The sequencer is executed step by step. Execution of the next step in the series is controlled by transitions and step enabling conditions. If a step is active, the assigned transitions are executed. At the same time, the next transition is activated and its step enabling conditions are logically scanned. If the conditions are met, the previous step is deactivated and the following one activated.

Industrial Application In real industrial scenarios, a combination of sequential and logic controls is often used. Operating mode blocks and message blocks are generally implemented as logic controls. The machining process as such is programmed as sequential control.

SITRAIN Training for Automation and Drives

Page 5

ST-7GRAPH Introduction and Basics

Sequencer: Representation to IEC 61131-3


S1 #Activate_Step_1 #Station_X_Transp_Start T2 S2 #Activate_Step_2 N #Activate_Stat_Y L #Transp_Start_L / R

Sequencer: Implementation in STEP 7 (FBD)


Sequencer: Command output (actions):

_Activate #Step_1 #Stat_X _Transp_Start

&
_Activate #Step_1 R #Activate _Step_2 S

#Processing_ Sequence_XYZ #Activate _Step_2

&

>=1

#Activate _Stat_Y = #Transp _Start_L/R

(other conditions)

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 6

SITRAIN Training for


Automation and Drives

Transitions

Transitions are step enabling conditions, i.e. the conditions which must be met to progress from one step to the next. Step enabling conditions can be process signals (e.g. signals from sensors, limit switches, etc.) and/or the result of logic combinations. The step variables are managed in the sequencer program part. The user defines the order in which the manufacturing process is to run. Generally, a separate network is created for each step variable. A step variable is set when the preceding step is active AND the transition associated with this step is fulfilled. At the same time the preceding step is reset under the same conditions. Scanning both conditions (preceding step AND transition) prevents a step from being erroneously activated at the wrong time. The only task the sequencer program part carries out is setting and resetting step variables; it does not control process actuators or execute actions. In the command output program part the user defines which actions are to be performed in which step. One or more actions are assigned to each step. In turn, the following properties can be assigned to these actions: D = delayed (time-delayed after the step is activated) N = not stored (action is only executed for the duration during which the step is active L = limited (limited in time, even if the step is active for a longer time)

Sequencer

Command Output

SITRAIN Training for Automation and Drives

Page 6

ST-7GRAPH Introduction and Basics

Basic Elements of a Sequencer to IEC 61131-3: Step


Step: Graphic representation with directed links " * * * " = Step name

* * *

* * *

Initial step Graphic representation with directed links " * * * " = Initial step name

Action block with actions

* * *

"a"

"b" "d"

"c"

"a": "b": "c": "d":

Identifier character (operation e.g. S ) Action name (e.g. MOTOR 1) Boolean "display" variable Action in: (e.g. declaration + STL code)

Actions are controlled according to specific rules that are described in detail in the IEC1131-3 standard. 1. Action block for activation 2. Enable / interlock of individual actions 3. Step switching

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 7

SITRAIN Training for


Automation and Drives

Representation

Representation of the sequential control language used for programming the sequencers is specified in the IEC 61131-3 standard. This standard covers a large part of the language elements for Sequential Function Chart (SFC). S7GRAPH also belongs to the SFC group and is mainly programmed with IEC elements. A sequencer contains the following main elements:

Step

A step is represented by a rectangular symbol with a step name. A step contains a finite number of actions (command outputs) with the associated interlocks and supervisions. Consecutive steps are connected via transitions. The initial step defines the sequencer's starting point. Activation takes place without querying further conditions. All other step variables are deactivate/reset, i.e. the sequencer is initialized. The active initial step returns the information that no other step is active. You can configure one action block in each step which contains the command output of the sequencer, i.e. activation of the actions. Actions consist of an activation that either controls an actuator/motor or an internal element e.g. flag. The various activation possibilities are programmed separately for each step in the action block. The associated enables, interlocks and supervisions must also be defined.

Initial step

Action Block

Action

SITRAIN Training for Automation and Drives

Page 7

ST-7GRAPH Introduction and Basics

Basic Elements of a Sequencer to IEC 61131-3: Transition

** ** **
%IX2.4 %IX2.3

A transition represents the condition whereby control passes from one or more steps preceding the transition to one or more successor steps along the corresponding directed link. Each transition shall have an associated transition condition which is the result of the evaluation of a single Boolean expression. %IX2.3 and %IX2.4 stand for corresponding absolute or symbolic operands.

** ** **

Additional graphical elements, such as branches (alternative, simultaneous), jumps and loops are described in subsequent chapters of this manual.

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 8

SITRAIN Training for


Automation and Drives

Transition

A transition consists of a graphic element (link between two steps with a line and an interruption line (break) with a transition name. A transition consists of x (0 <= x <= n) step-enabling conditions that enable the next step when the logic is fulfilled or lock in the event of an error. A step enabling condition consists of a signal query. It is possible to either query an external signal (e.g. input I 1.0) and/or internal signals (e.g. memory bit M 2.0) or the result of an arithmetic function.

SITRAIN Training for Automation and Drives

Page 8

ST-7GRAPH Introduction and Basics

The S7-GRAPH Software Package Tool for programming sequencers


Compatible with IEC 61131-3 Designed to meet the requirements of manufacturing technology Graphic division of the process sequence in steps and transitions Steps contain actions Transitions check the step enabling conditions
S1

T1 S2 S5 S6

T4

T2

T5

Automation of subsequent phases


Planning, configuring Programming Test Startup Maintenance, diagnostics
S4

T3

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 9

SITRAIN Training for


Automation and Drives

S7-GRAPH

With the S7-GRAPH programming language you can clearly and quickly configure and program sequential sequences that you would like to control with an S7 automation system. The process is divided into individual steps with their own functional scope. The sequence is displayed in a graphical representation. Text and images can be added for documentation. The actions to be executed are defined in the individual steps; progressing to the next step is controlled by the transitions (step enabling conditions). Their definitions, interlocks or monitoring functions are defined via a subset of the STEP 7 programming languages FBD (function block diagram) or LAD (ladder diagram). S7-GRAPH for S7-300/400 is fully compliant with the programming language definitions in the IEC 61131-3 standard. The following functions are supported: Multiple sequencers in the same S7-GRAPH function block Free numbering (1 to 999) of steps (max. 250 per sequencer) and transitions (max. 250) Simultaneous and alternative branches (max. of 250) Jumps (also to other sequencers) Start/stop of sequencers as well as activating/stopping steps. Display active steps or faulty steps Status display and monitoring of variables Switchover between operating modes: Manual, Automatic and Jog mode Overview, single-page or single-step display Graphic separation of interlock conditions (interlock, max. 32 conditions), actions (max. 100 per step) and monitoring conditions (supervision, max. 32 conditions). Page 9 ST-7GRAPH Introduction and Basics

Functionality

Test Functions

Operator Interface

SITRAIN Training for Automation and Drives

S7-GRAPH - Technical Data

Representation Sequential control/structure Sequencers per function block Steps per sequencer Parallel branches Alternative branches Transition Step

Memory requirements for sequencer admin Memory location for sequencers CPU with 8KB block size CPU with 16KB block size

Full graphic Control in function block Any number 250 250 125 32 conditions 32 interlock conditions 32 supervision conditions 100 actions with system-integrated qualifiers 5KB per FB (full code) 8KB (jointly used standard FC for all sequencers) n * 130 bytes (n = number of sequencers) Approx. 50 steps (with option standard FC) Approx. 100 steps (with option standard FC)

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 10

SITRAIN Training for


Automation and Drives

SITRAIN Training for Automation and Drives

Page 10

ST-7GRAPH Introduction and Basics

Basic Elements of a Sequencer: Step and Transition

S1 Step 1

Step 1 Action Action

Motor Limit switch

T1 Transition 1
Step enabling conditions Step 2 Action Action Input 1 Input 2

S2 Step 2

T2 Transition 2
Step enabling conditions

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 11

SITRAIN Training for


Automation and Drives

Overview

A sequential control is a control with step by step execution. It advances from one step to the next when the step enabling condition has been fulfilled. Therefore, with sequential controls it is characteristic to divide the control tasks into Steps and Transitions (step enabling conditions) A sequencer consists of steps and transitions. The sequencer is stored in an FB. An instance DB which contains the data for the sequencer is assigned to the FB. At least three blocks are required for an executable program: The FB containing the sequencer(s) An instance DB with the data for the sequencer An organization block, a function block or a function with the FB call. When the function block is called, the para- meters and the number of the instance DB are transferred.

Sequencers

OB1 Call FB sequencer

FB Sequencer

DB Instance DB

SITRAIN Training for Automation and Drives

Page 11

ST-7GRAPH Introduction and Basics

Creating a Sequencer Function Block

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 12

SITRAIN Training for


Automation and Drives

Overview

S7-GRAPH FBs can either be created using the SIMATIC Manager or the S7-GRAPH editor. In both cases, you need to create a project and user program first. Proceed as follows to create a S7-GRAPH function block with the SIMATIC Manager: 1. Open the user program in which the FB is to be created. 2. Select the menu item Insert S7 Block Function Block 3. In the "Properties" dialog box enter the number of the FB (e.g. FB 80) and select GRAPH as creation language. Click "OK". 4. Double-click the created block. The S7-GRAPH editor is launched and the block is opened. Context-sensitive help is provided to assist during input and editing of the sequencer. The toolbars contain icons for quick access to commonly used commands. You can select the following toolbars via the View Toolbars menu command: Standard: Functions for file operations (Open, Save, etc.) and for editing (Copy, Paste, etc.). View: Functions for different display options Sequencer Functions for inserting sequencer elements in the program. Ladder diagram/function block diagram: Functions for inserting LAD/FBD elements in the program. You may move the individual toolbars to any position you like in the S7-GRAPH Editor by simply clicking the gray part of the toolbar and dragging it to the desired location.

Creating the FB

S7-GRAPH Editor

Note

SITRAIN Training for Automation and Drives

Page 12

ST-7GRAPH Introduction and Basics

The S7-GRAPH Interface (1)

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 13

SITRAIN Training for


Automation and Drives

Operator Interface

The S7-GRAPH operator interface is organized in different working windows which can be displayed or hidden as required. You can optimize display for your task at hand by maximizing, minimizing or resizing these windows. Editing window (1): The sequential control is displayed in the work area where it can be edited. You can define the structure of the sequencers here or program the individual actions and conditions. Variable declaration window (2): The variable declaration window is to the left of the work area and, as the name implies, is used for declaring variables. The declaration sections are displayed in the left half of the variable declaration window. On the right-hand side, detailed information is displayed for the section selected on the left. If you wish to make changes to existing parameter sets, you can edit them in the variable declaration window. You cannot edit system parameters; they can only be deleted. You can also declare custom parameters. Output window (3). Errors and warnings are displayed in this window. The window is automatically opened after each compilation run (Save). You can also display it by selecting the menu command View Outputs. With variable declaration you define the local variables and parameters for the sequencer function block. Variable declaration consists of the following sections: Contains the input parameters as well as predefined parameters IN: for controlling the sequencer (Options Block Settings Compile / Save) OUT: Contains the custom parameters as well as the predefined output parameters IN_OUT: Contains the input/output parameters STAT: Contains the custom parameters as well as the static variables

Declaration of Variables

SITRAIN Training for Automation and Drives

Page 13

ST-7GRAPH Introduction and Basics

The S7-GRAPH Interface (2)

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 14

SITRAIN Training for


Automation and Drives

Compilation

The Compile/Decompile Messages tab displays any errors and warnings issued by the compiler after compiling the sequencer. The Addresses tab displays a list of the operands together with their addresses, symbols and data types. With the Monitoring test function and Single Step or Permanent Instructions setting, this tab contains an additional column which displays the current status value of the operands. The Forward Cross References tab displays all operands which are supplied in the current block and scanned in other blocks. The Backward Cross References tab displays all operands which are evaluated in the current block and supplied in other blocks.

Addresses

Forward Cross References

Backward Cross References

SITRAIN Training for Automation and Drives

Page 14

ST-7GRAPH Introduction and Basics

Representation Types of a Sequencer

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 15

SITRAIN Training for


Automation and Drives

General

The S7-GRAPH Editor offers various display modes for editing sequencers and their elements such as steps and transitions, branches, jumps, sequence ends and comments. The display modes are set via the following menu command: View Sequencer / Single-Step / Permanent Instructions or selected via the toolbar. This display provides an overview of the sequential control. It is particularly suitable for configuring the sequencer structure. Multiple sequencers in one function block are displayed next to one another. The overview contains the block comment, step and transition names as well as step and transition numbers. Single page displays actions, step numbers and names, the step enabling condition for the transitions, transition numbers and names, and the block comment. Multiple sequencers in one FB are displayed below one another. This display mode is used for configuring as well as for programming a sequential control. This display mode shows one step at a time with its associated transitions with all content. In this display mode, you can program supervisions and interlocks in addition to the actions and step enabling conditions. You can also edit step comments in Single Step display. This window is for programming permanent instructions. Permanent instructions are conditions and/or block calls which are located before or after the sequencer. They are executed once per scan cycle regardless of the state of the sequencer.

Overview

Single Page

Single Step

Permanent Instructions

SITRAIN Training for Automation and Drives

Page 15

ST-7GRAPH Introduction and Basics

Additional Elements of the Sequencer


Sequencer 1 Initial step S1 Open alternative branch Open simultaneous branch Transition T1 S2 S5 S6 T4 S8 T6 T9 Sequencer 2 S7

T2 S4

T5

T7 S9

Close simultaneous branch Close alternative branch T3

T9 S8 Jump to step 8

Branch stop

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 16

SITRAIN Training for


Automation and Drives

Overview

When you create a sequencer, functions are provided to assist in graphic programming. It is easy to create a sequencer structure without programming expertise as you simply arrange S7-GRAPH structure elements to form a representation of the sequencer. A sequencer consists of a series of steps and transitions. This series can be linear or branched. The commands for the plant are formulated in the steps. The transitions contain the conditions for advancing from one step to the next (step enabling conditions). The elements that can be used to create a sequencer are displayed by the icons below. You can select these icons from the toolbar. Step transition pair Jump Alternative branch, open Sequencer end Alternative branch, closed Simultaneous branch, open Simultaneous branch, closed Insert sequencer

Syntax

Icons are also available for permanent instructions and for changing the insert mode. Editing There are two edit modes for inserting elements: Insert Direct: In this mode you start by selecting the position in the sequencer where you would like to insert an element, then you select the element you wish to insert. Insert Preselection: In this mode you start by selecting the element you wish to insert, then move the mouse pointer to the position where you would like to insert the element. Page 16 ST-7GRAPH Introduction and Basics

SITRAIN Training for Automation and Drives

Branches
Alternative branch Simultaneous branch

1st priority

2nd priority

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 17

SITRAIN Training for


Automation and Drives

Alternative

Only one alternative branch can be activated and executed. If several opening transitions are fulfilled at the same time, the left-most branch (main branch) is given the highest priority. The priority decreases from left to right. Simultaneous branches allow simultaneous activation and execution of multiple steps in parallel. The (opening) transition before the opening branch ensures that the start is fully synchronous for all the first steps. From this point, the individual branches can run fully autonomously. The only common feature is the operating mode activated for the FB/DB and its functions until the simulataneous branch is closed. When closed, all the participating branches are closed to the left (as displayed in diagram). The next transition only becomes valid when all branches have activated their last steps prior to the convergence. The last steps of the faster branches then remain active until the last branch has reached the step that precedes the closing branch. The next transition (after the closing branch) will only become TRUE when all steps prior to the simultaneous convergence are active. The step in the left branch is enabled. The alternative branch (divergence) corresponds to an EXCLUSIVE OR branch. The left branch is also called the main branch (1st priority). The simultaneous branch corresponds both at opening and closing to synchronized AND branch. It can also be beneficial to include so-called waiting steps in the faster branches of the simultaneous branches.

Simultaneous

Note

SITRAIN Training for Automation and Drives

Page 17

ST-7GRAPH Introduction and Basics

Sequencers

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 18

SITRAIN Training for


Automation and Drives

New Sequencer

Any number of sequencers can be created in one sequencer block (FB with GRAPH creation language). You insert a new sequencer via the menu command Insert / Sequencer in Overview view. The sequencer is inserted graphically in the same window (sequencer FB). Depending on the display type, the sequencer will appear in the next free space in the window (from left to right) or below (if there is no space to the right). A GRAPH-7 FB with a finite number of sequencers and an associated instance data block represents a sequencer group. All sequencers combined in one FB have a common operating mode and common functions which are activated for all the incorporated sequencers.

Sequencer

Note

SITRAIN Training for Automation and Drives

Page 18

ST-7GRAPH Introduction and Basics

Names for Steps and Transitions; Numbering

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 19

SITRAIN Training for


Automation and Drives

Transition

The step enabling conditions to the next step are defined in transitions. A transition is always active together with the preceding step and enables the next step when the network returns RLO 1. The transition number is assigned by the system. You can, however, change the number for transitions individually. Transitions without programmed conditions are empty transitions. The preceding step is run once only and the following step becomes valid (compiler warning). If both the transition before a step and the transition after a step are valid at the same time, the default settings of the sequencer determine how to proceed. In the menu Options Block Settings / Compile / Save , select the function "Skip Steps". Then the above mentioned step does not become active. The following functions are possible as conditions for a transition: Binary functions AND/OR in FBD/LAD; negation Comparison functions Time monitoring T (entire activation time of the associated step) Time monitoring U (undisturbed activation time of the associated step) The steps and transitions are automatically numbered in GRAPH. User-defined adaptations can be made via the menu command Edit Numbering. The extended name for steps can be entered in the first line of the action table.

Empty Transition

Skipping Steps

Conditions

Note:

SITRAIN Training for Automation and Drives

Page 19

ST-7GRAPH Introduction and Basics

Simple Standard Actions in Steps

N: S,R: D: L: CALL:

Non-stored set, reset Time delayed, non-latching Time limited, non-latching, assignment limited in time Block number

Action_block_1 N M1.1 S M1.2 R M1.3 D M1.4 T#1H2M3S L M1.5 T#4MS CALL FC1

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 20

SITRAIN Training for


Automation and Drives

Overview D, L, N D, L S, R CALL

All these actions are defined in the IEC 61131-3 standard under 2.6.4. The associated actions are reset as soon as the step is terminated. Times can be specified as constant or as variable. These actions are also retained after the step is completed. Block call FBi.DBi, FCi, SFBi.DBi, SFCi (i = block number): Calls the specified block. After the block is processed, execution of the sequencer program continues. You can choose either symbolic or absolute addressing for the operands in the action block. The time is specified in IEC Time Format T# , e.g. T#10s. Steps are programmed in sequencer display with additional function Conditions and Actions or in single-step display. You can insert new actions by right-mouse clicking and selecting Insert New Element Actionfrom the menu.

Note

Time Format Entering Actions

SITRAIN Training for Automation and Drives

Page 20

ST-7GRAPH Introduction and Basics

Creating Executable Blocks


DB 80
S1 Step 1

FB 80

"Motor" "Limit switch" Save sequencer as executable S7 block

Step enabling conditions

S2 Step 2

"Input 1"

"Input 2" Save sequencer as S7-GRAPH source file

S7-GRAPH source file

Step enabling conditions

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 21

SITRAIN Training for


Automation and Drives

Overview

When an S7-GRAPH function block is saved, a compilation process is triggered. A function block is created from the sequencer during this process. It can be downloaded to the automation system. You can only save errorfree control programs. If the program cannot be compiled due to errors, it cannot be saved either. If you need to interrupt your work when errors are still present, you can save the current status in an S7-GRAPH source file at any time by selecting the menu command File Generate Source File. You can set the following options in for the compilation process in the Options Block Settings | "Compile/Save" tab: Which parameters are available when S7-GRAPH FBs is called (minimum, standard, maximum or user-defined parameter set) How steps and transitions are to be stored in the instance DB (as structure arrays or individual structures) and whether this interface description is also to be downloaded to the PLC or not. Whether the created FB is to execute autonomously or whether a standard FC (FC 70 or FC 71) containing the main part of the administrative code is used. If you select the option with standard FC, more steps can be saved in the FB than with an FB that runs autonomously. Whether to write criteria analysis data in the instance DB, the function "Skip steps" is activated or whether supervision errors occurring require acknowledgement or not. Whether program and process are to be synchronized, and whether all interlock conditions are to be permanently processed. The status display will then display a missing interlock and the step that is affected. Whether to display warnings in the message window during compilation. Whether interlock and supervision errors are handled via SFC 52 (diagnostic buffer entry) or via SFC 17, 18 (send to HMI devices).

Options

SITRAIN Training for Automation and Drives

Page 21

ST-7GRAPH Introduction and Basics

Saving Sequencers
Test operation possible!
Sequencer as GRAPH block
S1S1 T1 S13 T13

No test operation possible!


representation always as S7-GRAPHSequencer Sequencer as GRAPH source file
S1 T1 S13 T13

en G at er e ce ur so

Open/ Insert GRAPH block

Save Save as

Open/ insert GRAPH source file

Save Save as

fil e

le ) pi iler m p Co om (c

Blocks

Source files

Symbols used

Entry/utilization in STEP 7 Entry/utilization in STEP 7 symbol list symbol list


SITRAIN Training for
Automation and Drives

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 22

Block

The GRAPH7 FB can be saved in the following two ways: S7-GRAPH: 1xFB and 1xDB for each sequencer element S7-GRAPH: 1xFB and 1xDB for each sequencer element + standard FC for each CPU You can only save if no errors occurred during compilation. The compiler compiles the graphs to executable S7 machine code MC7. Compiler warnings can be tolerated. After saving, the GRAPH7 FB is downloaded to the automation system and can be tested online (call required in OB1). The GRAPH7 FB can be saved as source code in ASCII format (but is always visible as graphic). This allows you to save the sequencer without compiling and checking, e.g. for backing up the data for a faulty sequencer. The source also represents an export/import interface for an ASCII editor. If you have advanced knowledge of the command syntax, you can also create a sequencer in an ASCII editor (without STEP 7 and without S7-GRAPH). S7-GRAPH uses the same symbol list as the STEP7 project in the SIMATIC Manager. It can be directly opened and edited in the GRAPH7 Editor (menu command Options / Symbol List). While working on the configuration, it is advisable to save as source code as it is quicker to open and close the sequencer. After completion, compile the source code as FB.

Source File

Symbols

Note

SITRAIN Training for Automation and Drives

Page 22

ST-7GRAPH Introduction and Basics

Integrating FB Call in OB1

Minimum FB parameter

Standard FB parameter

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 23

SITRAIN Training for


Automation and Drives

Sequencer FB

In the "Compile" tab under menu command Options Block settings, you can set whether to set minimum, standard, maximum or user-defined FB parameters.

Minimum Parameters With minimum FB parameters, the FB contains only one start parameter INIT_SQ INIT_SQ and activates its sequencers once it is has been processed in OB1. Then the sequencers are immediately executed in Automatic mode. Minimum FB parameters is used when the sequencer is only required to run in Automatic mode and no additional control and supervision functions are required. A rising edge at parameter INIT_SQ activates the initial step(s). Standard Parameters This FB setting requires you to select the operating mode in addition to the call. The standard parameter settings is used when the sequencer is to run in different operating modes and feedback about the process is required as well as support for message acknowledgements. The sequencer FB always remains in the operating mode last activated. You can only deselect this previous mode by selecting a new one. Parameters that are not required are not supplied with values. Maximum Parameters The maximum parameters setting is used when more HMI options are required for service and startup than provided by the standard parameter settings. User-Defined User-defined (GRAPH7 V5.x and higher): All parameters are provided, you can delete any that are not required. In addition, you can define user-specific parameters.

SITRAIN Training for Automation and Drives

Page 23

ST-7GRAPH Introduction and Basics

Permanent Instructions

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 24

SITRAIN Training for


Automation and Drives

Perm. instructions

Permanent instructions are conditions or block calls that can be programmed before or after the sequencer. These operations are executed once per scan cycle regardless of the state of the sequencer. You can have any number of permanent instructions for each sequencer in an FB. Each operation is provided with a number. Conditions that must be TRUE in several locations in the sequencer can be centrally programmed via permanent instructions. For example, implementing a flashing indicator light in a step. For the permanent instruction display, activate the View Permanent Instructions menu command. You can insert the required functions by activating Insert New Element Permanent Instructions Condition/Call.

SITRAIN Training for Automation and Drives

Page 24

ST-7GRAPH Introduction and Basics

Exercise 1 : Task Description

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 25

SITRAIN Training for


Automation and Drives

Task assignment Solution Integration

First integrate Assembly Bay 1 in the sequencer on the basis of the following guideline: S1: Initial setting: Activate LED for bay 1. The blank is machined and once completed is positioned on the conveyor belt in front of INI1. S2: Part_finished: The acknowledge switch at bay 1 passes the completion report to the plant. The LED at bay 1 extinguishes. If within 5 sec no completion report is issued, the buzzer is to be activated. S3: Conv_right: The conveyor belt transports the workpiece to the final assembly, i.e. light barrier LS1 must be reached. S4: Remove_part: The conveyor stops so the operator can remove the workpiece. The final assembly LED is flashing. S5: Place_blank: The light barrier remains deactivated until the operator has placed another blank. The final assembly LED displays a continuous light. S6: Conv_left: Conveyor drive back to assembly bay 1 (INI1), if light barrier LS1 is been activated by a new blank. S7: Remove unmachined part: If bay 1 is occupied again (INI1), light barrier bay 1 shall flash again to alert the operator to remove the blank from the belt. If INI1 is free again, the machining process starts again (jump to the initial setting S1 initial step).

Flashing Function Symbols

The easiest way to implement the flashing function of LED H4 in step S4 and H1 in step S7 is to use permanent instructions. Use static step flags if required. The conveyor's and simulator unit's inputs and outputs are already contained in a symbol table. Copy this table from the participant project/symbol container to your current training project.

SITRAIN Training for Automation and Drives

Page 25

ST-7GRAPH Introduction and Basics

Symbols used

SITRAIN Training for Automation and Drives

Page 26

ST-7GRAPH Introduction and Basics

Exercise 2 : Configuring Linear Sequencers

SIMATIC S7
Siemens AG, 2005. All rights reserved.

Date: File:

18.04.2005 GRAPH_02E. 27

SITRAIN Training for


Automation and Drives

Task assignment

Configure a linear sequencer, assign step and transition names and test the sequencer. 1. Open the SIMATIC Manager and create a new project called "Assembly line". 2. Depending on the hardware available on your training station (S7-300/ S7400), insert a hardware station. Configure it as follows:Clock memory byte = MB10, inputs and outputs of conveyor model are assigned to IB8 and QB8, analog potentiometer = PIW304). 3. Generate a GRAPH7 FB80 with the symbolic name "Assembly line" 4. Double-click FB80 to open it. Specify the structure of the sequencer as in the previous exercise. Set the work area of the S7-GRAPH Editor to sequencer representation. 5. Configure the required steps and actions. Use either the sequencer setting or single-step display for the work area. Assign names to the steps and transitions. 6. Save the FB80 with the Standard parameter settings and select Full Code for executability. All other settings no not need to be changed. 7. Call the FB80 with instance DB80 in OB1. Gate the input INIT_SQ with the input I 0.0 (simulator). 8. Download all blocks to the PLC and test/debug the program via the test function Monitor (menu Debug / Monitor). Or, alternatively, click the Zoom button. The active step is displayed in "green". If you need to monitor any interlock or time monitoring errors (additional Exercises), the faulty step is displayed in "red". You can monitor the signal states of the conditions and actions in the active steps.

How To Proceed

Result

SITRAIN Training for Automation and Drives

Page 27

ST-7GRAPH Introduction and Basics

You might also like