Siemens SIMATIC S7-GRAPH Manual
Siemens SIMATIC S7-GRAPH Manual

Siemens SIMATIC S7-GRAPH Manual

For s7-300/400 programming sequential control systems
Table of Contents

Advertisement

Quick Links

SIMATIC
S7-GRAPH for S7-300/400
Programming Sequential
Control Systems
Manual
order number:
This manual has the
6ES7 811-0CC03-8BA0
05/99
Edition 01
Important Notes,
Contents
Product Overview
Installation and Authorization
Designing a Sequential
Control System based on the
Example of a Drill
Working with S7-Graph
Creating a Project
Programming the Structure of
the Sequencer
Programming Actions and
Conditions
Saving and Compiling
Assigning Parameters to and
Calling the S7-Graph FB
Downloading the S7-Graph
FB and Instance DB
Monitoring and Testing the
Sequential Control System
Printing the Sequencer
Overview of All Actions
Notes on Configuration
Instance DB
Glossary
Index
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Advertisement

Table of Contents
loading

Summary of Contents for Siemens SIMATIC S7-GRAPH

  • Page 1 Important Notes, Contents Product Overview Installation and Authorization Designing a Sequential Control System based on the SIMATIC Example of a Drill Working with S7-Graph S7-GRAPH for S7-300/400 Creating a Project Programming Sequential Control Systems Programming the Structure of the Sequencer Manual Programming Actions and order number:...
  • Page 2 Trademarks SIMATIC®, SIMATIC HMI® and SIMATIC NET® are registered trademarks of SIEMENS AG. Some of other designations used in these documents are also registered trademarks; the owner's rights may be violated if they are used by third parties for their own purposes.
  • Page 3 Important Notes Purpose of the Manual This manual supports you when creating user programs in the S7-Graph programming language. It explains how to write programs and describes the elements of a sequencer. This manual applies to the S7-Graph V5.0 programming software package. Audience and Requirements This manual is intended for persons with the qualifications required for installation, operation, and programming of the described software product.
  • Page 4 Important Notes Manual and Online Help This manual is a reduced version of the online help. Online help contains more detailed information, for example with step-by-step instructions. The manual and online help have the same structure so that you can change from one to the other without difficulty.
  • Page 5 Telephone: +65 740-7000 Fax: +49 (911) 895-7002 Fax: +1 423 461-2231 Fax: +65 740-7001 E-mail: simatic.support@ E-mail: simatic.hotline@ E-mail: simatic@ Nbgm.siemens.de sea.siemens.com singnet.com.sg GMT: +1:00 GMT: -5:00 GMT: +8:00 Nuremberg Nuremberg SIMATIC Authorization Hotline SIMATIC Premium Hotline Local time: Mo.-Fr. 7:00 to 17:00...
  • Page 6 The SIMATIC Customer Support team provides you with comprehensive additional information on SIMATIC products in its online services: • You can obtain general current information: • On the Internet at http://www.ad.siemens.de/simatic • Current Product Information leaflets and downloads which you may find useful for your product are available: •...
  • Page 7: Table Of Contents

    Contents Important Notes ........................iii Product Overview ....................1-1 Installation and Authorization ................2-1 Authorization......................2-1 Installing the Authorization ..................2-2 Upgrading the Authorization ..................2-3 Uninstalling the Authorization .................. 2-4 Rules for Handling Authorizations................2-4 Installing S7-Graph ....................2-6 Uninstalling S7-Graph .....................
  • Page 8 Contents Creating a Project ....................5-1 Creating the Project in the SIMATIC Manager ............5-1 S7-Graph FB or S7-Graph Source File?..............5-2 S7-Graph FB ......................5-2 S7-Graph Source File ..................... 5-3 Opening an S7-Graph FB or an S7-Graph Source File ..........5-4 Programming the Structure of the Sequencer.............
  • Page 9 Contents Assigning Parameters to and Calling the S7-Graph FB ........9-1 Calling the S7-Graph FB in the S7 Program ............9-1 Calling the S7-Graph FB ..................9-1 Selecting an FB Parameter Set ................9-2 Parameter Sets of the FB..................9-3 Input Parameters of the S7-Graph FB ..............
  • Page 10 Contents Instance DB......................15-1 15.1 Settings for the Instance DB.................. 15-1 15.2 Assignment of Instance DB and S7-Graph FB............15-2 15.3 Automatic Creation of the Instance DB on Saving ..........15-2 15.4 Creating the Instance DB Later ................15-3 15.5 Displaying and Printing the Content of the Instance DB.........
  • Page 11: Product Overview

    Product Overview S7-Graph Programming Language The S7-Graph programming language extends the range of functions of STEP 7 by allowing you to program sequential control systems graphically. With S7-Graph, you can configure and write programs to control sequential processes with a SIMATIC programmable logic controller (PLC). The process is divided into single steps with a clearly defined range of functions.
  • Page 12 Product Overview The Blocks of a Sequential Control System A sequential control system controls the process in a fixed order dependent on certain conditions. The complexity of the sequential control system depends on the automation task. However, even the simplest system requires at least the three following blocks: •...
  • Page 13 Product Overview Section of a Sequencer with Steps and Transitions You program sequencers in the S7-Graph FB. A sequencer consists of a sequence of steps that are activated in a fixed order depending on transitions (step-enabling conditions). Step1 Action Step1 Action Motor Limit switch...
  • Page 14 Product Overview Procedure for Creating a Sequential Control System By working through the tasks listed in the table below , you will get to step step know how to program a complete sequential control system. Step Task Practical introduction based on the example of a "drill" Creating a project Programming the structure of a sequencer Programming actions and conditions...
  • Page 15: Installation And Authorization

    Installation and Authorization Authorization A product authorization is required to use the S7-Graph software package. Software protected by this mechanism can only be used when the authorization required by the program or software package is detected on the hard disk of the programming device.
  • Page 16: Installing The Authorization

    In this case, when you start S7-Graph, the time until the authorization expires is displayed. Before this time expires, you should obtain a replacement for the lost authorization from your Siemens distributor or sales office.
  • Page 17: Upgrading The Authorization

    Installation and Authorization Installing the Authorization Later If you start the S7-Graph software and there is no authorization on your system, a message to this effect is displayed. To install the authorization at a later point in time: 1. insert the authorization diskette in your floppy disk drive, for example, drive A. 2.
  • Page 18: Uninstalling The Authorization

    Installation and Authorization 4. Insert the required authorization diskette. You will then be asked whether you really want to upgrade. This is the last opportunity to cancel the upgrade. After you confirm this prompt, do not interrupt the upgrade procedure under any circumstances otherwise you will lose the authorization.
  • Page 19 Installation and Authorization Backup If a backup of your hard disk contains copies of your authorizations, there is a risk that the valid, installed authorizations will be overwritten and destroyed when you write the backup data to the hard disk. To avoid loss of the authorization by overwriting an authorized system with a backup: •...
  • Page 20: Installing S7-Graph

    Defective authorizations on a hard disk can no longer be removed with the AuthorsW authorization tool. They can even block the installation of new, valid authorizations. In this case, contact your Siemens distributor or sales office. Authorization Tool Use version V2.0 of the AuthorsW authorization tool and where possible avoid using older versions.
  • Page 21 Installation and Authorization Requirements for Installation • Microsoft Windows 95/98 or Windows NT as operating system • SIMATIC STEP 7 standard package • PC or programming device equipped as explained in the readme file A programming device (PG) is a personal computer designed specifically for use in an industrial environment.
  • Page 22 (see readme). • Defective diskette: If you discover that a diskette is defective, please contact your Siemens distributor or sales office. • If you make a mistake: Start the installation again and follow the instructions carefully.
  • Page 23: Uninstalling S7-Graph

    Installation and Authorization Uninstalling S7-Graph To uninstall the software, use the usual method under Windows: 1. Under Windows, open the dialog for installing/uninstalling programs by double- clicking the “Add/Remove Programs" icon in the “Control Panel". 2. Select the STEP 7 entry in the list of installed programs. Click the "Add/Remove"...
  • Page 24 Installation and Authorization S7-GRAPH for S7 300/400 Programming Sequential Control Systems 2-10 C79000-G7076-C526-01...
  • Page 25: Designing A Sequential Control System Based On The Example Of A Drill

    Designing a Sequential Control System based on the Example of a Drill Welcome to the S7-Graph Beginner’s Example If you take an hour to work through the beginner’s example, you will learn how to create a sequential control system for automating the drill as described below. You first learn how to configure a sequential control system efficiently and will then be guided step by step through the tasks you need to perform in the SIMATIC Manager and in S7-Graph so that you can...
  • Page 26 Designing a Sequential Control System based on the Example of a Drill Requirements To allow you to program and test the "drill" example, you require the following hardware and software: • Programming device/PC with STEP 7 standard package and the S7-Graph optional package MPI connection to the programmable logic controller •...
  • Page 27: Technological Task And Functional Diagram

    Designing a Sequential Control System based on the Example of a Drill Technological Task and Functional Diagram Task You want to program a sequential control system to automate a drill. The setup of the drill is shown by a technological drawing and the process sequence in the form of a function diagram.
  • Page 28: Selecting The Structure Of The Sequencer

    Designing a Sequential Control System based on the Example of a Drill Initial State The initial state of the drill is defined as follows: • The drill motor and cooling pump are stopped • The carriage/drill is in the upper position •...
  • Page 29 Designing a Sequential Control System based on the Example of a Drill Dividing the Drilling Process into Individual Steps - Structure of the Sequencer The drilling process is described by S7-Graph in the form of a sequencer. A sequencer represents a sequence of single steps and conditions that control how the process moves on to the next single step.
  • Page 30: Defining The System Signals

    Designing a Sequential Control System based on the Example of a Drill Defining the System Signals Once you have broken down the drilling operation into individual steps, you should then define the input and output parameters for each step. The basis of the concept design is the technological drawing and the flowchart.
  • Page 31: Creating The Drill Project In The Simatic Manager

    Designing a Sequential Control System based on the Example of a Drill Creating the Drill Project in the SIMATIC Manager Creating a Project Projects for sequential control systems do not differ from other projects in STEP 7. To create a new project in the SIMATIC Manager, follow the steps outlined below: 1.
  • Page 32: Creating A Symbol Table

    Designing a Sequential Control System based on the Example of a Drill Creating a Symbol Table When you program in STEP 7, you work with addresses such as I/O signals, memory bits, counters, timers, data blocks, and function blocks. You can access these addresses in your program in absolute format (for example I1.1, M2.0, FB21).
  • Page 33: Creating An S7-Graph Fb And Programming A Sequencer

    Designing a Sequential Control System based on the Example of a Drill Creating an S7-Graph FB and Programming a Sequencer Create an S7-Graph FB The S7-Graph FB will contain the sequencer. To create an S7-Graph FB, follow the steps outlined below: 1.
  • Page 34 Designing a Sequential Control System based on the Example of a Drill 4. Select the button Close alternative branch button and then select transition 3. 5. Now complete the sequencer structure by first selecting transition 6 and then clicking the Insert jump button and then selecting step 1.
  • Page 35 Designing a Sequential Control System based on the Example of a Drill 7. Select the Close alternative branch button and select first transition 8 and then transition 3. 8. Close the sequencer structure with the following button Insert jump button by selecting first transition 6 and then step 1.
  • Page 36: Programming Step Actions

    Designing a Sequential Control System based on the Example of a Drill Programming Step Actions There are also two methods available for programming step actions and transitions: Direct and Drag & Drop. The procedure described below assumes you have selected the menu command Insert > Drag & Drop: 1.
  • Page 37 Designing a Sequential Control System based on the Example of a Drill 4. If you wish, you can also enter a comment for the sequencer. In all views, the comment field is at the top left and can be opened by clicking it with the mouse. The following figure shows the completed sequencer.
  • Page 38: Programming Monitoring Functions

    Designing a Sequential Control System based on the Example of a Drill When programming comparators, you can use the system information for steps as the addresses. The addresses have the following significance: • Step_name.T: current or last activation time of the step •...
  • Page 39: Specifying The Standard Function Block

    Designing a Sequential Control System based on the Example of a Drill 3.10 Specifying the Standard Function Block If you work with default system compilation option "Standard FC required", an executable S7-Graph program requires the standard function block FC70/72, that contains the run-time system of an S7-Graph sequencer.
  • Page 40: Including The Sequencer In The Step 7 Program

    Designing a Sequential Control System based on the Example of a Drill 3.12 Including the Sequencer in the STEP 7 Program Programming OB1 The sequential control program for the drill is called and started in organization block OB1. You can create OB1 in LAD, FBD, STL or SCL (here it was created in LAD).
  • Page 41 Designing a Sequential Control System based on the Example of a Drill S7-GRAPH for S7-300/400 Programming Sequential Control Systems 3-17 C79000-G7076-C526-01...
  • Page 42: Downloading The Program To The Cpu And Testing The Sequencer

    Designing a Sequential Control System based on the Example of a Drill 3.13 Downloading the Program to the CPU and Testing the Sequencer Downloading the User Program To allow you to download the program to the CPU, you must download all the blocks (DB1, FB1, OB1, FC72 or FC70/71) to the CPU of the programmable controller in the SIMATIC Manager.
  • Page 43: Test Function: Control Sequencer

    Designing a Sequential Control System based on the Example of a Drill 3.14 Test Function: Control Sequencer Control Sequencer is a test function with which you can test the sequencer in S7-Graph in all modes. All the settings and entries for the dialog box have the same effect as the corresponding FB parameters.
  • Page 44: Changing The Sequencer

    Designing a Sequential Control System based on the Example of a Drill Setting the Mode If you click one of the round option buttons, you switch the sequencer to the selected mode. You can, for example, run your sequencer in the manual mode instead of the automatic mode.
  • Page 45 Designing a Sequential Control System based on the Example of a Drill Downloading the Modified Sequencer Once you have compiled the sequencer, you must download it to the CPU. You can download the sequencer in the SIMATIC Manager or in the S7-Graph editor. In the S7-Graph editor, follow the steps outlined below: 1.
  • Page 46 Designing a Sequential Control System based on the Example of a Drill S7-GRAPH for S7 300/400 Programming Sequential Control Systems 3-22 C79000-G7076-C526-01...
  • Page 47: Working With S7-Graph

    Working with S7-Graph Aims This chapter explains how to get started with S7-Graph. The chapter also describes the user interface and shows you how to customize its appearance. Prior Experience In terms of handling, S7-Graph is a typical Windows (95/98/NT) program. It is assumed that you have experience in working with Windows programs.
  • Page 48: The S7-Graph User Interface

    Working with S7-Graph The S7-Graph User Interface Elements of the S7-Graph User Interface This section describes the elements of the user interface numbered in the figure. • Title bar of the S7-Graph editor (1) • Menu bar (2) • Toolbars (3), (4), (6), (7) •...
  • Page 49 Working with S7-Graph • Message window Title Bars Title bars are always located at the upper edge of a window in this case the window of S7-Graph (1). Apart from the standard Windows buttons, the title bars contain the following information: •...
  • Page 50 Working with S7-Graph Status Bar The status bar is at the bottom edge of the main window of S7-Graph. By selecting the menu command View > Status Bar, you can display or hide the status bar. The status bar contains the following information: •...
  • Page 51: Settings For The Work Area

    Working with S7-Graph Message Window The message window is used to display errors and warnings that occur for example after compiling the sequencer. This is not a separate window but is anchored to the work area. You can toggle the display of the message window on or off as required.
  • Page 52 Working with S7-Graph Note To program the contents of the steps and transitions, select the single page or single step level. Single Page Display At the single page level, the entire system structure with all the sequencers contained in the FB and the contents of the steps and transitions is displayed. Several sequencers are displayed one above the other .
  • Page 53 Working with S7-Graph Single Step Display At the single step level, only one step-transition pair is displayed. All the detailed information can be programmed at this display level, as follows: • Action: Actions executed within the step • Supervision: Conditions for monitoring the displayed step •...
  • Page 54: Customizing Display Level, Colors And Fonts

    Working with S7-Graph Setting a Display Level To set a display level: 1. Open the View menu. 2. Select the display level suitable for the current task: Overview for structuring the sequencers or Single page to display the structure with actions and conditions or Single step to program individual steps and transitions.
  • Page 55 Working with S7-Graph Specifying a Zoom Factor for the Current Display You can adapt the size of the current display to suit its contents by selecting the menu command View > Zoom Factor. If you select a zoom factor that would make text too small to be legible, the step and transition names are no longer displayed and only the numbers of steps and transitions are visible.
  • Page 56 Working with S7-Graph Displaying and Hiding Apart from displaying individual steps and transitions, S7-Graph provides further options in the work area. Select the required menu commands from the View menu: • To display a comment field: View > Display with > Comments •...
  • Page 57 Working with S7-Graph Color You can change the color of the following elements: Element Create Mode Monitor Mode Selected element Selected element Step active/transition valid Elements Step not active Inactive step Error Operator input error Disturbed step LAD/FBD satisfied Satisfied conditions in transitions, supervision conditions and interlocks LAD/FBD not satisfied Non-satisfied conditions in transitions,...
  • Page 58: Tools For Editing The Sequencer

    Working with S7-Graph Ladder Logic Addresses and Action Lines You can decide the maximum number of characters permitted for a LAD/FBD address or an action line. For the view in the program, you can limit the address to one line. Tip: If the LAD/FBD address or the action line is not displayed completely in a particular view, you can display the complete name as a tooltip by positioning the mouse pointer on the relevant address or action.
  • Page 59: Editing The Sequencer With The Toolbars

    Working with S7-Graph 4.5.2 Editing the Sequencer with the Toolbars The way in which you edit a sequencer with the buttons of the toolbar is decided by the menu command Insert > Drag & Drop or Insert > Direct. • In the Drag & Drop editing mode, you drag an element button (symbol) from the toolbar to the required position.
  • Page 60 Working with S7-Graph Searching for Occurrences of an Address This function displays a table showing all points at which the selected address is used in the entire S7 program. The table contains information about the following: • Block: Indicates the block in which the address is used •...
  • Page 61: Creating A Project

    Creating a Project Aims This chapter explains how you create and open your project. The chapter also explains criteria with which you can decide whether to work with an S7-Graph FB or S7-Graph source file. Steps to Create a Project All the information about a sequential control system is contained in a STEP 7 project.
  • Page 62: S7-Graph Fb Or S7-Graph Source File

    Creating a Project Inserting an S7 Project in the Project In the SIMATIC Manager, you create an S7 program with the menu command Insert > Program > S7 Program. The system then automatically creates the folders for source files, blocks and the symbol table. An empty OB1 is created in the Blocks folder.
  • Page 63: S7-Graph Source File

    Creating a Project Rules for Creating the S7-Graph FB The S7-Graph FB is saved in the Blocks folder. The following rules apply: • You can program the sequencer with absolute and symbolic addresses. • The FB is displayed depending on its location: offline: The FB is displayed from the hard disk of the programming device along with the symbols and comments.
  • Page 64: Opening An S7-Graph Fb Or An S7-Graph Source File

    Creating a Project Opening an S7-Graph FB or an S7-Graph Source File You can open an S7-Graph FB or an S7-Graph source file either in the SIMATIC Manager or in S7-Graph. Note If you create a new FB in S7-Graph, this is opened directly. Opening in the SIMATIC Manager In the SIMATIC Manager, follow the steps outlined below: •...
  • Page 65: Programming The Structure Of The Sequencer

    Programming the Structure of the Sequencer Aims The section below explains the rules and elements for creating a sequencer. OB/FB/FC DB i FB i Comment for ... CALL FBi,Dbi SQ_INIT:= The heart of a sequential control system is made up of the S7-Graph FBs (1). These contain the following: •...
  • Page 66: Sequencer - Principle

    Programming the Structure of the Sequencer Sequencer - Principle A sequencer consists of a series of steps and transitions that are activated in a fixed order depending on the step enabling conditions. How a Sequencer is Executed A sequencer is always executed starting with •...
  • Page 67: Structures Of A Sequencer

    Programming the Structure of the Sequencer Structures of a Sequencer The simplest structure of a sequencer is a linear sequence of steps and transitions without branches. A linear sequencer starts with a step and finishes with a transition that can be followed either by a jump to any step or by a branch stop.
  • Page 68: Rules For The Structure Of A Sequencer

    Programming the Structure of the Sequencer Rules for the Structure of a Sequencer The structure of the sequencer must satisfy the following rules: • An S7-Graph FB can contain and execute up to 8 sequencers at the same time. contain up to 250 steps and 250 transitions. Steps and transitions can only be inserted as pairs.
  • Page 69: Step-Transition Pair And Initial Step

    Programming the Structure of the Sequencer Simultaneous Branch Close Branch Stop Insert Sequencer You program the structure of the sequencer at the overview or single page display level. Tip: The overview level shows you the structure of the sequencer in the most compact form.
  • Page 70: Jump

    Programming the Structure of the Sequencer Jump A jump is the change from a transition to any step within the sequencer or within another sequencer in the same FB. A jump always follows a transition and closes the sequencer or the path of the branch at this point.
  • Page 71: Alternative Branch

    Programming the Structure of the Sequencer Alternative Branch An alternative branch consists of more than one parallel path (a maximum of 125). Each path in an alternative branch begins with a transition. Only the branch path whose transition switches first is executed. An alternative branch therefore corresponds to an OR operation in which only one path can be active.
  • Page 72: Simultaneous Branch

    Programming the Structure of the Sequencer Simultaneous Branch A simultaneous branch consists of more than one parallel path (a maximum of 249) each of which starts with a step. The path are executed simultaneously. A simultaneous branch corresponds to an AND branch. The transition before the simultaneous branch (in the figure T1 and T7) activates the first steps of the individual simultaneous branch paths.
  • Page 73: Branch Stop

    Programming the Structure of the Sequencer Branch Stop A branch stop at the end of a linear sequencer (1) or at the end of a path of an alternative branch (2) terminates the sequencer. The sequencer is not executed cyclically. A branch stop at the end of a path of a simultaneous branch (3) terminates only this path.
  • Page 74: Permanent Instructions

    Programming the Structure of the Sequencer 6.11 Permanent Instructions Permanent instructions are conditions (1) and block calls (2) located before or after the sequencer. These are executed once per scan cycle regardless of the state of the sequencer. You can program any number of permanent instructions in an S7-Graph FB. Each permanent instruction is assigned a number.
  • Page 75: Block Comment

    Programming the Structure of the Sequencer Permanent Block Call Blocks that were created in a programming language other than S7-Graph can be called using permanent block calls in an S7-Graph FB. After the called block has been executed, the execution of the S7-Graph FB is continued. When using a block call, note the following points: •...
  • Page 76 Programming the Structure of the Sequencer S7-GRAPH for S7 300/400 Programming Sequential Control Systems 6-12 C79000-G7076-C526-01...
  • Page 77: Programming Actions And Conditions

    Programming Actions and Conditions Aims The section below describes how to fill out the structure of the sequencers with content. You will learn (almost) everything about: • Actions with their categories and components and how to make them dependent on events •...
  • Page 78: Actions

    Programming Actions and Conditions Actions In the steps, you program actions that, for example, control the inputs, outputs and memory bits, activate or deactivate the steps of the sequencer or call blocks. This means that actions contain instructions for process control. These actions are executed in order from "top"...
  • Page 79: Standard Actions

    Programming Actions and Conditions Standard Actions Standard Actions - With and Without Interlock All standard actions can be combined with an interlock. The actions are only executed when the conditions of the interlock are fulfilled (letter C added). Standard actions without an interlock are executed as long as the step is active. Instruction Address Address...
  • Page 80: Event-Dependent Actions

    Programming Actions and Conditions Time Constant All actions that contain the instructions D or L require a time to be specified. Times are programmed as constants with the syntax T#<const> and can be combined as required. <const>= nD (n days), nH (n hours), nM (n minutes), nS (n seconds), nMS (n milliseconds), where n = a number (integer) Example: T#2D3H: time constant = 2 days and 3 hours Example: Action Table with Standard Actions...
  • Page 81 Programming Actions and Conditions Supervision • V1: Supervision error occurred (disturbance) • V0: Supervision error cleared (no disturbance) Disturbance Interlock • L0: Interlock condition entering state • L1: Interlock condition leaving state (for example disturbance) • C: Interlock condition is satisfied [C = 0] Message and Registration •...
  • Page 82 Programming Actions and Conditions Event Instruction Address Address Meaning: Identifier Location S0, V0, L0, L1 N, R, S, Q,I,M,D After the event is detected, the following applies to the next step cycle: CALL FB, FC, SFB, block number • Address has signal state 1 (N) once •...
  • Page 83: Counters, Timers And Arithmetic In Actions

    Programming Actions and Conditions Example: Action Table with Event-Dependent Actions Step4 Step4 S1 RC A1.0 V1 OFF S_ALL FC10 L0 CALL (1): As soon as the step is active and the interlock is satisfied, output Q1.0 is set to 0 and remains set to 0. (2): As soon as the supervision error occurs, all active steps are deactivated, except for step S4 in which the action is located.
  • Page 84 Programming Actions and Conditions Event Instruction Address Address Meaning: Identifier Location S1, S0, L1, L0, CR[C] Reset: As soon as the event occurs [and V1, V0, A1, R1 the interlock is satisfied], the counter value is reset to 0. [ ] = optional supplement to interlock; x = number of the counter Initial Counter Value All actions containing the CS instruction require an initial counter value.
  • Page 85 Programming Actions and Conditions Event Instruction Address Address Meaning: Identifier Location S1, S0, L1, L0, TD[C] Latching on delay, latching behavior of the V1, V0, A1, R1 timer bit (status of the timer): As soon as the event occurs, the timer starts. The condition C is only relevant for the point at which the timer starts.
  • Page 86 Programming Actions and Conditions Time (duration) All actions containing one of the TL or TD instructions require a time (duration) to be specified. The time is programmed with the following syntax: <time> = IWy, QWy, MWy, LWy, DBWy, DIWy; variable of the type S5TIME, WORD;...
  • Page 87 Programming Actions and Conditions 16 Bits 32 Bits Bits BYTE CHAR WORD S5TIME DWORD DINT REAL TIME TIME_ á á BYTE := 8 Bits á á CHAR := á á á á á á WORD := Bits á á á á...
  • Page 88 Programming Actions and Conditions Assignments with Built-in Function Assignments with a built-in Function are entered with the syntax A:=func(B). These assignments are essentially conversions functions and complex math functions. The assigned address A specifies the data type of the expression. You can use the following assignments with a built-in function: Assignment with Comment...
  • Page 89 Programming Actions and Conditions Assignments with Operator Enter assignments with an operator with the syntax A:=B<operator>C. These assignments are basic math functions and bit logic operations. The assigned address A specifies the data type of the expression. You can use the following assignments with an operator: Assignments with Comment...
  • Page 90: Conditions

    Programming Actions and Conditions Example: Action table with counters and arithmetic as alternative to counting step activations Step4 Step4 S1 CU S1 N A:=A+1 Two alternatives for counting production cycles: (1): As soon as the step is active, the counter C23 is incremented by 1. The counter therefore counts the number of times the step is activated.
  • Page 91 Programming Actions and Conditions Transition In a transition, you program conditions that control how the sequencer switches from one step to the next. Interlock Supervision Step1 Step1 S1 RC A1.0 V1 OFF S_ALL I 2.3 L0 CALL FC10 Trans1 I 2.5 A transition is displayed and programmed at the single step and single page display levels.
  • Page 92 Programming Actions and Conditions Interlock An interlock is a programmable condition for interlocking the step that influences the execution of individual actions. I 2.3 I 2.5 Interlock Supervision Step1 Step1 S1 RC A1.0 V1 OFF S_ALL FC10 L0 CALL Trans1 If the logic operation of the conditions is satisfied, the actions combined with interlocks are executed.
  • Page 93: Ladder Logic Elements For Programming Conditions

    Programming Actions and Conditions A programmed supervision is indicated by the letter V to the left of the step at all display levels. You program supervisions at the single step display level. A maximum of 32 Ladder Logic/FBD elements can be programmed per supervision. The result is managed automatically by the system.
  • Page 94 Programming Actions and Conditions Ladder Logic Element Address Data type Memory Description Area Compare box IN1: First INT/ DINT/ I, Q, M, data The compare box has the signal comparison REAL/ (double) state "1" when the comparison value TIMER/ word between the two addresses IN1 CONST and IN2 is true.
  • Page 95 Programming Actions and Conditions Ladder Logic Element Address Data type Memory Description Area <address> BOOL I, Q, M, data "Set coil" is only executed when the result of logic operation (RLO) of Address the previous permanent instructions -----(S) is "1". The <address> is then set to "1".
  • Page 96: Logic Operations With Ladder Logic Elements

    Programming Actions and Conditions Entering Addresses There are two ways of entering addresses: • Click the placeholder "??.?" of the required text field. Then enter an absolute or symbolic address (for example I1.0, "limit_switch"). You can use both the German mnemonics (E, A) and the English mnemonics (I, O) for addresses. Set the mnemonics you require in the SIMATIC Manager.
  • Page 97: Fbd Elements For Programming Conditions

    Programming Actions and Conditions FBD Elements for Programming Conditions FBD Elements An FBD program follows the signal flow of a logic string. The individual FBD elements carry binary information: Signal state "0" (current not flowing) or "1" (current flowing). FBD Element Address Data type Memory...
  • Page 98 Programming Actions and Conditions FBD Element Address Data type Memory Description Area IN2: INT / DINT / I, Q, M, D, L, Note: Second REAL constant When you enter the comparator comparison you only need to specify the data value type D/R/I explicitly when you enter the 32 bit values without specifying a type (for example when...
  • Page 99 Programming Actions and Conditions Rules for Entering FBD Elements When entering FBD elements, keep to the following rules: • All elements and branches must be connected together. • Each branch in an FBD network must contain at least one FBD element. Modes for Inserting FBD Elements There are two editing modes available for inserting FBD elements: •...
  • Page 100: S7-Graph Addresses In Conditions

    Programming Actions and Conditions S7-Graph Addresses in Conditions It is possible to use system information about steps as addresses in transitions, supervisions, interlocks, actions, and permanent instructions. Address Meaning Used in Si.T Current or last activation time of step i Comparator, assignment Si.U...
  • Page 101: Supervision Errors And Acknowledgment

    Programming Actions and Conditions 7.10 Supervision Errors and Acknowledgment Every step can be assigned a supervision condition. Only active steps are monitored. S7-Graph recognizes whether or not the supervision conditions are satisfied (in other words when a supervision error has occurred). A supervision error entering the state (1) results in event "V1", a supervision error leaving the state (2) results in the event "V0".
  • Page 102 Programming Actions and Conditions Supervision error occurs (event V1 enters state) Actions with V1 are executed once in the next sequencer cycle. Step activation time Si.U is stopped Message in FB param eter ERR_FLT Compilation setting: Acknowledge Ackn. signal or SV not true? Ackn.
  • Page 103: Comment, Extended Name, Number, Name

    Programming Actions and Conditions 7.11 Comment, Extended Name, Number, Name Step Comment A step comment can contain a maximum of 2048 characters. It has no influence on the execution of the program. Step comments are displayed only at the single step display level. If you do not enter an extended step name, the step name is displayed instead.
  • Page 104: Programming With Symbolic Addresses

    Programming Actions and Conditions Transition Number (for example, T1) and Transition Name (for example, Trans1) The transition name and transition number must be unique and can be adapted later in all three programming language representations. • The transition number is assigned automatically by the system (range: 1 to 999).
  • Page 105: Editing Variables

    Programming Actions and Conditions Displaying Symbol Information when Entering Addresses You can simplify the entry of symbolic addresses in LAD and FBD by displaying existing symbols in a drop-down list box. If the menu command View > Display with > Symbol List is selected, the list box with the symbols is displayed automatically when you enter addresses.
  • Page 106 Programming Actions and Conditions S7-GRAPH for S7 300/400 Programming Sequential Control Systems 7-30 C79000-G7076-C526-01...
  • Page 107: Saving And Compiling

    Saving and Compiling Principle: Saving and Compiling After you have programmed a sequencer, you must save the program. When saving and compiling, S7-Graph makes a distinction between an S7-Graph FB and an S7-Graph source file. Trigger: Save a source Trigger: Save an FB file Correction of errors Source file is saved...
  • Page 108: Rules For Saving An S7-Graph Fb

    Saving and Compiling • Before saving the S7-Graph FB or S7-Graph source file, you can start a consistency check. Errors and warnings during the compilation of an S7-Graph source file can but do not need to be corrected. Errors during the compilation of an S7-Graph FB must, however, be corrected before the FB can be saved.
  • Page 109: Settings For Saving And Compiling

    Saving and Compiling Settings for Saving and Compiling Before you save and compile a block, check and correct the settings. • Select the menu command Options > Block Settings. The dialog has three tab pages that are relevant for saving and compiling. The "Compile / Save"...
  • Page 110 Saving and Compiling On Saving • Include instance DB: If you select this option, whenever a function block is compiled or downloaded, S7-Graph checks whether the instance DB requires updating and if necessary updates it automatically. If you do not select this option, you must create or update the instance DB manually with the menu command File >...
  • Page 111: Settings In The "Compile/Save" Tab Page

    Saving and Compiling 8.4.2 Settings in the "Compile/Save" Tab Page All the settings that you make in this tab page selected with the menu command Options > Block Settings apply to the currently open block. FB Parameters This setting decides the available parameters and the intended functionality of the FB that will be created.
  • Page 112 Saving and Compiling Interface Description The interface description decides how data for steps and transitions are created in the instance DB. • Structure arrays: The interface descriptions are created in the instance DB as ARRAYs. This option optimizes the memory requirements of your S7-Graph FB. The step names are, however, not stored.
  • Page 113: Settings In The "Messages" Tab Page

    Saving and Compiling • Acknowledge Errors If a supervision error occurs during operation (conditions of a supervision satisfied), this must be acknowledged with the input parameter "ACK_EF" to allow the controller to continue operation. This option is not available if you have selected the options "FB Parameters: Minimum".
  • Page 114 Saving and Compiling Options in the "Messages" tab page: Message Handling: • None: Messages are not generated. • Messages with WR_USMSG (SFC52): Here, you decide whether messages about interlock or supervision errors are entered in the diagnostic buffer. • And send: Click this check box, if you also want the messages sending to network nodes (for example OPs).
  • Page 115: Saving

    Saving and Compiling Saving Calculating Memory Requirements With the following formulas, you can estimate how much space is required for an S7-Graph FB and instance DB in the work memory (n - number of steps). The following conditions apply: • The “Criteria analysis data in DB" option is not selected in the “Compile" tab page.
  • Page 116: Compiling

    Saving and Compiling Compiling Compiling produces a program that can be understood by the CPU. During compilation, the syntax of the program is checked, the S7-Graph FB is created and, if required, the instance DB. Methods for Compiling Sequencers Requirements Before an FB can be compiled, all the errors must be eliminated.
  • Page 117: Assigning Parameters To And Calling The S7-Graph Fb

    Assigning Parameters to and Calling the S7-Graph FB Calling the S7-Graph FB in the S7 Program Before a loaded S7-Graph FB can be executed on the CPU, it must be called in a block that is executed cyclically. This call can be in OB1 or in any other FB or FC called in OB1.
  • Page 118: Selecting An Fb Parameter Set

    Assigning Parameters to and Calling the S7-Graph FB Example: Assignment of the FB for the inching mode To call and operate the sequencer in the inching mode, you do not require all addresses. The following diagram shows the addresses that must be assigned when programming Ladder Logic.
  • Page 119: Parameter Sets Of The Fb

    Assigning Parameters to and Calling the S7-Graph FB You can also modify existing parameter sets in the variable declaration window. You can, for example, delete unnecessary parameters from a standard parameter set. System parameters cannot be modified however you can define user-specific parameters to meet your requirements.
  • Page 120 Assigning Parameters to and Calling the S7-Graph FB DB Sequencer Maximum <= V4 Maximum V5/ user-defined DB Sequencer FB Sequencer FB Sequencer BOOL BOOL BOOL BOOL BOOL OFF_SQ BOOL OFF_SQ S_NO S_NO BOOL INIT_SQ BOOL INIT_SQ S_MORE BOOL S_MORE BOOL BOOL ACK_EF BOOL...
  • Page 121: Input Parameters Of The S7-Graph Fb

    Assigning Parameters to and Calling the S7-Graph FB Input Parameters of the S7-Graph FB The FB reacts to the rising edge of the input parameter (exception EN). Parameter Data Description Min. Std. Max. User- Type def. á á á á BOOL Controls execution of the FB (enable input).
  • Page 122 Assigning Parameters to and Calling the S7-Graph FB Parameter Data Description Min. Std. Max. User- Type def. á EN_SSKIP BOOL STEP ENABLE_ _SKIPPING: Activate skip step á DISP_SACT BOOL STEP DISPLAY_ACTIVE_ Display active steps only á DISP_SEF BOOL STEP DISPLAY_ S_WITH_ERROR_OR_FAULT: Display steps with errors and disturbed steps only...
  • Page 123 Assigning Parameters to and Calling the S7-Graph FB Parameter Data Description Min. Std. Max. User- Type def. á á á S_OFF BOOL STEP _OFF: Manual mode: Deactivate the displayed step á T_PREV BOOL PREVIOUS_TRANSITION: Display previous valid transition in T_NO á...
  • Page 124: Output Parameters Of The S7-Graph Fb

    Assigning Parameters to and Calling the S7-Graph FB Output Parameters of the S7-Graph FB Parameter Data Description Min. Std. Max. User- Type def. á á á á BOOL Enable output. When the FB is active and no error has occurred, ENO has the value 1, otherwise 0 á...
  • Page 125 Assigning Parameters to and Calling the S7-Graph FB Parameter Data Description Min. Std. Max. User- Type def. á á SQ_HALTED BOOL SEQUENCE_IS_HALTED: Sequencer stopped á á TM_HALTED BOOL TIMES_ARE_HALTED: Timers stopped á á OP_ZEROED BOOL OPERANDS_ARE_ZEROED: Addresses reset á á IL_ENABLED BOOL INTERLOCK_IS_ENABLED:...
  • Page 126: The Modes Of The Sequential Control System

    Assigning Parameters to and Calling the S7-Graph FB The Modes of the Sequential Control System By selecting one of the four possible modes, you decide how the sequencer progresses from step to step. By setting suitable parameters for the S7-Graph FB, you can select the mode of the sequential control system as required.
  • Page 127 Assigning Parameters to and Calling the S7-Graph FB 9.7.1 Automatic Mode (SW_AUTO) In the automatic mode control passes to the next step when the transition is satisfied. Input Parameters for the Automatic Mode Parameters not listed are not mode-dependent. Parameter Data Description OFF_SQ...
  • Page 128 Assigning Parameters to and Calling the S7-Graph FB 9.7.2 Manual mode (SW_MAN) The manual mode is selected, for example, to test the sequencer. The manual mode is characterized as follows: • Next step not enabled when a transition is satisfied •...
  • Page 129: Inching Mode (Sw_Tap)

    Assigning Parameters to and Calling the S7-Graph FB 9.7.3 Inching mode (SW_TAP) To install or test a system step by step, the inching mode can be very useful: • The sequencer switches when the transition is satisfied and there is an edge change from 0 to 1 at the parameter T_PUSH.
  • Page 130: Automatic Or Switch To Next Mode (Sw_Top)

    Assigning Parameters to and Calling the S7-Graph FB 9.7.4 Automatic or Switch to next Mode (SW_TOP) For initial project start up or for testing a control system step-by-step, the "automatic or step-by-step" mode can be extremely useful: • The sequencer progresses when the transition is satisfied or when there is an edge change from 0 to 1 at the parameter T_PUSH.
  • Page 131: Downloading The S7-Graph Fb And Instance Db

    Downloading the S7-Graph FB and Instance DB 10.1 Downloading blocks from the Programming Device to the CPU Requirements for Downloading the S7-Graph FB to the CPU To download the user program to the CPU, the following requirements must be met: •...
  • Page 132: Uploading Blocks From The Cpu To The Programming Device

    Downloading the S7-Graph FB and Instance DB Downloading to the CPU To download the S7-Graph FB with the corresponding instance DB to the CPU, follow the steps outlined below: 1. With the FB open, click the menu command PLC > Download. The FB currently open in the working window is downloaded to the CPU.
  • Page 133: Monitoring And Testing The Sequential Control System

    Monitoring and Testing the Sequential Control System Using the Monitoring and Test Functions The monitoring functions allow you to monitor and check a program while it is being executed on the CPU. This allows you to locate errors that were not indicated by the formal consistency check while you were writing the program or by the syntax check performed during compilation.
  • Page 134: Monitoring And Test Functions In S7-Graph

    Monitoring and Testing the Sequential Control System Requirements for Activating the Test Functions of S7-Graph Before you can test an S7-Graph program, the following requirements must be met: • The PG must be connected online to the CPU. • The program was compiled without errors. •...
  • Page 135: Control Sequencer

    Monitoring and Testing the Sequential Control System The display indicates whether individual conditions are satisfied (for example a memory bit or an output). The display indicates whether a complete logic operation consisting of several conditions is satisfied, for example an OR operation. The display indicates whether the entire transition (T), interlock (C) or supervision (V) is satisfied.
  • Page 136: Synchronization

    Monitoring and Testing the Sequential Control System "Sequencer Control" Dialog Box The "Sequencer Control" dialog box is used both as an output field that displays the current settings and at the same time as an input field in which you can change the current status.
  • Page 137: Test Functions Of Step 7

    Monitoring and Testing the Sequential Control System Note In a simultaneous branch, each path must contain a step to be activated. 1. Activate the selected steps with the "Activate" button. 2. Now switch the sequencer back to the automatic mode. 11.2 Test Functions of STEP 7 The following test functions are available for further analysis of the sequential...
  • Page 138 Monitoring and Testing the Sequential Control System Querying Module Information and the Operating Mode With the menu command PLC > Module Information, you can obtain a variety of information about modules. As additional information on the sequential control system, the content of the diagnostic buffer and the current utilization of the work and load memory can be particularly interesting.
  • Page 139 Monitoring and Testing the Sequential Control System • The following table shows the lists available: List Content of the list Cross-reference Overview of the use of addresses in the memory areas I, Q, M, P, T, C and DB within the user program. Program structure Call hierarchy of the blocks within a user program and overview of the blocks used and their interdependencies.
  • Page 140 Monitoring and Testing the Sequential Control System S7-GRAPH for S7 300/400 Programming Sequential Control Systems 11-8 C79000-G7076-C526-01...
  • Page 141: Printing The Sequencer

    Printing the Sequencer Documenting the Program After you have created the sequential control system, you can print it out at any time to create your documentation. The printout is either according to the settings or the content of the active window is printed. The display level and zoom factor set for the active window are taken into account in the printout.
  • Page 142 Printing the Sequencer "Print" Tab Page, "Application Settings" Dialog Box in the "Print" tab page of the "Application Settings", you can specify the standard settings for printouts. You select the required settings by placing a check mark. You can, for example, include the following components in the printout: •...
  • Page 143: Overview Of All Actions

    Overview of All Actions What does this chapter describe? This chapter describes all the actions you can use when programming with S7- Graph. S7-Graph uses the settings for the mnemonics (SIMATIC or International) selected in the "Language" tab page in the SIMATIC manager with the menu command Options >...
  • Page 144 Overview of All Actions Action Explanation Address range Event Address Location Time struc- Area Constant tion Q,I,M,D* m.n As long as the step is active and the 0.0 to condition (interlock) is satisfied, the 65535.7 address is set to 1 and then remains set to 1.
  • Page 145: Event-Dependent Actions - With And Without Interlock

    Overview of All Actions 13.2 Event-Dependent Actions - with and without Interlock These actions are executed once when the event occurs and the corresponding step is active. When the sequencer is run through after this, an event-dependent action is executed again only when the event occurs again. Action Explanation Address...
  • Page 146 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area Q,I,M,D* As soon as the step becomes 0.0 to active (enters state) and the 65535.7 condition (interlock) is satisfied, the address is set to 1 and then remains set to 1. Q,I,M,D* As soon as the step becomes 0.0 to...
  • Page 147 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area CALL FB, FC, Block As soon as the step is SFB, SFC number deactivated (leaves state), the specified block is called. As soon as the step is i = step deactivated (leaves state), number...
  • Page 148 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area As soon as a supervision 0.0 to error occurs while the step is 65535.7 active or a supervision error had been detected before the step became active, step i is deactivated.
  • Page 149 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area As soon as a supervision 0.0 to error occurs while the step is 65535.7 active or a supervision error had been detected before the step became active and the condition (interlock) is satisfied, step i is activated.
  • Page 150 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area As soon as a supervision i = step error leaves the state (is number eliminated or acknowledged), step i is activated. As soon as a supervision i = step error leaves the state (is number eliminated or acknowledged),...
  • Page 151 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area L1: Actions linked with interlocks leaving state Q,I,M,D* As soon as the interlock 0.0 to condition is no longer 65535.7 satisfied (leaves state) while the step is active or if the interlock condition is not satisfied when the step becomes active, the signal...
  • Page 152 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area As soon as the interlock i = step condition is satisfied when the number step is no longer satisfied (leaves state) while the step is active or if the interlock condition is not satisfied when the step becomes active, step i is also deactivated.
  • Page 153 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area Q,I,M,D* As soon as a message is 0.0 to acknowledged and the 65535.7 condition (interlock) is satisfied, the address has signal state 1. Q,I,M,D* As soon as a message is 0.0 to acknowledged and the 65535.7...
  • Page 154 Overview of All Actions Action Explanation Address range Event Instruction Address Location Area As soon as a registration is i = step set, step i is activated. number As soon as a registration is i = step set, step i is deactivated. number Q,I,M,D* As soon as a registration is...
  • Page 155: Counters In Actions

    Overview of All Actions 13.3 Counters in Actions These actions are executed once when the event occurs and the corresponding step is active. When the sequencer is run through after this, an event-dependent action is executed again only when the event occurs again. Action Explanation Address...
  • Page 156 Overview of All Actions Action Explanation Address range Event Address Location struc- Area tion As soon as the step is deactivated (leaves x = counter state), the counter is decremented by 1. number As soon as the step is deactivated (leaves x = counter state), the counter is reset to 0.
  • Page 157 Overview of All Actions Action Explanation Address range Event Address Location struc- Area tion V1: Counters in actions linked to supervision errors entering the state As soon as a supervision error occurs while x = counter the step is active or a supervision error had number <initial been detected before the step became active,...
  • Page 158 Overview of All Actions Action Explanation Address range Event Address Location struc- Area tion V0: Counters in actions linked to supervision errors leaving the state As soon as a supervision error leaves the state x = counter (is eliminated or acknowledged), the initial number <initial counter value is loaded in the counter.
  • Page 159 Overview of All Actions Action Explanation Address range Event Address Location struc- Area tion R1: Counters in actions linked to setting a registration As soon as a registration is set, the initial x = counter counter value is loaded in the counter. number <initial counter...
  • Page 160: Timers In Actions

    Overview of All Actions 13.4 Timers in Actions These actions are executed once when the event occurs and the corresponding step is active. When the sequencer is run through after this, an event-dependent action is executed again only when the event occurs again. Action Explanation Event...
  • Page 161 Overview of All Actions Action Explanation Event Address Location Address struc- range tion As soon as the step is deactivated (leaves state) x = no. the timer stops. Timer bit (status of the timer) and of timer <time> timer value are reset to 0. L1: Timers in actions linked with interlocks leaving state As soon as the interlock condition is satisfied when x = no.
  • Page 162 Overview of All Actions Action Explanation Event Address Location Address struc- range tion V1: Timers in actions linked to supervision errors entering the state As soon as a supervision error occurs while the x = no. step is active or a supervision error had been of timer <time>...
  • Page 163 Overview of All Actions Action Explanation Event Address Location Address struc- range tion As soon as a supervision error leaves the state (is x = no. eliminated or acknowledged), the timer starts. For of timer <time> the specified time, the timer bit (status of the timer) is set to 0, when the time elapses, it is set to 1.
  • Page 164 Overview of All Actions Action Explanation Event Address Location Address struc- range tion As soon as a registration is set, the timer stops. x = no. Timer bit (status of the timer) and timer value are of timer <time> reset to 0. As soon as a registration is set and the condition x = no.
  • Page 165: Arithmetic In Actions

    Overview of All Actions 13.5 Arithmetic in Actions These actions are either executed in every cycle in which the relevant step is active or once when the relevant event occurs. Action Explanation Event Instruction Assignment A:=B As long as the step is active, the arithmetic is executed. A:=func(B) A:=B<operator>C A:=B...
  • Page 166 Overview of All Actions Action Explanation Event Instruction Assignment V1: Arithmetic in actions linked to supervision errors entering the state A:=B As soon as a supervision error occurs while the step is active or a supervision error had been detected before the A:=func(B) step became active, the arithmetic is executed.
  • Page 167: Notes On Configuration

    Notes on Configuration Introduction To automate your sequential control system with S7-Graph, in addition to the functions for the automatic mode, a range of further functions is also available. Before you can use the S7-Graph functions, you must make sure that certain conditions are met.
  • Page 168 Notes on Configuration General Cell level Enable Modes operation Station n: Save Station 1: Insert Coordination Turn level Save, Insert, remove weld Utilities Turntable Coolant Function or Pneumatics Centere Motor memory unit level Hydraulics Clamp Conveyor belt The individual levels have the following significance: •...
  • Page 169 Notes on Configuration Modes OB 1 General (cyclic) Release operation functions Station n Save Sequencers Station 1 Turn Station 1 Insert, weld Unit station n Unit station 1 Manual mode, Hydraulics Interlocks Pneumatics Poss. robot interface The various functions at the individual levels are executed cyclically in the order in which they are called: •...
  • Page 170 Notes on Configuration Init R "Unit_ready" Init "Controlpow ok" R "Process_enabled" Trans1 Init.U >=D Controller_on N "Controller_on" "Hydraulic "Pneumatic Con... _ok" _ok" Trans2 Unit_ready N "Unit_ready" Uni... "Central_start " Trans3 Process_enabled N "Unit_ready" Pro... N "Process_enabled" "Emer_off" Trans4 "Door_ closed" No_Process_enabled Pro...
  • Page 171 Notes on Configuration • If an OK signal from one of the power systems is canceled while the Process_enabled (step 4) is active, the enable signals are also canceled with the change to step 2. Once the OK_Signals of the power systems are present again, Central_start can return the unit to the enabled state again.
  • Page 172 Notes on Configuration Representing the Mode in the Sequencer If, for example, a selector switch on the control panel supplies the signals automatic, inching and manual as individual single signals, only relatively simple logic is required to derive the mode signals for the sequencers and for the underlying drives of the units as shown in principle in the following diagram.
  • Page 173 Notes on Configuration Handling the Interlocks and Manual Control in the Manual Mode In S7-Graph, the sequencer controls the functions for the automatic mode. The functions for the manual mode required over and above those of the automatic mode are included in a separate FB. Using action bits (for example Carr_fwd) the sequencer is connected to the interlock and manual control.
  • Page 174: Points To Note About Programming Sequencers

    Notes on Configuration 14.2 Points to Note about Programming Sequencers Initialization The sequencer is initialized using the INIT_SQ parameter. If this changes to "1", all steps marked as initial steps are activated. All other steps are deactivated. After turning on the controller, the sequencer is in the same mode as it was when the controller was turned off, in other words if the controller was in the SW_AUTO mode before it was turned off, it will be in this mode when it is turned on again.
  • Page 175 Notes on Configuration If time monitoring was programmed with Si.U, the acknowledgment signal resets the monitoring time so that the supervision condition is no longer satisfied. • Compilation options "Acknowledge Errors" not checked: The error is cleared when the supervision conditions are no longer satisfied. Notes: If the step enabling condition is satisfied during the acknowledgment cycle, the next step is enabled.
  • Page 176 Notes on Configuration 2. Select the menu command Debug > Synchronization. Result: All transition and interlock conditions are detected. The subsequent evaluation shows which steps are located between a satisfied and non-satisfied transition. All steps found are displayed yellow. 3. Click all the steps you want to select with the mouse pointer that changes to a cross-hair.
  • Page 177 Notes on Configuration FB sequencer & Autom. SW_AUTO AUTO_ON SW_TAP TAP_ON & Inch SW_MAN MAN_ON & With this logic, the sequencer returns to the state set by the signals automatic/inching/manual after one cycle. S7-GRAPH for S7-300/400 Programming Sequential Control Systems 14-11 C79000-G7076-C526-01...
  • Page 178: Linking To Operator Control And Monitoring Systems

    Notes on Configuration 14.3 Linking to Operator Control and Monitoring Systems The task of a machine or system is production. During normal operation, the display of the process state is normally unimportant. The situation is different when the process is disturbed. In this case it is important to be able to recognize an eliminate the cause as quickly as possible.
  • Page 179 Notes on Configuration Creating Diagnostic Data When you compile a sequencer, you can decide whether diagnostic data should also be created in addition to the FB/DB providing "message with ALARM_SQ/ALARM_S" is selected. The diagnostic data contains the structure data of a sequencer and can be linked into a corresponding OP project using ProAgent.
  • Page 180 Notes on Configuration • Detailed display The network affected is displayed in Ladder Logic or statement list representation and the missing conditions are marked. In the display, you also have the option of displaying the entire network or the reduced network containing only the conditions affected.
  • Page 181: Instance Db

    Instance DB Each S7-Graph FB is assigned an instance data block that can be understood as representing the memory of the FB. It contains the data belonging to the sequencer, in other words all the data and parameters required to execute the FB. •...
  • Page 182: Assignment Of Instance Db And S7-Graph Fb

    Instance DB 15.2 Assignment of Instance DB and S7-Graph FB In general, S7-Graph makes an automatic DB assignment for blocks. If the DB with the same number as the FB does not yet exist or the DB and FB match, the DB is automatically assigned.
  • Page 183: Creating The Instance Db Later

    Instance DB 15.4 Creating the Instance DB Later If you have not selected the option "Include Instance DB" in the "General" tab page, follow the steps below: 1. Program the S7-Graph FB and select the menu command File > Save. 2.
  • Page 184: Structure Of An Instance Db

    Instance DB 15.7 Structure of an Instance DB The structure of the instance DB depends on the settings you make in the "Compile / Save" tab page (menu command Options > Block Settings ). The following factors affect the content and the size. •...
  • Page 185 Instance DB Parameter Description Data Read Write int. Read Write Ext. Type int. Ext. OFF_SQ BOOL OFF_SEQUENCE: Turn off the sequencer INIT_SQ BOOL INIT_SEQUENCE: Initialize sequencer ACK_EF BOOL ACKNOWLEDGE_ERROR_FAULT: Acknowledge disturbance, force switching to next step REG_EF BOOL REGISTRATE_ERROR_FAULT: Register all errors and disturbances ACK_S STEP...
  • Page 186 Instance DB Parameter Description Data Read Write int. Read Write Ext. Type int. Ext. S_PREV STEP BOOL PREVIOUS_ Automatic mode: Indicate previous simultaneously active steps in S_NO Manual mode: Indicate previous step (next lower number) S_NEXT STEP BOOL NEXT_ Automatic mode: Indicate next simultaneously active step in S_NO manual mode: Indicate next step (next higher number)
  • Page 187 Instance DB Parameter Description Data Read Write int. Read Write Ext. Type int. Ext. S_NO STEP _NUMBER: Display step number S_MORE STEP BOOL MORE_ Further active steps can be displayed in S_NO S_ACTIVE STEP BOOL _ACTIVE: Displayed step is active S_TIME STEP TIME...
  • Page 188 Instance DB Parameter Description Data Read Write int. Read Write Ext. Type int. Ext. IL_ENABLED BOOL INTERLOCK_IS_ENABLED: Interlocks not deactivated SV_ENABLED BOOL SUPERVISION_IS_ENABLED: Supervisions not deactivated ACKREQ_EN BOOL ACKNOWLEDGE_REQUIRED_IS_ ABLED ENABLED: Mandatory acknowledgment activated SSKIP_EN STEP BOOL _SKIPPING_IS_ENABLED: ABLED Skip step activated SACT_DISP STEP BOOL...
  • Page 189: The Transition Structure

    Instance DB 15.10 The Transition Structure A structure with the following parameters is created in the instance DB for every transition located in the sequencer of the S7-Graph FB: Component Description Data Read Write int. Read Write Ext. Type int. Ext.
  • Page 190 Instance DB External access uses only the array element followed by the name of the structure element. Note: The array index is the internal transition number and not the number assigned by the user. • G7T[1].TT • G7T[3].CRIT "Individual structures" Option If you have selected the "Individual structures"...
  • Page 191: The Step Structure

    Instance DB 15.11 The Step Structure A structure with the following components is created in the instance DB for every step of the sequencer in the S7-Graph FB, as follows: Component Description Data Read Write int. Read Write Ext. Type int.
  • Page 192 Instance DB Component Description Data Read Write int. Read Write Ext. Type int. Ext. System-internal BOOL System-internal BOOL System-internal BOOL System-internal BOOL System-internal BOOL H_IL_ERR System-internal BYTE H_SV_FLT System-internal BYTE RESERVED Reserve DWORD If you selected the "Structure arrays" option, a field with the structures of the steps is generated, as follows: Array Name Length in Bytes...
  • Page 193: Sequencer Status

    Instance DB "Individual structures" Option If you selected the "Individual structures" option, the structures of the steps are entered in the instance DB as separate sections, as follows: Structure Name Length in Bytes <Step1> <Stepn> Internal access uses the step number or the step name followed by the name of the structure element.
  • Page 194 Instance DB Permanent Instructions This component of the sequencer status area describes the permanent instructions that can be programmed before or after the sequencer. The component is omitted if no permanent instructions are programmed. Name Description Data Length Read Write int. Read Write Ext.
  • Page 195 Instance DB Index Name Description Data Length Read Write Int. Read Write Type in Bytes int. Ext. Ext. Array_2 of the steps to be BYTE S_CNT+2 no deactivated Array_2 of the steps to be BYTE S_CNT+2 no activated S_DISPLAY Copy of the output parameter S_NO (can also be evaluated if the minimum parameter set option is selected)
  • Page 196 Instance DB Modes The next component in the sequencer status area describes the modes, in other words the state or mode change and codes. A structure with the following elements is created: Name Description Data Read Write int. Read Write Ext. Type int.
  • Page 197 Instance DB Name Description Data Read Write int. Read Write Ext. Type int. Ext. S_NEXT Automatic mode: Indicate next BOOL simultaneously active step in S_NO Manual mode: Indicate next higher step number S_SELOK Reserved BOOL S_ON Manual mode: Activate the displayed BOOL step S_OFF...
  • Page 198 Instance DB Indicating the Modes The modes component is saved in the instance DB as follows: Structure Description Length in Name Bytes MOPEDGE System-internal Changing modes and indicators Example: By setting MOP.MAN once, the mode changes to MANUAL. This can be set either controlled by the program (for example action in the sequencer) or by the PG function "Modify Variable"...
  • Page 199: Internal Data Area

    Instance DB Name Description Data Read Write Int. Read Write Ext. Type int. Ext. TV_OFL Too many valid BOOL transitions MSG_OFL Too many messages BOOL NO_SWI Reserved BOOL CYC_OP System-internal BOOL AS_MSG System-internal BOOL AS_SEND System-internal BOOL SQ_BUSY System-internal BOOL SA_BUSY System-internal BOOL...
  • Page 200 Instance DB Condition Descriptions These data are only entered when you select the option "With Criteria Analysis Data". Address Description Data Length ADR_LOG_T[]: Descriptions for all transitions with BYTE[] content; the start addresses are in the BYTE[] field ADR_LOG_T[]; a 0 is entered here for empty transitions and there is no description.
  • Page 201 Instance DB c+2* ADR_S1_CRITERR: WORD T_CNT+2* Address of the disturbed interlock criteria S_CNT+6 of S1 ADR_S1_CRITERR == address(G7S[1].CRIT_ERR) c+2* ADR_SERRX: WORD T_CNT+2* Address of the array of disturbed steps S_CNT+8 SERRX[] ADR_SERRX == address(SERRX[0]) == e n = Length of the instance DB in bytes Internal Work Area 2 Description Data...
  • Page 202 Instance DB n-26 PRS_INPAR: DWORD Range of input parameters n-22 PRS_OUTPAR: DWORD Range of output parameters n-18 SQ_FLAGS WORD Compiler flags part 1 SQ_FLAGS BYTE Compiler flags part 2 Bit .0 == 1 --> condition descriptions exist SQ_FLAGS BYTE Compiler flags part 3 G7_FBMARK: BYTE Compatibility FB criteria analysis...
  • Page 203: Glossary

    Glossary Action An action is an instruction to execute a function when a step is active. Alternative branch An alternative branch is the divergence of a sequencer to one step of several alternatives depending on several parallel transitions. Checkpoint The checkpoint is a point in the program cycle at which the plant states can be queried or influenced.
  • Page 204 Glossary Execution time The execution time of an instruction is the time during which the instruction (statement) is active; in other words is being executed. Interlock An interlock is a programmable condition within a step. An interlock influences the execution of individual actions. Ladder Logic branch A Ladder Logic branch corresponds to an OR logic operation on elements in a transition, supervision or interlock.
  • Page 205 Glossary Sequential control system A control system executed in a strict sequence from one programmed step to the next depending on satisfied conditions. Start point The start point is the defined beginning of a program cycle. At the start, the process image input table (PII) is read;...
  • Page 206 Glossary System checkpoint The system checkpoint is the interface between the system and the user program. At the system checkpoint, the signal states of the process variables can be monitored or modified and signal states can be set at the outputs. Transition The transition is the part of the sequencer containing the conditions to pass control from one step to the next.
  • Page 207: Index

    Index Acknowledge errors ......7-25 Colors Action", "categories......7-2 customizing ........4-10 Action", "components......7-2 Compiling Actions ..........7-2 an S7-Graph source file....8-10 arithmetic ........7-10 automatic ........8-10 assignment........7-10 sequencers........8-10 counter..........7-7 Condition event-dependent ......7-4 programming with FBD elements...
  • Page 208 Index Installation requirements ....2-7 Instance DB........15-1 accessing ........15-3 Empty Interlock.........7-16 displaying contents......15-3 Empty steps ........7-2 downloading ........10-1 Empty transition........7-15 include .......... 15-2 Error include automatically ..... 10-1 displaying........4-14 interface description ...... 15-1 Event-dependent actions ....7-4 internal working area ....
  • Page 209 Index programming......... 3-14 Rules for entering FBD elements ..... 7-23 for entering Ladder Logic elements 7-19 for saving an S7-Graph FB ....8-2 New sequencer........6-9 for saving and compiling ....8-1 Notes on configuration ..... 14-1 for the structure of a sequencer ..6-4 Rules for Creating and Calling the S7-Graph Source File ....
  • Page 210 Index inching mode........9-10 Test functions manual mode .........9-10 in STEP 7........11-5 monitoring ........11-1 Testing normal mode........9-10 requirements ......... 11-2 testing..........11-1 Time (duration) ........ 7-10 Simultaneous branch ......6-8 Time constant ........7-4 Single page display......4-6 Toolbars Single step display......4-7 display...........
  • Page 211 Siemens AG A&D AS E 81 Oestliche Rheinbrueckenstr. 50 76181 Karlsruhe From: Your Name:..........................Your Title: ..........................Company Name:......................... Street: ..........................Country: ..........................Phone: ..........................Please check any industry that applies to you: Automotive Pharmaceutical Chemical Plastic Electrical Machinery Pulp and Paper...
  • Page 212 Your comments and recommendations will help us to improve the quality and usefulness of our publications. Please take the first available opportunity to fill out this questionnaire and return it to Siemens. Please give each of the following questions your own personal mark within the range from 1 (very good) to 5 (poor).

Table of Contents