IEC-1131. Программируемые логические контроллеры. Языки программирования - файл IEC 61131-3(1).doc

IEC-1131. Программируемые логические контроллеры. Языки программирования
скачать (237.5 kb.)
Доступные файлы (1):
IEC 61131-3(1).doc1803kb.15.12.2007 17:06скачать

IEC 61131-3(1).doc

  1   2   3   4   5   6   7   8   9   ...   26

FINAL DRAFT - IEC 61131-3, 2nd Ed. 65B/WG7/TF3(PT3E2FDIS)
PROGRAMMABLE CONTROLLERS - PROGRAMMING LANGUAGES 2001-04-16


INTERNATIONAL ELECTROTECHNICAL COMMISSION

TECHNICAL COMMITTEE No. 65:
INDUSTRIAL-PROCESS MEASUREMENT AND CONTROL
SUB-COMMITTEE 65B: DEVICES


WORKING GROUP 7: PROGRAMMABLE CONTROLLERS

FINAL DRAFT - IEC 61131-3, 2nd Ed.
PROGRAMMABLE CONTROLLERS - PROGRAMMING LANGUAGES


FOREWORD

This document is the result of the review by IEC TC65/WG6, at its meeting in Melbourne, Florida USA on 15-16 January 2001, of known National Committee comments received on the document IEC 65B/373/CDV, Voting Draft - IEC 61131-3, 2nd Edition. Additional comments received from the German Advisory Group to IEC SC65B were also considered.

Annexes A, B, C, D, and E of this document are normative.

TABLE OF CONTENTS

1. General 9

1.1 Scope 9

1.2 Normative references 9

1.3 Definitions 9

1.4 Overview and general requirements 14

1.4.1 Software model 14

1.4.2 Communication model 16

1.4.3 Programming model 18

1.5 Compliance 21

1.5.1 System compliance 21

1.5.2 Program compliance 23

2. Common elements 24

2.1 Use of printed characters 24

2.1.1 Character set 24

2.1.2 Identifiers 24

2.1.3 Keywords 25

2.1.4 Use of white space 25

2.1.5 Comments 26

2.1.6 Pragmas 26

2.2 External representation of data 27

2.2.1 Numeric literals 27

2.2.2 Character string literals 28

2.2.3 Time literals 30

2.2.3.1 Duration 30

2.2.3.2 Time of day and date 31

2.3 Data types 31

2.3.1 Elementary data types 31

2.3.2 Generic data types 33

2.3.3 Derived data types 34

2.3.3.1 Declaration 34

2.3.3.2 Initialization 35

2.3.3.3 Usage 37

2.4 Variables 38

2.4.1 Representation 38

2.4.1.1 Single-element variables 38

2.4.1.2 Multi-element variables 40

2.4.2 Initialization 41

2.4.3 Declaration 41

2.4.3.1 Type assignment 43

2.4.3.2 Initial value assignment 45

2.5 Program organization units 48

2.5.1 Functions 48

2.5.1.1 Representation 50

2.5.1.2 Execution control 53

2.5.1.3 Declaration 54

2.5.1.4 Typing, overloading, and type conversion 57

2.5.1.5 Standard functions 59

2.5.1.5.1 Type conversion functions 60

2.5.1.5.2 Numerical functions 61

2.5.1.5.3 Bit string functions 64

2.5.1.5.4 Selection and comparison functions 65

2.5.1.5.5 Character string functions 68

2.5.1.5.6 Functions of time data types 69

2.5.1.5.7 Functions of enumerated data types 71

2.5.2 Function blocks 72

2.5.2.1 Representation 72

2.5.2.1a Use of EN and ENO in function blocks 74

2.5.2.2 Declaration 74

2.5.2.3 Standard function blocks 82

2.5.2.3.1 Bistable elements 83

2.5.2.3.2 Edge detection 83

2.5.2.3.3 Counters 84

2.5.2.3.4 Timers 87

2.5.2.3.5 Communication function blocks 89

2.5.3 Programs 89

2.6 Sequential Function Chart (SFC) elements 90

2.6.1 General 90

2.6.2 Steps 91

2.6.3 Transitions 93

2.6.4 Actions 96

2.6.4.1 Declaration 96

2.6.4.2 Association with steps 98

2.6.4.3 Action blocks 99

2.6.4.4 Action qualifiers 100

2.6.4.5 Action control 101

2.6.5 Rules of evolution 106

2.6.6 Compatibility of SFC elements 116

2.6.7 SFC Compliance requirements 117

2.7 Configuration elements 117

2.7.1 Configurations, resources, and access paths 119

2.7.2 Tasks 123

3. Textual languages 133

3.1 Common elements 133

3.2 Instruction list (IL) 133

3.2.1 Instructions 133

3.2.2 Operators, modifiers and operands 134

3.2.3 Functions and Function Blocks 136

3.3 Structured Text (ST) 140

3.3.1 Expressions 140

3.3.2 Statements 142

3.3.2.1 Assignment statements 143

3.3.2.2 Function and function block control statements 143

3.3.2.3 Selection statements 144

3.3.2.4 Iteration statements 144

4. Graphic languages 146

4.1 Common elements 146

4.1.1 Representation of lines and blocks 146

4.1.2 Direction of flow in networks 146

4.1.3 Evaluation of networks 148

4.1.4 Execution control elements 149

4.2 Ladder Diagram (LD) 151

4.2.1 Power rails 151

4.2.2 Link elements and states 151

4.2.3 Contacts 152

4.2.4 Coils 152

4.2.5 Functions and function blocks 152

4.2.6 Order of network evaluation 153

4.3 Function Block Diagram (FBD) 155

4.3.1 General 155

4.3.2 Combination of elements 155

4.3.3 Order of network evaluation 155

ANNEX A - Specification method for textual languages (normative) 156

A.1 Syntax 156

A.1.1 Terminal symbols 156

A.1.2 Non-terminal symbols 156

A.1.3 Production rules 157

A.2 Semantics 157

ANNEX B - Formal specifications of language elements (normative) 158

B.0 Programming model 158

B.1 Common elements 158

B.1.1 Letters, digits and identifiers 158

B.1.2 Constants 159

B.1.2.1 Numeric literals 159

B.1.2.2 Character strings 159

B.1.2.3 Time literals 160

B.1.2.3.1 Duration 160

B.1.2.3.2 Time of day and date 160

B.1.3 Data types 161

B.1.3.1 Elementary data types 161

B.1.3.2 Generic data types 161

B.1.3.3 Derived data types 162

B.1.4 Variables 163

B.1.4.1 Directly represented variables 163

B.1.4.2 Multi-element variables 164

B.1.4.3 Declaration and initialization 164

B.1.5 Program organization units 166

B.1.5.1 Functions 166

B.1.5.2 Function blocks 167

B.1.5.3 Programs 168

B.1.6 Sequential function chart elements 168

B.1.7 Configuration elements 169

B.2 Language IL (Instruction List) 171

B.2.1 Instructions and operands 171

B.2.2 Operators 172

B.3 Language ST (Structured Text) 172

B.3.1 Expressions 172

B.3.2 Statements 173

B.3.2.1 Assignment statements 173

B.3.2.2 Subprogram control statements 173

B.3.2.3 Selection statements 173

B.3.2.4 Iteration statements 174

ANNEX C - Delimiters and Keywords (normative) 175

ANNEX D - Implementation-dependent parameters (normative) 179

ANNEX E - Error Conditions (normative) 181

ANNEX F - Examples (informative) 183

F.1 Function WEIGH 183

F.2 Function block CMD_MONITOR 184

F.3 Function block FWD_REV_MON 187

F.4 Function block STACK_INT 193

F.5 Function block MIX_2_BRIX 199

F.6 Analog signal processing 203

F.6.1 Function block LAG1 204

F.6.2 Function block DELAY 205

F.6.3 Function block AVERAGE 206

F.6.4 Function block INTEGRAL 207

F.6.5 Function block DERIVATIVE 208

F.6.6 Function block HYSTERESIS 208

F.6.7 Function block LIMITS_ALARM 209

F.6.8 Structure ANALOG_LIMITS 209

F.6.9 Function block ANALOG_MONITOR 210

F.6.10 Function block PID 211

F.6.11 Function block DIFFEQ 212

F.6.12 Function block RAMP 213

F.6.13 Function block TRANSFER 214

F.7 Program GRAVEL 214

F.8 Program AGV 223

F.9 Use of enumerated data types 227

F.10 Function block RTC (Real Time Clock) 227

F.11 Function block ALRM_INT 228

ANNEX G - Index (informative) 229

ANNEX H - Reference character set (informative) 230

LIST OF TABLES

Table 1 - Character set features 24

Table 2 - Identifier features 25

Table 3 - Comment feature 26

Table 3a - Pragma feature 26

Table 4 - Numeric literals 27

Table 5 - Character string literal features 28

Table 6 - Two-character combinations in character strings 29

Table 7 - Duration literal features 30

Table 8 - Date and time of day literals 31

Table 9 - Examples of date and time of day literals 31

Table 10 - Elementary data types 32

Table 11 - Hierarchy of generic data types 34

Table 12 - Data type declaration features 35

Table 13 - Default initial values of elementary data types 36

Table 14 - Data type initial value declaration features 37

Table 15 - Location and size prefix features for directly represented variables 40

Table 16a - Variable declaration keywords 42

Table 16b - Usages of VAR_GLOBAL, VAR_EXTERNAL and CONSTANT declarations 43

Table 17 - Variable type assignment features 44

Table 18 - Variable initial value assignment features 46

Table 19 - Graphical negation of Boolean signals 51

Table 19a - Textual invocation of functions for formal and non-formal argument list 53

Table 20 - Use of EN input and ENO output 54

Table 20a - Function features 55

Table 21 - Typed and overloaded functions 57

Table 22 - Type conversion function features 60

Table 23 - Standard functions of one numeric variable 62

Table 24 - Standard arithmetic functions 63

Table 25 - Standard bit shift functions 64

Table 26 - Standard bitwise Boolean functions 65

Table 27 - Standard selection functionsd 66

Table 28 - Standard comparison functions 67

Table 29 - Standard character string functions 68

Table 30 - Functions of time data types 70

Table 31 - Functions of enumerated data types 71

Table 32 - Examples of function block I/O variable usage 73

Table 33 - Function block declaration and usage features 77

Table 34 - Standard bistable function blocks a 83

Table 35 - Standard edge detection function blocks 84

Table 36 - Standard counter function blocks 84

Table 37 - Standard timer function blocks 87

Table 38 - Standard timer function blocks - timing diagrams 88

Table 39 - Program declaration features 90

Table 40 - Step features 92

Table 41 - Transitions and transition conditions 94

Table 42 - Declaration of actions a,b 97

Table 43 - Step/action association 99

Table 44 - Action block features 100

Table 45 - Action qualifiers 101

Table 45a - Action control features 105

Table 46 - Sequence evolution 108

Table 47 - Compatible SFC features 117

Table 48 - SFC minimal compliance requirements 117

Table 49 - Configuration and resource declaration features 121

Table 50 - Task features 125

Table 51a - Examples of instruction fields 134

Table 51b - Parenthesized expression features for IL language 135

Table 52 - Instruction List operators 135

Table 53 - Function Block invocation and Function invocation features for IL language 137

Table 54 - Standard Function Block input operators for IL language 139

Table 55 - Operators of the ST language 141

Table 56 - ST language statements 142

Table 57 - Representation of lines and blocks 147

Table 58 - Graphic execution control elements 150

Table 59 - Power rails 151

Table 60 - Link elements 152

Table 61 - Contacts a 153

Table 62 - Coils 154

Table C.1 - Delimiters 175

Table C.2 - Keywords 176

Table D.1 - Implementation-dependent parameters 179

Table E.1 - Error conditions 181

Table H.1 - Character representations 230

Table H.2 - Character encodings 231


LIST OF FIGURES

Figure 1 - Software model 15

Figure 2a - Data flow connection within a program
17

Figure 2b - Communication via GLOBAL variables 17

Figure 2c - Communication function blocks 17

Figure 2d - Communication via access paths 18

Figure 3 - Combination of programmable controller language elements 20

Figure 4 - Examples of function usage 49

Figure 5 - Use of formal argument names 52

Figure 6 - Examples of function declarations and usage 56

Figure 7 - Examples of explicit type conversion with overloaded functions 58

Figure 8 - Examples of explicit type conversion with typed functions 59

Figure 9 - Function block instantiation examples 73

Figure 10 - Examples of function block declarations 76

Figure 11a - Graphical use of a function block name as an input variable 79

Figure 11b - Graphical use of a function block name as an in-out variable 80

Figure 11c - Graphical use of a function block name as an external variable 81

Figure 12 - Declaration and usage of in-out variables in function blocks 82

Figure 14 - ACTION_CONTROL function block - External interface(Not visible to the user) 102

Figure 15a - ACTION_CONTROL function block body with "final scan" logic 103

Figure 15b - ACTION_CONTROL function block body without "final scan" logic 104

Figure 16a - Action control example - SFC representation 105

Figure 16b - Action control example - functional equivalent 106

Figure 17 - Examples of SFC evolution rules 113

Figure 18a - Examples of SFC errors: an "unsafe" SFC 115

Figure 18b - Examples of SFC errors: an "unreachable" SFC 116

Figure 19a - Graphical example of a configuration 118

Figure 19b - Skeleton function block and program declarations for configuration example 119

Figure 20 - Examples of CONFIGURATION and RESOURCE declaration features 122

Figure 21a - Synchronization of function blocks with explicit task associations 130

Figure 21b - Synchronization of function blocks with implicit task associations 131

Figure 21c - Explicit task associations equivalent to figure 21b 132

Figure 22 - EXIT statement example 145

Figure 23 - Feedback path example 149

Figure 24 - Boolean OR Examples 155


  1   2   3   4   5   6   7   8   9   ...   26


Учебный материал
© nashaucheba.ru
При копировании укажите ссылку.
обратиться к администрации