logo资料库

软PLC控制技术标准编程规范IEC611-31.pdf

第1页 / 共240页
第2页 / 共240页
第3页 / 共240页
第4页 / 共240页
第5页 / 共240页
第6页 / 共240页
第7页 / 共240页
第8页 / 共240页
资料共240页,剩余部分请下载后查看
Strukturierte Lesezeichen
Contents
1 Introduction
1.1 Subject of the Book
1.2 The IEC 61131 standard
1.2.1 Goals and benefits of the standard
Manufacturers (PLC hardware and software)
Customers
1.2.2 History and components
1.3 The Organisation PLCopen
1.3.1 Aims
1.3.2 Committees and fields of activity
1.3.3 Results
Certification
Exchange format for user programs
2 Building Blocks of IEC€61131
2.1 Introduction to the New Standard
2.1.1 Structure of the building blocks
Declaration of variables
Code part of a POU
2.1.2 Introductory example written in IL
2.1.3 PLC assignment
2.2 The Program Organisation Unit (POU)
2.3 Elements of a POU
2.3.1 Example
2.3.2 Declaration part
Types of variables in POUs.
Characteristics of the POU interface
The formal parameters and return values of a POU
External and internal access to POU variables
2.3.3 Code part
2.4 The Function Block
2.4.1 Instances of function blocks
What is an “instance”?
Instance means “structure”.
Instance means “memory”.
Relationship between FB instances and data blocks.
2.4.2 Re-usable and object-oriented FBs
2.4.3 Types of variables in FBs
2.5 The Function
2.5.1 Types of variables in functions and the function value
2.5.2 Execution control with EN and ENO
2.6 The Program
2.7 Calling Functions and Function Blocks
2.7.1 Mutual calls of POUs
2.7.2 Recursive calls are forbidden
2.7.3 Calling with formal parameters
2.7.4 Calls with input parameters omitted or in a different order
2.7.5 FB instances as actual FB parameters
Example of an indirect FB call.
FB instance names as actual parameters of functions.
Function values as actual parameters.
2.8 Summary of POU Features
3 Variables, Data Types and Common Elements
4 The New Programming Languages of IEC€61131-3
5 Standardised PLC Functionality
5.1 Standard Functions
5.1.1 Overloaded and extensible functions
Overloaded functions
Extensible functions
5.1.1 Examples
Type conversion functions
Numerical functions
Arithmetic functions
Bit-shift functions
Bitwise Boolean functions
Selection functions
Comparison functions
Character string functions
Functions for time data types.
Functions for enumerated data types
5.2 Standard Function Blocks
5.2.2 Examples
Bistable element (flipflop)
Edge detection
Counter
Timer
6 State-of-the-Art PLC Configuration
6.1 Structuring Projects with Configuration Elements
6.2 Elements of a Real-World PLC Configuration
6.3 Configuration Elements
6.3.1 Definitions
6.3.2 The CONFIGURATION
6.3.3 The RESOURCE
6.3.4 The TASK with run-time program
6.3.5 ACCESS declarations
6.4 Configuration Example
6.5 Communication between Configurations and POUs
7 Innovative PLC Programming Systems
7.1 Requirements of Innovative Programming Tools
7.2 Technological Change
7.2.1 Processor performance
7.2.2 Full-graphics display and printout
7.2.3 Operating systems
7.2.4 Uniform user interfaces
7.3 Decompilation (Reverse Documentation)
7.3.1 No decompilation
7.3.2 Decompilation with symbols and comments
7.3.3 Decompilation including graphics
7.3.4 Sources stored in the PLC
7.4 Language Compatibility
7.4.1 Cross-compilation
The motivation for cross-compilation
Different approaches in graphical and textual languages.
Differences in languages affect cross-compilation.
Restrictions in LD/ FBD.
Restrictions in IL/ ST.
Cross-compilation IL / ST.
Full cross-compilation only with additional information.
Quality criteria for cross-compilation.
7.4.2 Language independence
7.5 Documentation
7.5.1 Cross-reference list
7.5.2 Allocation list (wiring list)
7.5.3 Comments
7.6 Project Manager
7.7 Test & Commissioning Functions
7.7.1 Program transfer
7.7.2 Online modification of a program
7.7.3 Remote control: Starting and stopping the PLC
7.7.4 Variable and program status
7.7.5 Forcing
7.7.6 Program test
7.7.7 Testing Sequential Function Chart programs
7.8 Data Blocks and Recipes
7.9 FB Interconnection
7.9.1 Data exchange and co-ordination of blocks in distributed systems
7.9.2 Macro techniques in FB interconnection
7.10 Diagnostics, Error Detection and Error Handling
Error concept of IEC€61131
Extended error handling model (beyond IEC).
7.11 Hardware-Dependence
7.12 Readiness for New Functionality
7.12.1 Exchange of programs and data
7.12.2 Extension with additional software packages
8 Main Advantages of IEC€61131
8.1 Convenience and Security with Variables and Data Types
8.2 Blocks with Extended Capabilities
8.3 PLC Configuration with Run-Time Behaviour
8.4 Uniform Programming Languages
8.5 Structured PLC Programs
8.6 Trend towards Open PLC Programming Systems
8.7 Conclusion
9 Programming by Configuring with IEC€61499
9.1 Programming by FB Interconnection with IEC€61131
9.2 IEC 61499 – The Programming Standard for Distributed PLC Systems
9.2.1 System model
9.2.2 Device model
9.2.3 Resource model
9.2.4 Application model
9.2.5 Function block model
Composite function blocks
9.2.6 Creating an application
9.3 Overview of the Parts of IEC€61499
10 Contents of CD-ROM
10.1 IEC Programming Systems STEP€7 and OpenPCS
Demo versions of STEP€7 (Siemens) and OpenPCS (infoteam).
Footnote
IL examples
10.2 Buyer's Guide for IEC€61131
A Standard Functions
A.1 Type Conversion Functions
A.2 Numerical Functions
A.3 Arithmetic Functions
A.4 Bit-Shift Functions
A.5 Bitwise Boolean Functions
A.6 Selection Functions for Max., Min. and Limit
A.7 Selection Functions for Binary Selection and Multiplexers
A.8 Comparison Functions
A.9 Character String Functions
A.10 Functions for Time Data Types
A.11 Functions for Enumerated Data Types
B Standard Function Blocks
B.1 Bistable Elements (Flip-Flops)
B.2 Edge Detection
B.3 Counters
B.4 Timers
C IL Examples
C.1 Example of a FUNCTION
C.2 Example of a FUNCTION_BLOCK
C.3 Example of a PROGRAM
D Standard Data Types
E Causes of Error
F Implementation-Dependent Parameters
G IL Syntax Example
G.1 Syntax Diagrams for IL
G.2 IL Example from Syntax Diagrams
H Reserved Keywords and Delimiters
H.1 Reserved Keywords
H.2 Delimiters
I Planned Amendments to the Standard
J Glossary
K Bibliography
L Index
1
2
Contents 1 Introduction ........................................................................................................9 1.1 Subject of the Book .........................................................................................10 1.2 The IEC 61131 standard ..................................................................................12 1.2.1 Goals and benefits of the standard ................................................................12 Manufacturers (PLC hardware and software)......................................................................... 13 Customers............................................................................................................................... 13 1.2.2 History and components ...............................................................................14 1.3 The OrganisationPLCopen ..............................................................................16 1.3.1 Aims..............................................................................................................16 1.3.2 Committees and fields of activity..................................................................17 1.3.3 Results ..........................................................................................................18 Certification ........................................................................................................................... 18 Exchange format for user programs........................................................................................ 19 2 Building Blocks of IEC 61131-3.......................................................................21 2.1 Introduction to the New Standard ....................................................................21 2.1.1 Structure of the building blocks....................................................................22 Declaration of variables.......................................................................................................... 22 Code part of a POU ................................................................................................................ 23 2.1.2 Introductory example written in IL ...............................................................25 2.1.3 PLC assignment ............................................................................................27 2.2 The Program Organisation Unit (POU) ...........................................................30 2.3 Elements of a POU ..........................................................................................32 2.3.1 Example ........................................................................................................33 2.3.2 Declaration part ............................................................................................34 Types of variables in POUs. ................................................................................................... 35 Characteristics of the POU interface ...................................................................................... 36 The formal parameters and return values of a POU................................................................ 37 External and internal access to POU variables ....................................................................... 37 2.3.3 Code part ......................................................................................................39 2.4 The Function Block .........................................................................................41 2.4.1 Instances of function blocks..........................................................................41 What is an “instance”? ........................................................................................................... 41 Instance means “structure”. ................................................................................................... 43 Instance means “memory”..................................................................................................... 45
2 Contents Relationship between FB instances and data blocks............................................................... 46 2.4.2 Re-usable and object-oriented FBs .............................................................. 47 2.4.3 Types of variables in FBs............................................................................. 48 2.5 The Function ................................................................................................... 48 2.5.1 Types of variables in functions and the function value ................................ 49 2.5.2 Execution control with EN and ENO ........................................................... 50 2.6 The Program.................................................................................................... 52 2.7 Calling Functions and Function Blocks........................................................... 53 2.7.1 Mutual calls of POUs ................................................................................... 53 2.7.2 Recursive calls are forbidden ....................................................................... 54 2.7.3 Calling with formal parameters .................................................................... 56 2.7.4 Calls with input parameters omitted or in a different order.......................... 59 2.7.5 FB instances as actual FB parameters .......................................................... 60 Example of an indirect FB call. .............................................................................................. 62 FB instance names as actual parameters of functions............................................................. 63 Function values as actual parameters. .................................................................................... 63 2.8 Summary of POU Features.............................................................................. 64 3 Variables, Data Types and Common Elements.............................................. 65 3.1 Simple Language Elements ............................................................................. 65 3.1.1 Reserved keywords ..................................................................................... 67 3.2 Literals and Identifiers .................................................................................... 68 3.2.1 Literals ......................................................................................................... 68 3.2.2 Identifiers ..................................................................................................... 70 3.3 Meanings of Data Types and Variables........................................................... 71 3.3.1 From direct PLC addresses via symbols to variables ................................... 72 3.3.2 The data type determines the properties of variables ................................... 73 3.3.3 Type-specific use of variables...................................................................... 74 3.3.4 Automatic mapping of variables onto the PLC ............................................ 75 3.4 Data Types ...................................................................................................... 75 3.4.1 Elementary data types .................................................................................. 76 3.4.2 Derived data types (type definition) ............................................................. 77 Additional properties for elementary data types. .................................................................... 78 Arrays. .................................................................................................................................... 80 Data structures........................................................................................................................ 81 Initial values in type definitions. ............................................................................................ 83 3.4.3 Generic data types........................................................................................ 84 3.5 Variables ......................................................................................................... 85 3.5.1 Inputs, outputs and flags as special variables ............................................... 86 3.5.2 Multi-element variables: arrays and structures............................................. 88 3.5.3 Assignment of initial values at the start of a program .................................. 90 3.5.4 Attributes of variable types .......................................................................... 91 3.5.5 Graphical representation of variable declarations ........................................ 93
Contents 3 4 The New Programming Languages of IEC 61131-3 ......................................95 4.1 Instruction List IL ............................................................................................96 4.1.1 Instruction in IL ............................................................................................96 4.1.2 The universal accumulator (Current Result) .................................................97 4.1.3 Operators ....................................................................................................100 Negation of the operand. ...................................................................................................... 100 Nesting levels by parenthesis................................................................................................ 100 Conditional execution of operators....................................................................................... 101 4.1.4 Using functions and function blocks...........................................................104 Calling a function................................................................................................................. 104 Calling a function block. ...................................................................................................... 106 4.1.5 IL example: Mountain railway....................................................................107 4.2 Structured Text ST.........................................................................................111 4.2.1 ST statements..............................................................................................111 4.2.2 Expression: Partial statement in ST ...........................................................113 Operands. ............................................................................................................................. 113 Operators. ............................................................................................................................. 113 Function as operator. ............................................................................................................ 115 4.2.3 Statement: Assignment................................................................................116 4.2.4 Statement: Call of function blocks..............................................................118 4.2.5 Statement: RETURN ..................................................................................118 4.2.6 Statement: Selection and Multi- selection...................................................119 Selection............................................................................................................................... 119 Multi- selection. ................................................................................................................... 120 4.2.7 Statement: Iteration.....................................................................................122 WHILE and REPEAT statements......................................................................................... 122 FOR statement...................................................................................................................... 123 EXIT statement..................................................................................................................... 125 4.2.8 Example: Stereo cassette recorder ..............................................................125 4.3 Function Block Diagram FBD .......................................................................128 4.3.1 Networks, graphical elements and connections of LD and FBD.................128 Network label. ...................................................................................................................... 128 Network comment. ............................................................................................................... 129 Network graphic................................................................................................................... 129 4.3.2 Network architecture in FBD......................................................................131 4.3.3 Graphical objects in FBD ...........................................................................133 Connections.......................................................................................................................... 134 Execution control (jumps). ................................................................................................... 134 Call of functions and function blocks................................................................................... 135 4.3.4 Programming methods in FBD ...................................................................136 Network evaluation. ............................................................................................................. 136 Feedback variable................................................................................................................. 137 4.3.5 Example: Stereo cassette recorder ..............................................................137 Comments on the networks of Example 4.24 and Example 4.31 ......................................... 140
4 Contents 4.4 Ladder Diagram LD ...................................................................................... 141 4.4.1 Networks, graphical elements and connections (LD) ................................. 141 4.4.2 Network architecture in LD........................................................................ 141 4.4.3 Graphical objects in LD ............................................................................. 142 Connections.......................................................................................................................... 142 Contacts and coils. ............................................................................................................... 143 Execution control. ................................................................................................................ 147 Call of functions and function blocks................................................................................... 148 4.4.4 Programming methods in LD ..................................................................... 149 Network evaluation. ............................................................................................................. 149 Feedback variable................................................................................................................. 151 4.4.5 Example in Ladder Diagram: Mountain railway ........................................ 153 Comments on the mountain railway networks...................................................................... 156 4.5 The American way of Ladder programming ................................................. 159 4.5.1 Network Layout.......................................................................................... 159 4.5.2 Module addresses and memory areas ......................................................... 161 4.5.3 Configuration ............................................................................................. 163 4.6 Sequential Function Chart SFC..................................................................... 164 4.6.1 Step / Transition combination .................................................................... 165 4.6.2 Step - transition sequence........................................................................... 167 4.6.3 Detailed description of steps and transitions .............................................. 172 Step....................................................................................................................................... 172 Transition. ............................................................................................................................ 174 4.6.4 Step execution using action blocks and actions.......................................... 179 4.6.5 Detailed description of actions and action blocks ...................................... 181 Actions. ................................................................................................................................ 181 Action block. ........................................................................................................................ 182 4.6.6 Relationship between step, transition, action and action block .................. 185 4.6.7 Action qualifiers and execution control ..................................................... 189 Qualifier. .............................................................................................................................. 189 Sequential control................................................................................................................. 195 4.6.8 Example: “Dino Park”................................................................................ 196 Comments on the network for the dinosaur park.................................................................. 200 5 Standardised PLC Functionality .................................................................. 201 5.1 Standard Functions........................................................................................ 202 5.1.1 Overloaded and extensible functions.......................................................... 206 Overloaded functions............................................................................................................ 206 Extensible functions ............................................................................................................. 208
Contents 5 5.1.1 Examples ....................................................................................................209 Type conversion functions.................................................................................................... 210 Numerical functions ............................................................................................................. 211 Arithmetic functions............................................................................................................. 211 Bit-shift functions ................................................................................................................ 212 Bitwise Boolean functions.................................................................................................... 212 Selection functions ............................................................................................................... 213 Comparison functions .......................................................................................................... 214 Character string functions .................................................................................................... 215 Functions for time data types. .............................................................................................. 215 Functions for enumerated data types .................................................................................... 216 5.2 Standard Function Blocks..............................................................................217 5.2.2 Examples ....................................................................................................218 Bistable element (flipflop).................................................................................................... 220 Edge detection ...................................................................................................................... 221 Counter................................................................................................................................. 223 Timer.................................................................................................................................... 224 6 State-of-the-Art PLC Configuration.............................................................227 6.1 Structuring Projects with Configuration Elements.........................................227 6.2 Elements of a Real-World PLC Configuration ..............................................228 6.3 Configuration Elements .................................................................................230 6.3.1 Definitions ..................................................................................................230 6.3.2 The CONFIGURATION ............................................................................231 6.3.3 The RESOURCE ........................................................................................232 6.3.4 The TASK with run-time program..............................................................233 6.3.5 ACCESS declarations .................................................................................236 6.4 Configuration Example..................................................................................237 6.5 Communication between Configurations and POUs......................................240 7 Innovative PLC Programming Systems........................................................243 7.1 Requirements of Innovative Programming Tools ..........................................243 7.2 Technological Change ...................................................................................244 7.2.1 Processor performance................................................................................244 7.2.2 Full-graphics display and printout ..............................................................244 7.2.3 Operating systems.......................................................................................244 7.2.4 Uniform user interfaces...............................................................................245 7.3 Decompilation (Reverse Documentation)......................................................245 7.3.1 No decompilation........................................................................................246 7.3.2 Decompilation with symbols and comments...............................................246 7.3.3 Decompilation including graphics ..............................................................246 7.3.4 Sources stored in the PLC...........................................................................247 7.4 Language Compatibility.................................................................................247
6 Contents 7.4.1 Cross-compilation ...................................................................................... 248 The motivation for cross-compilation................................................................................... 248 Different approaches in graphical and textual languages. .................................................... 249 Differences in languages affect cross-compilation. .............................................................. 250 Restrictions in LD/ FBD....................................................................................................... 251 Restrictions in IL/ ST. .......................................................................................................... 251 Cross-compilation IL / ST. ................................................................................................... 251 Full cross-compilation only with additional information...................................................... 252 Quality criteria for cross-compilation................................................................................... 253 7.4.2 Language independence ............................................................................. 254 7.5 Documentation .............................................................................................. 255 7.5.1 Cross-reference list..................................................................................... 255 7.5.2 Allocation list (wiring list) ......................................................................... 256 7.5.3 Comments .................................................................................................. 257 7.6 Project Manager ............................................................................................ 257 7.7 Test & Commissioning Functions ................................................................. 261 7.7.1 Program transfer......................................................................................... 261 7.7.2 Online modification of a program .............................................................. 262 7.7.3 Remote control: Starting and stopping the PLC......................................... 263 7.7.4 Variable and program status....................................................................... 263 7.7.5 Forcing ....................................................................................................... 267 7.7.6 Program test ............................................................................................... 268 7.7.7 Testing Sequential Function Chart programs ............................................. 269 7.8 Data Blocks and Recipes............................................................................... 269 7.9 FB Interconnection........................................................................................ 273 7.9.1 Data exchange and co-ordination of blocks in distributed systems ............ 273 7.9.2 Macro techniques in FB interconnection.................................................... 275 7.10 Diagnostics, Error Detection and Error Handling ....................................... 276 Error concept of IEC 61131-3. ............................................................................................. 277 Extended error handling model (beyond IEC). ..................................................................... 277 7.11 Hardware-Dependence ................................................................................ 279 7.12 Readiness for New Functionality ................................................................ 279 7.12.1 Exchange of programs and data ............................................................... 280 7.12.2 Extension with additional software packages........................................... 281 8 Main Advantages of IEC 61131-3................................................................. 283 8.1 Convenience and Security with Variables and Data Types ........................... 283 8.2 Blocks with Extended Capabilities................................................................ 284 8.3 PLC Configuration with Run-Time Behaviour.............................................. 285 8.4 Uniform Programming Languages ................................................................ 286 8.5 Structured PLC Programs.............................................................................. 286 8.6 Trend towards Open PLC Programming Systems........................................ 286 8.7 Conclusion .................................................................................................... 288
分享到:
收藏