• 沒有找到結果。

the Example of a Drill 2

N/A
N/A
Protected

Academic year: 2022

Share "the Example of a Drill 2"

Copied!
176
0
0

加載中.... (立即查看全文)

全文

(1)

Important Information, Contents

Product Overview and

Installation 1

Designing a Program Using

the Example of a Drill 2

Working with S7-HiGraph 3

Process Error Diagnosis 4

STL Instruction Description 5

Configuration Notes 6

User Program Run Behavior

in the PLC 7

Tips and Tricks 8

Glossary Index

SIMATIC

S7-HiGraph for S7-300/400

Manual

01/2000

C79000-G7076-C527 Edition 01

长沙工控帮教育科技有限公司整理

(2)

protect the product and connected equipment. These notices are highlighted in the manual by a warning triangle and are marked as follows according to the level of danger:

!

Dangerindicates that death, severe personal injury or substantial property damage will result if proper precautions are not taken.

!

Warningindicates that death, severe personal injury or substantial property damage can result if proper precautions are not taken.

!

Caution!indicates that minor personal injury or property damage can result if proper precautions are not taken.

Note

draws your attention to particularly important information on the product, handling the product, or to a particular part of the documentation.

Qualified Personnel

Only qualified personnel should be allowed to install and work on this equipment Qualified persons are defined as persons who are authorized to commission, to ground, and to tag circuits, equipment, and systems in accordance with established safety practices and standards.

Correct Usage

Please note the following:

!

Warning

This device and its components may only be used for the applications described in the catalog or the technical description, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens.

This product can only function correctly and safely if it is transported, stored, set up, and installed correctly, and operated and maintained as recommended.

Trademarks

SIMATIC®, SIMATIC HMI® and SIMATIC NET® are trademarks of Siemens AG.

Third parties using for their own purposes any other names in this document which refer to trademarks might infringe upon the rights of the trademark owners.

长沙工控帮教育科技有限公司整理

(3)

Important Information

Purpose of the manual

This manual is intended for programmers of HiGraph programs and for persons working in the fields of planning, commissioning and servicing PLCs.

If you are using HiGraph for the first time, we recommend that you familiarize yourself on the basis of the example in Chapter 2. It is an easy method of getting started in programming with HiGraph.

Required knowledge

A general knowledge of automation technology is required in order to understand the manual.

In addition, knowledge of S7 programs is required. This can be looked up in the programming manual. Since HiGraph is based on the STEP 7 basic software, you should also know how to handle the basic software, as described in the STEP 7 User Manual.

Validity of the manual

The manual is valid for the S7-HiGraph programming software, Version 5.0.

长沙工控帮教育科技有限公司整理

(4)

Online help

In addition to the manual detailed support in using the software is provided by the online help integrated in the software.

The help system is integrated in the software through several interfaces:

The Help menu contains several menu commands: Contents opens the table of contents of the help, Introduction provides an overview over HiGraph programming, Using Help provides detailed instructions on using the online help.

• The context-sensitive help provides information on the current context, for example on an opened dialog box or on active window. It can be used by clicking on the "Help" command button or by pressing F1.

• The status line provides a further form of context-sensitive help. A brief explanation of the respective menu command is displayed as soon as the cursor is positioned on the menu command.

• A brief explanation is also displayed for the icons in the toolbar as well as for the graphics elements in the state diagrams when the cursor is left briefly on the element.

If you would rather have the information of the online help in printed form, you can also print out individual help topics, books or the entire help.

User response to the documentation

We would appreciate your help in optimizing the documentation for you and future HiGraph users. Should you have any questions or remarks on this manual or on the online help, please fill out the questionnaire at the end of the manual and send it to the address specified there. Please also enter your personal evaluation there.

Reference to literature /.../

References to further documentation are made by means of literature numbers between slashes, for example /.../. You can use these numbers to ascertain the exact title of the documentation in the literature list at the end of the manual.

SIMATIC Training Center

We offer corresponding courses to help familiarize you with the SIMATIC S7 PLC.

Please contact your regional training center or the central training center in D 90327 Nuremberg, Germany. Tel. +49 (911) 895 3154.

长沙工控帮教育科技有限公司整理

(5)

SIMATIC Customer Support Hotline Available worldwide at all times:

Johnson City

Nuremberg

Singapur

SIMATIC Hotline

Nuremberg

SIMATIC BASIC Hotline

Johnson City

SIMATIC BASIC Hotline

Singapore

SIMATIC BASIC Hotline Local time: Mo.-Fr. 7:00 to 17:00

Telephone: +49 (911) 895-7000 Fax: +49 (911) 895-7002 E-mail: simatic.support@

Nbgm.siemens.de GMT: +1:00

Local time: Mo.-Fr. 7:00 to 17:00 Telephone: +1 423 461-2522 Fax: +1 423 461-2231 E-mail: simatic.hotline@

sea.siemens.com GMT: -5:00

Local time: Mo.-Fr. 8:30 to 17:30 Telephone: +65 740-7000 Fax: +65 740-7001 E-mail: simatic.hotline@

sae.siemens.com.sg GMT: +8:00

Nuremberg

SIMATIC Authorization Hotline

Nuremberg

SIMATIC Premium Hotline Local time: Mo.-Fr. 7:00 to 17:00

Telephone: +49 (911) 895-7000 Fax: +49 (911) 895-7201 E-mail: authorization@

Nbgm.siemens.de GMT: +1:00

(Calls charged, only with SIMATIC Card)

Time: Mo.-Fr. 0:00 to 24:00 Telephone: +49 (911) 895-7777 Fax: +49 (911) 895-7001 GMT: +01:00

长沙工控帮教育科技有限公司整理

(6)

SIMATIC Customer Support Online Services

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:

- On the Internet at http://www.ad.siemens.de/simatic-cs

- Using the Bulletin Board System (BBS) in Nuremberg (SIMATIC Customer Support Mailbox) number +49 (911) 895-7100.

To dial the mailbox, use a modem with up to V.34 (28.8Kbps) with the following parameter settings: 8, N, 1, ANSI, or dial via ISDN (x.75, 64 Kbps).

长沙工控帮教育科技有限公司整理

(7)

Contents

Important Information

1 Product Overview and Installation . ...1-1 1.1 Overview of S7-HiGraph. ...1-1 1.2 What Has Changed from V4.01 to V5.0? . ...1-4 1.3 Installation and Authorization. ...1-6 2 Designing a Program Using the Example of a Drill . ...2-1 2.1 Welcome to the Example for Getting Started in HiGraph. ...2-1 2.2 Prerequisites ...2-2 2.3 Automation Task Drilling Machine ...2-3 2.4 Steps to Create the "Drilling Machine" Programming Example...2-5 Step 1: Planning the Program Structure . ...2-6 Step 2: Designing the State Graphs . ...2-7 Step 3: Defining the Plant Signals . ...2-9 Step 4: Creating the "HiGr_Exp" Example in the SIMATIC Manager...2-10 Step 5: Creating a Symbol Table. ...2-11 Step 6: Creating a State Graph and StartingS7-HiGraph . ...2-12 Step 7: Declaring the Variables . ...2-13 Step 8: Inserting the States and Transitions ...2-14 Step 9: Entering the Actions and Transition Conditions. ...2-15 Step 10: Creating a Graph Group and Inserting Instances . ...2-16 Step 11: Assigning the Current Parameters. ...2-18 Step 12: Compiling the Graph Group. ...2-21 Step 13: Including the HiGraph FC in a STEP 7 Program . ...2-22 Step 14: Downloading and Debugging the User Program . ...2-23

长沙工控帮教育科技有限公司整理

(8)

3 Working withS7-HiGraph. ... 3-1 3.1 Structure of a Program Consisting of State Graphs and Graph Groups

(Instance Concept). ... 3-1 3.2 Steps for Creating a Program ... 3-2 3.3 Setting Up a STEP 7 Project ... 3-3 3.4 Starting S7-HiGraph and Creating State Graphs... 3-4 3.5 Control Interface and Setting the Work Area. ... 3-5 3.5.1 User Interface ...3-5 3.5.2 Arranging Working Windows . ...3-6 3.5.3 Saving and restoring the Window Arrangement . ...3-7 3.5.4 Setting the Size of the Drawing Area ...3-7 3.5.5 Enlarging and Reducing the View...3-7 3.5.6 Setting the Grid...3-8 3.5.7 Displaying and Hiding Instructions or Characteristics. ...3-8 3.5.8 Setting the Colors and Fonts for the Working Windows. ...3-8 3.5.9 Displaying Print Page Frames . ...3-9 3.6 Declaring Variables . ... 3-10 3.6.1 Meaning of the Variable Declaration. ... 3-10 3.6.2 The Variable Declaration Window. ... 3-10 3.6.3 Declaration Sections . ... 3-11 3.6.4 Columns in the Variable Declaration Window ... 3-11 3.6.5 Steps for Entering the Variable Declaration . ... 3-12 3.6.6 Using Predefined Variables... 3-12 3.6.7 Interaction between Variable Declarations and Instructions . ... 3-15 3.6.8 Interaction between Variable Declarations and

Current Parameter Assignments . ... 3-16 3.7 Programming the Structure of a State Graph. ... 3-17 3.7.1 Elements of a State Graph ... 3-17 3.7.2 Rules for the Structure of a State Graph. ... 3-17 3.7.3 Possibilities of Aligning Graphical Objects . ... 3-18 3.7.4 States . ... 3-19 3.7.5 Transitions . ... 3-22 3.7.6 Permanent Instructions ... 3-26 3.8 Programming Instructions... 3-27 3.8.1 Instructions in States and Transitions/Permanent Instructions . ... 3-27 3.8.2 Instruction Types. ... 3-28 3.8.3 Rules for Entering STL Instructions . ... 3-29 3.8.4 Settings for STL Instructions ... 3-30 3.8.5 Steps for Entering STL Instructions . ... 3-30 3.9 Programming Waiting and Monitoring Times . ... 3-31 3.9.1 Steps for Programming Waiting Times . ... 3-31 3.9.2 Steps for Programming Monitoring Times... 3-32 3.10 Programming Operating Modes. ... 3-33 3.10.1 Operating Modes . ... 3-33 3.10.2 Steps for Programming Operating Modes. ... 3-33 3.11 Programming Graph Groups ... 3-34 3.11.1 Graph Groups . ... 3-34 3.11.2 Steps for Programming Graph Groups . ... 3-35 3.11.3 Programming with Absolute or Symbolic Addresses ... 3-36

长沙工控帮教育科技有限公司整理

(9)

3.13 Display Reference Data ... 3-40 3.14 Saving and Compiling ... 3-42 3.14.1 Saving State Graphs and Graph Groups . ...3-42 3.14.2 Compilation of the Program . ...3-42 3.14.3 Setting the Compilation Parameters ...3-43 3.15 Calling and Loading S7-HiGraph FC. ... 3-45 3.15.1 Calling the FC from an S7 Program ...3-45 3.15.2 Requirements for Downloading...3-45 3.15.3 Downloading for the First Time...3-45 3.15.4 Reloading Changes ONLINE. ...3-46 3.16 Monitoring and Testing the Program. ... 3-47 3.16.1 Monitoring the Program Status ...3-47 3.16.2 Displaying in Program Status . ...3-47 3.16.3 Prerequisites for Starting the Program Status . ...3-49 3.16.4 Steps for Displaying the Program Status . ...3-49 3.16.5 STEP 7 Test Functions . ...3-50 3.17 Printing . ... 3-52 3.17.1 Printing a Program Documentation...3-52 3.17.2 Printing Steps. ...3-52 3.18 Working with Data from OlderS7-HiGraph Versions... 3-54 3.18.1 Converting Programs from HiGraph 2.6 / 2.7 . ...3-54 3.18.2 Using Programs Created inS7-HiGraph Version V4.0/4.01 ...3-55 4 Process Error Diagnosis ...4-1 4.1 Standard Diagnosis via ProTool/ProAgent . ...4-1 4.1.1 Standard Diagnosis via ProTool/ProAgent . ...4-1 4.1.2 Interaction between S7-HiGraph, the Automation System and the OP . ...4-2 4.1.3 Prerequisites for Standard Diagnosis. ...4-3 4.1.4 General Procedure for Creating Diagnostic Data (Standard Diagnosis). ...4-3 4.1.5 Displaying Messages in the Message Screen . ...4-4 4.1.6 Displaying of Initial Values in the Detail Screen . ...4-5 4.1.7 Displaying and Controlling Movements in the Movement Screen . ...4-6 4.1.8 Displaying Units in the Overview Screen . ...4-8 4.2 Diagnosis via Format Converter . ...4-9 4.2.1 Diagnosis via the Format Converter...4-9 4.2.2 Interaction between S7-HiGraph, the Automation System and the OP

(Format Converter)...4-10 4.2.3 Prerequisites for Diagnosis via the Format Converter . ...4-11 4.2.4 Generating Diagnostic Data for the Format Converter Diagnosis . ...4-11 5 STL Instruction Description . ...5-1 5.1 STL Instructions, Sorted by Instruction Families . ...5-1 5.2 STL Instructions, Sorted by Mnemonics...5-7 5.3 Valid Data Types. ... 5-10

长沙工控帮教育科技有限公司整理

(10)

6 Configuration Notes . ... 6-1 6.1 Introduction. ... 6-1 6.2 Automation Task Transfer Line. ... 6-2 6.3 Determining the Functions to be Controlled . ... 6-4 6.4 Determining the State Graphs . ... 6-5 6.5 Formation of Graph Groups... 6-6 6.6 Specifying the Program Structure. ... 6-8 6.7 Creating State Graphs. ... 6-9 6.7.1 Overview: State Graphs and Graph Groups for the Drill Unit ...6-9 6.7.2 State Graph for Controlling Operation Enables ... 6-10 6.7.3 State Graphs for Controlling Operating Modes ... 6-11 6.7.4 State Graph for Coordinating the Drill Unit. ... 6-13 6.7.5 Motor State Graph . ... 6-15 6.7.6 Clamp State Graph . ... 6-17 6.7.7 Valve_2E State Graph ... 6-19 6.7.8 Compiler Settings. ... 6-20 6.8 Standard Diagnosis Configuration . ... 6-21 6.8.1 Information on the Supplied Example . ... 6-21 6.8.2 State Graph for Generating the Operating-Mode Signals. ... 6-21 6.8.3 State Graphs with Coordination Function . ... 6-22 6.8.4 State Graphs which Realize a Movement . ... 6-22 6.8.5 Diagnostic Configuration in the Graph Groups... 6-25 7 User Program Run Behavior in the PLC . ... 7-1 7.1 Cyclic Processing of a State in the PLC. ... 7-1 7.2 Behavior on Startup and Restart . ... 7-3 7.3 Memory Requirements of the User Program. ... 7-6 8 Tips and Tricks . ... 8-1 Glossary... Glossary-1 Index . ...Index-1

长沙工控帮教育科技有限公司整理

(11)

1 Product Overview and Installation

1.1 Overview of S7-HiGraph

Application

S7-HiGraph extends the functional scope of STEP 7 to include a graphic programming method for state graphs.

With state graphs you can represent processes that you want to control with a SIMATIC programmable controller quickly and easily. The process is divided into individual functional units with a clearly defined functional scope. The behavior of each functional unit is described by means of a state graph.

The decisive advantage is that the program structure orientates itself to the technological objects involved in the process and is therefore easy to record.

The program structure is represented graphically and can be documented in the graphics. This representation is not only suitable for programmers of PLCs, but also for mechanical engineers, commissioning personnel, and service engineers.

Up

Movement down Movement up

down

Top

Top

Buttom

Down 3

2 1

0 1

1 1

1 Valves with the states

"Top" and "Bottom" and the movements "Up" and "Down"

Representation of states in a state graph

长沙工控帮教育科技有限公司整理

(12)

Programming language S7-HiGraph

S7-HiGraph programs are structured as follows:

• As a prerequisite for programming, automation tasks are divided into individual functional units. A functional unit can consist of a mechanical component (for example, a valve) or represent a conceptional unit (for example, "operating mode control"). The behavior of each functional unit is then described with the help of a state graph.

• In the state graphs the states are defined which the functional units can assume. Actions can be triggered in states. The execution time of the action can be defined: While entering the state, while in the state or while exiting the state.

• Transitions contain transition conditions which initiate a state change when they are fulfilled. It is also possible to program actions which are executed as soon as a transition is carried out.

• The actions and conditions in the states and transitions are defined using a subset of the STEP 7 programming language STL (Statement List).

• In order to generate a control program for a complete process from the

individual state graphs, the state graphs are grouped together in graph groups.

These correspond, for example, to the mechanical functional units of a machine. Within a group a state graph can be employed as coordinator.

• The state graphs can communicate with one another by means of messages.

Blocks of the user program

When a graph group is compiled, a function (FC) and a data block (DB) are created. The data block contains the data for the individual state graphs.

In order for the loaded S7-HiGraph program to be able to run in the CPU, the S7-HiGraph FC must be called from a cyclically processed block

(for example, OB 1).

OB1 Call the HiGraph FC

FC Graph group

DB Data for the state graph

长沙工控帮教育科技有限公司整理

(13)

Functions

S7-HiGraph offers the following functions:

• Comfortable development environment in Windows 95/98/NT standard.

• Programming of actions in states and transitions in STL.

• Calls of STEP 7 code blocks (FC, SFC, FB, SFB with STL, LAD, FBD, or SCL instructions) from the state graph.

• Programming of wait and monitoring times without using the S7 timers: One wait time and one monitoring time can be programmed for each state. The wait time can be used to delay the processing of a state. The monitoring time is used to monitor the execution time of states.

No S7 timers are required when programming wait and monitoring times.

These are only available to a limited extent depending on the respective CPU.

• Monitoring functions can also be programmed for the whole state graph.

Specific conditions (for example, emergency off) which arise can be monitored centrally, irrespective of the active state.

• Testing the behavior of the functional units with the ONLINE function "Status“

where the currently active state, the last transition, and the previous state are identified, and information on the instructions in states and transitions is displayed.

• Diagnosis of process faults: Error states, monitoring timeouts, and messages can be displayed on an operator interface device.

长沙工控帮教育科技有限公司整理

(14)

1.2 What Has Changed from V4.01 to V5.0?

The S7-HiGraph version 5.0 is based on the functionality of earlier HiGraph versions and furthermore offers improved editing and input methods as well as the possibility of process error diagnosis. The following functions have been developed or extended:

Process error diagnosis via ProTool/ProAgent

The process error diagnosis allows rapid recognition, finding and eliminating process errors. The following diagnostic functions are available:

• Outputting of messages if the system enters an error state or if a monitoring time is exceeded

• Determining the addresses causing the error (starting-count criteria analysis)

• Monitoring the movements of the units in the machine/plant as well as troubleshooting by means of tracked manual mode

Improved support during programming

You can use the menu command View > Symbolic Addresses/Absolute Addresses to toggle between absolute and symbolic display of the addresses in the program.

• In order to include symbolic names which are defined in the symbol table into an instruction, select the menu command Insert > Symbol. A list of all the symbols is then displayed.

• The points of use of an address in the program can be listed in an overview by using the menu command Edit > Go to > Point of Application. If you click on a point of use in the list, the program then jumps to this point.

• Linking of the incoming and outgoing messages in the current parameter window is supported by means of a selection list.

• A change in the variable name in the variable declaration is carried out automatically in the instructions of a state graph and in the current parameter assignment of a graph group.

• Instructions can now be arranged in instruction blocks. This facilitates automatic resetting of signals which were set while in the state.

长沙工控帮教育科技有限公司整理

(15)

Extended printing functions

• It is now possible to print out a list of the shared addresses used in S7-HiGraph.

• If you wish to adapt the layout of the state graphs or of the graph groups during drawing to the format of the print page to be used later, you can use the menu command View > Print Page Frame to have a frame displayed which shows the dimensions of the pages printed later. You can use the menu command Options > Align > To Page to center a marked object or a group of objects exactly on the print page.

Improved editor functions

• Instructions and current parameters are now displayed in a common window.

The window is displayed as soon as you double-click on a state or an instance.

If you deselect the element, the window is hidden again.

You can also keep the window open constantly by selecting the corresponding menu command from the context menu.

You can use the menu commands Window > Save Arrangement or

Window > Restore Arrangement to save the settings for the windows and to restore them later.

• In order to structure the state graph more clearly, you can use the menu command View > Details to display or hide the following elements:

- Instructions

- Permanent instructions

- Characteristics of states and transitions

• Copied or cut-out elements can be placed exactly at a desired position in the graphics by means of an interactive insertion cursor.

长沙工控帮教育科技有限公司整理

(16)

1.3 Installation and Authorization

System environment

The S7-HiGraph optional software package V5.0 runs on a programming device/PC with:

• Microsoft Windows 95/98/NT operating system

• STEP 7 Basic Package from Version 4.02.7 onwards or STEP 7 V5.0 from Service Pack 3 onwards (any corrections required for the basic package are supplied).

Hardware

The same requirements exist for S7-HiGraph as for the STEP 7 basic package.

The S7-HiGraph optional package also requires at least 10 Mbytes of additional memory capacity, depending on the installation variant selected.

Starting the installation program

S7-HiGraph includes a SETUP program which carries out the installation automatically. Prompts on the screen guide you step by step through the whole installation procedure.

Proceed as follows:

1. Under Windows 95/98/NT start the dialog for installing software by double- clicking on the “Add/Remove Software“ icon in the “Control Panel“.

2. Click on “Install“.

3. Insert the disk and click on “Continue“. Windows now automatically searches for the installation program "Setup.exe“.

4. Follow the instructions displayed by the installation program step by step.

On authorization

During installation the program checks whether the authorization required to use the S7-HiGraph programming software exists on the hard disk. If no authorization is found, a message is displayed to inform you that the software can only be used with authorization (user license). If you wish to, you can run the authorization program immediately or you can continue the installation and run the authorization at a later stage. In the first case you should insert the authorization diskette when prompted to do so.

长沙工控帮教育科技有限公司整理

(17)

!

CautionRead the information in the README.WRI file on the authorization diskette. If you do not adhere to these instructions, the authorization may be irretrievably lost.

If the authorization is lost ...

An authorization may be lost, for example, if a hard disk defect occurs and you did not have a chance to remove the authorization from the defective hard disk.

If you lose your authorization, you can fall back on the emergency license. It is also included on the authorization diskette. The emergency license allows you to continue using the software for a limited period of time. In this case, the time remaining until the license expires is displayed on the screen when you start it.

Within this time period you should obtain a replacement for the lost authorization.

Please contact your local Siemens distributor or sales office.

Note

For further information and rules on installing and removing the software please refer to the manual "Programming with STEP 7.

长沙工控帮教育科技有限公司整理

(18)

长沙工控帮教育科技有限公司整理

(19)

2 Designing a Program Using the Example of a Drill

2.1 Welcome to the Example for Getting Started in HiGraph

This example for getting started shows you in about an hour how to use

S7-HiGraph in order to create a program for the automation of the following drilling machine.

You first learn how to plan and structure an S7-HiGraph program efficiently and are then taken step-by-step through all the tasks that you have to carry out in the SIMATIC Manager and in S7-HiGraph in order to

• create the program,

• download it to the CPU and

• debug it.

The correctly programmed example is included in the scope of delivery as the project ZEn03_01_HiGraph_DrilMac. After the installation it is positioned in the directory STEP7\Examples.

长沙工控帮教育科技有限公司整理

(20)

2.2 Prerequisites

The following hardware and software components are required to program the example program as described:

• A programming device/personal computer on which the STEP 7 basic package and the S7- HiGraph optional package are installed.

• In order to download and debug the example program you require:

- An automation system with a digital input-output module (8DI+8DO).

In this example the S7-300 with CPU 314 is used. However, S7-HiGraph programs can also be executed on an S7-400 automation system.

- Or the S7-PLCSIM S7-optional package in order to simulate a CPU of the series S7-300 or S7-400.

长沙工控帮教育科技有限公司整理

(21)

2.3 Automation Task Drilling Machine

The structure of the drilling machine, shown in the technical diagram, and the sequence of the drilling process, shown in the function diagram, are specified.

Technical diagram: Structure of the drilling machine

Feed

Vice

Lower drill

Raise drill

Limit switch:

Drill at top

Limit switch:

Drill at bottom

Feedback : Set tension reached Drill motor on

Drill motor

Feedback:

- Drill running - Drill stationary

Start button

0

Basic state

The basic state of the drilling machine is defined as follows:

• Drill motor standing still.

• Feed/Drill is in the upper position.

• No workpiece is clamped.

Sequence during drilling

The drilling process is subdivided into the following steps:

1. Insert the workpiece and start the machine via the start pushbutton.

2. Clamp the workpiece (until the set clamping pressure is reached) 3. The drill motor starts up

4. Use the feed to lower the drill to the lower set position 5. Use the feed to raise the drill to the upper set position 6. Switch off the drill motor

长沙工控帮教育科技有限公司整理

(22)

The following function diagram shows the sequence of the drilling process:

Element Start

Motor

Feed Vice

State

On Off Running Stationary

Top Bottom

Step 1 2 3 4 5 6 7 8

长沙工控帮教育科技有限公司整理

(23)

2.4 Steps to Create the "Drilling Machine" Programming Example

Program design

- Design the structure of the complete program and of the individual state graphs

- Define plant signals

Create "HiGr_Bsp" project in the SIMATIC manager

Symbolic programming?

Program state graphs:

- Create - Declare variable

- Insert states and transitions

- Enter actions and transition conditions

Program graph group - Create

- Insert instances of state graphs - Assign actual parameters - Compile

Program OB1 with calling of the HiGraph FC

Download example program to the CPU and test it

Create symbol table Yes

No

长沙工控帮教育科技有限公司整理

(24)

Step 1: Planning the Program Structure

First define which state graphs are required for the drilling machine example. The following rules apply:

• One state graph is required per function unit or task.

Usually one state graph is used for every mechanical component of a process.

In addition there are further functions, such as for example, the control of the operating modes or the control of operation enables. These are also mapped to a state graph.

• The state graphs can be structured hierarchically. It is thus possible to insert one or more state graphs which coordinate the other state graphs in a graph group.

The drilling machine can be divided into the functional units "Drill_motor“, “Feed"

and "Vice“. The feed is realized by means of a valve with two limits.

The state graphs "Motor", "Valve_2I" and "Vice" are required to control these functional units. The state graph for coordinating is to be called "Drilling".

Feed

Vice Drill motor on

Drill motor

Feedback:

- Drill running - Drill stationary

Start button

0

Valve_2T 0

1

2 3

1

1 1 1

State graphs for the individual functional units Motor

0

1

2 3

1

1 1 1 Vice

0

1

2 3

Drilling 0

1

2 3

1 1

1 1

1 1

1 1

长沙工控帮教育科技有限公司整理

(25)

Step 2: Designing the State Graphs

From the function unit to the state graph

In this example for getting started the state graph "Valve_2I" is to be programmed.

The further state graphs required already exist in the supplied example project

"ZEn03_01_HiGraph_DrilMac".

The functional unit on which the “Valve_2I“ state graph is based is a valve unit with two limits. The valve unit consists of the following elements:

• A solenoid valve for the "Up" movement“

• A solenoid valve for the "Down" movement“

• A limit switch for the "Top" limit

• A limit switch for the "Bottom" limit.

It is assumed that the solenoid valves only have to be operated for the movement phase and that the valve remains in the respective limit.

Up

Down

Top Bottom

State

Movement down

End position

Movement up

Bottom Top

0 1 2 3 4

Determining the states

The valve can thus assume the following states:

No. State Description

0 Initialization A state for the initialization is required in every state graph.

In the initial state it is possible to check whether the functional unit is in a defined initial position. If required, it can be brought to the initial position.

1 "Top" limit Drill in the upper limit position 2 "Down" movement Drill travels downwards 3 "Bottom" limit Drill in the lower limit position

长沙工控帮教育科技有限公司整理

(26)

Determining the state change

The "Drilling" state graph determines when the valve unit changes from one state to the next. For this purpose it sends messages to the "Valve_2I".

When the valve reaches the limit, a message is returned to the "Drilling" state graph.

Designing the state graph

The structure of the "Valve_2I" state graph can now be specified on the basis of these specifications.

Drill in upper end position:

State

0

State

4

State

1

State

2

State

3

Action:

Step enabling condition:

Message “Drill at top” is sent to the coordinating graph

Is the message “Lower”

received from the coordinating graph?

Trigger feed.

Bottom end position reached?

Initialization:

None None

Drill moves downwards:

Drill in lower end position:

Trigger feed

Top end position reached?

Drill moves upwards:

Action:

Action:

Action:

Step enabling condition:

Step enabling condition:

Step enabling condition:

Action:

Step enabling condition:

Action:

Message “Drill at bottom” is sent to the coordinating graph

Is the message “Raise”

received from the coordinating graph?

长沙工控帮教育科技有限公司整理

(27)

Step 3: Defining the Plant Signals

After you have split the drilling process into its individual functions, you should define the corresponding inputs and outputs for each state. The concept is based on the technical diagram and the flow chart.

List the corresponding inputs and outputs of the drilling machine in an assignment table.

If you want to program your program symbolically, enter the desired symbolic designations (for example, I0.4 "Tension_reached") and any remarks required to understand the program better (for example, "Feedback for workpiece set clamping pressure reached") in addition to the absolute inputs and outputs.

In the drilling machine example we assume that the switches and contactors of the drilling machine are controlled via the inputs and outputs of the digital input/output module of the S7-300 automation system. The input/output module has 8 inputs and 8 outputs. The default values of the input and output addresses of the module on Slot 4 are: I0.0 to I0.7 and O0.0 to O0.7.

Address, absolute Address, symbolic Description Inputs in the program

I 0.0 Drill_motor_running Feedback for "Drill running with set speed“

I 0.1 Drill_motor_stopped Feedback for "Drill stopped“

I 0.2 Drill_at_bottom Limit switch for "Drill in bottom position“

I 0.3 Drill_at_top Limit switch for "Drill in top position“

I 0.4 Tension_reached Feedback for "Workpiece set clamping pressure reached"

I 0.7 Start_button Start button of the drilling machine

Outputs in the program

Q 0.0 Drill_motor_on Switch drill motor on

Q 0.1 Lower_drill Use the feed to lower the drill to the lower limit Q 0.2 Raise_drill Use the feed to raise the drill to the upper limit Q 0.3 Clamp_workpiece Clamp/fix workpiece with set pressure

长沙工控帮教育科技有限公司整理

(28)

Step 4: Creating the "HiGr_Exp" Example in the SIMATIC Manager

Creating the project

Prerequisite for programming with S7-HiGraph is a project in which the data of the S7-HiGraph program is saved.

Projects for state graph programming is not different to other projects in STEP 7.

Proceed as follows in order to create a new project in the SIMATIC Manager.

1. Select the File > "New Project" Wizard

2. The STEP 7 Wizard which is now started supports you in creating the project.

The Wizard prompts you to specify the following data:

- Which CPU are you using in your project?

Specify your CPU. In the supplied example the CPU 314 is used.

- Which block do you want to add?

Select the OB1.

- What do you want to call your project?

Enter the name "HiGr_Exp".

Project structure

The STEP 7 Wizard creates a folder for the station selected by you. This in turn contains a subfolder with the selected CPU. This contains the S7 program with folders for blocks, symbols and sources.

When configuring the structure, an "S7 Program" directory is automatically created for each CPU you have provided for. This directory serves as the folder for the blocks, the sources and the symbols of the user program.

• Call the S7 program “Drilling machine“.

The following figure shows the structure of the example project.

长沙工控帮教育科技有限公司整理

(29)

Step 5: Creating a Symbol Table

Since you want to program the program with symbolic addresses, it is advisable to create the symbol table as the next step.

• For this purpose open the symbol table in the "Drilling machine" directory by double-clicking on the "Symbols" folder and edit the table as shown in the following figure.

The HiGraphErrEmitterFB (FB 20) and HiGraphMsgEmitterFC (FC 101) blocks as well as the system function blocks SFC 51, SFC 52 and SFC 64 are required for diagnostic functions. The blocks are contained in the Standard library or in the HiGraph library.

长沙工控帮教育科技有限公司整理

(30)

Step 6: Creating a State Graph and Starting S7-HiGraph

Creating a state graph

Only the state graph "Valve_2I" is to be programmed in this introductory example.

The further state graphs required already exist in the supplied example project

"ZEn03_01_HIGRAPH_DrilMac".

State graphs are saved in the "Sources" folder of the S7 program.

Proceed as follows:

1. Open the "Sources" folder in the S7 program in the SIMATIC Manager.

2. Select the Insert > S7 Software > State Graph menu command.

3. Name the created state graph “Valve_2I“.

Starting S7-HiGraph

The S7-HiGraph is started by double-clicking on the “Valve_2I“ state graph in the

"Sources" folder. “Valve_2I“ is opened and already contains the first state (initial state) and the first transition which leads to this state.

长沙工控帮教育科技有限公司整理

(31)

Step 7: Declaring the Variables

Now define the variables which the state graph will use.

1. Open the variable declaration window by using the command button . 2. The declaration sections are shown in the left-hand partial window. They

contain predefined variables, which S7-HiGraph enters automatically into the declaration when creating a state graph. Enter the following additional variables. To do so double-click in the left-hand partial window on the desired declaration section and enter the variable name as well as the data type and the message type in the right-hand partial window.

Declaration section Name Data type Message

IN Top BOOL

Bottom BOOL

OUT Up BOOL

Down BOOL

IN_OUT IM_raise BOOL In

IM_lower BOOL In

OM_top BOOL Out

OM_bottom BOOL Out

The following figure shows the filled-out variable declaration window. The IN_OUT declaration section is selected.

长沙工控帮教育科技有限公司整理

(32)

Step 8: Inserting the States and Transitions

Now insert the states and transitions in the editing window for state graphs as shown in the figure below.

1. Select the Insert > State menu command and insert the states 1 - 4.

2. Use the Options > Align menu command to position them exactly.

3. Select the Insert > Transition menu command and interconnect the states. Always begin and end a transition in the center of a state circle. Only this method ensures that the transition has a connection to the state. Transition ends which do not have a connection to a state are identified by a small crossline. These are treated as special forms of transitions (as Return or Any transitions).

1 1

1 1

1

Movement 4

Bottom 3

Movement 2

Top

1

1

Init 0

Entering state names

Now enter a name for each state in order to improve the structural clarity:

1. For this purpose select the state and then select the Edit > Object Properties menu command. The command can also be called up by using the right-hand mouse button.

2. Enter a name in the "Name" input field.

The name is displayed in a box next to the state. Use the mouse to drag the box to a suitable position on the drawing area.

长沙工控帮教育科技有限公司整理

(33)

Step 9: Entering the Actions and Transition Conditions

The following figure shows the actions and transition conditions which you have to program. Proceed as follows:

1. First select state 4.

2. Use the View > Instructions/Current parameters menu command to have the input windows for instructions displayed.

3. Select the "Cyclic actions" instruction type in the left-hand partial window.

4. Press the right-hand mouse button and select the "Insert" menu command.

A new instruction line is inserted.

5. Select the new instruction and enter =Up; in the right-hand partial window.

Always complete instructions with a semicolon.

6. Now click all further states consecutively and enter the corresponding instructions.

Please note, that the address Down requires the symbol ID #Down in the instruction for state 2, as STEP 7 uses Down as the key word for an output byte.

7. Then select the transition from state 4 to state 1.

8. Select the "Conditions" instruction type in the left-hand partial window.

9. Press the right-hand mouse button and select the "Insert" menu command.

A new condition is inserted.

10. Enter the condition U Top;. Here again always end the line with a semicolon.

11. Use the same procedure for all other transitions.

? A IM_Lower;

1

? A Top;

1

? A M_Raise;

1

? A Bottom;

1 1

C = Up;

Movement up

4

C = OM_Bottom;

Bottom

3

C = Down;

Movement down

2

C = OM_Top;

Top

1

?A INIT_SD; 1

Init 0

长沙工控帮教育科技有限公司整理

(34)

Step 10: Creating a Graph Group and Inserting Instances

Copying further state graphs

You have now created the "Valve_2I" state graph successfully. In the next step copy the remaining state graphs needed into your S7 program.

• Change to the SIMATIC Manager and copy the state graphs "Motor", "Vice"

and "Drill" from the program "ZEn03_01_HIGRAPH_DrilMac" to the "Sources"

folder of your program.

Creating a graph group

In a graph group you define the sequence in which the state graphs are to be executed cyclically during the program execution.

Graph groups are created in the same file as the state graphs. Proceed as follows:

1. Open the "Sources" folder in the S7 program in the SIMATIC Manager.

2. Select the Insert > S7 Software > Graph Group menu command.

3. Name the created graph group "Drilling machine" and open it by double-clicking on it.

Inserting instances

After you have opened the "Drilling machine" graph group an empty drawing area is displayed into which you can insert the instances of the "Valve_2I", "Motor" and

"Vice" state graphs.

1. Select the Insert > Instance menu command.

2. In the subsequent dialog box select the "Valve_2I" state graph.

3. Position the instance on the drawing area.

4. Repeat the process until you have inserted the instances of all four state graphs.

5. Now assign explanatory names to the instances by calling up the "Instance Properties" dialog box with the Edit > Object Properties menu command.

Enter the following names in the "Name" input field.

Call the instance of the state graph... By the name...

Valve_2I Feed

Motor Drill_motor

Vice Vice

Drilling Drilling

长沙工控帮教育科技有限公司整理

(35)

Specifying the run sequence

The instances should be executed in the following sequence:

1. Drilling 2. Drill_motor 3. Feed 4. Vice

Assign the correct position in the run sequence to the instances by selecting the Edit > Run Sequence menu command.

长沙工控帮教育科技有限公司整理

(36)

Step 11: Assigning the Current Parameters

In the graph group you assign current parameters to the formal parameters of the instances. Enter the current parameters as follows:

1. If the input window for the current parameters is not displayed, use the View > Instructions/Current parameters menu command to have it displayed.

2. Select the "Feed" instance and enter the current parameters listed below (displayed in bold).

3. Use the same procedure for the "Drill_motor", "Vice" and "Drill" instances.

The following tables list the current parameters which have to be assigned to the instances.

Current parameters of the "Feed" instance

Area Name Data type Current parameter Message

IN Top BOOL Drill_at_top

Bottom BOOL Drill_at_bottom

OUT Up BOOL Raise_drill

Down BOOL Lower_drill

IN_OUT IM_raise BOOL In

IM_lower BOOL In

OM_top BOOL Drilling.IM_top Out

OM_bottom BOOL Drilling.IM_bottom Out

Current parameters of the "Drill_motor" instance

Area Name Data type Current parameter Message

IN Motor_running BOOL Drill_motor_running

Motor_stopped BOOL Drill_motor_stopped

OUT Motor_on BOOL Drill_motor_on

IN_OUT IM_motor_start BOOL In

IM_motor_stop BOOL In

OM_motor_running BOOL Drilling.IM_motor_running Out OM_motor_stopped BOOL Drilling.IM_motor_stopped Out

长沙工控帮教育科技有限公司整理

(37)

Current parameters of the "Vice" instance

Area Name Data type Current parameter Message

IN TensionReached BOOL Tension_Reached

OUT Clamp BOOL Clamp_workpiece

IN_OUT IM_Tighten BOOL In

IM_Loosen BOOL In

OM_Tensioned BOOL Drilling.IM_Tensioned Out

OM_Loosened BOOL Drilling.IM_Loosened Out

Current parameters of the "Drill" instance

Area Name Data type Current parameter Message

IN Start BOOL Start_button

IN_OUT OM_motor_start BOOL Motor.IM_Motor_Start Out

OM_motor_stop BOOL Motor.IM_Motor_Stop Out

IM_motor_running BOOL In

IM_motor_stopped BOOL In

OM_lower BOOL Feed.IM_lower Out

OM_ raise BOOL Feed.IM_raise Out

IM_bottom BOOL In

IM_top BOOL In

OM_Tighten BOOL Vice.IM_Tighten Out

OM_Loosen BOOL Vice.IM_Loosen Out

IM_Tensioned BOOL In

IM_Loosened BOOL In

长沙工控帮教育科技有限公司整理

(38)

After the current parameters have been entered the graph group has the following structure:

长沙工控帮教育科技有限公司整理

(39)

Step 12: Compiling the Graph Group

Specifying the FC and DB

Enter the name of the blocks to be generated (FC and DB) in the "Compile" tab card (Options > Settings for Graph Groups/State Graphs menu command). In this example use the names FC1 and DB1 or the symbolic designators

DB_GG_Drillingmachine and GG_Drillingmachine.

Specifying the compilation options

Further compilation options are offered in the "Compile" tab card. Activate the option "Cyclic actions with RLO = 0". The remaining options do not have to be changed.

Compiling a graph group

The graph group is compiled with the File > Compile menu command .

长沙工控帮教育科技有限公司整理

(40)

Step 13: Including the HiGraph FC in a STEP 7 Program

Calling the FC in the OB1

To process the S7-HiGraph program for the drilling machine in the automation system, it is called from the organization block OB1. Program the OB 1 in the LAD/STL/SFC editor of the STEP 7 basic package. The function (FC) generated by S7-HiGraph has a parameter "INIT_SD“. This parameter is to be supplied in such a matter that signal "1" applies when the control system is activated and Signal "0"

applies during the subsequent cycles. This initializes the state graphs in the graph group. The signal can be generated by means of the OB 1 start info (variable

#OB1_SCAN_1) and saved in a temporary variable of the OB 1.

Please note that in addition, a variable "startup", data type BOOL has to be in the variable declaration of the OB.

长沙工控帮教育科技有限公司整理

(41)

Step 14: Downloading and Debugging the User Program

You have to download the complete user program “Example“ (OB 1, FC, DB) to the CPU of the automation system by means of the SIMATIC Manager.

Proceed as follows:

1. Set the CPU to STOP.

2. In your project “HiGr_Exp“ open the CPU which was assigned to the user program.

3. Open the S7 program and select the "Blocks" folder.

4. Select the PLC > Download menu command .

Debugging the user program

Proceed as follows in order to debug the S7-HiGraph program:

1. Set the CPU to RUN.

2. Open the graph group and select the Debug > Monitor menu command . Information on processing the graph group is now displayed. The current state of each instance is displayed.

3. Now mark one or several instances and select the Edit > Open Object menu command.

The instances are opened ONLINE, the following information is displayed:

- The active state is highlighted in color

- The transition which lead to this state and the last active state are highlighted by shading

- A table with detailed status information is displayed for the transition outgoing from the active state with the highest priority.

4. The monitoring mode is terminated by deactivating the Debug > Monitor menu command .

长沙工控帮教育科技有限公司整理

(42)

长沙工控帮教育科技有限公司整理

(43)

3 Working with S7-HiGraph

3.1 Structure of a Program Consisting of State Graphs and Graph Groups (Instance Concept)

Function of state graphs

State graphs are program components which can be used several times. The state graphs which you have created for a certain functional unit can be used again at other program points at which a similar functional unit is required.

All the state graphs which you have programmed within an S7 program are saved centrally in the "Sources" folder. From there you can add them as often as required in one or more graph groups and thus call them.

The call of a state graph in a graph group is called an instance.

Changes to state graphs can be carried out centrally: The changes carried out in a state graph act in all the instances of this state graph.

Function of graph groups

In a graph group you define an ordered sequence of calls of state graphs which is executed cyclically in the run sequence when the program is executed.

Declare all the signals used in a state graph as formal parameters so that you can use all the state graphs several times without having to adapt the addresses contained in them. For every call of a state graph define the current parameters of the respective state-graph interface in the graph group.

长沙工控帮教育科技有限公司整理

(44)

3.2 Steps for Creating a Program

The flowchart provides an overview of the steps needed to create an S7-HiGraph program. The individual steps are described in the following chapters.

Create state graphs

Declare variables

Program states

Program transitions

Program permanent instructions

Create a graph group

Insert instances of state graphs

Set the run sequence

Assign actual parameters

Save and compile Program messages

长沙工控帮教育科技有限公司整理

(45)

3.3 Setting Up a STEP 7 Project

The following prerequisites must be created in the SIMATIC Manager before you begin to program withS7-HiGraph.

Creating a project

1. Select the File > New > Project menu command in the SIMATIC Manager.

2. Enter a name for the project and open it.

Creating a symbol table

If you want to program with symbolic addresses, it is advisable to create the symbol table before programming.

1. Open the symbol table of your S7 program in the SIMATIC Manager.

2. Enter the required symbols in the table.

Note

From Version 4 on STEP 7 provides a Wizard which helps you in building a complete project structure. In order to start the Wizard use the File > Wizard "New Project" menu command.

长沙工控帮教育科技有限公司整理

(46)

3.4 Starting S7-HiGraph and Creating State Graphs

Starting from the Windows user interface

After you have installed the software on your programming device/personal computer, you can call up theS7-HiGraph via the "Start" command button on the task bar in Windows 95/98/NT (entry under "Simatic/STEP 7").

Starting from the SIMATIC Manager

You can also startS7-HiGraph in the SIMATIC Manager by positioning the cursor on a graph group or a state graph in the "Sources" folder and double-clicking on it.

Creating and opening state graphs in S7-HiGraph

1. In order to create a state graph select the File > New State Graph menu command. In order to open an existing state graph select File > Open.

2. In the subsequent dialog box select the "Sources" folder of your S7 program.

3. Select the "state graph" type in the "Object type" selection field.

4. In order to create a state graph enter the desired name in the "File name" input field and confirm your input with "OK".

In order to open an existing state graph select the desired name and confirm your input with "OK".

Creating and opening state graphs in the SIMATIC Manager

• Open the "Sources" folder in your S7 program.

• Existing state graphs in this folder can be opened by double-clicking on them.

In order to create a state graph select the Insert > S7 Software > State Graph menu command.

A new state graph contains an initial state and a startup transition as well as the instruction table for permanent instructions.

长沙工控帮教育科技有限公司整理

(47)

3.5 Control Interface and Setting the Work Area

3.5.1 User Interface

The following figure showsS7-HiGraph with a newly created state graph.

Function of the windows

The S7-HiGraph user interface consists of various windows which you can hide or display as required. In order to use the available screen area optimally, you can use the mouse to change the size of the windows or to move them.

The individual windows have the following functions:

Window Name/Function

(1) The diagrams of the state graphs and graph groups are created in the working window.

(2) Enter the variable declaration of the processed state graph in the variable declaration window.

It can be displayed by using the View > Variables menu command.

长沙工控帮教育科技有限公司整理

(48)

Window Name/Function

(3) The View > Instructions/Current parameters menu command is used to have the Instructions/Current Parameters window displayed. It consists of two tab cards:

The "Instructions" tab card is active by default when you edit a state graph. Here you program the contents of states, transitions and permanent instructions.

The "Current parameters" tab card is active by default when you edit a graph group. Here you define the current parameters of instances.

(4) Errors and warnings occurring are output in the "Messages" window. Here you can choose between two register tabs:

The "Document Messages" tab card shows syntax errors which were found in the state graph or the graph group currently opened. It is displayed automatically as soon as an error or an inconsistency occurs in the program.

Error messages and warnings arising during compiling are output in the "Application Messages" tab card. The window is displayed after every compilation run. The messages can refer to errors in the graph group or to state graphs instanced in it.

Use the View > Messages menu command to have the window displayed when required.

3.5.2 Arranging Working Windows

You can change the positioning of the windows which exists when S7-HiGraph is opened and adapt it to your personal requirements.

The following functions are available:

You can use the View menu to display or hide the output window for errors and warnings, the variable declaration window and the instruction window.

• The instruction window can also be opened by double-clicking on a state or a transition. In this case it is hidden again as soon as you click on another element in the working window. However, you can also keep the instruction window open by selecting the Remain open menu command from the pop-up menu.

• In order to move the output window for errors and warnings, the instruction window or the variable declaration window, click on the inner window edge and drag the window to the desired position. The partial windows can only be placed at the outer edge of the working surface.

If several windows are opened, you can use the Window > Arrange menu command to cascade them, position them horizontally or vertically next to each other.

• The usual Windows commands can be used to minimize, maximize or close the windows.

• The status bar and toolbars can also be hidden. To do so use the View > Status bar or View > Toolbars menu commands.

长沙工控帮教育科技有限公司整理

參考文獻

相關文件

6 《中論·觀因緣品》,《佛藏要籍選刊》第 9 冊,上海古籍出版社 1994 年版,第 1

The first row shows the eyespot with white inner ring, black middle ring, and yellow outer ring in Bicyclus anynana.. The second row provides the eyespot with black inner ring

• One technique for determining empirical formulas in the laboratory is combustion analysis, commonly used for compounds containing principally carbon and

Quadratically convergent sequences generally converge much more quickly thank those that converge only linearly.

denote the successive intervals produced by the bisection algorithm... denote the successive intervals produced by the

Robinson Crusoe is an Englishman from the 1) t_______ of York in the seventeenth century, the youngest son of a merchant of German origin. This trip is financially successful,

fostering independent application of reading strategies Strategy 7: Provide opportunities for students to track, reflect on, and share their learning progress (destination). •

[This function is named after the electrical engineer Oliver Heaviside (1850–1925) and can be used to describe an electric current that is switched on at time t = 0.] Its graph