Sie sind auf Seite 1von 664

33002543 05/2010

Unity Pro
Obsolete
Block Library
05/2010
33002543.09

www.schneider-electric.com
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.
© 2010 Schneider Electric. All rights reserved.

2 33002543 05/2010
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 Availability of the blocks on different hardware
platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Availability of the block on the 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. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Examples of function blocks LEAD_LAG1 . . . . . . . . . . . . . . . . . . . . . . . . 64
Chapter 8 LIMV: Velocity limiter 1st order . . . . . . . . . . . . . . . . . . . . 67
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

33002543 05/2010 3
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Chapter 11 PIDP1: PID Controller with Parallel Structure . . . . . . . . . 99
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Setting parameters for the PIDP1 controller . . . . . . . . . . . . . . . . . . . . . . 105
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Chapter 12 SMOOTH_RATE: Differentiator with smoothing . . . . . . . 111
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Formulas for the SMOOTH_RATE function block . . . . . . . . . . . . . . . . . . . . 115
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Chapter 13 THREE_STEP_CON1: Three step controller . . . . . . . . . . 117
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Chapter 14 THREEPOINT_CON1: Three point controller . . . . . . . . . 125
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Chapter 15 TWOPOINT_CON1: Two point controller. . . . . . . . . . . . . 133
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Part III CLC_PRO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Chapter 16 ALIM: Velocity limiter: 2nd order . . . . . . . . . . . . . . . . . . . 143
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Chapter 17 COMP_PID: Complex PID controller . . . . . . . . . . . . . . . . 149
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Complex PID controller structure diagram . . . . . . . . . . . . . . . . . . . . . . . . 156
Setting parameters for the COMP_PID controller . . . . . . . . . . . . . . . . . . . 157
Anti-windup for COMP_PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Controller type selection for COMP_PID . . . . . . . . . . . . . . . . . . . . . . . . . 161
Bumpless operating mode switchover . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Selecting the operating mode of the COMP_PID . . . . . . . . . . . . . . . . . . . 166
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

4 33002543 05/2010
Chapter 18 DEADTIME: Deadtime device . . . . . . . . . . . . . . . . . . . . . 173
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Operating mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Example for behavior of the function block . . . . . . . . . . . . . . . . . . . . . . . . 179
Chapter 19 DERIV: Differentiator with smoothing . . . . . . . . . . . . . . 181
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Example for the function block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Chapter 20 FGEN: Function generator. . . . . . . . . . . . . . . . . . . . . . . . 189
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Parametering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Function selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Function definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Diagrams of the individual functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Special cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Timing diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Chapter 21 INTEG: Integrator with limit . . . . . . . . . . . . . . . . . . . . . . . 207
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Chapter 22 LAG: Delay element 1st order . . . . . . . . . . . . . . . . . . . . . 215
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Chapter 23 LAG2: Delay element 2nd order . . . . . . . . . . . . . . . . . . . 221
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
Timing diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Chapter 24 LEAD_LAG: PD device with smoothing . . . . . . . . . . . . . 229
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Examples of function blocks LEAD_LAG . . . . . . . . . . . . . . . . . . . . . . . . . 235
Chapter 25 PCON2: Two point controller. . . . . . . . . . . . . . . . . . . . . . 237
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Chapter 26 PCON3: Three point controller . . . . . . . . . . . . . . . . . . . . 243
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Runtime error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Chapter 27 PD_OR_PI: Structure changeover PD/PI controller. . . . 251
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Structure diagram for the function block PD_OR_PI . . . . . . . . . . . . . . . . 256
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260

33002543 05/2010 5
Chapter 28 PDM: Pulse duration modulation . . . . . . . . . . . . . . . . . . . 263
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Chapter 29 PI: PI controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Parametering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Example of a PI controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Chapter 30 PID: PID controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
PID function block structure diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Setting parameters for the PID controller. . . . . . . . . . . . . . . . . . . . . . . . . 290
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Chapter 31 PID_P: PID controller with parallel structure . . . . . . . . . 299
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Setting parameters for the PID_P controller . . . . . . . . . . . . . . . . . . 305
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Chapter 32 PIP: PIP cascade controller . . . . . . . . . . . . . . . . . . . . . . . 311
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
PIP function block structure diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Setting parameters for the PIP cascade controller . . . . . . . . . . . . . . . . . 318
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Chapter 33 PPI: PPI cascade controller . . . . . . . . . . . . . . . . . . . . . . . 325
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
PPI function block structure diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Setting parameters for the PPI cascade controller . . . . . . . . . . . . . . . . . 332
Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Detailed formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Chapter 34 PWM: Pulse width modulation . . . . . . . . . . . . . . . . . . . . . 339
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Example for the PWM block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Chapter 35 QPWM: Pulse width modulation (simple) . . . . . . . . . . . . 351
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Example for the QPWM block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Chapter 36 SCON3: Three step controller. . . . . . . . . . . . . . . . . . . . . . 359
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

6 33002543 05/2010
Chapter 37 VLIM: Velocity limiter 1st order . . . . . . . . . . . . . . . . . . . . 367
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Part IV Extension/Compatibility . . . . . . . . . . . . . . . . . . . . . . 373
Chapter 38 ADD_***_PL7 : Add a period . . . . . . . . . . . . . . . . . . . . . . 377
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Chapter 39 AKF_FL: Detection of any edge . . . . . . . . . . . . . . . . . . . 381
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Chapter 40 AKF_TA: Switch off delay . . . . . . . . . . . . . . . . . . . . . . . . 383
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Chapter 41 AKF_TE: Switch-on delay . . . . . . . . . . . . . . . . . . . . . . . . 387
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Chapter 42 AKF_TI: Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Chapter 43 AKF_TS: Storing switch on delay . . . . . . . . . . . . . . . . . . 395
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Chapter 44 AKF_TV: Extended pulse . . . . . . . . . . . . . . . . . . . . . . . . . 399
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Chapter 45 AKF_ZR: Decremental counter . . . . . . . . . . . . . . . . . . . . 403
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Chapter 46 AKF_ZV: Incremental counter . . . . . . . . . . . . . . . . . . . . . 407
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Chapter 47 AKF_ZVR: Incremental/decremental counter . . . . . . . . 411
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Chapter 48 COMPARE: Comparing two integers . . . . . . . . . . . . . . . 415
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Chapter 49 DATE_DINT_TO_STRING: Conversion of a date (DATE
PL7) into a character string . . . . . . . . . . . . . . . . . . . . . . . 417
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
Chapter 50 DAY_OF_WEEK : Day of the week . . . . . . . . . . . . . . . . . 419
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Chapter 51 DELTA_***: Difference between two dates. . . . . . . . . . . 421
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Chapter 52 DT_ARINT_TO_STRING: Converting a PL7 date into a
character string. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Chapter 53 END: Unconditional end of program. . . . . . . . . . . . . . . . 427
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Chapter 54 FIFO: First In/First Out stack register . . . . . . . . . . . . . . . 429
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432

33002543 05/2010 7
Chapter 55 FPULSOR: Generation of rectangular signals . . . . . . . . 433
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
Detailed description of the operation of the FPULSOR function . . . . . . . 436
Chapter 56 FSTEP_PL7_DRUM : Forcing a drum to a step . . . . . . . 437
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Chapter 57 FTOF: Deactivation timer . . . . . . . . . . . . . . . . . . . . . . . . . 439
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Detailed description of the operation of the FTOF function . . . . . . . . . . . 442
Chapter 58 FTON: Activation timer . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Detailed description of the operation of the FTON function . . . . . . . . . . . 446
Chapter 59 FTP: Pulse timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
Detailed description of the operation of the FTP function . . . . . . . . . . . . 450
Chapter 60 GET_3X: Read %IW Words (3x-Register) . . . . . . . . . . . . 451
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
Chapter 61 GET_4X: Read %MW Words (4x-Register) . . . . . . . . . . . 453
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Chapter 62 GET_BIT: Reading bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Chapter 63 HIGH_INT: Extracting the most significant word of a
double integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Chapter 64 IEC_BMDI: Block move . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Chapter 65 LIFO: Last In/First Out stack register. . . . . . . . . . . . . . . . 467
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Chapter 66 LOW_INT: Extracting the least significant word of a
double integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Chapter 67 MUX_DINTARR_125: Multiplexer for arrays of the data
type DIntArr125 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
Chapter 68 PL7_COUNTER : Counter/downcounter . . . . . . . . . . . . . 475
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Mode of operation of the PL7_COUNTER function . . . . . . . . . . . . . . . . . 479
Chapter 69 PL7_DRUM : Drum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Mode of operation of the PL7_DRUM timer function . . . . . . . . . . . . . . . . 486

8 33002543 05/2010
Chapter 70 PL7_MONOSTABLE : Monostable . . . . . . . . . . . . . . . . . 487
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
Detailed description of the operation of the PL7_MONOSTABLE function 491
Mode of operation of the PL7_MONOSTABLE monostable function . . . . 492
Chapter 71 PL7_REGISTER_32 : 32 word memory register. . . . . . . 493
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Chapter 72 PL7_REGISTER_255 : 255 word memory register. . . . . 497
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Chapter 73 PL7 and Unity Timers Comparison . . . . . . . . . . . . . . . . . 501
Differences between PL7 and Unity Pro: Timers . . . . . . . . . . . . . . . . . . . 501
Chapter 74 PL7_TOF : TOF type timer . . . . . . . . . . . . . . . . . . . . . . . . 503
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
Detailed description of the operation of the PL7_TOF function. . . . . . . . . 507
Mode of operation of the PL7_TOF timer function . . . . . . . . . . . . . . . . . . 508
Chapter 75 PL7_TON : TON type timer. . . . . . . . . . . . . . . . . . . . . . . . 509
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
Detailed description of the operation of the PL7_TON function . . . . . . . . 513
Mode of operation of the PL7_TON timer function . . . . . . . . . . . . . . . . . . 514
Chapter 76 PL7_TP : TP type timer. . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
Detailed description of the operation of the PL7_TP function . . . . . . . . . . 519
Mode of operation of the PL7_TP timer function. . . . . . . . . . . . . . . . . . . . 520
Chapter 77 PL7_3_TIMER : Conversion timer for % Ti’s of PL7 . . . 521
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
Detailed description of the operation of the PL7_3_TIMER function. . . . . 525
Mode of operation of the PL7_3_TIMER timer function . . . . . . . . . . . . . . 526
Chapter 78 PUT_4X: Write 4x register . . . . . . . . . . . . . . . . . . . . . . . . 527
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Chapter 79 R_INT_WORD: Type conversion (REAL -> INT -> WORD)
(R_INT_WORD: Type conversion (REAL -> INT ->
WORD)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
Chapter 80 R_UINT_WORD: Type conversion (REAL -> UINT ->
WORD) (R_UINT_WORD: Type conversion (REAL ->
UINT -> WORD)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Chapter 81 R2T_***: Register to table . . . . . . . . . . . . . . . . . . . . . . . . 533
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
Detailed description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Chapter 82 READ_PCMCIA: Reading data in the memory card . . . 537
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
READ_PCMCIA and WRITE_PCMCIA Example . . . . . . . . . . . . . . . . . . . 540

33002543 05/2010 9
Chapter 83 ROR1_ARB: Right shift of one byte from a table of bytes 543
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
Chapter 84 RRTC: Reading the system date . . . . . . . . . . . . . . . . . . . 545
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
Chapter 85 SCOUNT: Up/down counting with overshoot signaling. 547
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Chapter 86 SET_BIT: Set bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
Chapter 87 SET_PCMCIA: Initialization of the archiving zone . . . . . 555
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
Chapter 88 SHL_RBIT_***: Left shift on an integer or double integer 557
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Chapter 89 SHR_RBIT_***: Right shift on an integer or double
integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
Chapter 90 SHRZ_***: Right shift on an integer or double integer . 561
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Chapter 91 SHRZ_RBIT_***: Right shift on an integer or double
integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
Chapter 92 SRCH: Search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
Detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
Chapter 93 STR_ROUND: Approximate value of a floating point
number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
Chapter 94 SUB_***_PL7 : Subtract a period . . . . . . . . . . . . . . . . . . . 573
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Chapter 95 SYSSTATE: System state . . . . . . . . . . . . . . . . . . . . . . . . . 577
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
Chapter 96 T2T: Table to table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
Detailed Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
Chapter 97 TIME_DINT_TO_STRING: Conversion of a variable to
DINT format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Chapter 98 TOD_DINT_TO_STRING: Conversion of a variable to
TOD format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587

10 33002543 05/2010
Chapter 99 TRANS_TIME: Conversion of a duration into DINT
format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Chapter 100 W_INT_REAL: Type conversion (WORD -> INT -> REAL)
(W_INT_REAL: Type conversion (WORD -> INT ->
REAL)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Chapter 101 W_UINT_REAL: Type conversion (WORD -> UINT ->
REAL) (W_UINT_REAL: Type conversion (WORD ->
UINT -> REAL)) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
Chapter 102 WRITE_PCMCIA: Writing data to the memory card. . . . 595
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Chapter 103 WRTC: Updating the system date . . . . . . . . . . . . . . . . . . 599
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601
Appendix A EFB Error Codes and Values. . . . . . . . . . . . . . . . . . . . . . 603
Tables of Error Codes for the Obsolete Library. . . . . . . . . . . . . . . . . . . . . 604
Common Floating Point Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
Appendix B System Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
System Bit Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
Description of System Bits %S15 to %S21 . . . . . . . . . . . . . . . . . . . . . . . . 615
Description of System Words %SW0 to %SW11 . . . . . . . . . . . . . . . . . . . 618
Description of System Words %SW12 to %SW29 . . . . . . . . . . . . . . . . . . 621
Description of System Words %SW70 to %SW100 . . . . . . . . . . . . . . . . . 626
Description of System Words %SW123 to %SW127 . . . . . . . . . . . . . . . . 636
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659

33002543 05/2010 11
12 33002543 05/2010
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.

33002543 05/2010 13
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 the installation, and has received safety
training to recognize and avoid the hazards involved.

14 33002543 05/2010
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. They should not be used to create new user
programs.

Validity Note
This document is valid from Unity Pro Version 5.0.

User Comments
We welcome your comments about this document. You can reach us by e-mail at
techcomm@schneider-electric.com.

33002543 05/2010 15
16 33002543 05/2010
General
33002543 05/2010

General

I
Overview
This section contains general information about the Obsolete library.

What's in this Part?


This part contains the following chapters:
Chapter Chapter Name Page
1 Block Types and their Applications 19
2 Availability of the blocks on different hardware platforms 29
3 List of obsolete functions described in the other libraries 35

33002543 05/2010 17
General

18 33002543 05/2010
Block Types and their Applications
33002543 05/2010

Block Types and their


Applications
1
Overview
This chapter describes the different block types and their applications.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Block Types 20
FFB Structure 22
EN and ENO 25

33002543 05/2010 19
Block Types and their Applications

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:
z Elementary Function (EF)
z Elementary Function Block (EFB)
z Derived Function Block (DFB)
z Procedure

NOTE: Motion Function Blocks are not available on the Quantum platform.

Elementary Function

CAUTION
UNEXPECTED BEHAVIOR OF EQUIPMENT
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.

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,
e.g. 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 frame. The name of the function, i.e. the function type,
is shown in the center of the frame.
The number of inputs can be increased with some elementary functions.
NOTE: 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 EF’s output and must be used to connect the input of the element.

20 33002543 05/2010
Block Types and their Applications

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 frame. The name of the function block, i.e. the
function block type, is shown in the center of the frame. The instance name is
displayed above the 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.

33002543 05/2010 21
Block Types and their Applications

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.

Formal call of a function block in the ST programming language:

22 33002543 05/2010
Block Types and their Applications

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.

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.

33002543 05/2010 23
Block Types and their Applications

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:
z The VAR_IN_OUT inputs must be assigned a variable.
z Literals or constants cannot be assigned to VAR_IN_OUT inputs/outputs.

The following additional limitations apply to the graphic languages (FBD and LD):
z When using graphic connections, VAR_IN_OUT outputs can only be connected
with VAR_IN_OUT inputs.
z Only one graphical link can be connected to a VAR_IN_OUT input/output.
z 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.
z No negations can be used on VAR_IN_OUT inputs/outputs.
z A combination of variable/address and graphic connections is not possible for
VAR_IN_OUT outputs.

24 33002543 05/2010
Block Types and their Applications

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):
z Function blocks
z 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.
z 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.

33002543 05/2010 25
Block Types and their Applications

z Functions/Procedures
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:
z 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".
z 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.

26 33002543 05/2010
Block Types and their Applications

Conditional/Unconditional FFB Call


"Unconditional" or "conditional" calls are possible with each FFB. The condition is
realized by pre-linking the input EN.
z EN connected
conditional calls (the FFB is only processed if EN = 1)
z 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.

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.

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.

33002543 05/2010 27
Block Types and their Applications

28 33002543 05/2010
Availability of Blocks
33002543 05/2010

Availability of the blocks on


different hardware platforms
2
Availability of the block on the 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 Source M340 Premium Quantum


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

33002543 05/2010 29
Availability of Blocks

CLC_PRO
Availability of the blocks:

Block name Block type Source M340 Premium Quantum


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

30 33002543 05/2010
Availability of Blocks

Extension/Compatibility
Availability of the blocks:

Block name Block type Source M340 Premium Quantum


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 PL7 + TSX P 57 5• +
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 PL7 + + high end
CPUs
only
(651_50,
651_60,
671_60)
FIFO EFB Concept + + +
FPULSOR Procedure PL7 + + -
FSTEP_PL7_DRUM Procedure PL7 - + -

33002543 05/2010 31
Availability of Blocks

Block name Block type Source M340 Premium Quantum


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_TIMER Procedure PL7 - + -
PRESET_PL7_COUNTER Procedure PL7 - + -
PUT_4X Procedure Concept + + +
PUT_PL7_REGISTER_255 Procedure PL7 - + -
PUT_PL7_REGISTER_32 Procedure PL7 - + -

32 33002543 05/2010
Availability of Blocks

Block name Block type Source M340 Premium Quantum


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 + + -
TRANS_TIME EF PL7 + + -

33002543 05/2010 33
Availability of Blocks

Block name Block type Source M340 Premium Quantum


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

34 33002543 05/2010
List of obsolete functions described in the other libraries
33002543 05/2010

List of obsolete functions


described in the other libraries
3
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.

33002543 05/2010 35
List of obsolete functions described in the other libraries

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 The function is described in


function can be accessed the family...
via the family...
AND_ARDINT_DINT Extensions/compatibility Array
(see Unity Pro, Standard,
Block Library)
AND_ARINT_INT (see Unity Extensions/compatibility Array
Pro, Standard, Block Library)
AND_ARDINT (see Unity Extensions/compatibility Array
Pro, Standard, Block Library)
AND_ARINT (see Unity Pro, Extensions/compatibility Array
Standard, Block Library)
AND_DINT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
AND_INT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
NOT_DINT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
NOT_INT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
NOT_ARDINT (see Unity Extensions/compatibility Array
Pro, Standard, Block Library)
NOT_ARINT (see Unity Pro, Extensions/compatibility Array
Standard, Block Library)
OR_ARDINT_DINT Extensions/compatibility Array
(see Unity Pro, Standard,
Block Library)
OR_ARINT_INT (see Unity Extensions/compatibility Array
Pro, Standard, Block Library)
OR_ARDINT (see Unity Pro, Extensions/compatibility Array
Standard, Block Library)
OR_ARINT (see Unity Pro, Extensions/compatibility Array
Standard, Block Library)
OR_DINT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
OR_INT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)

36 33002543 05/2010
List of obsolete functions described in the other libraries

Functions Using Unity Pro, the The function is described in


function can be accessed the family...
via the family...
ROL_DINT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
ROL_INT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
ROR_DINT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
ROR_INT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
SHL_DINT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
SHL_INT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
XOR_ARDINT_DINT Extensions/compatibility Array
(see Unity Pro, Standard,
Block Library)
XOR_ARINT_INT (see Unity Extensions/compatibility Array
Pro, Standard, Block Library)
XOR_ARDINT (see Unity Extensions/compatibility Array
Pro, Standard, Block Library)
XOR_ARINT (see Unity Pro, Extensions/compatibility Array
Standard, Block Library)
XOR_DINT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)
XOR_INT (see Unity Pro, Extensions/compatibility Logic
Standard, Block Library)

33002543 05/2010 37
List of obsolete functions described in the other libraries

38 33002543 05/2010
CLC
33002543 05/2010

CLC

II
Overview
This part describes the elementary functions and elementary function blocks in the
family CLC.

What's 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 99
12 SMOOTH_RATE: Differentiator with smoothing 111
13 THREE_STEP_CON1: Three step controller 117
14 THREEPOINT_CON1: Three point controller 125
15 TWOPOINT_CON1: Two point controller 133

33002543 05/2010 39
CLC

40 33002543 05/2010
DELAY
33002543 05/2010

DELAY: Deadtime device

4
Introduction
This chapter describes the DELAY block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 42
Operating mode 45
Example for behavior of the function block 46

33002543 05/2010 41
DELAY

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.

42 33002543 05/2010
DELAY

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)

Representation in ST
Representation:
DELAY_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=InputValue, T_DELAY:=DelayTime,
YMAN:=ManualControl_Y_Value, Y=>Output,
READY=>InternalBufferFlag) ;

33002543 05/2010 43
DELAY

Parameter description
Description of input parameters:

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

Description of output parameters:

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)

Runtime error
For a list of all block error codes and values, see CLC, page 604.

44 33002543 05/2010
DELAY

Operating mode

Selecting the operating modes


There are three operating modes, which are selected via the inputs MAN and HALT.

Operating mode MAN HALT


Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1

Automatic operating mode


In the automatic mode, the function block operates according to the following rules:

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.

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.

33002543 05/2010 45
DELAY

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

46 33002543 05/2010
INTEGRATOR1
33002543 05/2010

INTEGRATOR1: Integrator with


limit
5
Introduction
This chapter describes the INTEGRATOR1 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 48
Detailed description 51

33002543 05/2010 47
INTEGRATOR1

Description

Function description
The function block replicates a limited integrator.
The function block has the following properties:
z Manual, halt and automatic modes
z 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.

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.

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

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

48 33002543 05/2010
INTEGRATOR1

Representation in FBD
Representation:

Representation in LD
Representation:

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)

33002543 05/2010 49
INTEGRATOR1

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:

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

Description of output parameters:

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

Runtime error
If YMAN < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 604.

50 33002543 05/2010
INTEGRATOR1

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.
z QMAX = 1 if Y ≥ YMAX
z QMIN = 1 if Y ≤YMIN

Operating mode
There are three operating modes, which are selected via the inputs MAN and HALT:

Operating MAN HALT Meaning


mode
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.

33002543 05/2010 51
INTEGRATOR1

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.
It displays the integrator jump response:

52 33002543 05/2010
LAG1
33002543 05/2010

LAG1: Delay element 1st order

6
Introduction
This chapter describes the LAG1 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 54
Detailed description 57

33002543 05/2010 53
LAG1

Description

Function description
The function block represents a delay element 1st order.
The function block contains the following operating mode:
z Manual mode
z Halt
z 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.

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.

EN and ENO can be configured as additional parameters.

Formula
The transfer function is:

The formula of calculation is:

54 33002543 05/2010
LAG1

Meaning of the sizes

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

Representation in FBD
Representation:

Representation in LD
Representation:

33002543 05/2010 55
LAG1

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:

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

Description of output parameters:

Parameter Data type Description


Y REAL Output

Runtime error
For a list of all block error codes and values, see CLC, page 604.

56 33002543 05/2010
LAG1

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:

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.

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.
Jump response for function block LAG1 if GAIN = 1

33002543 05/2010 57
LAG1

58 33002543 05/2010
LEAD_LAG1
33002543 05/2010

LEAD_LAG1: PD device with


smoothing
7
Introduction
This chapter describes the LEAD_LAG1 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 60
Detailed description 63
Examples of function blocks LEAD_LAG1 64

33002543 05/2010 59
LEAD_LAG1

Description

Function description
The function block serves as a PD outline with subsequent smoothing.
The function block has the following properties:
z Definable delay of the D-component
z 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.

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.

EN and ENO can be configured as additional parameters.

Formula
The transfer function is:

The formula of calculation is:

Meaning of the sizes

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

60 33002543 05/2010
LEAD_LAG1

Representation in FBD
Representation:

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)

33002543 05/2010 61
LEAD_LAG1

Representation in ST
Representation:
LEAD_LAG1_Instance (MAN:=ManualMode, HALT:=HaltMode,
X:=Input, GAIN:=GainFactor,
LEAD:=DifferentialTimeConstant, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue, Y=>Output) ;

Parameter description
Description of input parameters:

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

Description of output parameters:

Parameter Data type Description


Y REAL Output

Runtime error
For a list of all block error codes and values, see CLC, page 604.

62 33002543 05/2010
LEAD_LAG1

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.

33002543 05/2010 63
LEAD_LAG1

Examples of function blocks LEAD_LAG1

Example overview
The following examples are presented in the following diagrams:
z LEAD = LAG
z LEAD=LAG * 0.5, GAIN = 1
z 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

64 33002543 05/2010
LEAD_LAG1

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 05/2010 65
LEAD_LAG1

66 33002543 05/2010
LIMV
33002543 05/2010

LIMV: Velocity limiter 1st order

8
Introduction
This chapter describes the LIMV block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 68
Detailed description 71

33002543 05/2010 67
LIMV

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 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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z Operating modes Manual, Halt, Automatic
z Manipulated variable limiting in automatic mode

68 33002543 05/2010
LIMV

Representation in FBD
Representation:

Representation in LD
Representation:

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)

33002543 05/2010 69
LIMV

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:

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

Description of output parameters:

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

Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 604.

70 33002543 05/2010
LIMV

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.
z QMAX = 1 if Y ≥ YMAX
z 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.

33002543 05/2010 71
LIMV

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:

72 33002543 05/2010
PI1
33002543 05/2010

PI1: PI controller

9
Introduction
This chapter describes the PI1 block.

What's 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

33002543 05/2010 73
PI1

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z Operating modes Manual, Halt, Automatic
z bumpless changeover between manual and automatic
z Manipulated variable limiting
z Anti-windup reset
z Anti-windup measure with an active I component only

74 33002543 05/2010
PI1

Representation in FBD
Representation:

Representation in LD
Representation:

33002543 05/2010 75
PI1

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

76 33002543 05/2010
PI1

Description of output parameters:

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

Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 604.

33002543 05/2010 77
PI1

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

78 33002543 05/2010
PI1

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.
z QMAX = 1 if Y ≥ YMAX
z QMIN = 1 if Y ≤YMIN

Manipulated variable limiting


After summation of the components manipulated variable limiting takes place, so
that: YMIN ≤Y ≤YMAX

33002543 05/2010 79
PI1

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

80 33002543 05/2010
PI1

Operating modes

Selecting the operating modes


There are three operating modes, which are selected via the inputs MAN and HALT.

Operating mode MAN HALT


Automatic 0 0
Manual mode 1 1 or 0
Halt 0 1

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 93).

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.

33002543 05/2010 81
PI1

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

82 33002543 05/2010
PID1
33002543 05/2010

PID1: PID controller

10
Introduction
This chapter describes the PID1 block.

What's 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 95

33002543 05/2010 83
PID1

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.
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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z real PID controller with independent GAIN, TI, TD setting
z Operating modes Manual, Halt, Automatic
z bumpless changeover between manual and automatic
z Manipulated variable limiting in automatic mode
z Separately enabled P, I and D component
z Anti-Windup-Reset
z Anti-windup measures taken only for an active I component
z definable delay of the D component
z D component connectable to controlled variable PV or system deviation ERR

84 33002543 05/2010
PID1

Transfer function
The transfer function is:

Explanation of the variables:

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)

Representation in FBD
Representation:

33002543 05/2010 85
PID1

Representation in LD
Representation:

86 33002543 05/2010
PID1

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 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

33002543 05/2010 87
PID1

Parameter Data type Description


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

Description of output parameters:

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

Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 604.

88 33002543 05/2010
PID1

PID1 function block structure diagram

Structure diagram
The following is the structure diagram of the PID1block:

33002543 05/2010 89
PID1

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.
z QMAX = 1 if Y ≥ YMAX
z 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:

90 33002543 05/2010
PID1

Selecting the control types


There are various controller types, which can be selected via the EN_P, EN_I and
EN_D parameters.

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

The I component can also be disabled with TI = 0.

33002543 05/2010 91
PID1

Operating modes

Selecting the operating modes


There are three operating modes, which are selected via the parameters MAN and
HALT:

Operating mode MAN HALT


Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1

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.

92 33002543 05/2010
PID1

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:
z Switching with the help of the MOVE function
z Switching with the help of the velocity limiter function block LIMV

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.

33002543 05/2010 93
PID1

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.

94 33002543 05/2010
PID1

Detailed formulas

Explanation of formula variables


Meaning of the variables in the following formulas:

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

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:

33002543 05/2010 95
PID1

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:
z P component YP for manual, Halt and automatic mode
z I component YI for automatic mode
z I component YI for manual and halt modes
z D component YD for automatic mode
z 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:
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:

96 33002543 05/2010
PID1

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 05/2010 97
PID1

98 33002543 05/2010
PID_P1
33002543 05/2010

PIDP1: PID Controller with Parallel


Structure
11
At a Glance
This chapter describes the PIDP1 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 100
Setting parameters for the PIDP1 controller 105
Operating modes 107
Detailed formulas 108

33002543 05/2010 99
PID_P1

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.
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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z PID controller in pure parallel structure
z Each component P, I and D can be individually enabled
z Limiting control limits in automatic mode
z Anti-windup measure with an active I component only
z Anti-windup reset
z Operating modes Manual, Halt, Automatic
z bumpless changeover between manual and automatic
z D component connectable to input variable PV or system deviation ERR
z D component with variable delay

100 33002543 05/2010


PID_P1

Transfer function
The transfer function is:

Explanation of the variables:

Variable Description
YD D component
YI I component
YP P component

Representation in FBD
Representation:

33002543 05/2010 101


PID_P1

Representation in LD
Representation:

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)

102 33002543 05/2010


PID_P1

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 input parameters:

Parameter Data type Description


MAN BOOL "1": Manual mode
HALT BOOL "1": Halt mode
SP REAL Setpoint input
PV 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 REAL Integral action coefficient
KD REAL Derivative time constant
TD_LAG TIME Delay, D component
YMAX REAL Upper limit
YMIN REAL Lower limit
YMAN REAL Manually manipulated value

33002543 05/2010 103


PID_P1

Description of output parameters:

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

Runtime error
If YMAX < YMIN an error messages appears.
NOTE: For a list of all block error codes and values, see CLC, page 604.

104 33002543 05/2010


PID_P1

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.

33002543 05/2010 105


PID_P1

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.
z QMAX = 1 if Y ≥ YMAX
z 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

106 33002543 05/2010


PID_P1

Operating modes

Selecting the operating modes


There are three operating modes, which are selected via the parameters MAN and
HALT:

Operating mode MAN HALT


Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1

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 93).

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.

33002543 05/2010 107


PID_P1

Detailed formulas

Explanation of formula variables


Meaning of the variables in the formulas:

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

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:

If... Then
REVERSE = 0 ERR = SP - PV
REVERSE = 1 ERR = PV - SP

108 33002543 05/2010


PID_P1

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:
z P component YP for manual, halt and automatic modes
z I component YI for automatic mode
z I component YI for manual and halt modes
z D component YD for automatic mode
z 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:

33002543 05/2010 109


PID_P1

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:

110 33002543 05/2010


SMOOTH_RATE
33002543 05/2010

SMOOTH_RATE: Differentiator
with smoothing
12
Introduction
This chapter describes the SMOOTH_RATE block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 112
Formulas for the SMOOTH_RATE function block 115
Detailed description 116

33002543 05/2010 111


SMOOTH_RATE

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:
z Manual mode
z Halt
z 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.

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.

EN and ENO can be configured as additional parameters.

112 33002543 05/2010


SMOOTH_RATE

Representation in FBD
Representation:

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)

33002543 05/2010 113


SMOOTH_RATE

Representation in ST
Representation:
SMOOTH_RATE_Instance (MAN:=ManualMode,
HALT:=HaltMode, X:=InputVariable,
GAIN:=DifferentialGain, LAG:=DelayTimeConstant,
YMAN:=ManualControlValue,
Y=>DifferentiatorOutputWithDelay) ;

Parameter description
Description of input parameters:

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

Description of output parameters:

Parameter Data type Description


Y REAL Output derivative unit with smoothing

Runtime error
For a list of all block error codes and values, see CLC, page 604.

114 33002543 05/2010


SMOOTH_RATE

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

33002543 05/2010 115


SMOOTH_RATE

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:

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.

Example
The following illustration shows the jump response of the function block
SMOOTH_RATE when GAIN = 1 and LAG = 10 s:

116 33002543 05/2010


THREE_STEP_CON1
33002543 05/2010

THREE_STEP_CON1: Three step


controller
13
Introduction
This chapter describes the THREE_STEP_CON1 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 118
Detailed description 121

33002543 05/2010 117


THREE_STEP_CON1

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block THREE_STEP_CON1 has the following properties:
z Reset and automatic operating modes
z One internal feedback path (delay 1st Order)

Representation in FBD
Representation:

118 33002543 05/2010


THREE_STEP_CON1

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)

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) ;

33002543 05/2010 119


THREE_STEP_CON1

Parameter description
Description of input parameters:

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

Description of output parameters:

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

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 604.

Warning
In the following cases a warning will be returned:

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.

NOTE: For a list of all block error codes and values, see CLC, page 604.

120 33002543 05/2010


THREE_STEP_CON1

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

Meaning of variable K:

33002543 05/2010 121


THREE_STEP_CON1

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 122". 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!

122 33002543 05/2010


THREE_STEP_CON1

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 05/2010 123


THREE_STEP_CON1

124 33002543 05/2010


THREEPOINT_CON1
33002543 05/2010

THREEPOINT_CON1: Three point


controller
14
Introduction
This chapter describes the THREEPOINT_CON1 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 126
Detailed description 130

33002543 05/2010 125


THREEPOINT_CON1

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block THREEPOINT_CON1 contains the following properties:
z Operating modes Manual, Halt, Automatic
z Two internal feedback paths (delay 1st Order)

126 33002543 05/2010


THREEPOINT_CON1

Representation in FBD
Representation:

Representation in LD
Representation:

33002543 05/2010 127


THREEPOINT_CON1

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)

128 33002543 05/2010


THREEPOINT_CON1

Parameter Data type Description


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

Description of output parameters:

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

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 604.

Warning
In the following cases a warning will be returned:

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.

NOTE: For a list of all block error codes and values, see CLC, page 604.

33002543 05/2010 129


THREEPOINT_CON1

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

130 33002543 05/2010


THREEPOINT_CON1

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:

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

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!

33002543 05/2010 131


THREEPOINT_CON1

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 131". 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.

132 33002543 05/2010


TWOPOINT_CON1
33002543 05/2010

TWOPOINT_CON1: Two point


controller
15
Introduction
This chapter describes the TWOPOINT_CON1 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 134
Detailed description 138

33002543 05/2010 133


TWOPOINT_CON1

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block TWOPOINT_CON1 has the following properties:
z Operating modes Manual, Halt, Automatic
z Two internal feedback paths (delay 1st Order)

Representation in FBD
Representation:

134 33002543 05/2010


TWOPOINT_CON1

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)

33002543 05/2010 135


TWOPOINT_CON1

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:

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 für ERR_EFF

Description of output parameters:

Parameter Data type Description


Y BOOL "1" = Output manipulated variable
ERR_EFF REAL Effective switch value

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 604.

136 33002543 05/2010


TWOPOINT_CON1

Warning
In the following cases a warning will be returned:

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.

NOTE: For a list of all block error codes and values, see CLC, page 604.

33002543 05/2010 137


TWOPOINT_CON1

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 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!

138 33002543 05/2010


TWOPOINT_CON1

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:

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

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 138". The parameter DB is
typically set to 1% of the maximum control range [max. (SP - PV)].

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.

33002543 05/2010 139


TWOPOINT_CON1

140 33002543 05/2010


CLC_PRO
33002543 05/2010

CLC_PRO

III
Overview
This part describes the elementary functions and elementary function blocks in the
family CLC_PRO.

What's in this Part?


This part contains the following chapters:
Chapter Chapter Name Page
16 ALIM: Velocity limiter: 2nd order 143
17 COMP_PID: Complex PID controller 149
18 DEADTIME: Deadtime device 173
19 DERIV: Differentiator with smoothing 181
20 FGEN: Function generator 189
21 INTEG: Integrator with limit 207
22 LAG: Delay element 1st order 215
23 LAG2: Delay element 2nd order 221
24 LEAD_LAG: PD device with smoothing 229
25 PCON2: Two point controller 237
26 PCON3: Three point controller 243
27 PD_OR_PI: Structure changeover PD/PI controller 251
28 PDM: Pulse duration modulation 263
29 PI: PI controller 273
30 PID: PID controller 283
31 PID_P: PID controller with parallel structure 299
32 PIP: PIP cascade controller 311
33 PPI: PPI cascade controller 325

33002543 05/2010 141


CLC_PRO

Chapter Chapter Name Page


34 PWM: Pulse width modulation 339
35 QPWM: Pulse width modulation (simple) 351
36 SCON3: Three step controller 359
37 VLIM: Velocity limiter 1st order 367

142 33002543 05/2010


ALIM
33002543 05/2010

ALIM: Velocity limiter: 2nd order

16
Introduction
This chapter describes the ALIM block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 144
Detailed description 147

33002543 05/2010 143


ALIM

Description

Function description
The function block produces an acceleration limiter of the 2nd order.
The function block individually contains the following properties:
z Operating modes Manual, Halt, Automatic
z 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.

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.

EN and ENO can be configured as additional parameters.

Representation in FBD
Representation:

144 33002543 05/2010


ALIM

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:

Parameter Data type Description


X REAL Input
MODE Mode_MH Operating mode
PARA Para_ALIM Parameter
YMAN REAL Manual value for output Y

Description of input / output parameters:

Parameter Data type Description


Y REAL Output

33002543 05/2010 145


ALIM

Parameter description Mode_MH


Data structure description:

Element Data type Description


man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode

Parameter description Para_ALIM


Data structure description:

Element Data type Description


max_v REAL Maximum velocity (maximum x’)
Unit: 1/[s]
max_a REAL Maximum acceleration (maximum x’’)

Unit:

Runtime error
An error message is returned if
z an invalid floating point number lies at input YMAN or X,
z max_a or max_v ≤is 0.

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

146 33002543 05/2010


ALIM

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.

33002543 05/2010 147


ALIM

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.

148 33002543 05/2010


COMP_PID
33002543 05/2010

COMP_PID: Complex PID


controller
17
Introduction
This chapter describes the COMP_PID block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 150
Complex PID controller structure diagram 156
Setting parameters for the COMP_PID controller 157
Anti-windup for COMP_PID 160
Controller type selection for COMP_PID 161
Bumpless operating mode switchover 162
Selecting the operating mode of the COMP_PID 166
Detailed formulas 169

33002543 05/2010 149


COMP_PID

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 156.
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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z real PID controller with independent gain, ti, td setting
z Manual, halt, automatic, cascade, reset, manual value operating modes tracking
z Velocity limit for manual operation
z Adjustable manual manipulated value tracking
z Velocity limit for reference variable
z bumpless changeover between manual and automatic
z Manipulated variable limiting
z bumpless, individually connectable P, I and D components
z bumpless gain modification
z Choice of anti-windup reset and anti-windup halt
z Displacement of anti-windup limits compared to control limits
z Anti-windup measure with an active I component only
z definable delay of the D component
z D component connectable to controlled variable PV or system deviation ERR
z Dead zone with gain reduction
z external operating point (in P, PD and D operation)
z Choice of bump/bumpless manual/automatic switchover

150 33002543 05/2010


COMP_PID

Transfer function
The transfer function is:

Explanation of the variables:

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)

Representation in FBD
Representation:

33002543 05/2010 151


COMP_PID

Representation in LD
Representation:

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)

152 33002543 05/2010


COMP_PID

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

Description of input / output parameters:

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

Description of the output parameters:

Parameters Data type Description


ERR REAL System deviation
STATUS Stat_COMP_PID Output status

33002543 05/2010 153


COMP_PID

Parameter description Mode_COMP_PID


Data structure description

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

Parameter description Para_COMP_PID


Data structure description

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

154 33002543 05/2010


COMP_PID

Parameter description Stat_COMP_PID


Data structure description

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

Runtime error
An error message is returned if
z an unauthorized floating point number is placed at the input PV
z gain_red > 1 or gain_red < is 0
z db < is 0
z ymax < is ymin

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 155


COMP_PID

Complex PID controller structure diagram

Structure diagram
The following is the structure diagram of the COMP_PID controller:

156 33002543 05/2010


COMP_PID

Setting parameters for the COMP_PID controller

Setting Parameters
The COMP_PID control structure is displayed in the Structure diagram, page 156.
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.

33002543 05/2010 157


COMP_PID

Forming the system deviation


In cascade mode, the ERR system deviation is formed by SP_CAS and PV:
z sp_intern = SP_CAS
z 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.

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 159. 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.

158 33002543 05/2010


COMP_PID

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:
z st_max = 1 if Y ≥ ymax
z st_min = 1 if Y ≤ymin.

For limiting the manipulated variable, the upper limit ymax should be greater than
the lower limit ymin.

33002543 05/2010 159


COMP_PID

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:
z AWMAX = ymax + delt_aw
z 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.

160 33002543 05/2010


COMP_PID

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.

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

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.

33002543 05/2010 161


COMP_PID

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.

162 33002543 05/2010


COMP_PID

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

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).

33002543 05/2010 163


COMP_PID

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.

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.

164 33002543 05/2010


COMP_PID

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.

33002543 05/2010 165


COMP_PID

Selecting the operating mode of the COMP_PID

Operating mode
There are five operating modes selectable through r, man, halt, and cascade.

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

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.

166 33002543 05/2010


COMP_PID

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.

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 it's 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 controller's 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 controller's 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:

33002543 05/2010 167


COMP_PID

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.

168 33002543 05/2010


COMP_PID

Detailed formulas

Explanation of formula variables


Meaning of the variables in the following formulas:

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)

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:

33002543 05/2010 169


COMP_PID

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:
z P component YP for manual, halt, automatic and cascade modes
z I component YI for automatic mode
z I component YI for manual and halt modes
z D component YD for automatic and cascade mode
z D component YD for manual and halt modes

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:

170 33002543 05/2010


COMP_PID

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 05/2010 171


COMP_PID

172 33002543 05/2010


DEADTIME
33002543 05/2010

DEADTIME: Deadtime device

18
Introduction
This chapter describes the DEADTIME block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 174
Operating mode 177
Example for behavior of the function block 179

33002543 05/2010 173


DEADTIME

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:
z Manual mode
z Halt
z 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.

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.

174 33002543 05/2010


DEADTIME

Formula
The transfer function is:

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)

33002543 05/2010 175


DEADTIME

Representation in ST
Representation:
DEADTIME_Instance (X:=InputValue, MODE:=OperatingModes,
T_DELAY:=DeadTime, YMAN:=ManualManipulatedValue,
Y=>Output, READY=>InternalBufferFlag) ;

DEADTIME parameter description


Description of input parameters:

Parameter Data type Description


X REAL Input value
MODE Mode_MH Operating mode
T_DELAY TIME Deadtime
YMAN REAL Manually manipulated value

Description of output parameters:

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)

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode

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 606.

176 33002543 05/2010


DEADTIME

Operating mode

Selecting the operating modes


There are three operating mode selectable through the man and halt parameter
inputs:

Operating mode man halt


Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1

Automatic operating mode


In the automatic mode, the function block operates according to the following rules:

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 the scan time
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).
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
Scan time < T_DELAY, output Y may correspondingly remain unchanged
in two (or more) consecutive cycles.

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).

33002543 05/2010 177


DEADTIME

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 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.

178 33002543 05/2010


DEADTIME

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

33002543 05/2010 179


DEADTIME

180 33002543 05/2010


DERIV
33002543 05/2010

DERIV: Differentiator with


smoothing
19
Introduction
This chapter describes the DERIV block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 182
Formulas 185
Detailed description 186
Example for the function block 187

33002543 05/2010 181


DERIV

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.

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.

EN and ENO can be configured as additional parameters.

Representation in FBD
Representation:

182 33002543 05/2010


DERIV

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

Description of input / output parameters:

Parameter Data type Description


Y REAL Output derivative unit with smoothing

33002543 05/2010 183


DERIV

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode

Parameter description Para_DERIV


Data structure description

Element Data type Description


gain REAL Gain of the differentiation
lag TIME Delayed time constants

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 606.

184 33002543 05/2010


DERIV

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

33002543 05/2010 185


DERIV

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.

186 33002543 05/2010


DERIV

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

33002543 05/2010 187


DERIV

188 33002543 05/2010


FGEN
33002543 05/2010

FGEN: Function generator

20
Introduction
This chapter describes the FGEN block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 190
Parametering 193
Function selection 194
Function definition 195
Diagrams of the individual functions 199
Special cases 203
Timing diagrams 204

33002543 05/2010 189


FGEN

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:
z Jump function
z Ramp function
z Delta function
z Saw-tooth function
z Square wave function
z Trapezoid function
z Sine function
z 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.

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.

EN and ENO can be configured as additional parameters.

190 33002543 05/2010


FGEN

Representation in FBD
Representation:

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) ;

33002543 05/2010 191


FGEN

FGEN parameter description


Description of input parameters:

Parameter Data type Description


R BOOL 1: Reset
START BOOL 1: Start function generator
PARA Para_FGEN Parameter
YOFF REAL Offset for output Y

Description of output parameters:

Parameter Data type Description


Y REAL Function generator output
ACTIVE BOOL ACTIVE = 1: Function generator is active
N INT Number of intervals since start

Parameter description Para_FGEN


Data structure description

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

Runtime error
For a list of all block error codes and values, see CLC_PRO, page 606.

192 33002543 05/2010


FGEN

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.

33002543 05/2010 193


FGEN

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

194 33002543 05/2010


FGEN

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 194).
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.

33002543 05/2010 195


FGEN

"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

196 33002543 05/2010


FGEN

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 amplitude halfperiod t_off t_rise t_acc unipolar


Jump X
Ramp X X X
Saw-tooth X X X halfperiod X X
- t_acc
Delta X X X ((halfperiod X X
- t_acc)/2
Square X X X X
Trapezoid X X X X X X
Sine X X X X
Random X X
Number

Function diagrams can be found in the section Diagrams of the individual functions,
page 199

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.

33002543 05/2010 197


FGEN

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.

198 33002543 05/2010


FGEN

Diagrams of the individual functions

Jump function
Representation of the Jump function

Ramp function
Representation of the Ramp function

33002543 05/2010 199


FGEN

Saw-tooth function
Representation of the Saw-tooth function

Delta function
Representation of the Delta function

200 33002543 05/2010


FGEN

Square wave function


Representation of the Square wave function

Trapezoid function
Representation of the Trapezoid function

33002543 05/2010 201


FGEN

Sine function
Representation of the Sine function

202 33002543 05/2010


FGEN

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.

33002543 05/2010 203


FGEN

Timing diagrams

Bipolar operation
The following parameter specifications represent the various functions in bipolar
operation:

Parameter Specification
amplitude 1
halfperiod 10
t_off 2
t_rise 2
t_acc 0
unipolar 0

Bipolar operation

204 33002543 05/2010


FGEN

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 1

Unipolar operation

33002543 05/2010 205


FGEN

Trapezoid function
The following parameter specification represents the trapezoid function:

Parameter Specification
amplitude 1
halfperiod 10
t_off 1
t_rise 4
t_acc 1.5

Trapezoid function

206 33002543 05/2010


INTEG
33002543 05/2010

INTEG: Integrator with limit

21
Introduction
This chapter describes the INTEG block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 208
Detailed description 212

33002543 05/2010 207


INTEG

Description

Function description
The function block replicates a limited integrator.
The function block has the following properties:
z Operating modes Manual, Halt, Automatic
z 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.

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.

EN and ENO can be configured as additional parameters.

Formula
The transfer function is:

The formula of calculation is:

Meaning of the sizes

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

208 33002543 05/2010


INTEG

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) ;

33002543 05/2010 209


INTEG

INTEG parameter description


Description of input parameters:

Parameter Data type Description


X REAL Input variable
MODE Mode_MH Operating mode
PARA Para_INTEG Parameter
YMAN REAL Manually manipulated value

Description of input / output parameters:

Parameter Data type Description


Y REAL Output

Description of output parameters:

Parameter Data type Description


STATUS Stat_MAXMIN Output status

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode

Parameter description Para_INTEG


Data structure description

Element Data type Description


gain REAL Integral gain (units/second)
ymax REAL Upper limit
ymin REAL Lower limit

210 33002543 05/2010


INTEG

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmin BOOL "1" = Y has reached the lower control limit
qmax BOOL "1" = Y has reached the upper control limit

Runtime error
An error message is returned if
z an invalid floating point number lies at input YMAN or X
z ymax < is ymin

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 211


INTEG

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.
z qmax = 1 if Y ≥ ymax
z qmin = 1 if Y ≤ymin

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. 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.

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.

212 33002543 05/2010


INTEG

Representation of the integrator jump response

33002543 05/2010 213


INTEG

214 33002543 05/2010


LAG
33002543 05/2010

LAG: Delay element 1st order

22
Introduction
This chapter describes the LAG block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 216
Detailed description 220

33002543 05/2010 215


LAG

Description

Function description
The function block represents a delay element 1st Order (low pass)
The function block contains the following operating modes:
z Manual mode
z Halt
z 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.

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.

EN and ENO can be configured as additional parameters.

216 33002543 05/2010


LAG

Formula
The transfer function is:

The formula of calculation is:

Meaning of the sizes

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

Representation in FBD
Representation:

33002543 05/2010 217


LAG

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) ;

218 33002543 05/2010


LAG

LAG parameter description


Description of input parameters:

Parameter Data type Description


X REAL Input value
MODE Mode_MH Operating modes
PARA Para_LAG Parameter
YMAN REAL Manually manipulated value

Description of input / output parameters:

Parameter Data type Description


Y REAL Output

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode

Parameter description Para_LAG


Data structure description

Element Data type Description


gain REAL Gain factor
lag TIME Delayed time constants

Runtime error
For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 219


LAG

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.

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

220 33002543 05/2010


LAG2
33002543 05/2010

LAG2: Delay element 2nd order

23
Introduction
This chapter describes the LAG2 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 222
Detailed description 226
Timing diagrams 227

33002543 05/2010 221


LAG2

Description

Function description
The function block LAG2 represents a delay element 2nd order.
The function block contains the following operating mode:
z Manual mode
z Halt
z 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.

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.

EN and ENO can be configured as additional parameters.

222 33002543 05/2010


LAG2

Formula
The transfer function is:

The calculation formula is:

where

and

Meaning of the sizes

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

Representation in FBD
Representation:

33002543 05/2010 223


LAG2

Representation in LD
Representation:

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:

Parameter Data type Description


X REAL Input value
MODE Mode_MH Operating mode
PARA Para_LAG2 Parameter
YMAN REAL Manual manipulated value for output

224 33002543 05/2010


LAG2

Description of input / output parameters:

Parameter Data type Description


Y REAL Output

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode

Parameter description Para_LAG2


Data structure description

Element Data type Description


gain REAL Gain factor
dmp REAL Dampening
freq REAL Natural frequency

Runtime error
For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 225


LAG2

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.

226 33002543 05/2010


LAG2

Timing diagrams

Overview
The following diagrams show examples of the LAG2 device’s 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.

Dampening dmp = 0.5


For a dampening of dmp = 0.5 the output Y follows input X with a dampened periodic
action.

33002543 05/2010 227


LAG2

Dampening dmp = 0.2


For a dampening of dmp = 0.2 it is clear that the jump response is considerably less
dampened.

228 33002543 05/2010


LEAD_LAG
33002543 05/2010

LEAD_LAG: PD device with


smoothing
24
Introduction
This chapter describes the LEAD_LAG block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 230
Detailed description 234
Examples of function blocks LEAD_LAG 235

33002543 05/2010 229


LEAD_LAG

Description

Function description
The function block implements a PD element with following low-pass filter.
The function block has the following properties:
z Definable delay of the D-component
z 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.

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.

EN and ENO can be configured as additional parameters.

230 33002543 05/2010


LEAD_LAG

Formula
The transfer function is:

The formula of calculation is:

Meaning of the sizes

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

Representation in FBD
Representation:

33002543 05/2010 231


LEAD_LAG

Representation in LD
Representation:

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:

Parameter Data type Description


X REAL Input
MODE Mode_MH Operating mode
PARA Para_LEAD_LAG Parameter
YMAN REAL Manual value manipulated value

Description of input / output parameters:

Parameter Data type Description


Y REAL Output

232 33002543 05/2010


LEAD_LAG

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual operating mode
halt BOOL "1" = Halt mode

Parameter description Para_LEAD_LAG


Data structure description

Element Data type Description


gain REAL Gain factor
lead TIME Derivative time constant
lag TIME Delayed time constants

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 606.

33002543 05/2010 233


LEAD_LAG

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.

234 33002543 05/2010


LEAD_LAG

Examples of function blocks LEAD_LAG

Example overview
The following examples are presented in the following diagrams:
z lead = lag
z lead=lag * 0.5, gain = 1
z 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

33002543 05/2010 235


LEAD_LAG

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

236 33002543 05/2010


PCON2
33002543 05/2010

PCON2: Two point controller

25
Introduction
This chapter describes the PCON2 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 238
Detailed description 241

33002543 05/2010 237


PCON2

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:
z Operating modes Manual, Halt, Automatic
z Two internal feedback paths (delay 1st Order)

Representation in FBD
Representation:

Representation in LD
Representation:

238 33002543 05/2010


PCON2

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
MODE Mode_MH Operating mode
PARA Para_PCON2 Parameter
YMAN BOOL "1" = Manual value for ERR_EFF

Description of output parameters:

Parameter Data type Description


Y BOOL "1" = Output manipulated variable
ERR_EFF REAL Effective switch value

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual mode
halt BOOL "1" = Halt mode

33002543 05/2010 239


PCON2

Parameter description Para_PCON2


Data structure description

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)

Runtime error
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.

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

240 33002543 05/2010


PCON2

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.

33002543 05/2010 241


PCON2

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:

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

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 241. 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:

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.

242 33002543 05/2010


PCON3
33002543 05/2010

PCON3: Three point controller

26
Introduction
This chapter describes the PCON3 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 244
Detailed description 247
Runtime error 250

33002543 05/2010 243


PCON3

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:
z Operating modes Manual, Halt, Automatic
z Two internal feedback paths (delay 1st Order)

Representation in FBD
Representation:

Representation in LD
Representation:

244 33002543 05/2010


PCON3

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 parameter description


Description of input parameters:

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

Description of output parameters:

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

33002543 05/2010 245


PCON3

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1" = Manual mode
halt BOOL "1" = Halt mode

Parameter description Para_PCON3


Data structure description

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)

Runtime error
For a list of all block error codes and values, see CLC_PRO, page 606.

246 33002543 05/2010


PCON3

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

33002543 05/2010 247


PCON3

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:

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

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).

248 33002543 05/2010


PCON3

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 248.
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.

33002543 05/2010 249


PCON3

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.

250 33002543 05/2010


PD_OR_PI
33002543 05/2010

PD_OR_PI: Structure changeover


PD/PI controller
27
Introduction
This chapter describes the PD_OR_PI block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 252
Structure diagram for the function block PD_OR_PI 256
Detailed description 257
Detailed formulas 260

33002543 05/2010 251


PD_OR_PI

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z PI controller with independent gain, ti adjustment
z PD controller with independent gain, ti adjustment
z Manipulated variable limiting in automatic mode
z Anti-windup reset in PI operation
z definable delay of the D component
z Operating modes Manual, Halt, Automatic
z bumpless changeover between manual and automatic
z Automatic bumpless changeover from PD to PI operation and back

252 33002543 05/2010


PD_OR_PI

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:

Representation in LD
Representation:

33002543 05/2010 253


PD_OR_PI

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) ;

Parameter description PD_OR_PI


Description of input parameters:

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

Description of input / output parameters:

Parameter Data type Description


Y REAL Manipulated variable

Description of output parameters:

Parameter Data type Description


ERR REAL System deviation
STATUS Stat_MAXMIN Output status

254 33002543 05/2010


PD_OR_PI

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1": Manual mode
halt BOOL "1": Halt mode

Parameter description Para_PD_PI


Data structure description

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

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit

Runtime error
An error message is returned if
z an unauthorized floating point number is placed at the input PV
z ymax < is ymin

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 255


PD_OR_PI

Structure diagram for the function block PD_OR_PI

Structure diagram
The following is the structure diagram of the PD_OR_PI block:

256 33002543 05/2010


PD_OR_PI

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:
z PD controller: ERR > trig_err
z 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.

33002543 05/2010 257


PD_OR_PI

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:
z qmax = 1, if Y ≥ ymax
z 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:
z YI ≥ ymin - gain_i * (SP - PV) - FEED_FWD
z YI ≤ymax - gain_i * (SP - PV) - FEED_FWD

258 33002543 05/2010


PD_OR_PI

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 it's
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
controller's internal components are given the chance to
continuously react to the external influence.

33002543 05/2010 259


PD_OR_PI

Detailed formulas

Explanation of formula variables


Meaning of the variables in the following formulas:

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

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:

260 33002543 05/2010


PD_OR_PI

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:

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

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

33002543 05/2010 261


PD_OR_PI

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:

262 33002543 05/2010


PDM
33002543 05/2010

PDM: Pulse duration modulation

28
Introduction
This chapter describes the PDM block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 264
Detailed description 268

33002543 05/2010 263


PDM

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 block's 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.

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.

EN and ENO can be configured as additional parameters.

264 33002543 05/2010


PDM

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:

33002543 05/2010 265


PDM

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:

Parameter Data type Description


X REAL Input variable
R BOOL Reset mode
PARA Para_PDM Parameter

Description of output parameters:

Parameter Data type Description


Y_POS BOOL Output for positive X values
Y_NEG BOOL Negative X value output

266 33002543 05/2010


PDM

Parameter description Para_PDM


Data structure description

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)

Runtime error
An error message is returned if
z |up_x| ≤|lo_x|
z t_max ≤t_min

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 267


PDM

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).

268 33002543 05/2010


PDM

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

The following holds for all three cases:

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

NOTE: From the parameters up_x (-pos/-neg) and lo_x (-pos/-neg) only the
(absolute) value is evaluated.

33002543 05/2010 269


PDM

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.

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 271" and the picture "Output dependency on X (Special case), page 271".

270 33002543 05/2010


PDM

Output dependency on X
In the following picture the dependency of the output on X is shown:

Output dependency on X (Special case)


In the following picture the special case t_min = 0, lo_x = 0 is shown:

33002543 05/2010 271


PDM

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
controller's 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:

272 33002543 05/2010


PI
33002543 05/2010

PI: PI controller

29
Introduction
This chapter describes the PI block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 274
Formulas 278
Parametering 279
Operating modes 281
Example of a PI controller 282

33002543 05/2010 273


PI

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z Operating modes Manual, Halt, Automatic
z bumpless changeover between manual and automatic
z Manipulated variable limiting
z Anti-windup reset (only for an active I component)

274 33002543 05/2010


PI

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)

33002543 05/2010 275


PI

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:

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

Description of input / output parameters:

Parameter Data type Description


Y REAL Manipulated variable

Description of output parameters:

Parameter Data type Description


ERR REAL System deviation
STATUS Stat_MAXMIN Y output status

Parameter description Mode_MH


Data structure description

Element Data type Description


man BOOL "1": Manual mode
halt BOOL "1": Halt mode

276 33002543 05/2010


PI

Parameter description Para_PI


Data structure description

Element Data type Description


gain REAL Proportional action coefficient (gain)
ti TIME Integral time
ymax REAL Upper limit
ymin REAL Lower limit

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit

Runtime error
An error message is returned if
z an invalid floating point number lies at input YMAN or X,
z ymax < ymin.

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 277


PI

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

278 33002543 05/2010


PI

Parametering

Structure diagram
The following is the structure diagram of the PI controller:

Parametering
The PI control structure is displayed in theStructure diagram, page 279. 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.
z qmax = 1 if Y ≥ ymax
z qmin = 1 if Y ≤ymin

Manipulated variable limiting


After summation of the components manipulated variable limiting takes place, so
that: ymin ≤Y ≤ymax

33002543 05/2010 279


PI

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

280 33002543 05/2010


PI

Operating modes

Selecting the operating modes


There are three operating mode selectable through the man and halt parameter
inputs.

Operating mode man halt


Automatic 0 0
Manual mode 1 1 or 0
Halt 0 1

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 293).

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
controller's internal components are given the chance to continuously react to the
external influence.

33002543 05/2010 281


PI

Example of a PI controller

Example
The jump response of the PI controller is shown in the following Diagram
(see page 282) 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

282 33002543 05/2010


PID
33002543 05/2010

PID: PID controller

30
Introduction
This chapter describes the PID block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 284
PID function block structure diagram 289
Setting parameters for the PID controller 290
Operating modes 292
Detailed formulas 295

33002543 05/2010 283


PID

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.
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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z real PID controller with independent gain, ti, td setting
z Operating modes Manual, Halt, Automatic
z bumpless changeover between manual and automatic
z Manipulated variable limiting in automatic mode
z Separately enabled P, I and D component
z Anti-Windup-Reset
z Anti-windup measures taken only for an active I component
z definable delay of the D component
z D component connectable to controlled variable PV or system deviation ERR

284 33002543 05/2010


PID

Transfer function
The transfer function is:

Explanation of the variables:

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)

Representation in FBD
Representation:

33002543 05/2010 285


PID

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) ;

286 33002543 05/2010


PID

PID parameter description


Description of input parameters:

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

Description of input / output parameters:

Parameter Data type Description


Y REAL Manipulated variable

Description of output parameters:

Parameter Data type Description


ERR REAL System deviation
STATUS Stat_MAXMIN Y output status

Parameter description Mode_PID


Data structure description

Element Data type Description


man BOOL "1": Manual mode
halt BOOL "1": Halt mode
en_p BOOL "1": P component on
en_i 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

33002543 05/2010 287


PID

Parameter description Para_PID


Data structure description

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

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit

Error message
An error message is returned if
z an invalid floating point number lies at input YMAN or PV
z ymax < ymin

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

288 33002543 05/2010


PID

PID function block structure diagram

Structure diagram
The following is the structure diagram of the PID block:

33002543 05/2010 289


PID

Setting parameters for the PID controller

Parametering
The PID control structure is displayed in Structure diagram, page 289.
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.
z qmax = 1 if Y ≥ ymax
z 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:

290 33002543 05/2010


PID

Selecting the control types


There are four different control types, which are selected via the elements en_p,
en_i and en_d:

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

The I component can also be disabled with ti = 0.

33002543 05/2010 291


PID

Operating modes

Selecting the operating modes


There are three operating mode selectable through the man and halt elements:

Operating mode man halt


Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1

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.

292 33002543 05/2010


PID

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:
z Switching with the help of the MOVE function
z Switching with the help of the function block increase limit VLIM

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.

33002543 05/2010 293


PID

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.

294 33002543 05/2010


PID

Detailed formulas

Explanation of formula variables


Meaning of the variables in the following formulas:

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

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:
z P component YP for manual, Halt and automatic mode
z I component YI for automatic mode
z I component YI for manual and halt modes
z D component YD for automatic mode
z D component YD for manual and halt modes

33002543 05/2010 295


PID

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:

296 33002543 05/2010


PID

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 05/2010 297


PID

298 33002543 05/2010


PID_P
33002543 05/2010

PID_P: PID controller with parallel


structure
31
Introduction
This chapter describes the PID_P block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 300
Setting parameters for the PID_P controller 305
Operating modes 307
Detailed formulas 308

33002543 05/2010 299


PID_P

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.
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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z PID controller in pure parallel structure
z Independent gains for P-. I and D component
z Each component P, I and D can be individually enabled
z Limiting control limits in automatic mode
z Anti-windup measure with an active I component only
z Anti-windup reset
z Operating modes Manual, Halt, Automatic
z bumpless changeover between manual and automatic
z D component connectable to input variable PV or system deviation ERR
z D component with variable delay

300 33002543 05/2010


PID_P

Transfer function
The transfer function is:

Explanation of the variables:

Variable Description
YD D component
YI I component
YP P component

Representation in FBD
Representation:

33002543 05/2010 301


PID_P

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) ;

302 33002543 05/2010


PID_P

Parameter description PID_P


Description of input parameters:

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

Description of input / output parameters:

Parameter Data type Description


Y REAL Manipulated variable

Description of output parameters:

Parameter Data type Description


ERR REAL System deviation
STATUS Stat_MAXMIN Y output status

Parameter description Mode_PID_P


Data structure description

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

33002543 05/2010 303


PID_P

Parameter description Para_PID_P


Data structure description

Element Data type Description


kp REAL Proportional action coefficient (gain = P component)
ki 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

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit

Runtime error
An error message is returned if
z an invalid floating point number lies at input YMAN or X
z ymax < ymin.

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

304 33002543 05/2010


PID_P

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 305.
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.

33002543 05/2010 305


PID_P

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.
z qmax = 1 if Y ≥ ymax
z 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

306 33002543 05/2010


PID_P

Operating modes

Selecting the operating modes


There are three operating mode selectable through the man and halt elements:

Operating mode man halt


Automatic 0 0
Manual mode 1 0 or 1
Halt 0 1

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 293).

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.

33002543 05/2010 307


PID_P

Detailed formulas

Explanation of formula variables


Meaning of the variables in the formulas:

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

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

308 33002543 05/2010


PID_P

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:
z P component YP for manual, halt and automatic modes
z I component YI for automatic mode
z I component YI for manual and halt modes
z D component YD for automatic mode
z 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:

33002543 05/2010 309


PID_P

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:

310 33002543 05/2010


PIP
33002543 05/2010

PIP: PIP cascade controller

32
Introduction
This chapter describes the PIP block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 312
PIP function block structure diagram 317
Setting parameters for the PIP cascade controller 318
Operating modes 320
Detailed formulas 322

33002543 05/2010 311


PIP

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z PI as master controller and P as sub controller
z Manipulated variable limiting
z Anti-windup reset (PI controller)
z Operating modes, fixed setpoint control, manual, halt, automatic

312 33002543 05/2010


PIP

Transfer function
The transmission function for the controller says:

Controller Transfer function


Master controller (PI-controller)

Sub controller (P controller)

Proportional action coefficient


The proportional action coefficient of the master controller is determined as follows:

Representation in FBD
Representation:

33002543 05/2010 313


PIP

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)

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) ;

314 33002543 05/2010


PIP

PIP parameter description


Description of input 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

Description of input / output parameters:

Parameter Data type Description


Y REAL Manipulated variable

Description of output parameters:

Parameter Data type Description


ERR REAL System deviation
SP2 REAL Sub controller setpoint value
STATUS Stat_MAXMIN Y output status

Parameter description Mode_PIP


Data structure description

Element Data type Description


man BOOL "1": Manual mode
halt BOOL "1": Halt mode
fix BOOL "1": Fixed setpoint control

33002543 05/2010 315


PIP

Parameter description Para_PIP


Data structure description

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

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit

Runtime error
An error message is returned if
z an invalid floating point number lies at input PV, PV2, YMAN or SP_FIX
z ymax < ymin.

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

316 33002543 05/2010


PIP

PIP function block structure diagram

Structure diagram
The following is the structure diagram of the PIP block:

33002543 05/2010 317


PIP

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 318.
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

318 33002543 05/2010


PIP

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:
z on reaching the upper limit:

z on reaching the lower limit:

33002543 05/2010 319


PIP

Operating modes

Selecting the operating modes


There are four operating mode, which are selected via the elements man, halt and
fix:

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

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 293).

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 it’s current position. The
control output is, however, limited by ymax and ymin.

320 33002543 05/2010


PIP

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.

33002543 05/2010 321


PIP

Detailed formulas

Explanation of formula variables


Meaning of the variables in the following formulas:

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

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:
z YI, Y, SP2 in the automatic mode
z YI, Y, SP2 in the manual mode
z YI, Y, SP2 in the manual mode
z 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.

322 33002543 05/2010


PIP

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:

33002543 05/2010 323


PIP

324 33002543 05/2010


PPI
33002543 05/2010

PPI: PPI cascade controller

33
Introduction
This chapter describes the PPI block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 326
PPI function block structure diagram 331
Setting parameters for the PPI cascade controller 332
Operating modes 334
Detailed formulas 335

33002543 05/2010 325


PPI

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z P as master controller and PI as sub controller
z Manipulated variable limiting
z Anti-windup reset (PI controller)
z Operating modes, fixed setpoint control, manual, halt, automatic

326 33002543 05/2010


PPI

Transfer function
The transmission function for the controller says:

Controller Transfer function


Master controller (P-controller)

Sub controller (PI controller)

Proportional action coefficient


The proportional action coefficient is determined as follows:

Representation in FBD
Representation:

33002543 05/2010 327


PPI

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)

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) ;

328 33002543 05/2010


PPI

PPI parameter description


Description of input 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

Description of input / output parameters:

Parameter Data type Description


Y REAL Manipulated variable

Description of output parameters:

Parameter Data type Description


ERR REAL System deviation
SP2 REAL Sub controller setpoint value
STATUS Stat_MAXMIN Y output status

Parameter description Mode_PPI


Data structure description

Element Data type Description


man BOOL "1": Manual mode
halt BOOL "1": Halt mode
fix BOOL "1": Fixed setpoint control

33002543 05/2010 329


PPI

Parameter description Para_PPI


Data structure description

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

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit

Runtime error
An error message is returned if
z an invalid floating point number lies at input PV, PV2, YMAN or SP_FIX
z ymax < ymin.

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

330 33002543 05/2010


PPI

PPI function block structure diagram

Structure diagram
The following is the structure diagram of the PPI block:

33002543 05/2010 331


PPI

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 332.
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.
z qmax = 1, if Y ≥ ymax
z qmin = 1, if Y ≤ymin

Manipulated variable limiting


After summation of the components manipulated variable limiting takes place, so
that: ymin ≤Y ≤ymax

332 33002543 05/2010


PPI

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

33002543 05/2010 333


PPI

Operating modes

Selecting the operating modes


There are four operating mode, which are selected via the elements man, halt and
fix:

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

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 293).

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 it’s 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.

334 33002543 05/2010


PPI

Detailed formulas

Explanation of formula variables


Meaning of the variables in the following formulas:

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

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:
z YI and Y in the automatic mode
z YI, Y, SP2 in the manual mode
z YI, Y, SP2 in the manual mode
z YI, YP, Y and SP2 in the fixed setpoint control mode

33002543 05/2010 335


PPI

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.

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:

336 33002543 05/2010


PPI

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 05/2010 337


PPI

338 33002543 05/2010


PWM
33002543 05/2010

PWM: Pulse width modulation

34
Introduction
This chapter describes the PWM block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 340
Detailed description 344
Example for the PWM block 347

33002543 05/2010 339


PWM

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 block's 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.

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.

EN and ENO can be configured as additional parameters.

340 33002543 05/2010


PWM

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:

Output Formula Condition


Y_POS

Y_NEG

Parametering rules
For correct operation the following rules should be observed:
z

z From the parameters up_pos and up_neg only the value is evaluated.

Representation in FBD
Representation:

33002543 05/2010 341


PWM

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:

Parameter Data type Description


X REAL Input variable
R BOOL Reset mode ("1" = Reset)
PARA Para_PWM Parameter

Description of output parameters:

Parameter Data type Description


Y_POS BOOL Output for positive X values
Y_NEG BOOL Negative X value output

342 33002543 05/2010


PWM

Parameter description Para_PWM


Data structure description

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

Runtime error
For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 343


PWM

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 341 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.

344 33002543 05/2010


PWM

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.

33002543 05/2010 345


PWM

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 controller’s 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:

346 33002543 05/2010


PWM

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
z Jump response 1
z Jump response 2

33002543 05/2010 347


PWM

Jump response 1
The following parameter specifications apply to the jump response 1 display:

Parameters Specification
t_period 4s
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

Jump response 1 timing diagram

X analog signal
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.

348 33002543 05/2010


PWM

Jump response 2
The following parameter specifications apply to the jump response 2 display:

Parameters Specification
t_period 4s
t_min 0.5 s
t_max 4s
t_pause 0s
t_brake 0s
up_pos 10
up_neg 10

Jump response 2 timing diagram

X analog signal
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.

33002543 05/2010 349


PWM

350 33002543 05/2010


QPWM
33002543 05/2010

QPWM: Pulse width modulation


(simple)
35
Introduction
This chapter describes the QPWM block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 352
Detailed description 356
Example for the QPWM block 358

33002543 05/2010 351


QPWM

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 block's 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.

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.

EN and ENO can be configured as additional parameters.

352 33002543 05/2010


QPWM

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".

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:

Output Formula Condition


Y_POS

Y_NEG

Parametering rules
For correct operation when setting parameters the following rules should be
observed:
t_min ≤t_period

Representation in FBD
Representation:

33002543 05/2010 353


QPWM

Representation in LD
Representation:

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:

Parameter Data type Description


X REAL Input variable
R BOOL Reset mode ("1" = Reset)
PARA Para_QPWM Parameter

Description of output parameters:

Parameter Data type Description


Y_POS BOOL Output for positive X values
Y_NEG BOOL Negative X value output

354 33002543 05/2010


QPWM

Parameter description Para_QPWM


Data structure description

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

Runtime error
For a list of all block error codes and values, see CLC_PRO, page 606.

33002543 05/2010 355


QPWM

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 353 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.

356 33002543 05/2010


QPWM

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 controller’s 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:

33002543 05/2010 357


QPWM

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:

Parameters Specification
t_period 4s
t_min 0.5 s
x_max 10

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.

358 33002543 05/2010


SCON3
33002543 05/2010

SCON3: Three step controller

36
Introduction
This chapter describes the SCON3 block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 360
Detailed description 363

33002543 05/2010 359


SCON3

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block SCON3 has the following properties:
z Reset and automatic operating modes
z One internal feedback path (delay 1st Order)

Representation in FBD
Representation:

360 33002543 05/2010


SCON3

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 parameter description


Description of input parameters:

Parameter Data type Description


SP REAL Setpoint input
PV REAL Actual value input
PARA Para_SCON3 Parameter
R BOOL "1" = Reset mode

33002543 05/2010 361


SCON3

Description of output parameters:

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 description Para_SCON3


Data structure description

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

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 606.

Warning
In the following cases, a warning is shown in the diagnostic viewer (Tools →
Diagnostic viewer):
z gain ≤0 : The controller operates without feedback response.
z ti = 0: The controller operates without feedback response.
z 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 606.

362 33002543 05/2010


SCON3

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

Meaning of variable K:

33002543 05/2010 363


SCON3

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 364". 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!

364 33002543 05/2010


SCON3

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 05/2010 365


SCON3

366 33002543 05/2010


VLIM
33002543 05/2010

VLIM: Velocity limiter 1st order

37
Introduction
This chapter describes the VLIM block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 368
Detailed description 371

33002543 05/2010 367


VLIM

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.

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.

EN and ENO can be configured as additional parameters.

Properties
The function block has the following properties:
z Operating modes Manual, Halt, Automatic
z Manipulated variable limiting

Representation in FBD
Representation:

368 33002543 05/2010


VLIM

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

Description of input / output parameters:

Parameter Data type Description


Y REAL Output

33002543 05/2010 369


VLIM

Description of output parameters:

Parameter Data type Description


STATUS Stat_MAXMIN Y output status

Parameter description Mode_VLIM


Data structure description

Element Data type Description


man BOOL "1": Manual mode
halt BOOL "1": Halt mode

Parameter description Para_VLIM


Data structure description

Element Data type Description


rate REAL Maximum velocity (maximum x’ / sec)
ymax REAL Upper limit
ymin REAL Lower limit

Parameter description Stat_MAXMIN


Data structure description

Element Data type Description


qmax BOOL "1" = Y has reached the upper control limit
qmin BOOL "1" = Y has reached the lower control limit

Runtime error
An error message is returned if
z an invalid floating point number lies at input YMAN or X,
z ymax < ymin.

NOTE: For a list of all block error codes and values, see CLC_PRO, page 606.

370 33002543 05/2010


VLIM

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.
z qmax = 1 if Y ≥ ymax
z 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.

33002543 05/2010 371


VLIM

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.

372 33002543 05/2010


Extension/Compatibility
33002543 05/2010

Extension/Compatibility

IV
Overview
This part describes the elementary functions and elementary function blocks in the
family Extension/Compatibility.

What's in this Part?


This part contains the following chapters:
Chapter Chapter Name Page
38 ADD_***_PL7 : Add a period 377
39 AKF_FL: Detection of any edge 381
40 AKF_TA: Switch off delay 383
41 AKF_TE: Switch-on delay 387
42 AKF_TI: Pulse 391
43 AKF_TS: Storing switch on delay 395
44 AKF_TV: Extended pulse 399
45 AKF_ZR: Decremental counter 403
46 AKF_ZV: Incremental counter 407
47 AKF_ZVR: Incremental/decremental counter 411
48 COMPARE: Comparing two integers 415
49 DATE_DINT_TO_STRING: Conversion of a date (DATE PL7) 417
into a character string
50 DAY_OF_WEEK : Day of the week 419
51 DELTA_***: Difference between two dates 421
52 DT_ARINT_TO_STRING: Converting a PL7 date into a 423
character string
53 END: Unconditional end of program 427
54 FIFO: First In/First Out stack register 429
55 FPULSOR: Generation of rectangular signals 433
56 FSTEP_PL7_DRUM : Forcing a drum to a step 437

33002543 05/2010 373


Extension/Compatibility

Chapter Chapter Name Page


57 FTOF: Deactivation timer 439
58 FTON: Activation timer 443
59 FTP: Pulse timer 447
60 GET_3X: Read %IW Words (3x-Register) 451
61 GET_4X: Read %MW Words (4x-Register) 453
62 GET_BIT: Reading bit 455
63 HIGH_INT: Extracting the most significant word of a double 457
integer
64 IEC_BMDI: Block move 459
65 LIFO: Last In/First Out stack register 467
66 LOW_INT: Extracting the least significant word of a double 471
integer
67 MUX_DINTARR_125: Multiplexer for arrays of the data type 473
DIntArr125
68 PL7_COUNTER : Counter/downcounter 475
69 PL7_DRUM : Drum 481
70 PL7_MONOSTABLE : Monostable 487
71 PL7_REGISTER_32 : 32 word memory register 493
72 PL7_REGISTER_255 : 255 word memory register 497
73 PL7 and Unity Timers Comparison 501
74 PL7_TOF : TOF type timer 503
75 PL7_TON : TON type timer 509
76 PL7_TP : TP type timer 515
77 PL7_3_TIMER : Conversion timer for % Ti’s of PL7 521
78 PUT_4X: Write 4x register 527
79 R_INT_WORD: Type conversion (REAL -> INT -> WORD) 529
(R_INT_WORD: Type conversion (REAL -> INT -> WORD))
80 R_UINT_WORD: Type conversion (REAL -> UINT -> WORD) 531
(R_UINT_WORD: Type conversion (REAL -> UINT ->
WORD))
81 R2T_***: Register to table 533
82 READ_PCMCIA: Reading data in the memory card 537
83 ROR1_ARB: Right shift of one byte from a table of bytes 543
84 RRTC: Reading the system date 545
85 SCOUNT: Up/down counting with overshoot signaling 547
86 SET_BIT: Set bit 553

374 33002543 05/2010


Extension/Compatibility

Chapter Chapter Name Page


87 SET_PCMCIA: Initialization of the archiving zone 555
88 SHL_RBIT_***: Left shift on an integer or double integer 557
89 SHR_RBIT_***: Right shift on an integer or double integer 559
90 SHRZ_***: Right shift on an integer or double integer 561
91 SHRZ_RBIT_***: Right shift on an integer or double integer 563
92 SRCH: Search 565
93 STR_ROUND: Approximate value of a floating point number 571
94 SUB_***_PL7 : Subtract a period 573
95 SYSSTATE: System state 577
96 T2T: Table to table 579
97 TIME_DINT_TO_STRING: Conversion of a variable to DINT 585
format
98 TOD_DINT_TO_STRING: Conversion of a variable to TOD 587
format
99 TRANS_TIME: Conversion of a duration into DINT format 589
100 W_INT_REAL: Type conversion (WORD -> INT -> REAL) 591
(W_INT_REAL: Type conversion (WORD -> INT -> REAL))
101 W_UINT_REAL: Type conversion (WORD -> UINT -> REAL) 593
(W_UINT_REAL: Type conversion (WORD -> UINT -> REAL))
102 WRITE_PCMCIA: Writing data to the memory card 595
103 WRTC: Updating the system date 599

33002543 05/2010 375


Extension/Compatibility

376 33002543 05/2010


SUB_***_PL7
33002543 05/2010

ADD_***_PL7 : Add a period

38
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:
z ADD_DT_PL7,
z ADD_TOD_PL7.

Representation in FBD
Representation applied to a time of day:

Representation in LD
Representation applied to a time of day:

33002543 05/2010 377


SUB_***_PL7

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:

Parameter Type Comment


Source_Value DINT, Date or time.
ARRAY [0..3] Table of 4 integers.
OF INT
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.

The following table describes the output parameters:

Parameter Type Comment


Result_Value DINT, Result_Value is of the same type as
ARRAY [0..3] Source_Value.
OF INT Table of 4 integers.

NOTE: management of leap years must be provided for in the application.

378 33002543 05/2010


SUB_***_PL7

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 615) 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 615) 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 615) is set at 1 and
Result_Value is:
z 00:00:00 for the TOD type.
z 00001-01-01-00:00:00 for the DT type.

33002543 05/2010 379


SUB_***_PL7

380 33002543 05/2010


AKF_FL
33002543 05/2010

AKF_FL: Detection of any edge

39
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)

33002543 05/2010 381


AKF_FL

Representation in ST
Representation:
AKF_FL_Instance (CLK:=ClockInput, Q=>DisplaysAnyEdge) ;

Parameter description
Description of the input parameters:

Parameters Data type Meaning


CLK BOOL Timing input

Description of the output parameters:

Parameters Data type Meaning


Q BOOL Display of any edge

382 33002543 05/2010


AKF_TA
33002543 05/2010

AKF_TA: Switch off delay

40
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:

33002543 05/2010 383


AKF_TA

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) ;

Parameter description
Description of input parameters:

Parameter Data type Description


IN BOOL Start delay
ZB TIME Time basis of delay time
SW INT Delay time factor
R BOOL Reset input

384 33002543 05/2010


AKF_TA

Description of output parameters:

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

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 609.

33002543 05/2010 385


AKF_TA

386 33002543 05/2010


AKF_TE
33002543 05/2010

AKF_TE: Switch-on delay

41
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:

33002543 05/2010 387


AKF_TE

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) ;

Parameter description
Description of input parameters:

Parameter Data type Description


IN BOOL Start delay
ZB TIME Time basis of delay time
SW INT Delay time factor
R BOOL Reset input

388 33002543 05/2010


AKF_TE

Description of output parameters:

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

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 609.

33002543 05/2010 389


AKF_TE

390 33002543 05/2010


AKF_TI
33002543 05/2010

AKF_TI: Pulse

42
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:

33002543 05/2010 391


AKF_TI

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) ;

Parameter description
Description of input parameters:

Parameter Data type Description


IN BOOL Start pulse
ZB TIME Time basis of the pulse
SW INT Pulse factor
R BOOL Reset input

392 33002543 05/2010


AKF_TI

Description of output parameters:

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

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 609.

33002543 05/2010 393


AKF_TI

394 33002543 05/2010


AKF_TS
33002543 05/2010

AKF_TS: Storing switch on delay

43
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:

33002543 05/2010 395


AKF_TS

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) ;

Parameter description
Description of input parameters:

Parameter Data type Description


IN BOOL Start delay
ZB TIME Time basis of delay time
SW INT Delay time factor
R BOOL Reset input

396 33002543 05/2010


AKF_TS

Description of output parameters:

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

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 609.

33002543 05/2010 397


AKF_TS

398 33002543 05/2010


AKF_TV
33002543 05/2010

AKF_TV: Extended pulse

44
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:

33002543 05/2010 399


AKF_TV

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) ;

Parameter description
Description of input parameters:

Parameter Data type Description


IN BOOL Start pulse
ZB TIME Time basis of the pulse
SW INT Pulse factor
R BOOL Reset input

400 33002543 05/2010


AKF_TV

Description of output parameters:

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

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 609.

33002543 05/2010 401


AKF_TV

402 33002543 05/2010


AKF_ZR
33002543 05/2010

AKF_ZR: Decremental counter

45
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.

33002543 05/2010 403


AKF_ZR

Formula
Q = 1, if 0 < ZIWO < ZSWO

Representation in FBD
Representation:

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)

404 33002543 05/2010


AKF_ZR

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) ;

Parameter description
Description of input 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

Description of output parameters:

Parameter Data type Description


Q BOOL Output
ZIWO INT Count value (display of actual value)
ZSWO INT Display of setpoint value

33002543 05/2010 405


AKF_ZR

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".

406 33002543 05/2010


AKF_ZV
33002543 05/2010

AKF_ZV: Incremental counter

46
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.

33002543 05/2010 407


AKF_ZV

Formula
Q = 1, if 0 < ZIWO < ZSWO

Representation in FBD
Representation:

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)

408 33002543 05/2010


AKF_ZV

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) ;

Parameter description
Description of input 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

Description of output parameters:

Parameter Data type Description


Q BOOL Output
ZIWO INT Count value (display of actual value)
ZSWO INT Display of setpoint value

33002543 05/2010 409


AKF_ZV

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".

410 33002543 05/2010


AKF_ZVR
33002543 05/2010

AKF_ZVR:
Incremental/decremental counter
47
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.

33002543 05/2010 411


AKF_ZVR

Formula
Q = 1, if ZIWO ≥ ZSWO

Representation in FBD
Representation:

Representation in LD
Representation:

412 33002543 05/2010


AKF_ZVR

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:

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

Description of the output parameters:

Parameters Data type Meaning


Q BOOL Output
ZIWO INT Count value (display of actual value)
ZSWO INT Display of setpoint value

33002543 05/2010 413


AKF_ZVR

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".

414 33002543 05/2010


COMPARE
33002543 05/2010

COMPARE: Comparing two


integers
48
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:

33002543 05/2010 415


COMPARE

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:

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.

The following table describes the output parameters:

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

416 33002543 05/2010


DATE_DINT_TO_STRING
33002543 05/2010

DATE_DINT_TO_STRING:
Conversion of a date (DATE PL7)
into a character string 49
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:

33002543 05/2010 417


DATE_DINT_TO_STRING

Representation in IL
Representation:
LD Date1
DATE_DINT_TO_STRING
ST Result_Str

Representation in ST
Representation:
Result_Str:= DATE_DINT_TO_STRING(Date1);

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Date1 DINT PL7 date to convert into character string format.

The following table describes the output parameters:

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’

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 615) is set to 1.
If Date1 cannot be interpreted and is not consistent in DATE format, the system bit
%S18 (see page 615) is set to 1 and Result_Str =’YYYY-MM-DD’.

418 33002543 05/2010


DAY_OF_WEEK
33002543 05/2010

DAY_OF_WEEK : Day of the week

50
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:
z 1 for Monday,
z 2 for Tuesday,
z 3 for Wednesday,
z 4 for Thursday,
z 5 for Friday,
z 6 for Saturday,
z 7 for Sunday.
The additional parameters EN and ENO can be configured.

Representation in FBD
Representation:

Representation in LD
Representation:

33002543 05/2010 419


DAY_OF_WEEK

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:

Parameter Type Comment


Out_Day_Of_Week INT Whole number from 1 to 7 indicating the day of the
week:
z 1 for Monday,
z 2 for Tuesday,
z 3 for Wednesday,
z 4 for Thursday,
z 5 for Friday,
z 6 for Saturday,
z 7 for Sunday.

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 615) is set to 1.

420 33002543 05/2010


DELTA_***
33002543 05/2010

DELTA_***: Difference between


two dates
51
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:
z DELTA_D,
z DELTA_DT,
z DELTA_TOD.

Representation in FBD
Representation applied to a time of day:

Representation in LD
Representation applied to a time of day:

33002543 05/2010 421


DELTA_***

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:

Parameter Type Comment


Input_IN1 DINT, Date or time for which we wish to calculate the
ARRAY [0...3] OF INT variation from Input_IN2.
Input_IN2 DINT, Date or time for which we wish to calculate the
ARRAY [0...3] OF INT variation from Input_IN1

NOTE: Input_IN1 and Input_IN2 must be of the same type.


The following table describes the output parameters:

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.

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 615) 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 615) is set to
1.

422 33002543 05/2010


DT_ARINT_TO_STRING
33002543 05/2010

DT_ARINT_TO_STRING:
Converting a PL7 date into a
character string 52
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

33002543 05/2010 423


DT_ARINT_TO_STRING

Representation in ST
Representation:
Result_Str:= DT_ARINT_TO_STRING(Date1);

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Date1 ARRAY PL7 date (table of 4 words) to convert into character string
[0..3] of INT format.

The following table describes the output parameters:

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’

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 615) is set to 1.
If Date1 cannot be interpreted and is not consistent, the system bit %S18
(see page 615) is set to 1 and Result_Str =’YYYY-MM-DD-HH:MM:SS’.

424 33002543 05/2010


DT_ARINT_TO_STRING

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.

33002543 05/2010 425


DT_ARINT_TO_STRING

426 33002543 05/2010


END
33002543 05/2010

END: Unconditional end of


program
53
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:

33002543 05/2010 427


END

Representation in IL
Representation:
CAL END

Representation in ST
Representation:
END ();

428 33002543 05/2010


FIFO
33002543 05/2010

FIFO: First In/First Out stack


register
54
Introduction
This chapter describes the FIFO block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 430
Detailed description 432

33002543 05/2010 429


FIFO

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:

Representation in IL
Representation:
CAL FIFO_Instance (R:=ClearedStackRegister, SET:=WriteValue,
GET:=ReadValue, X:=StackRegisterInput,
N_MAX:=MaxNumberInStack, FULL=>StackRegisterFull,
EMPTY=>StackRegisterEmpty, Y=>StackRegisterOutput)

430 33002543 05/2010


FIFO

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 Stack register input
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
N_MAX UINT Maximum number of elements in the stack register

Description of output parameters:

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 Stack register output
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT

Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 609.

33002543 05/2010 431


FIFO

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:

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

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.

432 33002543 05/2010


FPULSOR
33002543 05/2010

FPULSOR: Generation of
rectangular signals
55
Subject of this Chapter
This Chapter describes the function FPulsor.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 434
Detailed description of the operation of the FPULSOR function 436

33002543 05/2010 433


FPULSOR

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

434 33002543 05/2010


FPULSOR

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:

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.

The following table describes the input/output parameters:

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.

The following table describes the output parameters:

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).

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).

33002543 05/2010 435


FPULSOR

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 The generation of the rectangular signal is launched: (if the
Enable input 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 The output bit OUT_Pulsor remains at 0.
Fall_Back_Time
time out has not run
out
3 Fall_Back_Time The output bit OUT_Pulsor changes to 1 until the end of
has elapsed, Rise_Time and the generator loops on steps 2 and 3.
Rise_Time is
activated
4 Enable switches to 0 Rise_Time and Fall_Back_Time are reset to 0, and the
output OUT_Pulsor switches to 0.

436 33002543 05/2010


FSTEP_PL7_DRUM
33002543 05/2010

FSTEP_PL7_DRUM : Forcing a
drum to a step
56
Description

Description of the function


The FSTEP_PL7_DRUM function positions the drum (see page 481) 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

33002543 05/2010 437


FSTEP_PL7_DRUM

Representation in ST
Representation:
FSTEP_PL7_DRUM (Step_value, Drum_instance);

Description of parameters
The following table describes the input parameters:

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.

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 615) bit is set at 1.

438 33002543 05/2010


FTOF
33002543 05/2010

FTOF: Deactivation timer

57
Subject of this Chapter
This Chapter describes the function FTOF.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 440
Detailed description of the operation of the FTOF function 442

33002543 05/2010 439


FTOF

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);

440 33002543 05/2010


FTOF

Description of the parameters


The following table describes the input 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.

The following table describes the input/output parameters:

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.

The following table describes the output parameters:

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.

33002543 05/2010 441


FTOF

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 The current value takes the value 0 (even if the timer is
Enable input running), and the OUT_Ftof output bit switches to 1 (or
stays at 1).
2 During the rising edge The timer is launched, and the current value increases from
of the Enable input 0 to the Presel_Value (in hundredths of seconds).
3 When the current The OUT_Pulsor output bit returns to 0.
value has reached the
Presel_Value

442 33002543 05/2010


FTON
33002543 05/2010

FTON: Activation timer

58
Subject of this Chapter
This Chapter describes the function FTON.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 444
Detailed description of the operation of the FTON function 446

33002543 05/2010 443


FTON

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);

444 33002543 05/2010


FTON

Description of the parameters


The following table describes the input 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.

The following table describes the input/output parameters:

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.

The following table describes the output parameters:

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.

33002543 05/2010 445


FTON

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 The timer is launched and its current value
Enable input Current_Value increases by 0 towards
Presel_Value (in hundredths of seconds).
2 The current value has The output bit OUT_Fton switches to 1, then remains at 1
reached as long as the Enable input is at 1.
Presel_Value
3 The Enableinput is at 0 The timer is stopped even if in run mode, and the
Current_Value becomes 0.

446 33002543 05/2010


FTP
33002543 05/2010

FTP: Pulse timer

59
Subject of this Chapter
This Chapter describes the function FTP.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 448
Detailed description of the operation of the FTP function 450

33002543 05/2010 447


FTP

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);

448 33002543 05/2010


FTP

Description of the parameters


The following table describes the input 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.

The following table describes the input/output parameters:

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.

The following table describes the output parameters:

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.

33002543 05/2010 449


FTP

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 The timer is launched (if it is not already running) and the
input 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 The OUT_FTP output bit returns to 0.
value has reached the
Presel_Value
3 The Enable input Presel_Value takes the value 0.
and the OUT_FTP
output are at 0

450 33002543 05/2010


GET_3X
33002543 05/2010

GET_3X: Read %IW Words (3x-


Register)
60
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:

33002543 05/2010 451


GET_3X

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:

Parameter Data type Description


Offset UINT Offset in the %IW (3x) register memory.

Description of output parameters:

Parameter Data type Description


Output ANY Output

Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 609.

452 33002543 05/2010


GET_4X
33002543 05/2010

GET_4X: Read %MW Words (4x-


Register)
61
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:

33002543 05/2010 453


GET_4X

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:

Parameter Data type Description


Offset UINT Offset in the %MW register memory (4x).

Description of output parameters:

Parameter Data type Description


Output ANY Output

Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 609.

454 33002543 05/2010


GET_BIT
33002543 05/2010

GET_BIT: Reading bit

62
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:

33002543 05/2010 455


GET_BIT

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:

Parameter Data type Description


InputRegister WORD Input word
BitNumber UINT Bit number to be read.

Description of output parameters:

Parameter Data type Description


CurrentState BOOL Current state of selected bit.

Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 609.

456 33002543 05/2010


HIGH_INT
33002543 05/2010

HIGH_INT: Extracting the most


significant word of a double
integer 63
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

33002543 05/2010 457


HIGH_INT

Representation in ST
Representation:
High_Int := HIGH_INT(Double_Int);

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Double_Int DINT Double integer whose most significant word is
extracted.

The following table describes the output parameters:

Parameter Type Comment


High_Int INT The most significant word extracted from the double
integer Double_Int.

458 33002543 05/2010


IEC_BMDI
33002543 05/2010

IEC_BMDI: Block move

64
Introduction
This chapter describes the IEC_BMDI block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 460
Detailed description 464

33002543 05/2010 459


IEC_BMDI

Description

Function description
This procedure copies the number of elements listed in NumberOfElements
wordwise, from position OffsetInSourceTable in the source table
(SourceTable) to position OffsetInDestinationTable in the destination table
(DestinationTable).

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.

EN and ENO can be configured as additional parameters.

460 33002543 05/2010


IEC_BMDI

Representation in FBD
Representation:

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);

33002543 05/2010 461


IEC_BMDI

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
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
OffsetInDestina- UINT Offset in selected source table. Because the
tionTable 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.

462 33002543 05/2010


IEC_BMDI

Runtime error
The following standard user error messages are used:

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.

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 609.

33002543 05/2010 463


IEC_BMDI

Detailed description

Function description

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 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:
z %MX or %IX to %MX
The source and target lengths are identical during copying of %MX or %IX to
%MX
z %IW or %MW to %MW
The source and target lengths are identical during copying of %IW or %MW to
%MW
z %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.
z %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.

464 33002543 05/2010


IEC_BMDI

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.

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.

33002543 05/2010 465


IEC_BMDI

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.

466 33002543 05/2010


LIFO
33002543 05/2010

LIFO: Last In/First Out stack


register
65
Introduction
This chapter describes the LIFO block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 468
Detailed description 470

33002543 05/2010 467


LIFO

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:

Representation in IL
Representation:
CAL LIFO_Instance (R:=ClearedStackRegister, SET:=WriteValue,
GET:=ReadValue, X:=StackRegisterInput,
N_MAX:=MaxNumberInStack, FULL=>StackRegisterFull,
EMPTY=>StackRegisterEmpty, Y=>StackRegisterOutput)

468 33002543 05/2010


LIFO

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 Stack register input
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
N_MAX UINT Maximum number of elements in the stack register

Description of output parameters:

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 Stack register output
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT

Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 609.

33002543 05/2010 469


LIFO

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:

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

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.

470 33002543 05/2010


LOW_INT
33002543 05/2010

LOW_INT: Extracting the least


significant word of a double
integer 66
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

33002543 05/2010 471


LOW_INT

Representation in ST
Representation:
Low_Int := LOW_INT(Double_Int);

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Double_Int DINT Double integer whose least significant word is
extracted.

The following table describes the output parameters:

Parameter Type Comment


Low_Int INT The least significant word extracted from the double
integer Double_Int.

472 33002543 05/2010


MUX_DINTARR_125
33002543 05/2010

MUX_DINTARR_125: Multiplexer
for arrays of the data type
DIntArr125 67
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:

33002543 05/2010 473


MUX_DINTARR_125

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:

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)

Description of output parameters:

Parameter Data type Description


SelectedElement DINT selected element

Parameter description DIntArr125


Description of the DIntArr125 data type:

Element Data type Description


varname[1] DINT 1. Element of the array
... ... ...
varname[125] DINT 125. Element of the array

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 609.

474 33002543 05/2010


PL7_COUNTER
33002543 05/2010

PL7_COUNTER :
Counter/downcounter
68
Object of this chapter
This chapter describes the PL7_COUNTERfunction.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 476
Mode of operation of the PL7_COUNTER function 479

33002543 05/2010 475


PL7_COUNTER

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:

LD representation
Representation:

476 33002543 05/2010


PL7_COUNTER

IL representation
Representation:
CAL Counter_1(R := Raz, P := Preselect, CU := Count_Up, CD :=
Count_Down, E => Empty, D => Done, F => Full)

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 ;

33002543 05/2010 477


PL7_COUNTER

Description of parameters
The following table describes the input parameters:

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.

The following table describes the output parameters:

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.

Description of variables
The following table describes the public variables:

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.

478 33002543 05/2010


PL7_COUNTER

Mode of operation of the PL7_COUNTER function

Description
The following table describes the specific modes of operation of the PL7_COUNTER
function:

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 (%S1=1) has no effect on the current value of the counter.
change to stop,
deactivation of a task
or execution of a
breakpoint
of modifying the A modification to the preset value by instruction or adjustment is
preset taken into account during management of the block by the
application.

NOTE: it is recommended to test the output bits only once in the program.

33002543 05/2010 479


PL7_COUNTER

480 33002543 05/2010


PL7_DRUM
33002543 05/2010

PL7_DRUM : Drum

69
Object of this chapter
This chapter describes the PL7_DRUMfunction.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 482
Mode of operation of the PL7_DRUM timer function 486

33002543 05/2010 481


PL7_DRUM

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 %DRi’s 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:

IL representation
Representation:
CAL PL7_Drum_1(R := Raz, U := Up, F => Full, W => %MW0)

482 33002543 05/2010


PL7_DRUM

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:

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.

The following table describes the output parameters:

Parameter Type Comment


F BOOL Output indicating that the final step defined is in
progress.
W INT Current step output value.

33002543 05/2010 483


PL7_DRUM

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:
z TB = 8: 1 mn (default value),
z TB = 4: 1 s,
z TB = 2: 100 ms,
z 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 INT PL7_Drum_1.Wj is a word representing the state of
(j=LEN-1) 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.

484 33002543 05/2010


PL7_DRUM

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.

33002543 05/2010 485


PL7_DRUM

Mode of operation of the PL7_DRUM timer function

Description
The following table describes the specific modes of operation of the PL7_DRUM
function:

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, The fact of not scanning the drum does not cause a reset to 0 of the
deactivation of a task order bits.
or execution of a
breakpoint

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:
z In LD and FBD, the history of the input PL7_Drum_1.U is updated with the
cabled values.
z In IL, the history of the input PL7_Drum_1.U is not updated; it retains the value
it had before the call.
z In ST, the history of the input PL7_Drum_1.U is updated with 0.

486 33002543 05/2010


PL7_MONOSTABLE
33002543 05/2010

PL7_MONOSTABLE : Monostable

70
Object of this chapter
This chapter describes the PL7_MONOSTABLEfunction.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 488
Detailed description of the operation of the PL7_MONOSTABLE function 491
Mode of operation of the PL7_MONOSTABLE monostable function 492

33002543 05/2010 487


PL7_MONOSTABLE

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:

488 33002543 05/2010


PL7_MONOSTABLE

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:

Parameter Type Comment


S BOOL "Start" input, on rising edge, starts the monostable.

The following table describes the output parameters:

Parameter Type Comment


R BOOL "Run" output:
z Mn_1.R = 0 if Mn_1.ET = Mn_1.PT or Mn_1.ET = 0.
z Mn_1.R = 1 otherwise.

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.

33002543 05/2010 489


PL7_MONOSTABLE

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:
z TB = 8: 1 mn (default value),
z TB = 4: 1 s,
z TB = 2: 100 ms,
z 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.

490 33002543 05/2010


PL7_MONOSTABLE

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.

33002543 05/2010 491


PL7_MONOSTABLE

Mode of operation of the PL7_MONOSTABLE monostable function

Description
The following table describes the specific modes of operation of the
PL7_MONOSTABLE function:

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, Does not freeze the current value.
deactivation of a task
or execution of a
breakpoint
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.

NOTE: it is recommended to test the output bit of the monostable only once in the
program.

492 33002543 05/2010


PL7_REGISTER_32
33002543 05/2010

PL7_REGISTER_32 : 32 word
memory register
71
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:
z FIFO mode (first in, first out), also known as file,
z 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:

33002543 05/2010 493


PL7_REGISTER_32

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 ;

494 33002543 05/2010


PL7_REGISTER_32

Description of parameters
The following table describes the input parameters:

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.

The following table describes the output parameters:

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.

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


FIFO BOOL Mode of operation of the register:
z True : FIFO.
z 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.

33002543 05/2010 495


PL7_REGISTER_32

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 :
z in LD and FBD, the input histories are updated with the cabled
values,
z in IL, the input histories are not updated and each input retains
the value it had prior to the call.
z in ST, the input histories are set to zero.

496 33002543 05/2010


PL7_REGISTER_255
33002543 05/2010

PL7_REGISTER_255 : 255 word


memory register
72
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:
z FIFO mode (first in, first out), also known as file,
z 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:

33002543 05/2010 497


PL7_REGISTER_255

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 ;

498 33002543 05/2010


PL7_REGISTER_255

Description of parameters
The following table describes the input parameters:

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.

The following table describes the output parameters:

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.

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


FIFO BOOL Mode of operation of the register:
z True : FIFO.
z 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.

33002543 05/2010 499


PL7_REGISTER_255

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 :
z in LD and FBD, the input histories are updated with the cabled
values,
z in IL, the input histories are not updated and each input retains
the value it had prior to the call.
z in ST, the input histories are set to zero.

500 33002543 05/2010


PL7 and Unity Timers Comparison
33002543 05/2010

PL7 and Unity Timers Comparison

73
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:
z PL7_TON
z PL7_TOF
z PL7_TP
The IEC timers include:
z TON
z TOF
z TP

33002543 05/2010 501


PL7 and Unity Timers Comparison

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 Unlimited 255
timers in application
Programming z No time base z Time base (min, sec, or ms)
z Preset time is a TIME type must be defined with an
(t#1mn20s) integer
z The current value of the z The preset time is an INT type
timer is directly one output (time base factor)
ET of TIME type z The current value is provided
by a public variable
Running Mode The TON instance must be The output is set once the timer is
scanned in the program to launched
refresh the output
Online Mode Online modifications The user cannot:
(add/modify) allowed on TON z Modify the time base
instance z Create new instance

502 33002543 05/2010


PL7_TOF
33002543 05/2010

PL7_TOF : TOF type timer

74
Object of this chapter
This chapter describes the PL7_TOFfunction.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 504
Detailed description of the operation of the PL7_TOF function 507
Mode of operation of the PL7_TOF timer function 508

33002543 05/2010 503


PL7_TOF

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:

IL representation
Representation:
CAL TOF_Timer_1(S := Timer_Start, Q => Timer_State)

504 33002543 05/2010


PL7_TOF

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:

Parameter Type Comment


S BOOL "Activation" input, on rising edge, starts the timer.

The following table describes the output parameters:

Parameter Type Comment


Q BOOL "Timer" output, setting at 1 of this depends on the timer
state.

33002543 05/2010 505


PL7_TOF

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:
z TB = 8: 1 mn (default value),
z TB = 4: 1 s,
z TB = 2: 100 ms,
z 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.

506 33002543 05/2010


PL7_TOF

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.

33002543 05/2010 507


PL7_TOF

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:

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, Does not freeze the current value.
deactivation of a task
or execution of a
breakpoint
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).

NOTE: it is recommended to test bit Q only once in the program.

508 33002543 05/2010


PL7_TON
33002543 05/2010

PL7_TON : TON type timer

75
Object of this chapter
This chapter describes the PL7_TONfunction.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 510
Detailed description of the operation of the PL7_TON function 513
Mode of operation of the PL7_TON timer function 514

33002543 05/2010 509


PL7_TON

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:

IL representation
Representation:
LD Timer_Start
CAL TON_Timer_1(S := TON_Timer_1, Q => Timer_State)

510 33002543 05/2010


PL7_TON

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:

Parameter Type Comment


S BOOL "Activation" input, on rising edge, starts the timer.

The following table describes the output parameters:

Parameter Type Comment


Q BOOL "Timer" output, setting at 1 of this depends on the timer
state.

33002543 05/2010 511


PL7_TON

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:
z TB = 8: 1 mn (default value),
z TB = 4: 1 s,
z TB = 2: 100 ms,
z 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.

512 33002543 05/2010


PL7_TON

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.

33002543 05/2010 513


PL7_TON

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:

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, Does not freeze the current value.
deactivation of a task
or execution of a
breakpoint
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).

NOTE: it is recommended to test bit Q only once in the program.

514 33002543 05/2010


PL7_TP
33002543 05/2010

PL7_TP : TP type timer

76
Object of this chapter
This chapter describes the PL7_TP function.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 516
Detailed description of the operation of the PL7_TP function 519
Mode of operation of the PL7_TP timer function 520

33002543 05/2010 515


PL7_TP

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:

IL representation
Representation:
CAL TP_Timer_1(S := Timer_Start, Q => Timer_State)

516 33002543 05/2010


PL7_TP

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:

Parameter Type Comment


IN BOOL "Activation" input, on rising edge, starts the timer.

The following table describes the output parameters:

Parameter Type Comment


Q BOOL "Timer" output, setting at 1 of this depends on the timer
state.

33002543 05/2010 517


PL7_TP

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:
z TB = 8: 1 mn (default value),
z TB = 4: 1 s,
z TB = 2: 100 ms,
z 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.

518 33002543 05/2010


PL7_TP

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.

33002543 05/2010 519


PL7_TP

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:

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, does not freeze the current value.
deactivation of a task
or execution of a
breakpoint
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).

NOTE: it is recommended to test bit Q only once in the program.

520 33002543 05/2010


PL7_3_TIMER
33002543 05/2010

PL7_3_TIMER : Conversion timer


for % Ti’s of PL7
77
Object of this chapter
This chapter describes the PL7__3_TIMERfunction.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 522
Detailed description of the operation of the PL7_3_TIMER function 525
Mode of operation of the PL7_3_TIMER timer function 526

33002543 05/2010 521


PL7_3_TIMER

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:

522 33002543 05/2010


PL7_3_TIMER

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:

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.

The following table describes the output parameters:

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.

33002543 05/2010 523


PL7_3_TIMER

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:
z TB = 8: 1 mn (default value),
z TB = 4: 1 s,
z TB = 2: 100 ms,
z 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.

524 33002543 05/2010


PL7_3_TIMER

Detailed description of the operation of the PL7_3_TIMER function

Chart
Chart.

E 0 0 1 1
C 0 1 0 1
PT ET = PT ET = PT ET frozen ET decreases by PT to 0
ET
D 0 1 0 1 if timer elapsed
R 0 1 0 1 if timer running

Operation
The following table describes the operation of the PL7_3_TIMER timer function:

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.

33002543 05/2010 525


PL7_3_TIMER

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:

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, Does not freeze the current value.
deactivation of a task
or execution of a
breakpoint
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.

NOTE: it is recommended to test the output bits only one in the program as they may
change state in mid-cycle.

526 33002543 05/2010


PUT_4X
33002543 05/2010

PUT_4X: Write 4x register

78
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:

33002543 05/2010 527


PUT_4X

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:

Parameter Data type Description


OffsetIn4XRegisterMemory UINT Offset in the %MW register memory (4x).
Input ANY Input

Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 609.

528 33002543 05/2010


R_INT_WORD
33002543 05/2010

R_INT_WORD: Type conversion


(REAL -> INT -> WORD)
(R_INT_WORD: Type conversion 79
(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:

33002543 05/2010 529


R_INT_WORD

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:

Parameter Data type Description


INP REAL Input value

Description of output parameters:

Parameter Data type Description


OUTP WORD Output value

Runtime error
The system bit %S18 (see page 615) and system words %SW17 (see page 621)
(error status) and %SW125 (see page 636) (16#DE87: Caldulation errors in a
floating point value calculation) are set when
z an unauthorized floating point number is set at the input,
z the value range of the data type INT is exceeded,

530 33002543 05/2010


R_UINT_WORD
33002543 05/2010

R_UINT_WORD: Type conversion


(REAL -> UINT -> WORD)
(R_UINT_WORD: Type conversion 80
(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:

33002543 05/2010 531


R_UINT_WORD

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:

Parameter Data type Description


INP REAL Input value

Description of output parameters:

Parameter Data type Description


OUTP WORD Output value

Runtime error
The system bit %S18 (see page 615) and system words %SW17 (see page 621)
(error status) and %SW125 (see page 636) (16#DE87: Caldulation errors in a
floating point value calculation) are set when
z an unauthorized floating point number is set at the input,
z the value range of the data type UINT is exceeded,
z a negative input value is to be converted.

532 33002543 05/2010


R2T_***
33002543 05/2010

R2T_***: Register to table

81
Introduction
This chapter describes the R2T_*** block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 534
Detailed description 536

33002543 05/2010 533


R2T_***

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:
z R2T_INT
z R2T_DINT
z R2T_UINT
z R2T_UDINT
z R2T_REAL

Representation in FBD
Representation:

Representation in LD
Representation:

534 33002543 05/2010


R2T_***

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:

Parameter Data type Description


NOINC BOOL 1: freezes the pointer value
R BOOL 1: resets the pointer value to zero
SRC INT, DINT, UINT, Source data to be copied in the current cycle
UDINT, REAL

Description of input / output parameters:

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.

Description of output parameters:

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 Destination register where source data will be
of INT, DINT, UINT, copied in the cycle.
UDINT or REALe.g.
ARRAY[0..X] of
INT

33002543 05/2010 535


R2T_***

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:

OFF NOINC R OFF Comment


(previous cycle) (current
cycle)
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.

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 table’s boundaries
again.

536 33002543 05/2010


READ_PCMCIA
33002543 05/2010

READ_PCMCIA: Reading data in


the memory card
82
Subject of this Chapter
This chapter describes the function READ_PCMCIA.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 538
READ_PCMCIA and WRITE_PCMCIA Example 540

33002543 05/2010 537


READ_PCMCIA

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 zone's 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 540).

Representation in FBD
Representation:

Representation in LD
Representation:

Representation in IL
Representation:
LD Slot_Number
READ_PCMCIA Source_Address, Words_Number, Dest_Address,
Read_State

538 33002543 05/2010


READ_PCMCIA

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:

Parameter Type Comment


Slot_Number INT PCMCIA card slot:
z 0 = upper slot,
z 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.

The following table describes the output parameters:

Parameter Type Comment


Read_State INT Code providing the result of the read command's
execution:
z 16#0000: read performed correctly,
z 16#0102: Dest_Address + Words_Number -1 is
greater than the maximum number of declared
words in the PLC.
z 16#0104: no valid application or no word in the PLC,
z 16#0201: no file zone in the memory card,
z 16#0202: memory card error,
z 16#0204: memory card write-protected,
z 16#0241: Source_Address < 0,
z 16#0242: Dest_Address + Words_Number-1 is
greater than the highest address of the memory
card,
z 16#0401: Words_Number = 0,
z 16#0402: Slot_Number is different from 0 and 1.
z 16#0501: Words_Number = unsupported service.

33002543 05/2010 539


READ_PCMCIA

READ_PCMCIA and WRITE_PCMCIA Example

Objectives
This example shows how to use the READ_PCMCIA and WRITE_PCMCIA function
blocks by:
z Writing values from words (%MW100 to %MW109) to a memory card.
z 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.

540 33002543 05/2010


READ_PCMCIA

Programming the MAST section


In the MAST section of the program, program as follows:
z The memory card is connected into slot 0.
z The WRITE_PCMCIA function writes 10 words to address 10000 on the memory
card from %MW100.
z 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.

33002543 05/2010 541


READ_PCMCIA

542 33002543 05/2010


ROR1_ARB
33002543 05/2010

ROR1_ARB: Right shift of one


byte from a table of bytes
83
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

33002543 05/2010 543


ROR1_ARB

ST representation
Representation:
ROR1_ARB(String1);

Parameter Description
The following table describes the input/output parameters:

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.

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

544 33002543 05/2010


RRTC
33002543 05/2010

RRTC: Reading the system date

84
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

33002543 05/2010 545


RRTC

Representation in ST
Representation:
RRTC(Result_Date);

Description of parameters
The following table describes the output parameters:

Parameter Type Comment


Result_Date ARRAY Result_Date contains the current date value in PL7
[0...3] OF DT format (array of 4 integers).
INT

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.

546 33002543 05/2010


SCOUNT
33002543 05/2010

SCOUNT: Up/down counting with


overshoot signaling
85
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:

33002543 05/2010 547


SCOUNT

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);

548 33002543 05/2010


SCOUNT

Description of parameters
The following table describes the input 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.

The following table describes the input/output parameters:

Parameter Type Comment


Mem_Word INT Integer used as an input and an output enabling
up/down counter inputs to be stored:
z bit 0, for Count_Up,
z bit 1, for Count_Down

33002543 05/2010 549


SCOUNT

The following table describes the output parameters:

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.

NOTE:
z 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
z 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
z 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
z 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
z A modification of the Presel_Value parameter with Enable set to 1 has no
impact on operation.
z A negative value for the Presel_Value and Minimum parameters is interpreted
as a nil value.
z A value of less than 1 for the Maximum parameter is interpreted as equal to 1.

550 33002543 05/2010


SCOUNT

Timing diagram
Functional timing diagram:

33002543 05/2010 551


SCOUNT

552 33002543 05/2010


SET_BIT
33002543 05/2010

SET_BIT: Set bit

86
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.

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.

EN and ENO can be configured as additional parameters.

Representation in FBD
Representation:

33002543 05/2010 553


SET_BIT

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:

Parameter Data type Description


InputData BOOL Input data
BitNumber UINT Bit number to be written.

Description of output parameters:

Parameter Data type Description


OutputRegister WORD Output

Runtime error
For a list of all block error codes and values, see Extension/Compatibility, page 609.

554 33002543 05/2010


SET_PCMCIA
33002543 05/2010

SET_PCMCIA: Initialization of the


archiving zone
87
Description

Function description
The SET_PCMCIA function enables all or part of the user memory card's 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:

33002543 05/2010 555


SET_PCMCIA

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:

Parameter Type Comment


Slot_Number INT PCMCIA card slot:
z 0 = upper slot,
z 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.

The following table describes the output parameters:

Parameter Type Comment


Init_State INT Code providing the result of the initialization
command's execution:
z 16#0000: initialization performed correctly,
z 16#0201: no file zone in the memory card,
z 16#0202: memory card error,
z 16#0204: memory card write-protected,
z 16#0241: negative address,
z 16#0242: Address + Words_Number-1 is
greater than the highest address of the
memory card,
z 16#0401: Words_Number ≤0,
z 16#0402: Slot_Number is different from 0
and 1,
z 16#0501: unsupported service.

556 33002543 05/2010


SHL_RBIT_***
33002543 05/2010

SHL_RBIT_***: Left shift on an


integer or double integer
88
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:
z SHL_RBIT_INT,
z SHL_RBIT_DINT.

Representation in FBD
Representation applied to an integer:

Representation in LD
Representation applied to an integer:

33002543 05/2010 557


SHL_RBIT_***

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:

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.

The following table describes the output parameters:

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

558 33002543 05/2010


SHR_RBIT_***
33002543 05/2010

SHR_RBIT_***: Right shift on an


integer or double integer
89
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:
z SHR_RBIT_INT,
z SHR_RBIT_DINT.

Representation in FBD
Representation applied to a double integer:

Representation in LD
Representation applied to a double integer:

33002543 05/2010 559


SHR_RBIT_***

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:

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.

The following table describes the output parameters:

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

560 33002543 05/2010


SHRZ_***
33002543 05/2010

SHRZ_***: Right shift on an


integer or double integer
90
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:
z SHRZ_INT,
z SHRZ_DINT.

Representation in FBD
Representation applied to an integer:

Representation in LD
Representation applied to an integer:

33002543 05/2010 561


SHRZ_***

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:

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.

The following table describes the output parameters:

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

562 33002543 05/2010


SHRZ_RBIT_***
33002543 05/2010

SHRZ_RBIT_***: Right shift on an


integer or double integer
91
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:
z SHRZ_RBIT_INT,
z SHRZ_RBIT_DINT.

Representation in FBD
Representation applied to an integer:

Representation in LD
Representation applied to an integer:

33002543 05/2010 563


SHRZ_RBIT_***

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:

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.

The following table describes the output parameters:

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

564 33002543 05/2010


SRCH
33002543 05/2010

SRCH: Search

92
Introduction
This chapter describes the SRCH block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 566
Detailed description 569

33002543 05/2010 565


SRCH

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:

Representation in IL
Representation:
CAL SRCH_Instance (TRIG:=StartsSearch, CONT:=ContinueSearch,
SRC:=SourceTable, PATTERN:=BitPatternForSearch,
INDEX:=FindingPlace, FOUND=>FoundPattern)

566 33002543 05/2010


SRCH

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) Source table
of type INT, DINT, UINT,
UDINT or REAL e.g.
ARRAY[0..X] OF INT
PATTERN INT, DINT, UINT, UDINT, PATTERN is the bit pattern to be searched for.
REAL 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.

33002543 05/2010 567


SRCH

Description of input / 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.

Description of output parameters:

Parameter Data type Description


FOUND BOOL 1 = pattern found

568 33002543 05/2010


SRCH

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.

33002543 05/2010 569


SRCH

570 33002543 05/2010


STR_ROUND
33002543 05/2010

STR_ROUND: Approximate value


of a floating point number
93
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

33002543 05/2010 571


STR_ROUND

Representation in ST
Representation:
STR_ROUND(Real_Str, Pos, Rounded_Str);

Description of the parameters


The following table describes the input parameters:

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

The following table describes the output parameters:

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'

Runtime errors
The length of the original and resulting character strings must be between 15 and
255. Otherwise , the system bit %S15 (see page 615) is set to 1.
The parameter Pos must be between 0 and 8. Otherwise, the bit %S20
(see page 615) 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.

572 33002543 05/2010


SUB_***_PL7
33002543 05/2010

SUB_***_PL7 : Subtract a period

94
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:
z SUB_DT_PL7,
z SUB_TOD_PL7.

Representation in FBD
Representation applied to a time of day:

Representation in LD
Representation applied to a time of day:

33002543 05/2010 573


SUB_***_PL7

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:

Parameter Type Comment


Source_Value DINT, Date or time.
ARRAY [0..3] OF
INT
Time_to_Sub DINT, Period to be subtracted from Source_Value
ARRAY [0..3] OF
INT 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.

The following table describes the output parameters:

Parameter Type Comment


Result_Value DINT, Result_Value is of the same type as
ARRAY [0..3] OF Source_Value.
INT

NOTE: management of leap years must be provided for in the application.

574 33002543 05/2010


SUB_***_PL7

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 615) 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 615) 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 615) is set at 1 and
Result_Value applies:
z 00:00:00 for the TOD type of PL7.
z 00001-01-01-00:00:00 for the DT type of PL7.

33002543 05/2010 575


SUB_***_PL7

576 33002543 05/2010


SYSSTATE
33002543 05/2010

SYSSTATE: System state

95
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:

33002543 05/2010 577


SYSSTATE

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:

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".

NOTE: In cold start cycle both outputs COLD and WARM are set to "1".

578 33002543 05/2010


T2T
33002543 05/2010

T2T: Table to table

96
Introduction
This chapter describes the T2T block.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Description 580
Detailed Description 583

33002543 05/2010 579


T2T

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 doesn't 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:
z 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.
z 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:

580 33002543 05/2010


T2T

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) ;

33002543 05/2010 581


T2T

Parameter description
Description of input 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 Source data to be copied in the current cycle
array of the BOOL,
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT
SIZE UINT The variable tells the function block how many
words have to copied every cycle.

Description of input / output parameters:

Parameter Data type Description


OFF UINT Offset in both the source and destination table.

Description of output parameters:

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 Destination table where source table will be copied
array of the BOOL, in the cycle.
BYTE, WORD, DWORD,
INT, DINT, UINT,
UDINT,REAL, TIME
types e.g.ARRAY
[0..X] OF INT

582 33002543 05/2010


T2T

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.

33002543 05/2010 583


T2T

584 33002543 05/2010


TIME_DINT_TO_STRING
33002543 05/2010

TIME_DINT_TO_STRING:
Conversion of a variable to DINT
format 97
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

33002543 05/2010 585


TIME_DINT_TO_STRING

Representation in ST
Representation:
Result_Str := TIME_DINT_TO_STRING(Time1);

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Time1 DINT Duration to convert into character string format.

The following table describes the output parameters:

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’

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 615) is set to 1.

586 33002543 05/2010


TOD_DINT_TO_STRING
33002543 05/2010

TOD_DINT_TO_STRING:
Conversion of a variable to TOD
format 98
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

33002543 05/2010 587


TOD_DINT_TO_STRING

Representation in ST
Representation:
Result_Str := TOD_DINT_TO_STRING(Time1);

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Time1 DINT PL7 time of day to convert into character string format.

The following table describes the output parameters:

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’

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 615) is set to 1.

588 33002543 05/2010


TRANS_TIME
33002543 05/2010

TRANS_TIME: Conversion of a
duration into DINT format
99
Description

Function description
The function TRANS_TIME is used to convert a duration in DINT format (TIME using
PL7) into a number.
z of hours (HHHH),
z of minutes (MM),
z of seconds (SS).
The additional parameters EN and ENO can be configured.

Representation in FBD
Representation:

Representation in LD
Representation:

33002543 05/2010 589


TRANS_TIME

Representation in IL
Representation:
LD Time1
TRANS_TIME
ST Result_DINT

Representation in ST
Representation:
Result_DINT := TRANS_TIME(Time1);

Description of the parameters


The following table describes the input parameters:

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.

The following table describes the output parameters:

Parameter Type Comment


Result_DINT DINT Result_INT is a double integer that breaks down as
follows:
z the most significant word contains the hours in BCD
format,
z the least significant word contains the minutes and
seconds:
z the most significant byte contains the minutes in
BCD format,
z 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.

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 615)
switches to 1 and Result_DINT = 16#00000000

590 33002543 05/2010


W_INT_REAL
33002543 05/2010

W_INT_REAL: Type conversion


(WORD -> INT -> REAL)
(W_INT_REAL: Type conversion 100
(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:

33002543 05/2010 591


W_INT_REAL

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:

Parameter Data type Description


INP WORD Input value

Description of output parameters:

Parameter Data type Description


OUTP REAL Output value

592 33002543 05/2010


W_UINT_REAL
33002543 05/2010

W_UINT_REAL: Type conversion


(WORD -> UINT -> REAL)
(W_UINT_REAL: Type conversion 101
(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:

33002543 05/2010 593


W_UINT_REAL

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:

Parameter Data type Description


INP WORD Input value

Description of output parameters:

Parameter Data type Description


OUTP REAL Output value

594 33002543 05/2010


WRITE_PCMCIA
33002543 05/2010

WRITE_PCMCIA: Writing data to


the memory card
102
Description

Function description
The WRITE_PCMCIA function transfers data from the PLC's RAM memory to the
user memory card archiving zone. The function WRITE_U_PCMCIA enables to
address the PLC zone's 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 540).

Representation in FBD
Representation:

33002543 05/2010 595


WRITE_PCMCIA

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);

596 33002543 05/2010


WRITE_PCMCIA

Description of the parameters


The following table describes the input parameters:

Parameter Type Comment


Slot_Number INT PCMCIA card slot:
z 0 = upper slot,
z 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.

The following table describes the output parameters:

Parameter Type Comment


Write_State INT Code providing the result of the write
command's execution:
z 16#0000: write performed correctly,
z 16#0102: Source_Address +
Words_Number - 1 is greater than the
maximum number of declared words in the
PLC,
z 16#0104: no valid application or no word in
the PLC,
z 16#0201: no file zone in the memory card,
z 16#0202: memory card error,
z 16#0204: memory card write-protected,
z 16#0241: Dest_Address < 0,
z 16#0242: Dest_Address +
Words_Number-1 is greater than the
highest address of the memory card,
z 16#0401: Words_Number = 0,
z 16#0402: Slot_Number is different from 0
and 1,
z 16#0501: unsupported service.

33002543 05/2010 597


WRITE_PCMCIA

598 33002543 05/2010


WRTC
33002543 05/2010

WRTC: Updating the system date

103
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

33002543 05/2010 599


WRTC

Representation in ST
Representation:
WRTC(Date1);

Description of parameters
The following table describes the input parameters:

Parameter Type Comment


Date1 ARRAY Date1 must contain the current value of the date in PL7
[0...3] OF DT format (table of 4 integers). The contents of this
INT variable must be assigned by program before launching
the function.

600 33002543 05/2010


33002543 05/2010

Appendices

Overview
This section contains the appendicies.

What's in this Appendix?


The appendix contains the following chapters:
Chapter Chapter Name Page
A EFB Error Codes and Values 603
B System Objects 613

33002543 05/2010 601


602 33002543 05/2010
EFB Error Codes and Values
33002543 05/2010

EFB Error Codes and Values

A
Introduction
The following tables show the error codes and error values created for the EFBs of
the Obsolete Library.

What's in this Chapter?


This chapter contains the following topics:
Topic Page
Tables of Error Codes for the Obsolete Library 604
Common Floating Point Errors 611

33002543 05/2010 603


EFB Error Codes and Values

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 Error Error Error description


state in value in value in
case of Dec Hex
error
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 611
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 611
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 611
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 611
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 611
PID1 E_ERR_DEN F -30152 16#8A38 Not a valid floating point
number

604 33002543 05/2010


EFB Error Codes and Values

EFB name Error code ENO Error Error Error description


state in value in value in
case of Dec Hex
error
PID1 E_ERR_PID_MAX_MIN F -30104 16#8A68 YMAX < YMIN
PID1 FP_ERROR F - - See table Common Floating
Point Errors, page 611
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 611
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 611
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 611
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 611
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 611
TWOPOINT_CON1 E_ERR_ZDR_HYS F -30106 16#8A66 2 * |UZ| < |HYS|

33002543 05/2010 605


EFB Error Codes and Values

CLC_PRO
Table of error codes and errors values created for EFBs of the CLC_PRO family.

EFB name Error code ENO Error Error Error description


state in value in value in
case of Dec Hex
error
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 611
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 611
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 611
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 611
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 611
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 611
LAG2 E_ERR_DEN F -30152 16#8A38 Not a valid floating point number

606 33002543 05/2010


EFB Error Codes and Values

EFB name Error code ENO Error Error Error description


state in value in value in
case of Dec Hex
error
LAG2 FP_ERROR F - - See table Common Floating Point
Errors, page 611
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 611
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 611
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 611
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 611
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 611
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 611
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
PID FP_ERROR F - - See table Common Floating Point
Errors, page 611
PID_P E_ERR_DEN F -30152 16#8A38 Not a valid floating point number

33002543 05/2010 607


EFB Error Codes and Values

EFB name Error code ENO Error Error Error description


state in value in value in
case of Dec Hex
error
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 611
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 611
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 611
PWM WAF_PBM_TMINMAX F -30113 16#8A5F t_min < t_max
PWM FP_ERROR F - - See table Common Floating Point
Errors, page 611
QPWM WAF_PBM_TMINMAX F -30113 16#8A5F t_min < t_max
QPWM FP_ERROR F - - See table Common Floating Point
Errors, page 611
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 611
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 611

608 33002543 05/2010


EFB Error Codes and Values

Extension/Compatibility
Table of error codes and errors values created for EFBs of the
Extension/Compatibility family.

EFB name Error code ENO Error Error Error description


state in value in value in
case of Dec Hex
error
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
(OffsetInSourceTable)
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).
IEC_BMDI E_EFB_USER_ERROR_5 F -30204 16#8A04 The output offset
(OffsetInDestinationTable)
selects an address outside
acceptable limits.
IEC_BMDI E_EFB_USER_ERROR_6 F -30205 16#8A03 The output offset
(OffsetInDestinationTable)
is not 1 or a multiple of
16+1.
IEC_BMDI E_EFB_USER_ERROR_7 F -30206 16#8A02 The value for
(NumberOfElements) is 0.

33002543 05/2010 609


EFB Error Codes and Values

EFB name Error code ENO Error Error Error description


state in value in value in
case of Dec Hex
error
IEC_BMDI E_EFB_USER_ERROR_8 F -30207 16#8A01 The value for
(NumberOfElements)
addresses more than 1600
bits.
IEC_BMDI E_EFB_USER_ERROR_9 F -30208 16#8A00 The value for
(NumberOfElements)
addresses more than 100
words.
IEC_BMDI E_EFB_USER_ERROR_10 F -30209 16#89FF The value for
(NumberOfElements)
selects a source address
outside the acceptable
limits.
IEC_BMDI E_EFB_USER_ERROR_11 F -30210 16#89FE The value for
(NumberOfElements)
selects a destination
address outside the
acceptable limits.
IEC_BMDI E_EFB_USER_ERROR_12 F -30211 16#89FD The value for
(NumberOfElements) 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.
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

610 33002543 05/2010


EFB Error Codes and Values

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 Error value Error description


in Dec in Hex
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 05/2010 611


EFB Error Codes and Values

612 33002543 05/2010


System Objects
33002543 05/2010

System Objects

B
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's in this Chapter?


This chapter contains the following topics:
Topic Page
System Bit Introduction 614
Description of System Bits %S15 to %S21 615
Description of System Words %SW0 to %SW11 618
Description of System Words %SW12 to %SW29 621
Description of System Words %SW70 to %SW100 626
Description of System Words %SW123 to %SW127 636

33002543 05/2010 613


System Objects

System Bit Introduction

General
The Modicon M340, Premium, Atrium and Quantum 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.

614 33002543 05/2010


System Objects

Description of System Bits %S15 to %S21

Detailed Description
Description of system bits %S15 to %S21:

Bit Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%S15 Character Normally set to 0, this bit is set to 1 when 0 YES YES YES
STRINGERROR string fault the destination zone for a character string (except
transfer is not of sufficient size (including for safety
the number of characters and the end of PLCs)
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.
%S16 Task Normally set to 1, this bit is set to 0 by the 1 YES YES YES
IOERRTSK input/output system when a fault on an in-rack module
fault 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.

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.

33002543 05/2010 615


System Objects

Bit Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%S17 Rotate shift Normally at 0. 0 YES YES YES
CARRY output During a rotate shift operation, this bit
takes the state of the outgoing bit.
%S18 Overflow or Normally set to 0, this bit is set to 1 in the 0 YES YES YES
OVERFLOW arithmetic event of a capacity overflow if there is:
error z a result greater than + 32 767 or less
than - 32 768, in single length,
z result greater than + 65 535, in
unsigned integer,
z a result greater than + 2 147 483 647
or less than - 2 147 483 648, in double
length,
z result greater than +4 294 967 296, in
double length or unsigned integer,
z real values outside limits,
z division by 0,
z the root of a negative number,
z forcing to a non-existent step on a
drum,
z stacking up of an already full register,
emptying of an already empty register.
There is only one case for which bit %S18
is not raised by the Modicon M340 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.
%S19 Task period Normally set to 0, this bit is set to 1 by the 0 YES YES YES
OVERRUN overrun system in the event of a time period
(periodical overrun (i.e. task execution time is
scanning) 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.

616 33002543 05/2010


System Objects

Bit Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%S20 Index Normally set to 0, this bit is set to 1 when 0 YES YES YES
INDEXOVF overflow the address of the indexed object (except for
becomes less than 0 or exceeds the safety
number of objects declared in the PLCs)
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.
%S21 First task Tested in a task (Mast, Fast, Aux0, Aux1, 0 YES YES YES
1RSTTASKRUN cycle 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 PL7 as in Unity Pro.

33002543 05/2010 617


System Objects

Description of System Words %SW0 to %SW11

Detailed Description
Description of system words %SW0 to %SW11.

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW0 Master task This word is used to modify the period of 0 YES YES YES
MASTPERIOD scanning the master task via the user program or (except
period via the terminal. for safety
The period is expressed in ms (1...255 PLCs)
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.
%SW1 Fast task This word is used to modify the period of 0 YES YES YES
FASTPERIOD scanning the fast task via the user program or via (except
period the terminal. for safety
The period is expressed in milliseconds PLCs)
(1...255 ms).
On a cold restart, it takes the value
defined by the configuration.
This word is not available on Quantum
safety PLCs.
%SW2 Auxiliary This word is used to modify the period of 0 NO YES (1) YES (1)
AUX0PERIOD task the tasks defined in the configuration, via (except
%SW3 scanning the user program or via the terminal. for safety
AUX1PERIOD period The period is expressed in tens of ms PLCs)
%SW4 (10ms to 2.55s).
AUX2PERIOD
%SW5 (1) only on 140 CPU 6•• and TSX 57 5••
AUX3PERIOD PLCs.
These words are not available on
Quantum safety PLCs.
%SW6 IP Address Gives the IP address of the CPU - YES NO NO
%SW7 Ethernet port. Modification is not taken
into account.
Is 0 if the CPU does not have an
Ethernet link.

618 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW8 Acquisition Normally set to 0, this bit can be set to 1 0 YES(1) YES YES(2)
TSKINHIBIN of task input or 0 by the program or the terminal. (except
monitoring It inhibits the input acquisition phase of for safety
each task: PLCs)
z %SW8.0 = 1 inhibits the acquisition
of inputs relating to the MAST task.
z %SW8.1 = 1 inhibits the acquisition
of inputs relating to the FAST task.
z %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.
This word is not available on Quantum
safety PLCs.
%SW9 Monitoring Normally set to 0, this bit can be set to 1 0 YES (3) YES YES (4)
TSKINHIBOUT of task or 0 by the program or the terminal. (except
output Inhibits the output updating phase of for safety
update each task. PLCs)
z %SW9.0 = 1 assigned to the MAST
task; outputs relating to this task are
no longer managed.
z %SW9.1 = 1 assigned to the FAST
task; outputs relating to this task are
no longer managed.
z %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.

33002543 05/2010 619


System Objects

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 Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW10 First cycle If the value of the current task bit is set 0 YES YES YES
TSKINIT after cold to 0, this means that the task is (except
start performing its first cycle after a cold for safety
start. PLCs)
z %SW10.0: assigned to the MAST
task.
z %SW10.1: assigned to the FAST
task.
z %SW10.2 to 5: assigned to the AUX
0...3 tasks.
This word is not available on Quantum
safety PLCs.
%SW11 Watchdog Reads the duration of the watchdog. - YES YES YES
WDGVALUE duration The duration is expressed in
milliseconds (10...1500 ms). This word
cannot be modified.

620 33002543 05/2010


System Objects

Description of System Words %SW12 to %SW29

Detailed Description
Description of system words %SW12 to %SW29:

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW12 Processor For Premium: Uni-Telway address - YES YES NO
UTWPORTADDR serial port of terminal port (in slave mode) as (see
address defined in the configuration and %SW12
loaded into this word on cold start. below)
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.
%SW12 Mode of the For Quantum safety PLC only, this 16#A501 NO NO YES
APMODE application word indicates the operating mode Only on
processor of the application processor of the safety
CPU module. PLCs
z 16#A501 = maintenance mode
z 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.
%SW13 Main This word indicates the following for 254 NO YES NO
XWAYNETWADDR address of the main network (Fipway or (16#00FE) (see
the station Ethway): %SW13
z the station number (least below)
significant byte) from 0 to 127,
z the network number (most
significant byte) from 0 to 63,
(value of the micro-switches on the
PCMCIA card).

33002543 05/2010 621


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW13 Mode of the For Quantum safety PLC only, this - NO NO YES
INTELMODE Intel word indicates the operating mode Only on
processor of the Intel Pentium processor of the safety
CPU module. PLCs
z 16#501A = maintenance mode
z 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.
%SW14 Commercia This word contains the current - YES YES YES
OSCOMMVERS l version of Operating System (OS) version of
PLC the PLC processor.
processor Example: 16#0135
version: 01
issue number: 35
%SW15 PLC This word contains the commercial - YES YES YES
OSCOMMPATCH processor version of the PLC processor patch.
patch It is coded onto the least significant
version byte of the word.
Coding: 0 = no patch, 1 = A, 2 = B...
Example: 16#0003 corresponds to
patch C.
%SW16 Firmware This word contains the Firmware - YES YES YES
OSINTVERS version version number in hexadecimal of
number the PLC processor firmware.
Example: 16#0011
version: 2.1
VN: 17

622 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW17 Error status When an error in a floating 0 YES YES YES
FLOATSTAT on floating arithmetic operation is detected, bit Only on
operation %S18 is set to 1 and %SW17 error safety
status is updated according to the PLCs
following coding:
z %SW17.0 = Invalid operation /
result is not a number,
z %SW17.1 =Denormalized
operand / result is acceptable
(flag not managed by Modicon
M340 or Quantum Safety PLCs),
z %SW17.2 = Division by 0 / result
is infinity,
z %SW17.3 = Overflow / result is
infinity,
z %SW17.4 = Underflow / result is
0,
z %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.
This word is not available on
Quantum safety PLCs.
%SD18: Absolute %SW18 represents the least 0 YES YES YES
%SW18 and time significant bytes and %SW19 the
%SW19 counter most significant bytes of the double
100MSCOUNTER word %SD18, which is incremented
by the system every 1/10th 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.

33002543 05/2010 623


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SD20: Absolute For M340 and Quantum PLCs 0 YES YES YES
%SW20 and time %SD20 is incremented every
%SW21 counter 1/1000th of a second by the system
MSCOUNTER (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 1•4M/2•4M/3•4M/C024M/
024M and TSX PCI57 204M/354M
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.
%SW23 Rotary The least significant byte contains - YES NO NO
switch the Ethernet processor rotary
value switch.
It can be read by the user program
or by the terminal.

624 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW26 Number of This system word allows to verifiy - YES YES YES
requests on server side the number of
processed requests processed by PLC per
cycle.
%SW27 System z %SW27 is the last system - YES NO NO
%SW28 overhead overhead time.
%SW29 time z %SW28 contains the maximum
system overhead time.
z %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.

33002543 05/2010 625


System Objects

Description of System Words %SW70 to %SW100

Detailed Description
Description of system words %SW70 to %SW100.

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW70 Real-time clock System word containing the number - YES YES YES
WEEKOFYEAR function of the week in the year: 1 to 52 (in
BCD).
%SW71 Position of the This word provides the image of the 0 NO NO YES
KEY_SWITCH switches on the positions of the switches on the front
Quantum front panel of the Quantum processor.
panel This word is updated automatically
by the system.
z %SW71.0 = 1 switch in the
"Memory protected" position,
z %SW71.1 = 1 switch in the
"STOP" position,
z %SW71.2 = 1 switch in the
"START" position,
z %SW71.8 = 1 switch in the
"MEM" position,
z %SW71.9 = 1 switch in the
"ASCII" position,
z %SW71.10 = 1 switch in the
"RTU" position,
z %SW71.3 to 7 and 11 to 15 are
not used.
%SW75 Timer-type event This word contains the number timer 0 YES YES (1) YES
TIMEREVTNB counter type events in the queue. (except for
(1): Not available on the following safety
processors: TSX 57 1•/2•/3•/4•/5•. PLCs)
This word is not available on
Quantum safety PLCs.
%SW76 Diagnostics Result of the last registration 0 YES YES YES
DLASTREG function: z = 0 if the recording was
recording successful,
z = 1 if the diagnostics buffer has
not been configured,
z = 2 if the diagnostics buffer is full.

626 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW77 Diagnostics Result of the last deregistration 0 YES YES YES
DLASTDEREG function: z = 0 if the non-recording was
non-recording successful,
z = 1 if the diagnostics buffer has
not been configured,
z = 21 if the error identifier is invalid,
z = 22 if the error has not been
recorded.
%SW78 Diagnostics Number of errors currently in the 0 YES YES YES
DNBERRBUF function: diagnostics buffer.
number of errors
%SW80 Message These words are updated by the 0 YES YES YES
MSGCNT0 management system, and can also be reset using
%SW81 %S80.
MSGCNT1 For Premium:
z %SW80: Number of message sent
by the system to the terminal port
(Uni-Telway port)
z %SW81: Number of message
received by the system to the
terminal port (Uni-Telway port)
For Modicon M340:
z %SW80: Number of message sent
by the system to the terminal port
(Modbus serial port),
z %SW81: Number of message
received by the system to the
terminal port (Modbus serial port).
For Quantum:
z %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.
z %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.

33002543 05/2010 627


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW82 Message These words are updated by the 0 NO YES YES
%SW83 management system, and can also be reset using
%S80.
For Premium:
z %SW82: Number of messages
sent by the system to the PCMCIA
module,
z %SW83: Number of messages
received by the system from the
PCMCIA module.
For Quantum:
z %SW82: Number of Modbus
messages sent or received on
serial port 1,
z %SW83: Number of Modbus
messages sent or received on
serial port 2.
%SW84 Premium: These words are updated by the 0 YES YES NO
MSGCNT4 Telegram system, and can also be reset using
%SW85 management %S80.
MSGCNT5 Modicon M340: For Premium:
Message z %SW84: Number of telegrams sent
management by the system,
z %SW85: Number of telegrams
received by the system.
For Modicon M340:
z %SW84: Number of messages
sent to the USB port,
z %SW85: Number of messages
received by the USB port.
%SW86 Message This word is updated by the system, 0 YES YES NO
MSGCNT6 management and can also be reset using %S80.
For Premium:
z Number of messages refused by
the system.
For Modicon M340:
z 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.

628 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW87 Communication Number of requests processed by 0 YES YES YES
MSTSERVCNT flow synchronous server per master
management (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.
%SW88 Premium: For Premium: 0 YES YES NO
ASNSERVCNT Communication z %SW88: Number of requests
%SW89 flow processed by asynchronous
APPSERVCNT management server per master (MAST) task
Modicon M340: cycle,
HTTP and FTP z %SW89: Number of requests
requests processed by server functions
received by the (immediately) per master (MAST)
processor’s Web task cycle.
server and FTP For Modicon M340:
server per
z %SW88: Number of HTTP
second
requests received by the
processor’s Web server per
second,
z %SW89: Number of FTP requests
received by the FTP server per
second.

33002543 05/2010 629


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW90 Maximum This word is used to set a maximum N YES YES YES
MAXREQNB number of number of requests (all protocols
requests included: UNI-TE, Modbus, etc.)
processed per which can be processed by the
master task server of the PLC per master task
cycle 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:
z BMX P34 10••/20••/: N = 8
(minimum 2, maximum 8 + 4 =
12),
For Premium range:
z TSX 57 0•: N = 4 (minimum 2,
maximum 4 + 4 = 9),
z TSX 57 1•: N = 4 (minimum 2,
maximum 4 + 4 = 8),
z TSX 57 2•: N = 8 (minimum 2,
maximum 8 + 4 = 12),
z TSX 57 3•: N = 12 (minimum 2,
maximum 12 + 4 = 16),
z TSX 57 4•: N = 16 (minimum 2,
maximum 16 + 4 = 20),
z TSX 57 5•: N = 16 (minimum 2,
maximum 16 + 4 = 20)
For Quantum range:
z 140 CPU 31••/43••/53••/ : N = 10
(minimum 5, maximum 10 + 4 =
14),
z 140 CPU 6•• : N = 20 (minimum 5,
maximum 20 + 4 = 24),

630 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
Continued Maximum The Word is initialized by the system N YES YES YES
%SW90 number of with N (default value) If the value 0 is
MAXREQNB requests entered, it is the value N that is taken
processed per into account. If a value between 1
master task and minimum is entered, it is the
cycle 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.
%SW91-92 Function blocks z %SW91: Number of function blocks 0 YES YES NO
message rates messages sent per second,
z %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.

33002543 05/2010 631


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW93 Memory card file Can be read and written by the user 0 YES NO NO
system format program or the terminal. This word is
command & used by the customer to format or
status clean up the memory card:
The format operation deletes the web
pages. To recover them, perform one
of the two following actions
z Use FTP.
z Before performing the format,
save the web pages using
FTP.
z After performing the format,
reload the web pages via FTP.
z Reinstall the firmware operating
system of the processor.
The clean up operation deletes the
content of the data storage directory.
Formatting or clean up is possible
only in Stop mode:
z %SW93.0 = 1 a rising edge
starts the format operation.
z %SW93.1 gives the file system
status after a format or a clean Up
operation request:
z %SW93.1 = 0 invalid file
system or command under
progress,
z %SW93.1 = 1 valid file
system.
z %SW93.2 = 1 a rising edge
starts the clean up operation.
%SW94 Application These two words contain a 32-bit - YES NO NO
%SW95 modification value that changes at every
signature application modification except
when:
z updating upload information,
z replacing the initial value with the
current value,
z saving the parameter command.

They can be read by the user


program or by the terminal.

632 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW96 Command and This word is used to copy or delete - YES NO NO
CMDDIAGSAVEREST Diagnostic of the current value of %MW to or from
Save and internal flash memory (see Unity Pro,
Restore Program Languages and Structure,
Reference Manual ) and to give the
action’s status. It can be read by the
user program or by the terminal:
z %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.
z %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.
z %SW96.2 = 1 indicates an error
on a save or restore operation
(see %SW96.8 to 15 for error code
definitions).
z %SW96.3 = 1 indicates that a
restore operation is in progress.
z %SW96.4 may be set to 1 by the
user to delete %MW area in
internal Flash memory.
z %SW96.7 = 1 indicates that
internal memory has valid %MW
backup.
z %SW96.8 to 15 are error codes
when %SW96.2 is set to 1:
z %SW96.9 = 1 indicates that
the saved %MW number is less
than the configured number,
z %SW96.8 = 1 and
%SW96.9 = 1 mean that the
saved %MW number is greater
than the configured number,
z %SW96.8 = 1,
%SW96.9 = 1 and
%SW96.10 = 1 indicate a
write error in internal flash
memory.

33002543 05/2010 633


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW97 Card status Can be read by the user program or - YES NO NO
CARDSTS 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.

%SW99 1 Communication NOTE: This word is used for for 0 NO YES1 NO


INPUTADR/ redundancy Premium and Quantum module but
management(1) has a different function.
SWAP 1
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.

%SW99 2 CRA NOTE: This word is used for 0 NO NO YES2


CRA_COMPAT_ compatibility Premium and Quantum module but
high status has a different function (see Modicon
HIGH 2
register Quantum, Hot Standby with Unity,
User Manual).
Word is inscremented each time a
CCOTF modificatuin is performed in
a PLC.
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.

634 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW100 CCOTF counting Word used to manage the CCOTF 0 NO NO YES
CCOTF_COUNT status register compatibility when a new module is
inserted.
%SW100 = XXYY where:
z XX is incremented each time an
I/O configuration is done in RUN
state in a RIO drop,
z YY is incremented each time an
I/O configuration is done in RUN
state in local rack.

33002543 05/2010 635


System Objects

Description of System Words %SW123 to %SW127

Detailed Description
Description of system words %SW123 to %SW127.

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW123 System This system word is used by the system - YES YES NO
ADJBUSX allowance and cannot be used by the user application
to BUS X
%SW124 Type of The last type of system fault encountered - YES YES YES
CPUERR processor is written into this word by the system
or system (these codes are unchanged on a cold
error restart):
z 16#30: system code fault
z 16#53: time-out fault during I/O
exchanges
z 16#60 to 64: stack overrun
z 16#65: Fast task period of execution is
too low
z 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.
z 16#90: system switch fault: Unforeseen
IT

636 33002543 05/2010


System Objects

Word Function Description Initial Modicon Premium Quantum


Symbol state M340 Atrium
%SW125 Last fault The code of the last fault detected is given - YES YES YES
BLKERRTYPE detected 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:
z 16#2258: execution of HALT instruction
z 16#DE87: calculation error on floating-
point numbers (%S18, these errors are
listed in the word %SW17)
z 16#DEB0: Watchdog overflow (%S11)
z 16#DEF0: division by 0 (%S18)
z 16#DEF1: character string transfer
error (%S15)
z 16#DEF2: arithmetic error; %S18
z 16#DEF3: index overflow (%S20)

NOTE: The following codes 16#8xF4,


16#9xF4, and 16#DEF7 indicate an error
on Sequencial Function Chart (SFC).
%SW126 Blocking Address of the instruction that generated 0 YES YES YES
ERRADDR0 error the application blocking error.
%SW127 instruction For 16 bit processors, TSX P57 1••/2••:
ERRADDR1 address z %SW126 contains the offset for this
address
z %SW127 contains the segment
number for this address.
For 32 bit processors:
z %SW126 contains the least significant
word for this address
z %SW127 contains the most significant
word for this address

33002543 05/2010 637


System Objects

638 33002543 05/2010


Glossary
33002543 05/2010

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.

33002543 05/2010 639


Glossary

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.

640 33002543 05/2010


Glossary

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:

33002543 05/2010 641


Glossary

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.

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.

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:
z The number 2,450
z 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.

642 33002543 05/2010


Glossary

DATE
The DATE type, encoded in BCD in a 32 bit format, contains the following
information:
z the year encoded in a 16 bit field;
z the month encoded in an 8 bit field;
z the day encoded in an 8 bit field.
The DATE type must be entered as follows: D# <Year> - <Month> - <Day>
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)

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:
z The number 78,993,016
z 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).

33002543 05/2010 643


Glossary

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:
z simplify the design and entry of the program;
z make the program easier to read;
z make it easier to debug;
z reduce the amount of code generated.

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:
z the year encoded in a 16 bit field;
z the month encoded in an 8 bit field;
z the day encoded in an 8 bit field;
z the time encoded in an 8 bit field;
z the minutes encoded in an 8 bit field;
z 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>

644 33002543 05/2010


Glossary

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.

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:

Base Lower limit Upper limit


Hexadecimal 16#0 16#FFFFFFFF
Octal 8#0 8#37777777777
Binary 2#0 2#11111111111111111111111111111111

Examples of representation:

Data Representation in one of the bases


00000000000010101101110011011110 16#ADCDE
00000000000000010000000000000000 8#200000
00000000000010101011110011011110 2#10101011110011011110

33002543 05/2010 645


Glossary

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:
z one bit for the value;
z one bit for the history (whenever the object changes state, the value is copied to
the history bit);
z 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).

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.

646 33002543 05/2010


Glossary

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 block's 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):
z the status of the function block outputs remains the same as it was during the
previous scanning cycle that executed correctly;
z the output(s) of the function, as well as the procedures, are set to "0".

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.

33002543 05/2010 647


Glossary

Function Block Diagram


See FBD.

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:

HTTP
Hypertext Transfer Protocol

648 33002543 05/2010


Glossary

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:


z less than -3.402824e+38, the symbol -INF (for -infinity) is displayed;
z 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.

33002543 05/2010 649


Glossary

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.

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).

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)

650 33002543 05/2010


Glossary

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)

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

33002543 05/2010 651


Glossary

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

Multitoken
Operating mode of an SFC. In multitoken mode, the SFC can have several steps
that are active simultaneously.

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.

652 33002543 05/2010


Glossary

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".
z 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.
z 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.

Peer cop
Peer Cop service is a mechanism for automatic exchange between stations
connected on the same Modbus Plus segment.

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.

33002543 05/2010 653


Glossary

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:


z between -1,175494e-38 and 1,175494e-38, it is considered to be a DEN;
z less than -3.402824e+38, the symbol -INF (for - infinity) is displayed;
z greater than +3.402824e+38, the symbol INF (for + infinity) is displayed;
z 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.

654 33002543 05/2010


Glossary

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 PLC's sequential behavior and
of the various resulting situations is created using simple graphic symbols.

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.

33002543 05/2010 655


Glossary

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.

TOD
TOD is the abbreviation of Time Of Day.
The TOD type, encoded in BCD in a 32 bit format, contains the following information:
z the hour encoded in an 8 bit field;
z the minutes encoded in an 8 bit field;
z 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:

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.

Example: TOD#23:59:45.

Token
Active step in an SFC.

656 33002543 05/2010


Glossary

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.

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).

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.

Variable
Memory entity of type BOOL, WORD, DWORD, etc., whose contents can be modified by
the program currently running.

33002543 05/2010 657


Glossary

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:

Base Lower limit Upper limit


Hexadecimal 16#0 16#FFFF
Octal 8#0 8#177777
Binary 2#0 2#1111111111111111

Examples of representation

Data Representation in one of the bases


0000000011010011 16#D3
1010101010101010 8#125252
0000000011010011 2#11010011

658 33002543 05/2010


Index
33002543 05/2010

Index
B
AC
A conditioning - instructions
ALIM, 143
ADD_***_PL7, 377
DEADTIME, 173
AKF_FL, 381
DELAY, 41
AKF_TA, 383
DERIV, 181
AKF_TE, 387
FGEN, 189
AKF_TI, 391
INTEG, 207
AKF_TS, 395
INTEGRATOR1, 47
AKF_TV, 399
LAG, 215
AKF_ZR, 403
LAG1, 53
AKF_ZV, 407
LAG2, 221
AKF_ZVR, 411
LEAD_LAG, 229
ALIM, 143
LEAD_LAG1, 59
array - instructions
LIMV, 67
R2T_***, 533
SMOOTH_RATE, 111
T2T, 579
VLIM, 367
availability of the instructions, 29

C
COMP_PID, 149
COMPARE, 415
comparison - instructions
COMPARE, 415
SRCH, 565

33002543 05/2010 659


Index

controller - instructions DELAY, 41


COMP_PID, 149 DELTA_***, 421
PCON2, 237 DERIV, 181
PCON3, 243 DOWN_PL7_COUNTER, 475
PD_OR_PI, 251 DOWN_PL7_TOF, 503
PDM, 263 DOWN_PL7_TON, 509
PI, 273 DOWN_PL7_TP, 515
PI1, 73 drum - instructions
PID, 283 FSTEP_PL7_DRUM, 437
PID_P, 299 PL7_DRUM, 481
PID1, 83 RESET_PL7_DRUM, 481
PIDP1, 99 UP_PL7_DRUM, 481
PIP, 311 DT_ARINT_TO_STRING, 423
PPI, 325
SCON3, 359
THREE_STEP_CON1, 117 E
THREEPOINT_CON1, 125 END, 427
TWOPOINT_CON1, 133 error codes, 603
conversion - instructions
DATE_DINT_TO_STRING, 417
DT_ARINT_TO_STRING, 423 F
TIME_DINT_TO_STRING, 585 FGEN, 189
TOD_DINT_TO_STRING, 587 FIFO, 429
TRANS_TIME, 589 FPULSOR, 433
R_INT_WORD, 529 FSTEP_PL7_DRUM, 437
R_UINT_WORD, 531 FTOF, 439
R2T_***, 533 FTON, 443
W_INT_REAL, 591 FTP, 447
W_UINT_REAL, 593
counter - instructions
SCOUNT, 547 G
AKF_ZR, 403 GET_3X, 451
AKF_ZV, 407 GET_4X, 453
AKF_ZVR, 411 GET_BIT, 455
DOWN_PL7_COUNTER, 475 GET_PL7_REGISTER_255, 497
PL7_COUNTER, 475 GET_PL7_REGISTER_32, 493
PRESET_PL7_COUNTER, 475
RESET_PL7_COUNTER, 475
UP_PL7_COUNTER, 475 H
HIGH_INT, 457
D
DATE_DINT_TO_STRING, 417
DAY_OF_WEEK, 419
DEADTIME, 173

660 33002543 05/2010


Index

I P
IEC_BMDI, 459 PCMCIA card - instructions
instructions READ_PCMCIA, 537
availability, 29 SET_PCMCIA, 555
INTEG, 207 WRITE_PCMCIA, 595
INTEGRATOR1, 47 PCON2, 237
PCON3, 243
PD_OR_PI, 251
L PDM, 263
LAG, 215 PI, 273
LAG1, 53 PI1, 73
LAG2, 221 PID, 283
LEAD_LAG, 229 PID_P, 299
LEAD_LAG1, 59 PID1, 83
LIFO, 467 PIDP1, 99
LIMV, 67 PIP, 311
logical - instructions PL7_3_TIMER, 521
HIGH_INT, 457 PL7_COUNTER, 475
LOW_INT, 471 PL7_DRUM, 481
AKF_FL, 381 PL7_MONOSTABLE, 487
PL7_MONOSTABLE, 487 PL7_REGISTER_255, 497
SET_BIT, 553 PL7_REGISTER_32, 493
START_PL7_MONOSTABLE, 487 PL7_TOF, 503
LOW_INT, 471 PL7_TON, 509
PL7_TP, 515
PPI, 325
M PRESET_PL7_3_TIMER, 521
mathematical - instructions PRESET_PL7_COUNTER, 475
ADD_***_PL7, 377 PUT_4X, 527
DELTA_***, 421 PUT_PL7_REGISTER_255, 497
IEC_BMDI, 459 PUT_PL7_REGISTER_32, 493
MUX_DINTARR_125, 473 PWM, 339
STR_ROUND, 571
SUB_***_PL7, 573
T2T, 579 Q
MUX_DINTARR_125, 473 QPWM, 351

O
output processing - instructions
PWM, 339
QPWM, 351

33002543 05/2010 661


Index

R START_PL7_MONOSTABLE, 487
START_PL7_TOF, 503
R_INT_WORD, 529
START_PL7_TON, 509
R_UINT_WORD, 531
START_PL7_TP, 515
R2T_***, 533
STOP_PL7_3_TIMER, 521
READ_PCMCIA, 537
STR_ROUND, 571
register management - instructions
string management - instructions
FIFO, 429
DATE_DINT_TO_STRING, 417
GET_3X, 451
DT_ARINT_TO_STRING, 423
GET_4X, 453
END, 427
GET_BIT, 455
TIME_DINT_TO_STRING, 585
GET_PL7_REGISTER_255, 497
TOD_DINT_TO_STRING, 587
GET_PL7_REGISTER_32, 493
STR_ROUND, 571
LIFO, 467
SUB_***_PL7, 573
PL7_REGISTER_255, 497
SYSSTATE, 577
PL7_REGISTER_32, 493
system specials - instructions
PUT_4X, 527
SYSSTATE, 577
PUT_PL7_REGISTER_255, 497
system time and date - instructions
PUT_PL7_REGISTER_32, 493
DAY_OF_WEEK, 419
RESET_PL7_REGISTER_255, 497
RRTC, 545
RESET_PL7_REGISTER_32, 493
WRTC, 599
ROR1_ARB, 543
SHL_RBIT_***, 557
SHR_RBIT_***, 559
SHRZ_***, 561
SHRZ_RBIT_***, 563
RESET_PL7_COUNTER, 475
RESET_PL7_DRUM, 481
RESET_PL7_REGISTER_255, 497
RESET_PL7_REGISTER_32, 493
ROR1_ARB, 543
RRTC, 545

S
SCON3, 359
SCOUNT, 547
SET_BIT, 553
SET_PCMCIA, 555
SHL_RBIT_***, 557
SHR_RBIT_***, 559
SHRZ_***, 561
SHRZ_RBIT_***, 563
SMOOTH_RATE, 111
SRCH, 565
START_PL7_3_TIMER, 521

662 33002543 05/2010


Index

T W_UINT_REAL, 593
WRITE_PCMCIA, 595
T2T, 579
WRTC, 599
THREE_STEP_CON1, 117
THREEPOINT_CON1, 125
TIME_DINT_TO_STRING, 585
timer - instructions
DOWN_PL7_TON, 509
FPULSOR, 433
FTOF, 439
FTON, 443
FTP, 447
PL7_TON, 509
START_PL7_TON, 509
AKF_TA, 383
AKF_TE, 387
AKF_TI, 391
AKF_TS, 395
AKF_TV, 399
DOWN_PL7_TOF, 503
DOWN_PL7_TP, 515
PL7_3_TIMER, 521
PL7_TOF, 503
PL7_TP, 515
PRESET_PL7_3_TIMER, 521
START_PL7_3_TIMER, 521
START_PL7_TOF, 503
START_PL7_TP, 515
STOP_PL7_3_TIMER, 521
TOD_DINT_TO_STRING, 587
TRANS_TIME, 589
TWOPOINT_CON1, 133

U
UP_PL7_COUNTER, 475
UP_PL7_DRUM, 481

V
VLIM, 367

W
W_INT_REAL, 591

33002543 05/2010 663


Index

664 33002543 05/2010

Das könnte Ihnen auch gefallen