27
Page 1 SITRAIN Training for Automation and Drives ST-7GRAPH Introduction and Basics Date: 18.04.2005 File: GRAPH_02E. 1 SIMATIC S7 Siemens AG, 2005. All rights reserved. SITRAIN Training for Automation and Drives Introduction and Basics S1 S2 T1 T2 S4 T3 Initial step Transition S5 S6 T4 T5 Branch stop Open alternative branch Open simultaneous branch Close alternative branch Close simultaneous branch Sequencer 1 S7 S8 T6 T7 S9 T9 Sequencer 2 S8 T9 Jump to step 8 Contents Page Objectives ........................................................................................................................................ 2 Types of Controls .......................................................................................................................... 3 Principle of a Logic Control System Program .................................................................................... 4 Sequential control system .................................................................................................................... 5 Sequencer: Representation to IEC 61131-3 ...................................................................................... 6 Basic Elements of a Sequencer to IEC 61131-3: Step ..................................................................... 7 Basic Elements of a Sequencer to IEC 61131-3: Transition ............................................................. 8 The S7-GRAPH Software Package...................................................................................................... 9 S7-GRAPH - Technical Data ........................................................................................................... 10 Basic Elements of a Sequencer: Step and Transition ...................................................................... 11 Creating a Sequencer Function Block .............................................................................................. 12 The S7-GRAPH Interface (1) ......................................................................................................... 13 The S7-GRAPH Interface (2) ......................................................................................................... 14 Representation Types of a Sequencer.................................................................................................. 15 Additional Elements of the Sequencer.................................................................................................... 16 Branches .......................................................................................................................................... 17 Sequencers ...................................................................................................................................... 18 Names for Steps and Transitions; Numbering .................................................................................. 19 Simple Standard Actions in Steps .................................................................................................... 20 Creating Executable Blocks ............................................................................................................. 21 Saving Sequencers ........................................................................................................................ 22 Integrating FB Call in OB1 ................................................................................................................. 23 Permanent Instructions ..................................................................................................................... 24 Exercise 1 : Task Description ............................................................................................................ 25 Symbols used ..................................................................................................................................... 26 Exercise 2 : Configuring Linear Sequencers ...................................................................................... 27

02 GRAPH E Introduction and Basics

  • Upload
    serch0

  • View
    23

  • Download
    3

Embed Size (px)

Citation preview

Page 1: 02 GRAPH E Introduction and Basics

Page 1SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 1

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Introduction and Basics

S1

S2

T1

T2

S4

T3

Initial step

Transition

S5 S6

T4

T5

Branch stop

Open alternative branch

Open simultaneous branch

Close alternative branch

Close simultaneous branch

Sequencer 1

S7

S8

T6

T7

S9

T9

Sequencer 2

S8

T9

Jump tostep 8

Contents PageObjectives ........................................................................................................................................ 2Types of Controls .......................................................................................................................... 3Principle of a Logic Control System Program .................................................................................... 4Sequential control system .................................................................................................................... 5Sequencer: Representation to IEC 61131-3 ...................................................................................... 6Basic Elements of a Sequencer to IEC 61131-3: Step ..................................................................... 7Basic Elements of a Sequencer to IEC 61131-3: Transition ............................................................. 8The S7-GRAPH Software Package...................................................................................................... 9S7-GRAPH - Technical Data ........................................................................................................... 10Basic Elements of a Sequencer: Step and Transition ...................................................................... 11Creating a Sequencer Function Block .............................................................................................. 12The S7-GRAPH Interface (1) ......................................................................................................... 13The S7-GRAPH Interface (2) ......................................................................................................... 14Representation Types of a Sequencer.................................................................................................. 15Additional Elements of the Sequencer.................................................................................................... 16Branches .......................................................................................................................................... 17Sequencers ...................................................................................................................................... 18Names for Steps and Transitions; Numbering .................................................................................. 19Simple Standard Actions in Steps .................................................................................................... 20Creating Executable Blocks ............................................................................................................. 21Saving Sequencers ........................................................................................................................ 22Integrating FB Call in OB1 ................................................................................................................. 23Permanent Instructions ..................................................................................................................... 24Exercise 1 : Task Description ............................................................................................................ 25Symbols used ..................................................................................................................................... 26Exercise 2 : Configuring Linear Sequencers ...................................................................................... 27

Page 2: 02 GRAPH E Introduction and Basics

Page 2SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 2

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Objectives

Basic elements of sequencer structures

Standard step and transition programming

Operating basics for the GRAPH7 Editor

Compiler settings for compiling

Page 3: 02 GRAPH E Introduction and Basics

Page 3SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 3

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Types of Controls

Programmablecontrollers

Logiccontrol

Sequentialcontrol system

Time-drivensequential controls

Process-drivencontrols

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 so-called 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.

Page 4: 02 GRAPH E Introduction and Basics

Page 4SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 4

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Principle of a Logic Control System Program

Diagram of a fill-level control

Correction

Inlet valveM

Pump 1

Outlet valveM

Pump 2

overflowFull

Empty

PROCESS CONTROL

Hardware

User program

Query input signals

Generate limit values

Control pumps etc.

Messages

InputsOutputs

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.

Example 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 step-by-step.Therefore, the logic controller program mainly consists of a description of the static connections between input and output signals.

Page 5: 02 GRAPH E Introduction and Basics

Page 5SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 5

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Sequential Control System

S1: Go to initial position…

S2: Completion report for Bay 1…

S3: Conveyor drive right…

S4: Remove part…

T2: Initiator triggered?…

T3: Acknowledge switch bay 1?...

T4 : Light barrier reached?…

T1: Conditions for initial position?…

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.

Page 6: 02 GRAPH E Introduction and Basics

Page 6SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 6

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Sequencer: Representation to IEC 61131-3

Sequencer: Implementation in STEP 7 (FBD)

S 1#Activate_Step_1

S 2#Activate_Step_2

#Station_X_Transp_Start T 2

_Activate #Step_1

&

#Stat_X_Transp_Start R

_Activate #Step_1

S

#Activate_Step_2

Sequencer: Command output (actions):

=

#Transp_Start_L/R

>=1&#Processing_

Sequence_XYZ

#Activate_Step_2

(other conditions)

=

#Activate_Stat_Y

#Activate_Stat_Y#Transp_Start_L / R

N

L

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.

Sequencer 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.

Command Output 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 activeL = limited (limited in time, even if the step is active for a longer time)

Page 7: 02 GRAPH E Introduction and Basics

Page 7SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 7

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

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

* * * "a" "b" "c"

"d"

"a": Identifier character (operation e.g. S )"b": Action name (e.g. MOTOR 1)"c": Boolean "display" variable"d": 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 activation2. Enable / interlock of individual actions3. Step switching

Action block with actions

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). S7-GRAPH 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.

Initial step 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.

Action Block You can configure one action block in each step which contains the command output of the sequencer, i.e. activation of the actions.

Action 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.

Page 8: 02 GRAPH E Introduction and Basics

Page 8SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 8

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

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

A transition represents the condition whereby control passes fromone or more steps preceding the transition to one or more successor steps along the correspondingdirected 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 orsymbolic operands.

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

* * ** * *

* * ** * *

%IX2.4 %IX2.3

X

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.

Page 9: 02 GRAPH E Introduction and Basics

Page 9SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 9

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

The S7-GRAPH Software Package

S1

S2

T1

T2

S4

T3

S6

T4

T5

S5

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

Automation of subsequent phases • Planning, configuring• Programming• Test• Startup• Maintenance, diagnostics

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.

Functionality 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.

Test Functions • Display active steps or faulty steps• Status display and monitoring of variables• Switchover between operating modes: Manual, Automatic and Jog mode

Operator Interface • 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 10: 02 GRAPH E Introduction and Basics

Page 10SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 10

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

S7-GRAPH - Technical Data

Representation Full graphicSequential control/structure Control in function blockSequencers per function block Any numberSteps per sequencer 250Parallel branches 250Alternative branches 125Transition 32 conditionsStep 32 interlock conditions

32 supervision conditions100 actions with system-integrated qualifiers5KB per FB (full code)8KB (jointly used standard FC for all sequencers)

Memory location for sequencers n * 130 bytes (n = number of sequencers)CPU with 8KB block size Approx. 50 steps (with option standard FC)CPU with 16KB block size Approx. 100 steps (with option standard FC)

Memory requirements forsequencer admin

Page 11: 02 GRAPH E Introduction and Basics

Page 11SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 11

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Basic Elements of a Sequencer: Step and Transition

S1Step 1

S2Step 2

T1Transition 1

Motor Limit switch

Step enabling conditions

T2Transition 2

Input 1 Input 2

Step enabling conditions

Step 1

Action

Action

Step 2

Action

Action

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)

Sequencers 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.

OB1

Call FB sequencer

FB

Sequencer

DB

Instance DB

Page 12: 02 GRAPH E Introduction and Basics

Page 12SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 12

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Creating a Sequencer Function Block

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.

Creating the FB 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 Block3. 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.

S7-GRAPH Editor 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 optionsSequencer Functions for inserting sequencer elements in the program.Ladder diagram/function block diagram: Functions for inserting LAD/FBD elements in the program.

Note 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.

Page 13: 02 GRAPH E Introduction and Basics

Page 13SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 13

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

The S7-GRAPH Interface (1)

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.

Declaration of With variable declaration you define the local variables and parameters for theVariables sequencer function block. Variable declaration consists of the following sections:

IN: Contains the input parameters as well as predefined parameters 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 parametersSTAT: Contains the custom parameters as well as the static variables

Page 14: 02 GRAPH E Introduction and Basics

Page 14SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 14

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

The S7-GRAPH Interface (2)

Compilation The Compile/Decompile Messages tab displays any errors and warnings issued by the compiler after compiling the sequencer.

Addresses 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.

Forward Cross References The Forward Cross References tab displays all operands which aresupplied in the current block and scanned in other blocks.

Backward Cross References The Backward Cross References tab displays all operands which are evaluated in the current block and supplied in other blocks.

Page 15: 02 GRAPH E Introduction and Basics

Page 15SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 15

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Representation Types of a Sequencer

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 Instructionsor selected via the toolbar.

Overview 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 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.

Single Step 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.

Permanent This window is for programming permanent instructions. PermanentInstructions 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.

Page 16: 02 GRAPH E Introduction and Basics

Page 16SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 16

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Additional Elements of the Sequencer

S1

S2

T1

T2

S4

T3

Initial step

Transition

S5 S6

T4

T5

Branch stop

Open alternative branch

Open simultaneous branch

Close alternative branch

Close simultaneous branch

Sequencer 1

S7

S8

T6

T7

S9

T9

Sequencer 2

S8

T9

Jump tostep 8

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.

Syntax 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 Alternative branch, closed

Jump Simultaneous branch, open

Alternative branch, open Simultaneous branch, closed

Sequencer end Insert sequencer

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 17: 02 GRAPH E Introduction and Basics

Page 17SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 17

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Branches

Simultaneous branchAlternative branch

1st priority

2nd priority

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 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.

Note 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.

Page 18: 02 GRAPH E Introduction and Basics

Page 18SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 18

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Sequencers

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).

Sequencer A GRAPH-7 FB with a finite number of sequencers and an associated instance data block represents a sequencer group.

Note All sequencers combined in one FB have a common operating mode and common functions which are activated for all the incorporated sequencers.

Page 19: 02 GRAPH E Introduction and Basics

Page 19SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 19

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Names for Steps and Transitions; Numbering

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.

Empty Transition Transitions without programmed conditions are empty transitions. The preceding step is run once only and the following step becomes valid (compiler warning).

Skipping Steps 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.

Conditions 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)

Note: 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.

Page 20: 02 GRAPH E Introduction and Basics

Page 20SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 20

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Simple Standard Actions in Steps

Action_block_1N M1.1S M1.2R M1.3D M1.4

T#1H2M3SL M1.5

T#4MSCALL FC1

N: Non-storedS,R: set, resetD: Time delayed, non-latchingL: Time limited, non-latching, assignment limited in timeCALL: Block number

Overview All these actions are defined in the IEC 61131-3 standard under 2.6.4.

D, L, N The associated actions are reset as soon as the step is terminated.

D, L Times can be specified as constant or as variable.

S, R These actions are also retained after the step is completed.

CALL 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.

Note You can choose either symbolic or absolute addressing for the operands in the action block.

Time Format The time is specified in IEC Time Format T# …, e.g. T#10s.

Entering Actions 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.

Page 21: 02 GRAPH E Introduction and Basics

Page 21SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 21

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Creating Executable Blocks

S1Step 1

S2Step 2

"Motor" "Limit switch"

Step enabling conditions

"Input 1" "Input 2"

Step enabling conditions

Save sequencer as executableS7 block

FB 80

Save sequencer as S7-GRAPHsource file

S7-GRAPHsource file

DB 80

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.

Options 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).

Page 22: 02 GRAPH E Introduction and Basics

Page 22SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 22

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Saving Sequencers

representation always as

S7-GRAPH-Sequencer

SaveSave as

Open/insertGRAPHsource file

Source files

SaveSave as

Open/InsertGRAPH block

Blocks

S1

Generate source file

Compile

(compile

r)

Test operation possible!

No test operation possible!

Sequencer as GRAPH block

S13

T1 T13

Sequencer as GRAPH source file

S1 S13

T1 T13

S1

Symbols used Entry/utilization in STEP 7 symbol list

Entry/utilization in STEP 7 symbol list

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 CPUYou 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).

Source File 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).

Symbols 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).

Note 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.

Page 23: 02 GRAPH E Introduction and Basics

Page 23SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 23

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Integrating FB Call in OB1

Standard FB parameter

Minimum FB parameter

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.

Page 24: 02 GRAPH E Introduction and Basics

Page 24SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 24

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Permanent Instructions

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.

Page 25: 02 GRAPH E Introduction and Basics

Page 25SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 25

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Exercise 1 : Task Description

Task assignment First integrate Assembly Bay 1 in the sequencer on the basis of the following guideline:

Solution Integration • 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 finalassembly, 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 barrierLS1 is been activated by a new blank.

• S7: Remove unmachined part: If bay 1 is occupied again (INI1), lightbarrier 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 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.

Symbols 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.

Page 26: 02 GRAPH E Introduction and Basics

Page 26SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Symbols used

Page 27: 02 GRAPH E Introduction and Basics

Page 27SITRAIN Training forAutomation and Drives

ST-7GRAPHIntroduction and Basics

Date: 18.04.2005File: GRAPH_02E. 27

SIMATIC S7Siemens AG, 2005. All rights reserved.

SITRAIN Training forAutomation and Drives

Exercise 2 : Configuring Linear Sequencers

Task assignment Configure a linear sequencer, assign step and transition names and test the sequencer.

How To Proceed 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/ S7-400), 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.

Result 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.