You are on page 1of 658

3

3
0
0
2
5
4
3
.
1
2
www.schneider-electric.com
Unity Pro
33002543 10/2013
Unity Pro
Obsolete
Block Library
10/2013
2 33002543 10/2013

The information provided in this documentation contains general descriptions and/or technical
characteristics of the performance of the products contained herein. This documentation is not
intended as a substitute for and is not to be used for determining suitability or reliability of these
products for specific user applications. It is the duty of any such user or integrator to perform the
appropriate and complete risk analysis, evaluation and testing of the products with respect to the
relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or
subsidiaries shall be responsible or liable for misuse of the information contained herein. If you
have any suggestions for improvements or amendments or have found errors in this publication,
please notify us.
No part of this document may be reproduced in any form or by any means, electronic or
mechanical, including photocopying, without express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and
using this product. For reasons of safety and to help ensure compliance with documented system
data, only the manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant
instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware products may
result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
2013 Schneider Electric. All rights reserved.
33002543 10/2013 3
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
About the Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Part I General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Chapter 1 Block Types and their Applications . . . . . . . . . . . . . . . 19
Block Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
FFB Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22
EN and ENO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
Chapter 2 Block Availability on Various Hardware Platforms . . 29
Block Availability on Various Hardware Platforms. . . . . . . . . . . . . . . .
29
Chapter 3 List of obsolete functions described in the other
libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Summary of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
Part II CLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Chapter 4 DELAY: Deadtime device. . . . . . . . . . . . . . . . . . . . . . . . 41
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
Operating mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
Example for behavior of the function block . . . . . . . . . . . . . . . . . . . . .
46
Chapter 5 INTEGRATOR1: Integrator with limit . . . . . . . . . . . . . . 47
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
48
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
Chapter 6 LAG1: Delay element 1st order . . . . . . . . . . . . . . . . . . . 53
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
54
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
57
Chapter 7 LEAD_LAG1: PD device with smoothing . . . . . . . . . . . 59
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
Examples of function blocks LEAD_LAG1 . . . . . . . . . . . . . . . . . . . . . .
65
Chapter 8 LIMV: Velocity limiter 1st order. . . . . . . . . . . . . . . . . . . 67
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
68
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71
4 33002543 10/2013
Chapter 9 PI1: PI controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74
Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
78
Parametering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
79
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
81
Example of the PI1 controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
82
Chapter 10 PID1: PID controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
84
PID1 function block structure diagram. . . . . . . . . . . . . . . . . . . . . . . . .
89
Setting parameters for the PID1 controller . . . . . . . . . . . . . . . . . . . . .
90
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
92
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
Chapter 11 PIDP1: PID Controller with Parallel Structure . . . . . . . 97
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
Setting parameters for the PIDP1 controller . . . . . . . . . . . . . . . . . . . .
103
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
105
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
106
Chapter 12 SMOOTH_RATE: Differentiator with smoothing . . . . . 109
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
110
Formulas for the SMOOTH_RATE function block . . . . . . . . . . . . . . . . . .
113
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
114
Chapter 13 THREE_STEP_CON1: Three step controller . . . . . . . . 115
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
116
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
120
Chapter 14 THREEPOINT_CON1: Three point controller. . . . . . . . 123
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
124
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
129
Chapter 15 TWOPOINT_CON1: Two point controller . . . . . . . . . . . 133
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
134
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
139
Part III CLC_PRO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Chapter 16 ALIM: Velocity limiter: 2nd order . . . . . . . . . . . . . . . . . 145
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
146
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
149
Chapter 17 COMP_PID: Complex PID controller . . . . . . . . . . . . . . 151
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
152
Complex PID controller structure diagram. . . . . . . . . . . . . . . . . . . . . .
158
Setting parameters for the COMP_PID controller . . . . . . . . . . . . . . . . .
159
33002543 10/2013 5
Anti-windup for COMP_PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
161
Controller type selection for COMP_PID. . . . . . . . . . . . . . . . . . . . . . . .
162
Bumpless operating mode switchover . . . . . . . . . . . . . . . . . . . . . . . . .
163
Selecting the operating mode of the COMP_PID . . . . . . . . . . . . . . . . .
166
Detailed formulas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
168
Chapter 18 DEADTIME: Deadtime device . . . . . . . . . . . . . . . . . . . . 171
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
172
Operating mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
175
Example for behavior of the function block . . . . . . . . . . . . . . . . . . . . .
177
Chapter 19 DERIV: Differentiator with smoothing . . . . . . . . . . . . . 179
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
180
Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
183
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
184
Example for the function block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
185
Chapter 20 FGEN: Function generator. . . . . . . . . . . . . . . . . . . . . . . 187
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
188
Parametering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
191
Function selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
192
Function definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
193
Diagrams of the individual functions . . . . . . . . . . . . . . . . . . . . . . . . . .
196
Special cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
200
Timing diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
201
Chapter 21 INTEG: Integrator with limit . . . . . . . . . . . . . . . . . . . . . . 203
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
204
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
208
Chapter 22 LAG: Delay element 1st order . . . . . . . . . . . . . . . . . . . . 211
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
212
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
215
Chapter 23 LAG2: Delay element 2nd order . . . . . . . . . . . . . . . . . . 217
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
218
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
222
Timing diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
223
Chapter 24 LEAD_LAG: PD device with smoothing . . . . . . . . . . . . 225
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
226
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
230
Examples of function blocks LEAD_LAG . . . . . . . . . . . . . . . . . . . . . . .
231
6 33002543 10/2013
Chapter 25 PCON2: Two point controller . . . . . . . . . . . . . . . . . . . . 233
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
234
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
237
Chapter 26 PCON3: Three point controller . . . . . . . . . . . . . . . . . . . 239
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
240
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
243
Runtime error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
246
Chapter 27 PD_OR_PI: Structure changeover PD/PI controller . . 247
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
248
Structure diagram for the function block PD_OR_PI . . . . . . . . . . . . . .
253
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
254
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
256
Chapter 28 PDM: Pulse duration modulation . . . . . . . . . . . . . . . . . 259
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
260
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
264
Chapter 29 PI: PI controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
270
Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
274
Parametering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
275
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
277
Example of a PI controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
278
Chapter 30 PID: PID controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
280
PID function block structure diagram. . . . . . . . . . . . . . . . . . . . . . . . . .
285
Setting parameters for the PID controller. . . . . . . . . . . . . . . . . . . . . . .
286
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
288
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
290
Chapter 31 PID_P: PID controller with parallel structure. . . . . . . . 293
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
294
Setting parameters for the PID_P controller . . . . . . . . . . . . . . . .
299
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
301
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
302
Chapter 32 PIP: PIP cascade controller. . . . . . . . . . . . . . . . . . . . . . 305
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
306
PIP function block structure diagram. . . . . . . . . . . . . . . . . . . . . . . . . .
311
Setting parameters for the PIP cascade controller . . . . . . . . . . . . . . .
312
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
314
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
316
33002543 10/2013 7
Chapter 33 PPI: PPI cascade controller . . . . . . . . . . . . . . . . . . . . . . 319
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
320
PPI function block structure diagram . . . . . . . . . . . . . . . . . . . . . . . . .
325
Setting parameters for the PPI cascade controller . . . . . . . . . . . . . . .
326
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
328
Detailed formulas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
329
Chapter 34 PWM: Pulse width modulation . . . . . . . . . . . . . . . . . . . 331
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
332
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
336
Example for the PWM block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
339
Chapter 35 QPWM: Pulse width modulation (simple). . . . . . . . . . . 343
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
344
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
347
Example for the QPWM block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
349
Chapter 36 SCON3: Three step controller . . . . . . . . . . . . . . . . . . . . 351
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
352
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
355
Chapter 37 VLIM: Velocity limiter 1st order. . . . . . . . . . . . . . . . . . . 359
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
360
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
363
Part IV Extension/Compatibility. . . . . . . . . . . . . . . . . . . . . 365
Chapter 38 ADD_***_PL7 : Add a period . . . . . . . . . . . . . . . . . . . . . 369
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
369
Chapter 39 AKF_FL: Detection of any edge . . . . . . . . . . . . . . . . . . 373
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
373
Chapter 40 AKF_TA: Switch off delay . . . . . . . . . . . . . . . . . . . . . . . 375
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
375
Chapter 41 AKF_TE: Switch-on delay . . . . . . . . . . . . . . . . . . . . . . . 379
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
379
Chapter 42 AKF_TI: Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
383
Chapter 43 AKF_TS: Storing switch on delay. . . . . . . . . . . . . . . . . 387
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
387
Chapter 44 AKF_TV: Extended pulse. . . . . . . . . . . . . . . . . . . . . . . . 391
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
391
Chapter 45 AKF_ZR: Decremental counter . . . . . . . . . . . . . . . . . . . 395
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
395
8 33002543 10/2013
Chapter 46 AKF_ZV: Incremental counter. . . . . . . . . . . . . . . . . . . . 399
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
399
Chapter 47 AKF_ZVR: Incremental/decremental counter . . . . . . . 403
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
403
Chapter 48 COMPARE: Comparing two integers . . . . . . . . . . . . . . 407
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
407
Chapter 49 DATE_DINT_TO_STRING: Conversion of a date
(DATE PL7) into a character string. . . . . . . . . . . . . . . . 409
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
409
Chapter 50 DAY_OF_WEEK : Day of the week . . . . . . . . . . . . . . . . 411
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
411
Chapter 51 DELTA_***: Difference between two dates . . . . . . . . . 413
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
413
Chapter 52 DT_ARINT_TO_STRING: Converting a PL7 date into a
character string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
415
Chapter 53 END: Unconditional end of program . . . . . . . . . . . . . . 419
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
419
Chapter 54 FIFO: First In/First Out stack register . . . . . . . . . . . . . 421
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
422
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
425
Chapter 55 FPULSOR: Generation of rectangular signals . . . . . . 427
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
428
Detailed description of the operation of the FPULSOR function . . . . .
430
Chapter 56 FSTEP_PL7_DRUM : Forcing a drum to a step . . . . . 431
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
431
Chapter 57 FTOF: Deactivation timer . . . . . . . . . . . . . . . . . . . . . . . 433
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
434
Detailed description of the operation of the FTOF function . . . . . . . . .
436
Chapter 58 FTON: Activation timer . . . . . . . . . . . . . . . . . . . . . . . . . 437
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
438
Detailed description of the operation of the FTON function . . . . . . . . .
440
Chapter 59 FTP: Pulse timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
442
Detailed description of the operation of the FTP function . . . . . . . . . .
444
Chapter 60 GET_3X: Read %IW Words (3x-Register). . . . . . . . . . . 445
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
445
33002543 10/2013 9
Chapter 61 GET_4X: Read %MW Words (4x-Register) . . . . . . . . . . 447
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
447
Chapter 62 GET_BIT: Reading bit. . . . . . . . . . . . . . . . . . . . . . . . . . . 449
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
449
Chapter 63 HIGH_INT: Extracting the most significant word of a
double integer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
451
Chapter 64 IEC_BMDI: Block move . . . . . . . . . . . . . . . . . . . . . . . . . 453
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
454
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
458
Chapter 65 LIFO: Last In/First Out stack register . . . . . . . . . . . . . . 461
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
462
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
465
Chapter 66 LOW_INT: Extracting the least significant word of a
double integer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
467
Chapter 67 MUX_DINTARR_125: Multiplexer for arrays of the data
type DIntArr125. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
469
Chapter 68 PL7_COUNTER : Counter/downcounter. . . . . . . . . . . . 471
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
472
Mode of operation of the PL7_COUNTER function. . . . . . . . . . . . . . .
476
Chapter 69 PL7_DRUM : Drum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
478
Mode of operation of the PL7_DRUM timer function. . . . . . . . . . . . . .
482
Chapter 70 PL7_MONOSTABLE : Monostable . . . . . . . . . . . . . . . . 483
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
484
Detailed description of the operation of the PL7_MONOSTABLE
function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
Mode of operation of the PL7_MONOSTABLE monostable function .
488
Chapter 71 PL7_REGISTER_32 : 32 word memory register. . . . . . 489
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
489
Chapter 72 PL7_REGISTER_255 : 255 word memory register. . . . 493
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
493
Chapter 73 PL7 and Unity Timers Comparison. . . . . . . . . . . . . . . . 497
Differences between PL7 and Unity Pro: Timers. . . . . . . . . . . . . . . . .
497
10 33002543 10/2013
Chapter 74 PL7_TOF : TOF type timer. . . . . . . . . . . . . . . . . . . . . . . 499
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
500
Detailed description of the operation of the PL7_TOF function . . . . . .
503
Mode of operation of the PL7_TOF timer function. . . . . . . . . . . . . . . .
504
Chapter 75 PL7_TON : TON type timer . . . . . . . . . . . . . . . . . . . . . . 505
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
506
Detailed description of the operation of the PL7_TON function. . . . . .
509
Mode of operation of the PL7_TON timer function. . . . . . . . . . . . . . . .
510
Chapter 76 PL7_TP : TP type timer . . . . . . . . . . . . . . . . . . . . . . . . . 511
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
512
Detailed description of the operation of the PL7_TP function . . . . . . .
515
Mode of operation of the PL7_TP timer function . . . . . . . . . . . . . . . . .
516
Chapter 77 PL7_3_TIMER : Conversion timer for % Tis of PL7 . . 517
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
518
Detailed description of the operation of the PL7_3_TIMER function . .
521
Mode of operation of the PL7_3_TIMER timer function. . . . . . . . . . . .
522
Chapter 78 PUT_4X: Write 4x register . . . . . . . . . . . . . . . . . . . . . . . 523
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
523
Chapter 79 R_INT_WORD: Type conversion (REAL -> INT ->
WORD) (R_INT_WORD: Type conversion (REAL ->
INT -> WORD)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
525
Chapter 80 R_UINT_WORD: Type conversion (REAL -> UINT ->
WORD) (R_UINT_WORD: Type conversion (REAL ->
UINT -> WORD)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
527
Chapter 81 R2T_***: Register to table . . . . . . . . . . . . . . . . . . . . . . . 529
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
530
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
532
Chapter 82 READ_PCMCIA: Reading data in the memory card . . 533
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
534
READ_PCMCIA and WRITE_PCMCIA Example. . . . . . . . . . . . . . . . .
536
Chapter 83 ROR1_ARB: Right shift of one byte from a table of
bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
539
Chapter 84 RRTC: Reading the system date. . . . . . . . . . . . . . . . . . 541
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
541
33002543 10/2013 11
Chapter 85 SCOUNT: Up/down counting with overshoot
signaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
543
Chapter 86 SET_BIT: Set bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
547
Chapter 87 SET_PCMCIA: Initialization of the archiving zone . . . 549
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
549
Chapter 88 SHL_RBIT_***: Left shift on an integer or double
integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
551
Chapter 89 SHR_RBIT_***: Right shift on an integer or double
integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
553
Chapter 90 SHRZ_***: Right shift on an integer or double integer 555
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
555
Chapter 91 SHRZ_RBIT_***: Right shift on an integer or double
integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
557
Chapter 92 SRCH: Search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
560
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
563
Chapter 93 STR_ROUND: Approximate value of a floating point
number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
565
Chapter 94 SUB_***_PL7 : Subtract a period . . . . . . . . . . . . . . . . . 567
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
567
Chapter 95 SYSSTATE: System state . . . . . . . . . . . . . . . . . . . . . . . 571
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
571
Chapter 96 T2T: Table to table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
574
Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
577
Chapter 97 TIME_DINT_TO_STRING: Conversion of a variable to
DINT format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
579
Chapter 98 TOD_DINT_TO_STRING: Conversion of a variable to
TOD format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
581
12 33002543 10/2013
Chapter 99 TRANS_TIME: Conversion of a duration into DINT
format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
583
Chapter 100 W_INT_REAL: Type conversion (WORD -> INT ->
REAL) (W_INT_REAL: Type conversion (WORD -> INT
-> REAL)). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
585
Chapter 101 W_UINT_REAL: Type conversion (WORD -> UINT ->
REAL) (W_UINT_REAL: Type conversion (WORD ->
UINT -> REAL)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
587
Chapter 102 WRITE_PCMCIA: Writing data to the memory card . . 589
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
589
Chapter 103 WRTC: Updating the system date . . . . . . . . . . . . . . . . 593
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
593
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Appendix A EFB Error Codes and Values . . . . . . . . . . . . . . . . . . . . 597
Tables of Error Codes for the Obsolete Library . . . . . . . . . . . . . . . . . .
598
Common Floating Point Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
606
Appendix B System Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
System Bit Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
608
Description of System Bits %S15 to %S21 . . . . . . . . . . . . . . . . . . . . .
609
Description of System Words %SW0 to %SW11. . . . . . . . . . . . . . . . .
613
Description of System Words %SW12 to %SW29. . . . . . . . . . . . . . . .
618
Description of System Words %SW70 to %SW99. . . . . . . . . . . . . . . .
625
Description of System Words %SW124 to %SW127. . . . . . . . . . . . . .
636
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655
33002543 10/2013 13
Safety Information
Important Information
NOTICE
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to warn of potential hazards or to call attention
to information that clarifies or simplifies a procedure.
14 33002543 10/2013
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of
the use of this material.
A qualified person is one who has skills and knowledge related to the construction and operation
of electrical equipment and its installation, and has received safety training to recognize and avoid
the hazards involved.
33002543 10/2013 15
About the Book
At a Glance
Document Scope
This documentation describes the functions and function blocks in the Obsolete library.
NOTE: The functions and function blocks in this library are only used to convert from Concept and
PL7 user programs. Even if the Obsolete library will continue to be fully supported in the future
versions of Unity Pro, the functions and function blocks it contains should not be used to create
new user programs.
Validity Note
This document is valid from Unity Pro Version 8.0.
16 33002543 10/2013
33002543 10/2013 17
Unity Pro
General
33002543 10/2013
General
Part I
General
Overview
This section contains general information about the Obsolete library.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
1 Block Types and their Applications 19
2 Block Availability on Various Hardware Platforms 29
3 List of obsolete functions described in the other libraries 35
General
18 33002543 10/2013
33002543 10/2013 19
Unity Pro
Block Types and their Applications
33002543 10/2013
Block Types and their Applications
Chapter 1
Block Types and their Applications
Overview
This chapter describes the different block types and their applications.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Block Types 20
FFB Structure 22
EN and ENO 25
Block Types and their Applications
20 33002543 10/2013
Block Types
Block Types
Different block types are used in Unity Pro. The general term for the block types is FFB.
There are the following types of block:
Elementary Function (EF)
Elementary Function Block (EFB)
Derived Function Block (DFB)
Procedure
NOTE: Motion Function Blocks are not available on the Quantum platform.
Elementary Function
Elementary functions (EF) have no internal status and one output only. If the input values are the
same, the output value is the same for the executions of the function, for example the addition of
two values gives the same result at every execution.
An elementary function is represented in the graphical languages (FBD and LD) as a block frame
with inputs and an output. The inputs are represented on the left and the outputs on the right of the
block frame. The name of the function, that is the function type, is shown in the center of the block
frame.
The number of inputs can be increased with some elementary functions.
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EFs output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools Program Languages Common.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when
your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
33002543 10/2013 21
Elementary Function Block
Elementary function blocks (EFB) have an internal status. If the inputs have the same values, the
value on the outputs can have another value during the individual executions. For example, with a
counter, the value on the output is incremented.
An elementary function block is represented in the graphical languages (FBD and LD) as a block
frame with inputs and outputs. The inputs are represented on the left and the outputs on the right
of the block frame. The name of the function block, that is the function block type, is shown in the
center of the block frame. The instance name is displayed above the block frame.
Derived Function Block
Derived function blocks (DFBs) have the same properties as elementary function blocks. They are
created by the user in the programming languages FBD, LD, IL and/or ST.
Procedure
Procedures are functions with several outputs. They have no internal state.
The only difference from elementary functions is that procedures can have more than one output
and they support variables of the VAR_IN_OUT data type.
Procedures do not return a value.
Procedures are a supplement to IEC 61131-3 and must be enabled explicitly.
There is no visual difference between procedures and elementary functions.
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EFs output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools Program Languages Common.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when
your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
22 33002543 10/2013
FFB Structure
Structure
Each FFB is made up of an operation (name of the FFB), the operands are required for the
operation (formal and actual parameters) and an instance name for elementary/derived function
blocks.
Call of a function block in the FBD programming language:
CAUTION
UNEXPECTED APPLICATION BEHAVIOR
Do not call several times the same block instance within a PLC cycle
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
33002543 10/2013 23
Formal call of a function block in the ST programming language:
Operation
The operation determines which function is to be executed with the FFB, e.g. shift register,
conversion operations.
Operand
The operand specifies what the operation is to be executed with. With FFBs, this consists of formal
and actual parameters.
Formal/actual parameters
Inputs and outputs are required to transfer values to or from an FFB. These are called formal
parameters.
Objects are linked to formal parameters; these objects contain the current process states. They are
called actual parameters.
At program runtime, the values from the process are transferred to the FFB via the actual
parameters and then output again after processing.
The data type of the actual parameters must match the data type of the input/output (formal
parameters). The only exceptions are generic inputs/outputs whose data type is determined by the
actual parameter. If the actual parameters consist of literals, a suitable data type is selected for the
function block.
Block Types and their Applications
24 33002543 10/2013
FFB Call in IL/ST
In text languages IL and ST, FFBs can be called in formal and in informal form. Details can be
found in the Reference manual.
Example of a formal function call:
out:=LIMIT (MN:=0, IN:=var1, MX:=5);
Example of an informal function call:
out:=LIMIT (0, var1, 5);
NOTE: The use of EN and ENO is only possible for formal calls.
VAR_IN_OUT variable
FFBs are often used to read a variable at an input (input variables), to process it and to output the
altered values of the same variable (output variables).
This special type of input/output variable is also called a VAR_IN_OUT variable.
The input and output variable are linked in the graphic languages (FBD and LD) using a line
showing that they belong together.
Function block with VAR_IN_OUT variable in FBD:
Function block with VAR_IN_OUT variable in ST:
MY_EXAMP1 (IN1:=Input1, IN2:=Input2, IO1:=Comb_IN_OUT,
OUT1=>Output1, OUT2=>Output2);
The following points must be considered when using FFBs with VAR_IN_OUT variables:
The VAR_IN_OUT inputs must be assigned a variable.
Literals or constants cannot be assigned to VAR_IN_OUT inputs/outputs.
The following additional limitations apply to the graphic languages (FBD and LD):
When using graphic connections, VAR_IN_OUT outputs can only be connected with
VAR_IN_OUT inputs.
Only one graphical link can be connected to a VAR_IN_OUT input/output.
Different variables/variable components can be connected to the VAR_IN_OUT input and the
VAR_IN_OUT output. In this case the value of the variables/variable component on the input is
copied to the output variables/variable component.
No negations can be used on VAR_IN_OUT inputs/outputs.
A combination of variable/address and graphic connections is not possible for VAR_IN_OUT
outputs.
Block Types and their Applications
33002543 10/2013 25
EN and ENO
Description
An EN input and an ENO output can be configured for the FFBs.
If the value of EN is equal to "0" when the FFB is invoked, the algorithms defined by the FFB are
not executed and ENO is set to "0".
If the value of EN is equal to "1" when the FFB is invoked, the algorithms defined by the FFB will
be executed. After the algorithms have been executed successfully, the value of ENO is set to "1".
If certain error conditions are detected when executing these algorithms, ENO is set to "0".
If the EN pin is not assigned a value, when the FFB is invoked, the algorithm defined by the FFB is
executed (same as if EN equals to "1"), Please refer to Maintain output links on disabled EF
(see Unity Pro, Operating Modes).
If the algorithms are executed successfully, then value of ENO is set to "1", else ENO is set to "0".
If ENO is set to "0" (caused by EN=0 or a detected error condition during execution or unsuccessful
algorithm execution):
Function blocks
EN/ENO handling with function blocks that (only) have one link as an output parameter:
If EN from FunctionBlock_1 is set to "0", the output connection OUT from
FunctionBlock_1 retains the status it had in the last correctly executed cycle.
EN/ENO handling with function blocks that have one variable and one link as output
parameters:
If EN from FunctionBlock_1 is set to "0", the output connection OUT from
FunctionBlock_1 retains the status it had in the last correctly executed cycle. The variable
OUT1 on the same pin, either retains its previous status or can be changed externally without
influencing the connection. The variable and the link are saved independently of each other.
Block Types and their Applications
26 33002543 10/2013
Functions/Procedures
NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links
connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A
variable must be connected to the EFs output and must be used to connect the input of the
element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is
deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu
Tools Program Languages Common.
As defined in IEC61131-3, the outputs from deactivated functions (EN-input set to "0") is
undefined. (The same applies to procedures.)
Here is an explanation of the output status in this case:
EN/ENO handling with functions/procedures that (only) have one link as an output
parameter:
If EN from Function/Procedure_1 is set to "0", the output connection OUT from
Function/Procedure_1 is also set to "0".
EN/ENO handling with function blocks that have one variable and one link as output
parameters:
If EN from Function/Procedure_1 is set to "0", the output connection OUT from
Function/Procedure_1 is also set to "0". The variable OUT1 on the same pin, either
retains its previous status or can be changed externally without influencing the connection.
The variable and the link are saved independently of each other.
The output behavior of the FFBs does not depend on whether the FFBs are called up without
EN/ENO or with EN=1.
CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
For Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs,
when your application relies on persistent output data of an EF.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
33002543 10/2013 27
Conditional/Unconditional FFB Call
"Unconditional" or "conditional" calls are possible with each FFB. The condition is realized by pre-
linking the input EN.
EN connected
conditional calls (the FFB is only processed if EN = 1)
EN shown, hidden, and marked TRUE, or shown and not occupied
unconditional calls (FFB is processed independent from EN)
NOTE: For disabled function blocks (EN = 0) with an internal time function (e.g. DELAY), time
seems to keep running, since it is calculated with the help of a system clock and is therefore
independent of the program cycle and the release of the block.
Note for IL and ST
The use of EN and ENO is only possible in the text languages for a formal FFB call, e.g.
MY_BLOCK (EN:=enable, IN1:=var1, IN2:=var2,
ENO=>error, OUT1=>result1, OUT2=>result2);
Assigning the variables to ENO must be done with the operator =>.
With an informal call, EN and ENO cannot be used.
CAUTION
UNEXPECTED APPLICATION EQUIPMENT
Do not disable function blocks with internal time function during their operation.
Failure to follow these instructions can result in injury or equipment damage.
Block Types and their Applications
28 33002543 10/2013
33002543 10/2013 29
Unity Pro
Availability of Blocks
33002543 10/2013
Block Availability on Various Hardware Platforms
Chapter 2
Block Availability on Various Hardware Platforms
Block Availability on Various Hardware Platforms
Introduction
Not all blocks are available on all hardware platforms. The blocks available on your hardware
platform can be found in the following tables.
NOTE: The functions and function blocks in this library are not defined in IEC 61131-3.
CLC
Availability of the blocks:
Block name Block
type
M340 M580 Quantum Momentum Premium Source
DELAY EFB + + + + + Concept
INTEGRATOR1 EFB + + + + + Concept
LAG1 EFB + + + + + Concept
LEAD_LAG1 EFB + + + + + Concept
LIMV EFB + + + + + Concept
PI1 EFB + + + + + Concept
PID1 EFB + + + + + Concept
PIDP1 EFB + + + + + Concept
SMOOTH_RATE EFB + + + + + Concept
THREE_STEP_CON1 EFB + + + + + Concept
THREEPOINT_CON1 EFB + + + + + Concept
TWOPOINT_CON1 EFB + + + + + Concept
Legend:
+ Yes
- No
Availability of Blocks
30 33002543 10/2013
CLC_PRO
Availability of the blocks:
Block name Block
type
M340 M580 Quantum Momentum Premium Source
ALIM EFB + + + + + Concept
COMP_PID EFB + + + + + Concept
DEADTIME EFB + + + + + Concept
DERIV EFB + + + + + Concept
FGEN EFB + + + + + Concept
INTEG EFB + + + + + Concept
LAG EFB + + + + + Concept
LAG2 EFB + + + + + Concept
LEAD_LAG EFB + + + + + Concept
PCON2 EFB + + + + + Concept
PCON3 EFB + + + + + Concept
PD_OR_PI EFB + + + + + Concept
PDM EFB + + + + + Concept
PI EFB + + + + + Concept
PID EFB + + + + + Concept
PID_P EFB + + + + + Concept
PIP EFB + + + + + Concept
PPI EFB + + + + + Concept
PWM EFB + + + + + Concept
QPWM EFB + + + + + Concept
SCON3 EFB + + + + + Concept
VLIM EFB + + + + + Concept
Legend:
+ Yes
- No
Availability of Blocks
33002543 10/2013 31
Extensions/Compatibility
Availability of the blocks:
Block name Block
type
M340 M580 Quantum Momentum Premium Source
ADD_DT_PL7 EF + - - + + PL7
ADD_TOD_PL7 EF + - - + + PL7
AKF_FL EFB + - + + + Concept
AKF_TA EFB + - + + + Concept
AKF_TE EFB + - + + + Concept
AKF_TI EFB + - + + + Concept
AKF_TS EFB + - + + + Concept
AKF_TV EFB + - + + + Concept
AKF_ZR EFB + - + + + Concept
AKF_ZV EFB + - + + + Concept
AKF_ZVR EFB + - + + + Concept
AND_ARINT_INT EF + - + + + PL7
AND_ARDINT_DINT EF + - + + + PL7
AND_*** EF + - + + + PL7
COMPARE Procedure + + + + TSX P 57 5 PL7
DATE_DINT_TO_STRING EF + - - + + PL7
DAY_OF_WEEK EF + - - + + PL7
DELTA_D EF + - - + + PL7
DELTA_DT EF + - - + + PL7
DELTA_TOD EF + - - + + PL7
DOWN_PL7_COUNTER Procedure - - - - + PL7
DOWN_PL7_TOF Procedure - - - - + PL7
DOWN_PL7_TON Procedure - - - - + PL7
DOWN_PL7_TP Procedure - - - - + PL7
DT_ARINT_TO_STRING EF + - - + + PL7
END Procedure + + high end
CPUs only
(651_50,
651_60,
671_60)
+ + PL7
FIFO EFB + + + + + Concept
FPULSOR Procedure + + - + + PL7
Availability of Blocks
32 33002543 10/2013
FSTEP_PL7_DRUM Procedure - - - - + PL7
FTOF Procedure - - - - + PL7
FTON Procedure - - - - + PL7
FTP Procedure - - - - + PL7
GET_3X EF - - + - - Concept
GET_4X EF + - + + + Concept
GET_BIT EF + + + + + Concept
GET_PL7_REGISTER_255 Procedure - - - - + PL7
GET_PL7_REGISTER_32 Procedure - - - - + PL7
HIGH_INT EF + + + + + PL7
IEC_BMDI Procedure - - + - - Concept
LIFO EFB + + + + + Concept
LOW_INT EF + + + + + PL7
MUX_DINTARR_125 EF + + + + + Concept
NOT_ARINT EF + + + + + PL7
NOT_ARDINT EF + + + + + PL7
NOT_INT EF + + + + + PL7
NOT_DINT EF + + + + + PL7
OR_ARINT_INT EF + + + + + PL7
OR_ARDINT_DINT EF + + + + + PL7
OR_*** EF + + + + + PL7
PL7_3_TIMER EFB - - - - + PL7
PL7_COUNTER EFB - - - - + PL7
PL7_DRUM EFB - - - - + PL7
PL7_MONOSTABLE EFB - - - - + PL7
PL7_REGISTER_255 EFB - - - - + PL7
PL7_REGISTER_32 EFB - - - - + PL7
PL7_TOF EFB - - - - + PL7
PL7_TON EFB - - - - + PL7
PL7_TP EFB - - - - + PL7
PRESET_PL7_3_TIMER Procedure - - - - + PL7
PRESET_PL7_COUNTER Procedure - - - - + PL7
PUT_4X Procedure + - + + + Concept
PUT_PL7_REGISTER_255 Procedure - - - - + PL7
Block name Block
type
M340 M580 Quantum Momentum Premium Source
Availability of Blocks
33002543 10/2013 33
PUT_PL7_REGISTER_32 Procedure - - - - + PL7
R_INT_WORD EF + + + + + Concept
R_UINT_WORD EF + + + + + Concept
READ_PCMCIA Procedure - - + - + PL7
R2T_*** EFB + + + + + Concept
RESET_PL7_COUNTER Procedure - - - - + PL7
RESET_PL7_DRUM Procedure - - - - + PL7
RESET_PL7_REGISTER_255 Procedure - - - - + PL7
RESET_PL7_REGISTER_32 Procedure - - - - + PL7
ROL_*** EF + + + + + PL7
ROR_*** EF + + + + + PL7
ROR1_ARB Procedure + + + + + PL7
RRTC Procedure + + - + + PL7
SCOUNT Procedure + + + + + PL7
SET_BIT EF + + + + + Concept
SET_PCMCIA Procedure - - + - + PL7
SHL_*** EF + + + + + PL7
SHL_RBIT_*** Procedure + + + + + PL7
SHR_RBIT_*** Procedure + + + + + PL7
SHRZ_*** EF + + + + + PL7
SHRZ_RBIT_*** Procedure + + + + + PL7
SRCH EFB + + + + + Concept
START_PL7_3_TIMER Procedure - - - - + PL7
START_PL7_MONOSTABLE Procedure - - - - + PL7
START_PL7_TOF Procedure - - - - + PL7
START_PL7_TON Procedure - - - - + PL7
START_PL7_TP Procedure - - - - + PL7
STOP_PL7_3_TIMER Procedure - - - - + PL7
STR_ROUND Procedure + + + + + PL7
SUB_***_PL7 EF + - - + + PL7
SYSSTATE EFB + + + + + Concept
T2T EFB + + + + + Concept
TIME_DINT_TO_STRING EF + - - + + PL7
TOD_DINT_TO_STRING EF + - - + + PL7
Block name Block
type
M340 M580 Quantum Momentum Premium Source
Availability of Blocks
34 33002543 10/2013
TRANS_TIME EF + + - + + PL7
UP_PL7_COUNTER Procedure - - - - + PL7
UP_PL7_DRUM Procedure - - - - + PL7
W_INT_REAL EF + + + + + Concept
W_UINT_REAL EF + + + + + Concept
WRITE_PCMCIA Procedure - - + - + PL7
WRTC Procedure + + - + + PL7
XOR_ARINT_INT EF + - + + + PL7
XOR_ARDINT_DINT EF + - + + + PL7
XOR_*** EF + - + + + PL7
Legend:
+ Yes
- No
Block name Block
type
M340 M580 Quantum Momentum Premium Source
33002543 10/2013 35
Unity Pro
List of obsolete functions described in the other libraries
33002543 10/2013
List of obsolete functions described in the other libraries
Chapter 3
List of obsolete functions described in the other libraries
Summary of functions
At a Glance
Despite belonging to the obsolete library, certain functions are described in the documentation for
the general library.
The following table provides a summary of these functions, and indicates the correspondence
between the function family through which they can be accessed using Unity Pro, and that of the
general library where they are described in the documentation.
Use of the obsolete functions
This library includes the functions from previous software generations. Conserving these functions
makes it possible to convert applications created by software products other than Unity Pro, as well
as enabling users to carry on programming as before. In most cases, functions are specific to an
API range. However, it should be noted that these functions are not IEC 61131-3 compliant, and
that in certain cases, IEC-equivalent functions do exist.
It is therefore recommended not to use this library for creating program modules that are
transferable from one PLC to another.
Summary table
The following table shows the different functions of the obsolete library which are described in the
general library:
Functions Using Unity Pro, the
function can be accessed
via the family...
The function is described in
the family...
AND_ARDINT_DINT
(see Unity Pro, Standard,
Block Library)
Extensions/compatibility Array
AND_ARINT_INT (see Unity
Pro, Standard, Block Library)
Extensions/compatibility Array
AND_ARDINT (see Unity
Pro, Standard, Block Library)
Extensions/compatibility Array
AND_ARINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Array
List of obsolete functions described in the other libraries
36 33002543 10/2013
AND_DINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
AND_INT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
NOT_DINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
NOT_INT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
NOT_ARDINT (see Unity
Pro, Standard, Block Library)
Extensions/compatibility Array
NOT_ARINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Array
OR_ARDINT_DINT
(see Unity Pro, Standard,
Block Library)
Extensions/compatibility Array
OR_ARINT_INT (see Unity
Pro, Standard, Block Library)
Extensions/compatibility Array
OR_ARDINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Array
OR_ARINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Array
OR_DINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
OR_INT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
ROL_DINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
ROL_INT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
ROR_DINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
ROR_INT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
SHL_DINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
SHL_INT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
Functions Using Unity Pro, the
function can be accessed
via the family...
The function is described in
the family...
List of obsolete functions described in the other libraries
33002543 10/2013 37
XOR_ARDINT_DINT
(see Unity Pro, Standard,
Block Library)
Extensions/compatibility Array
XOR_ARINT_INT (see Unity
Pro, Standard, Block Library)
Extensions/compatibility Array
XOR_ARDINT (see Unity
Pro, Standard, Block Library)
Extensions/compatibility Array
XOR_ARINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Array
XOR_DINT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
XOR_INT (see Unity Pro,
Standard, Block Library)
Extensions/compatibility Logic
Functions Using Unity Pro, the
function can be accessed
via the family...
The function is described in
the family...
List of obsolete functions described in the other libraries
38 33002543 10/2013
33002543 10/2013 39
Unity Pro
CLC
33002543 10/2013
CLC
Part II
CLC
Overview
This part describes the elementary functions and elementary function blocks in the family CLC.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
4 DELAY: Deadtime device 41
5 INTEGRATOR1: Integrator with limit 47
6 LAG1: Delay element 1st order 53
7 LEAD_LAG1: PD device with smoothing 59
8 LIMV: Velocity limiter 1st order 67
9 PI1: PI controller 73
10 PID1: PID controller 83
11 PIDP1: PID Controller with Parallel Structure 97
12 SMOOTH_RATE: Differentiator with smoothing 109
13 THREE_STEP_CON1: Three step controller 115
14 THREEPOINT_CON1: Three point controller 123
15 TWOPOINT_CON1: Two point controller 133
CLC
40 33002543 10/2013
33002543 10/2013 41
Unity Pro
DELAY
33002543 10/2013
DELAY: Deadtime device
Chapter 4
DELAY: Deadtime device
Introduction
This chapter describes the DELAY block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 42
Operating mode 45
Example for behavior of the function block 46
DELAY
42 33002543 10/2013
Description
Function description
With this function block the input signal is delayed by a deadtime.
The function block delays the signal X by the deadtime T_DELAY before it appears again at Y.
The function block incorporates a delay buffer for 128 elements (X values), meaning that during
the time span T_DELAY 128 X values can be stored. The buffer is used in such a way that it
corresponds with the operating mode.
Whether the system is started cold or warm, the value of Y remains unchanged. The internal values
are set to the value of X.
After a change of deadtime T_DELAY or a cold or warm system start, the output READY goes to
"0". This means: that the buffer is not ready because it is empty.
The function block has the following operating mode: Manual, halt and automatic mode.
EN and ENO can be configured as additional parameters.
NOTE: The delay time continues to run even if the block is disabled via the EN parameter, because
the block calculates its time differences according to the system clock.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
DELAY
33002543 10/2013 43
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL DELAY_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=InputValue, T_DELAY:=DelayTime,
YMAN:=ManualControl_Y_Value, Y=>Output,
READY=>InternalBufferFlag)
DELAY
44 33002543 10/2013
Representation in ST
Representation:
DELAY_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=InputValue, T_DELAY:=DelayTime,
YMAN:=ManualControl_Y_Value, Y=>Output,
READY=>InternalBufferFlag) ;
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
X REAL Input value
T_DELAY TIME Deadtime
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output
READY BOOL "1" = internal buffer is full
"0" = internal buffer is not full (e.g. after warm/cold
start or modification of deadtime)
DELAY
33002543 10/2013 45
Operating mode
Selecting the operating modes
There are three operating modes, which are selected via the inputs MAN and HALT.
Automatic operating mode
In the automatic mode, the function block operates according to the following rules:
Example of automatic mode
In the example the following values are accepted:
Cycle time = 100 ms
T_DELAY = 10 s
tin = T_DELAY / 128 = 78 ms
As the reading time tin is shorter than the cycle time, each X value is transferred to the buffer. On
the fourth execution of the function block (after 400 ms) the X value is saved twice rather than once
(as 3 x 78 = 312 and 4 x 78 = 390).
Manual mode
In manual mode the manual value YMAN is consistently transferred to the control output Y. The
internal buffer is charged with the manual value YMAN. The buffer is marked as charged (READY
=1).
Halt mode
The output Yis held at the last calculated value in Halt mode. The internal buffer still continues to
operate as in automatic mode.
Operating mode MAN HALT
Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1
If... Then...
the current X value is transferred to the buffer, and the oldest
X value in the buffer is placed on the output Y. If a cycle time
is greater than T_DELAY / 128, a resolution of less than 128
will result, causing a systematic error leading to double
storage of some X values. (see the following Example).
not all X values can be stored in the buffer. In this case the X
value is not saved in some cycles, and Y remains unchanged
in these cycles.
DELAY
46 33002543 10/2013
Example for behavior of the function block
Example
The following diagram shows an example for behavior of the function block. Input X follows a ramp
function from one value to a new value. Delayed by the deadtime T_DELAY, X values appear at Y.
Function block diagram DELAY
33002543 10/2013 47
Unity Pro
INTEGRATOR1
33002543 10/2013
INTEGRATOR1: Integrator with limit
Chapter 5
INTEGRATOR1: Integrator with limit
Introduction
This chapter describes the INTEGRATOR1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 48
Detailed description 51
INTEGRATOR1
48 33002543 10/2013
Description
Function description
The function block replicates a limited integrator.
The function block has the following properties:
Manual, halt and automatic modes
Manipulated variable limiting in automatic mode
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Formula
The transfer function is:
The formula for the output Y is:
Meaning of the sizes
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Variable Description
Value of input X from the previous cycle
Value of the output Y from the previous cycle
dt is the time differential between the current cycle and the previous cycle
INTEGRATOR1
33002543 10/2013 49
Representation in FBD
Representation:
Representation in LD
Representation:
INTEGRATOR1
50 33002543 10/2013
Representation in IL
Representation:
CAL INTEGRATOR1_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=InputVariable, GAIN:=IntegralGain,
YMAX:=UpperControlLimit, YMIN:=LowerControlLimit,
YMAN:=ManualControlLimit, Y=>Output,
QMAX=>Y_AtUpperLimit, QMIN=>Y_AtLowerLimit)
Representation in ST
Representation:
INTEGRATOR1_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=InputVariable, GAIN:=IntegralGain,
YMAX:=UpperControlLimit, YMIN:=LowerControlLimit,
YMAN:=ManualControlLimit, Y=>Output,
QMAX=>Y_AtUpperLimit, QMIN=>Y_AtLowerLimit) ;
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
If YMAN < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
X REAL Input variable
GAIN REAL Integral gain
YMAX REAL Upper limit
YMIN REAL Lower limit
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output
QMAX BOOL "1" = Output Y has reached upper limit
QMIN BOOL "1" = Output Y has reached lower limit
INTEGRATOR1
33002543 10/2013 51
Detailed description
Parametering
The parameter assignments of the function block are satisfied by the determination of the integral
GAIN and the limiting values YMAX and YMIN for output Y.
The limits YMAX and YMIN limit the output within the prescribed range. Therefore YMIN Y YMAX.
The markers QMAX and QMIN signal that the limits have been reached or the output signal is being
limited.
QMAX = 1 if Y YMAX
QMIN = 1 if Y YMIN
Operating mode
There are three operating modes, which are selected via the inputs MAN and HALT:
Example
The input signal is integrated via the time. If there is a jump on input X the output increases (for
positive X values) or decreases (for negative X values) according to a ramp function. Y is always
between YMAX and YMIN; if Y is equal to YMAX or YMIN, this is shown accordingly in QMAX or QMIN.
Operating
mode
MAN HALT Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed to
the output Y. The control output is, however, limited
by YMAX and YMIN.
Halt 0 1 The output Y will be held at the last calculated value.
INTEGRATOR1
52 33002543 10/2013
It displays the integrator jump response:
33002543 10/2013 53
Unity Pro
LAG1
33002543 10/2013
LAG1: Delay element 1st order
Chapter 6
LAG1: Delay element 1st order
Introduction
This chapter describes the LAG1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 54
Detailed description 57
LAG1
54 33002543 10/2013
Description
Function description
The function block represents a delay element 1st order.
The function block contains the following operating mode:
Manual mode
Halt
Automatic
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Formula
The transfer function is:
The formula of calculation is:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
LAG1
33002543 10/2013 55
Meaning of the sizes
Representation in FBD
Representation:
Representation in LD
Representation:
Variable Description
Value of input X from the previous cycle
Value of the output Y from the previous cycle
dt is the time differential between the current cycle and the previous cycle
LAG1
56 33002543 10/2013
Representation in IL
Representation:
CAL LAG1_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=InputValue, GAIN:=GainFactor, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue, Y=>Output)
Representation in ST
Representation:
LAG1_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=InputValue, GAIN:=GainFactor, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue, Y=>Output) ;
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
X REAL Input value
GAIN REAL Gain factor
LAG TIME Delayed time constants
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output
LAG1
33002543 10/2013 57
Detailed description
Parametering
Setting parameters for the function block is achieved through specification of the factor GAIN as
well as setting parameters for the delayed time constant LAG.
The unit jump at input X (jump at input X from 0 to 1.0) follows output Y with a delay. Along an e-
function
it will approximate the value .
Operating modes
There are three operating modes, which are selected via the inputs MAN and HALT:
Example
The diagram shows an example of the jump response of the LAG device: Input X jumps to a new
value and output Y follows an e-function for input X.
Operating mode MAN HALT Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y.
Halt 0 1 The output Y will be held at the last calculated
value.
LAG1
58 33002543 10/2013
Jump response for function block LAG1 if GAIN = 1
33002543 10/2013 59
Unity Pro
LEAD_LAG1
33002543 10/2013
LEAD_LAG1: PD device with smoothing
Chapter 7
LEAD_LAG1: PD device with smoothing
Introduction
This chapter describes the LEAD_LAG1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 60
Detailed description 64
Examples of function blocks LEAD_LAG1 65
LEAD_LAG1
60 33002543 10/2013
Description
Function description
The function block serves as a PD outline with subsequent smoothing.
The function block has the following properties:
Definable delay of the D-component
Operating modes Manual, Halt, Automatic
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Formula
The transfer function is:
The formula of calculation is:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
LEAD_LAG1
33002543 10/2013 61
Meaning of the sizes
Representation in FBD
Representation:
Variable Description
Value of input X from the previous cycle
Value of the output Y from the previous cycle
dt is the time differential between the current cycle and the previous cycle
LEAD_LAG1
62 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL LEAD_LAG1_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=Input, GAIN:=GainFactor,
LEAD:=DifferentialTimeConstant, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue, Y=>Output)
Representation in ST
Representation:
LEAD_LAG1_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=Input, GAIN:=GainFactor,
LEAD:=DifferentialTimeConstant, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue, Y=>Output) ;
LEAD_LAG1
33002543 10/2013 63
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
X REAL Input
GAIN REAL Gain factor
LEAD TIME Derivative time constant
LAG TIME Delayed time constants
YMAN REAL Manual value manipulated value
Parameter Data type Description
Y REAL Output
LEAD_LAG1
64 33002543 10/2013
Detailed description
Parametering
The parameter assignments of the function block are satisfied by the determination of the factor
GAIN, and the values the derivative time constant LEAD and delayed time constant LAG.
For very small sample times and the unit jump to input X (jump at input X from 0 to 1.0) output Y
will jump to the value (theoretical value - actual slightly smaller due to the
not infinitely small sample times), using the time constant LAG to approximate the value
closer.
Operating modes
There are three operating modes, which are selected via the inputs MAN and HALT:
Operating mode MAN HALT Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y.
Halt 0 1 The output Y will be held at the last calculated
value.
LEAD_LAG1
33002543 10/2013 65
Examples of function blocks LEAD_LAG1
Example overview
The following examples are presented in the following diagrams:
LEAD = LAG
LEAD=LAG * 0.5, GAIN = 1
LEAD/LAG = 2, GAIN = 1
LEAD = LAG
The function blocks behave like a pure multiplication block with the multiplier GAIN.
Function block LEAD_LAG1 with LEAD = LAG
LEAD_LAG1
66 33002543 10/2013
LEAD=LAG * 0.5, GAIN = 1
The output Y jumps in this case to half the end value in order to run into the end value with the
delayed time constant lag (GAIN * X).
Function block LEAD_LAG1 with LEAD/LAG = 0.5 and GAIN = 1
LEAD/LAG = 2, GAIN = 1
The output Y jumps in this case to twice the end value in order to run into the end value with the
delayed time constant LAG (GAIN * X).
Function block LEAD_LAG1 with LEAD/LAG = 2 and GAIN = 1
33002543 10/2013 67
Unity Pro
LIMV
33002543 10/2013
LIMV: Velocity limiter 1st order
Chapter 8
LIMV: Velocity limiter 1st order
Introduction
This chapter describes the LIMV block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 68
Detailed description 71
LIMV
68 33002543 10/2013
Description
Function description
The function block produces an velocity limiter of the 1st order with limiting of the manipulated
variable.
The gradient of the input size X is limited to a specified value RATE. Furthermore, the output Y will
be limited through YMAX and YMIN. This allows the function block to adjust signals to the technolog-
ically limited pace and limits from controlling elements.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
Operating modes Manual, Halt, Automatic
Manipulated variable limiting in automatic mode
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
LIMV
33002543 10/2013 69
Representation in FBD
Representation:
Representation in LD
Representation:
LIMV
70 33002543 10/2013
Representation in IL
Representation:
CAL LIMV_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=Input, RATE:=MaximumRateOfChange,
YMAX:=UpperControlLimit, YMIN:=LowerControlLimit,
YMAN:=ManualControlValue, Y=>Output,
QMAX=>Y_AtUpperLimit, QMIN=>Y_AtLowerLimit)
Representation in ST
Representation:
LIMV_Instance (MAN:=ManualMode, HALT:=HaltMode, X:=Input,
RATE:=MaximumRateOfChange,
YMAX:=UpperControlLimit, YMIN:=LowerControlLimit,
YMAN:=ManualControlValue, Y=>Output,
QMAX=>Y_AtUpperLimit, QMIN=>Y_AtLowerLimit) ;
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
X REAL Input
RATE REAL Maximum upper limit (maximum x)
YMAX REAL Upper limit
YMIN REAL Lower limit
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output
QMAX BOOL "1" = Output Y has reached upper limit
QMIN BOOL "1" = Output Y has reached lower limit
LIMV
33002543 10/2013 71
Detailed description
Parametering
The parameter assignments of the function block are created by the determination of the maximum
velocity RATE and the limiting values YMAX and YMIN for output Y. The maximum velocity rate
indicates by how much the output may change within one second.
The amount will be evaluated for parameter RATE. If RATE = 0, then Y = X.
The limits YMAX and YMIN limit the output within the prescribed range. Therefore YMIN Y YMAX.
The outputs QMAX and QMIN signal that the limits have been reached or the output signal is being
limited.
QMAX = 1 if Y YMAX
QMIN = 1 if Y YMIN
Operating modes
There are three operating modes, which are selected via the inputs MAN and HALT:
Operating mode MAN HALT Meaning
Automatic 0 0 The current value for Y will be constantly
calculated and output.
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y. The control output is, however,
limited by YMAX and YMIN.
Halt 0 1 The output Y will be held at the last calculated
value.
LIMV
72 33002543 10/2013
Example
The function block follows the jump to input X with maximum change in speed. Output Y remains
at a standstill in Halt mode, in order to subsequently move on from the position at which it has
stopped. It is also clear to see the limits of output Y through YMAX and YMIN with the relevant
messages QMAX and QMIN.
Dynamic behavior of LIMV:
33002543 10/2013 73
Unity Pro
PI1
33002543 10/2013
PI1: PI controller
Chapter 9
PI1: PI controller
Introduction
This chapter describes the PI1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 74
Formulas 78
Parametering 79
Operating modes 81
Example of the PI1 controller 82
PI1
74 33002543 10/2013
Description
Function description
The function block represents a simple PI controller.
A system deviation ERR is formed by the difference between the setpoint SP and the controlled
variable PV. This deviation ERR causes the manipulated variable Y to change.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
Operating modes Manual, Halt, Automatic
bumpless changeover between manual and automatic
Manipulated variable limiting
Anti-windup reset
Anti-windup measure with an active I component only
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PI1
33002543 10/2013 75
Representation in FBD
Representation:
Representation in LD
Representation:
PI1
76 33002543 10/2013
Representation in IL
Representation:
CAL PI1_Instance (MAN:=ManualMode, HALT:=HaltMode,
SP:=SetpointValueInput, PV:=ProcessVariable,
GAIN:=ProportionalRate, TI:=ResetTime,
YMAX:=UpperControlLimit, YMIN:=LowerControlLimit,
YMAN:=ManualValue, Y=>ManipulatedVariable,
ERR=>OutputSystemDeviation, QMAX=>Y_Reached_YMAX,
QMIN=>Y_Reached_YMIN)
Representation in ST
Representation:
PI1_Instance (MAN:=ManualMode, HALT:=HaltMode,
SP:=SetpointValueInput, PV:=ProcessVariable,
GAIN:=ProportionalRate, TI:=ResetTime,
YMAX:=UpperControlLimit, YMIN:=LowerControlLimit,
YMAN:=ManualValue, Y=>ManipulatedVariable,
ERR=>OutputSystemDeviation, QMAX=>Y_Reached_YMAX,
QMIN=>Y_Reached_YMIN) ;
Parameter description
Description of input parameters:
Parameter Data type Description
MAN BOOL "1": Manual mode
HALT BOOL "1": Halt mode
SP REAL Setpoint input
PV REAL Controlled variable (process variable)
GAIN REAL Proportional action coefficient (gain)
TI TIME Integral time
YMAX REAL Upper limit
YMIN REAL Lower limit
YMAN REAL Manual value
PI1
33002543 10/2013 77
Description of output parameters:
Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
Y REAL Manipulated variable
ERR REAL Output system deviation
QMAX BOOL "1" = Output Y has reached upper limit
QMIN BOOL "1" = Output Y has reached lower limit
PI1
78 33002543 10/2013
Formulas
Transfer function
The transfer function is:
The I component can be disabled by setting TI = 0.
Calculation formulas
The calculation formulas are:
Output signal Y
The output signal Y is then:
The I component is formed according to the trapezoid rule.
Explanation of formula variables
The meaning of the formula variables is given in the following table:
Variable Meaning
Present sample time
System deviation (SP - PV)
System deviation value from the previous sampling step
YI I component
YP P component
PI1
33002543 10/2013 79
Parametering
Structure diagram
The following is the structure diagram of the PI1 controller:
Parametering
The PI1 control structure is displayed in theStructure diagram, page 79. Setting parameters for the
function block takes place first of all for the elemental PI parameters: the proportional action
coefficient GAIN and reset time TI.
The limits YMAX and YMIN limit the output within the prescribed range. Therefore YMIN Y YMAX.
The markers QMAX and QMIN signal that the limits have been reached or the output signal is being
limited.
QMAX = 1 if Y YMAX
QMIN = 1 if Y YMIN
Manipulated variable limiting
After summation of the components manipulated variable limiting takes place, so that: YMIN Y
YMAX
PI1
80 33002543 10/2013
Anti-windup reset
Should limiting of the manipulated variable take place, the anti-windup reset should ensure that the
integral component "cannot go berserk". The anti-windup measure is only implemented if the I
component of the controller is not disabled. Anti-windup limits are identical to those for the
manipulated variable. The anti-windup-reset measure corrects the I component such that: YMIN -
YP YI YMAX - YP
PI1
33002543 10/2013 81
Operating modes
Selecting the operating modes
There are three operating modes, which are selected via the inputs MAN and HALT.
Automatic operating mode
In automatic mode the control output Y is determined through the closed-loop control based on the
controlled variable PV and reference variable SP. The manipulated variable is limited by YMAX and
YMIN. The control limits are also limits for the Anti-windup reset.
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between YMAX and YMIN, and Y goes directly to YMAN at the changeover.
If the changeover from automatic to manual is to be bumpless nevertheless, there are two
possibilities, which are explained as an example for a PID1 Controller (see page 92).
Manual mode
In manual mode the manually manipulated value YMAN is passed on directly to the control output
Y. However, the manipulated variable is limited by YMAX and YMIN. Internal variables will be
manipulated in such a manner that the controller changeover from manual to automatic (with I
component enabled) can be bumpless. The control limits are also limits for the Anti-windup reset
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
control output Y, i.e. Y = Y(old). Internal variables will be manipulated in such a manner that the
component sum corresponds with the manipulated variable, thus allowing the controller to be
driven smoothly from its current position. The control limits are also limits for the Anti-windup reset.
Operating mode MAN HALT
Automatic 0 0
Manual mode 1 1 or 0
Halt 0 1
PI1
82 33002543 10/2013
Example of the PI1 controller
Example
The jump response of the PI1 controller is shown in the following Diagram (see page 82) as an
example.
In the first part of the figure the function block response to MAN operating mode can be seen: The
output Y jumps to the YMAN value.
The second part of the diagram shows the reaction of the function block in automatic mode (MAN
= 0 and HALT= 0) both with a positive ERR system deviation and with a negative ERR system
deviation. For constant positive system deviation, Y ramps upward until the upper output limit is
reached.
The output is subsequently limited to the YMAX value. The limit is signaled in the QMAX output. The
system deviation then jumps to a negative value whose absolute value is greater than the previous
positive value.
The input jumps to the value ); through the P component, then
there is a ramp decrease in Y. The absolute value of the gradient is greater than under the previous
positive system deviation. This can be attributed to the now greater absolute value of the system
deviation.
The jump response of the PI1 controller
Presentation of the jump response of the PI1 controller
33002543 10/2013 83
Unity Pro
PID1
33002543 10/2013
PID1: PID controller
Chapter 10
PID1: PID controller
Introduction
This chapter describes the PID1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 84
PID1 function block structure diagram 89
Setting parameters for the PID1 controller 90
Operating modes 92
Detailed formulas 94
PID1
84 33002543 10/2013
Description
Function description
The function block produces a PID controller.
A system deviation ERR is formed because of the reference variable SP and the controlled variable
PV. This deviation ERR causes the manipulated variable Y to change.
Initialization requirements
This function block performs an internal initialization in the first program cycle after a warm start or
cold start (for examle application download or power cycle) of the PLC program.
EN and ENO can be configured as additional parameters.
For the proportional part of the controller to behave properly, the integral action must be reset (the
input coefficient EN_I set to zero) for at least one scan time after a warm start or cold start.
If the integral action coefficient EN_I is set to a non-zero value at initialization, the function block
behaves like an I or ID controller with no proportional part.
Properties
The function block has the following properties:
real PID controller with independent GAIN, TI, TD setting
Operating modes Manual, Halt, Automatic
bumpless changeover between manual and automatic
Manipulated variable limiting in automatic mode
Separately enabled P, I and D component
Anti-Windup-Reset
Anti-windup measures taken only for an active I component
definable delay of the D component
D component connectable to controlled variable PV or system deviation ERR
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PID1
33002543 10/2013 85
Transfer function
The transfer function is:
Explanation of the variables:
Representation in FBD
Representation:
Variable Description
YD D component (only when EN_D = 1)
YI I component (only when EN_I = 1)
YP P component (only when EN_P = 1)
PID1
86 33002543 10/2013
Representation in LD
Representation:
PID1
33002543 10/2013 87
Representation in IL
Representation:
CAL PID1_Instance (MAN:=ManualMode, HALT:=HaltMode,
SP:=SetpointValueInput, PV:=ProcessVariable,
BIAS:=DisturbanceInput, EN_P:=P_Portion_On,
EN_I:=I_Portion_On, EN_D:=D_Portion_On,
D_ON_X:=D_PortionValueFlag, GAIN:=ProportionalRate,
TI:=ResetTime, TD:=DerivativeActionTime,
TD_LAG:=LagTimeD_Portion, YMAX:=UpperControlLimit,
YMIN:=LowerControlLimit, YMAN:=ManualValue,
Y=>ManipulatedVariable, ERR=>OutputSystemDeviation,
QMAX=>Y_Reached_YMAX, QMIN=>Y_Reached_YMIN)
Representation in ST
Representation:
PID1_Instance (MAN:=ManualMode, HALT:=HaltMode,
SP:=SetpointValueInput, PV:=ProcessVariable,
BIAS:=DisturbanceInput, EN_P:=P_Portion_On,
EN_I:=I_Portion_On, EN_D:=D_Portion_On,
D_ON_X:=D_PortionValueFlag, GAIN:=ProportionalRate,
TI:=ResetTime, TD:=DerivativeActionTime,
TD_LAG:=LagTimeD_Portion, YMAX:=UpperControlLimit,
YMIN:=LowerControlLimit, YMAN:=ManualValue,
Y=>ManipulatedVariable, ERR=>OutputSystemDeviation,
QMAX=>Y_Reached_YMAX, QMIN=>Y_Reached_YMIN) ;
Parameter description
Description of input parameters:
Parameter Data type Description
MAN BOOL "1": Manual mode
HALT BOOL "1": Halt mode
SP REAL Setpoint input
PV REAL Controlled variable (process variable)
BIAS REAL Disturbance input
EN_P BOOL "1": P component on
EN_I
1
BOOL "1": I component on
EN_D BOOL "1": D component on
D_ON_X BOOL "1": D component on controlled variable
"0": D component on system deviation
PID1
88 33002543 10/2013
1
Refer to Initialization Requirements (see page 84).
Description of output parameters:
Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see Tables of Error Codes for the Obsolete
Library (see page 600).
GAIN REAL Proportional action coefficient (gain)
TI TIME Integral time
TD TIME Derivative time
TD_LAG TIME Delay, D component
YMAX REAL Upper limit
YMIN REAL Lower limit
YMAN REAL Manually manipulated value
Parameter Data type Description
ERR REAL Output system deviation
Y REAL Manipulated variable
QMAX BOOL "1" = Output Y has reached upper limit
QMIN BOOL "1" = Output Y has reached lower limit
Parameter Data type Description
PID1
33002543 10/2013 89
PID1 function block structure diagram
Structure diagram
The following is the structure diagram of the PID1block:
PID1
90 33002543 10/2013
Setting parameters for the PID1 controller
Parametering
The PID1 control structure is displayed in theStructure diagram, page 89.
Setting function block parameters is initially performed by the pure PID parameters, i.e. the
proportional action coefficient GAIN, the reset time TI and the rate time TD.
The D component is delayed by the time TD_LAG. The ratio between TD/TD_LAG is called
differential gain VD. The D component can either be formed by the system deviation ERR (D_ON_X
= 0) or the controlled variable PV (D_ON_X = 1). Should the D component be determined by the
controlled variable PV, then the D component will not be able to cause jumps when reference
variable fluctuations (changes in input SP) take place. Generally, the D component only affects
disturbances and process variances.
Control direction reversal
A reversed behavior of the controller can be achieved by reversing the sign of GAIN. A positive
value on GAIN causes the increase of the output value, for a positive error variable. A negative
value on GAIN causes the increase of the output value, for a positive error variable.
Manipulated variable limiting
The limits YMAX and YMIN limit the output within the prescribed range. Therefore YMIN Y YMAX.
The markers QMAX and QMIN signal that the limits have been reached or the output signal is being
limited.
QMAX = 1 if Y YMAX
QMIN = 1 if Y YMIN
For limiting the manipulated variable, the upper limit YMAX should be greater than the lower limit
YMIN.
Anti-windup reset
If manipulated variable limiting takes place, the anti-windup reset should make sure that the
integral component cannot exceed all limits. The anti-windup measure is only implemented if the I
component of the controller is not disabled. Anti-windup limits are identical to those for the
manipulated variable. The anti-windup measure disregards the D component, to avoid the capping
of the D component peaks through the anti-windup measure.
The anti-windup reset measure corrects the I component in the form, which means:
PID1
33002543 10/2013 91
Selecting the control types
There are various controller types, which can be selected via the EN_P, EN_I and EN_D
parameters.
The I component can also be disabled with TI = 0.
Controller type EN_P EN_I EN_D
P controller 1 0 0
PI controller 1 1 0
PD controller 1 0 1
PID controller 1 1 1
I controller 0 1 0
PID1
92 33002543 10/2013
Operating modes
Selecting the operating modes
There are three operating modes, which are selected via the parameters MAN and HALT:
Automatic operating mode
In automatic mode, the manipulated variable Y is determined through the discrete PID closed-loop
control algorithm subject to controlled variable PV and reference variable SP. The manipulated
variable is limited by YMAX and YMIN. The control limits are also limits for the Anti-windup reset.
Manual mode
In manual mode the manually manipulated value YMAN is passed on directly to the control output
Y. The control output is, however, limited by YMAX and YMIN. Internal variables will be manipulated
in such a manner that the controller changeover from manual to automatic (with I component
enabled) can be bumpless. The control limits are also limits for the Anti-windup reset.
In this operating mode the D component is automatically set to 0.
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
control output Y, i.e. Y = Y(old). Internal variables will be manipulated in such a manner that the
component sum corresponds to the control output, thus allowing the controller to be driven
smoothly from its current position (when the I component is enabled). The control limits are also
limits for the Anti-windup reset.
In this operating mode the D component is automatically set to 0.
Switching from automatic to manual
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between YMAX and YMIN, and Y goes directly to YMAN at the changeover.
There are two possibilities if, nevertheless, a bumpless changeover from automatic to manual is
required:
Switching with the help of the MOVE function
Switching with the help of the velocity limiter function block LIMV
Operating mode MAN HALT
Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1
PID1
33002543 10/2013 93
Switching via MOVE
Using function MOVE set the value of YMAN to the value of Y:
NOTE: This type of display was selected purely for clarity of understanding. The links represented
by a dotted line can not be programmed as Links (link objects), as they form unauthorized (in Unity
Pro) loops. In programming, the links must be established using variables.
The MOVE function is only executed when the PID controller is in automatic or halt mode (MAN = 0).
If only one changeover from automatic to manual takes place it is bumpless, as the value of YMAN
is equal to the value of Y in this cycle. In the manual mode the value of YMAN can slowly be
changed.
Switching via LIMV
Should you not wish to modify YMAN, e.g. because it is a constant, then the previous solution must
be replace by a velocity limiter (function block LIMV (see page 67)):
NOTE: This type of display was selected purely for clarity of understanding. The links represented
by a dotted line can not be programmed as Links (link objects), as they form unauthorized (in Unity
Pro) loops. In programming, the links must be established using variables.
The MOVE function is only executed when the PID controller is in automatic or halt mode (MAN = 0).
If only one changeover from automatic to manual takes place, it is bumpless, as the value of YMAN
(of the PID1) is equal to the value of Y (of the PID1) in this cycle. The PID1 controller YMAN value,
starting at your adjustment value (RATE), are compared with the actual manual value (on LIMV)
beginning with the next cycle.
PID1
94 33002543 10/2013
Detailed formulas
Explanation of formula variables
Meaning of the variables in the following formulas:
Manipulated variable
The manipulated variable consists of various terms which are dependent on the operating mode:
After summation of the components manipulated variable limiting takes place, so that:
Overview of the calculation of the control components
Following this an overview on the different calculations of the control components in relation to the
inputs EN_P, EN_I and EN_D can be found:
P component YP for manual, Halt and automatic mode
I component YI for automatic mode
I component YI for manual and halt modes
D component YD for automatic mode
D component YD for manual and halt modes
Variable Meaning
Time differential between the present cycle and the previous cycle
System deviation (SP - PV)
System deviation value from the current sampling step
System deviation value from the previous sampling step
BIAS Disturbance variable
Value of controlled variable from the current sampling step
Value of controlled variable from the previous sampling step
Y current output (halt mode) or YMAN (manual mode)
YD D component
YI I component
YP P component
PID1
33002543 10/2013 95
P component YP for all operating modes
YP for manual, halt and automatic modes is determined as follows:
For EN_P = 1 the following applies:
For EN_P = 0 the following applies:
I component YI for automatic mode
YI for automatic mode is determined as follows:
For EN_I = 1 the following applies:
For EN_I = 0 the following applies:
The I component is formed according to the trapezoid rule.
I component YI for manual and halt modes
YI for manual, halt and automatic modes is determined as follows:
For EN_I = 1 the following applies:
For EN_I = 0 the following applies:
PID1
96 33002543 10/2013
D component YD for automatic mode
YD for automatic mode and cascade is determined as follows:
For EN_D = 1 and D_ON_X = 0 the following applies:
For EN_D = 1 and D_ON_X = 1 the following applies:
For EN_D = 0 the following applies:
D component YD for manual and halt modes
YD for manual, halt and automatic modes is determined as follows:
YD = 0
33002543 10/2013 97
Unity Pro
PID_P1
33002543 10/2013
PIDP1: PID Controller with Parallel Structure
Chapter 11
PIDP1: PID Controller with Parallel Structure
At a Glance
This chapter describes the PIDP1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 98
Setting parameters for the PIDP1 controller 103
Operating modes 105
Detailed formulas 106
PID_P1
98 33002543 10/2013
Description
Function description
The function block replicates a PID controller in parallel structure.
A system deviation ERR is formed by the difference between the setpoint SP and the controlled
variable PV. The deviation ERR causes the manipulated variable Y to change.
Initialization Requirements
This function block performs an internal initialization in the first program cycle after a warm start or
cold start (e.g. application download or power cycle) of the PLC program.
EN and ENO can be configured as additional parameters.
For the proportional part of the controller to behave properly, the integral action must be reset (the
input coefficient KI set to zero) for at least one scan time after a warm start or cold start.
If the integral action coefficient KI is set to a non-zero value at initialization, the function block
behaves like an I or ID controller with no proportional part.
Properties
The function block has the following properties:
PID controller in pure parallel structure
Each component P, I and D can be individually enabled
Limiting control limits in automatic mode
Anti-windup measure with an active I component only
Anti-windup reset
Operating modes Manual, Halt, Automatic
Bumpless changeover between manual and automatic
D component connectable to input variable PV or system deviation ERR
D component with variable delay
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PID_P1
33002543 10/2013 99
Transfer function
The transfer function is:
Explanation of the variables:
Representation in FBD
Representation:
Variable Description
YD D component
YI I component
YP P component
PID_P1
100 33002543 10/2013
Representation in LD
Representation:
PID_P1
33002543 10/2013 101
Representation in IL
Representation:
CAL PIDP1_Instance (MAN:=ManualMode, HALT:=HaltMode,
SP:=SetpointValueInput, PV:=ProcessVariable,
BIAS:=DisturbanceInput, D_ON_X:=D_PortionValueFlag,
REVERS:=OutputReversed, KP:=ProportionalRate,
KI:=IntegralRate, KD:=DifferentiationRate,
TD_LAG:=LagTimeD_Portion, YMAX:=UpperControlLimit,
YMIN:=LowerControlLimit, YMAN:=ManualValue,
Y=>ManipulatedVariable, ERR=>OutputSystemDeviation,
QMAX=>Y_Reached_YMAX, YMIN=>Y_Reached_YMIN)
Representation in ST
Representation:
PIDP1_Instance (MAN:=ManualMode, HALT:=HaltMode,
SP:=SetpointValueInput, PV:=ProcessVariable,
BIAS:=DisturbanceInput, D_ON_X:=D_PortionValueFlag,
REVERS:=OutputReversed, KP:=ProportionalRate,
KI:=IntegralRate, KD:=DifferentiationRate,
TD_LAG:=LagTimeD_Portion, YMAX:=UpperControlLimit,
YMIN:=LowerControlLimit, YMAN:=ManualValue,
Y=>ManipulatedVariable, ERR=>OutputSystemDeviation,
QMAX=>Y_Reached_YMAX, YMIN=>Y_Reached_YMIN) ;
Parameter description
Description of the input parameters:
Parameter Data type Description
MAN BOOL "1": Manual mode
HALT BOOL "1": Halt mode
SP
1
REAL Setpoint input
PV
1
REAL Input variable
BIAS REAL Disturbance input
D_ON_X BOOL 1: D component in relation to the controlled variable
0: D component in relation to the system deviation
REVERSE BOOL 1: Output reversed
KP REAL Proportional action coefficient (gain)
KI
1
REAL Integral action coefficient
KD REAL Derivative time constant
TD_LAG TIME Delay, D component
PID_P1
102 33002543 10/2013
1
Refer to Initialization Requirements (see page 98).
Description of the output parameters:
Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see Tables of Error Codes for the Obsolete
Library (see page 598).
YMAX REAL Upper limit
YMIN REAL Lower limit
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Manipulated variable
ERR REAL System deviation
QMAX BOOL 1 = Y has reached the upper control limit
QMIN BOOL 1 = Y has reached the lower control limit
Parameter Data type Description
PID_P1
33002543 10/2013 103
Setting parameters for the PIDP1 controller
Structure diagram
The following is the structure diagram of the PIDP1 block:
Setting Parameters
The PIDP1 control structure is displayed in the Structure diagram.
Setting parameters for the PIDP1 controller takes place first of all for the pure PID parameters, that
is to say, the proportional action coefficient KP, the integral action coefficient KI and rate of
differentiation KD.
The P, I and D components can be individually disabled while the corresponding input (KP, KI oder
KD) is set to 0.
The D component is delayed by the time constant TD_LAG. The D component can either be formed
by the system deviation ERR (D_ON_X = 0) or the controlled variable PV (D_ON_X = 1). Should the
D component be determined by the controlled variable PV, then the D component will not be able
to cause jumps when reference variable fluctuations (changes in input SP) take place. In principle,
the D component only affects disturbances and process variances.
PID_P1
104 33002543 10/2013
Control direction reversal
The opposite behavior of the controller can be attained by setting input REVERSE to 1. REVERSE =
0 results in an increased output value when there is a positive disturbance. REVERSE = 1 results
in an decreased output value when there is a positive disturbance.
Manipulated variable limiting
The limits YMAX and YMIN limit the output within the prescribed range. Therefore YMIN Y YMAX.
The markers QMAX and QMIN signal that the limits have been reached or the output signal is being
limited.
QMAX = 1 if Y YMAX
QMIN = 1 if Y YMIN
For limiting the manipulated variable, the upper limit YMAX should be greater than the lower limit
YMIN.
Anti-Windup-Reset
If manipulated variable limiting takes place, the anti-windup reset should make sure that the
integral component cannot exceed all limits. The antiwindup measure is only implemented if the I
component of the controller is not disabled. Anti-windup limits are identical to those for the
manipulated variable. The anti-windup measure disregards the D component, to avoid the capping
of the D component peaks through the anti-windup measure.
The anti-windup reset measure corrects the I component in the form, which means:
Selecting the control types
Several controller variants can be selected over the parameters KP, KI and KD:
Controller type KP KI KD
P controller > 0 = 0 = 0
PI controller > 0 > 0 = 0
PD controller > 0 = 0 > 0
PID controller > 0 > 0 > 0
I controller = 0 > 0 = 0
PID_P1
33002543 10/2013 105
Operating modes
Selecting the operating modes
There are three operating modes, which are selected via the parameters MAN and HALT:
Automatic operating mode
In automatic mode, the control output Y is determined through the discrete PID closed-loop control
algorithm subject to controlled variable PV and reference variable SP. The control output is limited
by YMAX and YMIN. The control limits are also limits for the Anti-windup reset.
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between YMAX and YMIN, and Y goes directly to YMAN at the changeover.
If the changeover from automatic to manual is to be bumpless in spite of this, there are two
exemplary possibilities shown for a PID1 Controller (see page 92).
Manual mode
In manual mode the manually manipulated value YMAN is passed on directly to the control output
Y. The control output is, however, limited by YMAX and YMIN. Internal variables will be manipulated
in such a manner that the controller changeover from manual to automatic (with I component
enabled) can be bumpless. The control limits are also limits for the Anti-windup reset.
In this operating mode the D component is automatically set to 0.
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
control output Y, i.e. Y = Y(old). Internal variables will be manipulated in such a manner that the
component sum corresponds to the control output, thus allowing the controller to be driven
smoothly from its current position (when the I component is enabled). The control limits are also
limits for the Anti-windup reset.
In this operating mode the D component is automatically set to 0.
Operating mode MAN HALT
Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1
PID_P1
106 33002543 10/2013
Detailed formulas
Explanation of formula variables
Meaning of the variables in the formulas:
Manipulated variable
The manipulated variable is composed of various terms:
After summation of the components manipulated variable limiting takes place, so that:
System deviation
The system deviation will be determined as follows:
Variable Description
Time differential between the present cycle and the previous cycle
System deviation (SP-PV)
System deviation value from the current sampling step
System deviation value from the previous sampling step
BIAS Disturbance variable
Value of controlled variable from the current sampling step
Value of controlled variable from the previous sampling step
Y current output (halt mode) or YMAN (manual mode)
YD D component
YI I component
YP P component
If... Then
REVERSE = 0 ERR = SP - PV
REVERSE = 1 ERR = PV - SP
PID_P1
33002543 10/2013 107
Overview of the calculation of the control components
Following this an overview on the different calculations of the control components in relation to the
gains KP, KI and KD can be found:
P component YP for manual, halt and automatic modes
I component YI for automatic mode
I component YI for manual and halt modes
D component YD for automatic mode
D component YD for manual and halt modes
P component YP for all operating modes
YP for manual, halt and automatic modes is determined as follows:
I component YI for automatic mode
YI for automatic mode is determined as follows:
For KI > the following applies:0
For KI = 0 the following applies:
The I component is formed according to the trapezoid rule.
I component YI for manual and halt modes
YI for manual, halt and automatic modes is determined as follows:
For KI > 0 the following applies:
For KI = 0 the following applies:
PID_P1
108 33002543 10/2013
D component YD for automatic mode
YD for automatic mode and cascade is determined as follows:
For KD > 0 and D_ON_X = 0 the following applies:
For KD > 0 and D_ON_X = 1 the following applies:
For KD = 0 the following applies:
D component YD for manual and halt modes
YD for manual, halt and automatic modes is determined as follows:
33002543 10/2013 109
Unity Pro
SMOOTH_RATE
33002543 10/2013
SMOOTH_RATE: Differentiator with smoothing
Chapter 12
SMOOTH_RATE: Differentiator with smoothing
Introduction
This chapter describes the SMOOTH_RATE block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 110
Formulas for the SMOOTH_RATE function block 113
Detailed description 114
SMOOTH_RATE
110 33002543 10/2013
Description
Function description
The function block is a differential element with a delayed output Y respecting the delay time
constant LAG.
The function block contains the following operating mode:
Manual mode
Halt
Automatic
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SMOOTH_RATE
33002543 10/2013 111
Representation in LD
Representation:
Representation in IL
Representation:
CAL SMOOTH_RATE_Instance (MAN:=ManualMode,
HALT:=HaltMode, X:=InputVariable,
GAIN:=DifferentialGain, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue,
Y=>DifferentiatorOutputWithDelay)
Representation in ST
Representation:
SMOOTH_RATE_Instance (MAN:=ManualMode,
HALT:=HaltMode, X:=InputVariable,
GAIN:=DifferentialGain, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue,
Y=>DifferentiatorOutputWithDelay) ;
SMOOTH_RATE
112 33002543 10/2013
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
X REAL Input variable
GAIN REAL Gain of the differentiation
LAG TIME Delayed time constants
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output derivative unit with smoothing
SMOOTH_RATE
33002543 10/2013 113
Formulas for the SMOOTH_RATE function block
Transfer function
The transfer function for Y is:
Output Y
The output Y is determined as follows:
Explanation of formula variables
Meaning of the variables in the above formulas:
Variable Meaning
dt is the time differential between the current cycle and the previous cycle
Value of the input X from the current cycle
Value of input X from the previous cycle
Value of input Y from the previous cycle
SMOOTH_RATE
114 33002543 10/2013
Detailed description
Parametering
The parameter assignments of the function block are made by defining the GAIN, the differentiator
and the time constant LAG, by which the output Y is delayed.
For very short sampling times and a unit jump at the X input (input X jumps from 0 to 1.0), the output
Y jumps to the GAIN value (in theory - in reality somewhat smaller, due to the sampling time not
being infinitely small), and then returns to 0 with the delay time constant LAG.
Operating modes
The function block SMOOTH_RATE has 3 operating mode: Automatic, manual and halt.
The operating mode are selected via the inputs MAN and HALT:
Example
The following illustration shows the jump response of the function block SMOOTH_RATE when GAIN
= 1 and LAG = 10 s:
Operating mode MAN HALT Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The input YMAN will be transferred directly to the
output Y.
Halt 0 1 The output Y will be held at the last calculated
value.
33002543 10/2013 115
Unity Pro
THREE_STEP_CON1
33002543 10/2013
THREE_STEP_CON1: Three step controller
Chapter 13
THREE_STEP_CON1: Three step controller
Introduction
This chapter describes the THREE_STEP_CON1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 116
Detailed description 120
THREE_STEP_CON1
116 33002543 10/2013
Description
Function description
The function block replicates a three-point step controller, and exhibits a PD-like behavior due to
a dynamic feedback path.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block THREE_STEP_CON1 has the following properties:
Reset and automatic operating modes
One internal feedback path (delay 1st Order)
Representation in FBD
Representation:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
THREE_STEP_CON1
33002543 10/2013 117
Representation in LD
Representation:
Representation in IL
Representation:
CAL THREE_STEP_CON1_Instance (R:=ResetMode,
SP:=SetPointInput, PV:=ProcessVariable,
GAIN:=ProportionalRate, TI:=ResetTime,
T_PROC:=NominalControllerTime, HYS:=Hysteresis,
DB:=Deadband, Y_POS=>PosControlVarAt_ERR_EFF,
Y_NEG=>NegControlVarAt_ERR_EFF,
ERR_EFF=>EffectiveError)
THREE_STEP_CON1
118 33002543 10/2013
Representation in ST
Representation:
THREE_STEP_CON1_Instance (R:=ResetMode,
SP:=SetPointInput, PV:=ProcessVariable,
GAIN:=ProportionalRate, TI:=ResetTime,
T_PROC:=NominalControllerTime, HYS:=Hysteresis,
DB:=Deadband, Y_POS=>PosControlVarAt_ERR_EFF,
Y_NEG=>NegControlVarAt_ERR_EFF,
ERR_EFF=>EffectiveError) ;
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
With HYS > 2 * DB an error message is returned.
NOTE: For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
R BOOL "1": Reset mode
SP REAL Setpoint input
PV REAL Actual value input
GAIN REAL Proportional action coefficient (gain)
TI TIME Integral time
T_PROC TIME Nominal actuating time of the controlled valve
HYS REAL Hysteresis from three point switch
DB REAL Dead zone
Parameter Data type Description
ERR_EFF REAL Effective switch value
Y_POS BOOL "1" = positive manipulated variable at output
ERR_EFF
Y_NEG BOOL "1" = negative manipulated variable at output
ERR_EFF
THREE_STEP_CON1
33002543 10/2013 119
Warning
In the following cases a warning will be returned:
NOTE: For a list of all block error codes and values, see CLC, page 598.
If... Then...
GAIN 0 the controller operates without feedback.
TI = 0 the controller operates without feedback.
T_PROC = 0 the controller operates with a predetermined value of T_PROC = 60 s.
THREE_STEP_CON1
120 33002543 10/2013
Detailed description
Structure of the controller
Structure of the three-point controller:
Dependency of outputs Y_POS and Y_NEG on the variable Y:
Meaning of variable K:
If... Then...
Y = 1 Y_POS = 1
Y_NEG = 0
Y = 0 Y_POS = 0
Y_NEG = 0
Y = -1 Y_POS = 0
Y_NEG = 1
THREE_STEP_CON1
33002543 10/2013 121
Principle of the three-point controller
The actual three-point controller will have a dynamic feedback path (PT1-element) added. By
appropriately choosing the time constants TI and T_PROC of these feedback elements, the three-
point controller exhibits a dynamic behavior corresponding to that of a PID controller.
Principle of the three-point controller
The parameter GAIN must > be 0
Dead zone
The DB parameter fixes the operate point for the outputs Y_POS and Y_NEG. If the effective
switching value ERR_EFF = SP - PV - XR is positive and is greater than DB, then the Y_POS output
switches from "0" to "1". If the effective switch value ERR_EFF is negative and is greater than DB,
then the output Y_NEG will switch from "0" to "1". The parameter DB is typically set to 1% of the
maximum control range (max. (SP - PV)).
NOTE: The amount is evaluated from the DB dead zone!
Hysteresis
The parameter HYS indicates the switching hysteresis, i.e. the value which the effective switch
value ERR_EFF outgoing from control point DB must be reduced by, before the output Y_POS
(Y_NEG) is reset to "0". The connection between Y_POS and Y_NEG depending on the effective
switch value ERR_EFF and the parameters DB and HYS is illustrated in the image "Principle of the
three-point controller, page 121". The parameter HYS is typically set to 0.5 % of the maximum
control range (max. (SP - PV)).
NOTE: The amount is evaluated from the HYS hysterisis!
THREE_STEP_CON1
122 33002543 10/2013
Behavior with faulty time constants
Should the time constant TI = 0 or the proportional action coefficient GAIN 0 (configuration error),
the block will still continue to operate. The functions feedback path is disabled however, so that the
block operates as a conventional three-point switch.
If the time constant T_PROC = 0 (configuration error), the block will still continue to operate. In this
case T_PROC is set to a preset value of T_PROC = 60s (60 000 msec).
Operating modes
There are two operating modes that can be selected through the R parameter input:
Operating mode R Meaning
Automatic 0 The function block will be handled as described above.
Reset 1 The internal value of the feedback element is set to SP - PV.
The outputs Y_POS and Y_NEG are both set to "0".
33002543 10/2013 123
Unity Pro
THREEPOINT_CON1
33002543 10/2013
THREEPOINT_CON1: Three point controller
Chapter 14
THREEPOINT_CON1: Three point controller
Introduction
This chapter describes the THREEPOINT_CON1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 124
Detailed description 129
THREEPOINT_CON1
124 33002543 10/2013
Description
Function description
The function block forms a three-point controller, which maintains PID-similar behavior through two
dynamic feedback paths.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block THREEPOINT_CON1 contains the following properties:
Operating modes Manual, Halt, Automatic
Two internal feedback paths (delay 1st Order)
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
THREEPOINT_CON1
33002543 10/2013 125
Representation in FBD
Representation:
THREEPOINT_CON1
126 33002543 10/2013
Representation in LD
Representation:
THREEPOINT_CON1
33002543 10/2013 127
Representation in IL
Representation:
CAL THREEPOINT_CON1_Instance (MAN:=ManualMode,
HALT:=HaltMode,SP:=SetPointInput,
PV:=ProcessVariableInput, GAIN:=FeedbackGain,
LAG_NEG:=RapidFeedbackTimeConstant,
LAG_POS:=SlowFeedbackTimeConstant,
HYS:=HysteresisThreePositionSwitch, DB:=Deadband,
XF_MAN:=FeedbackResetFactor,
YMAN_POS:=ManualControlOutputForY_POS,
YMAN_NEG:=ManualControlOutputForY_NEG,
Y_POS=>PosManipulation, Y_NEG=>NegManipulation,
ERR_EFF=>EffectiveError)
Representation in ST
Representation:
THREEPOINT_CON1_Instance (MAN:=ManualMode,
HALT:=HaltMode,SP:=SetPointInput,
PV:=ProcessVariableInput, GAIN:=FeedbackGain,
LAG_NEG:=RapidFeedbackTimeConstant,
LAG_POS:=SlowFeedbackTimeConstant,
HYS:=HysteresisThreePositionSwitch, DB:=Deadband,
XF_MAN:=FeedbackResetFactor,
YMAN_POS:=ManualControlOutputForY_POS,
YMAN_NEG:=ManualControlOutputForY_NEG,
Y_POS=>PosManipulation, Y_NEG=>NegManipulation,
ERR_EFF=>EffectiveError) ;
Parameter description
Description of input parameters:
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
SP REAL Setpoint input
PV REAL Actual value input
GAIN REAL Feedback gain (Feedback Parameter Set)
LAG_NEG TIME Time constant of the quick feedback (Feedback
Parameter Set)
LAG_POS TIME Time constant of the slow feedback (Feedback
Parameter Set)
THREEPOINT_CON1
128 33002543 10/2013
Description of output parameters:
Runtime error
With HYS > 2 * DB an error message is returned.
NOTE: For a list of all block error codes and values, see CLC, page 598.
Warning
In the following cases a warning will be returned:
NOTE: For a list of all block error codes and values, see CLC, page 598.
HYS REAL Hysteresis from three point switch
DB REAL Dead zone
XF_MAN REAL Feedback path reset value in % (-100 to 100)
YMAN_POS BOOL Manual manipulation for Y_POS
YMAN_NEG BOOL Manual manipulation for Y_NEG
Parameter Data type Description
Y_POS BOOL "1" = positive manipulated variable at output
ERR_EFF
Y_NEG BOOL "1" = negative manipulated variable at output
ERR_EFF
ERR_EFF REAL Effective switch value
Parameter Data type Description
If... Then...
LAG_NEG = 0 and LAG_POS > 0 The controller works as if it had only a positive
feedback with time constant LAG_POS.
LAG_POS < LAG_NEG > 0 The controller works as if it had only a negative
feedback with time constant LAG_NEG.
XF_MAN < -100 or XF_MAN > 100 the controller operates without internal feedback
paths.
THREEPOINT_CON1
33002543 10/2013 129
Detailed description
Structure of the controller
Structure of the three-point controller:
Dependency of outputs Y_POS and Y_NEG on the variable Y:
If... Then...
Y = 1 Y_POS = 1
Y_NEG = 0
Y = 0 Y_POS = 0
Y_NEG = 0
Y = -1 Y_POS = 0
Y_NEG = 1
THREEPOINT_CON1
130 33002543 10/2013
Principle of the three-point controller
The actual three-point controller will have two dynamic feedbacks (PT1 elements) added. By
appropriately selecting the time constant of these feedback elements, the three-point controller
exhibits a dynamic behavior corresponding to that of a PID controller.
Principle of the three-point controller
The parameter GAIN must > be 0
NOTE: Entries for XF_MAN (percentages from -100% to 100%) must be in the range -100 to 100
inclusive!
Internal feedback paths
The function block has a parameter set for the internal feedback paths consisting of the feedback
gain GAIN and the feedback time constants LAG_NEG and LAG_POS.
The following table provides more exact information about it:
Dead zone
The DB parameter fixes the operate point for the outputs Y_POS and Y_NEG. If the effective switch
value ERR_EFF is positive and is greater than DB, then the output Y_POS will switch from "0" to "1".
If the effective switch value ERR_EFF is negative and is greater than DB, then the output Y_NEG
will switch from "0" to "1". The parameter DB is typically set to 1% of the maximum control range
(max. SP - PV).
NOTE: The amount is evaluated from the DB dead zone!
Feedback LAG_NEG LAG_POS
3-Point-Behavior (without feedback) = 0 = 0
negative feedback > 0 = 0
negative + positive feedback > 0 > LAG_NEG
Warning, regeneration (neg. feedback with LAG_POS) = 0 > 0
Warning, regeneration (pos. feedback switched off) > LAG_POS > 0
THREEPOINT_CON1
33002543 10/2013 131
Hysteresis
The parameter HYS indicates the switching hysteresis, i.e. the value which the effective switch
value ERR_EFF outgoing from control point DB must be reduced by, before the output Y_POS
(Y_NEG) is reset to "0". The connection between Y_POS and Y_NEG depending on the effective
switch value ERR_EFF and the parameters DB and HYS is illustrated in the image "Principle of the
three-point controller, page 130". The parameter HYS is typically set to 0.5% of the maximum
control range (max. SP - PV).
NOTE: The amount is evaluated from the HYS hysterisis!
Operating modes
There are three operating modes, which are selected via the inputs MAN and HALT:
Operating mode MAN HALT Meaning
Automatic 0 0 The function block will be handled as described
above.
Manual mode 1 0 or 1 The outputs Y_POS and Y_NEG are set to the
values YMAN_POS and YMAN_NEG. A priority
logic - Y_NEG is dominant over Y_POS -
prevents both outputs being simultaneously
set.
xf1 and xf2 are calculated using the following
formula:
Halt 0 1 The outputs Y_POS and Y_NEG are held at their
last respective values. xf1 and xf2 are set to
GAIN * Y.
THREEPOINT_CON1
132 33002543 10/2013
33002543 10/2013 133
Unity Pro
TWOPOINT_CON1
33002543 10/2013
TWOPOINT_CON1: Two point controller
Chapter 15
TWOPOINT_CON1: Two point controller
Introduction
This chapter describes the TWOPOINT_CON1 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 134
Detailed description 139
TWOPOINT_CON1
134 33002543 10/2013
Description
Function description
The function block forms a two-point controller, which maintains PID-similar behavior through two
dynamic feedback paths.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block TWOPOINT_CON1 has the following properties:
Operating modes Manual, Halt, Automatic
Two internal feedback paths (delay 1st Order)
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
TWOPOINT_CON1
33002543 10/2013 135
Representation in FBD
Representation:
TWOPOINT_CON1
136 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL TWOPOINT_CON1_Instance (MAN:=ManualMode,
HALT:=HaltMode,SP:=SetPointInput, PV:=ProcessVariable,
K:=FeedbackGain, LAG_NEG:=RapidFeedbackTimeConstant,
LAG_POS:=SlowFeedbackTimeConstant,
DB:=HysteresisOfTwoPosSwitch,
XF_MAN:=FeedbackResetValue,
YMAN:=ManualValueForERR_EFF, Y=>OutputControlFlag,
ERR_EFF=>EffectiveError)
TWOPOINT_CON1
33002543 10/2013 137
Representation in ST
Representation:
TWOPOINT_CON1_Instance (MAN:=ManualMode,
HALT:=HaltMode,SP:=SetPointInput, PV:=ProcessVariable,
K:=FeedbackGain, LAG_NEG:=RapidFeedbackTimeConstant,
LAG_POS:=SlowFeedbackTimeConstant,
DB:=HysteresisOfTwoPosSwitch,
XF_MAN:=FeedbackResetValue,
YMAN:=ManualValueForERR_EFF, Y=>OutputControlFlag,
ERR_EFF=>EffectiveError) ;
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
With HYS > 2 * DB an error message is returned.
NOTE: For a list of all block error codes and values, see CLC, page 598.
Parameter Data type Description
MAN BOOL "1" = Manual operating mode
HALT BOOL "1" = Halt mode
SP REAL Setpoint input
PV REAL Actual value input
K REAL Feedback boost
LAG_NEG TIME Time constants of the quick feedback
LAG_POS TIME Time constants of the slow feedback
DB REAL Hysteresis from two point switch
XF_MAN REAL Reset value of the feedback in % (0 100)
YMAN BOOL "1" = Handwert fr ERR_EFF
Parameter Data type Description
Y BOOL "1" = Output manipulated variable
ERR_EFF REAL Effective switch value
TWOPOINT_CON1
138 33002543 10/2013
Warning
In the following cases a warning will be returned:
NOTE: For a list of all block error codes and values, see CLC, page 598.
If... Then...
LAG_NEG = 0 and LAG_POS > 0 The controller works as if it had only a positive
feedback with time constant LAG_POS.
LAG_POS < LAG_NEG > 0 The controller works as if it had only a negative
feedback with time constant LAG_NEG.
XF_MAN < 0 or XF_MAN > 100 the controller operates without internal feedback
paths.
TWOPOINT_CON1
33002543 10/2013 139
Detailed description
Structure of the controller
Structure of the two-point controller:
TWOPOINT_CON1
140 33002543 10/2013
Principle of the two-point controller
The actual two-point controller will have two dynamic feedback paths (PT1 elements) added. By
appropriately choosing the time constant of these feedback elements, the two-point controller
exhibits a dynamic behavior corresponding to that of a PID controller.
Principle of the two-point controller:
The selected feedback gain K must be greater than zero!
Entries for XF_MAN (percentages from 0 to 100%) must be in the range 0 to 100 inclusive!
Internal feedback paths
The feedback parameter set, consisting of the feedback gain K and the feedback time constants
LAG_NEG and LAG_POS, allows a universal employment of the two-point controller.
The following table provides more exact information about it:
Hysteresis
The parameter DB indicates the switching-hysteresis, i.e. the value which the effective switch value
ERR_EFF outgoing from control point DB/2 must be reduced by, before the output Y is reset to "0".
The dependence of the output Y depending of the effective switch value ERR_EFF and the
Parameter DB, becomes clear in the illustration "Principle of the two-point controller, page 140".
The parameter DB is typically set to 1% of the maximum control range [max. (SP - PV)].
Feedback LAG_NEG LAG_POS
2-Point-Behavior (without feedback) = 0 = 0
negative feedback > 0 = 0
negative + positive feedback > 0 > LAG_NEG
Warning, regeneration (neg. feedback with LAG_POS) = 0 > 0
Warning, regeneration (pos. feedback switched off) > LAG_POS > 0
TWOPOINT_CON1
33002543 10/2013 141
Operating modes
There are three operating modes, which are selected via the inputs MAN and HALT:
Operating mode MAN HALT Meaning
Automatic 0 0 The function block will be handled as described
above.
Manual mode 1 0 or 1 The output Y is set to the YMAN value.
xf1 and xf2 are calculated using the following
formula:
Halt 0 1 The output Y is held at its last value. xf1 and xf2
are set to GAIN * Y.
TWOPOINT_CON1
142 33002543 10/2013
33002543 10/2013 143
Unity Pro
CLC_PRO
33002543 10/2013
CLC_PRO
Part III
CLC_PRO
Overview
This part describes the elementary functions and elementary function blocks in the family
CLC_PRO.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
16 ALIM: Velocity limiter: 2nd order 145
17 COMP_PID: Complex PID controller 151
18 DEADTIME: Deadtime device 171
19 DERIV: Differentiator with smoothing 179
20 FGEN: Function generator 187
21 INTEG: Integrator with limit 203
22 LAG: Delay element 1st order 211
23 LAG2: Delay element 2nd order 217
24 LEAD_LAG: PD device with smoothing 225
25 PCON2: Two point controller 233
26 PCON3: Three point controller 239
27 PD_OR_PI: Structure changeover PD/PI controller 247
28 PDM: Pulse duration modulation 259
29 PI: PI controller 269
30 PID: PID controller 279
31 PID_P: PID controller with parallel structure 293
32 PIP: PIP cascade controller 305
33 PPI: PPI cascade controller 319
34 PWM: Pulse width modulation 331
35 QPWM: Pulse width modulation (simple) 343
36 SCON3: Three step controller 351
37 VLIM: Velocity limiter 1st order 359
CLC_PRO
144 33002543 10/2013
33002543 10/2013 145
Unity Pro
ALIM
33002543 10/2013
ALIM: Velocity limiter: 2nd order
Chapter 16
ALIM: Velocity limiter: 2nd order
Introduction
This chapter describes the ALIM block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 146
Detailed description 149
ALIM
146 33002543 10/2013
Description
Function description
The function block produces an acceleration limiter of the 2nd order.
The function block individually contains the following properties:
Operating modes Manual, Halt, Automatic
Output limiting
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
ALIM
33002543 10/2013 147
Representation in LD
Representation:
Representation in IL
Representation:
CAL ALIM_Instance (X:=Input, MODE:=OperatingMode,
PARA:=Parameter, YMAN:=ManualManipulatedY, Y=Output)
Representation in ST
Representation:
ALIM_Instance (X:=Input, MODE:=OperatingMode,
PARA:=Parameter, YMAN:=ManualManipulatedY, Y:=Output) ;
ALIM parameter description
Description of input parameters:
Description of input / output parameters:
Parameter Data type Description
X REAL Input
MODE Mode_MH Operating mode
PARA Para_ALIM Parameter
YMAN REAL Manual value for output Y
Parameter Data type Description
Y REAL Output
ALIM
148 33002543 10/2013
Parameter description Mode_MH
Data structure description:
Parameter description Para_ALIM
Data structure description:
Runtime error
An error message is returned if
an invalid floating point number lies at input YMAN or X,
max_a or max_v is 0.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode
Element Data type Description
max_v REAL Maximum velocity (maximum x)
Unit: 1/[s]
max_a REAL Maximum acceleration (maximum x)
Unit:
ALIM
33002543 10/2013 149
Detailed description
Parametering
The parameters for the function block can be set by determining the maximum velocity max_v and
the maximum acceleration max_a. The maximum velocity specifies how much output Y can
change within one second. The maximum acceleration specifies the maximum amount that output
Y can change.
The value of Y follows the value of X, but is limited by the maximum permitted velocity and
acceleration.
Operating mode
There are three operating mode selectable through the man and halt parameter inputs:
Operating mode man halt Meaning
Automatic 0 0 A new value for Y will be constantly calculated
and output.
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y.
Halt 0 1 The output Y will be held at the last calculated
value. The output will no longer be changed, but
can be overwritten by the user.
ALIM
150 33002543 10/2013
Example
In the diagram the dynamic behavior of the function block is displayed as well as the reaction during
HALT operating mode:
A jump on input X causes the function block to accelerate the increase of output Y. Output Y is
accelerated using the value set for parameter max_a. Should the velocity reach the max_v value,
acceleration stops, but output Y continues to follow input X with the maximum velocity max_v (see
the straight section in the middle of the figure).
If the value of output Y is close enough to input signal value, the output is reversed to brake at a
negative speed increase of -max_a, so that the output does not come to an abrupt stop, but slowly
approximates the terminal point.
33002543 10/2013 151
Unity Pro
COMP_PID
33002543 10/2013
COMP_PID: Complex PID controller
Chapter 17
COMP_PID: Complex PID controller
Introduction
This chapter describes the COMP_PID block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 152
Complex PID controller structure diagram 158
Setting parameters for the COMP_PID controller 159
Anti-windup for COMP_PID 161
Controller type selection for COMP_PID 162
Bumpless operating mode switchover 163
Selecting the operating mode of the COMP_PID 166
Detailed formulas 168
COMP_PID
152 33002543 10/2013
Description
Function description
The function block represents a complex PID controller that in its design specifically includes
cascade treatment. The control structure is displayed in theStructure diagram, page 158.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
real PID controller with independent gain, ti, td setting
Manual, halt, automatic, cascade, reset, manual value operating modes tracking
Velocity limit for manual operation
Adjustable manual manipulated value tracking
Velocity limit for reference variable
bumpless changeover between manual and automatic
Manipulated variable limiting
bumpless, individually connectable P, I and D components
bumpless gain modification
Choice of anti-windup reset and anti-windup halt
Displacement of anti-windup limits compared to control limits
Anti-windup measure with an active I component only
definable delay of the D component
D component connectable to controlled variable PV or system deviation ERR
Dead zone with gain reduction
external operating point (in P, PD and D operation)
Choice of bump/bumpless manual/automatic switchover
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
COMP_PID
33002543 10/2013 153
Transfer function
The transfer function is:
Explanation of the variables:
Representation in FBD
Representation:
Variable Description
YD D component (only when en_d = 1)
YI I component (only when en_i= 1)
YP P component (only when en_p= 1)
COMP_PID
154 33002543 10/2013
Representation in LD
Representation:
COMP_PID
33002543 10/2013 155
Representation in IL
Representation:
CAL COMP_PID_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable,
SP_CAS:=CascadeReferenceVariable, MODE:=OperatingModes,
PARA:=Parameters, YMAN:=ManuallyManipulatedValue,
YRESET:=Y_ResetValue, FEED_FWD:=DisturbanceInput,
OFF:=OffsetFor_P_PD_Operation, Y:=ManipulatedVariable,
SP_CAS_N:=CascadeReferenceVariable,
YMAN_N:=ManuallyManipulatedValue,
OFF_N:=OffsetFor_P_PD_Operation, ERR=>SystemDeviation,
STATUS=>OutputStatus)
Representation in ST
Representation:
COMP_PID_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable,
SP_CAS:=CascadeReferenceVariable, MODE:=OperatingModes,
PARA:=Parameters, YMAN:=ManuallyManipulatedValue,
YRESET:=Y_ResetValue, FEED_FWD:=DisturbanceInput,
OFF:=OffsetFor_P_PD_Operation, Y:=ManipulatedVariable,
OFF_N:=OffsetFor_P_PD_Operation, ERR=>SystemDeviation,
STATUS=>OutputStatus) ;
Parameter description COMP_PID
Description of the input parameters:
Parameter Data type Description
SP REAL Reference variable
PV REAL Controlled variable
SP_CAS REAL Cascade reference variable
MODE Mode_COMP_PID Operating mode
PARA Para_COMP_PID Parameter
YMAN REAL Manually manipulated value
YRESET REAL Manipulated variable reset value
FEED_FWD REAL Disturbance input
OFF REAL Offset for P/PD operation
COMP_PID
156 33002543 10/2013
Description of input / output parameters:
Description of the output parameters:
Parameter description Mode_COMP_PID
Data structure description
Parameters Data type Meaning
Y REAL Manipulated variable
SP_CAS_N REAL Cascade reference variable
YMAN_N REAL Manually manipulated value
OFF_N REAL Offset for P/PD operation
Parameters Data type Description
ERR REAL System deviation
STATUS Stat_COMP_PID Output status
Element Data type Description
r BOOL "1": Reset mode
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
cascade BOOL "1": Cascade mode
en_p BOOL "1": P component on
en_i BOOL "1": I component on
en_d BOOL "1": D component
d_on_pv BOOL "1": D component on controlled variable
"0": D component on system deviation
halt_aw BOOL "1": Anti-windup Halt
"0": Anti-windup reset
bump BOOL "0": Bumpless operating mode switchover
ymanc BOOL "1": YMAN tracking
COMP_PID
33002543 10/2013 157
Parameter description Para_COMP_PID
Data structure description
Parameter description Stat_COMP_PID
Data structure description
Runtime error
An error message is returned if
an unauthorized floating point number is placed at the input PV
gain_red > 1 or gain_red < is 0
db < is 0
ymax < is ymin
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
gain REAL Proportional action coefficient (gain)
ti TIME Integral time
td TIME Derivative time
td_lag TIME D component delay time
db REAL Dead zone
gain_red REAL Gain reduction in dead zone (db)
rate_sp REAL Setpoint velocity (SP) [1/s]
rate_man REAL Manually manipulated velocity value (YMAN) [1/s]
ymax REAL Upper threshold for Y
ymin REAL Lower threshold for Y
delt_aw REAL Limit expansion for anti-windup
Element Data type Description
st_r BOOL "1": COMP_PID is in reset mode
st_man BOOL "1": COMP_PID is in manual mode
st_halt BOOL "1": COMP_PID is in halt mode
st_auto BOOL "1": COMP_PID is in automatic mode
st_cascade BOOL "1": COMP_PID is in cascade mode
st_max BOOL "1": Y Para_COMP_PID.ymax
st_min BOOL "1": Y Para_COMP_PID.ymin
COMP_PID
158 33002543 10/2013
Complex PID controller structure diagram
Structure diagram
The following is the structure diagram of the COMP_PID controller:
COMP_PID
33002543 10/2013 159
Setting parameters for the COMP_PID controller
Setting Parameters
The COMP_PID control structure is displayed in the Structure diagram, page 158.
Setting function block parameters is initially performed by the pure PID parameters, i.e. the
proportional action coefficient gain, the reset time ti and the derivative time td.
The D component is delayed by the time td_lag. The td/td_lag ratio is termed the differential
gain, and is generally selected between 3 and 10. The D component can either be based upon the
system deviation ERR (d_on_pv = "0") or the controlled variable PV (d_on_pv = "1"). Should the
D component be determined by the controlled variable PV, then the D component will not be able
to cause jumps when reference variable fluctuations (changes in input SP) take place. Generally,
the D component only affects disturbances and process variances.
NOTE: The EFB has 3 I/O parameters (SP_CAS, OFF, YMAN) that are updated by the function
itself in cascade mode. To use the block in cascade mode, you have to establish the connection
between these inputs and the appropriate outputs (SP_CAS_N, OFF_N, YMAN_N) through
variables.
Control direction reversal
A reversed behavior of the controller can be achieved by reversing the sign of gain. A positive
value on gain causes the manipulated variable to rise when there is a positive disturbance. A
negative value on gain causes the manipulated variable to drop when there is a positive
disturbance.
Forming the system deviation
In cascade mode, the ERR system deviation is formed by SP_CAS and PV:
sp_intern = SP_CAS
ERR = sp_intern - PV
The system deviation in automatic mode is formed by sp_intern and PV, whereby sp_intern
is set to the value of parameter SP via a velocity limiter. The internal reference variable sp_intern
is driven in ramp-type fashion toward the SP parameter value using the velocity specified in
parameter rate_sp (unit 1/s).
The amount will be evaluated for parameter rate_sp. The function of the velocity limiter for SP is
disabled if rate_sp = 0. SP is transferred directly to sp_intern.
System deviation is determined by the condition of parameter cascade when in reset, manual and
halt modes.
If cascade = 1, sp_intern is set to the PV parameter value and ERR goes to 0.
If cascade = 0 and the setting is bumpless operation (bump = 0), sp_intern is set to the SP
parameter value. Otherwise (bump = 1), sp_intern is also set to the PV parameter value.
COMP_PID
160 33002543 10/2013
Gain reduction for small system deviation values
Parameter db determines the size of a dead zone in which the proportional action coefficient gain
is not effective, but rather a proportional action coefficient reduced by the parameter gain_red.
The parameter db has an effect on the system deviation ERR = SP - PV in the form shown in
the illustration Representation of the dead zone, page 160. Unnecessary actuator loads caused by
small controlled variable disturbances or measurement noise can be reduced by the dead zone.
Enter the db parameter as positive.
Enter values between 0 and 1 for gain_red.
Tracking of manual value YMAN
When manual tracking mode is enabled (ymanc = 1), the input YMAN is tracked to the manipulated
variable value Y when in automatic and cascade modes, this means: YMAN = Y. If manual tracking
mode is disabled (ymanc = 0), the YMAN value remains unchanged.
Representation of the dead zone
Dead zone:
1 Gradient 1
2 Gradient gain_red
Manipulated variable limiting
The limits ymax and ymin retain the manipulated variable within the prescribed range. Therefore
ymin Y ymax.
The elements st_qmax and st_min signal that the manipulated variable has reached a limit, and
thus been capped:
st_max = 1 if Y ymax
st_min = 1 if Y ymin.
For limiting the manipulated variable, the upper limit ymax should be greater than the lower limit
ymin.
COMP_PID
33002543 10/2013 161
Anti-windup for COMP_PID
Definition
The anti-windup measure ensures that the Integral component does not grow too much causing
the controller to lock if it has been limited at a control limit too long. Anti-windup measures are only
performed for an active I component of the controller.
Limits for the anti-windup measure are by default the manipulated variables of the controller
(delt_aw = 0). The parameter delt_aw can be used to either increase (delt_aw > 0) or
decrease (delt_aw < 0) the limits with regard to the control limits (ymax, ymin).
Therefore, the limits used for the anti-windup measure are:
AWMAX = ymax + delt_aw
AWMIN = ymin - delt_aw.
Through displacement of the anti windup limits in relation to the control limits (in particular with very
noisy signals), the manipulated variable Y can be stopped from repeatedly jumping away from the
control limit (D component effect to disturbances) and subsequently returning to the limiting
position (I component effect with system deviation ERR 0). If the control limits are to be
simultaneously effective for the anti-windup measure, select the parameter delt_aw = 0.
By utilizing negative delt_aw values, anti-windup limits can be kept smaller than control limits
(useful for anti-windup halt).
Anti-windup reset (halt_aw = 0)
The anti-windup measure disregards the D component, to avoid the capping of the D component
peaks through the anti-windup measure. The anti-windup-reset measure corrects the I component
such that: AWMIN YP + FEED_FWD + YI AWMAX.
Anti-windup halt (halt_aw = 1)
The anti-windup measure only considers the I component. When anti-windup halt and I component
are enabled, the anti-windup halt measure corrects the I component such that: AWMIN YI
AWMAX.
The parameters rate_sp and rate_man represent velocity limiters for the manual values SP and
YMAN (see also function block VLIM). A 0 value disables the functionality of the corresponding
velocity limiter (rate_sp = 0 or rate_man = 0, respectively). The SP and YMAN values are then
utilized without delay.
COMP_PID
162 33002543 10/2013
Controller type selection for COMP_PID
Controller types
There are four different control types, which are selected via the parameters en_p, en_i and
en_d.
The I component can also be disabled with ti = 0.
The D contribution can also be disabled with td = 0.
OFF parameter influence
If the I component is enabled (en_i = 1), the manipulated variable Y is determined from the
summation of the components YP, YI, YD, and FEED_FWD. Offset is not included in the calculation
when the I component is enabled.
However, if the I component is disabled (en_i = 0), the manipulated variable is formed from the
summation of the components YP, YD, FEED_FWD, and the offset OFF.
NOTE: The OFF parameter is only designed for P, D, or PD controllers.
Controller type en_p en_i en_d
P controller 1 0 0
PI controller 1 1 0
PD controller 1 0 1
PID controller 1 1 1
I controller 0 1 0
COMP_PID
33002543 10/2013 163
Bumpless operating mode switchover
Method of switching over
Bumpless on/off switching of the various components (P, I, D) is implemented.
Bumpless switching with connected I component
If the P component is connected/disconnected, the internal I component will be corrected by the P
component. This way, the connection/disconnection of the P component is bumpless even if the
system deviation is not 0.
If the D component is disconnected, the internal I component takes over the remaining D
component. If the D component is connected, it is set to 0.
Bumpless switching for disconnected D component
Bumpless switching for a disconnected D component is only implemented if parameter bump = 0.
In this case, the OFF parameter is used to achieve the bumpless switchover.
If the P component is connected/disconnected, the value in the OFF parameter is corrected by the
P component. This way, the connection/disconnection of the P component is bumpless even if the
system deviation is not 0.
If the D component is disconnected, the remaining D component is added to the OFF parameter
value. If the D component is connected, it is set to 0 (OFF remains unchanged).
Bumpless I component switching
Bumpless I component disconnection is only performed if parameter bump = 0. In this case, the
OFF parameter as well as the internal I component (YI) are used to make the bumpless switchover
possible.
Bumpless switchover from a PI(D) to a P(D) controller
The principle consideration for bumpless switching from a PI(D) to P(D) controller is based on the
assumption that the PI(D) controller has reached a static condition. In this case, the process is in
an idle state. The I component has a specific value in this case. To allow a bumpless switch to P(D)
operation now, the I contribution of the PI(D) controller would have to serve as the PD controller
operating point (offset), thus allowing the switch to take place without equalization processes (new
transient condition) taking place. Based on the above consideration, bumpless I component
disconnection is implemented in such a way that the OFF parameter retrieves its value.
Value of the manipulated variable Y depending on en_i:
If... Then...
en_i = 1 Y = YP + YI + YD + FEED_FWD
en_i = 0 Y = YP + OFF + YD + FEED_FWD
COMP_PID
164 33002543 10/2013
Starting up the I component
I component enabling is based on a similar consideration. The internal I component is set to the
OFF parameter value. This allows the I component to be connected without giving rise to
equalization processes.
NOTE: If the OFF parameter is calculated by a previous function block (EFB or DFB output, e.g.
MOVE), the corrections for bumpless switching become ineffective (at the latest, when this function
block is edited).
Example of a bumpless switchover of the D component
In order to achieve the bumpless P(D) controller switchover as well as OFF parameter modification
by the user program, the following example can serve as a starting point.
In this example, the OFF parameter is set to the new_off variable value via a velocity limiter VLIM
in ramp form using the velocity provided in pvlim.rate.
COMP_PID
33002543 10/2013 165
Note on the example
In this example, it is important to note the use of the off variable at the YMAN input of the VLIM as
well as at the Y output of the VLIM, and the link of the output from VLIM to the OFF input of
COMP_PID. The link between the Y output from VLIM and the OFF input from COMP_PID causes
the VLIM function block to be processed prior to the COMP_PID function block (this is a prerequisite
for proper operation). As long as the manual mode (mvlim.man = 1) is enabled in the VLIM, the
manual value of the VLIM function block is transferred to the COMP_PID OFF parameter. The
COMP_PID function block is now able to modify the content of the variable for bumpless handling.
In the next cycle, this modified value is now available at the YMAN input of the VLIM function block.
At an appropriate time, the manual mode in the VLIM function block can be disabled, and the
function block drives up the value of the off variable in ramp form from its current value to that of
new_off. In the example above, manual mode enabling is controlled in the function block OR. As
long as COMP_PID has connected the I component (mkpid.en_i = 1), the VLIM function block
remains in manual mode.
NOTE: If mkpid.en_i = 1, the OFF parameter from COMP_PID will not be included in the calculation
of the COMP_PID output.
In the above example, the OR function block requires a second condition in order to change off to
new_off: The variable change_off must be 1.
Bumpless alteration of gain
Modification of the proportional action coefficient gain is bumpless. As in the
connection/disconnection of operating modes, this requires an internal correction to be carried out.
If the I component is connected (en_i = 1 and ti > 0), the internal I component will be corrected
by the expected P component jump which is caused by the gain modification.
If the I component is disconnected, the value in the OFF parameter will be corrected by the
expected P component jump, provided the parameter bump = 0. If bump = 1, OFF is not modified
and a P(D) controller gain variation leads to equalization processes.
COMP_PID
166 33002543 10/2013
Selecting the operating mode of the COMP_PID
Operating mode
There are five operating modes selectable through r, man, halt, and cascade.
Automatic and cascade modes
In automatic mode, the manipulated variable Y is determined through the discrete PID closed-loop
control algorithm subject to controlled variable X and reference variable SP.
In cascade mode, the manipulated variable Y is determined through the discrete PID closed-loop
control algorithm subject to controlled variable X and reference variable SP_CAS.
The distinction between these two operating modes, automatic and cascade, is only external in
their different use of the reference variable SP. SP_CAS refers to cascade, SP to all other operating
modes (with velocity limit). The SP_CAS variable is an input in cascade mode only, in all other
modes it is an output. In SP_CAS, the X variable is returned to the master controller when in the
modes reset, manual, halt or automatic as well as during startup, permitting bumpless switching
from, for instance, fixed setpoint control to cascade control.
In both operating modes, the manipulated variable Y is limited by ymax and ymin. The control
limits for the anti-windup measure can be extended using the parameter delt_aw.
Manual mode
In manual mode, the manual manipulated value YMAN is transferred to the manipulated variable Y
with a velocity limiter. The manipulated variable Y is set to the YMAN parameter value in ramp form
using the velocity (unit 1/s) rate set in the parameter rate_man.
The amount will be evaluated for parameter rate_man. The function of the velocity limiter for YMAN
is disabled if rate_man = 0. YMAN is transferred directly to the manipulated variable. The
manipulated variable is limited by ymax and ymin.
Internal variables will be manipulated in such a manner that the controller changeover from manual
to automatic (with I component enabled) can be bumpless. The Anti-windup measure is designed
just like in automatic mode.
In this operating mode the D component is automatically set to 0.
Operating
mode
r man halt cascade
Reset 1 1 or 0 1 or 0 1 or 0
Manual mode 0 1 1 or 0 1 or 0
Halt 0 0 1 1 or 0
Cascade 0 0 0 1
Automatic 0 0 0 0
COMP_PID
33002543 10/2013 167
Reset mode
In Reset mode, the reset value YRESET is transferred directly to the manipulated variable Y. The
manipulated variable is limited by ymax and ymin. Internal variables will be manipulated in such a
manner that the controller changeover from manual to automatic (with I component enabled) can
be bumpless. The Anti-windup measure is performed just like in automatic mode.
Halt mode
In halt mode, the control output remains as is, i.e. the function block does not change the
manipulated variable Y. Internal variables will be manipulated in such a manner that the controller
can be driven smoothly from its current position. Manipulated variable limits and Anti-windup
measures are as those in automatic mode. Halt mode is also useful in allowing an external operator
device to adjust control output Y, whereby the controllers internal components are given the
chance to continuously react to the external influence.
In this operating mode the D component is automatically set to 0.
Non-bumpless operation (bump = 0)
The definition of non-bumpless operation is when the controller exhibits a jump during operating
mode switchover (e.g. manual to automatic) due to the P component in the manipulated variable
Y. Depending on the controllers area of utilization, it might be useful for the controller to make a
jump-type correction of the manipulated variable when switching over, for instance from manual to
automatic, provided the system deviation is not equal to 0.
The jump height corresponds to the P component of the controller and is:
Bumpless operation (bump = 1)
The definition of bumpless operation is, the controller does not produce a discontinuity in the
manipulated variable Y during an operating mode switchover. That is, it should continue at exactly
the same location where it was positioned last. In this operating mode, the internal I component is
corrected by the P contribution. If no I component is enabled, bumpless operation is achieved by
tracing the operating point OFF such that the controller can continue during operating mode change
without a bump in spite of system deviation being not equal to 0.
COMP_PID
168 33002543 10/2013
Detailed formulas
Explanation of formula variables
Meaning of the variables in the following formulas:
Manipulated variable
The manipulated variable consists of various terms which are dependent on the operating mode:
After summation of the components manipulated variable limiting takes place, so that:
Overview of the calculation of the control components
The following is an overview on the different calculations of the control components in relation to
the elements en_p, en_i and en_d:
P component YP for manual, halt, automatic and cascade modes
I component YI for automatic mode
I component YI for manual and halt modes
D component YD for automatic and cascade mode
D component YD for manual and halt modes
Variable Meaning
Time differential between the present cycle and the previous cycle
The current internally formed System deviation
System deviation value from the current sampling step
System deviation value from the previous sampling step
FEED_FWD Disturbance (only in P, D or PD controllers)
OFF Offset
Value of controlled variable from the current sampling step
Value of controlled variable from the previous sampling step
Y current output (halt mode) or YMAN (manual mode)
YD D component (only when en_d = 1)
YI I component (only when en_i= 1)
YP P component (only when en_p= 1)
COMP_PID
33002543 10/2013 169
P component YP for all operating mode
YP for manual, halt, automatic and cascade modes is determined as follows:
For en_p = 1 the following applies:
For en_p = 0 the following applies:
I component YI for automatic mode
YI for automatic mode is determined as follows:
For en_i = 1 the following applies:
For en_i = 0 the following applies:
The I component is formed according to the trapezoid rule.
I component YI for manual and halt modes
YI for manual, halt and automatic modes is determined as follows:
For en_i = 1 the following applies:
For en_i = 0 the following applies:
COMP_PID
170 33002543 10/2013
D component YD for automatic and cascade mode
YD for automatic mode and cascade is determined as follows:
For en_d = 1 and d_on_pv = 0 the following applies:
For en_d = 1 and d_on_pv = 1 the following applies:
For en_d = 0 the following applies:
D component YD for manual and halt modes
YD for manual, halt and automatic modes is determined as follows:
33002543 10/2013 171
Unity Pro
DEADTIME
33002543 10/2013
DEADTIME: Deadtime device
Chapter 18
DEADTIME: Deadtime device
Introduction
This chapter describes the DEADTIME block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 172
Operating mode 175
Example for behavior of the function block 177
DEADTIME
172 33002543 10/2013
Description
Function description
With this function block an input signal is delayed by a time, the so-called deadtime.
The function block delays the signal X by the deadtime T_DELAY before it appears again at Y.
The function block utilizes a 128 element delay buffer to hold a sequence of X values, i.e. during
the T_DELAY time 128 discrete X values are detained. The buffer is used in such a way that it
corresponds with the operating mode.
Whether the system is started cold or warm, the value of Y remains unchanged. The internal values
are set to the value of X.
After a change of deadtime T_DELAY or a cold or warm system start, the output READY goes to
"0". This means: that the buffer is empty and not ready.
The function block has the following operating mode:
Manual mode
Halt
Automatic.
EN and ENO can be configured as additional parameters.
NOTE: The delay time continues to run even if the block is disabled via the EN parameter, because
the block calculates its time differences according to the system clock.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
Formula
The transfer function is:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
DEADTIME
33002543 10/2013 173
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL DEADTIME_Instance (X:=InputValue, MODE:=OperatingModes,
T_DELAY:=DeadTime, YMAN:=ManualManipulatedValue,
Y=>Output, READY=>InternalBufferFlag)
Representation in ST
Representation:
DEADTIME_Instance (X:=InputValue, MODE:=OperatingModes,
T_DELAY:=DeadTime, YMAN:=ManualManipulatedValue,
Y=>Output, READY=>InternalBufferFlag) ;
DEADTIME
174 33002543 10/2013
DEADTIME parameter description
Description of input parameters:
Description of output parameters:
Parameter description Mode_MH
Data structure description
Runtime error
An error message is returned when an invalid floating point number lies at input YMAN or X.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
X REAL Input value
MODE Mode_MH Operating mode
T_DELAY TIME Deadtime
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output
READY BOOL "1" = internal buffer is full
"0" = internal buffer is not full (e.g. after warm/cold
start or modification of deadtime)
Element Data type Description
man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode
DEADTIME
33002543 10/2013 175
Operating mode
Selecting the operating modes
There are three operating mode selectable through the man and halt parameter inputs:
Automatic operating mode
In the automatic mode, the function block operates according to the following rules:
Example of automatic mode
In the example the following values are accepted:
Cycle time = 100 ms
T_DELAY = 10 s
tin = T_DELAY / 128 = 78 ms
As the reading time tin is shorter than the cycle time, each X value is transferred to the buffer. On
the fourth execution of the function block (after 400 ms) the X value is saved twice rather than once
(as 3 x 78 = 312 and 4 x 78 = 390).
Manual mode
In manual mode the manual value YMAN is consistently transferred to the control output Y. The
internal buffer is charged with the manual value YMAN. The buffer is marked as charged (READY
=1).
Operating mode man halt
Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1
If... Then...
Scan time >
the current X value is transferred to the buffer, and the oldest
X value in the buffer is placed on the output Y. If the scan time
is more than T_DELAY / 128, resolution is less than 128
causing a systematic error, i.e. some X values are double-
stored (see the following Example).
Scan time <
not all X values can be stored in the buffer. In this case the X
value is not saved in some cycles. After completion of
T_DELAY, output Y may correspondingly remain unchanged
in two (or more) consecutive cycles.
DEADTIME
176 33002543 10/2013
Halt mode
The output Y is held at the last calculated value in Halt mode. The output will no longer be changed,
but can be overwritten by the user. The internal buffer still continues to operate as in automatic
mode.
DEADTIME
33002543 10/2013 177
Example for behavior of the function block
Example
The following diagram shows an example for behavior of the function block. Input X follows a ramp
function from one value to a new value. Delayed by the deadtime T_DELAY, X values appear at Y.
Function block diagram DEADTIME
DEADTIME
178 33002543 10/2013
33002543 10/2013 179
Unity Pro
DERIV
33002543 10/2013
DERIV: Differentiator with smoothing
Chapter 19
DERIV: Differentiator with smoothing
Introduction
This chapter describes the DERIV block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 180
Formulas 183
Detailed description 184
Example for the function block 185
DERIV
180 33002543 10/2013
Description
Function description
The function block is a differential element with a delayed output Y respecting the delay time
constant lag.
The function block contains the following operating mode: Manual, halt and automatic mode.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
DERIV
33002543 10/2013 181
Representation in LD
Representation:
Representation in IL
Representation:
CAL DERIV_Instance (X:=InputVariable, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulatedValue,
Y:=DifferentiatorOutput)
Representation in ST
Representation:
DERIV_Instance (X:=InputVariable, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulatedValue,
Y:=DifferentiatorOutput) ;
DERIV parameter description
Description of input parameters:
Parameter Data type Description
X REAL Input variable
MODE Mode_MH Operating mode
PARA Para_DERIV Parameter
YMAN REAL Manually manipulated value
DERIV
182 33002543 10/2013
Description of input / output parameters:
Parameter description Mode_MH
Data structure description
Parameter description Para_DERIV
Data structure description
Runtime error
An error message is returned when an invalid floating point number lies at input YMAN or X.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
Y REAL Output derivative unit with smoothing
Element Data type Description
man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode
Element Data type Description
gain REAL Gain of the differentiation
lag TIME Delayed time constants
DERIV
33002543 10/2013 183
Formulas
Transfer function
The transfer function for Y is:
Calculation formula for Y
The calculation formula for Y is:
Special case: lag =0
This amounts to pure differentiation without a 1st order time limiter.
In this situation the transfer function is:
The formula of calculation is:
Meaning of the sizes
The meaning of the formula sizes is as follows:
Variable Meaning
the input X value for the current cycle
the input X value from the previous cycle
the output Y value from the previous cycle
is the time differential between the current cycle and the previous cycle
DERIV
184 33002543 10/2013
Detailed description
Parametering
The parameter assignments of the function block are effected by the determination of gain, the
differentiator and the time constant lag, by which the output Y is delayed.
For very short sampling times and an input X unit step (input X jumps from 0 to 1.0), the output Y
jumps to the value gain (in theory - in reality somewhat smaller, due to the sampling time not being
infinitely small), and then returns to 0 with the delay time constant lag.
Operating mode
There are three operating mode selectable through the man and halt parameter inputs:
Operating mode man halt Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The input YMAN will be transferred directly to the
output Y.
Halt 0 1 The output Y will be held at the last calculated
value. The output will no longer be changed, but
can be overwritten by the user.
DERIV
33002543 10/2013 185
Example for the function block
Example DERIV
The following example shows the step response of the DERIV function block.
Jump response with gain = 1 and lag = 10 s
DERIV
186 33002543 10/2013
33002543 10/2013 187
Unity Pro
FGEN
33002543 10/2013
FGEN: Function generator
Chapter 20
FGEN: Function generator
Introduction
This chapter describes the FGEN block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 188
Parametering 191
Function selection 192
Function definition 193
Diagrams of the individual functions 196
Special cases 200
Timing diagrams 201
FGEN
188 33002543 10/2013
Description
Function description
The function block FGEN represents a function generator. It generates a signal form at the Y output
which is defined in the data structure Para_FGEN. The function block can be cascaded, i.e. if
several of these EFBs are used, various signal forms can be created and laid over one another.
The following 8 different signal forms can be generated:
Jump function
Ramp function
Delta function
Saw-tooth function
Square wave function
Trapezoid function
Sine function
Random Number
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
FGEN
33002543 10/2013 189
Representation in LD
Representation:
Representation in IL
Representation:
CAL FGEN_Instance (R:=ResetFlag, START:=StartFlag,
PARA:=Parameter, YOFF:=Output_Y_Offset,
Y=>FunctionGeneratorOutput,
ACTIVE=>FunctionGeneratorActiv, N=>NumberOfPeriods)
Representation in ST
Representation:
FGEN_Instance (R:=ResetFlag, START:=StartFlag,
PARA:=Parameter, YOFF:=Output_Y_Offset,
Y=>FunctionGeneratorOutput,
ACTIVE=>FunctionGeneratorActiv, N=>NumberOfPeriods) ;
FGEN
190 33002543 10/2013
FGEN parameter description
Description of input parameters:
Description of output parameters:
Parameter description Para_FGEN
Data structure description
Runtime error
For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
R BOOL 1: Reset
START BOOL 1: Start function generator
PARA Para_FGEN Parameter
YOFF REAL Offset for output Y
Parameter Data type Description
Y REAL Function generator output
ACTIVE BOOL ACTIVE = 1: Function generator is active
N INT Number of intervals since start
Element Data type Description
func_no INT Generator function choice (1-8)
amplitude REAL Function amplitude
halfperiod TIME Half cycle duration
t_off TIME Idle time constant
t_rise TIME Rise time constant
t_acc TIME Smoothing time
unipolar BOOL "1 "= Signal unipolar
"0 "= Signal bipolar
FGEN
33002543 10/2013 191
Parametering
Reset
Parameter R stands for RESET. If this parameter is set (R = 1), all running functions will be
immediately terminated and output Y goes to the value of parameter YOFF (offset). Simultaneously
the cycle counter N is also reset to 0 and ACTIVE returns to "0".
Starting the function generator.
The parameter START (START = 1) starts the function defined with the data structure. Output N is
incremented with the beginning of each new cycle. If the parameter START returns to "0", the active
cycle of the selected function runs to completion. As long as the function is running, output ACTIVE
is "1". If the period is ended, output ACTIVE is also reset to "0".
Offset
Waveforms produced by the function generator have an amplitude with the value of parameter
amplitude, i.e. values range from -amplitude to amplitude for bipolar operation (unipolar
= "0") resp. from 0 to amplitude in unipolar operation (unipolar = "1"). Waveform values can
be shifted away from the zero reference point through the parameter YOFF.
NOTE: Should the output of another function generator be applied to parameter YOFF, the
waveforms produced by both function generators are overlaid.
Rise time t_rise
Rise time t_rise is used only by the functions "ramp" and "trapezoid". In the "saw-tooth" function
rise time is determined by halfperiod - t_off. Rise time is 0.5 * (halfperiod - t_off)
for the "delta" function.
FGEN
192 33002543 10/2013
Function selection
Selection
There are a total of 8 functions which can be produced by the function generator. Function
selection is made through func_no. At a function change the last selected running function still
proceeds to completion.
The following function numbers are allowed:
func_no Function
1 Jump
2 Ramp
3 Saw-tooth
4 Delta
5 Square
6 Trapezoid
7 Sine
8 Random Number
FGEN
33002543 10/2013 193
Function definition
Definition
The function is defined completely in the data structure Para_FGEN. First of all the waveform must
be determined (refer to Function selection, page 192).
Trapezoid (Delta, Saw-tooth, Square) unipolar/bipolar is selected as the basic type for the
definition.
Function amplitude is determined in the parameter amplitude. It should be noted that this
declaration applies to unipolar operation. Amplitude in bipolar operation is doubled and consists of
amplitude and -amplitude.
The parameter halfperiod defines the half cycle duration.
Parameter t_off defines an idle time. A half cycle of the function is then output within the time
halfperiod - t_off.
For the trapezoid function definition the rise time t_rise is also required. This is the time in which
the signal should accelerate from 0 to amplitude. This time is also taken for the descent from
amplitude back to 0.
FGEN
194 33002543 10/2013
"Smoothing" a function
If a function in ramp form is to rise or decline, the transitions are first of all always made in a sharp
crease. The gradient is not constant in this case. "Smoothing" is used to achieve a soft rise and
descent, i.e. the ramp turns into an S-curve.
"Smoothing" a function
This is then divided into three sections. Section I "accelerates" directly from 0. Section II is
traversed with the velocity attained at the end of section I. In section III, the acceleration from
section I is used to brake, and thus approach the terminal point softly. The size of the section is
user-definable. They are defined by specifying t_acc and t_rise.
The acceleration involved is calculated by the following formulas:
with
and
FGEN
33002543 10/2013 195
It then follows that:
NOTE: Smoothing is used only by the functions "Ramp", "Saw-Tooth", "Delta" and "trapezoid".
"Jump", "Square" and "Sine" are not "smoothable" functions.
Individual Parameter Usage
Parameter use within the various functions.
Function diagrams can be found in the section Diagrams of the individual functions, page 196
Unipolar operation
The unipolar parameter defines whether the selected function should be output as a unipolar or
bipolar function. Particular attention should be paid to the fact that in unipolar operation a cycle is
still characterized by 2 "unipolar" half waves.
Altering function parameters
During a currently executing cycle, all function parameters may be altered. However, any
alterations made will not take effect until the cycle has completed. Should, for example, the idle
time t_off be altered during the running cycle, it does not apply until the start of the next cycle.
Altering a function
If the parameter func_no is changed during a currently executing cycle, it will also not take effect
until the cycle has completed with the previously selected function. The new function is then
started. This resets the cycle counter N, which indicates the period number, to 0.
Function amplitude halfperiod t_off t_rise t_acc unipolar
Jump X
Ramp X X X
Saw-tooth X X X halfperiod - t_acc X X
Delta X X X ((halfperiod - t_acc)/2 X X
Square X X X X
Trapezoid X X X X X X
Sine X X X X
Random
Number
X X
FGEN
196 33002543 10/2013
Diagrams of the individual functions
Jump function
Representation of the Jump function
Ramp function
Representation of the Ramp function
FGEN
33002543 10/2013 197
Saw-tooth function
Representation of the Saw-tooth function
Delta function
Representation of the Delta function
FGEN
198 33002543 10/2013
Square wave function
Representation of the Square wave function
Trapezoid function
Representation of the Trapezoid function
FGEN
33002543 10/2013 199
Sine function
Representation of the Sine function
FGEN
200 33002543 10/2013
Special cases
Jump function
On the "Jump" function the output goes to
the value Y = YOFF if START = 0
and
the value Y = YOFF + amplitude if START = 1
set
The time specifications (t_off, t_rise, t_acc) do not play a role in this function.
Output N is incremented for every new 0 1 transition of input START.
This function only runs in unipolar operation. For this reason, the parameter unipolar must be
set to 1 non-explicitly.
Ramp function
In the "Ramp" function output Y ramps upward from value YOFF to YOFF + amplitude. While
START is unchanged at 1, output Y remains at the value YOFF + amplitude. Output Y jumps back
to value YOFF if START be taken back to 0.
Run up is determined by the times t_rise and t_acc. The time needed for run up from Y = YOFF
to Y = YOFF + amplitude is specified by t_rise. "Smoothing" can be influenced by t_acc.
Output N is incremented for every new 0 1 transition of input START.
This function only runs in unipolar operation. For this reason, the parameter unipolar must be
set to 1 non-explicitly.
Random Number
In the "Random number" function output Y is set to a number resulting "by chance" between
YOFF Y YOFF + amplitude, in unipolar operation
and
YOFF - amplitude Y YOFF + amplitude , in bipolar operation
.
The time specifications (t_off, t_rise, t_acc) do not play a role in this function.
Output N is incremented for every new 0 1 transition of input START.
FGEN
33002543 10/2013 201
Timing diagrams
Bipolar operation
The following parameter specifications represent the various functions in bipolar operation:
Bipolar operation
Unipolar operation
The following parameter specifications represent the various functions in unipolar operation:
Parameter Specification
amplitude 1
halfperiod 10
t_off 2
t_rise 2
t_acc 0
unipolar 0
Parameter Specification
amplitude 1
halfperiod 10
t_off 2
t_rise 2
t_acc 0
unipolar 1
FGEN
202 33002543 10/2013
Unipolar operation
Trapezoid function
The following parameter specification represents the trapezoid function:
Trapezoid function
Parameter Specification
amplitude 1
halfperiod 10
t_off 1
t_rise 4
t_acc 1.5
33002543 10/2013 203
Unity Pro
INTEG
33002543 10/2013
INTEG: Integrator with limit
Chapter 21
INTEG: Integrator with limit
Introduction
This chapter describes the INTEG block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 204
Detailed description 208
INTEG
204 33002543 10/2013
Description
Function description
The function block replicates a limited integrator.
The function block has the following properties:
Operating modes Manual, Halt, Automatic
Manipulated variable limiting in automatic mode
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Formula
The transfer function is:
The formula of calculation is:
Meaning of the sizes
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Variable Description
Value of input X from the previous cycle
Value of the output Y from the previous cycle
dt is the time differential between the current cycle and the previous cycle
INTEG
33002543 10/2013 205
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL INTEG_Instance (X:=InputVariable, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulatedValue,
Y:=Output, STATUS=>Output_Y_Status)
Representation in ST
Representation:
INTEG_Instance (X:=InputVariable, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulatedValue,
Y:=Output, STATUS=>Output_Y_Status) ;
INTEG
206 33002543 10/2013
INTEG parameter description
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter description Mode_MH
Data structure description
Parameter description Para_INTEG
Data structure description
Parameter Data type Description
X REAL Input variable
MODE Mode_MH Operating mode
PARA Para_INTEG Parameter
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output
Parameter Data type Description
STATUS Stat_MAXMIN Output status
Element Data type Description
man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode
Element Data type Description
gain REAL Integral gain (units/second)
ymax REAL Upper limit
ymin REAL Lower limit
INTEG
33002543 10/2013 207
Parameter description Stat_MAXMIN
Data structure description
Runtime error
An error message is returned if
an invalid floating point number lies at input YMAN or X
ymax < is ymin
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
qmin BOOL "1" = Y has reached the lower control limit
qmax BOOL "1" = Y has reached the upper control limit
INTEG
208 33002543 10/2013
Detailed description
Parametering
The parameter assignments of the function block are satisfied by the determination of the integral
gain and the limiting values ymax and ymin for output Y.
The values ymax and ymin limit the output within the prescribed range. Therefore ymin Y ymax
If the threshold value is reached or the output signal is limited this will be indicated by qmax and
qmin.
qmax = 1 if Y ymax
qmin = 1 if Y ymin
Operating mode
There are three operating mode selectable through the man and halt parameter inputs:
Example
The input signal is integrated via the time. If there is a jump on input X the output increases (for
positive X values) or decreases (for negative X values) according to a ramp function. Y is always
between ymax and ymin; if Y is equal to ymax or ymin, this is shown accordingly in qmax or qmin.
Operating mode man halt Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y. The control output is, however,
limited by ymax and ymin.
Halt 0 1 The output Y will be held at the last calculated
value. The output will no longer be changed, but
can be overwritten by the user.
INTEG
33002543 10/2013 209
Representation of the integrator jump response
INTEG
210 33002543 10/2013
33002543 10/2013 211
Unity Pro
LAG
33002543 10/2013
LAG: Delay element 1st order
Chapter 22
LAG: Delay element 1st order
Introduction
This chapter describes the LAG block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 212
Detailed description 215
LAG
212 33002543 10/2013
Description
Function description
The function block represents a delay element 1st Order (low pass)
The function block contains the following operating modes:
Manual mode
Halt
Automatic
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Formula
The transfer function is:
The formula of calculation is:
Meaning of the sizes
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Variable Description
Value of input X from the previous cycle
Value of the output Y from the previous cycle
dt is the time differential between the current cycle and the previous cycle
LAG
33002543 10/2013 213
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL LAG_Instance (X:=InputValue, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulatedValue,
Y:=Output)
Representation in ST
Representation:
LAG_Instance (X:=InputValue, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulatedValue,
Y:=Output) ;
LAG
214 33002543 10/2013
LAG parameter description
Description of input parameters:
Description of input / output parameters:
Parameter description Mode_MH
Data structure description
Parameter description Para_LAG
Data structure description
Runtime error
For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
X REAL Input value
MODE Mode_MH Operating modes
PARA Para_LAG Parameter
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Output
Element Data type Description
man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode
Element Data type Description
gain REAL Gain factor
lag TIME Delayed time constants
LAG
33002543 10/2013 215
Detailed description
Parametering
Setting parameters for the function block is achieved through specification of the factor gain as
well as setting parameters for the delayed time constant lag.
The unit jump at input X (jump at input X from 0 to 1.0) follows output Y with a delay. Along an e-
function
it will approximate the value .
Operating mode
There are three operating mode selectable through the man and halt parameter inputs:
Operating mode man halt Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y.
Halt 0 1 The output Y will be held at the last calculated
value. The output will no longer be changed, but
can be overwritten by the user.
LAG
216 33002543 10/2013
Example
The diagram shows an example of the jump response of the function block. Input X jumps to a new
value and output Y follows an e-function for input X.
Jump response for function block LAG if gain = 1
33002543 10/2013 217
Unity Pro
LAG2
33002543 10/2013
LAG2: Delay element 2nd order
Chapter 23
LAG2: Delay element 2nd order
Introduction
This chapter describes the LAG2 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 218
Detailed description 222
Timing diagrams 223
LAG2
218 33002543 10/2013
Description
Function description
The function block LAG2 represents a delay element 2nd order.
The function block contains the following operating mode:
Manual mode
Halt
Automatic
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Formula
The transfer function is:
The calculation formula is:
where
and
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
LAG2
33002543 10/2013 219
Meaning of the sizes
Representation in FBD
Representation:
Representation in LD
Representation:
Variable Description
Value of the output Y from the previous cycle
Value of the output Y from the previous cycle
dt is the time differential between the current cycle and the previous cycle
LAG2
220 33002543 10/2013
Representation in IL
Representation:
CAL LAG2_Instance (X:=Input, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulated_Y_Value,
Y:=Output)
Representation in ST
Representation:
LAG2_Instance (X:=Input, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulated_Y_Value,
Y:=Output) ;
LAG2 parameter description
Description of input parameters:
Description of input / output parameters:
Parameter description Mode_MH
Data structure description
Parameter Data type Description
X REAL Input value
MODE Mode_MH Operating mode
PARA Para_LAG2 Parameter
YMAN REAL Manual manipulated value for output
Parameter Data type Description
Y REAL Output
Element Data type Description
man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode
LAG2
33002543 10/2013 221
Parameter description Para_LAG2
Data structure description
Runtime error
For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
gain REAL Gain factor
dmp REAL Dampening
freq REAL Natural frequency
LAG2
222 33002543 10/2013
Detailed description
Parametering
The parameter assignments of the function block are satisfied by the determination of the factor
gain, and the values for dampening dmp, and natural frequency freq.
Dampening dmp and natural frequency freq must have positive values.
Output Y follows input X jumps in a dampened oscillation. The period of undampened oscillation is
T = 1/freq. For dampening values dmp < 1 reference is made to a dampened oscillation. For
dampening values 1 reference is made to non-resonant behavior (i.e. without oscillation); in this
case the output follows the input in the same way as with 2 LAG function blocks, which are switched
in series.
Operating modes
There are three operating mode selectable through the man and halt parameter inputs:
Operating mode man halt Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y.
Halt 0 1 The output Y will be held at the last calculated
value. The output will no longer be changed, but
can be overwritten by the user.
LAG2
33002543 10/2013 223
Timing diagrams
Overview
The following diagrams show examples of the LAG2 devices jump response with varying
parameters.
Dampening dmp = 1
For a dampening of dmp = 1 the output Y follows input X with a non-periodic action.
LAG2
224 33002543 10/2013
Dampening dmp = 0.5
For a dampening of dmp = 0.5 the output Y follows input X with a dampened periodic action.
Dampening dmp = 0.2
For a dampening of dmp = 0.2 it is clear that the jump response is considerably less dampened.
33002543 10/2013 225
Unity Pro
LEAD_LAG
33002543 10/2013
LEAD_LAG: PD device with smoothing
Chapter 24
LEAD_LAG: PD device with smoothing
Introduction
This chapter describes the LEAD_LAG block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 226
Detailed description 230
Examples of function blocks LEAD_LAG 231
LEAD_LAG
226 33002543 10/2013
Description
Function description
The function block implements a PD element with following low-pass filter.
The function block has the following properties:
Definable delay of the D-component
Operating modes Manual, Halt, Automatic
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouput may deliver a wrong value.
EN and ENO can be configured as additional parameters.
Formula
The transfer function is:
The formula of calculation is:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
LEAD_LAG
33002543 10/2013 227
Meaning of the sizes
Representation in FBD
Representation:
Representation in LD
Representation:
Variable Description
Value of input X from the previous cycle
Value of the output Y from the previous cycle
dt is the time differential between the current cycle and the previous cycle
LEAD_LAG
228 33002543 10/2013
Representation in IL
Representation:
CAL LEAD_LAG_Instance (X:=Input, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualControlValue, Y:=Output)
Representation in ST
Representation:
LEAD_LAG_Instance (X:=Input, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualControlValue, Y:=Output) ;
Parameter description LEAD_LAG
Description of input parameters:
Description of input / output parameters:
Parameter description Mode_MH
Data structure description
Parameter description Para_LEAD_LAG
Data structure description
Parameter Data type Description
X REAL Input
MODE Mode_MH Operating mode
PARA Para_LEAD_LAG Parameter
YMAN REAL Manual value manipulated value
Parameter Data type Description
Y REAL Output
Element Data type Description
man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode
Element Data type Description
gain REAL Gain factor
lead TIME Derivative time constant
lag TIME Delayed time constants
LEAD_LAG
33002543 10/2013 229
Runtime error
An error message is returned when an invalid floating point number lies at input YMAN or X.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
LEAD_LAG
230 33002543 10/2013
Detailed description
Parametering
The parameter assignments of the function block are satisfied by the determination of the factor
gain, and the values the derivative time constant lead and delayed time constant lag.
For very small sample times and the unit jump at input X (jump at input X from 0 to 1.0) output Y
will jump to the value (theoretical value - actual slightly smaller, due to the not
infinitely small sample times), using the time constant lag to approximate the value .
Operating modes
There are three operating mode selectable through the man and halt parameter inputs:
Operating mode man halt Meaning
Automatic 0 0 The function block operates as described in
"Parametering".
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y.
Halt 0 1 The output Y will be held at the last calculated
value. The output will no longer be changed, but
can be overwritten by the user.
LEAD_LAG
33002543 10/2013 231
Examples of function blocks LEAD_LAG
Example overview
The following examples are presented in the following diagrams:
lead = lag
lead=lag * 0.5, gain = 1
lead/lag = 2, gain = 1
lead = lag
The function blocks behave like a pure multiplication block with the multiplier gain.
Function block LEAD_LAG with lead = lag
LEAD_LAG
232 33002543 10/2013
lead=lag * 0.5, gain = 1
The output Y jumps in this case to half the end value in order to run into the end value with the
delayed time constant lag (gain * X).
Function block LEAD_LAG with lead/lag = 0.5 and gain = 1
lead/lag = 2, gain = 1
The output Y jumps in this case to twice the end value in order to run into the end value with the
delayed time constant lag (gain * X).
Function block LEAD_LAG with lead/lag = 2 and gain = 1
33002543 10/2013 233
Unity Pro
PCON2
33002543 10/2013
PCON2: Two point controller
Chapter 25
PCON2: Two point controller
Introduction
This chapter describes the PCON2 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 234
Detailed description 237
PCON2
234 33002543 10/2013
Description
Function description
The function block forms a two-point controller, which maintains PID-similar behavior through two
dynamic feedback paths.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
Operating modes Manual, Halt, Automatic
Two internal feedback paths (delay 1st Order)
Representation in FBD
Representation:
PCON2
33002543 10/2013 235
Representation in LD
Representation:
Representation in IL
Representation:
CAL PCON2_Instance (SP:=SetpointInput, PV:=ProcessVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualManipulated_ERR_EFF,
Y=>ManipulatedOutput, ERR_EFF=>EffectiveError)
Representation in ST
Representation:
PCON2_Instance (SP:=SetpointInput, PV:=ProcessVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualManipulated_ERR_EFF,
Y=>ManipulatedOutput, ERR_EFF=>EffectiveError) ;
PCON2 parameter description
Description of input parameters:
Parameter Data type Description
SP REAL Setpoint input
PV REAL Actual value input
PCON2
236 33002543 10/2013
Description of output parameters:
Parameter description Mode_MH
Data structure description
Parameter description Para_PCON2
Data structure description
Runtime error
In the following cases a warning is given:
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
MODE Mode_MH Operating mode
PARA Para_PCON2 Parameter
YMAN BOOL "1" = Manual value for ERR_EFF
Parameter Data type Description
Y BOOL "1" = Output manipulated variable
ERR_EFF REAL Effective switch value
Parameter Data type Description
Element Data type Description
man BOOL "1" = Manual mode
halt BOOL "1" = Halt mode
Element Data type Description
gain REAL Feedback boost
lag_neg TIME Time constants of the quick feedback
lag_pos TIME Time constants of the slow feedback
hys REAL Hysteresis from two point switch
xf_man REAL Reset value of the feedback in % (0 100)
Causes Behavior of the controller
lag_neg = 0 and lag_pos > 0 The controller works as if it had only a negative
feedback with time constant lag_pos.
lag_pos < lag_neg > 0 The controller works as if it had only a negative
feedback with time constant lag_neg.
xf_man < 0 or xf_man > 100 The controller works without internal feedback paths.
PCON2
33002543 10/2013 237
Detailed description
Structure of the controller
Structure of the two-point controller:
Principle of the two-point controller
The actual two-point controller will have 2 dynamic feedback paths (PT1-element) added. Through
appropriate selection of the time constants of the feedback element, the two-point controller
maintains dynamic behavior that corresponds to the behavior of a PID controller.
PCON2
238 33002543 10/2013
Feedback
The feedback parameter set, made up of the feedback gain and the feedback time constants
lag_neg and lag_pos, allows universal usage of the two point controller.
The following table provides more exact information about it:
Set feedback gain greater than zero!
Enter xf_man (meaning 0% to 100%) values between 0 and 100!
Hysteresis
The parameter hys indicates the switching hysteresis, i.e. the value that the effective switch value
ERR_EFF outgoing from control point hys/2 must be reduced by, before the output Y is reset to"0".
The dependence of the output Y depending of the effective switch value ERR_EFF and the
Parameter hys, becomes clear in the picture Principle of the two-point controller, page 237. The
value of the hys parameter is typically set to 1% of the maximum control area [max. (SP - PV].
Operating modes
There are three operating mode selectable through the man and halt parameter inputs:
Feedback lag_neg lag_pos
2-Point-Behavior (without feedback) = 0 = 0
negative feedback > 0 = 0
negative + positive feedback > 0 > lag_neg
Warning, regeneration (neg. feedback with lag_pos) = 0 > 0
Warning, regeneration (pos. feedback switched off) > lag_pos > 0
Operating mode man halt Meaning
Automatic 0 0 The function block will be handled as described
above.
Manual mode 1 0 or 1 The output Y is set to the value YMAN. xfl and xf2
are calculated using the following formula:
xf1 = xf_man * gain /100
xf2 = xf_man * gain /100
Halt 0 1 Output Y will be held at the last value.
xf1 and xf2 are set to gain * Y.
33002543 10/2013 239
Unity Pro
PCON3
33002543 10/2013
PCON3: Three point controller
Chapter 26
PCON3: Three point controller
Introduction
This chapter describes the PCON3 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 240
Detailed description 243
Runtime error 246
PCON3
240 33002543 10/2013
Description
Function description
The function block forms a three-point controller, which maintains PID-similar behavior through two
dynamic feedback paths.
EN and ENO can be configured as additional parameters.
Properties
The function block PCON3 contains the following properties:
Operating modes Manual, Halt, Automatic
Two internal feedback paths (delay 1st Order)
Representation in FBD
Representation:
PCON3
33002543 10/2013 241
Representation in LD
Representation:
Representation in IL
Representation:
CAL PCON3_Instance (SP:=SetpointInput, PV:=ProcessVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN_POS:=ManManipulated_Y_POS,
YMAN_NEG:=ManManipulated_Y_NEG,
Y_POS=>PosManipulated_ERR_EFF,
Y_NEG=>NegManipulated_ERR_EFF,
ERR_EFF=>EffectiveError)
Representation in ST
Representation:
PCON3_Instance (SP:=SetpointInput, PV:=ProcessVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN_POS:=ManManipulated_Y_POS,
YMAN_NEG:=ManManipulated_Y_NEG,
Y_POS=>PosManipulated_ERR_EFF,
Y_NEG=>NegManipulated_ERR_EFF,
ERR_EFF=>EffectiveError) ;
PCON3
242 33002543 10/2013
PCON3 parameter description
Description of input parameters:
Description of output parameters:
Parameter description Mode_MH
Data structure description
Parameter description Para_PCON3
Data structure description
Runtime error
For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
SP REAL Setpoint input
PV REAL Actual value input
MODE Mode_MH Operating mode
PARA Para_PCON3 Parameter
YMAN_POS BOOL Manual manipulation for Y_POS
YMAN_NEG BOOL Manual manipulation for Y_NEG
Parameter Data type Description
Y_POS BOOL "1" = positive manipulated variable at output ERR_EFF
Y_NEG BOOL "1" = negative manipulated variable at output ERR_EFF
ERR_EFF REAL Effective switch value
Element Data type Description
man BOOL "1" = Manual mode
halt BOOL "1" = Halt mode
Element Data type Description
gain REAL Feedback gain (feedback parameter set)
lag_neg TIME Time constant of the quick feedback (Feedback Parameter Set)
lag_pos TIME Time constant of the slow feedback (Feedback Parameter Set)
hys REAL Hysteresis from three point switch
db REAL Dead zone
xf_man REAL Reset value of the feedback in % (0 100)
PCON3
33002543 10/2013 243
Detailed description
Structure of the controller
Structure of the three-point controller:
Hence:
If... Then...
Y = 1 Y_POS = 1
Y_NEG = 0
Y = 0 Y_POS = 0
Y_NEG = 0
Y = -1 Y_POS = 0
Y_NEG = 1
PCON3
244 33002543 10/2013
Principle of the three-point controller
The actual three-point controller will have 2 dynamic feedback paths (PT1-elements) added.
Through appropriate selection of the time constants of the feedback-element, the three-point
controller maintains dynamic behavior that corresponds to the behavior of a PID controller.
Feedback
The function block has a parameter sequence for the internal feedback paths, comprised of the
feedback gain and the reset time constant lag_neg and lag_pos.
The following table provides more exact information about it:
The parameter gain must be > 0
The amount will be resolved from the Hysterisis hys and the dead zone db!
For xf_man (meaning -100 to 100%) values between -100 and 100 are to be entered!
Dead zone
The parameter db sets the connection point for the outputs Y_POS and Y_NEG. If the effective
switch value ERR_EFF is positive and is greater than db, then the output Y_POS will switch from
"0" to "1". If the effective switch value ERR_EFF is negative and is smaller than db, then the output
Y_NEG will switch from "0" to "1". The value of the db parameter is typically set to 1% of the
maximum control area (max. SP - PV).
Feedback lag_neg lag_pos
3-Point-Behavior (without feedback) = 0 = 0
negative feedback > 0 = 0
negative + positive feedback > 0 > lag_neg
Warning, regeneration (neg. feedback with lag_pos) = 0 > 0
Warning, regeneration (pos. feedback switched off) > lag_pos > 0
PCON3
33002543 10/2013 245
Hysteresis
The parameter hys indicates the switching hysteresis, i.e. the value which the effective switch
value ERR_EFF outgoing from control point db must be reduced, before the output Y_POS (Y_NEG)
is reset to "0". The connection between Y_POS and Y_NEG depending on effective switch value
ERR_EFF and the parameters db and hys is illustrated in the image Principle of the three-point
controller, page 244. The value of the hys parameter is typically set to 0.5% of the maximum
control area (max. SP - PV).
Operating modes
There are three operating mode selectable through the man and halt parameter inputs:
Operating mode man halt Meaning
Automatic 0 0 The function block will be handled as described
above.
Manual mode 1 0 or 1 The outputs Y_POS and Y_NEG are set to the
values YMAN_POS and YMAN_NEG. In this case,
the built in priority logic - Y_NEG is dominant
over Y_POS, which prohibits both outputs from
being set simultaneously.
xf1 and xf2 are calculated using the following
formula:
xf1 = xf_man * gain /100
xf2 = xf_man * gain /100
Halt 0 1 In Halt mode, both outputs Y_POS and Y_NEG
will be held at the last value.
xf1 and xf2 are set to gain * Y.
PCON3
246 33002543 10/2013
Runtime error
Error message
If hys > 2 * db, an error message appears.
Warning
In the following cases a warning is given:
Causes Behavior of the controller
lag_neg = 0 and lag_pos > 0 The controller works as if it had only a negative
feedback with time constant lag_pos.
lag_pos < lag_neg > 0 The controller works as if it had only a negative
feedback with time constant lag_neg.
xf_man < 0 or xf_man > 100 The controller works without internal feedback paths.
33002543 10/2013 247
Unity Pro
PD_OR_PI
33002543 10/2013
PD_OR_PI: Structure changeover PD/PI controller
Chapter 27
PD_OR_PI: Structure changeover PD/PI controller
Introduction
This chapter describes the PD_OR_PI block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 248
Structure diagram for the function block PD_OR_PI 253
Detailed description 254
Detailed formulas 256
PD_OR_PI
248 33002543 10/2013
Description
Function description
The function block PD_OR_PI can work equally well as either PD controller or PI controller.
Depending on the system deviation (SP - PV) and a specified switch value, trig_err will
automatically perform a structural changeover from PD- to PI-Controller and vice-versa from PI- to
PD-Controller.
This EFB is particularly suitable for starting control purposes. When the process is started, the
controller reacts as a P(D) controller, whereby the controlled variable is to reach the adjusted
reference variable value as fast as possible. Shortly before the given setpoint value is reached, the
control algorithm is switched over and an I component makes sure that the remaining control
deviation fades out.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
PI controller with independent gain, ti adjustment
PD controller with independent gain, ti adjustment
Manipulated variable limiting in automatic mode
Anti-windup reset in PI operation
definable delay of the D component
Operating modes Manual, Halt, Automatic
bumpless changeover between manual and automatic
Automatic bumpless changeover from PD to PI operation and back
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PD_OR_PI
33002543 10/2013 249
The PI controller transfer function
The PI controller transfer function is:
The PD controller transfer function
The PD controller transfer function is:
Representation in FBD
Representation:
PD_OR_PI
250 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL PD_OR_PI_Instance (SP:=SetpointInput,
PV:=ProcessVariable, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualManipulatedVariable,
FEED_FWD:=Disturbance, Y:=ManipulatedVariable,
ERR=>SystemDeviation, STATUS=>StatusOfOutput_Y)
Representation in ST
Representation:
PD_OR_PI_Instance (SP:=SetpointInput, PV:=ProcessVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualManipulatedVariable,
FEED_FWD:=Disturbance, Y:=ManipulatedVariable,
ERR=>SystemDeviation, STATUS=>StatusOfOutput_Y) ;
PD_OR_PI
33002543 10/2013 251
Parameter description PD_OR_PI
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter description Mode_MH
Data structure description
Parameter Data type Description
SP REAL Setpoint input (reference variable)
PV REAL Process variable (controlled variable)
MODE Mode_MH Operating mode
PARA Para_PD_or_PI Parameter
YMAN REAL Manual manipulated variable
FEED_FWD REAL Disturbance variable
Parameter Data type Description
Y REAL Manipulated variable
Parameter Data type Description
ERR REAL System deviation
STATUS Stat_MAXMIN Output status
Element Data type Description
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
PD_OR_PI
252 33002543 10/2013
Parameter description Para_PD_PI
Data structure description
Parameter description Stat_MAXMIN
Data structure description
Runtime error
An error message is returned if
an unauthorized floating point number is placed at the input PV
ymax < is ymin
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
trig_err REAL Changeover switching value for PDPI controller
gain_d REAL PD controller proportional action coefficient (gain)
td TIME PD controller rate time
td_lag TIME Delay of the PD controller rate time
gain_i REAL PI controller proportional action coefficient (gain)
ti TIME PI controller reset time
ymax REAL Upper limit
ymin REAL Lower limit
Element Data type Description
qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit
PD_OR_PI
33002543 10/2013 253
Structure diagram for the function block PD_OR_PI
Structure diagram
The following is the structure diagram of the PD_OR_PI block:
PD_OR_PI
254 33002543 10/2013
Detailed description
Determination of switching value
Setting parameters for the function block begins with the determination of switching value
trig_err. This parameter determines when the function block is automatically changed from PD
to PI operation.
When the absolute value of system deviation ERR = SP - PV is smaller than the switching value
trig_err, the controller switches automatically from PD operation into PI operation.
When the system deviation ERR is larger than the switching value trig_err, the controller
switches automatically form PI operation into PD operation.
It then follows that:
PD controller: ERR > trig_err
PI controller: ERR trig_err
Each controller type is linked to a parameter set, which must be configured as well. The control
algorithm changeover is practically a switch from one parameter set to the other. The changeover
is bumpless.
PD controller
PD controller parameter settings are accomplished by configuration of the proportional action
coefficient gain_d and rate time td.
For PD controller operation the D component is delayed by the time constant value td_lag. The
td/td_lag ratio is termed the differential gain, and is generally selected between 3 and 10. The
D component directly determined by the system deviation ERR, such that for reference variable
fluctuations (variations at input SP) a jump attributed to the D component is produced.
The D component can be disabled by setting td = 0.
PI controller
PI controller parameter settings are accomplished by configuration of the proportional action
coefficient gain_i and reset time ti.
In general during the start-up procedure with the PD algorithm, the proportional action coefficient
is set considerably higher than in the practically stationary operation with the PI algorithm. This
circumstance is conceded to by the designation of two independent proportional action
coefficients.
The I component can be disabled by setting ti = 0.
PD_OR_PI
33002543 10/2013 255
Manipulated variable limiting
The limits ymax and ymin retain the manipulated variable within the prescribed range.
It therefore holds that: ymin Y ymax
The outputs qmax and qmin signal that the manipulated variable has reached a limit, and thus
been limited:
qmax = 1, if Y ymax
qmin = 1, if Y ymin
For limiting the manipulated variable, the upper limit ymax should be greater than the lower limit
ymin.
Anti-windup reset
Should limiting of the manipulated variable take place while the PI control algorithm is active, the
anti-windup reset should ensure that the I component "cannot go berserk". Anti-windup measures
are taken only for I component values other than 0. Anti-windup limits are identical to those for the
manipulated variable.
The anti-windup reset measure corrects the I component such that:
YI ymin - gain_i * (SP - PV) - FEED_FWD
YI ymax - gain_i * (SP - PV) - FEED_FWD
Operating modes
There are three operating mode selectable through the man and halt parameter inputs:
Operating mode man halt Meaning
Automatic 0 0 The manipulated variable output Y is determined through the
discrete PI or PD closed-loop control algorithms, based on the
controlled variable PV and reference variable SP. The
manipulated variable is limited by ymax and ymin. The
controller output limits also serve as limits for the antiwindup
reset.
Manual mode 1 0 or 1 The manual manipulated value YMAN is passed on directly to the
manipulated variable Y. The manipulated variable is limited by
ymax and ymin. Internal variables will be so manipulated, that
the controller changeover from manual to automatic can be
bumpless.
Halt 0 1 The manipulated variable remains unchanged, the block does
not influence the manipulated variable Y. Internal variables will
be manipulated in such a manner that the controller can be
driven smoothly from its current position. Manipulated variable
limits and antiwindup measures are as those in automatic mode
Halt mode is also useful in allowing an external operator device
to adjust control output Y, whereby the controllers internal
components are given the chance to continuously react to the
external influence.
PD_OR_PI
256 33002543 10/2013
Detailed formulas
Explanation of formula variables
Meaning of the variables in the following formulas:
System deviation
The system deviation will be determined as follows:
Manipulated variable
The manipulated variable consists of various terms which are dependent on the operating mode:
After summation of the components manipulated variable limiting takes place, so that:
Variable Meaning
Present sample time
System deviation
System deviation value from the previous sampling step
FEED_FWD Disturbance variable
Y Current output (halt mode) or YMAN (manual mode)
YD D component
Value of the D-component from the previous sampling step
YI I component
Value of the I component from the previous sampling step
YP P component
PD_OR_PI
33002543 10/2013 257
Overview of the calculation of the control components
Following this an overview on the different calculations of the control components in relation to the
elements trig_err can be found:
PI controller: YP and YD for all operating mode
YP and YD for manual, halt, automatic and cascade modes are located as follows:
PI controller: I component for automatic mode
YI for automatic mode is determined as follows (ti > 0):
The I component is formed according to the trapezoid rule.
PI controller: I component YI for manual and halt modes
YI for manual and halt are located as follows
PD controller: YP and YI for all modes
YP and YI for manual, halt, and automatic modes are determined as follows
Controller type Controller components
PI controller (ERR trig_err) YP and YD for manual, halt and automatic modes
YI for automatic operating mode
YI for manual and halt operating mode
PD controller (ERR> trig_err ) YP and YI for manual, halt and automatic modes
YD for automatic mode
YD for manual and halt operating mode
PD_OR_PI
258 33002543 10/2013
PD controller: D component for automatic mode
YD for automatic mode is determined as follows:
PD controller: D component for manual and halt operating mode
YD for manual, halt and automatic modes is determined as follows:
33002543 10/2013 259
Unity Pro
PDM
33002543 10/2013
PDM: Pulse duration modulation
Chapter 28
PDM: Pulse duration modulation
Introduction
This chapter describes the PDM block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 260
Detailed description 264
PDM
260 33002543 10/2013
Description
Using the block
Actuators are driven not only by analog quantities, but also through binary actuating signals. The
conversion of analog values into binary output signals is achieved for example, through pulse width
modulation (PWM) or pulse duration modulation (PDM).
The actuator adjusted average energy (actuator energy) should be in accord with the modulation
blocks analog input value (IN).
Function description
The function block PDM converts analog values into digital output signals.
In the function block PDM, a 1 signal of constant duration is output within a variable cycle time which
depends on the analog value X. The adjusted average energy corresponds to the quotient of the
fixed duty cycle t_on and the variable cycle time period.
In order that the adjusted average energy also corresponds to the analog input variable IN, the
following must apply:
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PDM
33002543 10/2013 261
General information about the actuator drive
In general, the binary actuator drive is performed by two Boolean signals Y_POS and Y_NEG. On a
motor the output Y_POS corresponds to the signal "clockwise rotation" and the output Y_NEG the
signal "counter-clockwise rotation". For an oven the outputs Y_POS and Y_NEG could be
interpreted as corresponding to "heating" and "cooling".
Should the actuating drive in question be a motor, it is possible that to avoid overtravel for non-self-
locking gearboxes, a brake pulse must be output after the engage signal.
In order to protect the power electronics, there must be a pause time t_pause after switching on
t_on and before the brake pulse t_brake so as to avoid short circuits.
Formula
For correct operation when setting parameters the following rules should be observed:
and
Representation in FBD
Representation:
PDM
262 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL PDM_Instance (X:=InputVariable, R:=ResetMode,
PARA:=Parameter, Y_POS=>Positive_X_ValueOutput,
Y_NEG=>Negative_X_ValueOutput)
Representation in ST
Representation:
PDM_Instance (X:=InputVariable, R:=ResetMode,
PARA:=Parameter, Y_POS=>Positive_X_ValueOutput,
Y_NEG=>Negative_X_ValueOutput) ;
PDM parameter description
Description of input parameters:
Description of output parameters:
Parameter Data type Description
X REAL Input variable
R BOOL Reset mode
PARA Para_PDM Parameter
Parameter Data type Description
Y_POS BOOL Output for positive X values
Y_NEG BOOL Negative X value output
PDM
33002543 10/2013 263
Parameter description Para_PDM
Data structure description
Runtime error
An error message is returned if
|up_x| |lo_x|
t_max t_min
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
t_on TIME Pulse duration (in s)
t_pause TIME Pause time (in s)
t_brake TIME Braking time (in s)
pos_up_x REAL Upper limit for positive X
pos_t_min TIME Minimum cycle time for Y_POS (where x = pos_up_x) (in s)
pos_lo_x REAL Lower limit for positive X
pos_t_max TIME Maximum cycle time for Y_POS (where x = pos_lo_x) (in s)
neg_up_x REAL Upper limit for negative X
neg_t_min TIME Minimum cycle time for Y_NEG (where x = -neg_up_x) (in s)
neg_lo_x REAL Lower limit for negative X
neg_t_max TIME Maximum cycle time for Y_NEG (where x = -neg_lo_x) (in s)
PDM
264 33002543 10/2013
Detailed description
Block mode of operation
The pulse duration t_on determines the time span in which the output Y_POS resp. Y_NEG has 1
signal. For a positive input signal X the output Y_POS is set, for a negative input signal X the output
Y_NEG is set. Only one output can carry 1 signal. It is advisable to perform a freely definable pause
time of t_pause = 10 or 20 ms between the actuating and brake pulses to protect the power
electronics (hopefully preventing simultaneous firing of the antiparallel connected thyristors).
A possible brake pulse of duration time t_brake follows the output pulse duration after a pause
time t_pause. Within the pause time both outputs carry 0 signals. During the braking time the
output opposite that carrying the previous pulse goes to 1 signal. A pause time of t_pause = 20
ms (t_pause =0.02) corresponds to an interruption of the firing angle control for two half waves.
That should guarantee a sufficiently large safety margin for the prevention of short-circuits resp.
triggering of the suppressor circuitry as a consequence of antiparallel thyristors firing.
Thereafter follows a period in which both outputs carry 0 signal (delay).
Period
This delay, together with the pulse, pause and brake times, all makeup a period , which
depending on lo_x and t_min, is calculated according to the following formulas:
Requirements Equation Explanation of formula variables
lo_x <> 0

lo_x = 0
t_min > 0

lo_x = 0
t_min = 0
PDM
33002543 10/2013 265
The following holds for all three cases:
NOTE: From the parameters up_x (-pos/-neg) and lo_x (-pos/-neg) only the (absolute) value is
evaluated.
Cycle time
The parameter t_min - for every output there is a separate value - gives the minimum period, i.e.
the time span, which passes from the beginning of one actuating pulse until the start of the next.
This time span appears when input X goes beyond value up_x - this time there is a separate value
for each sign.
The parameter t_max places an upper limit on the maximum period. Should the input cross below
the value pos_lo_x or neg_lo_x, the actuating pulse output is terminated until the until the input
exceeds the value pos_lo_x or neg_lo_x again. The values pos_lo_x and neg_lo_x define
what is in principle a dead zone, in which the function block outputs are not activated.
The parameters (pos_t_min, pos_up_x) and (pos_t_max, pos_lo_x) are valid for positive
input signals X. The output Y_POS is set. The parameters Parameter (neg_t_min, neg_up_x)
and (neg_t_max, neg_lo_x) are valid for negative input signals X. The output Y_NEG is set.
Requirements lo_x up_x t_min t_max
pos_lo_x pos_up_x pos_t_min pos_t_max
neg_lo_x neg_up_x neg_t_min neg_t_max
PDM
266 33002543 10/2013
Time ratio display
An overview of the ratio between times is shown in the following diagram:
Time-span dependency
The time-span dependency from the input variable X, in which the output Y_POS (Y_NEG) carries
1 signal, is displayed in the picture "Output dependency on X, page 267" and the picture "Output
dependency on X (Special case), page 268".
PDM
33002543 10/2013 267
Output dependency on X
In the following picture the dependency of the output on X is shown:
PDM
268 33002543 10/2013
Output dependency on X (Special case)
In the following picture the special case t_min = 0, lo_x = 0 is shown:
Operating modes
In reset mode R = "1", outputs Y_POS and Y_NEG are set to 0 signal. The internal time meters are
also standardized, so that the function block begins the transfer to R=0 with the output of a new 1
signal on the associated output.
Boundary conditions
If the PDM function block is operated together with a PID controller, then the maximum period
t_max should be selected so that it corresponds to the PID controllers scan time. It is then
guaranteed that every new actuating signal from the PID controller within the period time can be
fully processed.
The PDM scan time t_scan should be in proportion with the period vs. pulse time. Though this, the
smallest possible actuating pulse is be determined.
The following ratio is recommended:
33002543 10/2013 269
Unity Pro
PI
33002543 10/2013
PI: PI controller
Chapter 29
PI: PI controller
Introduction
This chapter describes the PI block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 270
Formulas 274
Parametering 275
Operating modes 277
Example of a PI controller 278
PI
270 33002543 10/2013
Description
Function description
The function block represents a simple PI controller.
A system deviation ERR is formed by the difference between the reference variable SP and the
controlled variable PV. This deviation ERR causes the manipulated variable Y to change.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
Operating modes Manual, Halt, Automatic
bumpless changeover between manual and automatic
Manipulated variable limiting
Anti-windup reset (only for an active I component)
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PI
33002543 10/2013 271
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL PI_Instance (SP:=SetpointInput, PV:=ProcessVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualManipulatedVariable, Y:=ManipulatedVariable,
ERR=>SystemDeviation, STATUS=>StatusOfOutput_Y)
PI
272 33002543 10/2013
Representation in ST
Representation:
PI_Instance (SP:=SetpointInput, PV:=ProcessVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualManipulatedVariable, Y:=ManipulatedVariable,
ERR=>SystemDeviation, STATUS=>StatusOfOutput_Y) ;
PI parameter description
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter description Mode_MH
Data structure description
Parameter Data type Description
SP REAL Setpoint input / reference variable
PV REAL Process variable / controlled variable
MODE Mode_MH Operating mode
PARA Para_PI Parameter
YMAN REAL Manual value
Parameter Data type Description
Y REAL Manipulated variable
Parameter Data type Description
ERR REAL System deviation
STATUS Stat_MAXMIN Y output status
Element Data type Description
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
PI
33002543 10/2013 273
Parameter description Para_PI
Data structure description
Parameter description Stat_MAXMIN
Data structure description
Runtime error
An error message is returned if
an invalid floating point number lies at input YMAN or X,
ymax < ymin.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
gain REAL Proportional action coefficient (gain)
ti TIME Integral time
ymax REAL Upper limit
ymin REAL Lower limit
Element Data type Description
qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit
PI
274 33002543 10/2013
Formulas
Transfer function
The transfer function is:
Calculation formulas
The calculation formulas are:
Output signal Y
The output signal Y is then:
The I component is formed according to the trapezoid rule.
Explanation of formula variables
The meaning of the formula variables is given in the following table:
Variable Meaning
Present sample time
System deviation (SP - PV)
System deviation value from the previous sampling step
YI I component
YP P component
PI
33002543 10/2013 275
Parametering
Structure diagram
The following is the structure diagram of the PI controller:
Parametering
The PI control structure is displayed in theStructure diagram, page 275. Setting parameters for the
function block takes place first of all for the elemental PI parameters: the proportional action
coefficient gain and reset time ti.
The I component can be disabled by setting ti = 0.
The values ymax and ymin limit the output within the prescribed range. Therefore ymin Y
ymax.
The outputs qmax and qmin signal that the output has reached a limit, and thus been capped.
qmax = 1 if Y ymax
qmin = 1 if Y ymin
Manipulated variable limiting
After summation of the components manipulated variable limiting takes place, so that: ymin Y
ymax
PI
276 33002543 10/2013
Anti-windup reset
Should limiting of the manipulated variable take place, the antiwindup reset should ensure that the
integral component "cannot go berserk". The antiwindup measure is only implemented if the I
component of the controller is not disabled. Anti-windup limits are identical to those for the
manipulated variable. The anti-windup-reset measure corrects the I component such that: ymin -
YP YI ymax - YP
PI
33002543 10/2013 277
Operating modes
Selecting the operating modes
There are three operating mode selectable through the man and halt parameter inputs.
Automatic operating mode
In automatic mode the control output Y is determined through the closed-loop control based on the
controlled variable PV and reference variable SP. The manipulated variable is limited by ymax and
ymin. The control limits are also limits for the Anti-windup reset.
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between ymax and ymin, and Y goes directly to YMAN at the changeover.
If the changeover from automatic to manual is to be bumpless in spite of these problems, there are
two exemplary possibilities shown for a PID controller (see page 288).
Manual mode
In manual mode the manually manipulated value YMAN is passed on directly to the control output
Y. However, the manipulated variable is limited by ymax and ymin. Internal variables will be
manipulated in such a manner that the controller changeover from manual to automatic (with I
component enabled) can be bumpless. The control limits are also limits for the Anti-windup reset
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
control output Y, i.e. Y = Y(old). Internal variables will be manipulated in such a manner that the
component sum corresponds with the manipulated variable, thus allowing the controller to be
driven smoothly from its current position. The control limits are also limits for the Anti-windup reset.
Halt mode is also useful in allowing an external operator device to adjust control output Y, whereby
the controllers internal components are given the chance to continuously react to the external
influence.
Operating mode man halt
Automatic 0 0
Manual mode 1 1 or 0
Halt 0 1
PI
278 33002543 10/2013
Example of a PI controller
Example
The jump response of the PI controller is shown in the following Diagram (see page 278) as an
example.
In the first part of the figure the function block response to MAN operating mode can be seen: The
output Y jumps to the YMAN value.
The second part of the diagram shows the reaction of the function block in automatic mode (MAN
= 0 and HALT= 0) both with a positive ERR system deviation and with a negative ERR system
deviation. For constant positive system deviation, Y ramps upward until the upper output limit is
reached.
Y is then limited to the value ymax. Limiting is signaled by qmax. The system deviation then jumps
to a negative value whose absolute value is greater than the previous positive value.
The input jumps to the value ); through the P component, then there
is a ramp decrease in Y. The absolute value of the gradient is greater than under the previous
positive system deviation. This can be attributed to the now greater absolute value of the system
deviation.
PI controller jump response
Presentation of the jump response of the PI controller
33002543 10/2013 279
Unity Pro
PID
33002543 10/2013
PID: PID controller
Chapter 30
PID: PID controller
Introduction
This chapter describes the PID block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 280
PID function block structure diagram 285
Setting parameters for the PID controller 286
Operating modes 288
Detailed formulas 290
PID
280 33002543 10/2013
Description
Function description
The function block produces a PID controller.
Initialization Requirements
This function block performs an internal initialization in the first program cycle after a warm start or
cold start (e.g. application download or power cycle) of the PLC program.
EN and ENO can be configured as additional parameters.
For the proportional part of the controller to behave properly, the integral action must be reset (the
input coefficient en_i set to zero) for at least one scan time after a warm start or cold start.
If the integral action coefficient en_i is set to a non-zero value at initialization, the function block
behaves like an I or ID controller with no proportional part.
Properties
The function block has the following properties:
real PID controller with independent gain, ti, td setting
Operating modes Manual, Halt, Automatic
bumpless changeover between manual and automatic
Manipulated variable limiting in automatic mode
Separately enabled P, I and D component
Anti-Windup-Reset
Anti-windup measures taken only for an active I component
definable delay of the D component
D component connectable to controlled variable PV or system deviation ERR
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PID
33002543 10/2013 281
Transfer function
The transfer function is:
Explanation of the variables:
Representation in FBD
Representation:
Variable Description
YD D component (only when en_d = 1)
YI I component (only when en_i= 1)
YP P component (only when en_p= 1)
PID
282 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL PID_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, MODE:=OperatingModes,
PARA:=Parameter, FEED_FWD:=Disturbance,
YMAN:=ManualManipulatedValue, Y:=ManipulatedVariable,
ERR=>SystemDeviation, STATUS=>StatusOfOutput_Y)
Representation in ST
Representation:
PID_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, MODE:=OperatingModes,
PARA:=Parameter, FEED_FWD:=Disturbance,
YMAN:=ManualManipulatedValue, Y:=ManipulatedVariable,
ERR=>SystemDeviation, STATUS=>StatusOfOutput_Y) ;
PID
33002543 10/2013 283
PID parameter description
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter description Mode_PID
Data structure description
1
Refer to Initialization Requirements (see page 280).
Parameter Data type Description
SP REAL Reference variable
PV REAL Controlled variable
MODE Mode_PID Operating mode
PARA Para_PID Parameter
FEED_FWD REAL Disturbance variable
YMAN REAL Manually manipulated value
Parameter Data type Description
Y REAL Manipulated variable
Parameter Data type Description
ERR REAL System deviation
STATUS Stat_MAXMIN Y output status
Element Data type Description
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
en_p BOOL "1": P component on
en_i
1
BOOL "1": I component on
en_d BOOL "1": D component on
d_on_pv BOOL "1": D component in relation to the controlled
variable
"0": D component in relation to the system deviation
PID
284 33002543 10/2013
Parameter description Para_PID
Data structure description
Parameter description Stat_MAXMIN
Data structure description
Error message
An error message is returned if
an invalid floating point number lies at input YMAN or PV
ymax < ymin
NOTE: For a list of all block error codes and values, see Tables of Error Codes for the Obsolete
Library (see page 600).
Element Data type Description
gain REAL Proportional action coefficient (gain)
ti TIME Integral time
td TIME Derivative time
td_lag TIME Delay of the D component
ymax REAL Upper limit
ymin REAL Lower limit
Element Data type Description
qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit
PID
33002543 10/2013 285
PID function block structure diagram
Structure diagram
The following is the structure diagram of the PID block:
PID
286 33002543 10/2013
Setting parameters for the PID controller
Parametering
The PID control structure is displayed in Structure diagram, page 285.
Setting function block parameters is initially performed by the pure PID parameters, i.e. the
proportional action coefficient gain, the reset time ti and the rate time td.
The D component is delayed by the time td_lag. The td/td_lag ratio is termed the differential
gain, and is generally selected between 3 and 10. The D component can either be based upon the
system deviation ERR (d_on_pv = "0") or the controlled variable PV (d_on_pv = "1"). Should the
D component be determined by the controlled variable PV, then the D component will not be able
to cause jumps when reference variable fluctuations (changes in input SP) take place. In principle
the D component only influences disturbances and process changes.
Control direction reversal
A reversed behavior of the controller can be achieved by reversing the sign of gain. A positive
value on gain causes the increase of the output value, for a positive error variable. A negative
value on gain causes the increase of the output value, for a positive error variable.
Manipulated variable limiting
The limits ymax and ymin limit the output within the prescribed range. Therefore ymin Y ymax.
The outputs qmax and qmin signal that the limit value has been reached, i.e. that the output signal
is limited.
qmax = 1 if Y ymax
qmin = 1 if Y ymin
The upper limit ymax for limiting the manipulated variable must be greater than the lower limit
ymin, otherwise the function block reports an error and does not function.
Anti-windup reset
Should limiting of the manipulated variable take place, the anti-windup reset should ensure that the
I component "cannot go berserk". Anti-windup measures are only taken if the controller I
component is not switched off. Anti-windup limits are identical to those for the manipulated
variable. The anti-windup measures disregard D component values, to avoid being falsely
triggered by D component peaks.
The anti-windup measures correct the I component in such a way that:
PID
33002543 10/2013 287
Selecting the control types
There are four different control types, which are selected via the elements en_p, en_i and en_d:
The I component can also be disabled with ti = 0.
Controller type en_p en_i en_d
P controller 1 0 0
PI controller 1 1 0
PD controller 1 0 1
PID controller 1 1 1
I controller 0 1 0
PID
288 33002543 10/2013
Operating modes
Selecting the operating modes
There are three operating mode selectable through the man and halt elements:
Automatic operating mode
In automatic mode, the manipulated variable Y is determined through the discrete PID closed-loop
control algorithm subject to controlled variable PV and reference variable SP. The manipulated
variable is limited by ymax and ymin. The control limits are also limits for the Anti-windup reset.
Manual mode
In manual mode the manually manipulated value YMAN is passed on directly to the manipulated
variable Y. However, the manipulated variable is limited by ymax and ymin. Internal variables will
be manipulated in such a manner that the controller changeover from manual to automatic (with I
component enabled) can be bumpless. The control limits are also limits for the Anti-windup reset.
In this operating mode the D component is automatically set to 0.
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
manipulated variable Y, i.e. Y = Y(old). The internal sizes are tracked in such a way that the
controller (on connecting to the I component) bumplessly proceeds from its current position. The
control limits are also limits for the Anti-windup reset. The halt operating mode is also useful for
setting the control output Y via an external operator device, whereby the internal components are
tracked correctly in the controller.
In this operating mode the D component is automatically set to 0.
Switching from automatic to manual
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between ymax and ymin, and Y goes directly to YMAN at the changeover.
There are two possibilities if, nevertheless, a bumpless changeover from automatic to manual is
required:
Switching with the help of the MOVE function
Switching with the help of the function block increase limit VLIM
Operating mode man halt
Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1
PID
33002543 10/2013 289
Switching via MOVE
Using function MOVE set the value of YMAN to the value of Y:
The MOVE function is only performed when the PID controller is in automatic mode (Mode.man =
0). If only one changeover from automatic to manual takes place it is bumpless, as the value of
YMAN is equal to the value of Y in this cycle. In the manual mode the value of YMAN can slowly be
changed.
Switching via VLIM
If you do not want to change YMAN, e.g. because it is a constant, then the previous solution can be
implemented using a velocity limiter (function block VLIM):
In automatic mode (MPID.man = 0) the velocity limiter is in manual mode (MOVE function). That way
the PID controller manual value (YMAN from PID) can be set to the Y value of the PID controller
via the velocity limiter manual value (YMAN from VLIM). If only one changeover from automatic to
manual takes place, it is bumpless, as the value of YMAN (of the PID) is equal to the value of Y (of
the PID) in this cycle. The PID controller YMAN value, starting at your adjustment value (Para.rate),
are compared with the actual manual value (on VLIM) beginning with the next cycle.
PID
290 33002543 10/2013
Detailed formulas
Explanation of formula variables
Meaning of the variables in the following formulas:
Manipulated variable
The manipulated variable consists of various terms which are dependent on the operating mode:
After summation of the components manipulated variable limiting takes place, so that:
Overview of the calculation of the control components
The following is an overview on the different calculations of the control components in relation to
the elements en_p, en_i and en_d:
P component YP for manual, Halt and automatic mode
I component YI for automatic mode
I component YI for manual and halt modes
D component YD for automatic mode
D component YD for manual and halt modes
Variable Meaning
is the time differential between the current cycle and the previous cycle
System deviation (SP - PV)
System deviation value from the current sampling step
System deviation value from the previous sampling step
FEED_FWD Disturbance variable
Value of controlled variable from the current sampling step
Value of controlled variable from the previous sampling step
Y current output (halt mode) or YMAN (manual mode)
YD D component
YI I component
YP P component
PID
33002543 10/2013 291
P component YP for all operating mode
YP for manual, Halt and automatic are located as follows
For en_p = 1 the following applies:
For en_p = 0 the following applies:
I component YI for automatic mode
YI for automatic mode is determined as follows:
For en_i = 1 the following applies:
For en_i = 0 the following applies:
The I component is formed according to the trapezoid rule.
I component YI for manual and halt modes
YI for manual, halt and automatic modes is determined as follows:
For en_i = 1 the following applies:
For en_i = 0 the following applies:
PID
292 33002543 10/2013
D component YD for automatic mode
YD for automatic mode and cascade is determined as follows:
For en_d = 1 and d_on_pv = 0 the following applies:
For en_d = 1 and d_on_pv = 1 the following applies:
For en_d = 0 the following applies:
D component YD for manual and halt modes
YD for manual, halt and automatic modes is determined as follows:
YD = 0
33002543 10/2013 293
Unity Pro
PID_P
33002543 10/2013
PID_P: PID controller with parallel structure
Chapter 31
PID_P: PID controller with parallel structure
Introduction
This chapter describes the PID_P block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 294
Setting parameters for the PID_P controller 299
Operating modes 301
Detailed formulas 302
PID_P
294 33002543 10/2013
Description
Function description
The function block replicates a PID controller in parallel structure.
A system deviation ERR is formed by the difference between the reference variable SP and the
controlled variable PV. The deviation ERR causes the manipulated variable Y to change.
Initialization Requirements
This function block performs an internal initialization in the first program cycle after a warm start or
cold start (e.g. application download or power cycle) of the PLC program.
EN and ENO can be configured as additional parameters.
For the proportional part of the controller to behave properly, the integral action must be reset (the
input coefficient KI set to zero) for at least one scan time after a warm start or cold start.
If the integral action coefficient KI is set to a non-zero value at initialization, the function block
behaves like an I or ID controller with no proportional part.
Properties
The function block has the following properties:
PID controller in pure parallel structure
Independent gains for P-. I and D component
Each component P, I and D can be individually enabled
Limiting control limits in automatic mode
Anti-windup measure with an active I component only
Anti-windup reset
Operating modes Manual, Halt, Automatic
bumpless changeover between manual and automatic
D component connectable to input variable PV or system deviation ERR
D component with variable delay
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PID_P
33002543 10/2013 295
Transfer function
The transfer function is:
Explanation of the variables:
Representation in FBD
Representation:
Variable Description
YD D component
YI I component
YP P component
PID_P
296 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL PID_P_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualValue,
FEED_FWD:=Disturbance, Y:=ManipulatedVariable,
ERR=>OutputSystemDeviation, STATUS=>StatusOfOutput_Y)
Representation in ST
Representation:
PID_P_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, MODE:=OperatingModes,
PARA:=Parameter, YMAN:=ManualValue,
FEED_FWD:=Disturbance, Y:=ManipulatedVariable,
ERR=>OutputSystemDeviation, STATUS=>StatusOfOutput_Y) ;
PID_P
33002543 10/2013 297
Parameter description PID_P
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter description Mode_PID_P
Data structure description
Parameter Data type Description
SP REAL Reference variable
PV REAL Controlled variable
MODE Mode_PID_P Operating mode
PARA Para_PID_P Parameter
YMAN REAL Manually manipulated value
FEED_FWD REAL Disturbance input
Parameter Data type Description
Y REAL Manipulated variable
Parameter Data type Description
ERR REAL System deviation
STATUS Stat_MAXMIN Y output status
Element Data type Description
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
d_on_pv BOOL "1": D component in relation to the controlled
variable
"0": D component in relation to the system deviation
reverse BOOL "1": Output reversed
PID_P
298 33002543 10/2013
Parameter description Para_PID_P
Data structure description
1
Refer to Initialization Requirements (see page 294).
Parameter description Stat_MAXMIN
Data structure description
Runtime error
An error message is returned if
an invalid floating point number lies at input YMAN or X
ymax < ymin.
NOTE: For a list of all block error codes and values, see Tables of Error Codes for the Obsolete
Library (see page 600).
Element Data type Description
kp REAL Proportional action coefficient (gain = P component)
ki
1
REAL Integral action coefficient (gain = I component) [1/s]
kd REAL Rate of differentiation (gain = D component) [s]
td_lag TIME Delay, D component
ymax REAL Upper limit
ymin REAL Lower limit
Element Data type Description
qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit
PID_P
33002543 10/2013 299
Setting parameters for the PID_P controller
Structure diagram
The following is the structure diagram of the PIDP block:
Parametering
The PID_P control structure is displayed in theStructure diagram, page 299.
Setting parameters for the PID_P controller takes place first of all for the pure PID parameters, that
is to say, the proportional action coefficient kp, the integral action coefficient ki and rate of
differentiation kd.
The P, I and D components can be disabled individually by setting the corresponding input (kp, ki
or kd) to 0.
The D component is delayed by the time constant td_lag. The D component can either be based
upon the system deviation ERR (d_on_pv = "0") or the controlled variable PV (d_on_pv = "1").
Should the D component be determined by the controlled variable PV, then the D component will
not be able to cause jumps when reference variable fluctuations (changes in input SP) take place.
In principle, the D component only affects disturbances and process variances.
PID_P
300 33002543 10/2013
Control direction reversal
Reversed behavior by the controller can be obtained by setting the reverse input. reverse = 0
has the effect that the output value increases with a positive disturbance. reverse = 1 has the
effect that the output value decreases with a positive disturbance.
Manipulated variable limiting
The limits ymax and ymin limit the output within the prescribed range. Therefore ymin Y ymax.
The outputs qmax and qmin signal that the limit value has been reached, i.e. that the output signal
is limited.
qmax = 1 if Y ymax
qmin = 1 if Y ymin
The upper limit ymax for limiting the manipulated variable must be greater than the lower limit
ymin, otherwise the function block reports an error and does not function.
Anti-windup reset
If manipulated variable limiting takes place, the anti-windup reset should make sure that the
integral component cannot exceed all limits. The anti-windup measure is only implemented if the I
component of the controller is not disabled. Anti-windup limits are identical to those for the
manipulated variable. The D component is not taken into consideration for anti-windup measures,
so that peaks, caused by the D component, are not capped by the anti-windup measure.
The anti-windup reset measure corrects the I component in the form, which means:
Selecting the control types
Several controller variants can be selected over the parameters kp, ki and kd:
Controller type kp ki kd
P controller > 0 = 0 = 0
PI controller > 0 > 0 = 0
PD controller > 0 = 0 > 0
PID controller > 0 > 0 > 0
I controller = 0 > 0 = 0
PID_P
33002543 10/2013 301
Operating modes
Selecting the operating modes
There are three operating mode selectable through the man and halt elements:
Automatic operating mode
In automatic mode, the manipulated variable Y is determined through the discrete PID closed-loop
control algorithm subject to controlled variable PV and reference variable SP. The manipulated
variable is limited by ymax and ymin. The control limits are also limits for the Anti-windup reset.
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between ymax and ymin, and Y goes directly to YMAN at the changeover.
If the changeover from automatic to manual is to be bumpless in spite of this, there are two
exemplary possibilities shown for a PID controller (see page 288).
Manual mode
In manual mode the manually manipulated value YMAN is passed on directly to the manipulated
variable Y. However, the manipulated variable is limited by ymax and ymin. Internal variables will
be manipulated in such a manner that the controller changeover from manual to automatic (with I
component enabled) can be bumpless. The control limits are also limits for the Anti-windup reset.
In this operating mode the D component is automatically set to 0.
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
manipulated variable Y, i.e. Y = Y(old). Internal variables will be manipulated in such a manner that
the controller (with I component enabled) can be driven smoothly from its current position. The
control limits are also limits for the Anti-windup reset. The halt operating mode is also useful for
setting the control output Y via an external operator device, whereby the internal components are
tracked correctly in the controller.
In this operating mode the D component is automatically set to 0.
Operating mode man halt
Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1
PID_P
302 33002543 10/2013
Detailed formulas
Explanation of formula variables
Meaning of the variables in the formulas:
Manipulated variable
The manipulated variable is composed of various terms:
After summation of the components manipulated variable limiting takes place, so that:
System deviation
The system deviation will be determined as follows:
ERR = SP - PV, if reverse = 0
ERR = PV - SP, if reverse = 1
Variable Meaning
is the time differential between the current cycle and the previous cycle
System deviation (SP - PV)
System deviation value from the current sampling step
System deviation value from the previous sampling step
FEED_FWD Disturbance variable
Value of controlled variable from the current sampling step
Value of controlled variable from the previous sampling step
Y current output (halt mode) or YMAN (manual mode)
YD D component
YI I component
YP P component
PID_P
33002543 10/2013 303
Overview of the calculation of the control components
Following this an overview on the different calculations of the control components in relation to the
gains kp, ki and kd can be found:
P component YP for manual, halt and automatic modes
I component YI for automatic mode
I component YI for manual and halt modes
D component YD for automatic mode
D component YD for manual and halt modes
P component YP for all operating modes
YP for manual, halt and automatic modes is determined as follows:
I component YI for automatic mode
YI for automatic mode is determined as follows:
For ki > 0 the following applies:
For ki = 0 the following applies:
The I component is formed according to the trapezoid rule.
I component YI for manual and halt modes
YI for manual, halt and automatic modes is determined as follows:
For ki > 0 the following applies:
For ki = 0 the following applies:
PID_P
304 33002543 10/2013
D component YD for automatic mode
YD for automatic mode and cascade is determined as follows:
For kd > 0 and d_on_pv = 0 the following applies:
For kd > 1 and d_on_pv = 0 the following applies:
For kd = 0 the following applies:
D component YD for manual and halt modes
YD for manual, halt and automatic modes is determined as follows:
33002543 10/2013 305
Unity Pro
PIP
33002543 10/2013
PIP: PIP cascade controller
Chapter 32
PIP: PIP cascade controller
Introduction
This chapter describes the PIP block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 306
PIP function block structure diagram 311
Setting parameters for the PIP cascade controller 312
Operating modes 314
Detailed formulas 316
PIP
306 33002543 10/2013
Description
Function description
The function block displays a cascade-controller, consisting of a PI-master controller and a P-sub
controller.
A system deviation ERR is formed by the difference between the reference variable SP and the
controlled variable PV.
The master controller generates a sub controller setpoint value SP2 through this system deviation.
Due to the difference between SP2 and PV2 the sub controller generates the manipulated variable
Y.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
PI as master controller and P as sub controller
Manipulated variable limiting
Anti-windup reset (PI controller)
Operating modes, fixed setpoint control, manual, halt, automatic
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PIP
33002543 10/2013 307
Transfer function
The transmission function for the controller says:
Proportional action coefficient
The proportional action coefficient of the master controller is determined as follows:
Representation in FBD
Representation:
Controller Transfer function
Master controller (PI-controller)
Sub controller (P controller)
PIP
308 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL PIP_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, PV2:=AuxiliaryControlVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualValue, SP_FIX:=FixedValue, OFF:=Offset,
Y:=ManipulatedVariable, ERR=>OutputSystemDeviation,
SP2=>SubControllerSetpointValue,
STATUS=>StatusOfOutput_Y)
PIP
33002543 10/2013 309
Representation in ST
Representation:
PIP_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, PV2:=AuxiliaryControlVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualValue, SP_FIX:=FixedValue, OFF:=Offset,
Y:=ManipulatedVariable, ERR=>OutputSystemDeviation,
SP2=>SubControllerSetpointValue,
STATUS=>StatusOfOutput_Y) ;
PIP parameter description
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter Data type Description
SP REAL Reference variable
PV REAL Controlled variable for the master controller
PV2 REAL Controlled variable for the sub controller (auxiliary
control variable)
MODE Mode_PIP Operating mode
PARA Para_PIP Parameter
YMAN REAL Manual value (of output Y)
SP_FIX REAL Fixed value (reference variable as manual value
for the sub controller)
OFF REAL Offset at the output of the P-controller
Parameter Data type Description
Y REAL Manipulated variable
Parameter Data type Description
ERR REAL System deviation
SP2 REAL Sub controller setpoint value
STATUS Stat_MAXMIN Y output status
PIP
310 33002543 10/2013
Parameter description Mode_PIP
Data structure description
Parameter description Para_PIP
Data structure description
Parameter description Stat_MAXMIN
Data structure description
Runtime error
An error message is returned if
an invalid floating point number lies at input PV, PV2, YMAN or SP_FIX
ymax < ymin.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
fix BOOL "1": Fixed setpoint control
Element Data type Description
gain1 REAL Proportional action coefficient (gain) for PI controller
ti TIME PI controller reset time
gain2 REAL Proportional action coefficient (gain) for P controller
ymax REAL Upper limit
ymin REAL Lower limit
Element Data type Description
qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit
PIP
33002543 10/2013 311
PIP function block structure diagram
Structure diagram
The following is the structure diagram of the PIP block:
PIP
312 33002543 10/2013
Setting parameters for the PIP cascade controller
Structure diagram
Structure diagram of the PIP cascade controller
Parametering
The PIP control structure is displayed in theStructure diagram, page 312.
Setting parameters for the function block takes place firstly through the pure PI parameter, that
is to say the proportional correction value gainl and the reset time ti.
The I component can be disabled by setting ti = 0.
Subsequently setting parameters for the P controller takes place through the proportional
correction value gain2.
Manipulated variable limiting
Manipulated variable limiting takes place at the output of the sub controller, which means:
ymin Y ymax
PIP
33002543 10/2013 313
Anti-windup reset (PI controller)
If manipulated variable limiting takes place, the anti-windup reset should make sure that the
integral component of the master controller "is not able to exceed all limits". The anti-windup
measure can only be used if the I-component of the controller is not disabled (ti = 0).
The anti-windup limits for the PI master controller are adjusted dynamically to the present system
deviation of the sub controller and the ymax and ymin limits.
If manipulated variable limiting takes place, the integral component will be limited as follows:
on reaching the upper limit:
on reaching the lower limit:
PIP
314 33002543 10/2013
Operating modes
Selecting the operating modes
There are four operating mode, which are selected via the elements man, halt and fix:
Automatic operating mode
In the automatic mode, the control output Y is determined through the PI closed-loop control, based
on the controlled variables PV, PV2 and the reference variables SP, SP2. The control output is
limited by ymax and ymin.
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between ymax and ymin, and Y goes directly to YMAN at the changeover.
If the changeover from automatic to manual is to be bumpless in spite of this, there are two
exemplary possibilities shown for a PID controller (see page 288).
Manual mode
The P controller works in manual mode. The PI controller I component is manipulated to permit
bumpless switching.
In the manual mode the manual manipulated value YMAN is passed on directly to the control output
Y. The control output is, however, limited by ymax and ymin. the integral component of the master
controller is tracked in such a way that the controller (on connecting to the I-component) can be
switched bumplessly from manual to automatic.
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
control output Y, i.e. Y = Y(old). Halt mode is also useful in allowing an external operator device to
adjust control output Y. the internal components are so manipulated that the controller can be
driven smoothly from its current position. The control output is, however, limited by ymax and
ymin.
Operating mode man halt fix
Automatic 0 0 0
Manual mode 1 0 or 1 0
Halt 0 1 0
Fixed setpoint control 0 0 1
PIP
33002543 10/2013 315
Fixed setpoint control
In fixed setpoint control mode the P controller works in automatic mode and the PI-controller works
in halt mode.
The fixed setpoint SP_FIX is passed on directly to the control output of the PI controller Y1 (= SP2).
The control output of the PIP controller Y is limited through ymax and ymin. The integral
component of the master controller is tracked in such a way that the controller (on connecting to
the I-component) can be switched smoothly from fixed setpoint control to automatic.
PIP
316 33002543 10/2013
Detailed formulas
Explanation of formula variables
Meaning of the variables in the following formulas:
Overview of the calculation of the control components
There now follows an overview of the varying calculations on control components and outputs for
the various modes:
YI, Y, SP2 in the automatic mode
YI, Y, SP2 in the manual mode
YI, Y, SP2 in the manual mode
YI, Y, SP2 in the fixed setpoint control mode
Automatic operating mode
The output signal Y of the cascade controller is:
The input signal SP2 of the sub controller is:
The integral component Y1 of the master controller for the automatic mode is determined as
follows:
The I component is formed according to the trapezoid rule.
Variable Meaning
is the time differential between the current cycle and the previous cycle
System deviation (SP - PV)
System deviation value from the current sampling step
System deviation value from the previous sampling step
OFF Offset at the output of the P-controller
Y Manipulated variable
Y1 Y of the master controller
YI I component
YP P component
PIP
33002543 10/2013 317
Manual mode
The output signal Y of the cascade controller is:
The input signal SP2 of the sub controller is:
The integral component Y1 of the master controller for the manual mode is determined as follows:
Halt mode
The output signal Y of the cascade controller is:
The input signal SP2 of the sub controller is:
The integral component Y1 of the master controller for the halt mode is determined as follows:
Fixed setpoint control
The output signal Y of the cascade controller is:
The input signal SP2 of the sub controller is:
The integral component Y1 of the master controller for the fixed setpoint control mode is
determined as follows:
PIP
318 33002543 10/2013
33002543 10/2013 319
Unity Pro
PPI
33002543 10/2013
PPI: PPI cascade controller
Chapter 33
PPI: PPI cascade controller
Introduction
This chapter describes the PPI block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 320
PPI function block structure diagram 325
Setting parameters for the PPI cascade controller 326
Operating modes 328
Detailed formulas 329
PPI
320 33002543 10/2013
Description
Function description
The function block displays a cascade-controller, consisting of a P-master controller and a PI-sub
controller.
A system deviation ERR is formed by the difference between the reference variable SP and the
controlled variable PV.
The master controller generates a sub controller setpoint value SP2 through this system deviation.
Due to the difference between SP2 and PV2 the sub controller generates the manipulated variable
Y.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
P as master controller and PI as sub controller
Manipulated variable limiting
Anti-windup reset (PI controller)
Operating modes, fixed setpoint control, manual, halt, automatic
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PPI
33002543 10/2013 321
Transfer function
The transmission function for the controller says:
Proportional action coefficient
The proportional action coefficient is determined as follows:
Representation in FBD
Representation:
Controller Transfer function
Master controller (P-controller)
Sub controller (PI controller)
PPI
322 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL PPI_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, PV2:=AuxiliaryControlVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualValue, SP_FIX:=FixedValue, OFF:=Offset,
Y:=ManipulatedVariable, ERR=>OutputSystemDeviation,
SP2=>SubControllerSetpointValue,
STATUS=>StatusOfOutput_Y)
PPI
33002543 10/2013 323
Representation in ST
Representation:
PPI_Instance (SP:=ReferenceVariable,
PV:=ControlledVariable, PV2:=AuxiliaryControlVariable,
MODE:=OperatingModes, PARA:=Parameter,
YMAN:=ManualValue, SP_FIX:=FixedValue, OFF:=Offset,
Y:=ManipulatedVariable, ERR=>OutputSystemDeviation,
SP2=>SubControllerSetpointValue,
STATUS=>StatusOfOutput_Y) ;
PPI parameter description
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter Data type Description
SP REAL Reference variable for the master controller
PV REAL Controlled variable for the master controller
PV2 REAL Controlled variable for the sub controller (auxiliary
control variable)
MODE Mode_PPI Operating mode
PARA Para_PPI Parameter
YMAN REAL Manual value (of output Y)
SP_FIX REAL Fixed value (reference variable as manual value
for the sub controller)
OFF REAL Offset at the output of the P-controller
Parameter Data type Description
Y REAL Manipulated variable
Parameter Data type Description
ERR REAL System deviation
SP2 REAL Sub controller setpoint value
STATUS Stat_MAXMIN Y output status
PPI
324 33002543 10/2013
Parameter description Mode_PPI
Data structure description
Parameter description Para_PPI
Data structure description
Parameter description Stat_MAXMIN
Data structure description
Runtime error
An error message is returned if
an invalid floating point number lies at input PV, PV2, YMAN or SP_FIX
ymax < ymin.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
fix BOOL "1": Fixed setpoint control
Element Data type Description
gain1 REAL Proportional action coefficient (gain) for P controller
ti TIME PI controller reset time
gain2 REAL Proportional action coefficient (gain) for PI controller
ymax REAL Upper limit
ymin REAL Lower limit
Element Data type Description
qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit
PPI
33002543 10/2013 325
PPI function block structure diagram
Structure diagram
The following is the structure diagram of the PPI block:
PPI
326 33002543 10/2013
Setting parameters for the PPI cascade controller
Block diagram
Block diagram of the PPI cascade controller
Parametering
The PPI control structure is displayed in theBlock diagram, page 326.
Setting parameters for the function block takes place firstly through the proportional correction
value (gain1) and the offset for the output of the p-controller (OFF).
Subsequently setting parameters for the PI controller takes place through the proportional
correction value gain2 and the reset time ti.
The I component can be disabled by setting ti = 0.
The limits ymax and ymin limit the output within the prescribed range.
The outputs qmax and qmin signal that the output has reached a limit, and thus been capped.
qmax = 1, if Y ymax
qmin = 1, if Y ymin
Manipulated variable limiting
After summation of the components manipulated variable limiting takes place, so that: ymin Y
ymax
PPI
33002543 10/2013 327
Anti-windup reset (PI controller)
If manipulated variable limiting takes place, the anti-windup reset should make sure that the
integral component of the master controller "is not able to exceed all limits". The anti-windup
measure can only be used if the I component of the sub-controller is not disabled.
The anti-windup reset takes place if:
Y ymax or Y ymin
In this case, it is:
YI = Y - YP
PPI
328 33002543 10/2013
Operating modes
Selecting the operating modes
There are four operating mode, which are selected via the elements man, halt and fix:
Automatic operating mode
In the automatic mode, the control output Y is determined through the PI closed-loop control, based
on the controlled variables PV, PV2 and the reference variables SP, SP2. The control output is
limited by ymax and ymin.
The changeover from automatic to manual is normally not bumpless, since output Y can take on
any value between ymax and ymin, and Y goes directly to YMAN at the changeover.
If the changeover from automatic to manual is to be bumpless in spite of this, there are two
exemplary possibilities shown for a PID controller (see page 288).
Manual mode
In the manual mode the manual manipulated value YMAN is passed on directly to the control output
Y. The control output is, however, limited by ymax and ymin. Internal variables will be manipulated
in such a manner that the controller changeover from manual to automatic (with I component
enabled) can be bumpless.
Halt mode
In halt mode the control output remains unchanged; the function block does not influence the
control output Y, i.e. Y = Y(old). Halt mode is also useful in allowing an external operator device to
adjust control output Y. the internal components are so manipulated that the controller can be
driven smoothly from its current position. The control output is, however, limited by ymax and
ymin.
Fixed setpoint control
In this operating mode the fixed setpoint SP_FIX is passed on directly to the setpoint input of the
PI controller (SP2). The PI controller works in the automatic mode.
Operating mode man halt fix
Automatic 0 0 0
Manual mode 1 0 or 1 0
Halt 0 1 0
Fixed setpoint control 0 0 1
PPI
33002543 10/2013 329
Detailed formulas
Explanation of formula variables
Meaning of the variables in the following formulas:
Master controller output
The output of the master controller is determined as follows:
Overview of the calculation of the control components
There now follows an overview of the varying calculations on control components and outputs
based on the various modes:
YI and Y in the automatic mode
YI, Y, SP2 in the manual mode
YI, Y, SP2 in the manual mode
YI, YP, Y and SP2 in the fixed setpoint control mode
Automatic operating mode
The output signal Y of the cascade controller is:
The integral component Y1 of the sub controller for the automatic mode is determined as follows:
The I component is formed according to the trapezoid rule.
Variable Meaning
Present sample time
System deviation (SP - PV)
System deviation (SP2-PV2)
System deviation value from the previous sampling step
OFF Offset at the output of the P-controller
Y Manipulated variable
YI I component
YP P component
PPI
330 33002543 10/2013
Manual mode
The output signal Y of the cascade controller is:
The input signal SP2 of the sub controller is:
The integral component Y1 of the sub controller for the manual mode is determined as follows:
Halt mode
The output signal Y of the cascade controller is:
The input signal SP2 of the sub controller is:
The integral component Y1 of the sub controller for the halt mode is determined as follows:
Fixed setpoint control
The output signal Y of the cascade controller is:
The input signal SP2 of the sub controller is:
The integral component Y1 of the sub controller for the fixed setpoint control mode is determined
as follows:
The proportional action coefficient YP is determined as follows:
33002543 10/2013 331
Unity Pro
PWM
33002543 10/2013
PWM: Pulse width modulation
Chapter 34
PWM: Pulse width modulation
Introduction
This chapter describes the PWM block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 332
Detailed description 336
Example for the PWM block 339
PWM
332 33002543 10/2013
Description
Using the block
Actuators are driven not only by analog quantities, but also by binary actuating signals. The
conversion of analog values into binary output signals is achieved for example, through pulse width
modulation (PWM) or pulse duration modulation (PDM).
The actuator adjusted average energy (actuator energy) should be in accord with the modulation
blocks analog input value (IN).
Function description
The PWM function block is used to convert analog values into digital output signals for Unity Pro.
In the pulse width modulation (PWM1) a "1" signal of variable persistence proportional to the analog
value X is output within a fixed cycle period. The adjusted average energy corresponds to the
quotient of the switch on duration T_on and the cycle time t_period.
In order that the adjusted average energy also corresponds to the analog input variable IN, the
following must apply:
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
PWM
33002543 10/2013 333
General information about the actuator drive
In general, the binary actuator drive is performed by two binary signals Y_POS and Y_NEG.
On a motor the output Y_POS corresponds to the signal "clockwise rotation" and the output Y_NEG
the signal "counter-clockwise rotation". For an oven the outputs Y_POS and Y_NEG could be
interpreted as corresponding to "heating" and "cooling".
Should the actuating drive in question be a motor, it is possible that to avoid overtravel for non-self-
locking gearboxes, a brake pulse must be output after the engage signal. In order to protect the
power electronics, there must be a pause time after switching on T_on and before the brake pulse
t_brake to avoid short circuits.
Pulse length formulas for Y_POS and Y_NEG
The pulse length T_on for outputs Y_POS and Y_NEG is determined by the following equations:
Parametering rules
For correct operation the following rules should be observed:

From the parameters up_pos and up_neg only the value is evaluated.
Representation in FBD
Representation:
Output Formula Condition
Y_POS
Y_NEG
PWM
334 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL PWM_Instance (X:=InputVariable, R:=ResetMode,
PARA:=Parameters, Y_POS=>Positive_X_ValueOutput,
Y_NEG=>Negative_X_ValueOutput)
Representation in ST
Representation:
PWM_Instance (X:=InputVariable, R:=ResetMode,
PARA:=Parameters, Y_POS=>Positive_X_ValueOutput,
Y_NEG=>Negative_X_ValueOutput) ;
PWM parameter description
Description of input parameters:
Description of output parameters:
Parameter Data type Description
X REAL Input variable
R BOOL Reset mode ("1" = Reset)
PARA Para_PWM Parameter
Parameter Data type Description
Y_POS BOOL Output for positive X values
Y_NEG BOOL Negative X value output
PWM
33002543 10/2013 335
Parameter description Para_PWM
Data structure description
Runtime error
For a list of all block error codes and values, see CLC_PRO, page 600.
Element Data type Description
t_period TIME Length of period
t_pause TIME Pause time
t_brake TIME Braking time
t_min TIME Minimum actuating pulse time (in sec)
t_max TIME Maximum actuating pulse time (in sec)
up_pos REAL Upper limit value for positive X values
up_neg REAL Upper limit value for negative X values
PWM
336 33002543 10/2013
Detailed description
Block mode of operation
The period determines the time, in which the actuating pulses (1-signal on output Y_POS or Y_NEG)
are regularly output, i.e. in a constant time-slot pattern.
The parameter t_min specifies the minimum pulse length, i.e. the shortest time span for which the
output Y_POS or Y_NEG should carry 1-signal. If the length of the pulse calculated according to the
equation in the section Pulse length formulas for Y_POS and Y_NEG, page 333 is shorter than
t_min, then there will be no pulse throughout the whole period.
The parameter t_max specifies the maximum pulse length, i.e. the time span for which the output
Y_POS or Y_NEG should carry 1-signal. If the value calculated for the pulse duration according to
the above formula is greater than t_max, the pulse duration is limited to t_max. It is advisable to
perform a freely definable pause time of t_pause = 10 or 20 ms between the actuating and brake
pulses to protect the power electronics (hopefully preventing simultaneous firing of the anti-parallel
connected converters).
Parameter t_pause specifies the time interval that should be waited after the "1" signal on output
Y_POS (Y_NEG), before the opposite output Y_NEG (Y_POS) goes to "1" signal for time span
t_brake. The action in question here is a brake pulse, which should take place after the pause
time. A pause time of t_pause = 20 ms (t_pause =0.02) corresponds to an interruption of the
firing angle control for two half waves.
That should guarantee a sufficiently large safety margin for the prevention of short-circuits resp.
triggering of the suppressor circuitry as a consequence of anti-parallel thrystors firing.
PWM
33002543 10/2013 337
Time ratio display
An overview of the ratio between times is shown in the following diagram:
1 Variable turn-on time
The parameters up_pos mark the point of input variable X, with which the output Y_POS would
continuously carry a 1-signal, when the input variable X is positive.
t_pause = t_brake = 0
and
t_max = t_period.
The parameters up_neg mark the point of input variable X, with which the output Y_NEG
continuously carries a 1-signal, when the input variable X is negative.
t_pause = t_brake = 0
and
t_max = t_period.
PWM
338 33002543 10/2013
Time-span dependency
The dependency of the time duration in which the output Y_POS (Y_NEG) carries a 1-signal, on the
input variable X is illustrated in the following diagram (again the figure has put t_pause =
t_brake = 0).
Operating modes
In reset mode R = 1, outputs Y_POS and Y_NEG are set to "0" signal. The internal time meters are
also standardized, so that the function block begins the transfer to R=0 with the output of a new 1
signal on the associated output.
Boundary conditions
If the PWM block is operated together with a PID controller, then the period t_period should be
so selected, that it corresponds to the PID controllers scan time. It is then guaranteed that every
new actuating signal from the PID controller within the period time can be fully processed.
The PWM scan time should be in proportion with the period vs. pulse time. Though this the smallest
possible actuating pulse will be specified.
The following ratio is recommended:
PWM
33002543 10/2013 339
Example for the PWM block
Overview
In the example, the signal sequences on the outputs Y_POS and Y_NEG are shown for various X
input signal values. The examples differ with respect to their selected parameter assignments.
The following examples on the PMW function block are to be found in this section
Jump response 1
Jump response 2
Jump response 1
The following parameter specifications apply to the jump response 1 display:
Jump response 1 timing diagram
X analog signal
Parameters Specification
t_period 4 s
t_min 0.2 s
t_max 3.8 s
t_pause 0.1 s
t_brake 0.2 s
up_pos 10
up_neg 10
PWM
340 33002543 10/2013
It is easily seen that the time span in which output Y_POS carries "1" signal is directly proportional
to input signal X. In addition, it can be seen that a short Y_NEG signal (output Y_NEG to 1-Signal)
follows every Y_POS signal. This can be attributed to the non-"0" t_brake parameters. With
negative X input signals, the signal duration for Y_NEG is proportional X. A short Y_POS pulse as
brake pulse also follows the Y_NEG pulse here as well.
Jump response 2
The following parameter specifications apply to the jump response 2 display:
Jump response 2 timing diagram
X analog signal
Parameters Specification
t_period 4 s
t_min 0.5 s
t_max 4 s
t_pause 0 s
t_brake 0 s
up_pos 10
up_neg 10
PWM
33002543 10/2013 341
In contrast to the example "Jump response 1", here the pause and brake pulses are dropped, as
the appropriate parameters were configured to "0". It is noticeable that pulses are no longer output
for very small X input signals. This is directly attributable to the effect of time t_min. Moreover a
continuous pulse is output for large X input signals (X = up_pos/up_neg). This is related to having
selected t_max = t_period.
PWM
342 33002543 10/2013
33002543 10/2013 343
Unity Pro
QPWM
33002543 10/2013
QPWM: Pulse width modulation (simple)
Chapter 35
QPWM: Pulse width modulation (simple)
Introduction
This chapter describes the QPWM block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 344
Detailed description 347
Example for the QPWM block 349
QPWM
344 33002543 10/2013
Description
Using the block
Actuators are driven not only by analog quantities, but also through binary actuating signals. The
conversion of analog values into binary output signals is achieved for example, through pulse width
modulation ( QPWM) or pulse duration modulation (PDM).
The actuator adjusted average energy (actuator energy) should be in accord with the modulation
blocks analog input value (IN).
Function description
The function block QPWM converts analog values into digital output signals.
In pulse width modulation (QPWM), a 1-signal is emitted, at a constant clock rate, for a duration that
is a function of the analog value. The adjusted average energy corresponds to the quotient of the
switch on duration T_on and the cycle time t_period.
In order that the adjusted average energy also corresponds to the analog input variable IN, the
following must apply:
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
General information about the actuator drive
In general, the binary actuator drive is performed by two binary signals Y_POS and Y_NEG.
On a motor the output Y_POS corresponds to the signal "clockwise rotation" and the output Y_NEG
the signal "counter-clockwise rotation". The outputs Y_POS and Y_NEG for an oven can be
interpreted as corresponding to "heating" and "cooling".
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
QPWM
33002543 10/2013 345
Pulse length formulas for Y_POS and Y_NEG
The pulse length T_on for outputs Y_POS and Y_NEG is determined by the following equations:
Parametering rules
For correct operation when setting parameters the following rules should be observed:
t_min t_period
Representation in FBD
Representation:
Representation in LD
Representation:
Output Formula Condition
Y_POS
Y_NEG
QPWM
346 33002543 10/2013
Representation in IL
Representation:
CAL QPWM_Instance (X:=InputVariable, R:=ResetMode,
PARA:=Parameter, Y_POS=>Positive_X_ValueOutput,
Y_NEG=>Negative_X_ValueOutput)
Representation in ST
Representation:
QPWM_Instance (X:=InputVariable, R:=ResetMode,
PARA:=Parameter, Y_POS=>Positive_X_ValueOutput,
Y_NEG=>Negative_X_ValueOutput) ;
QPWM parameter description
Description of input parameters:
Description of output parameters:
Parameter description Para_QPWM
Data structure description
Runtime error
For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
X REAL Input variable
R BOOL Reset mode ("1" = Reset)
PARA Para_QPWM Parameter
Parameter Data type Description
Y_POS BOOL Output for positive X values
Y_NEG BOOL Negative X value output
Element Data type Description
t_period TIME Length of period
t_min TIME Minimum actuating pulse time (in sec)
x_max REAL Upper limit for positive/negative X values
QPWM
33002543 10/2013 347
Detailed description
Block mode of operation
The period determines the time, in which the actuating pulses (1-signal on output Y_POS or Y_NEG)
are regularly output, i.e. in a constant time-slot pattern.
The parameter t_min specifies the minimum pulse length, i.e. the shortest time span for which the
output Y_POS or Y_NEG should carry 1-signal. If the length of the pulse calculated according to the
equation in the section Pulse length formulas for Y_POS and Y_NEG, page 345 is shorter than
t_min, then there will be no pulse throughout the whole period.
Time ratio display
An overview of the ratio between times is shown in the following diagram:
1 Variable turn-on time
The parameters x_max mark the point of input variable X, with which the output Y_POS would
continuously carry a 1-signal, when the input variable X is positive.
QPWM
348 33002543 10/2013
Time-span dependency
The dependency of the time duration in which the output Y_POS (Y_NEG) carries a 1-signal; the
input variable X is illustrated in the following diagram:
Operating modes
In reset mode R = 1, outputs Y_POS and Y_NEG are set to "0" signal. The internal time meters are
also standardized, so that the function block begins the transfer to R=0 with the output of a new 1
signal on the associated output.
Boundary conditions
If the QPWM block is operated together with a PID controller, then the period t_period should be
so selected, that it corresponds to the PID controllers scan time. It is then guaranteed that every
new actuating signal from the PID controller within the period time can be fully processed.
The QPWM scan time should be in proportion with the period vs. pulse time. The smallest possible
actuating pulse is determined this way.
The following ratio is recommended:
QPWM
33002543 10/2013 349
Example for the QPWM block
Jump response
In the example, the signal sequences on the outputs Y_POS and Y_NEG are shown for various X
input signal values.
The following parameter specifications apply to the jump response display:
Jump response timing diagram
X Analog signal
It is noticeable that pulses are no longer output for very small X input signals. This is directly
attributable to the effect of time t_min. A continuous pulse is output for large X (X = x_max)
signals.
Parameters Specification
t_period 4 s
t_min 0.5 s
x_max 10
QPWM
350 33002543 10/2013
33002543 10/2013 351
Unity Pro
SCON3
33002543 10/2013
SCON3: Three step controller
Chapter 36
SCON3: Three step controller
Introduction
This chapter describes the SCON3 block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 352
Detailed description 355
SCON3
352 33002543 10/2013
Description
Function description
The function block replicates a three-point step controller, and exhibits a PD-like behavior due to
a dynamic feedback path.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block SCON3 has the following properties:
Reset and automatic operating modes
One internal feedback path (delay 1st Order)
Representation in FBD
Representation:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SCON3
33002543 10/2013 353
Representation in LD
Representation:
Representation in IL
Representation:
CAL SCON3_Instance (SP:=SetpointInput, PV:=ProcessVariable,
PARA:=Parameters, R:=ResetModeFlag,
Y_POS=>PosManipulated_ERR_EFF,
Y_NEG=>NegManipulated_ERR_EFF,
ERR_EFF=>EffectiveError)
Representation in ST
Representation:
SCON3_Instance (SP:=SetpointInput, PV:=ProcessVariable,
PARA:=Parameters, R:=ResetModeFlag,
Y_POS=>PosManipulated_ERR_EFF,
Y_NEG=>NegManipulated_ERR_EFF,
ERR_EFF=>EffectiveError) ;
SCON3
354 33002543 10/2013
SCON3 parameter description
Description of input parameters:
Description of output parameters:
Parameter description Para_SCON3
Data structure description
Runtime error
If hys > 2 * db, an error message is shown in the diagnostic viewer (Tools Diagnostic viewer).
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Warning
In the following cases, a warning is shown in the diagnostic viewer (Tools Diagnostic viewer):
gain 0 : The controller operates without feedback response.
ti = 0: The controller operates without feedback response.
t_proc = 0: The controller operates with a predetermined value of t_proc = 60 s.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
SP REAL Setpoint input
PV REAL Actual value input
PARA Para_SCON3 Parameter
R BOOL "1" = Reset mode
Parameter Data type Description
Y_POS BOOL "1" = positive manipulated variable at output
ERR_EFF
Y_NEG BOOL "1" = negative manipulated variable at output
ERR_EFF
ERR_EFF REAL Effective switch value
Element Data type Description
gain REAL Proportional action coefficient (gain)
ti TIME Integral time
t_proc TIME Nominal actuating time of the controlled valve
hys REAL Hysteresis from three point switch
db REAL Dead zone
SCON3
33002543 10/2013 355
Detailed description
Structure of the controller
Structure of the three-point controller:
Dependency of outputs Y_POS and Y_NEG on the variable Y:
Meaning of variable K:
If... Then...
Y = 1 Y_POS = 1
Y_NEG = 0
Y = 0 Y_POS = 0
Y_NEG = 0
Y = -1 Y_POS = 0
Y_NEG = 1
SCON3
356 33002543 10/2013
Principle of the three-point controller
The actual three-point controller will have a dynamic feedback (PT1-element) added. By
appropriately choosing the time constants ti and t_proc of these feedback elements, the three-
point controller exhibits a dynamic behavior corresponding to that of a PID controller.
The gain parameter must be greater than zero.
Dead zone
The parameter db sets the connection point for the outputs Y_POS and Y_NEG. If the effective
switching value ERR_EFF = SP - PV - XR is positive and is greater than db, then the Y_POS output
switches from "0" to "1". If the effective switch value ERR_EFF is negative and is less than db, then
the output Y_NEG will switch from "0" to "1". The parameter db is typically set to 1% of the maximum
control range (max. (SP - PV)).
NOTE: The amount is evaluated from the db dead zone!
Hysteresis
The parameter hys indicates the connector-hysteresis, i.e. the value which the effective switch
value ERR_EFF outgoing from control point db must be reduced by, before the output Y_POS
(Y_NEG) is reset to "0". The connection between Y_POS and Y_NEG depending on the effective
switch value ERR_EFF and the parameters db and hys is illustrated in the image "Principle of the
three-point controller, page 356". The parameter hys is typically set to 0.5 % of the maximum
control range (max. (SP - PV)).
NOTE: The amount is evaluated from the hys hysterisis!
Behavior with faulty time constants
Should the time constant ti = 0 or the proportional action coefficient gain 0 (configuration error),
the block will still continue to operate. The functions feedback path is disabled however, so that the
block operates as a conventional three-point switch.
If the time constant t_proc = 0 (configuration error), the block will still continue to operate. In this
case t_proc is set to a preset value of t_proc = 60s (60 000 msec).
SCON3
33002543 10/2013 357
Operating modes
There are two operating modes that can be selected through the R parameter input:
Operating mode R Meaning
Automatic 0 The function block will be handled as described above.
Reset 1 The internal value of the feedback element is set to SP - PV.
The outputs Y_POS and Y_NEG are both set to "0".
SCON3
358 33002543 10/2013
33002543 10/2013 359
Unity Pro
VLIM
33002543 10/2013
VLIM: Velocity limiter 1st order
Chapter 37
VLIM: Velocity limiter 1st order
Introduction
This chapter describes the VLIM block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 360
Detailed description 363
VLIM
360 33002543 10/2013
Description
Function description
The function block produces a velocity limiter of the 1st order with limiting of the manipulated
variable.
The output Y follows the input X, but at the maximum gradient rate. Furthermore, the Y output is
limited by ymax and ymin. This allows the function block to adjust signals to the technologically
limited pace and limits from controlling elements.
NOTE: This function block performs an internal initialization in the first program cycle after a warm
start or cold start (e.g. application download or power cycle) of the PLC program.
Due to this, you have to make sure that the function block is invoked in the first program cycle. In
case of inkoving the function block in a later program cycle, the internal initialization will not be
performed and the ouputs may deliver wrong values.
EN and ENO can be configured as additional parameters.
Properties
The function block has the following properties:
Operating modes Manual, Halt, Automatic
Manipulated variable limiting
Representation in FBD
Representation:
WARNING
UNEXPECTED OUTPUT BEHAVIOUR
Make sure that the function block is always invoked in the first program cycle.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
VLIM
33002543 10/2013 361
Representation in LD
Representation:
Representation in IL
Representation:
CAL VLIM_Instance (X:=Input, MODE:=OperatingMode,
PARA:=Parameters, YMAN:=ManualManipulatedValue,
Y:=Output, STATUS:=Output_Y_Status)
Representation in ST
Representation:
VLIM_Instance (X:=Input, MODE:=OperatingMode,
PARA:=Parameters, YMAN:=ManualManipulatedValue,
Y:=Output, STATUS:=Output_Y_Status)
VLIM parameter description
Description of input parameters:
Parameter Data type Description
X REAL Input
MODE Mode_MH Operating mode
PARA Para_VLIM Parameter
YMAN REAL Manually manipulated value
VLIM
362 33002543 10/2013
Description of input / output parameters:
Description of output parameters:
Parameter description Mode_VLIM
Data structure description
Parameter description Para_VLIM
Data structure description
Parameter description Stat_MAXMIN
Data structure description
Runtime error
An error message is returned if
an invalid floating point number lies at input YMAN or X,
ymax < ymin.
NOTE: For a list of all block error codes and values, see CLC_PRO, page 600.
Parameter Data type Description
Y REAL Output
Parameter Data type Description
STATUS Stat_MAXMIN Y output status
Element Data type Description
man BOOL "1": Manual mode
halt BOOL "1": Halt mode
Element Data type Description
rate REAL Maximum velocity (maximum x / sec)
ymax REAL Upper limit
ymin REAL Lower limit
Element Data type Description
qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit
VLIM
33002543 10/2013 363
Detailed description
Parametering
The parameter assignments of the function block are defined by the determination of the maximum
gain rate as well as the ymax and ymin thresholds for the Y output. The maximum velocity rate
indicates the maximum by which the output may change within one second.
The amount will be evaluated by the rate parameter.
Exception when rate = 0
If rate = 0 is configured, then the Y output follows the X input immediately (Y=X).
Limits
The limits ymax and ymin limit the output within the prescribed range. Therefore ymin Y ymax.
The outputs qmax and qmin indicate that the output has reached a limit or that the output signal
has been capped.
qmax = 1 if Y ymax
qmin = 1 if Y ymin
Operating modes
There are three operating modes, which are selected via the inputs MAN and HALT:
Operating mode MAN HALT Meaning
Automatic 0 0 The current value for Y is constantly calculated
and displayed.
Manual mode 1 0 or 1 The manual value YMAN will be transmitted fixed
to the output Y. The control output is, however,
limited by ymax and ymin.
Halt 0 1 The output Y will be held at the last value. The
output will no longer be changed, but can be
overwritten by the user.
VLIM
364 33002543 10/2013
Example
Illustration of the dynamic behavior of the VLIM function block.
The function block follows the jump to input X with maximum change in speed (rate). Output Y
remains at a standstill in Halt mode, in order to subsequently move on from the position at which
it has stopped. It is also clear to see the limits of output Y durch ymax and ymin with the relevant
messages qmax and qmin.
33002543 10/2013 365
Unity Pro
Extension/Compatibility
33002543 10/2013
Extension/Compatibility
Part IV
Extension/Compatibility
Overview
This part describes the elementary functions and elementary function blocks in the family
Extension/Compatibility.
What Is in This Part?
This part contains the following chapters:
Chapter Chapter Name Page
38 ADD_***_PL7 : Add a period 369
39 AKF_FL: Detection of any edge 373
40 AKF_TA: Switch off delay 375
41 AKF_TE: Switch-on delay 379
42 AKF_TI: Pulse 383
43 AKF_TS: Storing switch on delay 387
44 AKF_TV: Extended pulse 391
45 AKF_ZR: Decremental counter 395
46 AKF_ZV: Incremental counter 399
47 AKF_ZVR: Incremental/decremental counter 403
48 COMPARE: Comparing two integers 407
49 DATE_DINT_TO_STRING: Conversion of a date (DATE PL7) into a character
string
409
50 DAY_OF_WEEK : Day of the week 411
51 DELTA_***: Difference between two dates 413
52 DT_ARINT_TO_STRING: Converting a PL7 date into a character string 415
53 END: Unconditional end of program 419
54 FIFO: First In/First Out stack register 421
55 FPULSOR: Generation of rectangular signals 427
56 FSTEP_PL7_DRUM : Forcing a drum to a step 431
57 FTOF: Deactivation timer 433
58 FTON: Activation timer 437
59 FTP: Pulse timer 441
60 GET_3X: Read %IW Words (3x-Register) 445
Extension/Compatibility
366 33002543 10/2013
61 GET_4X: Read %MW Words (4x-Register) 447
62 GET_BIT: Reading bit 449
63 HIGH_INT: Extracting the most significant word of a double integer 451
64 IEC_BMDI: Block move 453
65 LIFO: Last In/First Out stack register 461
66 LOW_INT: Extracting the least significant word of a double integer 467
67 MUX_DINTARR_125: Multiplexer for arrays of the data type DIntArr125 469
68 PL7_COUNTER : Counter/downcounter 471
69 PL7_DRUM : Drum 477
70 PL7_MONOSTABLE : Monostable 483
71 PL7_REGISTER_32 : 32 word memory register 489
72 PL7_REGISTER_255 : 255 word memory register 493
73 PL7 and Unity Timers Comparison 497
74 PL7_TOF : TOF type timer 499
75 PL7_TON : TON type timer 505
76 PL7_TP : TP type timer 511
77 PL7_3_TIMER : Conversion timer for % Tis of PL7 517
78 PUT_4X: Write 4x register 523
79 R_INT_WORD: Type conversion (REAL -> INT -> WORD) (R_INT_WORD:
Type conversion (REAL -> INT -> WORD))
525
80 R_UINT_WORD: Type conversion (REAL -> UINT -> WORD)
(R_UINT_WORD: Type conversion (REAL -> UINT -> WORD))
527
81 R2T_***: Register to table 529
82 READ_PCMCIA: Reading data in the memory card 533
83 ROR1_ARB: Right shift of one byte from a table of bytes 539
84 RRTC: Reading the system date 541
85 SCOUNT: Up/down counting with overshoot signaling 543
86 SET_BIT: Set bit 547
87 SET_PCMCIA: Initialization of the archiving zone 549
88 SHL_RBIT_***: Left shift on an integer or double integer 551
89 SHR_RBIT_***: Right shift on an integer or double integer 553
90 SHRZ_***: Right shift on an integer or double integer 555
91 SHRZ_RBIT_***: Right shift on an integer or double integer 557
92 SRCH: Search 559
93 STR_ROUND: Approximate value of a floating point number 565
Chapter Chapter Name Page
Extension/Compatibility
33002543 10/2013 367
94 SUB_***_PL7 : Subtract a period 567
95 SYSSTATE: System state 571
96 T2T: Table to table 573
97 TIME_DINT_TO_STRING: Conversion of a variable to DINT format 579
98 TOD_DINT_TO_STRING: Conversion of a variable to TOD format 581
99 TRANS_TIME: Conversion of a duration into DINT format 583
100 W_INT_REAL: Type conversion (WORD -> INT -> REAL) (W_INT_REAL:
Type conversion (WORD -> INT -> REAL))
585
101 W_UINT_REAL: Type conversion (WORD -> UINT -> REAL) (W_UINT_REAL:
Type conversion (WORD -> UINT -> REAL))
587
102 WRITE_PCMCIA: Writing data to the memory card 589
103 WRTC: Updating the system date 593
Chapter Chapter Name Page
Extension/Compatibility
368 33002543 10/2013
33002543 10/2013 369
Unity Pro
SUB_***_PL7
33002543 10/2013
ADD_***_PL7 : Add a period
Chapter 38
ADD_***_PL7 : Add a period
Description
Description of the function
The ADD_***_PL7 function adds a period to a date or to a time expressed in the DT format or TOD
format of PL7.
The additional parameters EN and ENO can be configured.
Available functions
The available functions are as follows:
ADD_DT_PL7,
ADD_TOD_PL7.
Representation in FBD
Representation applied to a time of day:
Representation in LD
Representation applied to a time of day:
SUB_***_PL7
370 33002543 10/2013
Representation in IL
Representation applied to a time of day:
LD Source_Value
ADD_TOD_PL7 Time_to_Add
ST Result_Value
Representation in ST
Representation applied to a time of day:
Result_Value := ADD_TOD_PL7(Source_Value, Time_to_Add);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
NOTE: management of leap years must be provided for in the application.
Parameter Type Comment
Source_Value DINT,
ARRAY [0..3]
OF INT
Date or time.
Table of 4 integers.
Time_to_Add DINT Period to be added to Source_Value
Note : this time is expressed in the TIME format of PL7
and this with an accuracy of the order of one tenth of a
second. As Source_Value is expressed to the
nearest second, Time_to_Add is rounded to the
nearest second.
Parameter Type Comment
Result_Value DINT,
ARRAY [0..3]
OF INT
Result_Value is of the same type as
Source_Value.
Table of 4 integers.
SUB_***_PL7
33002543 10/2013 371
Execution errors
When Source_Value is in the DINT format (TOD of PL7), there is a change of day if
Result_Value is greater than 24:00:00. In this case the system bit %S18 (see page 609) is set
at 1 and the value of Result_Value is only significant with a modulo 24:00:00.
When Source_Value is in the ARRAY [0..3] OF INT format (DT of PL7) and if Result_Value is
outside the authorized range of values, the system bit %S18 (see page 609) is set at 1 and the
value of Result_Value is also at the maximum limit.
If one of the input parameters cannot be interpreted and is inconsistent with the function format
then the system bit %S18 (see page 609) is set at 1 and Result_Value is:
00:00:00 for the TOD type.
00001-01-01-00:00:00 for the DT type.
SUB_***_PL7
372 33002543 10/2013
33002543 10/2013 373
Unity Pro
AKF_FL
33002543 10/2013
AKF_FL: Detection of any edge
Chapter 39
AKF_FL: Detection of any edge
Description
Function description
The derived function block detects any edge (1 -> 0 and 0 -> 1) on the CLK input.
Output Q is "1" for a cycle if there is a transition from "0" to "1" or a transition from "1" to "0" on CLK;
otherwise it remains "0".
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_FL_Instance (CLK:=ClockInput, Q=>DisplaysAnyEdge)
AKF_FL
374 33002543 10/2013
Representation in ST
Representation:
AKF_FL_Instance (CLK:=ClockInput, Q=>DisplaysAnyEdge) ;
Parameter description
Description of the input parameters:
Description of the output parameters:
Parameters Data type Meaning
CLK BOOL Timing input
Parameters Data type Meaning
Q BOOL Display of any edge
33002543 10/2013 375
Unity Pro
AKF_TA
33002543 10/2013
AKF_TA: Switch off delay
Chapter 40
AKF_TA: Switch off delay
Description
Function description
The derived function block is used as switch off delay.
The delay time comprises a time base ZB and a factor SW. The delay time is calculated from ZB x
SW.
The actual value is displayed at the TIW output and is calculated according to the following formula:
TIW = expired time / ZB
With a 0 -> 1 edge at the IN input, the delay time is transferred to the TSW output and the Q output
is set to "1".
With a 1 -> 0 at the IN input, the internal timer is started and the current state is displayed at the
TIW output. When TIW equals TSW, the Q output is set to "0".
With a 0 -> 1 edge at the R input the internal timer is reset and the Q output is set to "0".
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
AKF_TA
376 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_TA_Instance (IN:=StartingDelay, ZB:=TimeBase,
SW:=FactorDelayTime, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue)
Representation in ST
Representation:
AKF_TA_Instance (IN:=StartingDelay, ZB:=TimeBase,
SW:=FactorDelayTime, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue) ;
AKF_TA
33002543 10/2013 377
Parameter description
Description of input parameters:
Description of output parameters:
Timing diagram
Timing diagram of the TA disconnection delay:
(1) If IN becomes "1", Q becomes "1".
(2) If IN becomes "0", the internal timer (TIW) is started.
(3) If the internal timer TIW reaches the value of TSW, Q becomes "0".
(4) If IN becomes "1", Q becomes "1" and the internal timer is stopped/reset.
(5) If IN becomes "1" before the internal Timer TIW has reached the value of TSW, the internal time is
stopped/reset, without Q becoming "0".
(6) If R becomes "1" and IN is "0", Q becomes "0" and the internal timer is stopped/reset.
(7) If R becomes "1" and IN is "1", Q becomes "0".
(8) If R becomes "0" and IN is "1", Q becomes "1".
(9) If R becomes "1", the internal timer is stopped/reset.
(10) If IN becomes "1" and R is "1", Q remains at "0".
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
IN BOOL Start delay
ZB TIME Time basis of delay time
SW INT Delay time factor
R BOOL Reset input
Parameter Data type Description
Q BOOL Output
TIW INT internal time (actual timer value)
TSW INT Timer setpoint at time of 0 -> 1 edge at IN
AKF_TA
378 33002543 10/2013
33002543 10/2013 379
Unity Pro
AKF_TE
33002543 10/2013
AKF_TE: Switch-on delay
Chapter 41
AKF_TE: Switch-on delay
Description
Function description
The derived function block is used as switch on delay.
The delay time comprises a time base ZB and a factor SW. The delay time is calculated from ZB x
SW.
The actual value is displayed at the TIW output and is calculated according to the following formula:
TIW = expired time / ZB
With a 0 -> 1 edge at the IN input the delay time is transferred to the TSW output, the internal timer
is started, and the current state is displayed at the TIW output.
When TIW equals TSW, the Q output is set to "1".
With a 0 -> 1 edge at the R input or a 1 -> 0 edge at the IN input, the internal timer is reset and the
Q output is set to "0".
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
AKF_TE
380 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_TE_Instance (IN:=StartingDelay, ZB:=TimeBase,
SW:=FactorDelayTime, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue)
Representation in ST
Representation:
AKF_TE_Instance (IN:=StartingDelay, ZB:=TimeBase,
SW:=FactorDelayTime, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue) ;
AKF_TE
33002543 10/2013 381
Parameter description
Description of input parameters:
Description of output parameters:
Timing diagram
Timing diagram for activation delay TE:
(1) If IN becomes "1", the internal timer (TIW) is started.
(2) If the internal timer (TIW) reaches the value of TSW, Q becomes "1".
(3) If IN becomes "0", Q becomes "0" and the internal timer is stopped/reset.
(4) If IN becomes "0" before the internal timer (TIW) has reached the value of TSW, the internal timer is
stopped/reset without Q becoming "1".
(5) If R becomes "1", the internal timer is stopped/reset.
(6) If R becomes "1", Q becomes "0" and the internal timer is stopped/reset.
(7) If IN becomes "1" and R is "1", the internal timer is not started.
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
IN BOOL Start delay
ZB TIME Time basis of delay time
SW INT Delay time factor
R BOOL Reset input
Parameter Data type Description
Q BOOL Output
TIW INT internal time (actual timer value)
TSW INT Timer setpoint at time of 0 -> 1 edge at IN
AKF_TE
382 33002543 10/2013
33002543 10/2013 383
Unity Pro
AKF_TI
33002543 10/2013
AKF_TI: Pulse
Chapter 42
AKF_TI: Pulse
Description
Function description
The derived function block is used to generate a pulse that has a defined maximum duration.
The maximum pulse duration comprises a time base ZB and a factor SW. The maximum pulse
duration is calculated from ZB x SW.
The actual value is displayed at the TIW output and is calculated according to the following formula:
TIW = expired time / ZB
With a 0 -> 1 edge at the IN input, the maximum pulse duration is transferred to the TSW output,
the internal timer is started and the Q output is set to "1".
If TIW equals TSW, the Q output is set to "0", independent of the IN input.
With a 0 -> 1 edge at the R input the internal timer is reset and the Q output is set to "0".
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
AKF_TI
384 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_TI_Instance (IN:=StartingPulse, ZB:=TimeBaseOfPulse,
SW:=FactorOfPulse, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue)
Representation in ST
Representation:
AKF_TI_Instance (IN:=StartingPulse, ZB:=TimeBaseOfPulse,
SW:=FactorOfPulse, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue) ;
AKF_TI
33002543 10/2013 385
Parameter description
Description of input parameters:
Description of output parameters:
Timing diagram
Timing diagram for TI pulse:
(1) If IN becomes "1", Q becomes "1", and the internal timer (TIW) is started.
(2) If the internal timer TIW reaches the value of TSW, Q becomes "0".
(3) If IN becomes "0", the internal timer is stopped/reset.
(4) If IN becomes "0", Q becomes "0" and the internal timer is stopped/reset.
(5) If R becomes "1", Q becomes "0" and the internal timer is stopped/reset.
(6) If R becomes "1", the internal timer, is stopped/reset, independent of IN.
(7) If IN becomes "1" and R is "1", Q remains at "0".
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
IN BOOL Start pulse
ZB TIME Time basis of the pulse
SW INT Pulse factor
R BOOL Reset input
Parameter Data type Description
Q BOOL Output
TIW INT Internal time (actual timer value)
TSW INT Timer setpoint at time of 0 -> 1 edge at IN
AKF_TI
386 33002543 10/2013
33002543 10/2013 387
Unity Pro
AKF_TS
33002543 10/2013
AKF_TS: Storing switch on delay
Chapter 43
AKF_TS: Storing switch on delay
Description
Function description
The derived function block is used as stored switch on delay. Resetting of the output can only be
performed with the R input.
The delay time comprises a time base ZB and a factor SW. The delay time is calculated from ZB x
SW.
The actual value is displayed at the TIW output and is calculated according to the following formula:
TIW = expired time / ZB
With a 0 -> 1 edge at the IN input the delay time is transferred to the TSW output, the internal timer
is started, and the current state is displayed at the TIW output.
When TIW equals TSW, the Q output is set to "1".
With a 0 -> 1 edge at the R input the internal timer is reset and the Q output is set to "0".
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
AKF_TS
388 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_TS_Instance (IN:=StartingDelay, ZB:=TimeBase,
SW:=FactorOfDelay, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue)
Representation in ST
Representation:
AKF_TS_Instance (IN:=StartingDelay, ZB:=TimeBase,
SW:=FactorOfDelay, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue) ;
AKF_TS
33002543 10/2013 389
Parameter description
Description of input parameters:
Description of output parameters:
Timing diagram
Timing diagram for storing activation delay TS
(1) If IN becomes "1", the internal timer (TIW) is started.
(2) If the internal timer (TIW) reaches the value of TSW, Q becomes "1".
(3) Even if IN becomes "0", Q remains "1".
(4) If R becomes "1", the internal timer is stopped/reset and Q is set to "0".
(5) If R becomes "1" before the internal timer (TIW) has reached the value of TSW, the internal timer is
stopped/reset without Q having become "1".
(6) If IN becomes "1" and R is "1", the internal timer is not started.
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
IN BOOL Start delay
ZB TIME Time basis of delay time
SW INT Delay time factor
R BOOL Reset input
Parameter Data type Description
Q BOOL Output
TIW INT internal time (actual timer value)
TSW INT Timer setpoint at time of 0 -> 1 edge at IN
AKF_TS
390 33002543 10/2013
33002543 10/2013 391
Unity Pro
AKF_TV
33002543 10/2013
AKF_TV: Extended pulse
Chapter 44
AKF_TV: Extended pulse
Description
Function description
The derived function block is used to generate an extended pulse.
The pulse duration comprises a time base ZB and a factor SW. The pulse duration is calculated from
ZB x SW.
The actual value is displayed at the TIW output and is calculated according to the following formula:
TIW = expired time / ZB
With a 0 -> 1 edge at the IN input, the pulse duration is transferred to the TSW output, the internal
timer is started and the Q output is set to "1".
The Q output remains at "1", independent of IN, until TIW equals TSW. The Q output is now set to
"0".
With a 0 -> 1 edge at the R input the internal timer is reset and the Q output is set to "0".
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
AKF_TV
392 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_TV_Instance (IN:=StartingPulse, ZB:=TimeBaseOfPulse,
SW:=FactorOfPulse, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue)
Representation in ST
Representation:
AKF_TV_Instance (IN:=StartingPulse, ZB:=TimeBaseOfPulse,
SW:=FactorOfPulse, R:=ResetInput, Q=>Output,
TIW=>InternalTime, TSW=>TimerSetpointValue) ;
AKF_TV
33002543 10/2013 393
Parameter description
Description of input parameters:
Description of output parameters:
Timing diagram
Timing diagram for extended pulse TV:
(1) If IN becomes "1", Q becomes "1", and the internal timer (TIW) is started.
(2) If the internal timer (TIW) reaches the value of TSW, Q becomes "0".
(3) If IN becomes "1" again, the internal timer is restarted and Q becomes "1".
(4) If IN becomes "1" again, the internal timer is restarted and Q remains "1".
(5) If R becomes "1", Q becomes "0", independent of IN, and the internal timer is stopped/reset.
(6) If IN becomes "1" and R is "1", Q remains at "0" and the internal timer is not started.
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
IN BOOL Start pulse
ZB TIME Time basis of the pulse
SW INT Pulse factor
R BOOL Reset input
Parameter Data type Description
Q BOOL Output
TIW INT internal time (actual timer value)
TSW INT Timer setpoint at time of 0 -> 1 edge at IN
AKF_TV
394 33002543 10/2013
33002543 10/2013 395
Unity Pro
AKF_ZR
33002543 10/2013
AKF_ZR: Decremental counter
Chapter 45
AKF_ZR: Decremental counter
Description
Function description
The derived function block is used for downwards counting.
With a "1"signal at the R input, the actual value and the Q output are set to"0".
With a 0 -> 1 edge at the S input, the SW input accepts the setpoint value which is then displayed
at the ZSWO output. The actual value is set to the setpoint value. A comparison of setpoint
value/actual value will not take place until a setpoint value has been accepted at least once.
The Q output is set to "1" if the actual value is greater than "0" and less than the setpoint value.
Given a 0 -> 1 edge at the IN input, the actual value (ZIWO) is decreased by 1 (to 0 as a minimum)
and compared to the setpoint value (ZSWO).
The ZIW and ZSW inputs can be used to change the setpoint value (ZSW) and the actual value (ZIW)
online.
NOTE: In order for the counter to work correctly, the variable (actual value) which is established at
ZIW must also be established at ZIWO. The variable (setpoint), which is established at ZSW has
also to be established at ZSWO.
EN and ENO can be configured as additional parameters.
Formula
Q = 1, if 0 < ZIWO < ZSWO
Representation in FBD
Representation:
AKF_ZR
396 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_ZR_Instance (IN:=TriggerInput, S:=SetInput,
SW:=PresetSetpointValue, R:=ResetInput,
ZIW:=InternalCurrentValueControl,
ZSW:=InternalSetpointValueControl, Q=>Output,
ZIWO=>DisplayCurrentValue, ZSWO=>DisplaySetpointValue)
Representation in ST
Representation:
AKF_ZR_Instance (IN:=TriggerInput, S:=SetInput,
SW:=PresetSetpointValue, R:=ResetInput,
ZIW:=InternalCurrentValueControl,
ZSW:=InternalSetpointValueControl, Q=>Output,
ZIWO=>DisplayCurrentValue, ZSWO=>DisplaySetpointValue) ;
AKF_ZR
33002543 10/2013 397
Parameter description
Description of input parameters:
Description of output parameters:
Timing diagram
Timing diagram for AKF_ZR backwards counter:
(1) If S becomes "1" and R is "0", the preset setpoint value SW is accepted and displayed at the ZSWO output.
(2) If IN becomes "1", the actual counter value is decreased by "1" and Q set to "1".
(3) If IN becomes "1", the current counter value is decreased by "1".
(4) If IN becomes "1", the current counter value is decreased by "1". If this causes the counter value (ZIWO)
to become "0", the Q output is set to "0".
(5) If R becomes "1", the current counter value is set to "0".
(6) If S becomes "1" and R is "0", the preset setpoint value SW is accepted and Q is set to "0".
Parameter Data type Description
IN BOOL Trigger input
S BOOL Set input
SW INT Preset setpoint value
R BOOL Reset input
ZIW INT Control of the internal actual value
ZSW INT Control of internal setpoint value
Parameter Data type Description
Q BOOL Output
ZIWO INT Count value (display of actual value)
ZSWO INT Display of setpoint value
AKF_ZR
398 33002543 10/2013
33002543 10/2013 399
Unity Pro
AKF_ZV
33002543 10/2013
AKF_ZV: Incremental counter
Chapter 46
AKF_ZV: Incremental counter
Description
Function description
The derived function block is used for incrementing.
With a "1"signal at the R input, the actual value and the Q output are set to"0".
With a 0 -> 1 edge at the S input, the SW input accepts the setpoint value which is then displayed
at the ZSWO output. The actual value is set to "0". A comparison of setpoint value/actual value will
not take place until a setpoint value has been accepted at least once.
The Q output is set to "1" if the actual value is greater than "0" and less than the setpoint value.
In the case of -> 1 edge at the IN input, the actual value (ZIWO) is increased by 1 and compared
to the setpoint value (ZSWO).
The ZIW and ZSW inputs can be used to change the setpoint value (ZSW) and the actual value (ZIW)
online.
NOTE: In order for the counter to work correctly, the variable (actual value) which is established at
ZIW must also be established at ZIWO. The variable (setpoint), which is established at ZSW has
also to be established at ZSWO.
EN and ENO can be configured as additional parameters.
Formula
Q = 1, if 0 < ZIWO < ZSWO
Representation in FBD
Representation:
AKF_ZV
400 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
CAL AKF_ZV_Instance (IN:=TriggerInput, S:=SetInput,
SW:=PresetSetpointValue, R:=ResetInput,
ZIW:=InternalCurrentValueControl,
ZSW:=InternalSetpointValueControl, Q=>Output,
ZIWO=>DisplayCurrentValue, ZSWO=>DisplaySetpointValue)
Representation in ST
Representation:
AKF_ZV_Instance (IN:=TriggerInput, S:=SetInput,
SW:=PresetSetpointValue, R:=ResetInput,
ZIW:=InternalCurrentValueControl,
ZSW:=InternalSetpointValueControl, Q=>Output,
ZIWO=>DisplayCurrentValue, ZSWO=>DisplaySetpointValue) ;
AKF_ZV
33002543 10/2013 401
Parameter description
Description of input parameters:
Description of output parameters:
Parameter Data type Description
IN BOOL Trigger input
S BOOL Set input
SW INT Preset setpoint value
R BOOL Reset input
ZIW INT Control of the internal actual value
ZSW INT Control of internal setpoint value
Parameter Data type Description
Q BOOL Output
ZIWO INT Count value (display of actual value)
ZSWO INT Display of setpoint value
AKF_ZV
402 33002543 10/2013
Timing diagram
Timing diagram for Incremental counter AKF_ZVR:
(1) If IN becomes "1" and R is "0", the actual value is increased by "1" and Q is set to "1".
(2) If R becomes "1", the actual value and Q are set to "0".
(3) If S becomes "1", the preset setpoint value is accepted.
(4) If IN becomes "1", the actual value is increased by "1". If this causes the actual value to reach the setpoint
value, Q is set to "0".
(5) If IN becomes "1", the actual value is increased by "1".
(6) If S becomes "1", the preset setpoint value is accepted and the actual value is set to "0".
(7) If S becomes "1", the preset setpoint value is accepted, and the actual value and Q are set to "0".
33002543 10/2013 403
Unity Pro
AKF_ZVR
33002543 10/2013
AKF_ZVR: Incremental/decremental counter
Chapter 47
AKF_ZVR: Incremental/decremental counter
Description
Function description
The derived function block is used for incrementing/decrementing.
With a "1"-signal at the R input, the actual value and the Q output are set to"0".
With a 0 -> 1 edge at the S input, the SW input accepts the setpoint value which is then displayed
at the ZSWO output. The actual value does not change. A comparison of setpoint value/actual value
will not take place until a setpoint value has been accepted at least once.
The Q output is set to "1" if the actual value is greater than or equal to the setpoint.
In the case of -> 1 edge at the IN_F input, the actual value (ZIWO) is increased by 1 and compared
to the setpoint value (ZSWO).
In the case of -> 1 edge at the IN_B input, the actual value (ZIWO) is decreased by 1 and compared
to the setpoint value (ZSWO).
The ZIW and ZSW inputs can be used to change the setpoint value (ZSW) and the actual value (ZIW)
online.
NOTE: In order for the counter to work correctly, the variable (actual value) which is established at
ZIW must also be established at ZIWO. The variable (setpoint), which is established at ZSW has
also to be established at ZSWO.
EN and ENO can be configured as additional parameters.
Formula
Q = 1, if ZIWO ZSWO
AKF_ZVR
404 33002543 10/2013
Representation in FBD
Representation:
Representation in LD
Representation:
AKF_ZVR
33002543 10/2013 405
Representation in IL
Representation:
CAL AKF_ZVR_Instance (IN_F:=TriggerInputIncrementing,
IN_B:=TriggerInputDecrementing, S:=SetInput,
SW:=PresetSetpointValue, R:=ResetInput,
ZIW:=InternalCurrentValueControl,
ZSW:=InternalSetpointValueControl, Q=>Output,
ZIWO=>DisplayCurrentValue, ZSWO=>DisplaySetpointValue)
Representation in ST
Representation:
AKF_ZVR_Instance (IN_F:=TriggerInputIncrementing,
IN_B:=TriggerInputDecrementing, S:=SetInput,
SW:=PresetSetpointValue, R:=ResetInput,
ZIW:=InternalCurrentValueControl,
ZSW:=InternalSetpointValueControl, Q=>Output,
ZIWO=>DisplayCurrentValue, ZSWO=>DisplaySetpointValue) ;
Parameter description
Description of the input parameters:
Description of the output parameters:
Parameters Data type Meaning
IN_F BOOL Trigger input, incrementing
IN_B BOOL Trigger input, decrementing
S BOOL Set input
SW INT Preset setpoint value
R BOOL Reset input
ZIW INT Control of the internal actual value
ZSW INT Control of internal setpoint value
Parameters Data type Meaning
Q BOOL Output
ZIWO INT Count value (display of actual value)
ZSWO INT Display of setpoint value
AKF_ZVR
406 33002543 10/2013
Timing diagram
Timing diagram for Incremental counter AKF_ZVR
(1) If IN_F becomes "1" and R is "0", the current value is increased by "1".
(2) If IN_B becomes "1" and R is "0", the actual value is decreased by "1".
(3) If S becomes "1", the preset setpoint value is accepted.
(4) If IN_F becomes "1" and R is "0", the current value is increased by "1". If this causes the actual value to
reach the setpoint value, Q is set to "1".
(5) If R becomes "1", the actual value and Q are set to "0".
(6) If IN_B becomes "1" and R is "0", the actual value is decreased by "1". If this causes the actual value to fall
below the setpoint value, Q is set to "0".
(7) If IN_B becomes "1" and R is "0", the actual value is decreased by "1". If this causes the actual value to
reach the setpoint value, Q is set to "1".
33002543 10/2013 407
Unity Pro
COMPARE
33002543 10/2013
COMPARE: Comparing two integers
Chapter 48
COMPARE: Comparing two integers
Description
Function description
The function COMPARE performs a comparison between two integers.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
COMPARE
408 33002543 10/2013
Representation in IL
Representation:
LD Valid
COMPARE Value1, Value2, Greater_Than, Equal_Values, Less_Than,
Different_Values
Representation in ST
Representation:
COMPARE(Valid, Value1, Value2, Greater_Than, Equal_Values, Less_Than,
Different_Values);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Enable BOOL Validation input. The comparison only takes
place if this input is 1.
Value1 INT First value to compare.
Value2 INT Second value to compare.
Parameter Type Comment
Greater_Than BOOL If Value1 > Value2 then
Greater_Than = 1
Otherwise
Greater_Than = 0
Equal_Values BOOL If Value1 = Value2 then
Equal_Values = 1
Otherwise
Equal_Values = 0
Less_Than BOOL If Value1 < Value2 then
Less_Than = 1
Otherwise
Less_Than = 0
Different_Values BOOL If Value1 Value2 then
Different_Values = 1
Otherwise
Different_Values = 0
33002543 10/2013 409
Unity Pro
DATE_DINT_TO_STRING
33002543 10/2013
DATE_DINT_TO_STRING: Conversion of a date (DATE PL7) into a character string
Chapter 49
DATE_DINT_TO_STRING: Conversion of a date (DATE
PL7) into a character string
Description
Description of the function
The function DATE_DINT_TO_STRING is used to convert a PL7 date (double word) into a
character string.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Date1
DATE_DINT_TO_STRING
ST Result_Str
DATE_DINT_TO_STRING
410 33002543 10/2013
Representation in ST
Representation:
Result_Str:= DATE_DINT_TO_STRING(Date1);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Runtime errors
If the string Result_Str is too short to contain the date (length = less than 10 characters), the
date is truncated and the bit %S15 (see page 609) is set to 1.
If Date1 cannot be interpreted and is not consistent in DATE format, the system bit %S18
(see page 609) is set to 1 and Result_Str =YYYY-MM-DD.
Parameter Type Comment
Date1 DINT PL7 date to convert into character string format.
Parameter Type Comment
Result_Str STRING Result_Str is a string of 10 characters containing a date (not
including the time) in the following format: YYYY-MM-DD.
Example: 2000-12-27
33002543 10/2013 411
Unity Pro
DAY_OF_WEEK
33002543 10/2013
DAY_OF_WEEK : Day of the week
Chapter 50
DAY_OF_WEEK : Day of the week
Description
Description of the function
The function DAY_OF_WEEK provides the result of the day of the week, in the form of a whole
number:
1 for Monday,
2 for Tuesday,
3 for Wednesday,
4 for Thursday,
5 for Friday,
6 for Saturday,
7 for Sunday.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
DAY_OF_WEEK
412 33002543 10/2013
Representation in IL
Representation:
DAY_OF_WEEK
ST Out_Day_Of_Week
Representation in ST
Representation:
Out_Day_Of_Week := DAY_OF_WEEK();
Description of parameters
The following table describes the output parameters:
Runtime errors
If the function cannot update the result following a real-time clock access error, the result sent back
is 0 and the system bit %S18 (see page 609) is set to 1.
Parameter Type Comment
Out_Day_Of_Week INT Whole number from 1 to 7 indicating the day of the
week:
1 for Monday,
2 for Tuesday,
3 for Wednesday,
4 for Thursday,
5 for Friday,
6 for Saturday,
7 for Sunday.
33002543 10/2013 413
Unity Pro
DELTA_***
33002543 10/2013
DELTA_***: Difference between two dates
Chapter 51
DELTA_***: Difference between two dates
Description
Description of the function
The DELTA_*** function calculates the time variation between two dates or times in PL7 format.
The additional parameters EN and ENO can be configured.
Available functions
The available functions are as follows:
DELTA_D,
DELTA_DT,
DELTA_TOD.
Representation in FBD
Representation applied to a time of day:
Representation in LD
Representation applied to a time of day:
DELTA_***
414 33002543 10/2013
Representation in IL
Representation applied to a time of day:
LD Input_IN1
DELTA_TOD Input_IN2
ST Delay1
Representation in ST
Representation applied to a time of day:
Delay1:= DELTA_TOD(Input_IN1, Input_IN2);
Description of parameters
The following table describes the input parameters:
NOTE: Input_IN1 and Input_IN2 must be of the same type.
The following table describes the output parameters:
Runtime errors
If Delay1 exceeds the maximum value allowed for a DINT format, an overflow occurs, in which
case Delay1 = 0 and the system bit %S18 (see page 609) is set to 1.
If one of the input parameters cannot be interpreted and is inconsistent with the function format,
then Delay1 = 0 and the system bit %S18 (see page 609) is set to 1.
Parameter Type Comment
Input_IN1 DINT,
ARRAY
[0...3] OF
INT
Date or time for which we wish to calculate the variation
from Input_IN2.
Input_IN2 DINT,
ARRAY
[0...3] OF
INT
Date or time for which we wish to calculate the variation
from Input_IN1
Parameter Type Comment
Delay1 DINT Delay1 contains the absolute value of the time elapsed
between the two inputs Input_IN1 and Input_IN2.
Note: this time is expressed with a precision of a tenth
of second.
33002543 10/2013 415
Unity Pro
DT_ARINT_TO_STRING
33002543 10/2013
DT_ARINT_TO_STRING: Converting a PL7 date into a character string
Chapter 52
DT_ARINT_TO_STRING: Converting a PL7 date into a
character string
Description
Description of the function
The function DT_ARINT_TO_STRING converts a PL7 date (table of four words) into a character
string.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Date1
DT_ARINT_TO_STRING
ST Result_Str
DT_ARINT_TO_STRING
416 33002543 10/2013
Representation in ST
Representation:
Result_Str:= DT_ARINT_TO_STRING(Date1);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Runtime errors
If the string Result_Str is too short to contain the date (length = less than 19 characters), the
date is truncated and the bit %S15 (see page 609) is set to 1.
If Date1 cannot be interpreted and is not consistent, the system bit %S18 (see page 609) is set to
1 and Result_Str =YYYY-MM-DD-HH:MM:SS.
Parameter Type Comment
Date1 ARRAY [0..3]
of INT
PL7 date (table of 4 words) to convert into character string format.
Parameter Type Comment
Result_Str STRING Result_Str is a string of 19 characters containing a date (including
the time) in the following format: YYYY-MM-DD-HH:MM:SS.
Example: 2000-12-27-23:15:50
DT_ARINT_TO_STRING
33002543 10/2013 417
PL7 DATE_AND_TIME format
The PL7 DATE_AND_TIME (DT) format is displayed as follow:
yyyy-mm-dd-hh:mm:ss
example 2000-05-18-15:45:22
the value is BCD coded on 64 bit. The result is an array of 4 integers.
With the previous example in hexadecimal.
NOTE: Only the DT included between [1990-01-01-00:00:00, 2099-12-31-23:59:59] are allowed.
DT_ARINT_TO_STRING
418 33002543 10/2013
33002543 10/2013 419
Unity Pro
END
33002543 10/2013
END: Unconditional end of program
Chapter 53
END: Unconditional end of program
Description
Function description
The END function in an application program is used to define the end of the execution of a program
cycle.
By default (normal mode), when the end of program is activated, outputs are updated and the
program switches to the next cycle.
If polling is periodic, outputs are updated and the program waits until the end of the period then
switches to the next cycle.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
END
420 33002543 10/2013
Representation in IL
Representation:
CAL END
Representation in ST
Representation:
END ();
33002543 10/2013 421
Unity Pro
FIFO
33002543 10/2013
FIFO: First In/First Out stack register
Chapter 54
FIFO: First In/First Out stack register
Introduction
This chapter describes the FIFO block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 422
Detailed description 425
FIFO
422 33002543 10/2013
Description
Function description
This function block is a first in first out stack register.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
FIFO
33002543 10/2013 423
Representation in IL
Representation:
CAL FIFO_Instance (R:=ClearedStackRegister, SET:=WriteValue,
GET:=ReadValue, X:=StackRegisterInput,
N_MAX:=MaxNumberInStack, FULL=>StackRegisterFull,
EMPTY=>StackRegisterEmpty, Y=>StackRegisterOutput)
Representation in ST
Representation:
FIFO_Instance (R:=ClearedStackRegister, SET:=WriteValue,
GET:=ReadValue, X:=StackRegisterInput,
N_MAX:=MaxNumberInStack, FULL=>StackRegisterFull,
EMPTY=>StackRegisterEmpty, Y=>StackRegisterOutput) ;
Parameter description
Description of input parameters:
Parameter Data type Description
R BOOL 1 = stack register will be cleared
SET BOOL 1 = write value to stack register
GET BOOL 1 = read value from stack register
X ANY should be an
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
Stack register input
N_MAX UINT Maximum number of elements in the stack register
FIFO
424 33002543 10/2013
Description of output parameters:
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
FULL BOOL 1= stack register is full, no further elements can be
put in the stack register
EMPTY BOOL 1 = stack register is empty (number of elements in
the stack register = 0)
Y ANY should be an
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
Stack register output
FIFO
33002543 10/2013 425
Detailed description
Function mode of operation
FIFO is a first in/first out stack register.
The index and stack register are invisible to the user. The stack register is part of the internal state
and can accept up to 2000 bytes with data (i.e. 1000 INT or 500 REAL or 500 TIME elements).
The function block has two Boolean inputs, GET and SET, that are used to either read a value from
or write a value to the stack register. If GET and SET are set simultaneously, SET (write) will be
executed before GET (read). The stack register is cleared when R(eset) = 1.
The input parameters checking the stack must be set in a meaningful order to allow the function
block to work properly.
A meaningful order is, for example:
The N_MAX parameter provides the maximum number of elements in the stack register.
In a full stack register (number of elements in the stack register = N_MAX <= 2000 / (size of (X)),
FULL is set to 1 and no more elements can be placed in the stack register. If the stack register is
empty (number of elements in the stack register = 0), then EMPTY is set to 1. The function has an
X input and a Y input for various elementary data types.
X and Y are type ANY, which implies a predefined length. Due to the limited size of the internal stack
register, only input and output types with an element size equal to or smaller than 200 bytes are
accepted. Otherwise a runtime error occurs and an error message is generated that sets ENO to 0.
Cycle Parameters Result
Cycle n R=0, SET=0, GET=0 Stack not initialized
Cycle n+1 R=1, SET=0, GET=0 Stack initialized
Cycle n+2 R=0, SET=0, GET=0 End initializing
Cycle n+3 R=0, SET=1, GET=0 Loading stack with x values
Cycle n+x+1 R=0, SET=0, GET=0 End loading
Cycle n+x+2 R=0, SET=0, GET=1 Getting x values
Cycle n+x+2+x R=0, SET=0, GET=1 Stack not empty
FIFO
426 33002543 10/2013
33002543 10/2013 427
Unity Pro
FPULSOR
33002543 10/2013
FPULSOR: Generation of rectangular signals
Chapter 55
FPULSOR: Generation of rectangular signals
Subject of this Chapter
This Chapter describes the function FPulsor.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 428
Detailed description of the operation of the FPULSOR function 430
FPULSOR
428 33002543 10/2013
Description
Description of the function
The function FPULSOR generates a periodic rectangular signal for which it is possible to vary the
pulse width at 1 and at 0 using the program.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Enable
FPULSOR Rise_Time, Fall_Back_Time, Mem_Double_W, OUT_Pulsor,
Current_Value
FPULSOR
33002543 10/2013 429
Representation in ST
Representation:
FPULSOR(Enable, Rise_Time, Fall_Back_Time, Mem_Double_W, OUT_Pulsor,
Current_Value);
Description of parameters
The following table describes the input parameters:
The following table describes the input/output parameters:
The following table describes the output parameters:
NOTE: a modification of the Rise_Time and the Fall_Back_Time is taken into account even
during the time out. The sum of Rise_Time + Fall_Back_Time has a maximum duration of 5
minutes and 27 seconds (32700).
Parameter Type Comment
Enable BOOL Validation input. The function starts on the
rising edge of Enable and is only executed if
Enable = 1
Rise_Time INT Input word that determines the duration (in
hundredths of a second) of the pulse at 1. This
is used to define a maximum duration of 5 mins
and 27 secs, precise to 10 ms.
Fall_Back_Time INT Input word that determines the duration (in
hundredths of a second) of the pulse at 0. This
is used to define a maximum duration of 5 mins
and 27 secs, precise to 10 ms.
Parameter Type Comment
Mem_Double_W DINT Double word for storing internal statuses. It is
imperative that this word be used in order for the
function to operate.
Parameter Type Comment
OUT_Pulsor EBOOL Pulse output at 0 for the duration of
Fall_Back_Time and at 1 for the duration of
Rise_Time.
Current_Value INT Output word that increases from 0 to
Rise_Time + Fall_Back_Time as the timer
counts (in hundredths of a second).
FPULSOR
430 33002543 10/2013
Detailed description of the operation of the FPULSOR function
Timing diagram
Timing diagram.
Operation
The following table describes the operation of the FPULSOR function:
Phase Action Description
1 Rising edge on the
Enable input
The generation of the rectangular signal is launched: (if the
signal is not already increasing) its current value increases by
0 towards Rise_Time+Fall_Back_Time (in hundredths of
seconds).
2 As long as the
Fall_Back_Time
time out has not run
out
The output bit OUT_Pulsor remains at 0.
3 Fall_Back_Time
has elapsed,
Rise_Time is
activated
The output bit OUT_Pulsor changes to 1 until the end of
Rise_Time and the generator loops on steps 2 and 3.
4 Enable switches to 0 Rise_Time and Fall_Back_Time are reset to 0, and the
output OUT_Pulsor switches to 0.
33002543 10/2013 431
Unity Pro
FSTEP_PL7_DRUM
33002543 10/2013
FSTEP_PL7_DRUM : Forcing a drum to a step
Chapter 56
FSTEP_PL7_DRUM : Forcing a drum to a step
Description
Description of the function
The FSTEP_PL7_DRUM function positions the drum (see page 477) selected at a defined step.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Step_value
FSTEP_PL7_DRUM Drum_instance
FSTEP_PL7_DRUM
432 33002543 10/2013
Representation in ST
Representation:
FSTEP_PL7_DRUM (Step_value, Drum_instance);
Description of parameters
The following table describes the input parameters:
Execution errors
If the number of the step transmitted does not exist (number higher than or equal to the step
number of the drum), the %S18 (see page 609) bit is set at 1.
Parameter Type Comment
Step_value INT Value of 0 to LEN-1 of the step to be forced.
LEN = Drum step number
Drum_instance PL7_DRUM Instance of the drum on which the function applies.
33002543 10/2013 433
Unity Pro
FTOF
33002543 10/2013
FTOF: Deactivation timer
Chapter 57
FTOF: Deactivation timer
Subject of this Chapter
This Chapter describes the function FTOF.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 434
Detailed description of the operation of the FTOF function 436
FTOF
434 33002543 10/2013
Description
Function description
The function FTOF is a deactivation timer.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Enable
FTOF Presel_Value, Mem_Word, OUT_Ftof, Current_Value
Representation in ST
Representation:
FTOF(Enable, Presel_Value, Mem_Word, OUT_Ftof, Current_Value);
FTOF
33002543 10/2013 435
Description of the parameters
The following table describes the input parameters:
The following table describes the input/output parameters:
The following table describes the output parameters:
Parameter Type Comment
Enable BOOL "Arming" input, on the falling edge the time out starts.
Presel_Value INT Preset value that determines the duration (in
hundredths of a second) of the time out. The
maximum authorized duration is 5 minutes and 27
seconds, precise to 10 ms.
Note: Modification of the Presel_Value during the
time out is immediately taken into account.
Parameter Type Comment
Mem_Word DINT Double integer used in input and output which enables
internal statuses to be stored.
Be careful not to use this variable in another part of the
application.
Parameter Type Comment
OUT _Ftof EBOOL Output set to 1 on rising edge of Enable and set to 0
at end of time out.
Current_Value INT Current value of the time out (in hundredths of a
second). This variable increases from 0 to
Presel_Value when the timer is launched.
FTOF
436 33002543 10/2013
Detailed description of the operation of the FTOF function
Timing diagram
Timing diagram.
Operation
The following table describes the operation of the FTOF function:
Phase Action Description
1 Rising edge on the
Enable input
The current value takes the value 0 (even if the timer is running),
and the OUT_Ftof output bit switches to 1 (or stays at 1).
2 During the rising edge
of the Enable input
The timer is launched, and the current value increases from 0 to
the Presel_Value (in hundredths of seconds).
3 When the current
value has reached the
Presel_Value
The OUT_Pulsor output bit returns to 0.
33002543 10/2013 437
Unity Pro
FTON
33002543 10/2013
FTON: Activation timer
Chapter 58
FTON: Activation timer
Subject of this Chapter
This Chapter describes the function FTON.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 438
Detailed description of the operation of the FTON function 440
FTON
438 33002543 10/2013
Description
Function description
The function FTON is an activation timer.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Enable
FTON Presel_Value, Mem_Word, OUT_Fton, Current_Value
Representation in ST
Representation:
FTON(Enable, Presel_Value, Mem_Word, OUT_Fton, Current_Value);
FTON
33002543 10/2013 439
Description of the parameters
The following table describes the input parameters:
The following table describes the input/output parameters:
The following table describes the output parameters:
Parameter Type Comment
Enable BOOL "Arming" input, on the rising edge the timer starts.
Presel_Value INT Preset value that determines the duration (in
hundredths of a second) of the time out. The
maximum authorized duration is 5 minutes and 27
seconds, precise to 10 ms.
Note: Modification of the Presel_Value during
the time out is immediately taken into account.
Parameter Type Comment
Mem_Word DINT Double integer used in input and output which
enables internal statuses to be stored.
Be careful not to use this variable in another part
of the application.
Parameter Type Comment
OUT_Fton EBOOL Output set to 1 at the end of time out.
Current_Value INT Current value of the time out (in hundredths of a
second). This variable increases from 0 to
Presel_Value when the timer is launched.
FTON
440 33002543 10/2013
Detailed description of the operation of the FTON function
Timing diagram
Timing diagram.
Operation
The following table describes the operation of the FTON function:
Phase Action Description
1 Rising edge on the
Enable input
The timer is launched and its current value
Current_Value increases by 0 towards
Presel_Value (in hundredths of seconds).
2 The current value has
reached
Presel_Value
The output bit OUT_Fton switches to 1, then remains at 1
as long as the Enable input is at 1.
3 The Enableinput is at 0 The timer is stopped even if in run mode, and the
Current_Value becomes 0.
33002543 10/2013 441
Unity Pro
FTP
33002543 10/2013
FTP: Pulse timer
Chapter 59
FTP: Pulse timer
Subject of this Chapter
This Chapter describes the function FTP.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 442
Detailed description of the operation of the FTP function 444
FTP
442 33002543 10/2013
Description
Function description
The function FTP is a timer which enables a pulse of a precise and programmable duration to be
obtained.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Enable
FTP Presel_Value, Mem_Word, OUT_FTP, Current_Value
Representation in ST
Representation:
FTP(Enable, Presel_Value, Mem_Word, OUT_FTP, Current_Value);
FTP
33002543 10/2013 443
Description of the parameters
The following table describes the input parameters:
The following table describes the input/output parameters:
The following table describes the output parameters:
Parameter Type Comment
Enable BOOL "Arming" input, on the falling edge the time out starts.
Presel_Value INT Preset value that determines the duration (in
hundredths of a second) of the time out. The
maximum authorized duration is 5 minutes and 27
seconds, precise to 10 ms.
Note: Modification of the Presel_Value during the
time out is immediately taken into account.
Parameter Type Comment
Mem_Word DINT Double integer used in input and output which
enables internal statuses to be stored.
Be careful not to use this variable in another part of
the application.
Parameter Type Comment
OUT_FTP EBOOL Output set to 0 at the end of time out.
Current_Value INT Current value of the time out (in hundredths of a
second). This variable increases from 0 to
Presel_Value when the timer is launched.
FTP
444 33002543 10/2013
Detailed description of the operation of the FTP function
Timing diagram
Timing diagram.
Operation
The following table describes the operation of the FTP function:
Phase Action Description
1 Rising edge on the EN input The timer is launched (if it is not already running) and the
current value Current_Value increases from 0 to the
Presel_Value (in hundredths of seconds). The OUT_FTP
output bit switches to 1.
2 When the current value has
reached the
Presel_Value
The OUT_FTP output bit returns to 0.
3 The Enable input and the
OUT_FTP output are at 0
Presel_Value takes the value 0.
33002543 10/2013 445
Unity Pro
GET_3X
33002543 10/2013
GET_3X: Read %IW Words (3x-Register)
Chapter 60
GET_3X: Read %IW Words (3x-Register)
Description
Function description
This function writes values from the %IW register area (3x) of the state RAM to the variable that is
connected to the output pin.
Offset is an offset in the %IW register memory (3x).
The function copies as many bytes as the size of the output data type which is connected to the
output pin.
EN and ENO can be configured as additional parameters.
Example
The output of this function reads the 16-bit value of register %IW120 (register 300120), if Offset
= 120 and the output is of data type INT.
The value in Offset may be modified at runtime.
If Offset lies outside the configured number of %IW (3x), an error message is generated and ENO
is set to 0.
Representation in FBD
Representation:
GET_3X
446 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD Offset
GET_3X
ST Output
Representation in ST
Representation:
Output := GET_3X (Offset);
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
Offset UINT Offset in the %IW (3x) register memory.
Parameter Data type Description
Output ANY Output
33002543 10/2013 447
Unity Pro
GET_4X
33002543 10/2013
GET_4X: Read %MWWords (4x-Register)
Chapter 61
GET_4X: Read %MW Words (4x-Register)
Description
Function description
This function copies values from the %MW register area (4x register area for Quantum CPUs) to
the variable connected to the output pin VAL.
OFF is the word offset in the %MW register area.
The function copies as many bytes as the size of the output data type connected to the output pin
VAL.
The value in OFF may be modified at runtime. If OFF is outside the configured %MW register area,
an error message is generated and ENO is set to 0.
The function copies in any case only until the end of the configured %MW area, even if the
connected data type could take more data. The remaining part of the connected data type remains
untouched by the block in such cases.
EN and ENO can be configured as additional parameters.
Example
This function reads the 16-bit value of register %MW120 (register 400120), if OFF = 120 and the
output is of data type INT.
This function reads only 1 word, if OFF addresses the last configured %MW, even if the connected
data type is of a larger size than a word.
Representation in FBD
Representation:
GET_4X
448 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD Offset
GET_4X
ST Output
Representation in ST
Representation:
Output := GET_4X (Offset);
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
Offset UINT Offset in the %MW register memory (4x).
Parameter Data type Description
Output ANY Output
33002543 10/2013 449
Unity Pro
GET_BIT
33002543 10/2013
GET_BIT: Reading bit
Chapter 62
GET_BIT: Reading bit
Description
Function description
This function reads the bit selected with BitNumber for input InputRegister and writes the
current state to output CurrentState.
The output is the current state of the selected input data bit.
The BitNumber parameter shows which input data bit to select.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
GET_BIT
450 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD InputRegister
GET_BIT BitNumber
ST CurrentState
Representation in ST
Representation:
CurrentState := GET_BIT(InputRegister, BitNumber);
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
InputRegister WORD Input word
BitNumber UINT Bit number to be read.
Parameter Data type Description
CurrentState BOOL Current state of selected bit.
33002543 10/2013 451
Unity Pro
HIGH_INT
33002543 10/2013
HIGH_INT: Extracting the most significant word of a double integer
Chapter 63
HIGH_INT: Extracting the most significant word of a
double integer
Description
Description of the function
The function HIGH_INT extracts the most significant word of a double integer.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Double_Int
HIGH_INT
ST High_Int
HIGH_INT
452 33002543 10/2013
Representation in ST
Representation:
High_Int := HIGH_INT(Double_Int);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Double_Int DINT Double integer whose most significant word is
extracted.
Parameter Type Comment
High_Int INT The most significant word extracted from the double
integer Double_Int.
33002543 10/2013 453
Unity Pro
IEC_BMDI
33002543 10/2013
IEC_BMDI: Block move
Chapter 64
IEC_BMDI: Block move
Introduction
This chapter describes the IEC_BMDI block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 454
Detailed description 458
IEC_BMDI
454 33002543 10/2013
Description
Function description
This procedure copies the number of elements listed in NumberOfElements wordwise, from
position OffsetInSourceTable in the source table (SourceTable) to position OffsetInDes-
tinationTable in the destination table (DestinationTable).
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
WARNING
FORCED VALUES NOT TAKEN INTO ACCOUNT
This procedure overwrites the values in State memory WITHOUT regard to possible forced
values in the reference data editor. This can produce serious process conditions.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
IEC_BMDI
33002543 10/2013 455
Representation in LD
Representation:
Representation in IL
Representation:
LD SourceTable
IEC_BMDI OffsetInSourceTable, NumberOfElements,
DestinationTable, OffsetInDestinationTable
Representation in ST
Representation:
IEC_BMDI (SourceTable, OffsetInSourceTable,
NumberOfElements, DestinationTable,
OffsetInDestinationTable);
Parameter description
Description of input parameters:
Parameter Data type Description
SourceTable UINT Quantum source table having contents copied. Selection of
source table:
0 = Marker-Bits %MX
1 = Input Bits %IX
3 = Input words %IW
4 = Marker words %MW
IEC_BMDI
456 33002543 10/2013
OffsetInSourceTable UINT Offset in selected source table (SourceTable). As the
copy operation is executed word-by-word,
OffsetInSourceTable must be a multiple of 16+1 for 0x
and 1x source tables (e.g. 17, 33, 49 etc.) The offset is
subject to upper limit supervision and must be within the
limits of the source table.
NumberOfElements UINT Table size for source and destination table.
NumberOfElements indicates the number of elements in
the source table to be copied. Because the copy operation
is performed word-by-word, 0x and 1x source tables must
have a multiple of 16 (e.g. 16, 32, 48, etc.) for
NumberOfElements. NumberOfElements is subject to
upper limit supervision and must be within the limits of the
source and destination tables. Independent of the
configured limits, the NumberOfElements value was
additionally restricted to the following values to prevent the
copy operation from taking up too much time:
%MX, %IX Bits: max NumberOfElements = 1600
%IW, %MW Registers: max NumberOfElements = 100
DestinationTable UINT Destination table to which contents of source table will be
copied. Selection of destination table:
0 = Marker-Bits %MX
4 = Marker words %MW
OffsetInDestinationTable UINT Offset in selected source table. Because the copy
operation is performed word-by-word, 0x and 1x source
tables OffsetInDestinationTable must have a
multiple of 16+1 (e.g. 17, 33, 49, etc.). The offset is subject
to upper limit supervision and must be within the limits of
the destination table.
Parameter Data type Description
IEC_BMDI
33002543 10/2013 457
Runtime error
The following standard user error messages are used:
If there are no errors, the procedure copies the values from the indicated source to the destination
address and sets the ENO output to 1.
The user errors 1 through 12 will block the copy operation and are setting the ENO output to 0.
If user error 13 occurs, the copy operation continues and the ENO output remains at 1 because this
error is treated as a warning.
NOTE: For a list of all block error codes, see Extension/Compatibility, page 603.
User error message Description
E_EFB_USER_ERROR_1 Input value is invalid register type (SourceTable).
E_EFB_USER_ERROR_2 The input offset (OffsetInSourceTable) selects an address outside
acceptable limits.
E_EFB_USER_ERROR_3 The input offset (OffsetInSourceTable) is not 1 or a multiple of 16+1.
E_EFB_USER_ERROR_4 Output value is invalid register type (DestinationTable).
E_EFB_USER_ERROR_5 The output offset (OffsetInDestinationTable) selects an address
outside acceptable limits.
E_EFB_USER_ERROR_6 The output offset (OffsetInDestinationTable) is not 1 or a multiple
of 16+1.
E_EFB_USER_ERROR_7 The value for (NumberOfElements) is 0.
E_EFB_USER_ERROR_8 The value for (NumberOfElements) addresses more than 1600 bits.
E_EFB_USER_ERROR_9 The value for (NumberOfElements) addresses more than 100 words.
E_EFB_USER_ERROR_10 The value for (NumberOfElements) selects a source address outside
the acceptable limits.
E_EFB_USER_ERROR_11 The value for (NumberOfElements) selects a destination address
outside the acceptable limits.
E_EFB_USER_ERROR_12 The value for (NumberOfElements) is not a multiple of 16.
E_EFB_USER_ERROR_13 Warning: Address overlap of input and output addresses.
IEC_BMDI
458 33002543 10/2013
Detailed description
Function description
IEC_BMDI creates a word-by-word copy of the number of elements listed in LENGTH from the
OFF_IN position in the source table (SEL_IN) to the OFF_OUT position in the destination table
(SEL_OUT). While copying, LENGTH always uses the type of SEL_IN for orientation (%IX, %MX:
LENGTH = Number of Bits; %IW, %MW: LENGTH = number of words)
Copy behavior:
%MX or %IX to %MX
The source and target lengths are identical during copying of %MX or %IX to %MX
%IW or %MW to %MW
The source and target lengths are identical during copying of %IW or %MW to %MW
%MX or %IX to %MW
When copying %MX or %IX to %MW, a WORD-to-WORD copy is made as well. In this, the first
source bit is copied into the MSB (highest bit) of the first %MW register, and so on. LENGTH
defines the number of bits to be copied. The maximum output length is LENGTH/16 registers.
%IW or %MW to %MX
When copying %IW or %MW to %MX, a WORD-to-WORD copy is made as well. In this, the MSB
(highest bit) of the first register is copied into the first destination bit and so on. LENGTH defines
the number of registers to be copied. The maximum output length is LENGTH x 16 bits.
WARNING
FORCED VALUES NOT TAKEN INTO ACCOUNT
This procedure overwrites the values in State memory WITHOUT regard to possible forced
values in the reference data editor. This can produce serious process conditions.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
IEC_BMDI
33002543 10/2013 459
Example 1
In the example, 64 %MX source bits from start address %MX129 are copied into the %MW
destination register (starting at address %MW112). The input range is %MX129 to %MX192 and
the output range is %MW112 to %MW115.
Example 2
In the example, 11 %MW source bits from start address %MW250 are copied into the %MX
destination register (starting at address %MX257). The input range is %MW250 to %MW260 and
the output range is %MX257 to %MX432.
IEC_BMDI
460 33002543 10/2013
Example 3
In the example, 128 %MX source bits from start address %MX001 are copied into the %MX
destination register (starting at address %MX257). The input range is %MX001 to %MX127 and
the output range is %MX257 to %MX384.
Example 4
In the example, 15 %MW source bits from start address %MW250 are copied into the %MW
destination register (starting at address 4:01030). The input range is %MW250 to %MW264, and
the output range is 4:01030 to 4:01044.
33002543 10/2013 461
Unity Pro
LIFO
33002543 10/2013
LIFO: Last In/First Out stack register
Chapter 65
LIFO: Last In/First Out stack register
Introduction
This chapter describes the LIFO block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 462
Detailed description 465
LIFO
462 33002543 10/2013
Description
Function description
This function block is a last in first out stack register.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
LIFO
33002543 10/2013 463
Representation in IL
Representation:
CAL LIFO_Instance (R:=ClearedStackRegister, SET:=WriteValue,
GET:=ReadValue, X:=StackRegisterInput,
N_MAX:=MaxNumberInStack, FULL=>StackRegisterFull,
EMPTY=>StackRegisterEmpty, Y=>StackRegisterOutput)
Representation in ST
Representation:
LIFO_Instance (R:=ClearedStackRegister, SET:=WriteValue,
GET:=ReadValue, X:=StackRegisterInput,
N_MAX:=MaxNumberInStack, FULL=>StackRegisterFull,
EMPTY=>StackRegisterEmpty, Y=>StackRegisterOutput) ;
Parameter description
Description of input parameters:
Parameter Data type Description
R BOOL 1 = stack register will be cleared
SET BOOL 1 = write value to stack register
GET BOOL 1 = read value from stack register
X ANY should be an
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
Stack register input
N_MAX UINT Maximum number of elements in the stack register
LIFO
464 33002543 10/2013
Description of output parameters:
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
FULL BOOL 1= stack is full, no further elements can be put in the
stack.
EMPTY BOOL 1 = stack register is empty (number of elements in
the stack register = 0)
Y ANY should be an
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
Stack register output
LIFO
33002543 10/2013 465
Detailed description
Function description
LIFO is a last in-first out stack register.
The index and stack registers are invisible to the user. The stack register is part of the internal state
and can accept up to 2000 bytes (i.e. 1000 INT or 500 REAL or 500 TIME elements).
The function block has two Boolean inputs, GET and SET, that are used to either read a value from
or write a value to the stack register. If GET and SET are set simultaneously, SET (write) will be
executed before GET (read).
The stack register will be cleared if R(eset) = 1.
The input parameters checking the stack must be set in a meaningful order to allow the function
block to work properly.
A meaningful order is, for example:
An N_MAX parameter defines the maximum number of elements in the stack register.
In a full stack register (number of elements in the stack register = N_MAX <= 2000 / (size of (X)),
FULL is set to 1. Cannot put any more elements onto stack register.
In an empty stack register (number of elements in the stack register = 0), EMPTY is set to 1.
The function has one X input and one Y output for various data types.
X and Y are type ANY, which implies a predefined length. Due to the limited size of the stack
register, only data types with an element size less than or equal to 200 bytes are allowed.
Otherwise a runtime error will be generated and the ENO output is set to 0.
Cycle Parameters Result
Cycle n R=0, SET=0, GET=0 Stack not initialized
Cycle n+1 R=1, SET=0, GET=0 Stack initialized
Cycle n+2 R=0, SET=0, GET=0 End initializing
Cycle n+3 R=0, SET=1, GET=0 Loading stack with x values
Cycle n+x+1 R=0, SET=0, GET=0 End loading
Cycle n+x+2 R=0, SET=0, GET=1 Getting x values
Cycle n+x+2+x R=0, SET=0, GET=1 Stack not empty
LIFO
466 33002543 10/2013
33002543 10/2013 467
Unity Pro
LOW_INT
33002543 10/2013
LOW_INT: Extracting the least significant word of a double integer
Chapter 66
LOW_INT: Extracting the least significant word of a double
integer
Description
Description of the function
The function LOW_INT extracts the least significant word of a double integer.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Double_Int
LOW_INT
ST Low_Int
LOW_INT
468 33002543 10/2013
Representation in ST
Representation:
Low_Int := LOW_INT(Double_Int);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Double_Int DINT Double integer whose least significant word is
extracted.
Parameter Type Comment
Low_Int INT The least significant word extracted from the double
integer Double_Int.
33002543 10/2013 469
Unity Pro
MUX_DINTARR_125
33002543 10/2013
MUX_DINTARR_125: Multiplexer for arrays of the data type DIntArr125
Chapter 67
MUX_DINTARR_125: Multiplexer for arrays of the data type
DIntArr125
Description
Function description
Use this function to address and select a single element in an array. When addressing arrays, only
constant indexes can be entered in the programming languages FBD and LD.
With the help of this function, variables for indexing can also be used.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
MUX_DINTARR_125
470 33002543 10/2013
Representation in IL
Representation:
LD DIntArray
MUX_DINTARR_125 PositionInArray
ST SelectedElement
Representation in ST
Representation:
SelectedElement := MUX_DINTARR_125 (DIntArray,
PositionInArray) ;
Parameter description MUX_DINTARR_125
Description of input parameters:
Description of output parameters:
Parameter description DIntArr125
Description of the DIntArr125 data type:
Runtime error
There will be an error message when the authorized value range for the parameter NO is violated.
The error number is entered in this case instead of the selected element on the output of the
function (SelectedElement).
NOTE: For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
DIntArray DIntArr125 Array an element is to be selected from
PositionInArray INT Position in the array where the element to be
selected is placed (range 0 ... 124)
Parameter Data type Description
SelectedElement DINT selected element
Element Data type Description
varname[1] DINT 1. Element of the array
... ... ...
varname[125] DINT 125. Element of the array
33002543 10/2013 471
Unity Pro
PL7_COUNTER
33002543 10/2013
PL7_COUNTER : Counter/downcounter
Chapter 68
PL7_COUNTER : Counter/downcounter
Object of this chapter
This chapter describes the PL7_COUNTERfunction.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 472
Mode of operation of the PL7_COUNTER function 476
PL7_COUNTER
472 33002543 10/2013
Description
Description of the function
The PL7_COUNTER function block is a counter/down counter that allows counting of pulses up or
down.
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_COUNTER function in online mode. This means
you must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_COUNTER the application cannot be
transfered in the PLC.
FBD representation
Representation:
PL7_COUNTER
33002543 10/2013 473
LD representation
Representation:
IL representation
Representation:
CAL Counter_1(R := Raz, P := Preselect, CU := Count_Up, CD := Count_Down,
E => Empty, D => Done, F => Full)
PL7_COUNTER
474 33002543 10/2013
ST representation
Representation:
IF Raz THEN
RESET_PL7_COUNTER (Counter_1) ;
END_IF ;
IF Preselect THEN
PRESET_PL7_COUNTER (Counter_1) ;
END_IF ;
IF Count_Up THEN
UP_PL7_COUNTER (Counter_1) ;
END_IF ;
IF Count_Down THEN
DOWN_PL7_COUNTER (Counter_1) ;
END_IF ;
Empty := Counter_1.E ;
Done := Counter_1.D ;
Full := Counter_1.F ;
PL7_COUNTER
33002543 10/2013 475
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Description of variables
The following table describes the public variables:
Parameter Type Comment
R BOOL Input of reset to zero, if Counter_1.R is equal to 1, the
current value of the counter Counter_1.CV = 0
P BOOL Preset input, if Counter_1.S equals 1,
Counter_1.CV = Counter_1.PV
CU BOOL Count input, the current value is incremented by 1 on
the rising edge of Counter_1.CU.
CD BOOL Down-count input, the current value is decremented by
1 on the rising edge of Counter_1.CD.
Parameter Type Comment
E BOOL Empty counter output. Counter_1.E=1 when
Counter_1.CV changes from 0 to 9999 and then to 0
again if the counter continues to count down.
D BOOL Output which indicates that the counter has reached the
preset value. Counter_1.CD = 1 when
Counter_1.CV = Counter_1.PV.
F BOOL Full counter output. Counter_1.F = 1 when
Counter_1.CV changes from to 9999 to 0 and then to
0 again if the counter continues to count up.
Parameter Type Comment
CV INT Current value of counter. This value can be read and
tested but not written by the program.
PV INT This value, which is between 0 and 9999, is known as
the counter preset value. It can be written, read and
tested by the program; the default setting is 9999.
PL7_COUNTER
476 33002543 10/2013
Mode of operation of the PL7_COUNTER function
Description
The following table describes the specific modes of operation of the PL7_COUNTER function:
NOTE: it is recommended to test the output bits only once in the program.
Effect... Description
of a cold restart (%S0=1) the current value is reset to zero, the outputs are set to
zero and the preset value is initialized at the value defined in
configuration.
of a warm restart, a
change to stop,
deactivation of a task
or execution of a
breakpoint
(%S1=1) has no effect on the current value of the counter.
of modifying the preset A modification to the preset value by instruction or adjustment is
taken into account during management of the block by the
application.
33002543 10/2013 477
Unity Pro
PL7_DRUM
33002543 10/2013
PL7_DRUM : Drum
Chapter 69
PL7_DRUM : Drum
Object of this chapter
This chapter describes the PL7_DRUMfunction.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 478
Mode of operation of the PL7_DRUM timer function 482
PL7_DRUM
478 33002543 10/2013
Description
Description of the function
The PL7_DRUM function block is a drum. Each step is associated with output bits or internal bits
known as order bits. This function block is used to convert PL7 programs; it corresponds to the
conversion of the %DRis under PL7.
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_DRUM function in online mode. This means you
must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_DRUM the application cannot be transfered
in the PLC.
FBD representation
Representation:
LD representation
Representation:
PL7_DRUM
33002543 10/2013 479
IL representation
Representation:
CAL PL7_Drum_1(R := Raz, U := Up, F => Full, W => %MW0)
ST representation
Representation:
IF Raz THEN
RESET_PL7_DRUM(PL7_Drum_1);
END_IF ;
IF RE (Up) THEN
UP_PL7_DRUM(PL7_Drum_1);
END_IF ;
Full := PL7_Drum_1.F ;
%MW0 := PL7_Drum_1.W ;
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
R BOOL "Return to step 0" input, at state 1 initializes the drum at step 0.
U BOOL "Advance" input, on rising edge causes the drum to advance
by one step and the updating of the order bits.
Parameter Type Comment
F BOOL Output indicating that the final step defined is in progress.
W INT Current step output value.
PL7_DRUM
480 33002543 10/2013
Description of variables
The following table describes the public variables:
Parameter Type Comment
LEN UINT Number of steps: possible values from 1 to 16 (default is 16).
ET INT Time out or duration of current step. PL7_Drum_1.ET is
between 0 and 9999. This integer can be reset to zero for each
step change. It can be read and tested, but not written. The
duration of a step is equal to PL7_Drum1.ET x
PL7_Drum_1.TB.
S INT Between 0 and 15, this is the number of the current step. This
integer can be read and tested. It can only be written from an
immediate value.
TB UINT Cyclical programmer time base. Possible values:
TB = 8: 1 mn (default value),
TB = 4: 1 s,
TB = 2: 100 ms,
TB = 1: 10 ms.
When the program is executed, the value of the time base (TB
defined in offline mode) is rounded down to the nearest multiple
of 2 (between 1 and 8).
W0...Wj
(j=LEN-1)
INT PL7_Drum_1.Wj is a word representing the state of step j. This
word (type INT) indicates the state of each order bit for a given
step. It is entered by the user using the data editor.
Note: There are as many Wj as there are steps (LEN).
CAUTION
UNEXPECTED BEHAVIOR AFTER WARM RESTART
Do no modify the time base (TB) in online mode, this would cause an unexpected behavior of the
application on warm restart.
Failure to follow these instructions can result in injury or equipment damage.
PL7_DRUM
33002543 10/2013 481
Chart
Chart of the operation of the PL7_DRUM function block:
The number of the current step is incremented for each rising edge on the input PL7_Drum_1.U
(or activation of the instruction UP_PL7_DRUM(PL7_Drum_1)). This number can be changed by
the program.
PL7_DRUM
482 33002543 10/2013
Mode of operation of the PL7_DRUM timer function
Description
The following table describes the specific modes of operation of the PL7_DRUM function:
NOTE: updating of the order bits only takes place when there is a change of step or when there is
a warm or cold start.
NOTE: on resetting to 0:
In LD and FBD, the history of the input PL7_Drum_1.U is updated with the cabled values.
In IL, the history of the input PL7_Drum_1.U is not updated; it retains the value it had before
the call.
In ST, the history of the input PL7_Drum_1.U is updated with 0.
Effect... Description
of a cold restart (%S0=1) causes the reinitialization of the programmer to step 0
(with updating of the order bits).
of a warm restart (%S1=1) causes the updating of the order bits according to the
current step.
a program jump,
deactivation of a task
or execution of a
breakpoint
The fact of not scanning the drum does not cause a reset to 0 of the
order bits.
33002543 10/2013 483
Unity Pro
PL7_MONOSTABLE
33002543 10/2013
PL7_MONOSTABLE : Monostable
Chapter 70
PL7_MONOSTABLE : Monostable
Object of this chapter
This chapter describes the PL7_MONOSTABLEfunction.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 484
Detailed description of the operation of the PL7_MONOSTABLE function 487
Mode of operation of the PL7_MONOSTABLE monostable function 488
PL7_MONOSTABLE
484 33002543 10/2013
Description
Description of the function
The PL7_MONOSTABLE function block is a monostable that allows a pulse to be generated with a
precise duration.
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_MONOSTABLE function in online mode. This
means you must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_MONOSTABLE the application cannot be
transfered in the PLC.
FBD representation
Representation:
LD representation
Representation:
PL7_MONOSTABLE
33002543 10/2013 485
IL representation
Representation:
CAL Mn_1(S := Mn_Start, R => Mn_State)
ST representation
Representation:
IF RE(Mn_Start) THEN
START_PL7_MONOSTABLE (Mn_1) ;
END_IF ;
Mn_State := Mn_1.R ;
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
NOTE: the monostable can be reset on the rising edge of Ma_1.S, on the other hand, the length
of the monostable starting pulse does not change the pulse generated as the monostable is started
on the rising edge.
Parameter Type Comment
S BOOL "Start" input, on rising edge, starts the monostable.
Parameter Type Comment
R BOOL "Run" output:
Mn_1.R = 0 if Mn_1.ET = Mn_1.PT or Mn_1.ET =
0.
Mn_1.R = 1 otherwise.
PL7_MONOSTABLE
486 33002543 10/2013
Description of variables
The following table describes the public variables:
Parameter Type Comment
ET INT Current value of the monostable which runs down over
time from Mn_1.PT to 0. This value can be read and
tested but not written by the program.
PT INT This value, which is between 0 and 9999, is known as
the monostable preset value. It can be written, read and
tested by the program. Its default setting is 9999. The
value of the pulse generated by the monostable is equal
to Mn_PT x TB.
TB UINT Cyclical programmer time base. Possible values:
TB = 8: 1 mn (default value),
TB = 4: 1 s,
TB = 2: 100 ms,
TB = 1: 10 ms.
When the program is executed, the value of the time
base (TB defined in offline mode) is rounded down to
the nearest multiple of 2 (between 1 and 8).
CAUTION
UNEXPECTED BEHAVIOR AFTER WARM RESTART
Do no modify the time base (TB) in online mode, this would cause an unexpected behavior of the
application on warm restart.
Failure to follow these instructions can result in injury or equipment damage.
PL7_MONOSTABLE
33002543 10/2013 487
Detailed description of the operation of the PL7_MONOSTABLE function
Chart
Chart showing operation of the monostable
Operation
Description of monostable operation
Phase Description
1 Once a rising edge appears on input Mn_1.S of the monostable, the current value
Mn_1.ET takes the preselection value Mn_1.PT.
2 The current value Mn_1.ET decreases to 0 at a rate of one unit for each pulse of
the time base Mn_1.TB
3 The output bit Mn_1.R (Running) switches to 1 once the current value Mn_1.ET
is different to 0.
4 When the current value Mn_1.ET = 0, the output bit Mn_1.R switches back to 0.
PL7_MONOSTABLE
488 33002543 10/2013
Mode of operation of the PL7_MONOSTABLE monostable function
Description
The following table describes the specific modes of operation of the PL7_MONOSTABLE function:
NOTE: it is recommended to test the output bit of the monostable only once in the program.
Effect... Description
of a cold restart (%S0=1), causes a reset to zero of the current value, the preset value is reinitialized
to the value defined in the configuration and the current value is set at the preset
value.
of a warm restart (%S1=1) has no effect on the current value of the monostable or on the preset value.
The current value does not change during a power outage.
a change to stop,
deactivation of a task
or execution of a
breakpoint
Does not freeze the current value.
of a program jump The fact of not scanning the instructions where the monostable block is
programmed does not freeze the current value that continues to decrease towards
zero.
Similarly the output bit retains it normal function and can thus be tested by another
instruction. On the other hand the output, directly cabled to the output, is not
activated as it is not scanned by the PLC
Output bit test the output bit can change state in mid-cycle.
33002543 10/2013 489
Unity Pro
PL7_REGISTER_32
33002543 10/2013
PL7_REGISTER_32 : 32 word memory register
Chapter 71
PL7_REGISTER_32 : 32 word memory register
Description
Description of the function
The PL7_REGISTER_32 function block is a memory register that can store up to 32 words (of the
INT type).
There are two storage modes:
FIFO mode (first in, first out), also known as file,
LIFO mode (last in, first out), also known as pile.
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_REGISTER_32 function in online mode. This
means you must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_REGISTER_32 the application cannot be
transfered in the PLC.
FBD representation
Representation:
PL7_REGISTER_32
490 33002543 10/2013
LD representation
Representation:
IL representation
Representation:
CAL R_1 (R := Raz, I := In_Pulse, O := Out_Pulse, E => Empty, F => Full)
ST representation
Representation:
IF Raz THEN
RESET_PL7_REGISTER_32 (R_1) ;
END_IF ;
IF RE(In_Pulse) THEN
GET_PL7_REGISTER_32 (R_1) ;
END_IF ;
IF RE(Out_Pulse) THEN
PUT_PL7_REGISTER_32 (R_1) ;
END_IF ;
Empty := R_1.E ;
Full := R_1.F ;
PL7_REGISTER_32
33002543 10/2013 491
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
NOTE: when both inputs (store and destock) are activated simultaneously, storing is carried out
before destocking.
Description of variables
The following table describes the public variables:
Parameter Type Comment
R BOOL Input of reset to zero, if R_1.R equals 1 the register is emptied.
I BOOL Storage input, on rising edge, the input word of the register is stored in
the register.
O BOOL Destock input, on rising edge, the input word is written with the
information ready to be destocked from the register.
Parameter Type Comment
E BOOL Empty register output. When the register is empty, it is no longer
possible to destock information.
F BOOL Full register output. When the register is full, it is no longer possible to
store information.
Parameter Type Comment
FIFO BOOL Mode of operation of the register:
True : FIFO.
False : LIFO (default).
IN W INT Input word of the register; it can be read, tested or written.
OUT W INT Output word of the register; it can be read, tested or written.
LEN UINT Number of words of the register.
PL7_REGISTER_32
492 33002543 10/2013
Operating modes
The following table describes the specific modes of operation of the PL7_REGISTER_32 function:
Effect... Description
of a cold restart (%S0=1), causes the initialization of the contents of the register. The output bit
indicating that the register is empty is set at 1.
of a warm restart (%S1=1) has no effect on the content of the register or on the state of the output bits.
of a reset to zero The effect of the reset to zero differs according to the language used :
in LD and FBD, the input histories are updated with the cabled values,
in IL, the input histories are not updated and each input retains the value it had
prior to the call.
in ST, the input histories are set to zero.
33002543 10/2013 493
Unity Pro
PL7_REGISTER_255
33002543 10/2013
PL7_REGISTER_255 : 255 word memory register
Chapter 72
PL7_REGISTER_255 : 255 word memory register
Description
Description of the function
The PL7_REGISTER_255 function block is a memory register that can store up to 255 words (of
the INT type).
There are two storage modes:
FIFO mode (first in, first out), also known as file,
LIFO mode (last in, first out), also known as pile.
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_REGISTER_255 function in online mode. This
means you must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_REGISTER_255 the application cannot be
transfered in the PLC.
FBD representation
Representation:
PL7_REGISTER_255
494 33002543 10/2013
LD representation
Representation:
IL representation
Representation:
CAL R_1 (R := Raz, I := In_Pulse, O := Out_Pulse, E => Empty, F => Full)
ST representation
Representation:
IF Raz THEN
RESET_PL7_REGISTER_255 (R_1) ;
END_IF ;
IF RE(In_Pulse) THEN
GET_PL7_REGISTER_255 (R_1) ;
END_IF ;
IF RE(Out_Pulse) THEN
PUT_PL7_REGISTER_255 (R_1) ;
END_IF ;
Empty := R_1.E ;
Full := R_1.F ;
PL7_REGISTER_255
33002543 10/2013 495
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
NOTE: when both inputs (store and destock) are activated simultaneously, storing is carried out
before destocking.
Description of variables
The following table describes the public variables:
Parameter Type Comment
R BOOL Input of reset to zero, if R_1.R equals 1 the register is emptied.
I BOOL Storage input, on rising edge, the input word of the register is stored
in the register.
O BOOL Destock input, on rising edge, the input word is written with the
information ready to be destocked from the register.
Parameter Type Comment
E BOOL Empty register output. When the register is empty, it is no longer
possible to destock information.
F BOOL Full register output. When the register is full, it is no longer possible to
store information.
Parameter Type Comment
FIFO BOOL Mode of operation of the register:
True : FIFO.
False : LIFO (default).
IN W INT Input word of the register; it can be read, tested or written.
OUT W INT Output word of the register; it can be read, tested or written.
LEN UINT Number of words of the register.
PL7_REGISTER_255
496 33002543 10/2013
Operating modes
The following table describes the specific modes of operation of the PL7_REGISTER_255
function:
Effect... Description
of a cold restart (%S0=1), causes the initialization of the contents of the register. The empty register
output bit is set at 1.
of a warm restart (%S1=1) has no effect on the content of the register or on the state of the output bits.
of a reset to zero The effect of the reset to zero differs according to the language used :
in LD and FBD, the input histories are updated with the cabled values,
in IL, the input histories are not updated and each input retains the value it had
prior to the call.
in ST, the input histories are set to zero.
33002543 10/2013 497
Unity Pro
PL7 and Unity Timers Comparison
33002543 10/2013
PL7 and Unity Timers Comparison
Chapter 73
PL7 and Unity Timers Comparison
Differences between PL7 and Unity Pro: Timers
Introduction
This part explains the differences between the PL7 timers and IEC timers available in Unity Pro.
Those differences are useful especially when migrating from PL7 software to Unity Pro.
The PL7 timers include:
PL7_TON
PL7_TOF
PL7_TP
The IEC timers include:
TON
TOF
TP
IEC timers and PL7 timers comparison
The table below lists the differences between IEC timers and PL7 timers:
IEC Timers PL7 Timers
Allowed amount of
timers in application
Unlimited 255
Programming No time base
Preset time is a TIME type
(t#1mn20s)
The current value of the
timer is directly one output
ET of TIME type
Time base (min, sec, or ms) must be defined
with an integer
The preset time is an INT type (time base
factor)
The current value is provided by a public
variable
Running Mode The TON instance must be
scanned in the program to
refresh the output
The output is set once the timer is launched
Online Mode Online modifications
(add/modify) allowed on TON
instance
The user cannot:
Modify the time base
Create new instance
PL7 and Unity Timers Comparison
498 33002543 10/2013
33002543 10/2013 499
Unity Pro
PL7_TOF
33002543 10/2013
PL7_TOF : TOF type timer
Chapter 74
PL7_TOF : TOF type timer
Object of this chapter
This chapter describes the PL7_TOFfunction.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 500
Detailed description of the operation of the PL7_TOF function 503
Mode of operation of the PL7_TOF timer function 504
PL7_TOF
500 33002543 10/2013
Description
Description of the function
The PL7_TOF function block is a timer of the TOF type (fall-delay time).
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_TOF function in online mode. This means you
must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_TOF the application cannot be transfered in
the PLC.
FBD representation
Representation:
LD representation
Representation:
PL7_TOF
33002543 10/2013 501
IL representation
Representation:
CAL TOF_Timer_1(S := Timer_Start, Q => Timer_State)
ST representation
Representation:
IF RE(Timer_start) THEN
START_PL7_TOF (TOF_Timer_1) ;
END_IF ;
IF FE(Timer_Start) THEN
DOWN_PL7_TOF (TOF_Timer_1) ;
END_IF ;
Timer_State := TOF_Timer_1.Q ;
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
S BOOL "Activation" input, on rising edge, starts the timer.
Parameter Type Comment
Q BOOL "Timer" output, setting at 1 of this depends on the timer
state.
PL7_TOF
502 33002543 10/2013
Description of variables
The following table describes the public variables:
Parameter Type Comment
ET INT Current value of the timer that runs down over time. This
value can be read and tested but not written by the
program.
PT INT This value, which is between 0 and 9999, is known as
the timer preset value. It can be written, read and tested
by the program. Its default setting is 9999. The delay
created by the timer is equal to PT x TB.
TB UINT Timer time base. Possible values:
TB = 8: 1 mn (default value),
TB = 4: 1 s,
TB = 2: 100 ms,
TB = 1: 10 ms.
The lower the time base, the greater the timer accuracy.
When the program is executed, the value of the time
base (TB defined in offline mode) is rounded down to
the nearest multiple of 2 (between 1 and 8).
CAUTION
UNEXPECTED BEHAVIOR AFTER WARM RESTART
Do no modify the time base (TB) in online mode, this would cause an unexpected behavior of the
application on warm restart.
Failure to follow these instructions can result in injury or equipment damage.
PL7_TOF
33002543 10/2013 503
Detailed description of the operation of the PL7_TOF function
Chart
Chart.
Operation
The following table describes the operation of the PL7_TOF timer function:
Phase Description
1 The current value TOF_Timer_1.ET takes the value 0, on a rising edge of the
TOF_Timer_1.S input (even if the timer is running at the time).
2 The output bit TOF_Timer_1.Q changes to 1.
3 When there is a falling edge on the TOF_Timer_1.S, input the timer is started.
4 The current value increases towards TOF_Timer_1.PT by one unit for each
pulse of the time base TB.
5 The output bit TOF_Timer_1.Q falls to 0 again as soon as the current value
reaches TOF_Timer_1.PT.
PL7_TOF
504 33002543 10/2013
Mode of operation of the PL7_TOF timer function
Description
The following table describes the specific modes of operation of the PL7_TOF timer function:
NOTE: it is recommended to test bit Q only once in the program.
Effect... Description
of a cold restart (%S0=1), causes a reset to zero of the current value, a reset to 0 of the
Q output and the preset value is reset to the value defined in the
configuration.
of a warm restart (%S1=1) has no effect on the current value of the timer or on the preset
value. The current value does not change during a power outage.
a change to stop,
deactivation of a task
or execution of a
breakpoint
Does not freeze the current value.
of a program jump The fact of not scanning the instructions where the timer block is
programmed does not freeze the current value ET which continues to
increase towards PT.
Similarly bit Q retains it normal function and can thus be tested by
another instruction. On the other hand the output, directly cabled to the
output Q, is not activated as it is not scanned by the PLC
of modifying the preset A modification to the preset value by instruction or adjustment is only
taken into account the next time the timer function is activated.
A modification of the preset value in the variables editor is only taken
into account after a cold restart (%S0=1).
33002543 10/2013 505
Unity Pro
PL7_TON
33002543 10/2013
PL7_TON : TON type timer
Chapter 75
PL7_TON : TON type timer
Object of this chapter
This chapter describes the PL7_TONfunction.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 506
Detailed description of the operation of the PL7_TON function 509
Mode of operation of the PL7_TON timer function 510
PL7_TON
506 33002543 10/2013
Description
Description of the function
The PL7_TON function block is a timer of the TON type (rise-delay time).
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_TON function in online mode. This means you
must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_TON the application cannot be transfered in
the PLC.
FBD representation
Representation:
LD representation
Representation:
PL7_TON
33002543 10/2013 507
IL representation
Representation:
LD Timer_Start
CAL TON_Timer_1(S := TON_Timer_1, Q => Timer_State)
ST representation
Representation:
IF RE(Timer_start) THEN
START_PL7_TON (TON_Timer_1) ;
END_IF ;
IF FE(Timer_Start) THEN
DOWN_PL7_TON (TON_Timer_1) ;
END_IF ;
Timer_State := TON_Timer_1.Q ;
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
S BOOL "Activation" input, on rising edge, starts the timer.
Parameter Type Comment
Q BOOL "Timer" output, setting at 1 of this depends on the timer
state.
PL7_TON
508 33002543 10/2013
Description of variables
The following table describes the public variables:
Parameter Type Comment
ET INT Current value of the timer that runs down over time. This
value can be read and tested but not written by the
program.
PT INT This value, which is between 0 and 9999, is known as
the timer preset value. It can be written, read and tested
by the program. Its default setting is 9999. The delay
created by the timer is equal to PT x TB.
TB UINT Timer time base. Possible values:
TB = 8: 1 mn (default value),
TB = 4: 1 s,
TB = 2: 100 ms,
TB = 1: 10 ms.
The lower the time base, the greater the timer accuracy.
When the program is executed, the value of the time
base (TB defined in offline mode) is rounded down to
the nearest multiple of 2 (between 1 and 8).
CAUTION
UNEXPECTED BEHAVIOR AFTER WARM RESTART
Do no modify the time base (TB) in online mode, this would cause an unexpected behavior of the
application on warm restart.
Failure to follow these instructions can result in injury or equipment damage.
PL7_TON
33002543 10/2013 509
Detailed description of the operation of the PL7_TON function
Chart
Chart.
Operation
The following table describes the operation of the PL7_TON timer function:
Phase Description
1 When there is a rising edge on the TON_Timer_1.S, input the timer is started.
2 The current value TON_Timer_1.ET of the timer increases from 0 towards TON_Timer_1.PT
at a rate of one unit for each pulse of the time base TB.
3 The output bit TON_Timer_1.Q changes to 1 as soon as the current value reaches
TON_Timer_1.PT.
4 The TON_Timer_1.Q output bit remains at 1 while the TON_Timer_1.S input is at 1.
5 When the TON_Timer_1.S input is at 0, the timer is stopped, even if it was running at the time:
TON_Timer_1.ET takes the value 0.
PL7_TON
510 33002543 10/2013
Mode of operation of the PL7_TON timer function
Description
The following table describes the specific modes of operation of the PL7_TON timer function:
NOTE: it is recommended to test bit Q only once in the program.
Effect... Description
of a cold restart (%S0=1), causes a reset to zero of the current value, a reset to 0 of the Q output
and the preset value is reset to the value defined in the configuration.
of a warm restart (%S1=1) has no effect on the current value of the timer or on the preset value. The
current value does not change during a power outage.
a change to stop,
deactivation of a task
or execution of a
breakpoint
Does not freeze the current value.
of a program jump The fact of not scanning the instructions where the timer block is programmed does
not freeze the current value ET which continues to increase towards PT.
Similarly bit Q retains it normal function and can thus be tested by another
instruction. On the other hand the output, directly cabled to the output Q, is not
activated as it is not scanned by the PLC.
of modifying the preset A modification to the preset value by instruction or adjustment is only taken into
account the next time the timer function is activated.
A modification of the preset value in the variables editor is only taken into account
after a cold restart (%S0=1).
33002543 10/2013 511
Unity Pro
PL7_TP
33002543 10/2013
PL7_TP : TP type timer
Chapter 76
PL7_TP : TP type timer
Object of this chapter
This chapter describes the PL7_TP function.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 512
Detailed description of the operation of the PL7_TP function 515
Mode of operation of the PL7_TP timer function 516
PL7_TP
512 33002543 10/2013
Description
Description of the function
The PL7_TP function block is a TP type timer that allows pulses to be generated with a precise
duration (monostable function).
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_TP function in online mode. This means you must
be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_TP the application cannot be transfered in
the PLC.
FBD representation
Representation:
LD representation
Representation:
PL7_TP
33002543 10/2013 513
IL representation
Representation:
CAL TP_Timer_1(S := Timer_Start, Q => Timer_State)
ST representation
Representation:
IF RE(Timer_start) THEN
START_PL7_TP (TP_Timer_1) ;
END_IF ;
IF FE(Timer_Start) THEN
DOWN_PL7_TP (TP_Timer_1) ;
END_IF ;
Timer_State := TP_Timer_1.Q ;
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
IN BOOL "Activation" input, on rising edge, starts the timer.
Parameter Type Comment
Q BOOL "Timer" output, setting at 1 of this depends on the timer
state.
PL7_TP
514 33002543 10/2013
Description of variables
The following table describes the public variables:
Parameter Type Comment
ET INT Current value of the timer that runs down over time. This
value can be read and tested but not written by the
program.
PT INT This value, which is between 0 and 9999, is known as
the timer preset value. It can be written, read and tested
by the program. Its default setting is 9999. The delay
created by the timer is equal to PT x TB.
TB UINT Timer time base. Possible values:
TB = 8: 1 mn (default value),
TB = 4: 1 s,
TB = 2: 100 ms,
TB = 1: 10 ms.
The lower the time base, the greater the timer accuracy.
When the program is executed, the value of the time
base (TB defined in offline mode) is rounded down to
the nearest multiple of 2 (between 1 and 8).
CAUTION
UNEXPECTED BEHAVIOR AFTER WARM RESTART
Do no modify the time base (TB) in online mode, this would cause an unexpected behavior of the
application on warm restart.
Failure to follow these instructions can result in injury or equipment damage.
PL7_TP
33002543 10/2013 515
Detailed description of the operation of the PL7_TP function
Chart
Chart.
Operation
The following table describes the operation of the PL7_TP timer function:
Phase Description
1 When there is a rising edge on the TP_Timer_1.S, input the timer is started
2 The output bit TP_Timer_1.Q changes to 1.
3 The current value TP_Timer_1.ET of the timer increases from 0 towards TP_Timer_1.PT at
a rate of one unit for each pulse of the time base TB
4 The output bit TP_Timer_1.Q falls to 0 again as soon as the current value reaches
TP_Timer_1.PT
5 When the TP_Timer_1.IN input and the TP_Timer_1.Q output are at 0, TP_Timer_1.ET
takes the value 0.
6 This monostable cannot be reset.
PL7_TP
516 33002543 10/2013
Mode of operation of the PL7_TP timer function
Description
The following table describes the specific modes of operation of the PL7_TP timer function:
NOTE: it is recommended to test bit Q only once in the program.
Effect... Description
of a cold restart (%S0=1), causes a reset to zero of the current value, a reset to 0 of the Q output
and the preset value is reset to the value defined in the configuration.
of a warm restart (%S1=1) has no effect on the current value of the timer or on the preset value. The
current value does not change during a power outage.
a change to stop,
deactivation of a task
or execution of a
breakpoint
does not freeze the current value.
of a program jump The fact of not scanning the instructions where the timer block is programmed does
not freeze the current value ET which continues to increase towards PT.
Similarly bit Q retains it normal function and can thus be tested by another
instruction. On the other hand the output, directly cabled to the output Q, is not
activated as it is not scanned by the PLC
of modifying the preset A modification to the preset value by instruction or adjustment is only taken into
account the next time the timer function is activated.
A modification of the preset value in the variables editor is only taken into account
after a cold restart (%S0=1).
33002543 10/2013 517
Unity Pro
PL7_3_TIMER
33002543 10/2013
PL7_3_TIMER : Conversion timer for %Tis of PL7
Chapter 77
PL7_3_TIMER : Conversion timer for % Tis of PL7
Object of this chapter
This chapter describes the PL7_3_TIMER function.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 518
Detailed description of the operation of the PL7_3_TIMER function 521
Mode of operation of the PL7_3_TIMER timer function 522
PL7_3_TIMER
518 33002543 10/2013
Description
Description of the function
The PL7_3_TIMER function block is a timer used for converting the %Ti of PL7 which were
themselves conversions of Ti of PL7_3.
The additional parameters EN and ENO can be configured.
NOTE: you cannot instantiate or modify the PL7_3_TIMER function in online mode. This means
you must be in offline mode and therefore you must transfer the project in the PLC.
NOTE: If you create more than 255 instances of PL7_3_TIMER the application cannot be
transfered in the PLC.
FBD representation
Representation:
LD representation
Representation:
PL7_3_TIMER
33002543 10/2013 519
IL representation
Representation:
CAL PL7_3_Timer_1(E := Timer_Enable, C := Timer_Control, D => Timer_Done,
R => Timer_Run)
ST representation
Representation:
IF Timer_Enable THEN
IF Timer_Control THEN
START_PL7_3_TIMER (PL7_3_Timer_1) ;
ELSE
STOP_PL7_3_TIMER (PL7_3_Timer_1) ;
END_IF
ELSE
PRESET_PL7_3_TIMER (PL7_3_Timer_1) ;
END_IF ;
Timer_Done := PL7_3_Timer_1.D ;
Timer_Run := PL7_3_Timer_1.R ;
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
E BOOL "Enable" input, on state 0 reinitializes the timer.
C BOOL "Control" input on state 0 freezes the progression of the timer.
Parameter Type Comment
D BOOL "Timer run down" output, set at 1 if the current value is equal to 0.
R BOOL "Timer running" output, set at 1 if the current value is between 0 and the
preset value and the control input is at 1.
PL7_3_TIMER
520 33002543 10/2013
Description of variables
The following table describes the public variables:
Parameter Type Comment
ET INT Current value of the timer that runs down over time. This value can be
read and tested but not written by the program.
PT INT This value, which is between 0 and 9999, is known as the timer preset
value. It can be written, read and tested by the program. Its default
setting is 9999. The delay created by the timer is equal to PT x TB.
TB UINT Timer time base. Possible values are:
TB = 8: 1 mn (default value),
TB = 4: 1 s,
TB = 2: 100 ms,
TB = 1: 10 ms.
The lower the time base, the greater the timer accuracy.
When the program is executed, the value of the time base (TB defined
in offline mode) is rounded down to the nearest multiple of 2 (between
1 and 8).
CAUTION
UNEXPECTED BEHAVIOR AFTER WARM RESTART
Do no modify the time base (TB) in online mode, this would cause an unexpected behavior of the
application on warm restart.
Failure to follow these instructions can result in injury or equipment damage.
PL7_3_TIMER
33002543 10/2013 521
Detailed description of the operation of the PL7_3_TIMER function
Chart
Chart.
Operation
The following table describes the operation of the PL7_3_TIMER timer function:
E 0 0 1 1
C 0 1 0 1
PT
ET
ET = PT ET = PT ET frozen ET decreases by PT to 0
D 0 1 0 1 if timer elapsed
R 0 1 0 1 if timer running
Phase Description
1 The current value PL7_3_Timer_1.ET decreases from the preset
PL7_3_Timer_1.PT towards 0, by one unit per base time pulse.
2 The output bit PL7_3_Timer_1.R (Timer running) is then at state 1, the output
bit PL7_3_Timer_1.D (Timer elapsed) is at state 0.
3 When the current value PL7_3_Timer_1.ET = 0, PL7_3_Timer_1.D
changes to state 1 and PL7_3_Timer_1.R resets to state 0.
PL7_3_TIMER
522 33002543 10/2013
Mode of operation of the PL7_3_TIMER timer function
Description
The following table describes the specific modes of operation of the PL7_3_TIMER function:
NOTE: it is recommended to test the output bits only one in the program as they may change state
in mid-cycle.
Effect... Description
of a cold restart (%S0=1), causes the writing of the preset value (defined in
configuration) in the current value and the resetting to zero of the
"Done" output, with any preset value modified during adjustment
(terminal) being lost.
of a warm restart (%S1=1) has no effect on the current value of the timer or on the
preset value.
a change to stop,
deactivation of a task
or execution of a
breakpoint
Does not freeze the current value.
of a program jump The fact of not scanning the instructions where the timer block is
programmed does not freeze the current value ET which continues
to decrease towards 0.
Similarly the two output bits retain their normal operation and can
thus be tested by another instruction. On the other hand, the coils
directly cabled to the outputs are not activated since they are not
scanned by the PLC.
33002543 10/2013 523
Unity Pro
PUT_4X
33002543 10/2013
PUT_4X: Write 4x register
Chapter 78
PUT_4X: Write 4x register
Description
Function description
This function copies values from input variable IN to the %MW register area (4x register area for
Quantum CPUs). OFF is the word offset in the %MW register area.
The function copies as many bytes as the size of the data type connected to the input pin IN.
The value in OFF may be modified at runtime. If OFF is outside the configured %MW register area,
an error message is generated and ENO is set to 0.
The function writes in any case only until the end of the configured %MW area, even if the
connected data type could have more data. The remaining part of the connected data type remains
unread by the block in such cases.
EN and ENO can be configured as additional parameters.
Example
This function writes the 16-bit value of register %MW120 (register 400120), if OFF = 120 and the
input is of data type INT.
This function writes only 1 word, if OFF addresses the last configured %MW, even if the size of the
connected IN variable is of larger size than a word.
Representation in FBD
Representation:
PUT_4X
524 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD OffsetIn4XRegisterMemory
PUT_4X Input
Representation in ST
Representation:
PUT_4X (OffsetIn4XRegisterMemory, Input);
Parameter description
Description of input parameters:
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
OffsetIn4XRegisterMemory UINT Offset in the %MW register memory (4x).
Input ANY Input
33002543 10/2013 525
Unity Pro
R_INT_WORD
33002543 10/2013
R_INT_WORD: Type conversion (REAL -> INT -> WORD) (R_INT_WORD: Type conversion (REAL -> INT -> WORD))
Chapter 79
R_INT_WORD: Type conversion (REAL -> INT -> WORD)
(R_INT_WORD: Type conversion (REAL -> INT -> WORD))
Description
Function description
This function converts an input value with data type REAL to data type INT and then data type
WORD.
As opposed to the REAL_TO_WORD conversion module (standard library), the R_INT_WORD
module performs a conversion to an INT value prior to output of the WORD value. The result is, for
example, that the input value -1.0 is output as output value FFFF. (Not as with the REAL_TO_WORD
module, for which in this case the output value 0 is set).
As additional parameters, EN and ENO are projected.
Representation in FBD
Representation:
Representation in LD
Appearance:
R_INT_WORD
526 33002543 10/2013
Representation in IL
Appearance:
LD RealValue
R_INT_WORD
ST WordValue
Representation in ST
Appearance:
WordValue := R_INT_WORD (RealValue);
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
The system bit %S18 (see page 609) and system words %SW17 (see page 618) (error status) and
%SW125 (see page 636) (16#DE87: Caldulation errors in a floating point value calculation) are set
when
an unauthorized floating point number is set at the input,
the value range of the data type INT is exceeded,
Parameter Data type Description
INP REAL Input value
Parameter Data type Description
OUTP WORD Output value
33002543 10/2013 527
Unity Pro
R_UINT_WORD
33002543 10/2013
R_UINT_WORD: Type conversion (REAL -> UINT -> WORD) (R_UINT_WORD: Type conversion (REAL -> UINT -> WORD))
Chapter 80
R_UINT_WORD: Type conversion (REAL -> UINT -> WORD)
(R_UINT_WORD: Type conversion (REAL -> UINT ->
WORD))
Description
Function description
This function converts an input value with data type REAL to data type UINT and then data type
WORD.
As opposed to the conversion module REAL_TO_WORD (standard library) the R_UINT_WORD
module performs a conversion to a UINT value before output of a WORD value (value range 0 -
65535). This results in that the input value -1.0 causes an error message, the outputENO is set, and
the output value remains unchanged. (Not as with the REAL_TO_WORD module, for which the
output value 0 is set without error message in this case).
As additional parameters, EN and ENO are projected.
Representation in FBD
Representation:
Representation in LD
Appearance:
R_UINT_WORD
528 33002543 10/2013
Representation in IL
Appearance:
LD RealValue
R_UINT_WORD
ST WordValue
Representation in ST
Appearance:
WordValue := R_UINT_WORD (RealValue);
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
The system bit %S18 (see page 609) and system words %SW17 (see page 618) (error status) and
%SW125 (see page 636) (16#DE87: Caldulation errors in a floating point value calculation) are set
when
an unauthorized floating point number is set at the input,
the value range of the data type UINT is exceeded,
a negative input value is to be converted.
Parameter Data type Description
INP REAL Input value
Parameter Data type Description
OUTP WORD Output value
33002543 10/2013 529
Unity Pro
R2T_***
33002543 10/2013
R2T_***: Register to table
Chapter 81
R2T_***: Register to table
Introduction
This chapter describes the R2T_*** block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 530
Detailed description 532
R2T_***
530 33002543 10/2013
Description
Function description
This function block copies the value entered at SRC to the DEST parameter which is interpreted as
a table.
EN and ENO can be configured as additional parameters.
Available functions
The following blocks are available:
R2T_INT
R2T_DINT
R2T_UINT
R2T_UDINT
R2T_REAL
Representation in FBD
Representation:
Representation in LD
Representation:
R2T_***
33002543 10/2013 531
Representation in IL
Representation:
CAL R2T_Instance (NOINC:=FreezesPointerValue,
R:=ResetPointerValue, SRC:=SourceData,
OFF:=PositionInTable, END=>PointerStatus,
DEST=>DestinationTable)
Representation in ST
Representation:
R2T_Instance (NOINC:=FreezesPointerValue,
R:=ResetPointerValue, SRC:=SourceData,
OFF:=PositionInTable, END=>PointerStatus,
DEST=>DestinationTable) ;
Parameter description
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter Data type Description
NOINC BOOL 1: freezes the pointer value
R BOOL 1: resets the pointer value to zero
SRC INT, DINT, UINT,
UDINT, REAL
Source data to be copied in the current cycle
Parameter Data type Description
OFF UINT OFF shows the position in the table. OFF is standardized with a reset
(R), i.e. when R=1, OFF is set to "1". After the restore, OFF is
incremented by 1.
Parameter Data type Description
END BOOL 1: Pointer value = Table length, i.e. table is full, the function block
performs no further copy functions, and OFF is no longer
incremented. The function block (and consequently END as well) can
be reset with R=1.
DEST ANY should be array of
INT, DINT, UINT,
UDINT or REALe.g.
ARRAY[0..X] of
INT
Destination register where source data will be copied in the cycle.
R2T_***
532 33002543 10/2013
Detailed description
Mode of Operation
R2T_*** copies the value entered at SRC to the DEST parameter which is interpreted as a table.
The OFF parameter, an offset, points to the position in the destination field (array) where the source
value is to be saved.
In each cycle, the function copies the value from SRC to DEST[OFF] and increments the offset value
by the size of the data type in the table, i.e. OFF+1.
The offset value is automatically raised in each cycle as long as the NOINC parameter does not
have the value 1. OFF is of the read/write type, equivalent to the VAR_IN_OUT IEC parameters
Association between OFF, NOINC and R:
DEST is type ANY which implicates a pre-defined length. The same type is accepted as the data
type for this array as for SRC irrespective of the type entered for the run time (it could be a structure
of various types).
OFF undergoes a boundary check in each cycle. If OFF exceeds the length of the table (internal
parameter size), END is set to 1 and OFF is no longer increased (the function no longer copies until
OFF accepts a value within the tables boundaries again.
OFF
(previous cycle)
NOINC R OFF
(current
cycle)
Comment
n (any value) 0 1 2 The value for OFF is reset to 1 with R=1, and since
NOINC=0, incremented by 1 already in the same
cycle.
n (any value) 1 1 1 The value for OFF is reset to 1 with R=1, and is not
incremented since NOINC=1.
n (any value) 1 0 n If NOINC=1, the value for OFF is not incremented
and the value from the previous cycle is
maintained.
n (any value) 0 0 n+1 If R=0 and NOINC=0, the value from the previous
cycle is incremented by 1.
33002543 10/2013 533
Unity Pro
READ_PCMCIA
33002543 10/2013
READ_PCMCIA: Reading data in the memory card
Chapter 82
READ_PCMCIA: Reading data in the memory card
Subject of this Chapter
This chapter describes the function READ_PCMCIA.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 534
READ_PCMCIA and WRITE_PCMCIA Example 536
READ_PCMCIA
534 33002543 10/2013
Description
Function description
The READ_PCMCIA function transfers data from the user memory card archiving zone to the PLC
RAM memory. The function READ_U_PCMCIA enables to address the PLC zones beginning to be
copied to the PCMCIA card up to 65 535 (instead of 32 767 for READ_PCMCIA function) and is
therefore recommended to be used instead of READ_PCMCIA function.
The additional parameters EN and ENO can be configured.
An example using the functions READ_PCMCIA and WRITE_PCMCIA is available, READ_PCMCIA
and WRITE_PCMCIA example (see page 536).
Representation in FBD
Representation:
Representation in LD
Representation:
READ_PCMCIA
33002543 10/2013 535
Representation in IL
Representation:
LD Slot_Number
READ_PCMCIA Source_Address, Words_Number, Dest_Address, Read_State
Representation in ST
Representation:
READ_PCMCIA(Slot_Number, Source_Address, Words_Number, Dest_Address,
Read_State);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Slot_Number INT PCMCIA card slot:
0 = upper slot,
1 = lower slot
Source_Address DINT First address where the data is read from the memory card
(0...).
Words_Number INT Number of words to be read.
Dest_Address INT First address where the data is written in the PLC (%MW). The
upper limit of the address is: 32 767.
Parameter Type Comment
Read_State INT Code providing the result of the read commands execution:
16#0000: read performed correctly,
16#0102: Dest_Address + Words_Number -1 is greater
than the maximum number of declared words in the PLC.
16#0104: no valid application or no word in the PLC,
16#0201: no file zone in the memory card,
16#0202: memory card error,
16#0204: memory card write-protected,
16#0241: Source_Address < 0,
16#0242: Dest_Address + Words_Number-1 is greater
than the highest address of the memory card,
16#0401: Words_Number = 0,
16#0402: Slot_Number is different from 0 and 1.
16#0501: Words_Number = unsupported service.
READ_PCMCIA
536 33002543 10/2013
READ_PCMCIA and WRITE_PCMCIA Example
Objectives
This example shows how to use the READ_PCMCIA and WRITE_PCMCIA function blocks by:
Writing values from words (%MW100 to %MW109) to a memory card.
Reading values from the memory card to words (%MW110 to %MW119).
NOTE: In this example, to use those function blocks, a memory card must be connected into the
PLC.
Configuration of the CPU
In this example, the TSX MRP C007M SRAM memory card is connected into the upper slot A of
the CPU (parameter SLOT = 0 for the functions blocks). In addition, for data storage purposes, the
CPU is configured with 2000 kB of memory.
NOTE: The data storage is used for READ_PCMCIA and WRITE_PCMCIA function blocks. The
2000 kB of data storage represents:
The READ_PCMCIA and WRITE_PCMCIA functions are working with word addresses:
Addresses from 0 to 1024000 for the memory card can be used.
READ_PCMCIA
33002543 10/2013 537
Programming the MAST section
In the MAST section of the program, program as follows:
The memory card is connected into slot 0.
The WRITE_PCMCIA function writes 10 words to address 10000 on the memory card from
%MW100.
The READ_PCMCIA reads 10 words from address 10000 on the memory card to %MW110.
Representation of WRITE_PCMCIA and READ_PCMCIA in FBD language:
Representation of WRITE_PCMCIA and READ_PCMCIA in ST language:
WRITE_PCMCIA (0,10000,10,100,Status_write);
READ_PCMCIA (0,10000,10,110,Status_read);
Testing the Example
By using animation tables with words: %MW100 to %MW119, the values from %MW100 to
%MW109 are copied to %MW110 to %MW119 via the memory card.
READ_PCMCIA
538 33002543 10/2013
33002543 10/2013 539
Unity Pro
ROR1_ARB
33002543 10/2013
ROR1_ARB: Right shift of one byte from a table of bytes
Chapter 83
ROR1_ARB: Right shift of one byte from a table of bytes
Description
Function Description
The ROR1_ARB function is used to perform a rotation shift to the right of a byte in a PL7 byte table.
Using Unity Pro, the PL7 byte tables have become character strings. This is therefore the rotation
shift of a byte to the right in a character string.
The additional parameters EN and ENO can be configured.
FBD representation
Representation:
LD representation
Representation:
IL representation
Representation:
LD String1
ROR1_ARB
ROR1_ARB
540 33002543 10/2013
ST representation
Representation:
ROR1_ARB(String1);
Parameter Description
The following table describes the input/output parameters:
NOTE: This function is necessary to process certain communication requests, such as the
SEND_REQ function, which introduces an additional byte at the beginning of the response.
Example:
Objects to read:
16#0201
16#0403
16#0605
16#0807
16#0A09
Reception table after execution of a SEND_REQ (read object):
%MW100=16#0107
%MW101=16#0302
%MW102=16#0504
%MW103=16#0706
%MW104=16#0908
%MW105=16#000A
Reception table after a ROR1_ARB(%MW100:6):
%MW100=16#0201
%MW101=16#0403
%MW102=16#0605
%MW103=16#0807
%MW104=16#0A09
%MW105=16#0700
Parameter Type Comment
String1 STRING Character string whose bytes are to be moved.
Caution: this parameter is an input/output. Each time this instruction
occurs, the character string will therefore be moved by one byte.
33002543 10/2013 541
Unity Pro
RRTC
33002543 10/2013
RRTC: Reading the system date
Chapter 84
RRTC: Reading the system date
Description
Description of the function
The function RRTC captures the current date from the PLC real-time clock. It is a function used to
convert PL7 applications.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
RRTC
ST Result_Date
RRTC
542 33002543 10/2013
Representation in ST
Representation:
RRTC(Result_Date);
Description of parameters
The following table describes the output parameters:
PL7 DATE_AND_TIME format
The PL7 DATE_AND_TIME (DT) format is displayed as follow:
yyyy-mm-dd-hh:mm:ss
example 2000-05-18-15:45:22
the value is BCD coded on 64 bit. The result is an array of 4 integers.
With the previous example in hexadecimal.
NOTE: Only the DT included between [1990-01-01-00:00:00, 2099-12-31-23:59:59] are allowed.
Parameter Type Comment
Result_Date ARRAY [0...3] OF INT Result_Date contains the current date value in PL7 DT
format (array of 4 integers).
33002543 10/2013 543
Unity Pro
SCOUNT
33002543 10/2013
SCOUNT: Up/down counting with overshoot signaling
Chapter 85
SCOUNT: Up/down counting with overshoot signaling
Description
Function description
The SCOUNT function carries out up/down counting with overshoot signaling.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
SCOUNT
544 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD Valid
SCOUNT Presel_Value, Count_Up, Count_Down, Minimum, Maximum, Mem_Word,
Output_Qmin, Output_Qmax, Count_Value
Representation in ST
Representation:
SCOUNT(Valid, Presel_Value, Count_Up, Count_Down, Minimum, Maximum,
Mem_Word, Output_Qmin, Output_Qmax, Count_Value);
SCOUNT
33002543 10/2013 545
Description of parameters
The following table describes the input parameters:
The following table describes the input/output parameters:
The following table describes the output parameters:
Parameter Type Comment
Enable BOOL Enable input selected, the function is only
executed if it is Valid = 1.
Presel_Value INT Preset value, that is the initial count value.
Count_Up BOOL Upcounter input, on each pulse, Count_Value
is incremented by 1.
Count_Down BOOL Downcounter input, on each pulse,
Count_Value is decremented by 1.
Minimum INT Minimum count value, when: Count_Value =
Minimum,
Output_Qmin = 1.
Maximum INT Maximum count value, when: Count_Value =
Maximum,
Output_Qmin = 1.
Parameter Type Comment
Mem_Word INT Integer used as an input and an output enabling
up/down counter inputs to be stored:
bit 0, for Count_Up,
bit 1, for Count_Down
Parameter Type Comment
Output_Qmin EBOOL Output which indicates that the count value has
reached the minimum threshold:
Count_Value = Minimum,
Output_Qmin = 1
Output_Qmax EBOOL Output which indicates that the count value has
reached the maximum threshold:
Count_Value = Maximum,
Output_Qmax = 1
Count_Value INT Current count value.
SCOUNT
546 33002543 10/2013
NOTE:
If (en) = 0 then the function is no longer enabled and on each call, we have:
Output_Qmin = Output_Qmax = 0
Mem_Word:X0 = Mem_Word:X1 = 0, Count_Value = Presel_Value
If Maximum > Minimum then:
Count_Value Maximum entails: Output_Qmax = 1 and Output_Qmin = 0
Minimum < Count_Value < Maximum entails: Output_Qmax = Output_Qmin = 0
Count_Value Minimum entails: Output_Qmax = 0 and Output_Qmin = 1
If Maximum < Minimum then:
Maximum Count_Value Minimum entails: Output_Qmax = 1 and Output_Qmin = 0
Count_Value < Maximum entails: Output_Qmax = 0 and Output_Qmin = 1
Count_Value > Maximum entails: Output_Qmax = 1 and Output_Qmin = 0
If Maximum = Minimum then:
Count_Value < Maximum and Minimum entails: Output_Qmax = 0 and Output_Qmin = 1
Count_Value Maximum and Minimum entails: Output_Qmax = 1 and Output_Qmin = 0
A modification of the Presel_Value parameter with Enable set to 1 has no impact on
operation.
A negative value for the Presel_Value and Minimum parameters is interpreted as a nil value.
A value of less than 1 for the Maximum parameter is interpreted as equal to 1.
Timing diagram
Functional timing diagram:
33002543 10/2013 547
Unity Pro
SET_BIT
33002543 10/2013
SET_BIT: Set bit
Chapter 86
SET_BIT: Set bit
Description
Function description
This function sets the bit of the OutputRegister output word selected with BitNumber to the
value of InputData.
The BitNumber parameter provides the bit number in the output data.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
WARNING
FORCED VALUES NOT TAKEN INTO ACCOUNT
This procedure overwrites the values in State memory WITHOUT regard to possible forced
values in the reference data editor. This can produce serious process conditions.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
SET_BIT
548 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD InputData
SET_BIT BitNumber
ST OutputRegister
Representation in ST
Representation:
OutputRegister := SET_BIT (InputData, BitNumber);
Parameter description
Description of input parameters:
Description of output parameters:
Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 603.
Parameter Data type Description
InputData BOOL Input data
BitNumber UINT Bit number to be written.
Parameter Data type Description
OutputRegister WORD Output
33002543 10/2013 549
Unity Pro
SET_PCMCIA
33002543 10/2013
SET_PCMCIA: Initialization of the archiving zone
Chapter 87
SET_PCMCIA: Initialization of the archiving zone
Description
Function description
The SET_PCMCIA function enables all or part of the user memory cards archiving zone to be
initialized at the desired value.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
SET_PCMCIA
550 33002543 10/2013
Representation in IL
Representation:
LD Slot_Number
SET_PCMCIA Address, Words_Number, Init_Value, Init_State
Representation in ST
Representation:
SET_PCMCIA(Slot_Number, Address, Words_Number, Init_Value, Init_State);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Slot_Number INT PCMCIA card slot:
0 = upper slot,
1 = lower slot
Address DINT Address of the archiving zone from which
initialization is performed.
Words_Number INT Number of words to be initialized.
Init_Value INT Initialization value.
Parameter Type Comment
Init_State INT Code providing the result of the initialization
commands execution:
16#0000: initialization performed correctly,
16#0201: no file zone in the memory card,
16#0202: memory card error,
16#0204: memory card write-protected,
16#0241: negative address,
16#0242: Address + Words_Number-1 is
greater than the highest address of the
memory card,
16#0401: Words_Number 0,
16#0402: Slot_Number is different from 0
and 1,
16#0501: unsupported service.
33002543 10/2013 551
Unity Pro
SHL_RBIT_***
33002543 10/2013
SHL_RBIT_***: Left shift on an integer or double integer
Chapter 88
SHL_RBIT_***: Left shift on an integer or double integer
Description
Function description
The function SHL_RBIT_*** performs a shift to the left for an integer or a double integer, with
recovery of the moved bits.
The additional parameters EN and ENO can be configured.
Available functions
List of available functions:
SHL_RBIT_INT,
SHL_RBIT_DINT.
Representation in FBD
Representation applied to an integer:
Representation in LD
Representation applied to an integer:
SHL_RBIT_***
552 33002543 10/2013
Representation in IL
Representation applied to an integer:
LD Input_Var
SHL_RBIT_INT Shift_Num, Shifted_Var, Shifted_Bits
Representation in ST
Representation applied to an integer:
SHL_RBIT_INT(Input_Var, Shift_Num, Shifted_Var, Shifted_Bits);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Input_Var INT, DINT Variable on which the shift is to be performed.
Example: Input_Var = 2#0001111101101000.
Shift_Num INT Value of the shift to be performed.
Example: Shift_Num = 4.
Parameter Type Comment
Shifted_Var INT, DINT Shifted_Var contains the value of Input_Var shifted by the
number of bits given by Shift_Num. The shift register is filled with
zeros.
Example: with the data examples of the previous table, the result is
the following Shifted_Var = 2#1111011010000000
Shifted_Bits INT, DINT Shifted_Bits contains the shifted bits.
Example: with the example values of the previous table, the result
is the following Shifted_Bits = 2#0000000000000001
33002543 10/2013 553
Unity Pro
SHR_RBIT_***
33002543 10/2013
SHR_RBIT_***: Right shift on an integer or double integer
Chapter 89
SHR_RBIT_***: Right shift on an integer or double integer
Description
Function description
The SHR_RBIT_*** function performs a shift to the right on an integer or a double integer with
sign extension and recovery of the shifted bits.
The additional parameters EN and ENO can be configured.
Available functions
List of available functions:
SHR_RBIT_INT,
SHR_RBIT_DINT.
Representation in FBD
Representation applied to a double integer:
Representation in LD
Representation applied to a double integer:
SHR_RBIT_***
554 33002543 10/2013
Representation in IL
Representation applied to a double integer:
LD Input_Var
SHR_RBIT_DINT Shift_Num, Shifted_Var, Shifted_Bits
Representation in ST
Representation applied to a double integer:
SHR_RBIT_DINT(Input_Var, Shift_Num, Shifted_Var, Shifted_Bits);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Input_Var INT, DINT Variable on which the shift is to be performed.
Example: Input_Var = 2#10000000111100010000000011001111.
Shift_Num INT Value of the shift to be performed.
Example: Shift_Num = 6.
Parameter Type Comment
Shifted_Var INT, DINT Shifted_Var contains the value of Input_Var shifted by the number
of bits given by Shift_Num. With conservation of the sign and
propagation of the sign bit in the bits liberated by the shift.
Example: with the data examples of the previous table, the result is the
following Shifted_Var = 2#1 1111110000000111100010000000011
Shifted_Bits INT, DINT Shifted_Bits contains the shifted bits.
Example: with the data examples of the previous table, the result is the
following Shifted_Bits = 2#00000000000000000000000000001111
33002543 10/2013 555
Unity Pro
SHRZ_***
33002543 10/2013
SHRZ_***: Right shift on an integer or double integer
Chapter 90
SHRZ_***: Right shift on an integer or double integer
Description
Function description
The function SHRZ_*** performs a shift to the right on an integer or a double integer and fills the
shift register with zeros.
The additional parameters EN and ENO can be configured.
Available functions
List of available functions:
SHRZ_INT,
SHRZ_DINT.
Representation in FBD
Representation applied to an integer:
Representation in LD
Representation applied to an integer:
SHRZ_***
556 33002543 10/2013
Representation in IL
Representation applied to an integer:
LD Input_Var
SHRZ_INT Shift_Num
ST Shifted_Var
Representation in ST
Representation applied to an integer:
Shifted_Var := SHRZ_INT(Input_Var, Shift_Num);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Input_Var INT, DINT Variable on which the shift is to be performed.
Example: Input_Var = 2#1000000011110001.
Shift_Num INT Value of the shift to be performed.
Example: Shift_Num = 4.
Parameter Type Comment
Shifted_Var INT, DINT Shifted_Var contains the value of Input_Var shifted by the
number of bits given by Shift_Num. The shift register is filled with
zeros.
Example: with the data examples of the previous table, the result is
the following Shifted_Var = 2#0000100000001111
33002543 10/2013 557
Unity Pro
SHRZ_RBIT_***
33002543 10/2013
SHRZ_RBIT_***: Right shift on an integer or double integer
Chapter 91
SHRZ_RBIT_***: Right shift on an integer or double integer
Description
Function description
The function SHRZ_RBIT_*** performs a shift to the right on an integer or a double integer, fills
the shift register with zeros and recovers the shifted bits.
The additional parameters EN and ENO can be configured.
Available functions
List of available functions:
SHRZ_RBIT_INT,
SHRZ_RBIT_DINT.
Representation in FBD
Representation applied to an integer:
Representation in LD
Representation applied to an integer:
SHRZ_RBIT_***
558 33002543 10/2013
Representation in IL
Representation applied to an integer:
LD Input_Var
SHRZ_RBIT_INT Shift_Num, Shifted_Var, Shifted_Bits
Representation in ST
Representation applied to an integer:
SHRZ_RBIT_INT(Input_Var, Shift_Num, Shifted_Var, Shifted_Bits);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Input_Var INT, DINT Variable on which the shift is to be performed.
Example: Input_Var = 2#1000000011110001.
Shift_Num INT Value of the shift to be performed.
Example: Shift_Num = 4.
Parameter Type Comment
Shifted_Var INT, DINT Shifted_Var contains the value of Input_Var shifted by the
number of bits given by Shift_Num. The shift register is filled with
zeros.
Example: with the data examples of the previous table, the result is
the following Shifted_Var = 2#0000100000001111
Shifted_Bits INT, DINT Shifted_Bits contains the shifted bits.
Example: with the data examples of the previous table, the result is
the following Shifted_Bits = 2#0001000000000000
33002543 10/2013 559
Unity Pro
SRCH
33002543 10/2013
SRCH: Search
Chapter 92
SRCH: Search
Introduction
This chapter describes the SRCH block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 560
Detailed description 563
SRCH
560 33002543 10/2013
Description
Function description
This function block searches a source table for an entered bit pattern. It increments the directory
in the source table in each released cycle and checks whether the displayed Array element
matches the defined pattern or not.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Appearance:
SRCH
33002543 10/2013 561
Representation in IL
Representation:
CAL SRCH_Instance (TRIG:=StartsSearch, CONT:=ContinueSearch,
SRC:=SourceTable, PATTERN:=BitPatternForSearch,
INDEX:=FindingPlace, FOUND=>FoundPattern)
Representation in ST
Representation:
SRCH_Instance (TRIG:=StartsSearch, CONT:=ContinueSearch,
SRC:=SourceTable, PATTERN:=BitPatternForSearch,
INDEX:=FindingPlace, FOUND=>FoundPattern) ;
Parameter description
Description of input parameters:
Parameter Data type Description
TRIG BOOL TRIG detects the rising edge and starts the search
for the next element in the table.
CONT BOOL CONT defines whether to continue the search or to
resume it at the beginning of the table.
1 = The search will be continued with the next rising
edge of TRIG.
0 = The search position is reset to the beginning of
the table with the next rising edge of TRIG and the
first element of the table will be compared to the
pattern.
SRC ANY should be a field
(array) of type INT,
DINT, UINT, UDINT or
REAL e.g.
ARRAY[0..X] OF
INT
Source table
PATTERN INT, DINT, UINT,
UDINT, REAL
PATTERN is the bit pattern to be searched for.
Note: The length of the bit pattern to be searched
for is always derived from the length of the data type
at the input PATTERN; the length of the Array
element is not considered. To enable correct work
methods, make sure that the data type of PATTERN
is identical to that of the array to be searched for.
SRCH
562 33002543 10/2013
Description of input / output parameters:
Description of output parameters:
Parameter Data type Description
INDEX UINT INDEX displays the Array index of the last search
process. (This means that when the pattern is
found, the INDEX parameter will indicate where the
pattern was found in the table). The value of the
variables at the input can be changed with the
application to change the search position in the
table.
Note: INDEX always displays the Array index to
which the last comparison was applied. It will always
begin counting at 1 for the first Array element,
regardless of the actual Array limits that were
defined in the data editor. INDEX always counts
ascending, even if the index is greater than the
number of Array elements.
Parameter Data type Description
FOUND BOOL 1 = pattern found
SRCH
33002543 10/2013 563
Detailed description
Function description
The SRCH function block searches a source table for an entered bit pattern. It increments the
directory in the source table in each released cycle marked TRIG and checks whether the Array
element displayed with INDEX matches the defined pattern or not. The result is displayed at the
FOUND output.
SRC (source) is type ANY which implicates a pre-defined length. This field (array) is interpreted as
an ARRAY with the same data type (INT, DINT, UINT, UDINT, REAL) as the data type used at the
PATTERN input. To enable correct work methods, make sure that the data type of PATTERN is
identical to that of the array to be searched for. A binary comparison is performed in each cycle
between PATTERN and an Array element. The length of the comparison is always derived from the
length of PATTERN; the length of the Array element is not considered.
TRIG detects the rising edge and starts the search for one cycle. The search will stop after this
cycle until the next rising edge is detected at TRIG.
PATTERN is the bit pattern to be searched for.
The CONT parameter defines whether to continue the search or to resume it at the beginning of the
table after a pattern has been found.
Once the pattern is found, FOUND is set to "1" and the INDEX parameter shows where in the table
the pattern has been found.
SRCH
564 33002543 10/2013
33002543 10/2013 565
Unity Pro
STR_ROUND
33002543 10/2013
STR_ROUND: Approximate value of a floating point number
Chapter 93
STR_ROUND: Approximate value of a floating point
number
Description
Function description
The STR_ROUND function provides the approximate value of a floating point number expressed in
the form of a character string.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Real_Str
STR_ROUND Pos, Rounded_Str
STR_ROUND
566 33002543 10/2013
Representation in ST
Representation:
STR_ROUND(Real_Str, Pos, Rounded_Str);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Runtime errors
The length of the original and resulting character strings must be between 15 and 255. Otherwise
, the system bit %S15 (see page 609) is set to 1.
The parameter Pos must be between 0 and 8. Otherwise, the bit %S20 (see page 609) is set to 1.
Special case for Pos = 0 and Pos = 8, the rounding off is not performed, Real_Str =
Rounded_Str.
When the last character different to zero is greater than 5, the preceding character is incremented.
Parameter Type Comment
Real_Str STRING Character string containing the real number.
Example: -1.1354942e-30
Pos INT Position from which the rounding off is performed. The
position is calculated from the decimal separator, and
the calculation is inclusive of the separator.
Example: 2
Parameter Type Comment
Rounded_Str STRING Result of truncation.
Example: with the data examples of the previous table,
the result is the following -1.1000000e-30
33002543 10/2013 567
Unity Pro
SUB_***_PL7
33002543 10/2013
SUB_***_PL7 : Subtract a period
Chapter 94
SUB_***_PL7 : Subtract a period
Description
Description of the function
The SUB_***_PL7 function removes a period from a date or from a time expressed in the DT
format or TOD format of PL7.
The additional parameters EN and ENO can be configured.
Available functions
The available functions are as follows:
SUB_DT_PL7,
SUB_TOD_PL7.
Representation in FBD
Representation applied to a time of day:
Representation in LD
Representation applied to a time of day:
SUB_***_PL7
568 33002543 10/2013
Representation in IL
Representation applied to a time of day:
LD Source_Value
SUB_TOD_PL7 Time_to_Sub
ST Result_Value
Representation in ST
Representation applied to a time of day:
Result_Value := SUB_TOD_PL7(Source_Value, Time_to_Add);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
NOTE: management of leap years must be provided for in the application.
Parameter Type Comment
Source_Value DINT,
ARRAY [0..3] OF INT
Date or time.
Time_to_Sub DINT,
ARRAY [0..3] OF INT
Period to be subtracted from Source_Value
Note : this time is expressed in the TIME format of PL7
(with an accuracy of the order of one tenth of a second).
As the DT and TOD types of PL7 (converted under
Unity Pro into DINT or tables of 4 INT) are expressed to
the nearest second, Time_to_Sub is rounded to the
nearest second.
Parameter Type Comment
Result_Value DINT,
ARRAY [0..3] OF INT
Result_Value is of the same type as
Source_Value.
SUB_***_PL7
33002543 10/2013 569
Execution errors
If Source_Value is in the DINT format (TOD of PL7), there is a change of day if Result_Value
is outside of the range of authorized values. In this case the system bit %S18 (see page 609) is set
at 1 and the value of Result_Value is only significant with a modulo 24:00:00.
If Source_Value is in the ARRAY [0..3] OF INT format (DT of PL7), if Result_Value is outside
the authorized range of values, the system bit %S18 (see page 609) is set at 1 and the value of
Result_Value is also at the minimum limit.
If one of the input parameters cannot be interpreted and is inconsistent with the function format
then the system bit %S18 (see page 609) is set at 1 and Result_Value applies:
00:00:00 for the TOD type of PL7.
00001-01-01-00:00:00 for the DT type of PL7.
SUB_***_PL7
570 33002543 10/2013
33002543 10/2013 571
Unity Pro
SYSSTATE
33002543 10/2013
SYSSTATE: System state
Chapter 95
SYSSTATE: System state
Description
Function description
This function block displays the status of the PLC.
SYSSTATE is task-specific and can be used in MAST, FAST and AUX tasks.
SYSSTATE cannot be used in EVT tasks.
EN and ENO can be configured as additional parameters.
Representation in FBD
Representation:
Representation in LD
Representation:
SYSSTATE
572 33002543 10/2013
Representation in IL
Representation:
CAL SYSSTATE_Instance (COLD=>ColdStartCycle,
WARM=>WarmStartCycle, ERROR=>ErrorInBuffer)
Representation in ST
Representation:
SYSSTATE_Instance (COLD=>ColdStartCycle,
WARM=>WarmStartCycle, ERROR=>ErrorInBuffer) ;
Parameter description
Description of output parameters:
NOTE: In cold start cycle both outputs COLD and WARM are set to "1".
Parameter Data type Description
COLD BOOL Is set for one cycle to "1", when the user task is in a
cold start cycle, i.e. the first start after the project
has been completely loaded.
COLD operates inversely to the user task bit in
%SW10 (TSKINIT).
WARM BOOL Is set for one cycle to "1" when the PLC or the user
task is started, i.e. after switching on the power or by
starting the SPS after a stop.
When a STOP->RUN transition of the
corresponding tasks occurs, WARM is set to "1".
After the logic of the corresponding tasks have been
completed, WARM is set to "0".
WARM is identical to the user task specific system bit
%S21.
ERROR BOOL Is set to "1" when there are error messages in the
diagnostic buffer that have not yet been
acknowledged.
ERROR is set to "1" if %SW78 (DNBERRBUF) is not
"0".
33002543 10/2013 573
Unity Pro
T2T
33002543 10/2013
T2T: Table to table
Chapter 96
T2T: Table to table
Introduction
This chapter describes the T2T block.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Description 574
Detailed Description 577
T2T
574 33002543 10/2013
Description
Function description
This function block copies the value from the SRC parameter to the DEST parameter. Both tables
have to be of the same data type.
When setting OFF to 0 the copy operation is blocked. In this case the function block sets END to 1
and doesnt perform any data copying.
If the sum of OFF and SIZE is outside of the DEST table END is also set to 1.
Independent from the data type of SRC and DEST the function block copies on a word base (16
bits). This results in the following behavior:
In case of arrays defined of data types smaller than 16 bits (e.g. BOOL, EBOOL, BYTE) the
function block copies two values at once. Due to this, the number of elements in the source and
destination table has to be even.
In case of arrays defined of 32 bits data types (e.g. DINT, UDINT, REAL) the function block has
to copy 2 words per array element. Due to this, the parameters OFF and SIZE has to be
increased by 2 per array element to copy.
In general the copy operation will only be performed for END=0.
If NOINC is set to 0, the value of OFF increases by SIZE after each copy operation.
EN can be configured as additional parameter.
NOTE: ENO is not supported by this function block (value is always 1).
Representation in FBD
Representation:
T2T
33002543 10/2013 575
Representation in LD
Representation:
Representation in IL
Representation:
CAL T2T_Instance (NOINC:=FreezesPointerValue,
R:=Reset, SRC:=SourceData,
SIZE:=NumberOfWordsToCopy, OFF:=Offset,
END=>PointerValue, DEST=>DestinationTable)
Representation in ST
Representation:
T2T_Instance (NOINC:=FreezesPointerValue,
R:=Reset, SRC:=SourceData,
SIZE:=NumberOfWordsToCopy, OFF:=Offset,
END=>PointerValue, DEST=>DestinationTable) ;
T2T
576 33002543 10/2013
Parameter description
Description of input parameters:
Description of input / output parameters:
Description of output parameters:
Parameter Data type Description
NOINC BOOL 1: Freezes the pointer value. The value of OFF
remains unchanged.
R BOOL 1: Sets the offset variable (OFF) to the first element
and resets the END output before starting the copy
operations.
SRC ANY should be an
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
Source data to be copied in the current cycle
SIZE UINT The variable tells the function block how many
words have to copied every cycle.
Parameter Data type Description
OFF UINT Offset in both the source and destination table.
Parameter Data type Description
END BOOL 1: Pointer value = table length (function block
cannot increment any further)
1: If OFF=0 or if the sum of OFF and SIZE is outside
the destination table DEST. Copy operation is
disabled.
DEST ANY should be an
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
Destination table where source table will be copied
in the cycle.
T2T
33002543 10/2013 577
Detailed Description
Mode of Operation
This function copies the value from the SRC parameter, which is interpreted as a table, to the DEST
parameter, which is also interpreted as a table.
The parameter OFF points into both tables. It is an index for the source array and the destination
array where the source value should be copied from and to.
In each cycle the function copies the value of SRC[OFF] to DEST[OFF].
The offset will be incremented in each cycle by the number of 16 bit words, which are copied,
unless the parameter NOINC is 1. OFF is of the read/write type, equivalent to the VAR_IN_OUT IEC
parameters
A parameter SIZE tells the EFB how many words have to be copied every cycle.
OFF is reset if the parameter R has the value 1 before copying.
SRC and DEST are type ANY, which implies a predefined length. These variables will be interpreted
as an ARRAY of bytes regardless of the type definition for these parameters (they may be a
structure of different types).
OFF undergoes a boundary check each cycle. If OFF exceeds the length of one of the tables, then
END is set to 1 and OFF is not incremented. The function will not copy any more data until OFF
returns within its boundaries.
Copying Tables with More than 10,000 Words
To copy tables of more than 10,000 words, the T2T function block must be used instead of the
direct assignment :=.
Example: If Tab_1 and Tab_2 are two INT Arrays [1..20000] , do not use Tab_1:=Tab_2;
Instead, use: T2T_Instance(NOINC:=0, R=1, SRC:=Tab_1, SIZE:=20000,
OFF:=Offset, END=>PointerValue, DEST=>Tab_2
NOTE: During the transfer of a large table using the direct copy Tab_1:=Tab_2, some system
words linked to time calculation (for example: %SW30) are not refreshed correctly. This problem
does not occur with the T2T function.
T2T
578 33002543 10/2013
33002543 10/2013 579
Unity Pro
TIME_DINT_TO_STRING
33002543 10/2013
TIME_DINT_TO_STRING: Conversion of a variable to DINT format
Chapter 97
TIME_DINT_TO_STRING: Conversion of a variable to DINT
format
Description
Function description
The function TIME_DINT_TO_STRING is used to convert a variable in DINT format (TIME using
PL7) into a character string.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Time1
TIME_DINT_TO_STRING
ST Result_Str
TIME_DINT_TO_STRING
580 33002543 10/2013
Representation in ST
Representation:
Result_Str := TIME_DINT_TO_STRING(Time1);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Runtime errors
If the string Result_Str is too short to contain the date (length = less than 15 characters), the
date is truncated and the bit %S15 (see page 609) is set to 1.
Parameter Type Comment
Time1 DINT Duration to convert into character string format.
Parameter Type Comment
Result_Str String Result_Str is a string of 15 characters containing a
duration in the following format: HHHHHH:MM:SS.D.
Example: 119304:38:49.5
33002543 10/2013 581
Unity Pro
TOD_DINT_TO_STRING
33002543 10/2013
TOD_DINT_TO_STRING: Conversion of a variable to TOD format
Chapter 98
TOD_DINT_TO_STRING: Conversion of a variable to TOD
format
Description
Function description
The function TOD_DINT_TO_STRING is used to convert a TOD format PL7 variable, or DINT
double integer, into a character string.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Time1
TOD_DINT_TO_STRING
ST Result_Str
TOD_DINT_TO_STRING
582 33002543 10/2013
Representation in ST
Representation:
Result_Str := TOD_DINT_TO_STRING(Time1);
Description of parameters
The following table describes the input parameters:
The following table describes the output parameters:
Runtime errors
If the string Result_Str is too short to contain the converted value (length = less than 8
characters), it is truncated and the bit %S15 (see page 609) is set to 1.
Parameter Type Comment
Time1 DINT PL7 time of day to convert into character string format.
Parameter Type Comment
Result_Str String Result_Str is a string of 8 characters containing a
time of day in the following format: HH:MM:SS.
Example: 04:38:49
33002543 10/2013 583
Unity Pro
TRANS_TIME
33002543 10/2013
TRANS_TIME: Conversion of a duration into DINT format
Chapter 99
TRANS_TIME: Conversion of a duration into DINT format
Description
Function description
The function TRANS_TIME is used to convert a duration in DINT format (TIME using PL7) into a
number.
of hours (HHHH),
of minutes (MM),
of seconds (SS).
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Time1
TRANS_TIME
ST Result_DINT
TRANS_TIME
584 33002543 10/2013
Representation in ST
Representation:
Result_DINT := TRANS_TIME(Time1);
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Runtime errors
The maximum possible value is therefore 9999 hours, 59 minutes and 59 seconds, or 359,999,990
tenths of a second.
If Time1 is 360,000,000, there is an overflow, the bit %S15 (see page 609) switches to 1 and
Result_DINT = 16#00000000
Parameter Type Comment
Time1 DINT Duration to convert. Time1 is expressed in tenths of
seconds; the value used for the function is therefore
rounded off to the second.
Parameter Type Comment
Result_DINT DINT Result_INT is a double integer that breaks down as
follows:
the most significant word contains the hours in BCD
format,
the least significant word contains the minutes and
seconds:
the most significant byte contains the minutes in
BCD format,
the least significant byte contains the seconds in
BCD format.
Example: 16#00233740 corresponds to 23 hours, 37
minutes and 40 seconds.
Note: Result_DINT ranges between 0000:00:00 and
9999:59:59.
33002543 10/2013 585
Unity Pro
W_INT_REAL
33002543 10/2013
W_INT_REAL: Type conversion (WORD -> INT -> REAL) (W_INT_REAL: Type conversion (WORD -> INT -> REAL))
Chapter 100
W_INT_REAL: Type conversion (WORD -> INT -> REAL)
(W_INT_REAL: Type conversion (WORD -> INT -> REAL))
Description
Function description
This function converts an input value with data type WORD to data type INT and then data type
REAL.
As opposed to the WORD_TO_REAL conversion module (standard library), the W_INT_REAL
module performs a conversion to an INT value prior to output of the REAL value. The result is, for
example, that the input value FFFF is output as output value -1.0. (Not as with the WORD_TO_REAL
module, for which the output value 9.183409e-41 is set).
As additional parameters, EN and ENO are projected.
Representation in FBD
Representation:
Representation in LD
Appearance:
W_INT_REAL
586 33002543 10/2013
Representation in IL
Appearance:
LD WordValue
W_INT_REAL
ST RealValue
Representation in ST
Appearance:
RealValue := W_INT_REAL (WordValue);
Parameter description
Description of input parameters:
Description of output parameters:
Parameter Data type Description
INP WORD Input value
Parameter Data type Description
OUTP REAL Output value
33002543 10/2013 587
Unity Pro
W_UINT_REAL
33002543 10/2013
W_UINT_REAL: Type conversion (WORD -> UINT -> REAL) (W_UINT_REAL: Type conversion (WORD -> UINT -> REAL))
Chapter 101
W_UINT_REAL: Type conversion (WORD -> UINT -> REAL)
(W_UINT_REAL: Type conversion (WORD -> UINT ->
REAL))
Description
Function description
This function converts an input value with data type WORD to data type UINT and then data type
REAL.
As opposed to the WORD_TO_REAL conversion module (standard library), the W_UINT_REAL
module performs a conversion to a UINT value prior to output of the REAL value. The result is, for
example, that the input value FFFF is output as output value 65535.0. (Not as with the
WORD_TO_REAL module, for which the output value 9.183409e-41 is set).
As additional parameters, EN and ENO are projected.
Representation in FBD
Representation:
Representation in LD
Appearance:
W_UINT_REAL
588 33002543 10/2013
Representation in IL
Appearance:
LD WordValue
W_UINT_REAL
ST RealValue
Representation in ST
Appearance:
RealValue := W_UINT_REAL (WordValue);
Parameter description
Description of input parameters:
Description of output parameters:
Parameter Data type Description
INP WORD Input value
Parameter Data type Description
OUTP REAL Output value
33002543 10/2013 589
Unity Pro
WRITE_PCMCIA
33002543 10/2013
WRITE_PCMCIA: Writing data to the memory card
Chapter 102
WRITE_PCMCIA: Writing data to the memory card
Description
Function description
The WRITE_PCMCIA function transfers data from the PLCs RAM memory to the user memory card
archiving zone. The function WRITE_U_PCMCIA enables to address the PLC zones beginning to
be copied to the PCMCIA card up to 65 535 (instead of 32 767 for WRITE_PCMCIA function) and
is therefore recommended to be used instead of WRITE_PCMCIA function.
The additional parameters EN and ENO can be configured.
An example using the functions READ_PCMCIA and WRITE_PCMCIA is available, READ_PCMCIA
and WRITE_PCMCIA example (see page 536).
Representation in FBD
Representation:
WRITE_PCMCIA
590 33002543 10/2013
Representation in LD
Representation:
Representation in IL
Representation:
LD Slot_Number
WRITE_PCMCIA Dest_Address, Words_Number, Source_Address, Write_State
Representation in ST
Representation:
WRITE_PCMCIA(Slot_Number, Dest_Address, Words_Number, Source_Address,
Write_State);
WRITE_PCMCIA
33002543 10/2013 591
Description of the parameters
The following table describes the input parameters:
The following table describes the output parameters:
Parameter Type Comment
Slot_Number INT PCMCIA card slot:
0 = upper slot,
1 = lower slot
Dest_Address DINT First address where the data is written in the memory card.
Words_Number INT Number of words to write.
Source_Address INT First address where the data is read from the PLC (%MW). The
upper limit of the address is: 32767.
Parameter Type Comment
Write_State INT Code providing the result of the write commands execution:
16#0000: write performed correctly,
16#0102: Source_Address + Words_Number - 1 is greater
than the maximum number of declared words in the PLC,
16#0104: no valid application or no word in the PLC,
16#0201: no file zone in the memory card,
16#0202: memory card error,
16#0204: memory card write-protected,
16#0241: Dest_Address < 0,
16#0242: Dest_Address + Words_Number-1 is greater than the
highest address of the memory card,
16#0401: Words_Number = 0,
16#0402: Slot_Number is different from 0 and 1,
16#0501: unsupported service.
WRITE_PCMCIA
592 33002543 10/2013
33002543 10/2013 593
Unity Pro
WRTC
33002543 10/2013
WRTC: Updating the system date
Chapter 103
WRTC: Updating the system date
Description
Description of the function
The WRTC function updates the current date in the PLC real-time clock. It is a function used to
convert PL7 applications.
The additional parameters EN and ENO can be configured.
Representation in FBD
Representation:
Representation in LD
Representation:
Representation in IL
Representation:
LD Date1
WRTC
WRTC
594 33002543 10/2013
Representation in ST
Representation:
WRTC(Date1);
Description of parameters
The following table describes the input parameters:
Parameter Type Comment
Date1 ARRAY
[0...3] OF
INT
Date1 must contain the current value of the date in PL7
DT format (table of 4 integers). The contents of this
variable must be assigned by program before launching
the function.
33002543 10/2013 595
Unity Pro
33002543 10/2013
Appendices
Overview
This section contains the appendicies.
What Is in This Appendix?
The appendix contains the following chapters:
Chapter Chapter Name Page
A EFB Error Codes and Values 597
B System Objects 607
596 33002543 10/2013
33002543 10/2013 597
Unity Pro
EFB Error Codes and Values
33002543 10/2013
EFB Error Codes and Values
Appendix A
EFB Error Codes and Values
Introduction
The following tables show the error codes and error values created for the EFBs of the Obsolete
Library.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
Tables of Error Codes for the Obsolete Library 598
Common Floating Point Errors 606
EFB Error Codes and Values
598 33002543 10/2013
Tables of Error Codes for the Obsolete Library
Introduction
The following tables show the error codes and error values created for the EFBs of the Obsolete
Library.
CLC
Table of error codes and errors values created for EFBs of the CLC family.
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
DELAY E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
INTEGRATOR1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
INTEGRATOR1 E_ERR_IB_MAX_MIN F -30102
16#8A6A
YMAX < YMIN
INTEGRATOR1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
LAG1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
LAG1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
LEAD_LAG1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
LEAD_LAG1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
LIMV E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
LIMV E_ERR_AB1_MAX_MIN F -30101
16#8A6B
YMAX < YMIN
LIMV FP_ERROR F - - See table Common Floating
Point Errors, page 606
PI1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PI1 E_ERR_PI_MAX_MIN F -30103 16#8A69 YMAX < YMIN
PI1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
PID1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PID1 E_ERR_PID_MAX_MIN F -30104 16#8A68 YMAX < YMIN
PID1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
EFB Error Codes and Values
33002543 10/2013 599
PIDP1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PIDP1 E_ERR_PID_MAX_MIN F -30104 16#8A68 YMAX < YMIN
PIDP1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
SMOOTH_RATE E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
SMOOTH_RATE FP_ERROR F - - See table Common Floating
Point Errors, page 606
THREE_STEP_CON1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
THREE_STEP_CON1 W_WARN_DSR_TN T 30101 16#7595 TN = 0
THREE_STEP_CON1 W_WARN_DSR_TSN T 30102 16#7596 TSN = 0
THREE_STEP_CON1 W_WARN_DSR_KP T 30103 16#7597 KP <= 0
THREE_STEP_CON1 E_ERR_DSR_HYS F -30105 16#8A67 2 * |UZ| < |HYS|
THREE_STEP_CON1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
THREEPOINT_CON1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
THREEPOINT_CON1 W_WARN_ZDR_XRR F 30105 16#7599 DR: XRR < -100 or XRR > 100
THREEPOINT_CON1 W_WARN_ZDR_T1T2 F 30104 16#7598 T2 > T1
THREEPOINT_CON1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
THREEPOINT_CON1 E_ERR_ZDR_HYS F -30106 16#8A66 2 * |UZ| < |HYS|
TWOPOINT_CON1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
TWOPOINT_CON1 W_WARN_ZDR_XRR F 30105 16#7599 DR: XRR < -100 or XRR > 100
TWOPOINT_CON1 W_WARN_ZDR_T1T2 F 30104 16#7598 T2 > T1
TWOPOINT_CON1 FP_ERROR F - - See table Common Floating
Point Errors, page 606
TWOPOINT_CON1 E_ERR_ZDR_HYS F -30106 16#8A66 2 * |UZ| < |HYS|
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
EFB Error Codes and Values
600 33002543 10/2013
CLC_PRO
Table of error codes and errors values created for EFBs of the CLC_PRO family.
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
ALIM E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
ALIM WAF_AB2_VMAX F -30111 16#8A61 vmax <= 0
ALIM WAF_AB2_BMAX F -30112 16#8A60 bmax <= 0
ALIM FP_ERROR F - - See table Common Floating Point Errors,
page 606
COMP_PID E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
COMP_PID WAF_KPID_KUZ F -30110 16#8A62 gain_red < 0 or gain_red > 1
COMP_PID WAF_KPID_OGUG F -30104 16#8A68 YMAX < YMIN
COMP_PID WAF_KPID_UZ F -30109 16#8A63 db < 0
COMP_PID FP_ERROR F - - See table Common Floating Point Errors,
page 606
DEADTIME E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
DERIV E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
DERIV FP_ERROR F - - See table Common Floating Point Errors,
page 606
FGEN E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
FGEN WAF_SIG_TV_MAX F -30116 16#8A5C t_acc > t_rise / 2
FGEN WAF_SIG_TH_MAX F -30117 16#8A5B t_rise too big
FGEN WAF_SIG_TA_MAX T 30106 16#759A t_off >= halfperiod
FGEN WAF_SIG_T1_MIN T 30107 16#759B t_max <= t_min
FGEN WAF_SIG_FKT F -30118 16#8A5A func_no <= 0 or func_no > 8
FGEN FP_ERROR F - - See table Common Floating Point Errors,
page 606
INTEG E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
INTEG E_ERR_IB_MAX_MIN F -30102 16#8A6A YMAX < YMIN
INTEG FP_ERROR F - - See table Common Floating Point Errors,
page 606
LAG E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
LAG FP_ERROR F - - See table Common Floating Point Errors,
page 606
EFB Error Codes and Values
33002543 10/2013 601
LAG2 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
LAG2 FP_ERROR F - - See table Common Floating Point Errors,
page 606
LEAD_LAG E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
LEAD_LAG FP_ERROR F - - See table Common Floating Point Errors,
page 606
PCON2 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PCON2 W_WARN_ZDR_XRR T 30105 16#7599 DR: XRR < -100 or XRR > 100
PCON2 W_WARN_ZDR_T1T2 T 30104 16#7598 T2 > T1
PCON2 FP_ERROR F - - See table Common Floating Point Errors,
page 606
PCON2 E_ERR_ZDR_HYS F -30106 16#8A66 2 * |UZ| < |HYS|
PCON3 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PCON3 W_WARN_ZDR_XRR T 30105 16#7599 DR: XRR < -100 or XRR > 100
PCON3 W_WARN_ZDR_T1T2 T 30104 16#7598 T2 > T1
PCON3 FP_ERROR F - - See table Common Floating Point Errors,
page 606
PCON3 E_ERR_ZDR_HYS F -30106 16#8A66 2 * |UZ| < |HYS|
PD_OR_PI E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PD_OR_PI WAF_PDPI_OG_UG F -30103 16#8A69 YMAX < YMIN
PD_OR_PI FP_ERROR F - - See table Common Floating Point Errors,
page 606
PDM PDM_TMAX_TMIN F -30115 16#8A5D t_max <= t_min
PDM PDM_OG_UG F -30114 16#8A69 |pos_up_x| > |pos_lo_x| or |neg_up_x| >
|neg_lo_x|
PDM FP_ERROR F - - See table Common Floating Point Errors,
page 606
PI E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PI E_ERR_PI_MAX_MIN F -30103 16#8A69 YMAX < YMIN
PI FP_ERROR F - - See table Common Floating Point Errors,
page 606
PID E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PID E_ERR_PID_MAX_MIN F -30104 16#8A68 YMAX < YMIN
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
EFB Error Codes and Values
602 33002543 10/2013
PID FP_ERROR F - - See table Common Floating Point Errors,
page 606
PID_P E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PID_P E_ERR_PID_MAX_MIN F -30104 16#8A68 YMAX < YMIN
PID_P FP_ERROR F - - See table Common Floating Point Errors,
page 606
PIP E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PIP E_ERR_PI_MAX_MIN F -30103 16#8A69 YMAX < YMIN
PIP FP_ERROR F - - See table Common Floating Point Errors,
page 606
PPI E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
PPI E_ERR_PI_MAX_MIN F -30103 16#8A69 YMAX < YMIN
PPI FP_ERROR F - - See table Common Floating Point Errors,
page 606
PWM WAF_PBM_TMINMAX F -30113 16#8A5F t_min < t_max
PWM FP_ERROR F - - See table Common Floating Point Errors,
page 606
QPWM WAF_PBM_TMINMAX F -30113 16#8A5F t_min < t_max
QPWM FP_ERROR F - - See table Common Floating Point Errors,
page 606
SCON3 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
SCON3 W_WARN_DSR_TN T 30101 16#7595 TN = 0
SCON3 W_WARN_DSR_TSN T 30102 16#7596 TSN = 0
SCON3 W_WARN_DSR_KP T 30103 16#7597 KP <= 0
SCON3 E_ERR_DSR_HYS F -30105 16#8A67 2 * |UZ| < |HYS|
SCON3 FP_ERROR F - - See table Common Floating Point Errors,
page 606
VLIM E_ERR_DEN F -30152 16#8A38 Not a valid floating point number
VLIM E_ERR_AB1_MAX_MIN F -30101 16#8A6B YMAX < YMIN
VLIM FP_ERROR F - - See table Common Floating Point Errors,
page 606
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
EFB Error Codes and Values
33002543 10/2013 603
Extension/Compatibility
Table of error codes and errors values created for EFBs of the Extension/Compatibility
family.
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
AKF_TA E_AKFEFB_TIMEBASE_IS_ZERO F -30482
16#88EE
Time base is zero
AKF_TE E_AKFEFB_TIMEBASE_IS_ZERO F -30482
16#88EE
Time base is zero
AKF_TI E_AKFEFB_TIMEBASE_IS_ZERO F -30482
16#88EE
Time base is zero
AKF_TS E_AKFEFB_TIMEBASE_IS_ZERO F -30482
16#88EE
Time base is zero
AKF_TV E_AKFEFB_TIMEBASE_IS_ZERO F -30482
16#88EE
Time base is zero
FIFO E_INPUT_VALUE_OUT_OF_RANGE F -30183
16#8A19
Input value is out of
range
GET_3X E_INPUT_VALUE_OUT_OF_RANGE F -30183
16#8A19
Input value is out of
range
GET_4X E_INPUT_VALUE_OUT_OF_RANGE F -30183
16#8A19
Input value is out of
range
GET_BIT E_INPUT_VALUE_OUT_OF_RANGE F -30183
16#8A19
Input value is out of
range
IEC_BMDI E_EFB_USER_ERROR_1 F -30200
16#8A08
Input value is
invalid register type
(SourceTable).
IEC_BMDI E_EFB_USER_ERROR_2 F -30201
16#8A07
The input offset
(OffsetInSourceTab
le) selects an
address outside
acceptable limits.
IEC_BMDI E_EFB_USER_ERROR_3 F -30202
16#8A06
The input offset
(OFF_IN) is not 1 or
a multiple of 16+1.
IEC_BMDI E_EFB_USER_ERROR_4 F -30203
16#8A05
Output value is
invalid register type
(DestinationTable).
EFB Error Codes and Values
604 33002543 10/2013
IEC_BMDI E_EFB_USER_ERROR_5 F -30204
16#8A04
The output offset
(OffsetInDestinatio
nTable) selects an
address outside
acceptable limits.
IEC_BMDI E_EFB_USER_ERROR_6 F -30205
16#8A03
The output offset
(OffsetInDestinatio
nTable) is not 1 or a
multiple of 16+1.
IEC_BMDI E_EFB_USER_ERROR_7 F -30206
16#8A02
The value for
(NumberOfElement
s) is 0.
IEC_BMDI E_EFB_USER_ERROR_8 F -30207
16#8A01
The value for
(NumberOfElement
s) addresses more
than 1600 bits.
IEC_BMDI E_EFB_USER_ERROR_9 F -30208
16#8A00
The value for
(NumberOfElement
s) addresses more
than 100 words.
IEC_BMDI E_EFB_USER_ERROR_10 F -30209
16#89FF
The value for
(NumberOfElement
s) selects a source
address outside the
acceptable limits.
IEC_BMDI E_EFB_USER_ERROR_11 F -30210
16#89FE
The value for
(NumberOfElement
s) selects a
destination address
outside the
acceptable limits.
IEC_BMDI E_EFB_USER_ERROR_12 F -30211
16#89FD
The value for
(NumberOfElement
s) is not a multiple
of 16.
IEC_BMDI E_EFB_USER_ERROR_13 F -30212
16#89FC
Warning: Address
overlap of input and
output addresses.
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
EFB Error Codes and Values
33002543 10/2013 605
LIFO E_INPUT_VALUE_OUT_OF_RANGE F -30183
16#8A19
Input value is out of
range
PUT_4X E_INPUT_VALUE_OUT_OF_RANGE F -30183
16#8A19
Input value is out of
range
MUX_DINTARR
_125
E_SELECTOR_OUT_OF_RANGE F -30175
16#8A21
Selector is out of
range
SET_BIT E_INPUT_VALUE_OUT_OF_RANGE F -30183
16#8A19
Input value is out of
range
EFB name Error code ENO
state
in
case
of
error
Error
value in
Dec
Error
value in
Hex
Error description
EFB Error Codes and Values
606 33002543 10/2013
Common Floating Point Errors
Introduction
The following table shows the commen error codes and error values created for floating point
errors.
Common Floating Point Errors
Table of common floating point errors
Error codes Error value in
Dec
Error value
in Hex
Error description
FP_ERROR -30150 16#8A3A Base value (not apearing as an error value)
E_FP_STATUS_FAILED_IE -30151 16#8A39 Illegal floating point operation
E_FP_STATUS_FAILED_DE -30152 16#8A38 Operand is denormalized - not a valid REAL
number
E_FP_STATUS_FAILED_ZE -30154 16#8A36 Illegal divide by zero
E_FP_STATUS_FAILED_ZE_IE -30155 16#8A35 Illegal floating point operation / Divide by zero
E_FP_STATUS_FAILED_OE -30158 16#8A32 Floating point overflow
E_FP_STATUS_FAILED_OE_IE -30159 16#8A31 Illegal floating point operation / Overflow
E_FP_STATUS_FAILED_OE_ZE -30162 16#8A2E Floating point overflow / Divide by zero
E_FP_STATUS_FAILED_OE_ZE_IE -30163 16#8A2D Illegal floating point operation / Overflow /
Divide by zero
E_FP_NOT_COMPARABLE -30166 16#8A2A Internal error
33002543 10/2013 607
Unity Pro
System Objects
33002543 10/2013
System Objects
Appendix B
System Objects
Subject of this Chapter
This chapter describes the system bits and words of Unity Pro language.
Note: The symbols, associated with each bit object or system word, mentioned in the descriptive
tables of these objects, are not implemented as standard in the software, but can be entered using
the data editor.
They are proposed in order to ensure the homogeneity of their names in the different applications.
What Is in This Chapter?
This chapter contains the following topics:
Topic Page
System Bit Introduction 608
Description of System Bits %S15 to %S21 609
Description of System Words %SW0 to %SW11 613
Description of System Words %SW12 to %SW29 618
Description of System Words %SW70 to %SW99 625
Description of System Words %SW124 to %SW127 636
System Objects
608 33002543 10/2013
System Bit Introduction
General
The Modicon M340, Premium, Atrium, Quantum, and Momentum Unity PLCs use %Si system bits
which indicate the state of the PLC, or they can be used to control how it operates.
These bits can be tested in the user program to detect any functional development requiring a set
processing procedure.
Some of these bits must be reset to their initial or normal state by the program. However, the
system bits that are reset to their initial or normal state by the system must not be reset by the
program or by the terminal.
System Objects
33002543 10/2013 609
Description of System Bits %S15 to %S21
Detailed Description
Description of system bits %S15 to %S21:
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%S15
STRINGERROR
Character
string fault
Normally set to 0, this bit
is set to 1 when the
destination zone for a
character string transfer is
not of sufficient size
(including the number of
characters and the end of
string character) to
receive this character
string.
The application stops in
error state if the %S78 bit
has been to set to 1.
This bit must be reset to 0
by the application.
This bit is not available on
Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
YES
%S16
IOERRTSK
Task
input/output
fault
Normally set to 1, this bit
is set to 0 by the system
when a fault on an in-rack
module or device on Fipio
is detected (e.g. non-
compliant configuration,
exchange fault, hardware
fault, etc.).
This bit must be reset to 1
by the user.
1 YES YES YES YES
CAUTION
UNEXPECTED APPLICATION BEHAVIOR - SPECIFIC VARIABLE BEHAVIOR
On Quantum, network communication errors with remote devices detected by communication
modules (NOM, NOE, NWM, CRA, CRP) and motion modules (MMS) are not reported on bits
%S10, %S16 and %S119.
Failure to follow these instructions can result in injury or equipment damage.
System Objects
610 33002543 10/2013
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%S17
CARRY
Rotate shift
output
Normally at 0.
During a rotate shift
operation, this bit takes the
state of the outgoing bit.
0 YES YES YES YES
%S18
OVERFLOW
Overflow or
arithmetic
error
Normally set to 0, this bit is
set to 1 in the event of a
capacity overflow if there is:
a result greater than +
32 767 or less than -
32 768, in single length,
result greater than +
65 535, in unsigned
integer,
a result greater than +
2 147 483 647 or less
than - 2 147 483 648, in
double length,
result greater than
+4 294 967 296, in
double length or
unsigned integer,
real values outside limits,
division by 0,
the root of a negative
number,
forcing to a non-existent
step on a drum,
stacking up of an already
full register, emptying of
an already empty
register.
0 YES YES YES YES
System Objects
33002543 10/2013 611
Continued
%S18
OVERFLOW
Overflow or
arithmetic
error
There is only one case for
which bit %S18 is not raised
by the Modicon M340,
Modicon M580, and
Momentum PLCs when real
values are outside limits. It is
only if denormalized
operands or some
operations which generate
denormalized results are
used (gradual underflow).
It must be tested by the user
program after each
operation where there is a
risk of overflow, then reset to
0 by the user if there is
indeed an overflow.
When the %S18 bit switches
to 1, the application stops in
error state if the %S78 bit
has been to set to 1.
0 YES YES YES YES
%S19
OVERRUN
Task period
overrun
(periodical
scanning)
Normally set to 0, this bit is
set to 1 by the system in the
event of a time period
overrun (i.e. task execution
time is greater than the
period defined by the user in
the configuration or
programmed into the %SW
word associated with the
task). The user must reset
this bit to 0. Each task
manages its own %S19 bit.
0 YES YES YES YES
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
612 33002543 10/2013
%S20
INDEXOVF
Index
overflow
Normally set to 0, this bit is
set to 1 when the address of
the indexed object becomes
less than 0 or exceeds the
number of objects declared
in the configuration.
In this case, it is as if the
index were equal to 0.
It must be tested by the user
program after each
operation where there is a
risk of overflow, then reset to
0 if there is indeed an
overflow.
When the %S20 bit switches
to 1, the application stops in
error state if the %S78 bit
has been to set to 1.
This bit is not available on
Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
YES
%S21
1RSTTASKRUN
First task
cycle
Tested in a task (Mast, Fast,
Aux0, Aux1, Aux2 Aux3), the
bit %S21 indicates the first
cycle of this task, including
after a cold start with
automatic start in run and a
warm start. %S21 is set to 1
at the start of the cycle and
reset to zero at the end of the
cycle.
Note: The bit %S21 does not
have the same meaning in
Unity Pro as in PL7.
0 YES YES YES YES
Bit
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002543 10/2013 613
Description of System Words %SW0 to %SW11
Detailed Description
Description of system words %SW0 to %SW11.
Word
Symbol
Function Description Initial
State
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%SW0
MASTPERIOD
Master task
scanning
period
This word is used to
modify the period of the
master task via the user
program or via the
terminal.
The period is expressed in
ms (1...255 ms)
%SW0=0 in cyclic
operation.
On a cold restart: it takes
the value defined by the
configuration.
This word is not available
on Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
YES
%SW1
FASTPERIOD
FAST task
scanning
period
This word is used to
modify the period of the
FAST task via the user
program or via the
terminal.
The period is expressed in
milliseconds (1...255 ms).
On a cold restart, it takes
the value defined by the
configuration.
This word is not available
on Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
NO
System Objects
614 33002543 10/2013
%SW2
AUX0PERIOD
%SW3
AUX1PERIOD
Auxiliary
task
scanning
period
These words are used to
modify the period of the
tasks defined in the
configuration, via the user
program or via the
terminal.
The period is expressed in
tens of ms (10 ms to
2.55 s).
(1) only on 140 CPU 6
and TSX 57 5 PLCs.
These words are not
available on Quantum
safety PLCs.
0 NO-340
YES-580
YES (1) YES (1)
(except
for safety
PLCs)
NO
%SW4
AUX2PERIOD
%SW5
AUX3PERIOD
Auxiliary
task
scanning
period
These words are used to
modify the period of the
tasks defined in the
configuration, via the user
program or via the
terminal.
The period is expressed in
tens of ms (10 ms to
2.55 s).
(1) only on 140 CPU 6
and TSX 57 5 PLCs.
These words are not
available on Quantum
safety PLCs.
0 NO YES (1) YES (1)
(except
for safety
PLCs)
NO
%SW6
%SW7
IP Address Gives the IP address of
the CPU Ethernet port.
Modification is not taken
into account.
Is 0 if the CPU does not
have an Ethernet link.
- YES NO NO YES
Word
Symbol
Function Description Initial
State
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002543 10/2013 615
%SW8
TSKINHIBIN
Acquisition
of task input
monitoring
Normally set to 0, this bit
can be set to 1 or 0 by the
program or the terminal.
It inhibits the input
acquisition phase of each
task:
%SW8.0 = 1 inhibits
the acquisition of
inputs relating to the
MAST task.
%SW8.1 = 1 inhibits
the acquisition of
inputs relating to the
FAST task.
%SW8.2 to 5 = 1
inhibits the acquisition
of inputs relating to the
AUX 0...3 tasks.
(1) Note: On Modicon
M340, inputs/outputs
distributed via CANopen
bus are not affected by
the word %SW8.
(2) Note: On Quantum,
inputs/outputs distributed
via DIO bus are not
affected by the word
%SW8.
(3) Note: On PREMIUM,
inputs/outputs distributed
via ETY and ETY PORT
are not affected by the
word %SW8. High End
CPU Ethernet port is
affected by the word
%SW8.
This word is not available
on Quantum safety PLCs.
0 YES(1) YES (3) YES(2)
(except
for safety
PLCs)
NO
Word
Symbol
Function Description Initial
State
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
616 33002543 10/2013
%SW9
TSKINHIBOUT
Monitoring
of task
output
update
Normally set to 0, this bit
can be set to 1 or 0 by the
program or the terminal.
Inhibits the output
updating phase of each
task.
%SW9.0 = 1 assigned
to the MAST task;
outputs relating to this
task are no longer
managed.
%SW9.1 = 1 assigned
to the FAST task;
outputs relating to this
task are no longer
managed.
%SW9.2 to 5 = 1
assigned to the AUX
0...3 tasks; outputs
relating to these tasks
are no longer
managed.
(3) Note: On Modicon
M340, inputs/outputs
distributed via CANopen
bus are not affected by
the word %SW9.
On Modicon M340, after
an operating mode,
outputs are in Security
mode state equal to 0
while the bit is set.
(4) Note: On Quantum,
inputs/outputs distributed
via DIO bus are not
affected by the word
%SW9.
This word is not available
on Quantum safety PLCs.
0 YES(3) YES YES (4)
(except
for safety
PLCs)
NO
Word
Symbol
Function Description Initial
State
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002543 10/2013 617
CAUTION
UNEXPECTED APPLICATION BEHAVIOR
Before setting the %SW9 value to 1, ensure that the output behavior will remain appropriate:
On Premium/Atrium:
Module outputs located on the X Bus automatically switch to the configured mode (fallback or
maintain). On the Fipio bus, certain devices do not manage fallback mode; then only maintain
mode is possible.
On Quantum:
All outputs, as well as the local or remote rack (RIO) are maintained in the state that preceded
the switch to 1 of the %SW9 bit corresponding to the task.
The Distributed Inputs/Outputs (DIO) are not assigned by the system word %SW9.
Failure to follow these instructions can result in injury or equipment damage.
Word Symbol Function Description Initial
State
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%SW10
TSKINIT
First cycle
after cold
start
If the value of the current
task bit is set to 0, this
means that the task is
performing its first cycle
after a cold start.
%SW10.0: assigned to
the MAST task.
%SW10.1: assigned to
the FAST task.
%SW10.2 to 5:
assigned to the AUX
0...3 tasks.
This word is not available
on Quantum safety PLCs.
0 YES YES YES
(except
for safety
PLCs)
YES
%SW11
WDGVALUE
Watchdog
duration
Reads the duration of the
watchdog. The duration is
expressed in milliseconds
(10...1500 ms).
This word cannot be
modified.
NOTE: The duration
range in Quantum Safety
PLCs is: 20...990 ms.
- YES YES YES YES
System Objects
618 33002543 10/2013
Description of System Words %SW12 to %SW29
Detailed Description
Description of system words %SW12 to %SW29:
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%SW12
UTWPORTADDR
Processor
serial port
address
For Premium: Uni-
Telway address of
terminal port (in
slave mode) as
defined in the
configuration and
loaded into this word
on cold start. The
modification of the
value of this word is
not taken into
account by the
system.
For Modicon M340:
Gives the Modbus
slave address of the
CPU serial port.
Modification is not
taken into account. Is
0 if the CPU does not
have a Serial Port
link.
- YES-340
NO-580
YES NO
(see
%SW12
below)
YES
System Objects
33002543 10/2013 619
%SW12
APMODE
Mode of the
application
processor
For Quantum safety
PLC only, this word
indicates the
operating mode of
the application
processor of the
CPU module.
16#A501 =
maintenance
mode
16#5AFE = safe
mode
Any other value is
interpreted as an
error.
Note: In a HotStand
By safety system,
this word is
exchanged from the
primary to the
standby PLC to
inform the standby
PLC of the safe or
maintenance mode.
For Momentum, this
word contains the
slave address for
serial channel 0.
16#A501 NO NO YES
Only on
safety
PLCs
YES
%SW13
XWAYNETWADDR
Main
address of
the station
This word indicates
the following for the
main network
(Fipway or Ethway):
the station
number (least
significant byte)
from 0 to 127,
the network
number (most
significant byte)
from 0 to 63,
(value of the micro-
switches on the
PCMCIA card).
254
(16#00FE)
NO YES NO
(see
%SW13
below)
NO
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
620 33002543 10/2013
%SW13
INTELMODE
Mode of the
Intel
processor
For Quantum safety
PLC only, this word
indicates the
operating mode of
the Intel Pentium
processor of the
CPU module.
16#501A =
maintenance
mode
16#5AFE = safe
mode
Any other value is
interpreted as an
error.
Note: In a HotStand
By safety system,
this word is
exchanged from the
primary to the
standby PLC to
inform the standby
PLC of the safe or
maintenance mode.
- NO NO YES
Only on
safety
PLCs
NO
%SW14
OSCOMMVERS
Commercial
version of
PLC
processor
This word contains
the current
Operating System
(OS) version of the
PLC processor.
Example: 16#0135
version: 01
issue number: 35
- YES YES YES YES
%SW15
OSCOMMPATCH
PLC
processor
patch
version
This word contains
the commercial
version of the PLC
processor patch.
It is coded onto the
least significant byte
of the word.
Coding: 0 = no patch,
1 = A, 2 = B...
Example: 16#0003
corresponds to patch
C.
- YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002543 10/2013 621
%SW16
OSINTVERS
Firmware
version
number
This word contains
the Firmware version
number in
hexadecimal of the
PLC processor
firmware.
Example: 16#0011
version: 2.1
VN: 17
- YES YES YES YES
%SW17
FLOATSTAT
Error status
on floating
operation
When an error in a
floating arithmetic
operation is
detected, bit %S18 is
set to 1 and %SW17
error status is
updated according to
the following coding:
%SW17.0 =
Invalid operation /
result is not a
number,
%SW17.1
=Denormalized
operand / result is
acceptable (flag
not managed by
Modicon M340 or
Quantum Safety
PLCs),
%SW17.2 =
Division by 0 /
result is infinity,
%SW17.3 =
Overflow / result
is infinity,
%SW17.4 =
Underflow / result
is 0,
%SW17.5 to 15 =
not used.
This word is reset to
0 by the system on
cold start, and also
by the program for
re-usage purposes.
0 YES YES YES
Only on
safety
PLCs
YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
622 33002543 10/2013
%SD18:
%SW18 and
%SW19
100MSCOUNTER
Absolute
time counter
%SW18 represents
the least significant
bytes and %SW19 the
most significant
bytes of the double
word %SD18, which
is incremented by
the system every
1/10
th
of a second.
The application can
read or write these
words in order to
perform duration
calculations.
%SD18 is
incremented
systematically, even
in STOP mode and
equivalent states.
However, times
when the PLC is
switched off are not
taken into account,
since the function is
not linked to the real-
time scheduler, but
only to the real-time
clock.
For Quantum safety
PLC, knowing that
the 2 processors
must process exactly
the same data, the
value of %SD18 is
updated at the
beginning of the
mast task, and then
frozen during the
application
execution.
0 YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002543 10/2013 623
%SD20:
%SW20 and
%SW21
MSCOUNTER
Absolute
time counter
For M340,
Momentum and
Quantum PLCs
%SD20 is
incremented every
1/1000th of a second
by the system (even
when the PLC is in
STOP, %SD20 is no
longer incremented if
the PLC is powered
down). %SD20 can
be read by the user
program or by the
terminal.
%SD20 is reset on a
cold start.
%SD20 is not reset
on a warm start.
For Premium
TSX P57 14M/24M
/34M/C024M/024M
and
TSX PCI57 204M/35
4M PLCs, %SD20 is
incremented by 5
every 5/1000th of a
second by the
system. For all the
others Premium
PLCs, %SD20 is time
counter at 1 ms like
Quantum and M340
PLCs.
For Quantum safety
PLC, knowing that
the 2 processors
must process exactly
the same data, the
value of %SD18 is
updated at the
beginning of the
mast task, and then
frozen during the
application
execution.
0 YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
624 33002543 10/2013
%SW23 Rotary
switch value
The least significant
byte contains the
Ethernet processor
rotary switch.
It can be read by the
user program or by
the terminal.
- YES-340
NO-580
NO NO NO
%SW26 Number of
requests
processed
This system word
allows to verifiy on
server side the
number of requests
processed by PLC
per second.
- YES NO NO YES
%SW27
%SW28
%SW29
System
overhead
time

%SW27 is the last
system overhead
time.
%SW28 contains
the maximum
system overhead
time.
%SW29 contains
the minimum
system overhead
time.
The system
overhead time
depends on the
configuration
(number of I/O...)
and on the current
cycle requests
(communication,
diagnostics).
System overhead
time = Mast Cycle
Time - User code
execution time.
These can be read
and written by the
user program or by
the terminal.
- YES NO NO YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
33002543 10/2013 625
Description of System Words %SW70 to %SW99
Detailed Description
Description of system words %SW70 to %SW99.
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
%SW70
WEEKOFYEAR
Real-time
clock
function
System word containing the number
of the week in the year: 1 to 52 (in
BCD).
- YES YES YES YES
%SW71
KEY_SWITCH
Position of
the
switches on
the
Quantum
front panel
This word provides the image of the
positions of the switches on the front
panel of the Quantum processor.
This word is updated automatically by
the system.
%SW71.0 = 1 switch in the
"Memory protected" position,
%SW71.1 = 1 switch in the
"STOP" position,
%SW71.2 = 1 switch in the
"START" position,
%SW71.8 = 1 switch in the
"MEM" position,
%SW71.9 = 1 switch in the
"ASCII" position,
%SW71.10 = 1 switch in the
"RTU" position,
%SW71.3 to 7 and 11 to 15 are
not used.
0 NO NO YES NO
System Objects
626 33002543 10/2013
%SW72

Unity 984
Error Log
Extended Math library (EMTH)
detected error log errors (as LL984).
0 YES YES YES YES
Bit / Function
15 - 8 : function code / EMTH sub-function (see below)
7 - 6: not used
4: integer/floating point conversion detected error
3: exponential function power too large
2: invalid floating point value or operation
1: floating point overflow
0: floating point underflow
Function code / EMTH sub-function
16#01 / ADDDP
16#02 / SUBDP
16#03 / MULDP
16#04 / DIVDP
16#05 / SQRT
16#06 / SQRTP
16#07 / LOG
16#08 / ANLOG
16#09 / CNVIF
16#0A / ADDIF
16#0B / SUBIF
16#0C / MULIF
16#0D / DIVIF
16#0E / SUBFI
16#0F / DIVFI
16#10 / CMPIF
16#11 / CNVFI
16#12 / ADDFP
16#13 / SUBFP
16#14 / MULFP
16#15 / DIVFP
16#16 / CMPFP
16#17 / SQRFP
16#18 / CHSIN
16#19 / PI
16#1A / SINE
16#1B / COS
16#1C / TAN
16#1D / ARSIN
16#1E / ARCOS
16#1F / ARTAN
16#20 / CNVRD
16#21 / CNVDR
16#22 / POW
16#23 / EXP
16#24 / LNFP
16#25 / LOGFP
16#26 / ERLOG
%SW75
TIMEREVTNB
Timer-type
event
counter
This word contains the number of
timer-type events in the queue.
(1): Not available on the following
processors: TSX 57 1/2/3/4/5.
This word is not available on
Quantum Safety PLCs.
0 YES YES
(1)
YES
(ex-
cept
for
Safety
PLCs)
NO
%SW76
DLASTREG
Diagnostics
function:
recording
Result of the last registration
= 0 if the recording was
successful,
= 1 if the diagnostics buffer has
not been configured,
= 2 if the diagnostics buffer is full.
0 YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
33002543 10/2013 627
%SW77
DLASTDEREG
Diagnostics
function:
non-
recording
Result of the last de-registration
= 0 if the non-recording was
successful,
= 1 if the diagnostics buffer has
not been configured,
= 21 if the error identifier is invalid,
= 22 if the error has not been
recorded.
0 YES YES YES YES
%SW78
DNBERRBUF
Diagnostics
function:
number of
errors
Number of errors currently in the
diagnostics buffer.
0 YES YES YES YES
%SW80
MSGCNT0
%SW81
MSGCNT1
Message
manage-
ment
These words are updated by the
system, and can also be reset using
%S80.
For Premium:
%SW80: Number of message sent
by the system to the terminal port
(Uni-Telway port)
%SW81: Number of message
received by the system to the
terminal port (Uni-Telway port)
For Modicon M340 amd Momentun
Unity:
%SW80: Number of message sent
by the system to the terminal port
(Modbus serial port),
%SW81: Number of message
received by the system to the
terminal port (Modbus serial port).
0 YES-340
NO-580
YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
628 33002543 10/2013
%SW80
MSGCNT0
%SW81
MSGCNT1
Message
manage-
ment (con-
tinued)
For Quantum:
%SW80: Number of Modbus
messages sent by the system as
client on all communication ports.
NOTE: Modbus messages sent by
the system as Master are not counted
in this word.
%SW81: Number of Modbus
messages received by the system
as client on all communication
port.
NOTE: Modbus messages received
as response to the requests sent by
the system, as Master, are not
counted in this word.
0 YES-340
NO-580
YES YES YES
%SW82
%SW83
Message
manage-
ment
These words are updated by the
system, and can also be reset using
%S80.
For Premium:
%SW82: Number of messages
sent by the system to the PCMCIA
module,
%SW83: Number of messages
received by the system from the
PCMCIA module.
For Quantum, M340, M580, and
Momentum Unity:
%SW82: Number of Modbus
messages sent or received on
serial port 1,
%SW83: Number of Modbus
messages sent or received on
serial port 2.
0 YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
33002543 10/2013 629
%SW84
MSGCNT4
%SW85
MSGCNT5
Premium:
Telegram
manage-
ment
Modicon
M340: Mes-
sage man-
agement
These words are updated by the
system, and can also be reset using
%S80.
For Premium:
%SW84: Number of telegrams sent
by the system,
%SW85: Number of telegrams
received by the system.
For Modicon M340, M580 and
Momentum Unity:
%SW84: Number of messages
sent to the USB port,
%SW85: Number of messages
received by the USB port.
0 YES YES NO YES
%SW86
MSGCNT6
Message
manage-
ment
This word is updated by the system,
and can also be reset using %S80.
For Premium and M580:
Number of messages refused by
the system.
For Modicon M340 and Momentum
Unity:
Number of messages refused by
the system, not treated because
of lack of resources for example.If
the message is refused by
Modbus Server then it
corresponds to Modbus exception
messages, sent by the CPU to the
remote Modbus client.
0 YES YES NO YES
%SW87
MSTSERVCNT
Communi-
cation flow
manage-
ment
Number of requests processed by
synchronous server per master
(MAST) task cycle.
The requests processed may come
from all communication ports (having
access to the server Modbus/UNI-
TE, each of them having its own
limitation). This means also that
requests from other clients, then
communication EFs like IO Scanner,
connected HMI and so on should be
counted.
0 YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
630 33002543 10/2013
%SW88
ASNSERVCNT
%SW89
APPSERVCNT
Premium:
Communi-
cation flow
manage-
ment
Modicon
M340:
HTTP and
FTP
requests
received by
the
processors
Web server
and FTP
server per
second
For Premium:
%SW88: Number of requests
processed by asynchronous
server per master (MAST) task
cycle,
%SW89: Number of requests
processed by server functions
(immediately) per master (MAST)
task cycle.
For Modicon M340, M580 and
Momentum Unity:
%SW88: Number of HTTP
requests received by the
processors Web server per
second,
For Modicon M340, and M580:
%SW89: Number of FTP requests
received by the FTP server per
second.
0 YES YES NO YES
(%SW88)
NO
(%SW89)
%SW90
MAXREQNB
Maximum
number of
requests
processed
per master
task cycle
This word is used to set a maximum
number of requests (all protocols
included: UNI-TE, Modbus, etc.)
which can be processed by the
server of the PLC per master task
cycle.(Requests sent by the PLC as
client are not concerned.)
This number of requests must be
between a minimum and a maximum
(defined as N+4) depending on the
model.
For M340 range:
BMX P34 10/20/: N = 8
(minimum 2, maximum 8 + 4 =
12),
N YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
33002543 10/2013 631
Continued
%SW90
MAXREQNB
Maximum
number of
requests
processed
per master
task cycle
For Premium range:
TSX 57 0: N = 4 (minimum 2,
maximum 4 + 4 = 8),
TSX 57 1: N = 4 (minimum 2,
maximum 4 + 4 = 8),
TSX 57 2: N = 8 (minimum 2,
maximum 8 + 4 = 12),
TSX 57 3: N = 12 (minimum 2,
maximum 12 + 4 = 16),
TSX 57 4: N = 16 (minimum 2,
maximum 16 + 4 = 20),
TSX 57 5: N = 16 (minimum 2,
maximum 16 + 4 = 20)
For Quantum range:
140 CPU 31/43/53/: N = 10
(minimum 5, maximum 10 + 4 =
14),
140 CPU 6: N = 20 (minimum 5,
maximum 20 + 4 = 24),
N YES YES YES YES
Continued
%SW90
MAXREQNB
Maximum
number of
requests
processed
per master
task cycle
NOTE: Requests may come from
various modules or embedded
communication ports. The
communication exchange capacity of
each port is limited, therefore the
maximum request value set in %SW90
might not be reached.
The Word is initialized by the system
with N (default value) If the value 0 is
entered, it is the value N that is taken
into account. If a value between 1
and minimum is entered, it is the
minimum value that is taken into
account. If a value greater than
maximum is entered, it is maximum
value that is taken into account.
The number of requests to be
processed per cycle should take into
account requests from all
communication ports (having access
to the server.) This means that
requests from other clients than
communication EFs, like IO Scanner,
connected HMI and so on should also
be taken into account.
N YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
632 33002543 10/2013
%SW91-92 Function
blocks
message
rates
%SW91: Number of function blocks
messages sent per second,
%SW92: Number of function block
messages received per second.
Can be read by the user program or
by the terminal.
These counters does not include
other outgoing requests coming from
an IO Scanner for example.
0 YES YES NO NO
%SW93 Memory
card file
system
format
command
& status
Can be read and written by the user
program or the terminal. This word is
used by the customer to format or
clean up the memory card:
The format operation deletes the web
pages. To recover them, perform one
of the two following actions
Use FTP.
Before performing the format,
save the web pages using
FTP.
After performing the format,
reload the web pages via FTP.
Reinstall the firmware operating
system of the processor.
The clean up operation deletes the
content of the data storage directory.
0 YES NO NO NO
Continued
%SW93
Memory
card file
system
format
command
& status
Formatting or clean up is possible
only in Stop mode:
%SW93.0 = 1 a rising edge
starts the format operation.
%SW93.1 gives the file system
status after a format or a clean Up
operation request:
%SW93.1 = 0 invalid file
system or command under
progress,
%SW93.1 = 1 valid file
system.
%SW93.2 = 1 a rising edge
starts the clean up operation.
0 YES NO NO NO
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
33002543 10/2013 633
%SW94
%SW95
Application
modifica-
tion signa-
ture
These two words contain a 32-bit
value that changes at every
application modification except when:
updating upload information,
replacing the initial value with the
current value,
saving the parameter command.
They can be read by the user
program or by the terminal.
- YES NO NO YES
%SW96
CMDDIAGSA-
VEREST
Command
and
Diagnostic
of Save and
Restore
This word is used to copy or delete
the current value of %MW to or from
internal flash memory (see Unity Pro,
Program Languages and Structure,
Reference Manual ) and to give the
actions status. It can be read by the
user program or by the terminal:
%SW96.0: Request to copy
current value of %MW to internal
Flash memory. Set to 1 by the
user to request a save, and set to
0 by the system when a save is in
progress.
NOTE: You must stop the processor
before copying via %SW96.0.
%SW96.1 is set to 1 by the system
when a save is finished, and set to
0 by the system when a save is in
progress.
%SW96.2 = 1 indicates an error
on a save or restore operation
(see %SW96.8 to 15 for error code
definitions).
%SW96.3 = 1 indicates that a
restore operation is in progress.
- YES NO NO YES
Continued
%SW96
CMDDIAGSA-
VEREST
Command
and
Diagnostic
of Save and
Restore

%SW96.4 may be set to 1 by the
user to delete %MW area in
internal Flash memory.
%SW96.7 = 1 indicates that
internal memory has valid %MW
backup.
- YES NO NO YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
634 33002543 10/2013
%SW96
CMDDIAGSA-
VEREST
Command
and
Diagnostic
of Save and
Restore
%SW96.8 to 15 are error codes when
%SW96.2 is set to 1:
%SW96.9 = 1 indicates that the
saved %MW number is less than
the configured number.
%SW96.8 = 1 and
%SW96.9 = 1 means that the
saved %MW number is greater
than the configured number.
%SW96.8 = 1, %SW96.9 = 1
and %SW96.10 = 1 indicates a
detected write error in internal
flash memory.
- YES NO NO YES
%SW97
CARDSTS
Card status Can be read by the user program or
by the terminal. Indicates the status
of the card.
%SW97:
0000 = no error.
0001 = application backup or file write
sent to a write-protected card.
0002 = card not recognized, or
application backup damaged.
0003 = backup of the application
requested, but no card available.
0004 = card access error, for
example after a card has been
removed not properly.
0005 = no file system present in the
card, or file system not compatible.
Use %SW93.0 to format the card.
- YES NO NO NO
%SW99
1
INPUTADR/
SWAP
1
Communi-
cation re-
dundancy
manage-
ment(
1
)
NOTE: This word is used for
Premium and Quantum module but
has a different function.
Word used to manage the
redundancy of network modules.
When a problem is detected on a
communication module used to
access a network number x (X-WAY),
it is possible to switch to another
communication module (connected
to the same network) by entering the
network number in the %SW99 word.
%SW99 is reset to 0 by the system.
0 NO
YES
1
NO NO
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
33002543 10/2013 635
%SW99
2
CRA_COMPAT
_HIGH
2
CRA com-
patibility
high status
register
NOTE: This word is used for
Premium and Quantum module but
has a different function (see Modicon
Quantum, Change Configuration On
The Fly, User Guide).
Word used to manage the CCOTF
compatibility when a new module is
inserted.
When a module is inserted in the RIO
drop the corresponding bit is at 1 and
indicates that the module is
connected on the drop and CCOTF
compatible.
0 NO NO
YES
2
NO
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premi-
um
Atrium
Quan-
tum
Momen-
tum Unity
System Objects
636 33002543 10/2013
Description of System Words %SW124 to %SW127
Detailed Description
Description of system words %SW124 to %SW127:
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
%SW124
CPUERR
Type of
processor
or system
error
The last type of system fault
encountered is written into
this word by the system
(these codes are unchanged
on a cold restart):
16#30: system code fault
16#53: time-out fault
during I/O exchanges
16#60 to 64: stack
overrun
16#65: Fast task period of
execution is too low
16#81: detection of
backplane (see Premium
and Atrium using Unity
Pro, Processors, racks
and power supply
modules, Implementation
manual) error
NOTE: 16#81 system
code is not managed by
Quantum PLCs
NOTE: If this error is
detected, all racks have to
be re-initialized.
16#90: Detected Internal
system error: Unexpected
interruption
- YES YES YES YES
System Objects
33002543 10/2013 637
%SW125
BLKERRTYPE
Last fault
detected
The code of the last fault
detected is given in this word:
The following error codes
cause the PLC to stop if
%S78 is set to 1. %S15,
%S18 and %S20 are always
activated independently of
%S78:
16#2258: execution of
HALT instruction
16#DE87: calculation
error on floating-point
numbers (%S18, these
errors are listed in the
word %SW17)
16#DEB0: Watchdog
overflow (%S11)
16#DEF0: division by 0
(%S18)
16#DEF1: character
string transfer error
(%S15)
16#DEF2: arithmetic
error; %S18
16#DEF3: index overflow
(%S20)
NOTE: The following codes
16#8xF4, 16#9xF4, and
16#DEF7 indicate an error on
Sequence Function Chart
(SFC).
- YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
System Objects
638 33002543 10/2013
%SW126
ERRADDR0
%SW127
ERRADDR1
Blocking
error
instruction
address
Address of the instruction
that generated the
application blocking error.
For 16 bit processors, TSX
P57 1/2:
%SW126 contains the
offset for this address
%SW127 contains the
segment number for this
address.
For 32 bit processors:
%SW126 contains the
least significant word for
this address
%SW127 contains the
most significant word for
this address
For a system STOP due a
watchdog overflow:
%SW126 contains the
number of the MAST task
with the overflow
%SW127 contains the
value of the MAST task
with the overflow
0 YES YES YES YES
Word
Symbol
Function Description Initial
state
Modicon
M340 &
M580
Premium
Atrium
Quantum Momentum
Unity
33002543 10/2013 639
Unity Pro
Glossary
33002543 10/2013
Glossary
0-9
%I
According to the CEI standard, %I indicates a language object of type discrete IN.
%IW
According to the CEI standard, %IW indicates a language object of type analog IN.
%KW
According to the CEI standard, %KW indicates a language object of type constant word.
%M
According to the CEI standard, %M indicates a language object of type memory bit.
%MW
According to the CEI standard, %MW indicates a language object of type memory word.
%Q
According to the CEI standard, %Q indicates a language object of type discrete OUT.
%QW
According to the CEI standard, %QW indicates a language object of type analog OUT.
A
ADDM_TYPE
This predefined type is used as an output for the ADDM function. This is an ARRAY[0..8] OF Int.
You can find it in the library, in the same family as the EFs that use it.
ADDR_TYPE
This predefined type is used as an output for the ADDR function. This is an ARRAY[0..5] OF Int.
You can find it in the library, in the same family as the EFs that use it.
ANL_IN
ANL_IN is the abbreviation of the analog input data type. It is used when processing analog values.
%IW addresses in the configured analog input module, which are specified in the list of I/O
components, are automatically assigned to data types, and therefore must be occupied by
unassigned variables only.
ANL_OUT
ANL_OUT is the abbreviation of the analog output data type. It is used when processing analog
values. %MW addresses in the configured analog input module, which are specified in the list of I/O
components, are automatically assigned to data types, and therefore must be occupied by
unassigned variables only.
Glossary
640 33002543 10/2013
ANY
There is a hierarchy among the various data types. In the DFBs, it is sometimes possible to declare
variables that can contain several types of values. In that case we use ANY_xxx types.
The figure below describes this hierarchical structure:
ARRAY
An ARRAY is a table containing elements of a single type.
The syntax is as follows: ARRAY [<limits>] OF <Type>
Example:
ARRAY [1..2] OF BOOL is a one-dimensional table with two elements of type BOOL.
ARRAY [1..10, 1..20] OF INT is a two-dimensional table with 10x20 elements of type INT.
ART
(application response time) The time a PLC/ application takes to react to a given input. ART is
measured from the time a physical signal in the PLC turns on and triggers a write command until
the remote output turns on to signify that the data has been received.
Glossary
33002543 10/2013 641
Assigned variables
A variable whose position in the PLC memory can be known. For example, the Water_pressure
variable is associated with %MW102. Water_pressure is said to be assigned.
B
BCD
BCD is the abbreviation of the Binary Coded Decimal format.
BCD can be used to represent decimal numbers between 0 and 9 using a set of four bits (nybble).
In this format, the four bits used to encode decimal numbers have an unused range of
combinations.
Example of BCD encoding:
The number 2,450
is encoded: 0010 0100 0101 0000
BOOL
BOOL is the abbreviation for the Boolean type. This is the basic data type in computing. A BOOL
variable can have either of the following two values: 0 (FALSE) or 1 (TRUE).
A bit extracted from a word is of type BOOL, for example: %MW10.4.
BYTE
When 8 bits are grouped together, they are called a BYTE. You can enter a BYTE either in binary
mode or in base 8.
The BYTE type is encoded in an 8 bit format which, in hexadecimal format, ranges from 16#00 to
16#FF.
D
DATE
The DATE type, encoded in BCD in a 32 bit format, contains the following information:
the year encoded in a 16 bit field;
the month encoded in an 8 bit field;
the day encoded in an 8 bit field.
The DATE type must be entered as follows: D#<Year>-<Month>-<Day>
Glossary
642 33002543 10/2013
This table shows the upper/lower limits of each field:
DATE_AND_TIME
See DT.
DBCD
Representation of a double integer in double BCD format.
BCD format can be used to represent decimal numbers between 0 and 9 using a set of four bits.
In this format, the four bits used to encode decimal numbers have an unused range of
combinations.
Example of DBCD encoding:
The number 78,993,016
is encoded: 0111 1000 1001 1001 0011 0000 0001 0110
DDT
DDT is the abbreviation of Derived Data Type.
A derived data type is a set of elements with the same type (ARRAY) or with different types
(structure).
Device DDT (DDDT)
A Device DDT is a DDT predefined by the manufacturer and not modifiable by user. It contains the
I/O language elements of an I/O module.
DFB
DFB is the abbreviation of Derived Function Block.
DFB types are function blocks that can be defined by the user in ST, IL, LD or FBD language.
Using these DFB types in an application makes it possible to:
simplify the design and entry of the program;
make the program easier to read;
make it easier to debug;
reduce the amount of code generated.
Field Limits Comment
Year [1990,2099] Year
Month [01,12] The leading 0 is displayed; it can be omitted during data
entry.
Day [01,31] For months 01/03/05/07/08/10/12
[01,30] For months 04/06/09/11
[01,29] For month 02 (leap years)
[01,28] For month 02 (non-leap years)
Glossary
33002543 10/2013 643
DINT
DINT is the abbreviation of Double INTeger (encoded in 32 bits).
The upper/lower limits are as follows: -(2 to the power of 31) to (2 to the power of 31) - 1.
Example:
-2147483648, 2147483647, 16#FFFFFFFF.
DT
DT is the abbreviation of Date and Time.
The DT type, encoded in BCD in a 64 bit format, contains the following information:
the year encoded in a 16 bit field;
the month encoded in an 8 bit field;
the day encoded in an 8 bit field;
the time encoded in an 8 bit field;
the minutes encoded in an 8 bit field;
the seconds encoded in an 8 bit field.
NOTE: The 8 least significant bits are not used.
The DT type must be entered as follows:
DT#<Year>-<Month>-<Day>-<Hour>:<Minutes>:<Seconds>
This table shows the upper/lower limits of each field:
Field Limits Comment
Year [1990,2099] Year
Month [01,12] The leading 0 is displayed; it can be omitted during
data entry.
Day [01,31] For months 01/03/05/07/08/10/12
[01,30] For months 04/06/09/11
[01,29] For month 02 (leap years)
[01,28] For month 02 (non-leap years)
Hour [00,23] The leading 0 is displayed; it can be omitted during
data entry.
Minute [00,59] The leading 0 is displayed; it can be omitted during
data entry.
Second [00,59] The leading 0 is displayed; it can be omitted during
data entry.
Glossary
644 33002543 10/2013
DWORD
DWORD is the abbreviation of Double Word.
The DWORD type is encoded in a 32 bit format.
This table shows the upper/lower limits of each of the bases that can be used:
Examples of representation:
E
EBOOL
EBOOL is the abbreviation of Extended BOOLean. An EBOOL type has a value (0 (FALSE) or 1
(TRUE), but also rising or falling edges and forcing functions.
An EBOOL variable occupies one byte in memory.
The byte contains the following information:
one bit for the value;
one bit for the history (whenever the object changes state, the value is copied to the history bit);
one bit for forcing (equal to 0 if the object is not forced, or 1 if the bit is forced).
The default value of each bit is 0 (FALSE).
Base Lower limit Upper limit
Hexadecimal 16#0 16#FFFFFFFF
Octal 8#0 8#37777777777
Binary 2#0 2#11111111111111111111111111111111
Data Representation in one of the bases
00000000000010101101110011011110 16#ADCDE
00000000000000010000000000000000 8#200000
00000000000010101011110011011110 2#10101011110011011110
Glossary
33002543 10/2013 645
EF
EF is the abbreviation of Elementary Function.
This is a block used in a program which performs a predefined logical function.
A function does not have any information on the internal state. Several calls to the same function
using the same input parameters will return the same output values. You will find information on
the graphic form of the function call in the "[functional block (instance)]". Unlike a call to a function
block, function calls include only an output which is not named and whose name is identical to that
of the function. In FBD, each call is indicated by a unique [number ] via the graphic block. This
number is managed automatically and cannot be modified.
You position and configure these functions in your program in order to execute your application.
You can also develop other functions using the SDKC development kit.
EFB
EFB is the abbreviation of Elementary Function Block.
This is a block used in a program which performs a predefined logical function.
EFBs have states and internal parameters. Even if the inputs are identical, the output values may
differ. For example, a counter has an output indicating that the preselection value has been
reached. This output is set to 1 when the current value is equal to the preselection value.
Elementary function
See EF.
EN
EN stands for ENable; it is an optional block input. When the EN input is enabled, an ENO output is
set automatically.
If EN = 0, the block is not enabled; its internal program is not executed, and ENO is set to 0.
If EN = 1, the blocks internal program is run and ENO is set to 1. If an error occurs, ENO is set to 0.
If the EN input is not connected, it is set automatically to 1.
ENO
ENO stands for Error NOtification; this is the output associated with the optional input EN.
If ENO is set to 0 (because EN = 0 or in case of an execution error):
the status of the function block outputs remains the same as it was during the previous scanning
cycle that executed correctly;
the output(s) of the function, as well as the procedures, are set to "0".
Glossary
646 33002543 10/2013
F
FBD
FBD is the abbreviation of Function Block Diagram.
FBD is a graphical programming language that works like a flowchart. By adding simple logical
blocks (AND, OR, etc.), each function or function block in the program is represented in this
graphical format. For each block, the inputs are on the left and the outputs on the right. Block
outputs can be linked to inputs of other blocks in order to create complex expressions.
FFB
Collective term for EF (elementary function), EFB (elementary function block) and DFB (derived
function block).
FTP
File Transfer Protocol.
Function
See EF.
Function Block Diagram
See FBD.
G
Global Data
Global Data provides the automatic exchange of data variables for the coordination of PLC
applications.
GRAY
The Gray code, or "reflected binary", is used to encode a numerical value developed in a string of
binary configurations that may be differentiated by changing the status of a single bit.
For example, this code can be used to avoid the following random event: in pure binary, changing
the value 0111 to 1000 may produce a range numbers between 0 and 1,000, given that the bits do
not all change value at the same time.
Equivalence between decimal, BCD and Gray:
Glossary
33002543 10/2013 647
H
HTTP
Hypertext Transfer Protocol
I
I/O scanning
An I/O scan continuously polls I/O modules to collect data bits and status, error, and diagnostics
information. This process monitors inputs and control outputs.
IEC 61131-3
International standard: programmable logic controllers
Part 3: programming languages
IL
IL is the abbreviation of Instruction List.
This language is a series of basic instructions.
It is very close to assembly language used to program processors.
Each instruction is made up of an instruction code and an operand.
INF
Used to indicate that a number exceeds the authorized limits.
For an integer, the value ranges (shown in gray) are as follows:
When a result is:
less than -3.402824e+38, the symbol -INF (for -infinity) is displayed;
greater than +3.402824e+38, the symbol INF (for +infinity) is displayed;
INT
INT is the abbreviation of single INTeger (encoded in 16 bits).
The upper/lower limits are as follows: -(2 to the power of 15) to (2 to the power of 15) - 1.
Example:
-32768, 32767, 2#1111110001001001, 16#9FA4.
Glossary
648 33002543 10/2013
IODDT
IODDT is the abbreviation of Input/Output Derived Data Type.
The term IODDT indicates a structured data type representing a module or a channel of a PLC
module. Each expert module has its own IODDTs.
K
Keyword
A keyword is a unique combination of characters used as a syntax element in a programming
language (see the definition provided in appendix B of the IEC 61131-3 standard. All the keywords
used in Unity Pro and included in the IEC 61131-3 standard appear in appendix C of that standard.
Keywords cannot be used as identifiers [names of variables, sections, DFB types, etc.] in your
program).
L
LD
LD is the abbreviation of Ladder Diagram.
LD is a programming language that represents instructions to be executed as graphical diagrams
very similar to electrical diagrams (contacts, coils, etc.).
Literal value in base 10
A literal value in base 10 is used to represent a decimal integer value. This value may be preceded
by the "+" and "-" signs. If the "_" character is used in the literal value, it is not significant.
Example:
-12, 0, 123_456, +986
Literal value in base 16
A literal value in base 16 is used to represent a hexadecimal integer. The base is determined by
the number "16" and the "#" sign. The "+" and "-" signs are prohibited. To make it easier to read,
you can use the "_" sign between the bits.
Example:
16#F_F or 16#FF (decimal 255)
16#E_0 or 16#E0 (decimal 224)
Literal value in base 2
A literal value in base 2 is used to represent a binary integer. The base is determined by the
number "2" and the "#" sign. The "+" and "-" signs are prohibited. To make it easier to read, you
can use the "_" sign between the bits.
Example:
2#1111_1111 or 2#11111111 (decimal 255)
2#1110_0000 or 2#11100000 (decimal 224)
Glossary
33002543 10/2013 649
Literal value in base 8
A literal value in base 8 is used to represent an octal integer. The base is determined by the number
"8" and the "#" sign. The "+" and "-" signs are prohibited. To make it easier to read, you can use
the "_" sign between the bits.
Example:
8#3_77 or 8#377 (decimal 255)
8#34_0 or 8#340 (decimal 224)
Literal value of a real
A literal real value is a number expressed with one or more decimals.
Example:
-12,0, 0,0, +0,456, 3,14159_26
Literal value of a real with an exponent
Number that may be expressed using standard scientific notation. In that case the representation
is as follows: mantissa + exponent.
Example:
-1.34E-12 or -1.34e-12
1.0E+6 or 1.0e+6
1.234E6 or 1.234e6
Literal value of an integer
A literal value of an integer is used to enter integer values in the decimal system. Values may be
preceded by the "+" and "-" signs. Underscore signs (_) separating numbers are not significant.
Example:
-12, 0, 123_456, +986
Literal value of time
The TIME type has the following units: days (d), hours (h), minutes (m), seconds (s) and
milliseconds (ms). A literal value of type TIME is represented by a combination of the preceding
types prefixed with T#, t#, TIME# or time#.
Examples: T#25h15m, t#14,7S, TIME#5d10h23m45s3ms
M
Multitoken
Operating mode of an SFC. In multitoken mode, the SFC can have several steps that are active
simultaneously.
Glossary
650 33002543 10/2013
N
Naming conventions (identifier)
An identifier is a series of letters, digits, and underscores starting with a letter or an underscore
(e.g. the name of a function block type, an instance, a variable, or a section). Accented letters (such
as , , and ) may be used, except in names of projects and DFBs. Underscore signs are
significant in identifiers. For example, A_BCD and AB_CD are interpreted as different identifiers.
You cannot use several underscores in succession or at the start of an identifier.
Identifiers cannot contain spaces. They do not differentiate uppercase and lowercase characters.
For example, ABCD and abcd are interpreted as the same identifier.
According to the IEC 61131-3 standard, leading digits are not authorized in identifiers. However,
you can use them if, from the Tools Project options dialog box, in the Language extensions
tab, you check the Leading digits authorized box.
Identifiers cannot be keywords.
NAN
Used to indicate that the result of an operation is not a number (NAN = Not A Number).
Example: calculating the square root of a negative number.
NOTE: The CEI 559 standard defines two classes of NAN: the silent NAN (QNAN) and the
signaling NAN (SNAN). A QNAN is a NAN with a most significant fraction bit while an SNAN is a
NAN without a most significant fraction bit (bit number 22). QNANs can be propagated via most
arithmetic operations without throwing an exception. As for SNANs, they generally indicate an
invalid operation when they are used as operands in arithmetic operations (see %SW17 and
%S18).
Network
There are two meanings of the work "network".
In LD:
a network is a set of interconnected graphic elements. The scope of a network is local,
concerning the organizational unit (section) of the program containing the network.
With expert communication modules:
a network is a set of stations that intercommunicate. The term "network" is also used to define
a group interconnected graphic elements. This group then makes up part of a program that may
comprise a group of networks.
P
Peer cop
Peer Cop service is a mechanism for automatic exchange between stations connected on the
same Modbus Plus segment.
Glossary
33002543 10/2013 651
Procedure
Procedures are technically functional views. The only difference with elementary functions is the
fact that procedures can include more than one output and that they handle the VAR_IN_OUT data
type. In appearance, procedures are no different from elementary functions.
Procedures are an extension to the IEC 61131-3 standard.
R
REAL
The REAL type is encoded in a 32 bit format.
The possible value ranges are shown in the figure below:
When a result is:
between -1,175494e-38 and 1,175494e-38, it is considered to be a DEN;
less than -3.402824e+38, the symbol -INF (for - infinity) is displayed;
greater than +3.402824e+38, the symbol INF (for + infinity) is displayed;
undefined (square root of a negative number), the symbolNAN is displayed.
NOTE: The IEC 559 standard defines two classes of NAN: the silent NAN (QNAN) and the
signaling NAN (SNAN). A QNAN is a NAN with a most significant fraction bit while an SNAN is a
NAN without a most significant fraction bit (bit number 22). QNANs can be propagated via most
arithmetic operations without throwing an exception. As for SNANs, they generally indicate n invalid
operation when they are used as operands in arithmetic operations (see %SW17 and %S18).
NOTE: When a DEN (non-standardized number) is used as an operand, the result is not significant.
S
SFC
SFC is the abbreviation of Sequential Function Chart.
An SFC can be used to graphically represent in a structured manner the operation of a sequential
PLC. This graphical description of the PLCs sequential behavior and of the various resulting
situations is created using simple graphic symbols.
Glossary
652 33002543 10/2013
SIL
Safety Integrity Level
Safety functions are executed to achieve and maintain the safe state of a system. The IEC 61508
specifies 4 levels of safety performance for a safety function. These are called safety integrity
levels (SIL), ranging from 1 (the lowest) to 4 (the highest). The Quantum Safety PLC is certified for
use in SIL2 applications in which the de-energized state is the safe state, for example in an
Emergency Shutdown (ESD) system.
You can use the Schneider safety products for creating a Hot Standby (HSBY) solution if you
require high availability for a safety system.
Single token
Operating mode for an SFC diagram in which only one step can be active at a given time.
SNMP
Simple Network Management Protocol.
ST
ST is the abbreviation of Structured Text.
The structured literal language is a developed language similar to computer programming
languages. It can be used to organize a series of instructions.
STRING
A STRING variable is a series of ASCII characters. The maximum length of a string is 65,534
characters.
T
TIME
The TIME type expresses a time in milliseconds. Encoded in 32 bits, this type can be used to obtain
times from 0 to 2
32
-1 milliseconds.
The TIME type has the following units: days (d), hours (h), minutes (m), seconds (s) and
milliseconds (ms). A literal value of type TIME is represented by a combination of the preceding
types prefixed with T#, t#, TIME# or time#.
Examples: T#25h15m, t#14,7S, TIME#5d10h23m45s3ms
TIME_OF_DAY
See TOD.
Glossary
33002543 10/2013 653
TOD
TOD is the abbreviation of Time Of Day.
The TOD type, encoded in BCD in a 32 bit format, contains the following information:
the hour encoded in an 8 bit field;
the minutes encoded in an 8 bit field;
the seconds encoded in an 8 bit field.
NOTE: The 8 least significant bits are not used.
The TOD type must be entered as follows: TOD#<Hour>:<Minutes>:<Seconds>
This table shows the upper/lower limits of each field:
Example: TOD#23:59:45.
Token
Active step in an SFC.
TOPO_ADDR_TYPE
This predefined type is used as an output for the READ_TOPO_ADDR function. This is an
ARRAY[0..4] OF Int. You can find it in the library, in the same family as the EFs that use it.
U
UDINT
UDINT is the abbreviation of Unsigned Double INTeger (encoded in 32 bits). The upper/lower limits
are as follows: 0 to (2 to the power of 32) - 1.
Example:
0, 4294967295, 2#11111111111111111111111111111111, 8#37777777777,
16#FFFFFFFF.
UDP
user datagram protocol. UDP is a connectionless Internet communications protocol defined by
IETF RFC 768. This protocol facilitates the direct transmission of datagrams on IP networks.
UDP/IP messages do not expect a response, and are therefore ideal for applications in which
dropped packets do not require retransmission (such as streaming video and networks that
demand real-time performance).
Field Limits Comment
Hour [00,23] The leading 0 is displayed; it can be omitted during data entry.
Minute [00,59] The leading 0 is displayed; it can be omitted during data entry.
Second [00,59] The leading 0 is displayed; it can be omitted during data entry.
Glossary
654 33002543 10/2013
UINT
UINT is the abbreviation of the Unsigned INTeger format (encoded in 16 bits). The upper/lower
limits are as follows: 0 to (2 to the power of 16) - 1.
Example:
0, 65535, 2#1111111111111111, 8#177777, 16#FFFF.
Unassigned variables
A variable whose position in the PLC memory cannot be known. A variable that is not linked to an
address is called unassigned variable.
V
Variable
Memory entity of type BOOL, WORD, DWORD, etc., whose contents can be modified by the program
currently running.
W
WORD
The type WORD is encoded in a 16 bit format and is used to perform processing on series of bits.
This table shows the upper/lower limits of each of the bases that can be used:
Examples of representation
Base Lower limit Upper limit
Hexadecimal 16#0 16#FFFF
Octal 8#0 8#177777
Binary 2#0 2#1111111111111111
Data Representation in one of the bases
0000000011010011 16#D3
1010101010101010 8#125252
0000000011010011 2#11010011
33002543 10/2013 655
Unity Pro
Index
33002543 10/2013
Index
A
ADD_***_PL7, 369
AKF_FL, 373
AKF_TA, 375
AKF_TE, 379
AKF_TI, 383
AKF_TS, 387
AKF_TV, 391
AKF_ZR, 395
AKF_ZV, 399
AKF_ZVR, 403
ALIM, 145
array - instructions
R2T_***, 529
T2T, 573
availability of the instructions, 29
C
COMP_PID, 151
COMPARE, 407
comparison - instructions
COMPARE, 407
SRCH, 559
conditioning - instructions
ALIM, 145
DEADTIME, 171
DELAY, 41
DERIV, 179
FGEN, 187
INTEG, 203
INTEGRATOR1, 47
LAG, 211
LAG1, 53
LAG2, 217
LEAD_LAG, 225
LEAD_LAG1, 59
LIMV, 67
SMOOTH_RATE, 109
VLIM, 359
controller - instructions
COMP_PID, 151
PCON2, 233
PCON3, 239
PD_OR_PI, 247
PDM, 259
PI, 269
PI1, 73
PID, 279
PID_P, 293
PID1, 83
PIDP1, 97
PIP, 305
PPI, 319
SCON3, 351
THREE_STEP_CON1, 115
THREEPOINT_CON1, 123
TWOPOINT_CON1, 133
conversion - instructions
DATE_DINT_TO_STRING, 409
DT_ARINT_TO_STRING, 415
TIME_DINT_TO_STRING, 579
TOD_DINT_TO_STRING, 581
TRANS_TIME, 583
R_INT_WORD, 525
R_UINT_WORD, 527
R2T_***, 529
W_INT_REAL, 585
W_UINT_REAL, 587
counter - instructions
SCOUNT, 543
AKF_ZR, 395
AKF_ZV, 399
AKF_ZVR, 403
DOWN_PL7_COUNTER, 471
PL7_COUNTER, 471
PRESET_PL7_COUNTER, 471
RESET_PL7_COUNTER, 471
UP_PL7_COUNTER, 471
Index
656 33002543 10/2013
D
DATE_DINT_TO_STRING, 409
DAY_OF_WEEK, 411
DEADTIME, 171
DELAY, 41
DELTA_***, 413
DERIV, 179
DOWN_PL7_COUNTER, 471
DOWN_PL7_TOF, 499
DOWN_PL7_TON, 505
DOWN_PL7_TP, 511
drum - instructions
FSTEP_PL7_DRUM, 431
PL7_DRUM, 477
RESET_PL7_DRUM, 477
UP_PL7_DRUM, 477
DT_ARINT_TO_STRING, 415
E
END, 419
error codes, 597
F
FGEN, 187
FIFO, 421
FPULSOR, 427
FSTEP_PL7_DRUM, 431
FTOF, 433
FTON, 437
FTP, 441
G
GET_3X, 445
GET_4X, 447
GET_BIT, 449
GET_PL7_REGISTER_255, 493
GET_PL7_REGISTER_32, 489
H
HIGH_INT, 451
I
IEC_BMDI, 453
instructions
availability, 29
INTEG, 203
INTEGRATOR1, 47
L
LAG, 211
LAG1, 53
LAG2, 217
LEAD_LAG, 225
LEAD_LAG1, 59
LIFO, 461
LIMV, 67
logical - instructions
HIGH_INT, 451
LOW_INT, 467
AKF_FL, 373
PL7_MONOSTABLE, 483
SET_BIT, 547
START_PL7_MONOSTABLE, 483
LOW_INT, 467
M
mathematical - instructions
ADD_***_PL7, 369
DELTA_***, 413
IEC_BMDI, 453
MUX_DINTARR_125, 469
STR_ROUND, 565
SUB_***_PL7, 567
T2T, 573
MUX_DINTARR_125, 469
O
output processing - instructions
PWM, 331
QPWM, 343
Index
33002543 10/2013 657
P
PCMCIA card - instructions
READ_PCMCIA, 533
SET_PCMCIA, 549
WRITE_PCMCIA, 589
PCON2, 233
PCON3, 239
PD_OR_PI, 247
PDM, 259
PI, 269
PI1, 73
PID, 279
PID_P, 293
PID1, 83
PIDP1, 97
PIP, 305
PL7_3_TIMER, 517
PL7_COUNTER, 471
PL7_DRUM, 477
PL7_MONOSTABLE, 483
PL7_REGISTER_255, 493
PL7_REGISTER_32, 489
PL7_TOF, 499
PL7_TON, 505
PL7_TP, 511
PPI, 319
PRESET_PL7_3_TIMER, 517
PRESET_PL7_COUNTER, 471
PUT_4X, 523
PUT_PL7_REGISTER_255, 493
PUT_PL7_REGISTER_32, 489
PWM, 331
Q
QPWM, 343
R
R_INT_WORD, 525
R_UINT_WORD, 527
R2T_***, 529
READ_PCMCIA, 533
register management - instructions
FIFO, 421
GET_3X, 445
GET_4X, 447
GET_BIT, 449
GET_PL7_REGISTER_255, 493
GET_PL7_REGISTER_32, 489
LIFO, 461
PL7_REGISTER_255, 493
PL7_REGISTER_32, 489
PUT_4X, 523
PUT_PL7_REGISTER_255, 493
PUT_PL7_REGISTER_32, 489
RESET_PL7_REGISTER_255, 493
RESET_PL7_REGISTER_32, 489
ROR1_ARB, 539
SHL_RBIT_***, 551
SHR_RBIT_***, 553
SHRZ_***, 555
SHRZ_RBIT_***, 557
RESET_PL7_COUNTER, 471
RESET_PL7_DRUM, 477
RESET_PL7_REGISTER_255, 493
RESET_PL7_REGISTER_32, 489
ROR1_ARB, 539
RRTC, 541
S
SCON3, 351
SCOUNT, 543
SET_BIT, 547
SET_PCMCIA, 549
SHL_RBIT_***, 551
SHR_RBIT_***, 553
SHRZ_***, 555
SHRZ_RBIT_***, 557
SMOOTH_RATE, 109
SRCH, 559
START_PL7_3_TIMER, 517
START_PL7_MONOSTABLE, 483
START_PL7_TOF, 499
START_PL7_TON, 505
START_PL7_TP, 511
STOP_PL7_3_TIMER, 517
Index
658 33002543 10/2013
STR_ROUND, 565
string management - instructions
DATE_DINT_TO_STRING, 409
DT_ARINT_TO_STRING, 415
END, 419
TIME_DINT_TO_STRING, 579
TOD_DINT_TO_STRING, 581
STR_ROUND, 565
SUB_***_PL7, 567
SYSSTATE, 571
system specials - instructions
SYSSTATE, 571
system time and date - instructions
DAY_OF_WEEK, 411
RRTC, 541
WRTC, 593
T
T2T, 573
THREE_STEP_CON1, 115
THREEPOINT_CON1, 123
TIME_DINT_TO_STRING, 579
timer - instructions
DOWN_PL7_TON, 505
FPULSOR, 427
FTOF, 433
FTON, 437
FTP, 441
PL7_TON, 505
START_PL7_TON, 505
AKF_TA, 375
AKF_TE, 379
AKF_TI, 383
AKF_TS, 387
AKF_TV, 391
DOWN_PL7_TOF, 499
DOWN_PL7_TP, 511
PL7_3_TIMER, 517
PL7_TOF, 499
PL7_TP, 511
PRESET_PL7_3_TIMER, 517
START_PL7_3_TIMER, 517
START_PL7_TOF, 499
START_PL7_TP, 511
STOP_PL7_3_TIMER, 517
TOD_DINT_TO_STRING, 581
TRANS_TIME, 583
TWOPOINT_CON1, 133
U
UP_PL7_COUNTER, 471
UP_PL7_DRUM, 477
V
VLIM, 359
W
W_INT_REAL, 585
W_UINT_REAL, 587
WRITE_PCMCIA, 589
WRTC, 593

You might also like