EcoStruxure Machine Expert Guide
EcoStruxure Machine Expert Guide
EIO0000002854 06/2019
EcoStruxure Machine
Expert
Programming Guide
06/2019
EIO0000002854.00
[Link]
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.
You agree not to reproduce, other than for your own personal, noncommercial use, all or part of
this document on any medium whatsoever without permission of Schneider Electric, given in
writing. You also agree not to establish any hypertext links to this document or its content.
Schneider Electric does not grant any right or license for the personal and noncommercial use of
the document or its content, except for a non-exclusive license to consult it on an "as is" basis, at
your own risk. All other rights are reserved.
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.
© 2019 Schneider Electric. All rights reserved.
2 EIO0000002854 06/2019
Table of Contents
Safety Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Part I Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 1 General Introduction to the EcoStruxure Machine Expert
Logic Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
What is the EcoStruxure Machine Expert Logic Builder? . . . . . . . . . . 30
Tasks Performed by the EcoStruxure Machine Expert Logic Builder . 31
Chapter 2 EcoStruxure Machine Expert Logic Builder User Interface 33
Elements of the EcoStruxure Machine Expert Logic Builder Screen. . 34
Multi-Tabbed Navigators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Functional tree. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Multi-Tabbed Catalog View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Customizing the User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
User Interface in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Menus and Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Chapter 3 Basic Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Introduction and Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Part II Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Chapter 4 Installing Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Integration of Sercos Devices from Third-Party Vendors . . . . . . . . . . 63
Chapter 5 Managing Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.1 Adding Devices by Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Adding Devices by Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
5.2 Adding Devices by Contextual Menu or Plus Button . . . . . . . . . . . . . . 69
Adding a Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Adding Expansion Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Adding Communication Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Adding Devices to a Communication Manager . . . . . . . . . . . . . . . . . . 74
Adding Devices from Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.3 Updating Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Updating Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
5.4 Converting Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Converting Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
EIO0000002854 06/2019 3
5.5 Converting Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Converting SoMachine Basic and Twido Projects . . . . . . . . . . . . . . . . 81
Chapter 6 Common Device Editor Dialogs . . . . . . . . . . . . . . . . . . . . 101
6.1 Device Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
General Information About Device Editors. . . . . . . . . . . . . . . . . . . . . . 103
Communication Settings in Controller Selection Mode . . . . . . . . . . . . 105
Communication Settings in Simple Mode . . . . . . . . . . . . . . . . . . . . . . 125
Communication Settings in Classic Mode . . . . . . . . . . . . . . . . . . . . . . 128
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Synchronized Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
PLC Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Users and Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Access Rights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Task Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
6.2 I/O Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
I/O Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Working with the I/O Mapping Dialog. . . . . . . . . . . . . . . . . . . . . . . . . . 158
I/O Mapping in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Implicit Variables for Forcing I/Os . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Part III Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Chapter 7 Program Components . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.1 Program Organization Unit (POU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
POU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Adding and Calling POU Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Transition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
POUs for Implicit Checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
4 EIO0000002854 06/2019
7.2 Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
General Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Function Block Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Calling a Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Configuring a Memory Reserve for the Online Change of Function
Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Extension of a Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Implementing Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Method Invocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
SUPER Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
THIS Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
7.3 Application Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Data Type Unit (DUT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Global Variable List - GVL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Network Variable List (Receiver) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Persistent Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
External File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Text List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Image Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
7.4 Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Chapter 8 Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Adding Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Chapter 9 Managing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . 249
9.1 General Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
9.2 Building and Downloading Applications. . . . . . . . . . . . . . . . . . . . . . . . 252
Building Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Build Process at Changed Applications. . . . . . . . . . . . . . . . . . . . . . . . 256
Downloading an Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
9.3 Running Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Running Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
9.4 Maintaining Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Core Dump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
EIO0000002854 06/2019 5
Programming Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Refactoring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Static Analysis Light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Creating an Archive in Your Controller on Download. . . . . . . . . . . . . . 287
Part IV Logic Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Chapter 10 Common Features of Graphic Editors . . . . . . . . . . . . . . . 291
Common Features of Graphic Editors . . . . . . . . . . . . . . . . . . . . . . . . . 291
Chapter 11 FBD/LD/IL Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
11.1 Information on the FBD/LD/IL Editor . . . . . . . . . . . . . . . . . . . . . . . . . . 294
FBD/LD/IL Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Function Block Diagram (FBD) Language . . . . . . . . . . . . . . . . . . . . . . 296
Ladder Diagram (LD) Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Instruction List (IL) Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Modifiers and Operators in IL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Working in the FBD and LD Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Working in the IL Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Cursor Positions in FBD, LD, and IL . . . . . . . . . . . . . . . . . . . . . . . . . . 316
FBD/LD/IL Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
FBD/LD/IL Editor in Online Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
11.2 FBD/LD/IL Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
FBD/LD/IL Toolbox. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Network in FBD/LD/IL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Assignment in FBD/LD/IL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Jump in FBD/LD/IL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Label in FBD/LD/IL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
Boxes in FBD/LD/IL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
RETURN Instruction in FBD/LD/IL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
Branch / Hanging Coil in FBD/LD/IL. . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Parallel Branch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Branch Start / End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Set/Reset in FBD/LD/IL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Set/Reset Coil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Execute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
11.3 LD Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Contact. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Coil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
6 EIO0000002854 06/2019
Chapter 12 Continuous Function Chart (CFC) Editor . . . . . . . . . . . . 351
Continuous Function Chart (CFC) Language . . . . . . . . . . . . . . . . . . . 352
CFC Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
Cursor Positions in CFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
CFC Elements / ToolBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Working in the CFC Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
CFC Editor in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
CFC Editor Page-Oriented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Chapter 13 Sequential Function Chart (SFC) Editor . . . . . . . . . . . . . 371
SFC Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
SFC - Sequential Function Chart Language . . . . . . . . . . . . . . . . . . . . 374
Cursor Positions in SFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Working in the SFC Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
SFC Element Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
SFC Elements / ToolBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Qualifier for Actions in SFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Implicit Variables - SFC Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Sequence of Processing in SFC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
SFC Editor in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Chapter 14 Structured Text (ST) Editor. . . . . . . . . . . . . . . . . . . . . . . 401
14.1 Information on the ST Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
ST Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
ST Editor in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
14.2 Structured Text ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
Structured Text ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Part V Object Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Chapter 15 Declaration Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
Textual Declaration Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Tabular Declaration Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Declaration Editor in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Chapter 16 Device Type Manager (DTM) Editor . . . . . . . . . . . . . . . . 433
DTM Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Chapter 17 Data Unit Type (DUT) Editor. . . . . . . . . . . . . . . . . . . . . . 435
Data Unit Type Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
Chapter 18 Global Variables List (GVL) Editor . . . . . . . . . . . . . . . . . 437
GVL Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
EIO0000002854 06/2019 7
Chapter 19 Network Variables List (NVL) Editor . . . . . . . . . . . . . . . . . 439
19.1 Information on the NVL Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Network Variables List Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
19.2 General Information on Network Variables . . . . . . . . . . . . . . . . . . . . . 441
Introduction to Network Variables List (NVL) . . . . . . . . . . . . . . . . . . . . 442
Configuring the Network Variables Exchange . . . . . . . . . . . . . . . . . . . 446
Network Variables List (NVL) Rules. . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Operating State of the Sender and the Receiver . . . . . . . . . . . . . . . . . 455
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Compatibility. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Chapter 20 Task Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Information on the Task Configuration . . . . . . . . . . . . . . . . . . . . . . . . . 466
Properties Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
System Events Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Monitor Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Variable Usage Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
Configuration of a Specific Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Task Processing in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
Chapter 21 Watch List Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
Watch View / Watch List Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Creating a Watch List. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
Watch List in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Chapter 22 Tools Within Logic Editors . . . . . . . . . . . . . . . . . . . . . . . . 485
Function and Function Block Finder. . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Input Assistant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
Part VI Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Chapter 23 Data Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Introduction to Data Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Chapter 24 Recipe Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Recipe Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Recipe Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
RecipeMan Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Loading Recipe Values from the Controller . . . . . . . . . . . . . . . . . . . . . 514
Memory Usage by Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
Chapter 25 Trace Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
25.1 Trace Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Trace Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Creating a Trace Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
8 EIO0000002854 06/2019
25.2 Trace Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Trace Configuration - Tree Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526
Variable Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
Record Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
Display Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
Advanced Trace Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
Display Settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
25.3 Trace Editor in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
Trace Editor in Online Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
25.4 Keyboard Operations for Trace Diagrams . . . . . . . . . . . . . . . . . . . . . . 543
Keyboard Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
Chapter 26 Trend Recording . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
26.1 Trend Recording Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
Trend Recording Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Trend Recording Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
26.2 Trend Recording Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Trend Recording Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
Record Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
Variable Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
Steps for Trend Recording Configuration . . . . . . . . . . . . . . . . . . . . . . 556
26.3 Recording Trend Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
Start the Recording Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
Chapter 27 Unit Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Unit Conversion Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
Usage in IEC Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Chapter 28 Symbol Configuration Editor . . . . . . . . . . . . . . . . . . . . . . 567
Symbol Configuration Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
Symbol Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Adding a Symbol Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
Chapter 29 EcoStruxure Machine Expert Controller - HMI Data
Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
EcoStruxure Machine Expert Single Variable Definition . . . . . . . . . . . 578
Publishing Variables in the Controller Part . . . . . . . . . . . . . . . . . . . . . 582
Selecting Variables in the HMI Part . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
Publishing Variables in the HMI Part . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Parameterization of the Physical Media . . . . . . . . . . . . . . . . . . . . . . . 587
Communication Performance on Controller - HMI Data Exchange . . . 588
Indications for HMI Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
EIO0000002854 06/2019 9
Chapter 30 Cam Motion Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
30.1 Cam Motion Editor - General Information . . . . . . . . . . . . . . . . . . . . . . 594
General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Adding a Cam Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
Opening the Motion Editor of a Cam Object . . . . . . . . . . . . . . . . . . . . 597
30.2 Generating IEC Program Code from Cam Data. . . . . . . . . . . . . . . . . . 598
Using Cam Data for Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . 599
Copying the Source Code of the Cam Diagram. . . . . . . . . . . . . . . . . . 601
30.3 Online View and Functions of the Cam Motion Editor . . . . . . . . . . . . . 602
Online View and Functions of the Cam Motion Editor . . . . . . . . . . . . . 602
30.4 Discontinuous Courses of the Positions. . . . . . . . . . . . . . . . . . . . . . . . 603
Discontinuous Courses of the Positions. . . . . . . . . . . . . . . . . . . . . . . . 603
30.5 Dialog Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
Motion Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
Generating IEC Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
Part VII Programming Reference . . . . . . . . . . . . . . . . . . . . . 617
Chapter 31 Variables Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
31.1 Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
Recommendations on the Naming of Identifiers . . . . . . . . . . . . . . . . . 624
Variables Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 630
Shortcut Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
AT Declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
31.2 Variable Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
Variable Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Attribute Keywords for Variable Types. . . . . . . . . . . . . . . . . . . . . . . . . 641
Variables Configuration - VAR_CONFIG . . . . . . . . . . . . . . . . . . . . . . . . 645
31.3 Method Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
FB_Init, FB_Reinit, and FB_ExitMethods. . . . . . . . . . . . . . . . . . 647
31.4 Pragma Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652
Pragma Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Message Pragmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656
Conditional Pragmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
Region Pragmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666
10 EIO0000002854 06/2019
31.5 Attribute Pragmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667
Attribute Pragmas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
User-Defined Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
Attribute call_after_global_init_slot. . . . . . . . . . . . . . . 672
Attribute call_after_init. . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
Attribute call_after_online_change_slot . . . . . . . . . . . . 674
Attribute call_before_global_exit_slot. . . . . . . . . . . . . . 675
Attribute call_on_type_change . . . . . . . . . . . . . . . . . . . . . . . 676
Attribute const_replaced, Attribute const_non_repla
ced . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
Attribute 'dataflow' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
Attribute displaymode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
Attribute estimated-stack-usage . . . . . . . . . . . . . . . . . . . . . 680
Attribute ExpandFully . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Attribute global_init_slot. . . . . . . . . . . . . . . . . . . . . . . . . . . 682
Attribute hide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
Attribute hide_all_locals. . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
Attribute initialize_on_call . . . . . . . . . . . . . . . . . . . . . . . . 686
Attribute init_namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
Attribute init_On_Onlchange . . . . . . . . . . . . . . . . . . . . . . . . . 688
Attribute instance-path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
Attribute linkalways . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
Attribute monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Attribute namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
Attribute no_assign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
Attribute no_check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698
Attribute no_copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
Attribute no-exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700
Attribute no_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
Attribute no_instance_in_retain . . . . . . . . . . . . . . . . . . . . . 702
Attribute no_virtual_actions . . . . . . . . . . . . . . . . . . . . . . . . 703
Attribute pingroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705
Attribute pin_presentation_order_inputs/outputs . . . . 707
Attribute obsolete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709
Attribute pack_mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710
Attribute qualified_only. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Attribute reflection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
EIO0000002854 06/2019 11
Attribute subsequent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
Attribute symbol. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
Attribute warning disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716
Attribute enable_dynamic_creation . . . . . . . . . . . . . . . . . . . 717
31.6 The Smart Coding Functionality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
Smart Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
Chapter 32 Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
32.1 General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
32.2 Standard Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
Standard Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
32.3 Extensions to IEC Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
UNION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
BIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
32.4 User-Defined Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738
Defined Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739
Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744
Enumerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
Subrange Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
Chapter 33 Programming Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . 753
33.1 Naming Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
33.2 Prefixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
Prefix Parts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
Order of Prefixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
Scope Prefix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760
Data Type Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761
Property Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763
POU Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 764
Namespace Prefix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765
Chapter 34 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
34.1 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768
ADD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769
MUL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771
SUB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
12 EIO0000002854 06/2019
DIV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
MOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 778
MOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
SIZEOF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781
34.2 Bitstring Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782
AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 784
XOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
34.3 Bit-Shift Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
SHL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788
SHR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
ROL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
ROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 793
34.4 Selection Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795
SEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
MIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798
LIMIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799
MUX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800
34.5 Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801
GT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
LT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803
LE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804
GE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805
EQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
NE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 807
34.6 Address Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
ADR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
Content Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
BITADR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
34.7 Calling Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812
CAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 812
34.8 Type Conversion Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
Type Conversion Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 814
BOOL_TO Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815
TO_BOOL Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
Conversion Between Integral Number Types . . . . . . . . . . . . . . . . . . . 819
EIO0000002854 06/2019 13
REAL_TO / LREAL_TO Conversions. . . . . . . . . . . . . . . . . . . . . . . . . . 820
TIME_TO/TIME_OF_DAY Conversions . . . . . . . . . . . . . . . . . . . . . . . . 822
DATE_TO/DT_TO Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824
STRING_TO Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 826
TRUNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828
TRUNC_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829
ANY_..._TO Conversions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 830
TO_<xxx> Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831
34.9 Numeric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 832
ABS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833
SQRT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
LN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
LOG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836
EXP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837
SIN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838
COS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839
TAN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
ASIN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841
ACOS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842
ATAN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
EXPT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844
34.10 IEC Extending Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
IEC Extending Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 846
__DELETE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847
__ISVALIDREF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850
__NEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 851
__QUERYINTERFACE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854
__QUERYPOINTER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 856
AND_THEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
OR_ELSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859
__TRY, __CATCH, __FINALLY, __ENDTRY . . . . . . . . . . . . . . . . . 860
__VARINFO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863
Scope Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865
34.11 Initialization Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867
INI Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867
14 EIO0000002854 06/2019
Chapter 35 Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869
35.1 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870
BOOL Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871
TIME Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 872
DATE Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874
DATE_AND_TIME Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
TIME_OF_DAY Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 876
Number Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877
REAL/LREAL Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878
String Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
Typed Constants / Typed Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881
35.2 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 882
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
Addressing Bits in Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 884
35.3 Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887
Direct Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887
35.4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889
Part VIII EcoStruxure Machine Expert Templates . . . . . . . . . 891
Chapter 36 General Information about Templates . . . . . . . . . . . . . . 893
36.1 EcoStruxure Machine Expert Templates . . . . . . . . . . . . . . . . . . . . . . . 894
General Information About EcoStruxure Machine Expert Templates . 895
Administration of EcoStruxure Machine Expert Templates . . . . . . . . . 897
Chapter 37 Managing Device Templates . . . . . . . . . . . . . . . . . . . . . 905
37.1 Managing Device Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906
Facts of Device Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907
Adding Devices from Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908
Creating a Device Template on the Basis of Field Devices or I/O
Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911
Visualizations Suitable for Creating Device Templates . . . . . . . . . . . . 912
Further Information on Integrating Control Logic into Device Templates 913
Steps to Create a Device Template. . . . . . . . . . . . . . . . . . . . . . . . . . . 915
Chapter 38 Managing Function Templates . . . . . . . . . . . . . . . . . . . . 919
38.1 Managing Function Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920
Facts of Function Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
Adding Functions from Template. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 922
Application Functions as Basis for Function Templates . . . . . . . . . . . 928
Steps to Create a Function Template . . . . . . . . . . . . . . . . . . . . . . . . . 930
EIO0000002854 06/2019 15
Part IX Troubleshooting and FAQ . . . . . . . . . . . . . . . . . . . . 935
Chapter 39 Generic - Troubleshooting and FAQ. . . . . . . . . . . . . . . . . 937
39.1 Frequently Asked Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938
How Can I Enable and Configure Analog Inputs on CANopen? . . . . . 939
Why is EcoStruxure Machine Expert Startup Performance Sometimes
Slower? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940
How Can I Manage Shortcuts and Menus? . . . . . . . . . . . . . . . . . . . . . 941
How Can I Increase the Memory Limit Available for EcoStruxure
Machine Expert on 32-Bit Operating Systems? . . . . . . . . . . . . . . . . . . 943
How Can I Reduce the Memory Consumption of EcoStruxure Machine
Expert?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 944
How Can I Increase the Build-Time Performance of EcoStruxure
Machine Expert? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945
What Can I Do in Case of Issues with Modbus IOScanner on Serial
Line? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946
What Can I Do If My Network Variables List (NVL) Communication Has
Been Suspended? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947
Chapter 40 Accessing Controllers - Troubleshooting and FAQ . . . . . 949
40.1 Troubleshooting: Accessing New Controllers . . . . . . . . . . . . . . . . . . . 950
Accessing New Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951
Connecting via IP Address and Address Information. . . . . . . . . . . . . . 953
40.2 FAQ - What Can I Do in Case of Connection Problems With the
Controller? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 955
FAQ - Why is a Connection to the Controller not Possible? . . . . . . . . 956
FAQ - Why has the Communication Between PC and Controller been
Interrupted? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961
Appendix A Network Communication . . . . . . . . . . . . . . . . . . . . . . . . . 963
Network Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
Addressing and Routing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965
Structure of Addresses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967
Appendix B Python Script Language . . . . . . . . . . . . . . . . . . . . . . . . . . 971
B.1 General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 972
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973
Accessing the Python Interpreter in EcoStruxure Machine Expert . . . 976
Using the Logic Builder Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 981
Using the Logic Builder Scripting Immediate View. . . . . . . . . . . . . . . . 989
Keyboard Commands in the Logic Builder Shell and the Scripting
Immediate View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 992
Explore EcoStruxure Machine Expert Python API (with dir() and
inspectapi) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 993
16 EIO0000002854 06/2019
Using Logic Builder Shell with Microsoft Visual Studio and PTVS . . . 998
Using Logic Builder Shell with JetBrains PyCharm . . . . . . . . . . . . . . . 1004
Using Logic Builder Shell with Microsoft Visual Studio Code and
Python Extension. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008
Executing Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1012
Best Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1014
Reading .NET API Documentations . . . . . . . . . . . . . . . . . . . . . . . . . . 1016
EcoStruxure Machine Expert Python API . . . . . . . . . . . . . . . . . . . . . . 1018
EcoStruxure Machine Expert Scripting - Python API. . . . . . . . . . . . . . 1019
Calling Scripts Via Toolbar Icons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024
B.2 Schneider Electric Script Engine Examples . . . . . . . . . . . . . . . . . . . . 1026
New Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1027
Device Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1029
Compiler Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1031
Visualization Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1032
Update Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1034
Update Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1035
Clean and Build Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1036
Communication Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1037
Start ETEST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1038
Reset Diagnostic Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1040
Reboot the Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1041
Convert Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1042
Comparing Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046
Advanced Library Management Functions . . . . . . . . . . . . . . . . . . . . . 1047
Accessing POUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048
B.3 CoDeSys Script Engine Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 1050
Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1051
Online Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1060
Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063
Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1064
System / User Interface (UI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1069
Reading Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1073
Reading Values From Recipe and Send an Email . . . . . . . . . . . . . . . 1075
Determine Device Tree of the Open Project . . . . . . . . . . . . . . . . . . . . 1077
Script Example 4: Import a Device in PLCOpenXML From Subversion 1078
EIO0000002854 06/2019 17
Script Example 5: Creating and Editing POUs. . . . . . . . . . . . . . . . . . . 1080
Script Example 6: User Interface / Interaction with the User . . . . . . . . 1081
Script Example 7: Manipulation of the Project information Object . . . . 1083
Advanced Example: Checkout a Library from SVN and Installation in
EcoStruxure Machine Expert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1084
Appendix C Controller Feature Sets for Migration . . . . . . . . . . . . . . . . 1085
Controller Feature Sets for Migration . . . . . . . . . . . . . . . . . . . . . . . . . . 1085
Appendix D Know-How Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089
Know-How Protection of Projects and Libraries. . . . . . . . . . . . . . . . . . 1089
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1091
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095
18 EIO0000002854 06/2019
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, service, 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.
EIO0000002854 06/2019 19
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of
the use of this material.
A qualified person is one who has skills and knowledge related to the construction and operation
of electrical equipment and its installation, and has received safety training to recognize and avoid
the hazards involved.
20 EIO0000002854 06/2019
About the Book
At a Glance
Document Scope
This document describes the graphical user interface of the EcoStruxure Machine Expert software
and the functions it provides. For further information, refer to the separate documents provided in
the EcoStruxure Machine Expert online help.
Validity Note
This document has been updated for the release of EcoStruxureTM Machine Expert V1.1.
Related Documents
EIO0000002854 06/2019 21
Document title Reference
EcoStruxure Machine Expert Controller Assistant EIO0000001671 (ENG);
User Guide EIO0000001672 (FRE);
EIO0000001673 (GER);
EIO0000001675 (SPA);
EIO0000001674 (ITA);
EIO0000001676 (CHS)
EcoStruxure Machine Expert Device Type Manager EIO0000003047 (ENG);
(DTM) User Guide EIO0000003048 (FRE);
EIO0000003049 (GER);
EIO0000003051 (SPA);
EIO0000003050 (ITA);
EIO0000003052 (CHS)
EcoStruxure Machine Expert TwidoEmulationSupport EIO0000001692 (ENG);
Library Guide EIO0000001693 (FRE);
EIO0000001694 (GER);
EIO0000001696 (SPA);
EIO0000001695 (ITA);
EIO0000001697 (CHS)
EcoStruxure Machine Expert Network Variable EIO0000002974 (ENG);
Configuration SE_NetVarUdp Library Guide EIO0000002975 (FRE);
EIO0000002976 (GER);
EIO0000002978 (SPA);
EIO0000002977 (ITA);
EIO0000002979 (CHS)
You can download these technical publications and other technical information from our website
at [Link]/en/download.
22 EIO0000002854 06/2019
Product Related Information
WARNING
LOSS OF CONTROL
The designer of any control scheme must consider the potential failure modes of control paths
and, for certain critical control functions, provide a means to achieve a safe state during and
after a path failure. Examples of critical control functions are emergency stop and overtravel
stop, power outage and restart.
Separate or redundant control paths must be provided for critical control functions.
System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
Observe all accident prevention regulations and local safety guidelines.1
Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
1For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control" and to NEMA ICS 7.1 (latest
edition), "Safety Standards for Construction and Guide for Selection, Installation and Operation of
Adjustable-Speed Drive Systems" or their equivalent governing your particular location.
WARNING
UNINTENDED EQUIPMENT OPERATION
Only use software approved by Schneider Electric for use with this equipment.
Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000002854 06/2019 23
Terminology Derived from Standards
The technical terms, terminology, symbols and the corresponding descriptions in this manual, or
that appear in or on the products themselves, are generally derived from the terms or definitions
of international standards.
In the area of functional safety systems, drives and general automation, this may include, but is not
limited to, terms such as safety, safety function, safe state, fault, fault reset, malfunction, failure,
error, error message, dangerous, etc.
Among others, these standards include:
Standard Description
IEC 61131-2:2007 Programmable controllers, part 2: Equipment requirements and tests.
ISO 13849-1:2015 Safety of machinery: Safety related parts of control systems.
General principles for design.
EN 61496-1:2013 Safety of machinery: Electro-sensitive protective equipment.
Part 1: General requirements and tests.
ISO 12100:2010 Safety of machinery - General principles for design - Risk assessment and risk
reduction
EN 60204-1:2006 Safety of machinery - Electrical equipment of machines - Part 1: General
requirements
ISO 14119:2013 Safety of machinery - Interlocking devices associated with guards - Principles
for design and selection
ISO 13850:2015 Safety of machinery - Emergency stop - Principles for design
IEC 62061:2015 Safety of machinery - Functional safety of safety-related electrical, electronic,
and electronic programmable control systems
IEC 61508-1:2010 Functional safety of electrical/electronic/programmable electronic safety-
related systems: General requirements.
IEC 61508-2:2010 Functional safety of electrical/electronic/programmable electronic safety-
related systems: Requirements for electrical/electronic/programmable
electronic safety-related systems.
IEC 61508-3:2010 Functional safety of electrical/electronic/programmable electronic safety-
related systems: Software requirements.
IEC 61784-3:2016 Industrial communication networks - Profiles - Part 3: Functional safety
fieldbuses - General rules and profile definitions.
2006/42/EC Machinery Directive
2014/30/EU Electromagnetic Compatibility Directive
2014/35/EU Low Voltage Directive
24 EIO0000002854 06/2019
In addition, terms used in the present document may tangentially be used as they are derived from
other standards such as:
Standard Description
IEC 60034 series Rotating electrical machines
IEC 61800 series Adjustable speed electrical power drive systems
IEC 61158 series Digital data communications for measurement and control – Fieldbus for use in
industrial control systems
Finally, the term zone of operation may be used in conjunction with the description of specific
hazards, and is defined as it is for a hazard zone or danger zone in the Machinery Directive
(2006/42/EC) and ISO 12100:2010.
NOTE: The aforementioned standards may or may not apply to the specific products cited in the
present documentation. For more information concerning the individual standards applicable to the
products described herein, see the characteristics tables for those product references.
EIO0000002854 06/2019 25
26 EIO0000002854 06/2019
EcoStruxure Machine Expert
Introduction
EIO0000002854 06/2019
Part I
Introduction
Introduction
EIO0000002854 06/2019 27
Introduction
28 EIO0000002854 06/2019
EcoStruxure Machine Expert
General Introduction to the EcoStruxure Machine Expert Logic Builder
EIO0000002854 06/2019
Chapter 1
General Introduction to the EcoStruxure Machine Expert Logic Builder
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 29
General Introduction to the EcoStruxure Machine Expert Logic Builder
General Description
The Logic Builder provides the configuration and programming environment for EcoStruxure
Machine Expert projects.
It displays the different elements of your project in separate views that you can arrange on the
EcoStruxure Machine Expert user interface and on your desktop according to your individual
requirements. This view structure allows you to add hardware and software elements to your
project by drag and drop. The main configuration dialog boxes that allow you to create content for
the project are provided in the center of the Logic Builder screen.
In addition to easy configuration and programming, the Logic Builder also provides powerful
diagnostic and maintenance features.
30 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
General Introduction to the EcoStruxure Machine Expert Logic Builder
Building Projects
The Logic Builder provides different ways (such as Build, Build all, or Clean all) to build your
EcoStruxure Machine Expert project.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 31
General Introduction to the EcoStruxure Machine Expert Logic Builder
32 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
EcoStruxure Machine Expert Logic Builder User Interface
EIO0000002854 06/2019
Chapter 2
EcoStruxure Machine Expert Logic Builder User Interface
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 33
EcoStruxure Machine Expert Logic Builder User Interface
Overview
Logic Builder consists of the following elements:
Menus and toolbars
Navigator views
Catalog views
Main editor pane
When you open the Logic Builder, it provides a default screen layout. This document describes the
default positions.
You can adapt the elements according to your individual requirements as described in the
Customizing the User Interface chapter (see page 51). You can see and modify the present
settings in the Customize dialog box. It is by default available in the Tools menu.
You can also arrange the views and windows anytime via shifting, docking/undocking views,
resizing or closing windows. The positions are saved with the project. When you reopen a project,
the elements are placed at the positions where they were when the project was saved. The
positions of views are saved separately in perspectives (see page 53).
34 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
1 Menu bar
2 Toolbar
3 Multi-tabbed Navigators: Devices tree, Tools tree, Applications tree, Functional tree
4 Messages view
5 Information and status bar
6 Multi-tabbed catalog view: hardware catalog: Controller, HMI & iPC, Devices & Modules, Diverse software
catalog: Variables, Assets. Macros, ToolBox, Libraries
7 Multi-tabbed editor view
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 35
EcoStruxure Machine Expert Logic Builder User Interface
Default Components
The Logic Builder screen contains the following components that are visible by default:
Component Description
Menu bar Provides menus which contain the available commands as defined in
the Tools → Customize dialog box.
Toolbar Contains buttons to execute the available tools as defined in the Tools
→ Customize dialog box.
Multi-tabbed Navigators The following Navigators are available as tabs where the different
objects of a project are organized in a tree structure:
Devices tree
Applications tree
Tools tree
Functional tree
Software Catalog
Variables
Assets
Macros
ToolBox
Libraries
36 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Component Description
Multi-tabbed editor window Used for creating the particular object in the respective editor.
In the case of language editors (for example, ST editor, CFC editor),
usually the window combines the language editor in the lower part and
the declaration editor in the upper part.
In the case of other editors, it can provide dialog boxes (for example,
task editor, device editor). The name of the POU or the resource object
is displayed in the title bar of this view. You can open the objects in the
editor window in offline or online mode by executing the Edit Object
command.
Abbreviation Description
Ln Line in which the cursor is placed.
Col Column in which the cursor is placed.
(A column includes exactly one space, character, or digit.)
Ch Number of characters.
(In this context, a character can be a single character or digit as well as a tab
including, for example, four columns.)
Double-click one of the fields to open the dialog box Go To Line. Here you can enter a different
position where the cursor is placed.
The status of the editing mode is indicated by the following abbreviations:
Abbreviation Description
INS Insert mode
OVR Overwrite mode
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 37
EcoStruxure Machine Expert Logic Builder User Interface
Text Description
Program loaded Program loaded on device.
Program unchanged Program on device matches that in the programming system.
Program modified (Online Program on device differs from that in the programming system, online
Change) change required.
Program modified (Full Program on device differs from that in the programming system, full download
download) required.
38 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Switching Windows
EcoStruxure Machine Expert allows you to switch between open views and editors. To switch
between open views and editors, press the Ctrl and Tab keys simultaneously. A window opens that
lists the views and editors that are open. As long as the Ctrl key is pressed the window stays open.
Use the Tab key or the Arrow keys simultaneously to select a specific view or editor.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 39
EcoStruxure Machine Expert Logic Builder User Interface
Multi-Tabbed Navigators
Overview
The multi-tabbed Navigators are default components of the Logic Builder screen.
By default, the following navigators are available:
Devices tree: It allows you to manage the devices on which the application is to run.
Applications tree: It allows you to manage project-specific as well as global POUs, and tasks in
a single view.
Tools tree: It allows you to manage project-specific as well as global libraries or other elements
in a single view.
Functional tree: It allows you to group the content of a controller according to your individual
requirements.
You can access views via the View menu.
Repositioning Objects
To reposition objects, use the clipboard commands (Cut, Copy, Paste, Delete) from the Edit menu.
Alternatively, you can drag the selected object with the mouse while the mouse-button (plus CTRL
key for copying) is pressed. When you add devices using the copy and paste function, the new
device gets the same name followed by an incrementing number.
40 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 41
EcoStruxure Machine Expert Logic Builder User Interface
1 Root node
2 Programmable device (with applications)
3 Symbolic device name
4 Device name defined in device description file
Each entry in the Devices tree displays the symbol, the symbolic name (editable), and the
device type (= device name as provided by the device description).
A device is programmable or configurable. The type of the device determines the possible
position within the tree and also which further resources can be inserted below the device.
Within a single project, you can configure one or several programmable devices - regardless of
manufacturer or type (multi-resource, multi-device, networking).
Configure a device concerning communication, parameters, I/O mapping in the device dialog
(device editor). To open the device editor, double-click the device node in the Devices tree (refer
to the description of the device editor (see page 103)).
In online mode, the status of a device is indicated by an icon preceding the device entry:
Controller is connected, application is running, device is in operation, data is exchanged.
The option Update IO while in stop in the PLC settings view of the device editor
(see page 141) can be enabled or disabled.
Controller is connected and stopped (STOP). The option Update IO while in stop in the
PLC settings view of the device editor (see page 141) is disabled.
42 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Device is configured but not fully operational. Data is not exchanged. For example,
CANopen devices are in startup and preoperational.
Redundancy mode active: The fieldbus master is not sending data because another
master is in active mode.
Device description was not found in device repository. For further information on installing
and uninstalling devices in the Device Repository dialog box, refer to the description of the
Device Repository (see EcoStruxure Machine Expert, Menu Commands, Online Help).
The names of the connected devices and applications are displayed green shaded.
The names of devices running in simulation mode (refer to the description of the Simulation
command) are displayed in italics.
Additional diagnostic information is provided in the Status view of the device editor
(see page 153).
You can also run the active application on a simulation device which is by default automatically
available within the programming system. Therefore, no real target device is needed to test the
online behavior of an application (at least that which does not rely on hardware resources for
execution). When you switch to simulation mode (see EcoStruxure Machine Expert, Menu
Commands, Online Help), an entry in the Devices tree is displayed in italics, and you can log into
the application.
You can also connect to the controller in online configuration mode (refer to chapter Online Config
Mode (see EcoStruxure Machine Expert, Menu Commands, Online Help)) without the need of first
having loaded a real application into the controller. This is useful for the initial start-up of an I/O
system because you can access and test the I/Os in the controller configuration before you build
and load a real application program.
For information on the conversion of device references when opening projects, refer to the
Compatibility and Migration User Guide.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 43
EcoStruxure Machine Expert Logic Builder User Interface
44 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 45
EcoStruxure Machine Expert Logic Builder User Interface
Functional tree
Overview
The Functional tree is available for controllers that have a Functional Model node in the Devices
tree. It allows you to group multiple objects, such as IEC code or devices, and link them to a
function. Once this function is created, you can reuse it. By creating this modularity, it is possible
for you to reuse your developments more easily and to improve your vision of the project. You can
export / import the Functional tree and reuse it in another project.
Selecting Controllers
Select controllers for the Functional tree as follows:
46 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Adding Nodes
To group the content of a controller according to your individual requirements, the Functional tree
allows you to create subnodes below the controller nodes.
Deleting Nodes
To delete a node from the Functional tree, right-click it, and execute the command Delete from the
contextual menu. You are requested to decide whether to delete the selected object, with its child
objects, only from the Functional tree or from the whole project.
Child objects cannot be removed from the Functional tree only. If you intend to delete a child object,
you are prompted to confirm that the object is removed from the whole project.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 47
EcoStruxure Machine Expert Logic Builder User Interface
It is not possible to copy and paste attached objects in the Functional tree.
48 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Overview
The multi-tabbed Hardware Catalog is a default component of the Logic Builder screen.
It contains the following tabs:
Controller: Contains the Logic, HMI, and Motion controllers that can be inserted in your
EcoStruxure Machine Expert project.
Devices & Modules: Contains the PLC Components, I/O Modules, and the Communication,
Motor Control, Safety, and Sensor devices that can be inserted in your EcoStruxure Machine
Expert project. It also allows you to insert devices by using a device template.
HMI & iPC: Contains the HMI and iPC devices that can be inserted in your EcoStruxure Machine
Expert project.
Diverse: Contains third-party devices that can be inserted in your EcoStruxure Machine Expert
project.
The content of the individual tabs depends on the project. If the controllers integrated in the
EcoStruxure Machine Expert project do not support, for example, CANopen, then CANopen
devices are not displayed in the catalogs.
You can extend this view by the tabs of the Software Catalog (Variables, Assets, Macros, ToolBox,
Libraries) via the menu View → Software Catalog.
The buttons Hardware Catalog and Software Catalog in the toolbar allow you to display
or hide the catalog views.
You can add the elements from the catalogs to the project by simple drag and drop as described
in the Adding Devices by Drag and Drop chapter (see page 66).
Favorites List
Each tab of the catalog view contains a Favorites list. To provide quick access, you can add
frequently used elements to this Favorites list by drag and drop.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 49
EcoStruxure Machine Expert Logic Builder User Interface
Adding Devices From Device Templates in the Devices & Modules Tab
The Devices & Modules tab contains the option Device Template at the bottom. Activate this option
to display the available templates of field devices in the lists of the Devices & Modules tab. Add
them to the Devices tree as described in the Adding Devices from Template chapter
(see page 908).
50 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Overview
The look of the user interface, in terms of arrangement and configuration of the particular
components, depends on the following:
Default pre-settings for menus, keyboard functions, and toolbars. You can overwrite the
EcoStruxure Machine Expert default settings via the Customize dialog box (see EcoStruxure
Machine Expert, Menu Commands, Online Help) (by default available in the Tools menu). The
present settings are saved on the local system. A reset function is available for restoring the
default values at any time.
Properties of an editor as defined in the respective Tools → Options dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help). You can also overwrite
these settings. The present configuration is saved on the local system.
The way you arrange views or editor windows within the project. The present positions are
saved with the project (see below).
The selected perspective. By default, the Logic Configuration perspective is selected. For
further information, refer to the Perspectives paragraph in this chapter (see page 53).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 51
EcoStruxure Machine Expert Logic Builder User Interface
View is placed here: the view currently placed at this position and the new
one are arranged as icons.
52 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
When you release the mouse-button, the view is placed at the new position.
Views with an Auto Hide button can be placed as independent windows (floating) anywhere on the
screen by moving them and not dragging them on one of the arrow symbols. In this case, the view
looses the Auto Hide button. As an alternative, execute the commands Dock and Float from the
Window menu.
Hiding views: You can hide views with Auto Hide buttons at the border of the EcoStruxure Machine
Expert window. Click the Auto Hide down button in the upper right corner of the view. The view will
be displayed as a tab at the nearest border of the frame window. The content of the view is only
visible as long as the cursor is moved on this tab. The tab displays the icon and the name of the
view. This state of the view is indicated by the docking button changed to Auto Hide.
Unhiding views: To unhide a view, click the Auto Hide button.
An alternative way of hiding and unhiding a view is provided by the Auto Hide command that is by
default available in the Window menu.
It is not possible to reposition the information and status bar on the lower border of the user
interface (see page 35).
Perspectives
A perspective is used to save the layout of EcoStruxure Machine Expert views. It stores whether
the Messages and Watch views are open and at which position the view windows are located
(docked or independent windows).
By default, EcoStruxure Machine Expert provides 4 perspectives for the following use cases in the
Window → Switch Perspective menu or in the perspective table in the toolbar.
Perspective name Use case Navigators (on the left Catalog views (on the Views at the bottom of
side) right side) the screen
Device For adding / Devices tree Hardware catalog Messages (in Auto
Configuration configuring devices. Applications tree Controller Hide mode)
Tools tree Devices & Modules
HMI & iPC
Diverse
Logic Configuration For adding / creating Devices tree Software catalog Messages (in Auto
logic. Applications tree Variables Hide mode)
Tools tree Assets
Macros
ToolBox
Libraries
CODESYS Classic Standard CoDeSys Devices Hardware catalog Messages (in Auto
views. POUs Controller Hide mode)
Devices & Modules
HMI & iPC
Diverse
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 53
EcoStruxure Machine Expert Logic Builder User Interface
Perspective name Use case Navigators (on the left Catalog views (on the Views at the bottom of
side) right side) the screen
Online For online mode. Devices tree Hardware catalog Messages (in Auto
Applications tree Controller Hide mode)
Tools tree Devices & Modules Watch 1
HMI & iPC
Diverse
The Online perspective is automatically selected when the application is switched to online mode.
Creating your own perspective:
In addition to these default perspectives, you can create your own view layout and save it in
different perspectives according to your individual requirements.
To create your own perspective, proceed as follows:
Step Action
1 Resize, open, or close views according to your individual requirements.
2 Execute the command Save Perspective from the Window menu to save your modifications to
a new perspective.
3 In the Save Perspective dialog box, enter a name for your perspective.
Result: The present view layout is saved. The new perspective is available in the Window →
Switch Perspective menu and in the perspective table in the toolbar.
Zoom
Each editor window provides a zoom function. Click the zoom button in the lower right corner
of the window to open a list. It allows you to choose one of the zoom levels 25, 50, 100, 150, 200,
and 400 percent or to enter a zoom factor of your choice. A printout always refers to the 100% view.
Customization of the user interface is possible in offline and in online mode.
54 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Overview
As soon as you log in with the project, the objects which have already been opened in offline mode,
are automatically viewed in online mode. The perspective is automatically switched to the Online
perspective (see page 53) which means that the Watch view opens by default.
To open an object in online mode which is not already open, double-click the node in the
Applications tree or execute the Project → Edit Object command. The object will be opened in
online mode.
If there are several instances of the selected object (such as function blocks) contained in the
project, a dialog box named Select Online State <object name> will display. It allows you to choose
whether an instance or the base implementation of the object should be viewed and whether the
object should be displayed in online or offline mode.
Select Online State dialog box
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 55
EcoStruxure Machine Expert Logic Builder User Interface
The Device/Application field contains the device and application to which the respective object is
associated.
To open the online view of the object, activate the option Online mode and click OK. To see the
offline view, activate the option Offline mode.
If the object is a function block, the Function block instance field contains a list of the instances
currently used in the application.
In this case, the options available are:
Either select one of the instances and activate Online or Offline mode.
Or select the option Implementation which - independently of the selected instance - will open
the base implementation view of the function block. The Implementation option has no affect for
non-instantiated objects.
For more information on the online views of the particular editors, refer to the respective editor
descriptions.
The status bar (see page 35) provides information on the current status of the application.
56 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert Logic Builder User Interface
Overview
The following figure shows the default menu bar:
Some commands are not visible in the default view. To add a command to a menu, insert it in a
menu of your choice by using the Tools → Customize dialog box (see EcoStruxure Machine
Expert, Menu Commands, Online Help).
Specific commands, for a particular editor for example, are usually available in a corresponding
menu. These commands are only visible when the editor is open. For example: when you edit an
object in the SFC editor, the SFC menu is added to the menu bar.
To reorganize the menu structures, use the Tools → Customize dialog box.
For a description of the menus and commands, refer to the separate EcoStruxure Machine Expert
Menu Commands Online Help (see EcoStruxure Machine Expert, Menu Commands, Online Help).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 57
EcoStruxure Machine Expert Logic Builder User Interface
58 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Basic Concepts
EIO0000002854 06/2019
Chapter 3
Basic Concepts
Basic Concepts
Overview
EcoStruxure Machine Expert is a device-independent controller programming system.
Conforming to the IEC 61131-3 standard, it supports all standard programming languages.
Object Orientation
The object-oriented approach is not only reflected by the availability of appropriate programming
elements and features, but also in the structure and version handling of EcoStruxure Machine
Expert and in the project organization. Multi-device usage of a EcoStruxure Machine Expert project
is possible based on jointly used, instantiated programming units.
Version Handling
A parallel installation of several versions of EcoStruxure Machine Expert components and working
with the desired combination of versions is possible. This also pertains the device-specific use of
different compiler versions. Individual functions can be added without having to update the whole
version.
For further information, refer to the Compatibility and Migration User Guide.
Project Organization
Project organization is also determined in an object oriented fashion. A EcoStruxure Machine
Expert project contains a controller program composed of various programming objects and it
contains definitions of the resources which are needed to run instances of the program
(application) on defined target systems (devices, controllers).
So there are two main types of objects in a project:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 59
Basic Concepts
Code Generation
Code generation by integrated compilers and the subsequent use of the resulting machine code
provides for short execution times.
Additionally, EcoStruxure Machine Expert provides an editor for programming in CFC that is not
part of the IEC standard:
CFC editor (see page 351) for continuous function chart
60 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Configuration
EIO0000002854 06/2019
Part II
Configuration
Configuration
EIO0000002854 06/2019 61
Configuration
62 EIO0000002854 06/2019
EcoStruxure Machine Expert
Installing Devices
EIO0000002854 06/2019
Chapter 4
Installing Devices
Installing Devices
Introduction
Via the Device Repository dialog box (see EcoStruxure Machine Expert, Menu Commands, Online
Help), you can integrate Sercos devices with generic I/O profiles in your programming system.
To install this Sercos device, you need the SDDML (Sercos Device Description Markup Language)
file (device description file for Sercos devices) provided by the vendor of the device. The
SDDML file is a device description file for Sercos devices.
There are two types of Sercos devices with generic I/O profiles available:
Block I/O devices
A block I/O device is a pre-assembled block that consists of a bus interface and an I/O module.
Modular I/O devices
Modular I/O devices are I/O modules which can be connected to a bus interface.
Step Action
1 Select Tools → Device Repository... from the menu bar.
Result: The Device Repository dialog box opens.
2 Click the Install... button in the Device Repository dialog box.
Result: The Install Device Description dialog box opens.
3 Select the file type SERCOS III I/O device descriptions (*.xml) and browse your file system for
the SDDML file to open.
4 Select the SDDML file and click Open.
Result: The SDDML file is converted and imported into a compatible file format for EcoStruxure
Machine Expert.
NOTE: If the selected SDDML file is not compatible or if the Sercos device of the third-party vendor
is not using a compatible FSP (Function Specific Profile) type, then a corresponding diagnostic
message is indicated in the Messages view (see EcoStruxure Machine Expert, Menu Commands,
Online Help).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 63
Installing Devices
Step Action
1 Select Tools → Device Repository... from the menu bar.
Result: The Device Repository dialog box opens.
2 In the tree structure Installed device descriptions, expand the node Fieldbusses → Sercos.
3 Expand the subnode Slave to verify whether the Sercos bus interfaces that you integrated are
available in the list.
4 Expand the subnode Module to verify whether the Sercos I/O modules that you integrated are
available in the list.
For further information, refer to the description of the Device Repository dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
64 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Managing Devices
EIO0000002854 06/2019
Chapter 5
Managing Devices
Managing Devices
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 65
Managing Devices
Section 5.1
Adding Devices by Drag and Drop
Overview
EcoStruxure Machine Expert provides a multi-tabbed catalog view on the right-hand side of the
EcoStruxure Machine Expert Logic Builder.
Two different types of catalog views are available:
The Hardware Catalog
The Software Catalog
To add a device to the Devices tree, select the respective entry in the Hardware Catalog, drag it to
the Devices tree, and drop it at a suitable node. It is added automatically to your project.
Step Action
1
Open the Hardware Catalog by clicking the Hardware Catalog button in the EcoStruxure
Machine Expert Logic Builder toolbar if it is not already opened.
2 Select the tab Controller in the Hardware Catalog.
Result: The controllers suitable for your EcoStruxure Machine Expert project are displayed in
the Hardware Catalog.
3 Select a controller entry in the Controller tab, drag it to the Devices tree and drop it at a suitable
node. You can drop a controller at any empty space inside the Devices tree.
Result: The controller is added to the Devices tree as a new node with different subnodes
depending on the controller type.
66 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Step Action
1
Open the Hardware Catalog by clicking the Hardware Catalog button in the EcoStruxure
Machine Expert Logic Builder toolbar if it is not already opened.
2 Select the tab Devices & Modules in the Hardware Catalog.
Result: The expansion devices suitable for your EcoStruxure Machine Expert project are
displayed in the Hardware Catalog.
3 Select your expansion device, drag it to the Devices tree and drop it at a suitable subnode of a
controller.
NOTE: Suitable subnodes are expanded and highlighted by EcoStruxure Machine Expert.
Result: The expansion device is added to the Devices tree below the subnode of the controller.
4 If the expansion device requires a communication manager, this node is added automatically to
the Devices tree.
If several communication managers are available for your expansion device, a dialog box is
displayed allowing you to select the suitable communication manager.
Step Action
1
Open the Hardware Catalog by clicking the Hardware Catalog button in the EcoStruxure
Machine Expert Logic Builder toolbar if it is not already opened.
2 Select the tab Devices & Modules in the Hardware Catalog.
Result: The field devices suitable for your EcoStruxure Machine Expert project are displayed in
the Hardware Catalog.
3 Select a field device entry in the Devices & Modules catalog view, drag it to the Devices tree,
and drop it at a suitable subnode of a controller.
NOTE: Suitable subnodes are expanded and highlighted by EcoStruxure Machine Expert.
Result: The field device is added to the Devices tree below the subnode of the controller.
4 If the field device requires a communication manager, this node is added automatically to the
Devices tree.
If several communication managers are available for your field device, a dialog box is displayed
allowing you to select the suitable communication manager.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 67
Managing Devices
Step Action
1
Open the Hardware Catalog by clicking the Hardware Catalog button in the EcoStruxure
Machine Expert Logic Builder toolbar if it is not already opened.
2 Select the tab Devices & Modules in the Hardware Catalog.
3 Select the option Device Template at the bottom of the Devices & Modules tab.
Result: The device templates suitable for your EcoStruxure Machine Expert project are
displayed in the Devices & Modules tab.
4 Add them to the Devices tree as described in the Adding Devices from Template chapter
(see page 908).
Step Action
1
Open the software catalog by clicking the Software Catalog button in the EcoStruxure
Machine Expert Logic Builder toolbar if it is not already opened.
2 Select the tab Macro in the Software Catalog.
Result: The function templates available in EcoStruxure Machine Expert are displayed in the
Software Catalog.
3 Select a function template entry in the Macro view, drag it to the Devices tree, and drop it at a
suitable subnode of a controller.
NOTE: Suitable subnodes are expanded and highlighted by EcoStruxure Machine Expert.
Result: The device based on the function template is added to the Devices tree.
68 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Section 5.2
Adding Devices by Contextual Menu or Plus Button
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 69
Managing Devices
Adding a Controller
Introduction
As an alternative to dragging and dropping devices on the Devices tree, click the green plus button
that is displayed at the suitable node in the Tree. Alternatively, you can right-click a node of the
Tree to add a suitable device using the contextual menu. The Add Device dialog box opens that
allows you to determine whether the device will be appended, inserted, or plugged to the selected
node (see EcoStruxure Machine Expert, Menu Commands, Online Help).
When you add a controller to your project, several nodes are automatically added to the Devices
tree. These subnodes are controller-specific, depending on the functions the controller provides.
The following paragraph describes the general procedure of adding a controller. For details on a
specific controller, refer to the programming manual for your particular controller.
Adding a Controller
To add a device to your EcoStruxure Machine Expert project, proceed as follows:
Step Action
1 Select a project node, right-click the project node and execute the Add Device... command from the
contextual menu.
Result: The Add Device dialog box opens.
2 In the Add Device dialog box, select Schneider Electric from the list box Vendor.
3 Choose the controller you want to insert into the project.
4 Rename your device by typing a name in the text box Name.
NOTE: Choose a name that complies to the IEC standard. Do not use special characters, leading
digits, or spaces within the name. The name must not exceed a length of 32 characters. If you do
not rename the device, a name is given by default.
Naming the device meaningfully may ease the organization of your project.
5 Click the Add Device button.
Result: The selected controller is added to the project and appears as a new node in the Devices
tree. The Add Device dialog box remains open. You can do the following:
You can add another controller by going back to step 3
You can click the Close button to close the Add Device dialog box
70 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
WARNING
UNINTENDED EQUIPMENT OPERATION
Only use software approved by Schneider Electric for use with this equipment.
Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Step Action
1 Select a controller node and click the green plus button of the node or right-click the controller node and
execute the Add Device... command from the contextual menu.
Result: The Add Device dialog box opens.
2 In the Add Device dialog box, select Schneider Electric from the Vendor list.
3 Choose the expansion device you want to add to your controller from the Device list below.
4 Rename your expansion device by typing a name in the text box Name.
NOTE: The name must not contain any space character. If you do not rename the expansion device, a
name is given by default.
Naming the expansion device meaningfully may ease the organization of your project.
5 Click the Add Device button.
Result: The selected expansion device is added to the project and is displayed in the Devices Tree as a
new subnode of your controller.
The Add Device dialog box remains open. You can do the following:
You can add another expansion device by going back to step 3 of this description
You can click the Close button
NOTE: When you add a TWDNOI10M3 object (AS-Interface Master Module), the corresponding
Virtual AS interface bus fieldbus manager will automatically be inserted.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 71
Managing Devices
Overview
Communication managers are mandatory to activate and configure any hardware bus interface,
for example CANopen or serial line.
Two types of communication managers exist:
Fieldbus managers which allow to configure fieldbus devices (for example CANopen slaves or
Modbus slaves)
General communication managers
72 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Step Action
1 In the Devices Tree, select the bus interface (Serial Line, CANopen bus / CANbus, Ethernet)
and click the green plus button of the node or right-click the bus interface node and execute the
Add Device... command from the contextual menu.
Result: The Add Device dialog box opens.
2 In the Add Device dialog box, select Schneider Electric from the list Vendor.
Note: You can filter the devices by brand by clicking the list Vendor.
3 Select the Communication manager from the list.
4 Rename your device by typing a name in the Name box.
Note: Do not use spaces within the name. If you do not rename the device, a name is given by
default.
Naming the device meaningfully may ease the organization of your project.
5 Click the Add Device button.
6 Click the Close button to close the Add Device dialog box.
7 Configure the Communication manager.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 73
Managing Devices
Overview
You can add field devices to the communication manager by selecting the field device manager
node (for example, CANopen or Modbus manager) in the Devices Tree and clicking the green plus
sign. Alternatively, you can right-click the field device manager node in the Devices Tree and
execute the Add Device command.
As a prerequisite, the device must be available in the Device Repository dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
Adding Devices
Step Action
1 Select the field device manager node (CANopen or Modbus manager) in the Devices Tree and
click the green plus sign, or right-click the field device manager node and execute the Add
Device... command from the contextual menu.
Result: The Add Device dialog box opens.
2 In the Add Device dialog box, select Schneider Electric from the list box Vendor.
Note: You can filter the devices by brand by clicking the list box Vendor.
3 Select the device of your choice from the list below.
4 Rename your device by typing a name in the Name textbox.
NOTE: Do not use spaces within the name. Do not use an underscore character (_) at the end
of the name.
If you do not rename the device, a name is given by default.
Naming the device meaningfully may ease the organization of your project.
5 Click the Add Device button.
Result: The field device is added to the field device manager.
NOTE: The Add Device dialog box remains open.
You can do the following:
You can add another device by going back to step 2.
You can click the Close button.
74 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
WARNING
UNINTENDED EQUIPMENT OPERATION
Use the g_aNetDiagnosis data structure within the application to monitor CAN slave
responses to configuration commands.
Verify that the application does not start up or put the machine or process in an operational
state in the event of receiving SDO abort messages from any of the CAN slaves.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
After adding the CanConfig Extern library to your application, use the Net Diagnostic definition
within your application to test for SDO abort messages from the CAN slaves.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 75
Managing Devices
The following code example illustrates the use of the CAN diagnostic data structure:
IF g_aNetDiagnosis[CAN_Net_Number].ctSDOErrorCounter = 0 THEN
(* No error is detected in the configuration*)
ELSE
(* An error has been detected during configuration. Get the latest
error information.*)
// node ID of the slave which sent the abort code
ReadLastErrorNodeID := g_aNetDiagnosis[CAN_Net_Number].usiNodeID;
// index used in the aborted SDO
ReadLastErrorIndex := g_aNetDiagnosis[CAN_Net_Number].wIndex;
// subIndex used in the aborted SDO
ReadLastErrorSubIndex := g_aNetDiagnosis[CAN_Net_Number].bySubIndex
;
//SDO abort code
ReadLastErrorSdoAbortCode := g_aNetDiagnosis [CAN_Net_Number].udiAb
ortCode;
(* Do not allow the start-
up or other operation of the machine or process *)
END_IF
NOTE: In this example, the CAN_Net_Number would be 0 for the CAN0 port and, if the controller
is so equipped, 1 for the CAN1port.
76 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Overview
It is also possible to add a new device using a device template. For a description of this procedure,
refer to the Managing Device Templates section (see page 908).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 77
Managing Devices
Section 5.3
Updating Devices
Updating Devices
Updating Devices
Introduction
The update device function allows you to replace a device selected in the Devices tree
By another version of the same device or
By a different type of device.
Updating Devices
To replace a device of your EcoStruxure Machine Expert project by another version or by a
different device, proceed as follows:
Step Action
1 Select the device you want to replace in the Devices tree and execute the command Update Device... from
the Project menu.
OR
Right-click the device you want to replace in the Devices tree and execute the command Update Device... from
the contextual menu.
Result: The Update Device dialog box opens.
OR
Right-click the device you want to replace in the Devices tree and execute the command Add Device... from
the contextual menu. In the Add Device dialog box select the Action: Update device.
Result: The Add Device dialog box is converted into the Update Device dialog box.
2 From the Device: list, choose the device that should replace the present device.
To select a specific version of the device, select the options Display all versions (for experts only) and/or
Display outdated versions.
3 Click the Update Device button.
Result: The device that had been selected in the Devices tree is replaced by the new device type or the new
version. The new device type or the new version is now displayed at the selected node in the Devices tree.
78 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Section 5.4
Converting Devices
Converting Devices
Converting Devices
Introduction
EcoStruxure Machine Expert 4.0 and later versions allow you to convert a device that is configured
in your project to a different, but compatible device. EcoStruxure Machine Expert automatically
converts the currently configured device into the selected device and displays the changes that are
made in the Messages view.
The Convert Device command may automatically add or remove modules. These hardware
changes also have influences on the addressing and the libraries.
To help to avoid unintended behavior after a device was converted:
Verify that the new device supports all functions and communication ports that are required in
your project
Avoid using direct addresses in your application
Perform a backup of the project to the PC before converting a device
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that any direct addresses used in your application (for example, %IB5) have been
converted correctly after device conversion.
Verify that the modified project contains the intended configurations and provides the intended
functionality after you have converted the device.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTICE
LOSS OF DATA
Perform a backup of the project to the PC before converting a device.
Failure to follow these instructions can result in equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 79
Managing Devices
Converting a Device
To convert a device to a compatible device, proceed as follows:
Step Action
1 Perform a backup of the project to the PC by executing the File → Save Project As... command before
converting a device.
2 Right-click the device you want to convert in the Devices Tree.
3 Execute the Convert Device command from the contextual menu.
Result: The Convert Device dialog box is displayed. It lists those devices that are compatible to the device
you selected and provides further information on the selected device.
4 Select the device from the list in which you want to convert your currently configured device.
To display the available versions of a device, select the option Display all versions (for experts only).
5 If you have not yet performed a backup of your project, click Cancel to stop without changes and perform
a backup before you start the procedure once again.
To start the conversion, click OK.
Result: The currently configured device is converted into the device you selected from the list. The
information you entered is conserved if the related modules are still available. Any modifications or
configurations that could not be converted are listed in the Messages view.
6 Check whether the converted project still contains the intended configurations and provides the intended
functions. If not, adapt the configuration or restore the backup of the unchanged project file.
To save the information displayed in the Messages view, you can copy it to the Clipboard (press
CTRL + C) and paste it to a data file (press CTRL + V).
80 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Section 5.5
Converting Projects
Converting Projects
Introduction
With EcoStruxure Machine Expert, you can convert a SoMachine Basic or TwidoSoft/TwidoSuite
project and the configured controller to a selectable EcoStruxure Machine Expert logic controller
(see page 1085). The controller and the corresponding logic are converted and integrated in the
EcoStruxure Machine Expert project.
For the conversion process, execute the File → Convert SoMachine Basic Project or the File →
Convert Twido Project command. The Convert SoMachine Basic Project dialog box or Convert
Twido Project dialog box opens. If the commands are not available, you can insert them in a menu
of your choice by using the Tools → Customize dialog box (see EcoStruxure Machine Expert,
Menu Commands, Online Help).
The SoMachine Basic versions supported by this conversion mechanism are listed in the release
notes of EcoStruxure Machine Expert. If you convert a SoMachine Basic project that was created
with a SoMachine Basic version that is newer than the latest supported version, this is indicated
by a message in the Messages view (see EcoStruxure Machine Expert, Menu Commands, Online
Help). You can then continue or cancel the conversion. If you continue, the application will be
converted, but it may not be possible to do so without encountering errors that will need to be
rectified. In this case, review and verify both the message view and your application before
attempting to put it into service.
NOTE: Verify that the SoMachine Basic or Twido project is valid before you convert it into
EcoStruxure Machine Expert.
NOTE: It is not possible to convert password-protected projects.
To help to avoid unintended behavior after a project was converted, verify that the target controller
supports the functions and communication ports that are required in your project.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 81
Managing Devices
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that the program for the target controller contains the intended configurations and
provides the intended functions after you have converted the project.
Fully debug, verify, and validate the functionality of the converted program before putting it into
service.
Before converting a program, verify that the source program is valid, i.e., is downloadable to
the source controller.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: For more information, advice and important safety information concerning importing
projects into EcoStruxure Machine Expert, see the Compatibility and Migration User Guide
(see EcoStruxure Machine Expert Compatibility and Migration, User Guide).
82 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Step Action
1 To start the conversion process, perform one of the three actions in the EcoStruxure Machine Expert
Logic Builder (as listed in the Introduction block of this chapter (see page 81)).
Result: The Convert SoMachine Basic Project dialog box or Convert Twido Project dialog box opens:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 83
Managing Devices
Step Action
3 Enter the path to the SoMachine Basic or Twido project file in the Project File box, or click the ... button
to browse for the file.
NOTE: If you already browsed for your SoMachine Basic or Twido project in the Open project dialog box,
the path has been entered automatically in the Project File field and cannot be edited.
4 Select the programming language in which the logic will be converted from the Implementation Language
list.
The following programming languages are supported:
Ladder diagram (LD)
Function block diagram (FBD)
Instruction list (IL)
Continuous function chart (CFC)
5 Select the target controller from the Devices list in which you want to convert your SoMachine Basic or
Twido controller. Further information on the selected device is displayed in the Information area of the
dialog box.
6 Click Convert to start the conversion.
Result: The SoMachine Basic or Twido project is converted and integrated in the open EcoStruxure
Machine Expert project. Modifications or configurations that could not be converted are listed in the
Messages view (see EcoStruxure Machine Expert, Menu Commands, Online Help).
7 Consult the category Project Conversion of the Messages view and verify the errors and alerts detected
and listed.
8 Verify whether the converted project contains the intended configurations and provides the intended
functions. If not, adapt the configuration.
TwidoEmulationSupport Library
The TwidoEmulationSupport library (see EcoStruxure Machine Expert, Twido Emulation Support
Library, Library Guide) contains functions and function blocks that provide SoMachine Basic and
TwidoSoft/TwidoSuite functionality in a EcoStruxure Machine Expert application. The TwidoEmu-
lationSupport library is automatically integrated in the EcoStruxure Machine Expert project with the
converted controller.
84 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
In EcoStruxure Machine Expert, there is only the memory word area for memory objects:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 85
Managing Devices
The graphic provides an overview of the different layouts of %MD and %MF addresses in SoMachine
Basic / Twido and EcoStruxure Machine Expert.
86 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
The relationship between %KW, %KD, and %KF objects is the same as for %MW, %MD, and %MF objects.
For example, %KD4 / %KF4 are mapped on the same location as %KW4. Uneven %KD / %KF
addresses cannot be mapped.
Remote Access
Memory objects (%MW, %MD, %MF, and %M) can be accessed by a remote device through Modbus
services:
If a remote device accesses %MW, %MD or %MF objects in the source application, this access will
still be available in the EcoStruxure Machine Expert application.
If a remote device accesses %M objects in the source application, this access will no longer be
available in the EcoStruxure Machine Expert application.
Handling Rising and Falling Edges
A rising/falling edge contact is converted as follows:
1. An additional global variable with the suffix _Rise/_Fall is created (for example, M1_Rise
for a rising edge contact for %M1).
2. This variable is set via an R_TRIG/F_TRIG instance in the SystemFunctions program.
Edge detection is performed at the beginning of the controller cycle.
A FALLING/RISING instruction is directly converted into an R_TRIG/F_TRIG instance.
Edge detection is performed at the same place of the execution sequence as in the original
application.
Counters %C FB_Counter
PID FB_PID
Exchange / message %MSG FB_EXCH
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 87
Managing Devices
88 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 89
Managing Devices
Other system variables are not supported by the conversion. If an unsupported system variable is
used by the source application program, a message is generated in the category Project
Conversion of the Messages view (see EcoStruxure Machine Expert, Menu Commands, Online
Help).
90 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Conversion of Symbols
Symbols defined in a SoMachine Basic / Twido project are automatically transferred into the
EcoStruxure Machine Expert project.
The following restrictions apply to the naming of symbols:
For the complete list of symbol modifications that were required, refer to the Messages view.
Conversion of Fast Counters, High-Speed Counters (Twido: Very Fast Counters) and Pulse Generators
The function blocks provided by EcoStruxure Machine Expert differ from the function blocks
provided by SoMachine Basic / Twido. Nevertheless, the configuration of fast counters, high-speed
counters, and pulse generators is converted as far as possible. The following sections provide an
overview of the restrictions that apply.
General Restrictions
The following general restrictions apply:
Restriction Solution
The inputs and outputs used by the converted high- Take this into account in the wiring of the converted
speed counters and pulse generators may differ from controller.
the used inputs and outputs of the source application. The reassignment of inputs and outputs is reported in
the Messages view (see EcoStruxure Machine
Expert, Menu Commands, Online Help).
The SoMachine Basic controller may support a You have to adapt your application manually.
different number of counters and pulse generators
than the selected target controller. The conversion
function only converts the counters and pulse
generators that are supported by the target controller.
Constraints Pertaining to the Conversion of %FC, %HSC / %VFC, %PLS, and %PWM
For each %FC, %HSC / %VFC, %PLS, and %PWM function block being used in the SoMachine Basic /
Twido application, a single program is created in EcoStruxure Machine Expert. You can improve
this basic implementation according to the needs of your application.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 91
Managing Devices
Restriction Solution
The access to function block parameters is performed If the source application accesses parameters of the
differently in SoMachine Basic and EcoStruxure function block, you have to extend the converted
Machine Expert. application accordingly.
In SoMachine Basic, the parameters of a function
block can be accessed directly by the application
program, for example, %HSC.P = 100.
In EcoStruxure Machine Expert, a controller-specific
function block (for example, EXPERTSetParam) has
to be used to access a parameter.
The behavior of counters differs in EcoStruxure You have to adapt your application manually.
Machine Expert from SoMachine Basic / Twido when
the preset value is set.
In Twido:
The down counter continues counting if zero is
reached.
The up counter continues counting if the preset
value is reached.
In EcoStruxure Machine Expert:
The down counter stops counting if zero is
reached.
The up counter starts to count from the beginning
if the preset value is reached.
The following parameters of SoMachine Basic You have to adapt your application manually.
function blocks cannot be converted to EcoStruxure
Machine Expert:
Function block %PLS:
Output parameter D [Done]
Parameter R [Duty Cycle]
92 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Constraints Pertaining to the Conversion of PTO Function Blocks %PTO and %MC_xxxx
For M241:
The PTO function blocks provided by EcoStruxure Machine Expert for M241 controllers are
compatible with the PTO function blocks provided by SoMachine Basic. PTO function blocks are
converted without restrictions. The only exception is the MC_MotionTask_PTO function block.
The MC_MotionTask_PTO is not converted.
For HMISCU:
The PTO function blocks provided by EcoStruxure Machine Expert for HMISCU controllers are not
compatible with the PTO function blocks provided by SoMachine Basic. PTO function blocks are
not converted.
Constraints Pertaining to the Conversion of Frequency Generator Function Block %FREQGEN
The frequency generator function block %FREQGEN is converted without restrictions for both M241
and HMISCU controllers.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 93
Managing Devices
94 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
A graphical Grafcet POU can be initialized by setting the system bit %S21. If this bit is set in the
SoMachine Basic project, the converter activates the implicit variable SFCInit and uses it to
initialize the SFC program.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 95
Managing Devices
Source TM2 expansion module Target TM3 expansion module Further information
TM2DDI8DT TM3DI8 –
TM2DAI8DT TM3DI8A –
TM2DDO8UT TM3DQ8U –
TM2DDO8TT TM3DQ8T –
TM2DRA8RT TM3DQ8R –
TM2DDI16DT TM3DI16 –
TM2DDI16DK TM3DI16K –
TM2DRA16RT TM3DQ16R –
TM2DDO16UK TM3DQ16UK –
TM2DDO16TK TM3DQ16TK –
TM2DDI32DK TM3DI32K –
TM2DDO32UK TM3DQ32UK –
TM2DDO32TK TM3DQ32TK –
TM2DMM8DRT TM3DM8R –
TM2DMM24DRF TM3DM24R –
TM2AMI2HT TM3AI2H –
TM2AMI4LT TM3TI4 It is possible that the behavior of the converted
temperature module differs from the original
module. Carefully verify the converted module.
TM2AMI8HT TM3AI8 –
TM2ARI8HT – The TM2 modules TM2ARI8HT, TM2ARI8LRJ,
and TM2ARI8LT are not converted because there
is no corresponding TM3 expansion module. You
can replace this module by two TM3TI4 modules.
TM2AMO1HT TM3AQ2 The target TM3 expansion module has more
I/O channels than the source TM2 module.
TM2AVO2HT –
TM2AMM3HT TM3TM3 –
TM2ALM3LT It is possible that the behavior of the converted
temperature module differs from the original
module. Carefully verify the converted module.
96 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
Source TM2 expansion module Target TM3 expansion module Further information
TM2AMI2LT TM3TI4 The target TM3 expansion module has more
I/O channels than the source TM2 module.
It is possible that the behavior of the converted
temperature module differs from the original
module. Carefully verify the converted module.
TM2AMM6HT TM3AM6 –
TM2ARI8LRJ – The TM2 modules TM2ARI8HT, TM2ARI8LRJ,
and TM2ARI8LT are not converted because there
is no corresponding TM3 expansion module. You
can replace this module by two TM3TI4 modules.
TM2ARI8LT – The TM2 modules TM2ARI8HT, TM2ARI8LRJ,
and TM2ARI8LT are not converted because there
is no corresponding TM3 expansion module. You
can replace this module by two TM3TI4 modules.
NOTE: If you are using TM2 as well as TM3 expansion modules in your EcoStruxure Machine
Expert project, note their position in the tree structure: If TM3 nodes are located below TM2 nodes
in the tree structure, this is reported as a detected Build error in the Messages view.
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that the program for the target controller contains the intended configurations and
provides the intended functions after you have converted the project.
Fully debug, verify, and validate the functionality of the converted program before putting it into
service.
Before converting a program, verify that the source program is valid, i.e., is downloadable to
the source controller.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 97
Managing Devices
Configuration
The IOScanner configuration is completely converted:
The devices are converted to the Generic Modbus Slave device. The source device type is not
preserved.
The device configuration is completely converted. This includes initialization requests, channel
settings, and reset variable.
Function Blocks
The drive function blocks for the control of Altivar drives over the Modbus IOScanner
(MC_xxx_ATV) are not converted.
Status Handling
Since the IOScanner status handling differs for SoMachine Basic and EcoStruxure Machine
Expert, these features can only be partly converted. If your application uses IOScanner status
information, verify that this logic still works.
98 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Devices
If you use these communication features in your Twido application, you have to adapt the
EcoStruxure Machine Expert application manually.
During conversion, one variable is created for each related I/O object in order to allow the
EcoStruxure Machine Expert application to be built successfully. These variables are collected in
separate global variable lists. This helps you in identifying the variables to be replaced.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 99
Managing Devices
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that the program for the target controller contains the intended configurations and
provides the intended functions after you have converted the project.
Fully debug, verify, and validate the functionality of the converted program before putting it into
service.
Before converting a program, verify that the source program is valid, i.e., is downloadable to
the source controller.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
A warning message indicates that the conversion process made some adjustments that, in all
likelihood, do not have impact on the functions of your application.
An error message indicates that some parts of the application could not be fully converted. In
this case, you have to adapt the application manually in order to preserve the same functionality
in the target application.
If the application program makes use of functionality that cannot be completely converted, the
converter creates variables for the unsupported language objects. This allows you to compile
your application successfully. However, verify this unsupported functionality after the
conversion.
To save the information displayed in the Messages view, you can copy it to the Clipboard (press
CTRL + C) and paste it to a data file (press CTRL + V).
100 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Common Device Editor Dialogs
EIO0000002854 06/2019
Chapter 6
Common Device Editor Dialogs
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 101
Common Device Editor Dialogs
Section 6.1
Device Configuration
Device Configuration
102 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Overview
The device editor provides parameters for the configuration of a device, which is managed in the
Devices tree.
To open the device editor for a specific device, do the following:
Double-click the node of the device in the Devices tree or
Select device in the Devices tree and execute the Edit Object command via the contextual menu
or via the Project menu.
The Tools → Options → Device editor dialog box allows you to make the generic device
configuration views invisible (see page 132).
This chapter describes the main device editor dialogs. Bus-specific configuration dialogs are
described separately.
Tab Description
Communication Settings in Controller Configuration of the connection between programming system and
selection mode (see page 105) a programmable device (controller). The tab that is displayed
Communication Settings in Simple depends on the mode selected with the parameter Communication
page in the Tools → Options → Device editor dialog box
mode (see page 125)
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
Communication Settings in Classic
mode (see page 128)
Configuration (see page 132) Display or configuration of the device parameters.
Parameter (see page 133) Display or configuration of the device parameters of PacDrive
controllers.
Applications (see page 134) List of applications running on the controller. Refer to the description
in the Program chapter (see page 167).
Synchronized Files (see page 136) List of files that are downloaded to the controller with an application
download.
Files (see page 137) Configuration of a file transfer between host and controller.
Log (see page 139) Display of the controller log file.
PLC settings (see page 141) Configuration of:
Application noticed for I/O handling
I/O behavior in stop status
Bus cycle options
Users and Groups (see page 143) User management concerning device access during runtime.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 103
Common Device Editor Dialogs
Tab Description
Access Rights (see page 148) Configuration of the access rights on runtime objects and files for
the particular user groups.
Task Deployment (see page 152) Display of inputs and outputs assigned to the defined task - used for
troubleshooting.
Status (see page 153) Device-specific status and diagnostic messages.
Information (see page 154) General information on the device (for example: name, provider,
version).
I/O Mapping (see page 155) Mapping of the input and output channels of an I/O device on project
(application) variables.
OPC UA server configuration Provides various functionalities to edit the server configuration file
[Link] on the Compact Flash (CF) card of the
controller.
The OPC UA server configuration allows you to perform the
following actions:
Define default properties for new server certificates.
View and delete existing server certificates.
View and add sampling rates.
Import and export server certificates.
Enable and manage various settings.
104 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Overview
The Communication Settings tab in controller selection mode is displayed when the mode
Controller selection mode has been selected for the parameter Communication page in the Tools
→ Options → Device editor dialog box (see EcoStruxure Machine Expert, Menu Commands,
Online Help). The tab provides access to the Network Device Identification service that allows you
to scan the Ethernet network for available controllers and to display them in a list. You can
configure the parameters for the communication between the devices (referred to as controllers in
this chapter) and the programming system.
The list of controllers contains those controllers in the network that have sent a response to the
request of EcoStruxure Machine Expert. It may happen that the controller of your choice is not
included in this list. This can have several causes. For causes and suitable solutions, refer to the
chapter Accessing Controllers - Troubleshooting and FAQ (see page 949).
Communication Settings tab in controller selection mode
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 105
Common Device Editor Dialogs
Button Description
Optical Click this button to cause the selected controller to indicate an optical
signal: It flashes a control LED quickly. This can help you to identify the
respective controller if many controllers are used.
The function stops on a second click or automatically after about
30 seconds.
NOTE: The optical signal is issued only by controllers that support this
function.
Optical and acoustical Click this button to cause the selected controller to indicate an optical and
an acoustical signal: It starts to beep and flashes a control LED quickly.
This can help you to identify the respective controller if many controllers
are used.
The function stops on a second click or automatically after about
30 seconds.
NOTE: The optical and acoustical signals are issued only by controllers
that support this function.
Update Click this button to refresh the list of controllers. A request is sent to the
controllers in the network. Controllers that respond to the request are
listed with the present values.
Pre-existing entries of controllers are updated with every new request.
Controllers that are already in the list but do not respond to a new request
are not deleted. They are marked as inactive by a red cross being added
to the controller icon.
The Update button corresponds to the Refresh list command that is
provided in the contextual menu if you right-click a controller in the list.
To refresh the information of a selected controller, the contextual menu
provides the command Refresh this controller. This command requests
more detailed information from the selected controller.
NOTE: The Refresh this controller command can also refresh the
information of other controllers.
Remove inactive controllers from Controllers that do not respond to a network scan are marked as inactive
list. in the list. This is indicated by a red cross being added to the controller
icon. Click this button to remove the controllers that are marked as
inactive controllers from the list.
NOTE: A controller can be marked as inactive even if this is not the case.
The contextual menu that opens if you right-click a controller in the list
provides two other commands for removing controllers:
The Remove selected controller from list command allows you to
remove only the selected controller from the list.
The Remove all controllers from list command allows you to remove
all controllers simultaneously from the list.
106 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Button Description
New Favorite... and Favorite 0 You can use Favorites to adjust the selection of controllers to your
personal requirements. This can help you keep track of many controllers
in the network.
A Favorite describes a collection of controllers that are recognized by a
unique identifier.
Click a favorite button (such as Favorite 0) to select or deselect it. If you
have not selected a favorite, all detected controllers are visible.
You can also access Favorites via the contextual menu. It opens upon
right-clicking a controller in the list.
Move the cursor over a favorite button in the toolbar to view the
associated controllers as a tooltip.
List of Controllers
The list of controllers in the middle of the Communication Settings tab of the device editor lists
those controllers that have sent a response to the network scan. It provides information on each
controller in several columns. You can adapt the columns displayed in the list of controllers
according to your individual requirements.
To achieve this, right-click the header of a column to open the Process columns dialog box.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 107
Common Device Editor Dialogs
You can create your own layout of this table. Click New, and enter a name for your layout. Shift
columns from the list of Possible columns to the list of Current columns and vice versa by clicking
the horizontal arrow buttons. To change the order of the columns in the Current columns list, click
the arrow up and arrow down buttons.
Step Action
1 Select the controller in the list of controllers.
2 Right-click the controller entry and execute the command Edit communication settings... from
the contextual menu.
Result: The Edit communication settings dialog box opens with the settings of the controller.
NOTE: Most controllers provide a parameter (such as RemoteAccess) that helps prevent
changing communication parameters of the controller.
108 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Step Action
3 Configure the communication parameters:
Boot Mode
FIXED: A fixed IP address is used according to the values entered below (IP address,
Subnet mask, Gateway).
BOOTP: The IP address is received dynamically by BOOTP (bootstrap protocol). The
values below will be ignored.
DHCP: The IP address is received dynamically by DHCP (dynamic host configuration
protocol). The values below will be ignored.
NOTE: Not all devices support BOOTP and/or DHCP.
IP address
When configuring IP addresses, refer to the hazard message below.
This box contains the IP address of the controller. It is a unique address that consists of
four numbers in the range of 0...255 separated by periods. The IP address has to be unique
in this (sub)network.
Subnet mask
The subnet mask specifies the network segment to which the controller belongs. It is an
address that consists of four numbers in the range of 0...255 separated by periods.
Generally, only the values 0 and 255 are used for standard subnet mask numbers.
However, other numeric values are possible. The value of the subnet mask is generally the
same for all controllers in the network.
Gateway
The gateway address is the address of a local IP router that is located on the same network
as the controller. The IP router passes the data to destinations outside of the local network.
It is an address that consists of four numbers in the range of 0...255 separated by periods.
The value of the gateway is generally the same for all controllers in the network.
To save the communication settings in the controller even if it is restarted, activate the
option Save settings permanently.
4 Click OK to transfer the settings to the controller.
Carefully manage the IP addresses because each device on the network requires a unique
address. Having multiple devices with the same IP address can cause unintended operation of
your network and associated equipment.
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that all devices have unique addresses.
Obtain your IP address from your system administrator.
Confirm that the device’s IP address is unique before placing the system into service.
Do not assign the same IP address to any other equipment on the network.
Update the IP address after cloning any application that includes Ethernet communications to
a unique address.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 109
Common Device Editor Dialogs
Managing Favorites
To manage favorites in the list of controllers, proceed as follows:
Step Action
1 Select the controller in the list of controllers.
2 Right-click the controller and select one of the commands:
New Favorite to create a new group of favorites.
Favorite n in order to
Add the selected controller to this list of favorites
Remove the selected controller from this list of favorites
Remove all controllers from this list of favorites
Select a favorite
Rename a favorite
Remove a favorite
Consult the Programming Guide specific to your controller for information on the support of TLS.
The following scenarios are possible when you attempt to log into a controller using encrypted
communication:
110 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
WARNING
UNINTENDED EQUIPMENT OPERATION
Ensure that all devices have unique nodenames.
Confirm that the device’s nodename is unique before placing the system into service.
Do not assign the same nodename to any other equipment on the network.
Update the nodename after cloning any application that includes Ethernet communications to
a unique nodename.
Create a unique nodename for each device that does not create it automatically, such as M241
and M251 controllers.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Depending on the type of controller, the automatic creation of the NodeName (device name) may
differ in procedure. To create a unique name, some controllers integrate their IP address, others
use the MAC address of the Ethernet adapter. In this case, you do not have to change the name.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 111
Common Device Editor Dialogs
Step Action
1 Right-click the controller in the list and execute the command Change device name... from the
contextual menu.
Result: The Change device name dialog box opens.
2 In the Change device name dialog box, enter a unique device name in the box New.
3 Click the OK button to confirm.
Result: The device name you entered is assigned to the controller and is displayed in the
column NodeName of the list.
NOTE: Device name and NodeName are synonymous.
112 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Example:
Connection Mode → Nodename via NAT (Remote TCP) selected and address and nodename
specified
If you switch to Connection Mode → Automatic, the information is converted to a URL, starting with
the prefix enodename3://
If an IP address has been entered for the connection mode, the information is converted to a URL
starting with a prefix. For the Connection Mode → IP Address , the prefix etcp3:// is used. For
the Connection Mode → IP Address (Fast TCP) , the prefix etcp4:// is used. For example,
etcp4://<IpAddress>.
NOTE: In the Controller Assistant and the Diagnostics tools, an IP address can additionally have
the prefix etcp2://. This is only available for PacDrive M controllers.
If a nodename has been entered for the connection mode (for example, when Connection Mode
→ Nodename has been selected), the information is converted to a URL starting with the prefix
enodename3://. For example, enodename3://<Nodename>.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 113
Common Device Editor Dialogs
1 PC
2 NAT router
3 Target device
114 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Enter the port of the NAT router to be used. Otherwise, the default port 1105 is used.
The information you enter is interpreted as a URL that creates a remote TCP bridge - using
TCP block driver - and then connects by scanning for a controller with the given nodename on the
local gateway.
NOTE: The NAT router can be located on the target controller itself. You can use it to create a
TCP bridge to a controller.
You can also scan a remote network via a remote controller (bridge controller). To achieve this,
enter the NAT Address/Port, and click the refresh button right to the NAT Address/Port text field.
The controllers that send a response to the remote network scan are listed in the list of controllers.
Each of these entries is marked by the icon REM being displayed in the first column. To fill the list
with more detailed information, right-click a controller entry and execute the command Refresh this
controller. If the controller supports this function, further information on the controller is added to
the list. Consult the Programming Guide specific to your controller.
1 Refresh button
2 REM icon
In the following example, the bridge controller, controller 2, and controller 3 are scanned.
1 Local subnet
2 Remote subnet
3 Bridge controller
4 Controller 3
5 Controller 2
6 NAT router
7 PC
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 115
Common Device Editor Dialogs
1 PC
2 NAT router
3 Target device
116 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
1 Refresh button
2 REM icon
In the following example, the bridge controller, controller 2, and controller 3 are scanned.
1 Local subnet
2 Remote subnet
3 Bridge controller
4 Controller 3
5 Controller 2
6 NAT router
7 PC
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 117
Common Device Editor Dialogs
1 PC / HMI
2 PC / HMI / devices with installed EcoStruxure Machine Expert gateway
3 Target device
118 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
The graphic shows an example that allows a connection from the PC to the target controller 3 (item
4 in the graphic) by using the address of hop PC2 (item 5 in the graphic) that must have a
EcoStruxure Machine Expert gateway installed.
1 Hop PC 1
2 Target controller 1: MyNotUniqueNodename
3 Target controller 2: MyNotUniqueNodename
4 Target controller 3: MyNotUniqueNodename
5 Hop PC 2
6 PC / HMI
7 Router
8 Ethernet
To verify whether the connection to a specific controller can be established, enter the Gateway
Address/Port, and click the Test button. If the controller sends a response to the network scan, an
entry for this controller is added to the list of controllers. This entry is marked by the icon GAT being
displayed in the first column.
To scan a specific gateway for available controllers, enter the Gateway Address/Port, and click the
refresh button right to the Gateway Address/Port text field. The controllers that send a response to
the gateway scan are listed in the list of controllers. Each of these entries is marked by the icon
GAT being displayed in the first column. To fill the list with more detailed information, right-click a
controller entry and execute the command Refresh this controller. If the controller supports this
function, further information on the controller is added to the list. Consult the Programming Guide
specific to your controller.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 119
Common Device Editor Dialogs
1 Refresh button
2 GAT icon
The gateway that is scanned can be located on a PC or on an HMI that can reside in the local or
in a remote subnet. In the following example, the bridge target controller 1 and target controller 2
are scanned.
1 Local subnet
2 Remote subnet
3 Target controller 1
4 Target controller 2
5 Gateway
6 PC
7 Ethernet
120 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
1 PC / HMI
2 PC / HMI / devices with installed EcoStruxure Machine Expert gateway
3 Target device
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 121
Common Device Editor Dialogs
The graphic shows an example that allows a connection from hop PC2 (item 5 in the graphic) that
must have a EcoStruxure Machine Expert gateway installed to the target controller 3 (item 4 in the
graphic).
1 Hop PC 1
2 Target controller 1: [Link]
3 Target controller 2: [Link]
4 Target controller 3: [Link]
5 Hop PC 2
6 PC
7 Router
8 Ethernet
To verify whether the connection to a specific controller can be established, enter the Gateway
Address/Port, and click the Test button. If the controller sends a response to the network scan, an
entry for this controller is added to the list of controllers. This entry is marked by the icon GAT being
displayed in the first column.
To scan a specific gateway for available controllers, enter the Gateway Address/Port, and click the
refresh button right to the Gateway Address/Port text field. The controllers that send a response to
the gateway scan are listed in the list of controllers. Each of these entries is marked by the icon
GAT being displayed in the first column. To fill the list with more detailed information, right-click a
controller entry and execute the command Refresh this controller. If the controller supports this
function, further information on the controller is added to the list. Consult the Programming Guide
specific to your controller.
122 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
1 Refresh button
2 GAT icon
The gateway that is scanned can be located on a PC or on an HMI that can reside in the local or
in a remote subnet. In the following example, the bridge target controller 1 and target controller 2
are scanned.
1 Local subnet
2 Remote subnet
3 Target controller 1
4 Target controller 2
5 Gateway
6 PC
7 Ethernet
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 123
Common Device Editor Dialogs
1 PC
2 PC / MODEM
3 Target modem
4 Target device
5 Phone line
To establish a connection to the modem, click the MODEM → Connect button. In the Modem
Configuration dialog box, enter the Phone number of the target modem and configure the
communication settings. Click OK to confirm and to establish a connection to the modem.
If the EcoStruxure Machine Expert gateway is stopped and restarted, any connection of the local
gateway is terminated. EcoStruxure Machine Expert displays a message that has to be confirmed
before the restart process is started.
After the connection to the modem has been established successfully, the MODEM button
changes from Connect to Disconnect. The list of controllers is cleared and refreshed scanning the
modem connection for connected controllers. You can double-click an item from the list of
controllers or enter a nodename in the Target Nodename: box to connect to a specific controller.
Click the MODEM → Disconnect button to terminate the modem connection and to stop and restart
the EcoStruxure Machine Expert gateway. The list of controllers is cleared and refreshed scanning
the Ethernet network.
124 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Overview
The Communication Settings tab in simple mode is displayed when the mode Simple mode has
been selected for the parameter Communication page in the Tools → Options → Device editor
dialog box (see EcoStruxure Machine Expert, Menu Commands, Online Help). It provides a
graphic view to configure the parameters for the communication between device and programming
system.
The Communication Settings tab in simple mode contains an illustration of the programming
device, the present gateway, and the target device with the connection status.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 125
Common Device Editor Dialogs
Select a gateway and a target device in the selection fields. The list entries you can select are
determined by the Manage gateways and Manage favorite devices parameters.
You can enter the target device in different ways:
By the IP address, for example [Link]
By the device address, for example [056D]
By the device name, for example MyDevice
NOTE: To search for a device via the device name, unique device names are required within the
network.
A status bullet at the right bottom of the gateway symbol indicates the communication status:
Color Description
Red Connection cannot be established.
Green Connection is established.
Black Connection state is not defined.
NOTE: Some communication protocols do not allow a periodic verification of the gateway. Thus,
the status cannot be displayed.
Click the status bullet of the target device to start a network scan for the device. However, this is
only possible if the gateway has not already started searching.
Element Description
Scan network... button Opens the Select Device dialog box that lists the
configured gateways and their associated devices.
Gateway list –
Add new gateway... Opens the Gateway dialog box for adding a new
gateway (see EcoStruxure Machine Expert, Menu
Commands, Online Help).
Manage gateways... Opens the Manage gateways dialog box showing an
overview of all gateways. In this dialog box, you can
add or remove gateways. You can change the order
of the gateway entries by using the buttons.
Configure local Opens the Gateway Configuration dialog box
gateway... (see EcoStruxure Machine Expert, Menu
Commands, Online Help). It enables you to set up the
block driver configuration for the local gateway.
Device list –
Add current device to Adds the defined device to the list of favorite devices.
favorites
126 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Element Description
Manage favorite Opens a dialog box showing the list of favorite
devices... devices. In this dialog box, you can add or remove
devices or change the order of the entries. The
device at top of the list defines the default device.
Rename active device... Opens a dialog box for renaming the device.
Wink active device The connected controller flashes during login.
Send echo service EcoStruxure Machine Expert implements the echo
service that is similar to the ping tool.
In order to verify the quality of the network
connection, EcoStruxure Machine Expert sends five
echo data packets to the controller. The amount of
user data that is consecutively added to these
packets depends on the communication buffer size of
the controller.
A result message is displayed that indicates the
average round-trip delay time and the amount of user
data that has been echoed through the connection.
Store communication If this option is activated, EcoStruxure Machine
settings in project Expert can automatically restore the communication
settings, even if you are going to open the project on
another computer. If this option is not selected, the
settings are stored in the local EcoStruxure Machine
Expert options on your computer. In this case, you
must reconfigure them if you are going to use the
project on another computer.
Confirmed online mode If this option is activated, EcoStruxure Machine
Expert prompts the user for confirmation each time
one of the following online commands is to be
executed: Force values, Write values, Multiple
download, Release force list, Single cycle, Start,
Stop.
Filter network scans by If this option is activated, the list is reduced to those
target ID devices which have the same target ID as the device
configured in the project.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 127
Common Device Editor Dialogs
Overview
The Communication Settings tab in classic mode is displayed when the mode Classic mode has
been selected for the parameter Communication page in the Tools → Options → Device editor
dialog box (see EcoStruxure Machine Expert, Menu Commands, Online Help). It allows you to
configure the parameters for the communication between device and programming system.
The Communication Settings tab in classic mode provides a tree structure to configure the
parameters:
128 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Color Description
Red Connection cannot be established.
Green Connection is established.
Black Connection state is undefined.
NOTE: Some communication protocols do not allow a periodic verification of the gateway. Thus,
the status cannot be displayed.
Indented below the Gateway node (open/close via the +/- sign), you will see entries for the devices
which are reachable through this gateway. The device entries are preceded by a symbol.
Entries with a target ID different to that of the device configured in the project, are displayed in gray
font. To obtain an up-to-date list of the available devices, use the button Scan network.
The device nodes consist of a symbol followed by the node name and the node address. In the
right part of the window, the respective Device Name, Device Address, Number of Channels,
Target ID, Target Name, Target Type, Target Vendor, and Target Version are shown.
In the Select the network path to the controller field, the gateway channel is specified automatically
by selecting the channel in the tree structure.
NOTE: The parameter Number of Channels displays the number of channels that is supported by
the selected controller. You cannot monitor online the number of channels that are being used.
A channel is a connection to a client (such as Diagnostics, Logic Builder, WebVisu, OPC, HMI).
Depending on the communication service, a client may occupy more than one channel for a short
time. When all channels supported by the controller are being used, Logic Builder displays the
message Connection denied by device: All available communication channels are already in use.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 129
Common Device Editor Dialogs
130 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Option Description
Don't store communication Activate this option if the network path definition should not be stored in the
settings in project project, but in the local option settings on your computer. Therefore, the
path setting is restored if the project is reopened on the same computer. It
will have to be redefined if the project is used on another system.
Confirmed online mode Activate this option if the user should be prompted for confirmation when
selecting one of the following online commands: Force values, Multiple
download, Release force list, Single cycle, Start, Stop, Write values.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 131
Common Device Editor Dialogs
Configuration
Overview
The Configuration view is only available in the device editor if the option Show generic device
configuration views in the Tools → Options → Device editor dialog box is activated. The
Configuration view shows the device-specific parameters, and, if allowed by the device description,
provides the possibility to edit the parameter values.
Configuration view of the device editor
Element Description
Parameter Parameter name, not editable
Type Data type of parameter, not editable
Value Primarily, the default value of the parameter is displayed directly or
by a symbolic name. If the parameter can be modified (this depends
on the device description, non-editable parameters are displayed as
gray-colored), click the table cell to open an edit frame or a selection
list to change the value. If the value is a file specification, the dialog
box for opening a file opens by double-clicking the cell. It allows you
to select another file.
Default Value Default parameter value, not editable
Unit Unit of the parameter value (for example: ms for milliseconds), not
editable
Description Short description of the parameter, not editable
132 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Parameter
Overview
The Parameter view displays the controller-specific parameters in a table. You can edit the Value
of those parameters that are defined as editable in the device description. This function is not
available for all supported controllers. Consult the Programming Guide specific to your controller
for further information.
The view contains the following elements:
Element Description
Parameters Indicates the parameter name, not editable.
Type Indicates the data type of the parameter, not editable.
Value The default value of the parameter is displayed directly or by a
symbolic name.
If the value can be modified, double-click the field to open an edit
frame, a selection list, or a file selection dialog box.
Parameters that are not defined as editable in the device description
are displayed as gray-colored in this list.
Default Value Indicates the default parameter value as defined in the device
description, not editable
Unit Indicates the unit of the parameter value (for example: ms for
milliseconds), not editable.
Description Indicates the short description of the parameter as defined in the
device description, not editable.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 133
Common Device Editor Dialogs
Applications
Overview
The Applications view of the device editor serves to scan and to remove applications on the
controller. Information on the content of the application can be available as well as some details on
the application properties.
Element Description
Applications on the PLC This text box lists the names of applications which have been found
on the controller during the last scan (by clicking Refresh List).
If no scan has been executed yet or if a scan is not possible because
no gateway is configured (see page 125) for a connection, an
appropriate message is displayed.
Remove Click these buttons to remove the application currently selected in
Remove All the list or all applications from the controller.
Details Click this button to open a dialog box showing the information as
defined in the Information tab of the Properties dialog box of the
application object.
Content If, in the View → Properties → Application build options, the option
Download Application Info is activated for the application object
(see EcoStruxure Machine Expert, Menu Commands, Online Help),
then additional information on the content of the application is loaded
to the controller.
Click the Content button to view the different POUs, in a comparison
view. Upon several downloads, this information allows you to
compare the code of the new application with that already available
on the controller. This provides more information for decisions on
how to log in. For further information, refer to the description of the
Login command.
Refresh List Click this button to scan the controller for applications. The list will be
updated accordingly.
134 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 135
Common Device Editor Dialogs
Synchronized Files
Overview
The Synchronized Files view of the device editor lists the files that are downloaded to the controller
when the application is downloaded:
External files, for example, that were added to an application.
Implicit files, such as the source code archive file, are displayed only in this view if the time of
download is configured and the option Show implicit files for application download on the editor
of a PLC is selected in the Tools → Options → Device Editor dialog box (see EcoStruxure
Machine Expert, Menu Commands, Online Help).
This function is not available for all supported controllers. Consult the Programming Guide specific
to your controller for details on this function.
136 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Files
Overview
The Files view of the device editor serves to transfer files between the host and the controller. You
can choose any file from a directory of the local network to copy it to the file directory of the
currently connected runtime system, or vice versa.
This view is divided in two parts:
The left part shows the files on the Host.
The right part shows the files on the Runtime system.
Element Description
Updates the Runtime list.
Location Specifies the folder of the respective file system that will be used for
the file transfer.
Select an entry from the list or browse in the file system tree.
<< >> File transfer between EcoStruxure Machine Expert and controller
(see paragraph below).
For the directories in the file trees there are the following variants:
Element Description
Normal file directory.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 137
Common Device Editor Dialogs
138 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Log
Overview
The Log view of the device editor is used to display the events which have been logged on the
runtime system of the controller.
This concerns:
Events at system start or shutdown (loaded components and their versions)
Application download and boot project download
Customer-specific entries
Log entries of I/O drivers
Log entries of the data server
Element Description
Severity The events of the log are grouped in four categories:
warning
error
exception
information
The buttons in the bar above the listing display the number
of loggings in the respective category. Click the buttons to
switch on or off the display of the entries of each category.
Time Stamp Date and time:
Example: 13.01.2007 09:48.
Description Description of the event:
Example: <Application> started
Component Choose a particular component in order to obtain only
displayed log entries regarding this component. The default
setting is <All components>.
Logger The selection list provides the available loggings. The default
setting is <Default Logger>, which is defined by the runtime
system.
Updates the list.
Exports the list to an XML file. The dialog box for saving a file
opens. The file filter is set to xml-files (*.xml). The log file is
stored with the specified file name with extension .XML in the
chosen directory.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 139
Common Device Editor Dialogs
Element Description
Displays log entries stored in an XML file which may have
been exported as described above. The dialog box for
browsing for a file opens. The filter is set to xml-files (*.xml).
Choose the desired log file. The entries of this file are
displayed in a separate window.
Clears the log table by removing the displayed entries.
Troubleshooting
In case an error is detected and displays the text *SOURCEPOSITION*, you can open the
respective function by double-click or by executing the command Show source code in editor from
the contextual menu. The cursor marks the relevant position. You can also use the project archive
including the Download information files and the exported log file for diagnostics. In case of
protected functions, the message The source code is not available for <function name> is
displayed.
140 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
PLC Settings
Overview
The PLC settings view of the device editor is used to configure general settings for the controller.
Element Description
Application for I/O handling Define here the application assigned to the device in the Devices
tree that will be monitored for the I/O handling. For EcoStruxure
Machine Expert, there is only one application available.
PLC settings area
Update IO while in stop Note for PacDrive controllers: Supported by TM5 / TM7 IOs but not
by controls or drive based IOs.
If this option is activated (default), the values of the input and output
channels are updated when the controller is stopped. In case of
expiration of the watchdog, the outputs are set to the defined default
values.
Behaviour for outputs in Stop From the selection list, choose one of the following options to define
how the values at the output channels are handled in case of
controller stop:
Keep current values
The present values will not be modified.
Set all outputs to default
The default values resulting from the mapping will be assigned.
Execute program
You can determine the outputs behavior by a program available
within the project. Enter the name of this program here and it will
be executed when the controller gets stopped. Click the button ...
to use the Input Assistant for this purpose.
Always update variables Global definition, if the I/O variables are updated in the bus cycle
task. This setting takes effect for the I/O variables of the slaves and
modules only if their update setting is defined as Disabled.
Disabled (update only if used in a task): The I/O variables are
only updated if they are used in a task.
Enabled 1 (use bus cycle task if not used in any task): The I/O
variables are updated in the bus cycle task if not used in any
other task.
Enabled 2 (always in bus cycle task): All variables are updated in
every cycle of bus cycle task, regardless of whether they are
being used or whether they are mapped to an input or to an
output channel.
You can set this option separately for each device in the I/O Mapping
dialog (see page 160).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 141
Common Device Editor Dialogs
Element Description
Bus cycle options area
Bus cycle task The selection list offers the tasks defined in the Task Configuration
of the active application (for example, MAST). The default setting
MAST is entered automatically.
<unspecified> means that the task is selected according to
controller-internal settings, which are therefore controller-
dependent.
NOTE: Setting the bus cycle task to <unspecified> may cause unintended behavior of your
application. Consult the Programming Guide specific to your controller.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not set the Bus cycle task to <unspecified>, unless you understand the bus cycle task settings
of the controller.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Additional Settings
Element Description
Generate force variables for IO This setting is only available if supported by the device. Consult the
mapping: Programming Guide specific to your controller for further
information.
If the option is activated, for each I/O channel, which is assigned to
a variable in the I/O Mapping dialog box, 2 global variables will be
created as soon as the application is built. These variables can be
used in an HMI visualization for forcing the I/O value. For further
information, refer to the I/O Mapping chapter (see page 155).
Enable diagnosis for device The library CAA Device Diagnosis is added to the project
automatically. For each device, a function block is generated in the
Applications tree. If the function block already exists, an extended
FB is used (for example, EtherCAT) or an additional function block
instance is added. This function block contains the general
implementation for the device diagnostics. By use of these function
block instances, the status of the devices can be retrieved in the
application. Furthermore, detected errors can be evaluated. The
library also provides functions for the programmatical evaluation of
the Devices tree (for example, search in child devices or jump to the
parent device). For detailed information, see the PDF document
CAA Device Diagnosis which is part of the library.
Show I/O warnings as errors Warnings concerning the I/O configuration are dumped as detected
errors.
142 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Overview
The Users and Groups view of the device editor is provided for devices supporting device Users
and Groups management. If supported by the device, you can view and edit the Users and Groups
management for the device. Thereafter, you can assign rights to allow certain user groups to
access objects on the controller at runtime by assigning Access Rights.
For the user management at the project level, refer to the Project → User Management →
Permissions... command (see EcoStruxure Machine Expert, Menu Commands, Online Help).
The device Users and Groups management can be pre-defined in the device description.
As in the project user management, users have to be members of at least one user group. Only
user groups can be assigned specific access rights (see page 148).
For managing Users and Groups, you have to login as Administrator user.
NOTE: It is not intended that the Users and Groups feature be used to protect the EcoStruxure
Machine Expert project against malicious access, but rather to help prevent mistakes from trusted
users.
If you want to protect your entire project, activate the option Enable project file encryption in the
Project Settings → Security dialog box (see EcoStruxure Machine Expert, Menu Commands,
Online Help).
If you want to protect only a part of your code inside the project, put this code inside a compiled
library (see EcoStruxure Machine Expert, Menu Commands, Online Help).
CAUTION
UNAUTHENTICATED, UNAUTHORIZED ACCESS
Do not expose controllers and controller networks to public networks and the Internet as much
as possible.
Use additional security layers like VPN for remote access and install firewall mechanisms.
Restrict access to authorized people.
Change default passwords at start-up and modify them frequently.
Validate the effectiveness of these measurements regularly and frequently.
Failure to follow these instructions can result in injury or equipment damage.
NOTE: You can use the security-related commands (see EcoStruxure Machine Expert, Menu
Commands, Online Help) which provide a way to add, edit, and remove a user in the online Users
and Groups management of the target device where you are logged in.
NOTE: You must establish user access-rights using EcoStruxure Machine Expert software. If you
have cloned an application from one controller to another, you will need to enable and establish
user access-rights in the targeted controller.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 143
Common Device Editor Dialogs
NOTE: The only way to gain access to a controller that has user access-rights enabled and for
which you do not have the password(s) is by performing an Update firmware operation using an
SD card or USB memory key (refer to the Controller Assistant User Guide for further information),
depending on the support of your particular controller, or by running a script. Since the process of
running a script is specific to each controller, refer to the chapters File Transfer with SD Card or
File Transfer with USB Memory Key in the Programming Guide of the controller you are using. This
will effectively remove the existing application from the controller memory, but will restore the ability
to access the controller.
Element Description
Synchronization Click the Synchronization button to switch on / off the synchronization
between the editor and the Users and Groups management in the controller.
If Synchronization is not activated, then the editor contains a Users and
Groups management configuration that has been imported from disk, or it
does not contain any configuration at all.
If Synchronization is activated, the data displayed in the editor is continuously
synchronized with the Users and Groups management configuration on the
connected controller.
If you invoke Synchronization while the editor contains a Users and Groups
configuration that is not synchronized with the device, you are prompted to
decide what will be displayed in the editor:
Upload from the device and overwrite the editor content: The Users and
Groups configuration from the controller is loaded to the editor. The
contents of the editor is overwritten.
Download the editor content to the device and overwrite the user
management there: The configuration from the editor is loaded to the
controller. The contents of the controller is overwritten.
Import from disk Click the Import from disk button to open a dialog box for selecting and
importing a Users and Groups management configuration from the disk.
When you click the button in the Users and Groups view, the file type is set
to Device user management files (*.dum). The Import from disk is available
when you are in offline mode or Synchronization is deactivated.
Export to disk Click the Export to disk button to open a dialog box for saving a file to the disk.
The Users and Groups management configuration is saved as an XML file.
When you click the button in the Users and Groups view, the file type is set
to Device user management files (*.dum).
Device user Name of the user who is logged into the controller.
144 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Editing or Viewing the Users and Groups Management Before any Users and Groups Have Been
Established
If the controller supports device Users and Groups management, proceed as follows during first
login:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 145
Common Device Editor Dialogs
Setting up a New User in the Users and Groups Management of the Controller
If the controller supports device Users and Groups management, you can add a new user as
follows:
146 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Loading a Users and Groups Management From a *.dum File, Modifying it, and Later Downloading it to
the Controller
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 147
Common Device Editor Dialogs
Access Rights
Overview
In the Access Rights view of the device editor, define the device access rights of device users to
objects in the controller.
In order for the Access Rights view to be available in the device editor of controllers, activate the
Show access rights page option in the Tools → Options → Device Editor dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help). Furthermore, Users and
Groups management must be set up in the controller.
Access Rights view of the device editor
148 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Modifying Access Rights to Controller Objects in the Users and Groups Management of the Controller
If the controller supports device Users and Groups management, you can assign access rights as
follows:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 149
Common Device Editor Dialogs
Element Description
Synchronization Click the Synchronization button to switch on / off the synchronization
between the editor and the Access Rights management in the controller.
If Synchronization is not activated, then the editor contains an Access Rights
management configuration that has been imported from disk, or it does not
contain any configuration at all.
If Synchronization is activated, the data displayed in the editor is continuously
synchronized with the Access Rights management configuration on the
connected controller.
If you invoke Synchronization while the editor contains an Access Rights
management configuration that is not synchronized with the device, you are
prompted to decide what will be displayed in the editor:
Upload from the device and overwrite the editor content: The Access
Rights configuration from the controller is loaded to the editor. The
contents of the editor is overwritten.
Download the editor content to the device and overwrite the user
management there: The configuration from the editor is loaded to the
controller. The contents of the controller is overwritten.
Load from disk Click the Load from disk button to open a dialog box for selecting and
importing a user access rights management configuration from the disk.
When you click the button in the Access Rights view, the file type is by default
set to Device rights management files (*.drm).
Save to disk Click the Save to disk button to open a dialog box for saving a file to the disk.
When you click the button in the Access Rights view, the file type is by default
set to Device rights management files (*.drm).
Device user Name of the user who is logged into the controller.
Objects Area
In the Objects tree structure on the left-hand side, the objects are listed that allow actions to be
executed in runtime mode. The objects are assigned by their object source. They are partially
sorted in object groups. In the Rights area on the right-hand side, you can configure the access
options of the selected object for a user group.
On the top level of the Objects tree structure there are two object categories grouped in folders:
File system objects
Runtime system objects
Indented below the object categories, there are further subnodes. The subnode Device, for
example, can, in turn, have the following subnodes:
Logger
PlcLogic
Settings
UserManagement
150 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Rights Area
In the Rights area on the right-hand side, the access rights of the selected object are displayed in
a table. For every user group, it displays the rights configured for the possible actions on the
selected object.
The following actions can be configured for the object:
Add/Remove
Modify
View
Execute
Icon Description
Access (action) is permitted explicitly.
The access right has been inherited from the parent object.
Access has not been permitted or denied explicitly, even for the parent
object. No access is possible
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 151
Common Device Editor Dialogs
Task Deployment
Overview
The Task deployment view of the device editor shows a table with inputs/outputs and their
assignment to the defined tasks. Before the information can be displayed, the project has to be
compiled and the code has to be generated. This information helps in troubleshooting in case that
the same input/output is updated in different tasks with different priorities.
Task deployment of the device editor
The table shows the tasks sorted by their task priority. Click the column heading (task name) to
display only the variables assigned to this task. To show all variables again, click the first column
(I/O channels).
To open the I/O mapping table of a channel, double-click the input or output.
A blue arrow indicates the task of the bus cycle.
In the example above, the variable usiBK5120Out AT %QB0 is used in 2 different tasks. In this
situation, the output, set by one task, can be overwritten by the other task: this can lead to an
undefined value. In general, it is ill-advised to write output references in more than one task, as it
makes the program difficult to debug and often may lead to unintended results in the operation of
your machine or process.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not write to an output variable in more than one task.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
152 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Status
Overview
The Status view of the device editor shows status information (for example, Running, Stopped) and
specific diagnostic messages from the respective device; also on the used card and the internal
bus system.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 153
Common Device Editor Dialogs
Information
Overview
The Information view of the device editor shows some general information on the device currently
selected in the Devices tree: Name, Vendor, Type, Version number, Order Number, Description,
Image.
154 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Section 6.2
I/O Mapping
I/O Mapping
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 155
Common Device Editor Dialogs
I/O Mapping
Overview
The I/O Mapping view of the device editor is named <devicetype> I/O Mapping (for example,
PROFIBUS DP I/O Mapping). It serves to configure an I/O mapping of the controller. This means
that project variables used by the application are assigned to the input, output, and memory
addresses of the controller.
Define the application which should handle the I/Os in the PLC settings view (see page 141).
NOTE: If supported by the device, you can use the online configuration mode to access the I/O
hardware without having an application loaded beforehand. For further information, refer to the
description of the Online Config Mode (see EcoStruxure Machine Expert, Menu Commands,
Online Help).
See the following chapters:
Working with the I/O Mapping Dialog (see page 158)
I/O Mapping in Online Mode (see page 163)
Implicit Variables for Forcing I/Os (see page 164)
156 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Element Description
Create variable on I/Os mapping Select or deselect this option to activate or deactivate the automatic
I/O mapping function.
Mapping area
Bitwise Select this option to create variables for each bit.
Module-wise Select this option to create a variable for each module, not for the
individual bits.
Naming Rule area
text box Enter the following characters preceded by a # symbol to specify the
parts the variable name will consist of:
Enter #X to integrate an i for inputs and a q for outputs in the
variable name.
Enter #T to integrate the prefix code for the respective data type
of the variable in the variable name. The prefixes that are used for
the different data types are listed in the Recommendations on the
Naming of Identifiers chapter (see page 624).
Enter #D to integrate the name of the device in the variable name.
Enter #C to integrate the name as defined in the Channel column
in the variable name.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 157
Common Device Editor Dialogs
Overview
The following is an illustration of the I/O Mapping tab of the device editor:
Element Description
Channel Symbolic name of the input or output channel of the device
Address Address of the channel, for example: %IW0
Type Data type of the input or output channel, for example: BOOL
If the data type is not standard, but a structure or bit field defined in the device
description, it will be listed only if it is part of the IEC standard. It is indicated
as IEC type in the device description. Otherwise, the entry of the table will be
empty.
158 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Element Description
Default value Default value that is assigned to the channel when the controller is set to
STOP mode.
This column is only available if the option Set all outputs to default is selected
for the parameter Behaviour for outputs in Stop in the PLC Settings view of
the device editor (see page 141).
You can edit this field only if you are mapping to a new created variable or if
no mapping is specified. When you are mapping to an existing variable, the
initialization value of the variable is used as the default value.
NOTE: In case a “new” variable and an “existing” variable (by using the
AT declaration) are mapped to the same output, the initialization value of the
“existing” variable is used as default value.
Unit Unit of the parameter value, for example: ms for milliseconds
Description Short description of the parameter
Current Value Present value of the parameter, displayed in online mode
NOTE: Inputs and outputs that are not used in the application are not read by the controller in
online mode. To indicate that these inputs and outputs are not used, they are marked with a gray
background. Any values that might appear in these gray lines are invalid.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 159
Common Device Editor Dialogs
If the value has been modified, the subsequent addresses (up to the next fixed address) will be
adapted correspondingly:
If you want to remove the fixation of the value, reopen the address edit field, delete the address
entry, and close with Enter. The address and the identified succeeding addresses will be set back
to the values they had before the manual modification. The M symbol will be removed.
160 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
See in the following example an output mapping on the existing variable xBool_4:
NOTE: When you are mapping to an existing variable, the initialization value of the variable is used
as the default value. You can edit the Default value field only if you are mapping to a new created
variable or if no mapping is specified.
If you want to define a new variable, enter the desired variable name.
Example: bVar1
In this case, the symbol will be inserted in the Mapping column and the variable will be
internally declared as a global variable. From here, the variable will be available globally within
the application. The mapping dialog is another place for the declaration of global variables.
NOTE: Alternatively, an address can also be read or written within a program code, such as
in ST (structured text).
Considering the possibility of changes in the device configuration, do the mappings within the
device configuration dialog.
NOTE: If a UNION is represented by I/O channels in the mapping dialog, it depends on the device
whether the root element is mappable or not.
If a declared variable of a given data type is larger than that to which it is being mapped, the value
of the variable being mapped will be assigned a truncated to the size of the mapped target variable.
For example, if the variable is declared as a WORD data type, and it is mapped to a BYTE, only
8 bits of the word will be mapped to the byte.
This implies that, for the monitoring of the value in the mapping dialog, the value displayed at the
root element of the address will be the value of the declared variable - as currently valid in the
project. In the subelements below the root, the particular element values of the mapped variable
will be monitored. However, only part of the declared value may be displayed among the
subelements.
A further implication is when you map a declared variable to physical outputs. Likewise, if you map
a data type that is larger than the output data type, the output data type may receive a truncated
value such that it may affect your application in unintended ways.
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that the declared data type that is being mapped to physical I/O is compatible with the
intended operation of your machine.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 161
Common Device Editor Dialogs
Element Description
Reset mapping Click this button to reset the mapping settings to the defaults
defined by the device description file.
Always update variables Definition if the I/O variables are updated in the bus cycle
task (see page 141). The default value is defined in the
device description.
Use parent device settings: Update according to the
settings of the parent device.
Enabled 1 (use bus cycle task if not used in any task):
The I/O variables are updated in the bus cycle task if not
used in another task.
Enabled 2 (always in bus cycle task): The variables are
updated in every cycle of bus cycle task, regardless of
whether they are being used or whether they are mapped
to an input or to an output channel.
IEC Objects
This part of the tab is only available if implicitly a function block instance of a device has been
created, which can be accessed by the application (for example, in order to restart a bus or to poll
information). Whether such an instance is available and how it can be used, depends on the
controller. Consult the Programming Guide specific to your controller.
162 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 163
Common Device Editor Dialogs
Overview
During the commissioning of a plant or a machine, it may be necessary to force I/Os. For this
purpose, you can generate special force variables for each I/O channel which is mapped on a
variable in the I/O Mapping tab of the device editor.
As a precondition the setting Generate force variables for IO mapping has to be activated in the
PLC settings tab. Then, at each build run of the application, for each mapped I/O channel,
two variables are generated according to the following syntax. Any empty spaces in the channel
name are replaced by underscores.
<devicename>_<channelname>_<IECaddress>_Force of type BOOL, for activating and
deactivating the forcing
<devicename>_<channelname>_<ECaddress>_Value of datatype of the channel, for defining the
value to be forced on the channel
These variables will be available in the input assistant in category Variables → IoConfig_Globals_-
Force_Variables. They can be used in any programming objects, in visualizations, symbol
configuration, and so on, within the programming system.
A rising edge at the force variable activates the forcing of the respective I/O with the value define
by the value variable. A falling edge deactivates the forcing. Deactivating by setting the force
variable back to FALSE is necessary before a new value can be forced.
Consider the restrictions listed below.
Example
If the mapping is completed as shown in figure I/O Mapping tab of the device editor (see page 158),
then at a build (F11) of the application, the following variables will be generated and be available
in the input assistant:
Digitax_ST_Control_word_QW0_Force : BOOL;
Digitax_ST_Control_word_QW0_Value : UINT;
Digitax_ST_Target_position_QD1_Force : BOOL;
Digitax_ST_Target_position_QD1_Value : DINT;
Digitax_ST_Status_word_IW0_Force : BOOL;
Digitax_ST_Status_word_IW0_Value : UINT;
Digitax_ST_Position_actual_value_ID1_Force : BOOL;
Digitax_ST_Position_actual_value ID1_Value : DINT;
164 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Common Device Editor Dialogs
Restrictions
Only channels which are mapped on a variable in the I/O Mapping tab (i.e., a variable has to be
defined in the Variable column, no matter whether it is a new or an existing) can be forced by
the above described implicit variables.
Unused inputs / outputs as well as those which are mapped via AT declaration in an application
program cannot be forced.
The respective I/O channels have to be used in at least one task.
Forced I/Os are not indicated in the monitoring (watch view, I/O mapping dialog). The value is
only used implicitly in the I/O driver for writing onto the device.
Forced inputs are displayed correctly by the red force symbol (F), not however, forced
inputs/outputs.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 165
Common Device Editor Dialogs
166 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Program
EIO0000002854 06/2019
Part III
Program
Program
Chapter 7
Program Components
Program Components
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 169
Program Components
Section 7.1
Program Organization Unit (POU)
170 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
POU
Overview
The term Program Organizational Unit (POU) is used for all programming objects (programs,
function blocks, functions, etc.) which are used to create a controller application.
As defined in the IEC 61131 standard, a POU is a program, a function block, or a function.
However, in this document the term POU is used for programming elements in general that can
contain IEC code, such as methods, properties, interfaces etc. Whenever this document refers to
POUs in the more restricted sense as defined in IEC 61131, the term POU object is used.
POU Management
POUs which are managed in the Global node of the Applications tree are not device-specific but
they can be instantiated for the use on a device (application). For this purpose, program POUs
must be called by a task of the respective application.
But POU also is the name of a certain sub-category of these objects in the Add Object menu. At
this place, it just comprises programs, function blocks, and functions.
Therefore, a POU object in general is a programming unit. It is an object which is managed either
non-device-specifically in the Global node of the Applications tree or directly below an application
in the Applications tree. It can be viewed and edited in an editor view. A POU object can be a
program, function, function block.
It is possible to set certain Properties (such as build conditions, etc.) for each particular POU
object.
For a description on how to create a POU object, refer to the section Adding POU Objects to an
Application (see page 173). The POU objects you have created are added to the Assets view of
the Software catalog.
You can add a POU object available in the Assets view to the project in 2 different ways:
Select a POU object in the Assets view and drag it to the suitable node in the Applications tree.
Select a POU object in the Assets view and drag it to the logic editor view (see page 289).
Besides the POU objects, there are device objects used for running the program on the target
system (Resource, Application, Task Configuration etc.). They are managed in the Applications
tree.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 171
Program Components
Introduction
You can add Program Organization Unit (POU) objects to your application in the Software catalog
→ Assets or in the Applications tree.
The different types of POU objects are:
Program: It returns one or several values during operation. All values are retained from the last
time the program was run until the next. It can be called by another POU object.
Function Block: It provides one or more values during the processing of a program. As opposed
to a function, the values of the output variables and the necessary internal variables shall persist
from one execution of the function block to the next. So invocation of a function block with the
same arguments (input parameters) need not always yield the same output values.
Function: It yields exactly one data element (which can consist of several elements, such as
fields or structures) when it is processed. The call in textual languages can occur as an operator
in expressions.
172 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Step Action
1 In the Software catalog → Assets → POUs section, select an Application node, click the green plus
button, and execute the command POU.... As an alternative, you can right-click the Application node
of the controller and choose Add Object → POU.
The two methods are also available in the Applications tree.
Result: The Add POU dialog box opens.
2 In the Add POU dialog box, assign a name to your POU object by typing a name in the text field
Name.
NOTE: The name must not contain any space characters. If you do not enter a name, a name is
given by default.
Assigning a meaningful name to a POU may ease the organization of your project.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 173
Program Components
Step Action
3 Select the type of POU object you want:
Program
Function Block:
a. If you want your function block to extend an already existing function block, select Extends and
click the browser to select the function block you want in the Input Assistant.
b. Click the OK button.
c. If you want your function block to implement an interface, select Implements and click the
browser to select the interface you want in the Input Assistant.
d. Click the OK button.
e. If your function block implements an interface, in the list box Method implementation language,
select the programming language you want for editing the methods and properties defined in
the implemented interface.
Function:
a. Click the browse button to select the Return type you want in the Input Assistant.
b. Click the OK button.
4 From the list box Implementation Language, select the programming language you want for editing
your POU object.
5 Click the Open button.
Already defined POU objects are listed in the Software catalog → Assets → POUs section. You
can add them to your application, by dragging them to the Applications tree and dropping them on
an Application node. You can also drop a POU object on the logic editor view.
Step Action
1 Under the node Task Configuration of the controller, double-click the task to which you want to add
your program. In the Configuration tab, click Add Call.
Alternatively, in the Applications tree select the task to which you want to assign your program and
click the green plus button. Execute the command Program Call... from the list. Click the ... button.
Result: The Input Assistant dialog box is displayed.
2 In the tab Categories of the Input Assistant dialog box, select Programs.
3 Click to clear the check box Structured view.
4 In the Items panel, select the POU you want.
5 Click the OK button.
174 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Calling POUs
POUs can call other POUs. Recursion however is not allowed (a POU that calls itself).
When a POU assigned to an application calls another POU just by its name (without any
namespace (see page 866) added), consider the following order of browsing the project for the
POU to be called:
1. current application
2. Library Manager of the current application in the Tools tree
3. Global node of the Applications tree
4. Library Manager in the Global node of the Tools tree
If a POU with the name specified in the call is available in a library of the Library Manager of the
application as well as an object in the Global node of the Applications tree, there is no syntax for
explicitly calling the POU in the Global node of the Applications tree, just by using its name. In this
case move the respective library from the Library Manager of the application to the Library
Manager of the Global node of the Applications tree. Then you can call the POU from the Global
node of the Applications tree just by its name (and, if needed, that from the library by preceding the
library namespace).
Also refer to the chapter POUs for Implicit Checks (see page 192).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 175
Program Components
Program
Overview
A program is a POU object which returns one or several values during operation. All values are
retained from the last time the program was run until the next. However, there are not separate
instances of programs, unlike function blocks. When calling a function block, only the values in the
given instance of the function block are modified. The modifications are only affected when the
same instance is called again. Program value modifications will be retained until the program gets
called again even if called from another POU.
Adding a Program
To add a program to an existing application, select the application node in the Applications tree,
click the green plus button, and execute the command POU.... As an alternative, right-click the
Application node, and execute the command Add Object → POU from the contextual menu. To
add an application-independent POU, select the Global node of the Applications tree, and execute
the same commands.
In the Add POU dialog box select the Program option, enter a name for the program, and select
the desired implementation language. Click Open to confirm. The editor view for the new program
opens and you can start editing the program.
Declaring a Program
Syntax:
PROGRAM <program name>
This is followed by the variable declarations of input (see page 637), output (see page 638), and
program variables. Access variables are available as options as well.
Example of a program
176 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Calling a Program
A program can be called by another POU. However, a program call in a Function (see page 178)
is not allowed. There are no instances of programs.
If a POU has called a program and if the values of the program have been modified, these
modifications will be retained until the program gets called again. This applies even if it is called
from within another POU. Consider that this is different from calling a function block. When calling
a function block, only the values in the given instance of the function block are modified. The
modifications are only affected when the same instance is called again.
In order to set input and/or output parameters in the course of a program call, in text language
editors (for example, ST), assign values to the parameters after the program name in parentheses.
For input parameters, use := for this assignment, as with the initialization of variables
(see page 629) at the declaration position. For output parameters, use =>. See the following
example.
If the program is inserted via the Input Assistant using the option Insert with arguments in the
implementation view of a text language editor, it will be displayed automatically according to this
syntax with all parameters, though you do not necessarily have to assign these parameters.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 177
Program Components
Function
Overview
A function is a POU which yields exactly one data element (which can consist of several elements,
such as fields or structures) when it is processed. Its call in textual languages can occur as an
operator in expressions.
Adding a Function
To assign the function to an existing application, select the application node in the Applications
tree, click the green plus button, and execute the command POU.... As an alternative, right-click
the Application node, and execute the command Add Object → POU from the contextual menu.
To add an application-independent POU, select the Global node of the Applications tree, and
execute the same commands.
In the Add POU dialog box, select the Function option. Enter a Name (<function name>) and a
Return Data Type (<data type>) for the new function and select the desired implementation
language. To choose the return data type, click the button ... to open the Input Assistant dialog box.
Click Open to confirm. The editor view for the new function opens and you can start editing.
Declaring a Function
Syntax:
FUNCTION <function name> : <data type>
This is followed by the variable declarations of input and function variables.
Assign a result to the function. This means that the function name is used as an output variable.
Do not declare local variables as RETAIN or PERSISTENT in a function because this will have no
effect.
Example of a function in ST: this function takes 3 input variables and returns the product of the last
2 added to the first one.
178 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Calling a Function
The call of a function in ST can appear as an operand in expressions.
In IL, you can position a function call only within actions of a step or within a transition.
Functions (in contrast to a program or function block) contain no internal state information, that is,
invocation of a function with the same arguments (input parameters) always will yield the same
values (output). For this reason, functions may not contain global variables and addresses.
Example:
fun(formal1 := actual1, actual2); // -> error message
fun(formal2 := actual2, formal1 := actual1); // same semantics as the f
ollowing:
fun(formal1 := actual1, formal2 := actual2);
According to the IEC 61131-3 standard, functions can have additional outputs. They can be
assigned in the call of the function. In ST, for example, according to the following syntax:
out1 => <output variable 1> | out2 => <output variable 2> | ...further output variables
Example
Function fun is defined with 2 input variables in1 and in2 and two output variables out1 and
out2. The output values of fun are written to the locally declared variables loc1 and loc2.
fun(in1 := 1, in2 := 2, out1 => loc1, out2 => loc2);
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 179
Program Components
Method
Overview
A method is a language element similar to a function that can be used in a context of a function
block (see page 194). It can be regarded as a function which contains an instance of the respective
function block. Such as a function, a method has a return value, and its own declaration part for
temporary variables and parameters.
Also as a means of object-oriented programming, you can use interfaces (see page 185) to
organize the methods available in a project.
NOTE: When copying or moving a method or property from a POU to an interface, the contained
implementations are deleted automatically. When copying or moving from an interface to a POU,
you are requested to specify the desired implementation language.
Inserting a Method
To assign a method to a function block or interface, select the appropriate function block or
interface node in the Applications tree, click the green plus button and execute the command
Method. Alternatively, you can right-click the function block or interface node and execute the
command Add Object → Method from the contextual menu.
In the Add Method dialog box, enter a Name, the desired Return Type, the Implementation
Language, and the Access Specifier (see below). For choosing the return data type, click the
button ... to open the Input Assistant... dialog box.
Access specifier: For compatibility reasons, access specifiers are optional. The specifier PUBLIC
is available as an equivalent for having set no specifier.
Alternatively, choose one of the options from the selection list:
PRIVATE: The access on the method is restricted to the function block.
PROTECTED: The access on the method is restricted to the function block and its derivation.
INTERNAL: The access on the method is restricted to the present namespace (the library).
180 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Declaring a Method
Syntax:
METHOD <access specifier> <method name> : <return data type>VAR_INPUT ... END_VAR
For a description on how to declare interface handling methods, refer to the Interface chapter
(see page 185).
Calling a Method
Method calls are also named virtual function calls. For further information, refer to the chapter
Method Invocation (see page 208).
Note the following for calling a method:
The data of a method is temporary and only valid during the execution of the method (stack
variables). This means that the variables and function blocks declared in a method are
reinitialized at each call of the method.
Methods defined in an interface (see page 185) are only allowed to have input, output, and
input/output variables, but no body (implementation part).
Methods such as functions can have additional outputs. They must be assigned during method
invocation (see page 208).
Implementing a Method
Note the following for implementing a method:
In the body of a method, access to the function block instance variables is allowed.
If necessary, use the THIS pointer (see page 212) which always points on the present instance.
VAR_TEMP variables of the function block cannot be accessed in a method.
Method Description
Init A method named FB_init is by default declared implicitly, but can also be declared
explicitly. It contains initialization code for the function block as declared in the
declaration part of the function block. Refer to FB_init method (see page 647).
Reinit If a method named FB_reinit is declared for a function block instance, it is called
after the instance has been copied (like during Online Change) and will reinitialize the
new instance module. Refer to FB_init, FB_reinit methods (see page 647).
Exit If an exit method named FB_exit is desired, it has to be declared explicitly. There is
no implicit declaration. The Exit method is called for each instance of the function
block before a new download, a reset or during online change for all moved or deleted
instances. Refer to FB_exit method (see page 647).
Properties (see page 183) and interface properties (see page 186) each consist of a Set and/or a
Get accessor method.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 181
Program Components
182 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Property
Overview
A property in extension to the IEC 61131-3 is available as a means of object-oriented
programming. It consists of a pair of accessor methods (Get, Set). They allow encapsulating a
read or write access to variables declared inside of a POU or a GVL into a function call, while
keeping the syntax of a variable access.
To insert a property as an object below a program (see page 176), a function block (see page 194),
a GVL (see page 218), or an interface (see page 185) node, select the node in the Applications
tree, click the green plus button, and execute the command Property. As an alternative, right-click
the node and execute the command Add Object → Property from the contextual menu.
In the Add Property dialog box specify the Name, Return Type, desired Implementation Language,
and optionally an Access Specifier.
The same access specifiers are available as for methods (see page 180):
PUBLIC
PRIVATE
PROTECTED
INTERNAL
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 183
Program Components
Example:
Function block FB1 has a property seconds that uses a local variable milli. This variable is
determined by the properties Get and Set:
Get implementation example
seconds := milli / 1000;
Set implementation example
milli := seconds * 1000;
You can write the property of the function block (Set method), for example by
[Link] := 22;.
(fbinst is the instance of FB1).
You can read the property of the function block (Get method) for example by
testvar := [Link];.
In the following example, property seconds is assigned to function block FB1:
A property can have additional local variables but no additional inputs and - in contrast to a function
(see page 178) or method (see page 180) - no additional outputs.
NOTE: When copying or moving a method or property from a POU to an interface, the contained
implementations are deleted automatically. When copying or moving from an interface to a POU,
you are requested to specify the desired implementation language.
Monitoring a Property
A property can be monitored in online mode either with help of inline monitoring (see page 404) or
with help of a watch list (see page 480). The precondition for monitoring a property is the addition
of the pragma {attribute 'monitoring' := 'variable'} (refer to the chapter Attribute
Monitoring (see page 691)) on top of its definition.
184 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Interface
Overview
The use of interfaces is a means of object-oriented programming. An interface POU defines a set
of methods (see page 180) and properties (see page 183) without an implementation. An interface
can be described as an empty shell of a function block (see page 194). It must be implemented
(see page 206) in the declaration of the function block in order to get realized in the function block
instances. A function block can implement one or several interfaces.
The same method can be realized with identical parameters but different implementation code by
different function blocks. Therefore, an interface can be used/called in any POU without the need
that the POU identifies the particular function block that is concerned.
1 or multiple function blocks can now be inserted, implementing the above defined interface ITF.
Creating a function block implementing an interface
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 185
Program Components
When function block POU is added to the Applications tree, the methods Method1 and Method2
are automatically inserted below as defined by ITF. Here they can be filled with function block-
specific implementation code.
Using the interface in the function block definition
An interface can extend other interfaces by using EXTENDS (see following example Example for
Extending an Interface (see page 187)) in the interface definition.
Interface Properties
An interface can also define an interface property, consisting of the accessor methods Get and/or
Set. For further information on properties, refer to the chapter Property (see page 183). A property
in an interface like the possibly included methods is just a prototype that means it contains no
implementation code. Like the methods, it is automatically added to the function block, which
implements the interface. There it can be filled with specific programming code.
186 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Considerations
Consider the following:
It is not allowed to declare variables within an interface. An interface has no body (implemen-
tation part) and no actions. Just a collection of methods is defined within an interface and those
methods are only allowed to have input variables, output variables, and input/output variables.
Variables declared with the type of an interface are treated as references.
A function block implementing an interface must have assigned methods and properties which
are named exactly as they are in the interface. They must contain identically named inputs,
outputs, and inputs/outputs.
NOTE: When copying or moving a method or property from a POU to an interface, the contained
implementations are deleted automatically. When copying or moving from an interface to a POU,
you are requested to specify the desired implementation language.
Inserting an Interface
To add an interface to an application, select the Application node in the Applications tree or in the
Software Catalog → Assets, click the green plus button and select Add Other Objects... →
Interface. Alternatively, execute the command Add Object → Interface. If you select the node
Global before you execute the command, the new interface is available for all applications.
In the Add Interface dialog box, enter a name for the new interface (<interface name>). Optionally
you can activate the option Extends: if you want the current interface to be an extension
(see page 203) of another interface.
Click Add to confirm the settings. The editor view for the new interface opens.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 187
Program Components
Declaring an Interface
Syntax
INTERFACE <interface name>
For an interface extending another one:
INTERFACE <interface name> EXTENDS <base interface name>
Example
INTERFACE interface1 EXTENDS interface_base
188 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Action
Overview
You can define actions and assign them to function blocks (see page 194) and programs
(see page 176). An action is an additional implementation. It can be created in a different language
than the basic implementation. Each action is given a name.
An action works with the data of the function block or program to which it belongs. It uses the
input/output variables and local variables defined and does not contain its own declarations.
In this example, each call of the function block FB1 increases or decreases the output variable out,
depending on the value of the input variable in. Calling action Reset of the function block sets the
output variable out to 0. The same variable out is written in both cases.
Inserting an Action
To add an action, select the respective program or function block node in the Applications Tree or
in the Global node of the Applications Tree, click the green plus button, and execute the command
Action.... Alternatively, right-click the program or function block node, and execute the command
Add Object → Action. In the Add Action dialog box, define the action Name and the desired
Implementation Language.
EcoStruxure Machine Expert facilitates object-oriented programming using inheritance within
function blocks: When you execute Add Object on a function block that inherits from another
function block, the Action, Method, Property, and Transition elements used in the base function
block are listed for selection:
Action, Method, Property, and Transition elements with Access specifier = PUBLIC,
PROTECTED, and INTERNAL defined in the base function block are available for selection.
You can adapt the definition for the inherited object. In the inherited object, the same Access
specifier is assigned as to the source elements.
Action, Method, Property, and Transition elements with Access specifier = PRIVATE are not
available for selection because access is restricted to the base function block.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 189
Program Components
Calling an Action
Syntax
<Program_name>.<Action_name>
or
<Instance_name>.<Action_name>
Consider the notation in FBD (see the following example).
If it is required to call the action within its own block, that is the program or function block it belongs
to it is sufficient to use the action name.
Examples
This section provides examples for the call of the above described action from another POU.
Declaration for all examples:
PROGRAM PLC_PRG
VAR
Inst : Counter;
END_VAR
Call of action Reset in another POU, which is programmed in IL:
CAL [Link](In := FALSE)
LD [Link]
ST ERG
Call of action Reset in another POU, which is programmed in ST:
[Link](In := FALSE);
Erg := [Link];
Call of action Reset in another POU, which is programmed in FBD:
Action in FBD
NOTE: The IEC standard does not recognize actions other than actions of the sequential function
chart (SFC). These actions are an essential part containing the instructions to be processed at the
particular steps of the chart.
190 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Transition
Overview
You can use transition objects as transition elements in a program or function block implemented
in SFC.
For further information, refer to the description of steps and transitions in the chapter SFC
Elements / ToolBox (see page 381).
EcoStruxure Machine Expert facilitates object-oriented programming using inheritance within
function blocks: When you execute Add Object on a function block that inherits from another
function block, the Action, Method, Property, and Transition elements used in the base function
block are listed for selection:
Action, Method, Property, and Transition elements with Access specifier = PUBLIC,
PROTECTED, and INTERNAL defined in the base function block are available for selection.
You can adapt the definition for the inherited object. In the inherited object, the same Access
specifier is assigned as to the source elements.
Action, Method, Property, and Transition elements with Access specifier = PRIVATE are not
available for selection because access is restricted to the base function block.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 191
Program Components
Overview
You have to add special POUs below an application to provide implicitly available check functions.
They verify array and range boundaries, the validity of pointers and verify the presence of division
by zero during runtime.
NOTE: The availability of the check functions have a runtime performance impact.
NOTE: For the check functions to verify the code of uncompiled referenced libraries, you have to
enter the Compiler defines string checks_in_libs in the Build tab of the Properties dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help) of the application.
To add monitoring functions under an application, select the application node in the Applications
tree and click the green plus button or execute the command Add Object → POU for implicit
checks....
The dialog box allows you to activate the following check functions for the selected application:
When you insert a check POU, the option is no longer available in the dialog box to help avoid a
double insertion. If the different types of check POUs have been added below the application, the
Add Object dialog box does not provide the POUs for implicit checks option any longer.
192 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
CAUTION
INCORRECT IMPLICIT CHECKS FUNCTIONALITY
Do not modify the declaration part of an implicit check function in order to maintain its functional
integrity.
Failure to follow these instructions can result in injury or equipment damage.
NOTE: You may, however, add local variables to the declaration part of an implicit check function.
NOTE: After having removed implicit check function (such as CheckBounds) from your application,
no Online Change is possible, just a download. An appropriate message is displayed.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 193
Program Components
Section 7.2
Function Block
Function Block
194 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
General Information
Overview
A function block is a POU (see page 171) which provides 1 or more values during the processing
of a controller program. As opposed to a function, the values of the output variables and the
necessary internal variables shall persist from one execution of the function block to the next.
Therefore, invocation of a function block with the same arguments (input parameters) need not
always yield the same output values.
In addition to the functionality described by standard IEC11631-3, object-oriented programming is
supported and function blocks can be defined as extensions (see page 203) of other function
blocks. They can include interface (see page 206) definitions concerning Method invocation
(see page 208). Therefore, inheritance can be used when programming with function blocks.
A function block always is called via an instance (see page 198), which is a reproduction (copy) of
the function block.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 195
Program Components
Option Description
Extends Enter the name of another function block available in the project, which
should be the base for the current one. For details, refer to Extension of a
Function Block (see page 203).
Implements Enter the names of interfaces (see page 185) available in the project, which
should be implemented in the current function block. You can enter several
interfaces separated by commas. For details, refer to Implementing
Interfaces (see page 206).
Access specifier For compatibility reasons, access specifiers are optional. Specifier PUBLIC
is available as an equivalent for having set no specifier.
Alternatively, choose one of the options from the selection list:
INTERNAL: The access on the function block is restricted to the current
namespace (the library).
FINAL: Deriving access is not possible that is the function block cannot
be extended by another one. Enables optimized code generation.
NOTE: The access specifiers are valid as of compiler version [Link]
and thus can be used as identifiers in earlier versions.
For further information, refer to the EcoStruxure Machine
Expert/CoDeSys compiler version mapping table in the EcoStruxure
Machine Expert Compatibility and Migration User Guide
(see EcoStruxure Machine Expert Compatibility and Migration, User
Guide).
Method implementation Choose the desired programming language for all method and property
language objects created via the interface implementation, independently from that set
for the function block itself.
Click Add to confirm the settings. The editor view for the new function block opens and you can
start editing.
196 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Example
FBexample shown in the following figure has 2 input variables and 2 output variables out1 and
out2.
out1 is the sum of the 2 inputs, out2 is the result of a comparison for equality.
Example of a function block in ST
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 197
Program Components
Overview
Function blocks are called (see page 199) through an instance which is a reproduction (copy) of a
function block (see page 195).
Each instance has its own identifier (instance name), and a data structure containing its inputs,
outputs, and internal variables.
Instances like variables are declared locally or globally. The name of the function block is indicated
as the data type of an identifier.
Example
Declaration (for example, in the declaration part of a program) of instance INSTANCE of function
block FUB:
INSTANCE: FUB;
The declaration parts of function blocks and programs can contain instance declarations.
198 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Overview
Function blocks (see page 195) are called through a function block instance. Thus a function block
instance has to be declared locally or globally. Refer to the chapter Function Block Instance
(see page 198) for information on how to declare.
Then the desired function block variable can be accessed using the following syntax.
Syntax
<instance name>.<variable name>
Considerations
Only the input and output variables of a function block can be accessed from outside of a
function block instance, not its internal variables.
Access to a function block instance is limited to the POU (see page 171) in which it was
declared unless it was declared globally.
At calling the instance, the desired values can be assigned to the function block parameters.
See the following paragraph Assigning Parameters at Call.
The input / output variables (VAR_IN_OUT) of a function block are passed as pointers.
In SFC, function block calls can only take place in steps.
The instance name of a function block instance can be used as an input parameter for a function
or another function block.
All values of a function block are retained until the next processing of the function block.
Therefore, function block calls do not always return the same output values, even if done with
identical arguments.
NOTE: If at least 1 of the function block variables is a remanent variable, the total instance is stored
in the retain data area.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 199
Program Components
200 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Overview
You can configure a memory reserve for the online change of function blocks. After you have made
modifications on the declaration of a function block (in particular after you have added a new
variable), and you perform an online change, it is no longer necessary to copy the instances of the
function block to a new memory area. Thus, the online change is performed faster and fewer errors
are detected.
If the memory reserve you configured is depleted, a message is displayed before the online change
is performed.
It is a good practice to configure the memory reserve for a function block before you download the
application to the controller. If you configure the memory reserve when the application is already
located on the controller, then you have to perform an online change that is even more time-
consuming.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 201
Program Components
Procedure of Configuring a Memory Reserve for the Online Change of Function Blocks
If you intend to perform later modifications on a function block that would require the function block
instance to be copied to other memory locations when executing an online change, then you can
use the Online Change Memory Reserve Settings command.
By default, the command is not available in the menus. Add this command via the Tools →
Customize menu (see EcoStruxure Machine Expert, Menu Commands, Online Help).
When you download the application to the controller, the memory size that is reserved for the
function block is calculated by the present size of the function block plus the memory reserve you
configured in the Online Change Memory Reserve view.
Future modifications to the function block can be downloaded to the controller with the online
change without having to copy all instances of the function block to a new memory area.
202 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Overview
Supporting object-orientated programming, a function block can be derived from another function
block. This means a function block can extend another, thus automatically getting the
methods/properties/actions/transitions and variables of the basing function block in addition to its
own.
The extension is performed by using the keyword EXTENDS in the declaration of a function block.
You can choose the EXTENDS option already during adding a function block to the project via the
Add Object dialog box.
For further information, refer to the sections describing how to add a method (see page 180), a
property (see page 183), an action (see page 189), or a transition (see page 191).
Syntax
FUNCTION_BLOCK <function block name> EXTENDS <function block name>
This is followed by the declaration of the variables.
Example
Definition of function block fbA
FUNCTION_BLOCK fbA
VAR_INPUT
x:int;
END_VAR
...
Definition of function block fbB
FUNCTION_BLOCK fbB EXTENDS fbA
VAR_INPUT
ivar: INT := 0;
END_VAR
...
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 203
Program Components
Extension by EXTENDS
Extension by EXTENDS means:
fbB contains all data and methods which are defined by fbA. An instance of fbB can now be
used in any context where a function block of type fbA is expected.
fbB is allowed to override the methods/properties/actions/transitions defined in fbA. This
means: fbB can declare a method with the same name and the same inputs and output as
declared by A.
fbB is not allowed to declare function block variables with the same name as used in fbA. In
this case, the compiler will generate an error message.
fbA variables and methods can be accessed directly within an fbB scope by using the SUPER
pointer (see page 210) (SUPER^.<method>).
NOTE: A function block can implement multiple interfaces, but it can only extend a single function
block.
Example
FUNCTION_BLOCK FB_Base
VAR_INPUT
END_VAR
VAR_OUTPUT
iCnt : INT;
END_VAR
VAR
END_VAR
THIS^.METH_DoIt();
THIS^.METH_DoAlso();
204 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 205
Program Components
Implementing Interfaces
Overview
In order to support object-oriented programming, a function block can implement several interfaces
(see page 185) which allows you to use methods (see page 180).
Syntax
FUNCTION_BLOCK <function block name> IMPLEMENTS <interface_1 name>|,<interface_2
name>, ..., <interface_n name>
A function block that implements an interface must contain all methods and properties (interface
properties (see page 186)) defined by this interface. This includes name, inputs, and the output of
the particular method or property which must be exactly the same.
For this purpose - when creating a new function block implementing an interface - automatically all
methods and properties defined in this interface will be inserted below the new function block in
the Applications Tree.
NOTE: If afterwards, methods are added to the interface definition, they will not be added
automatically in the concerned function blocks and thus produce compiler errors. Execute the
command Implement interfaces... (see EcoStruxure Machine Expert, Menu Commands, Online
Help) to perform this update explicitly.
When you use inheritance for function blocks, consider that if methods or attributes were created
by inheritance of an interface, either implement them, or delete them if the implementation of the
base function block is to be used. Pragma attributes are automatically inserted. They are detected
during compilation and messages are generated to remind you that the inherited methods or
properties have to be verified. Delete the pragma attributes after you have completely implemented
the new function block.
For further information, refer to the description of the Implement interfaces... command
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
206 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Example
INTERFACE I1 includes method GetName:
METHOD GetName : STRING
Function blocks A and B each implement interface I1:
FUNCTION_BLOCK A IMPLEMENTS I1
FUNCTION_BLOCK B IMPLEMENTS I1
Thus in both function blocks the method GetName has to be available and will be inserted
automatically below each when the function blocks are inserted in the Applications Tree.
Consider a declaration of a variable of type I1:
FUNCTION DeliverName : STRING
VAR_INPUT
l_i : I1;
END_VAR
This input can receive all function blocks that implement interface I1.
Example for function calls:
DeliverName(l_i := A_instance); // call with instance of type A
DeliverName(l_i := B_instance); // call with instance of type B
NOTE: A variable of an interface-type must get assigned an instance of a function block before a
method can be called on it. A variable of an interface-type always is a reference to the assigned
function block instance.
Thus a call to the interface method results in a call to the function block implementation. As soon
as the reference is assigned, the corresponding address is monitored in online mode. Otherwise,
if no reference has been assigned yet, the value 0 is displayed within monitoring in online mode.
For this example see in the implementation part of the function DeliverName:
DeliverName := l_i.GetName(); // in this case it depends on the "real"
type of l_i whether [Link] or [Link] is called
NOTE: See also the possibility to extend a function block (see page 203) by using the keyword
EXTENDS in the declaration.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 207
Program Components
Method Invocation
Overview
Object-oriented programming with function blocks is - besides of the possibility of extension
(see page 203) via EXTENDS - supported by the possible use of interfaces (see page 206) and
inheritance. This requires dynamically resolved method invocations, also called virtual function
calls.
Virtual function calls need some more time than normal function calls and are used when:
a call is performed via a pointer to a function block (pfub^.method)
a method of an interface variable is called ([Link])
a method calls another method of the same function block
a call is performed via a reference to a function block
VAR_IN_OUT of a base function block type can be assigned an instance of a derived function
block type
Virtual function calls make possible that the same call in a program source code will invoke
different methods during runtime.
For more information and in-depth view, refer to:
Method (see page 180) for further information on methods.
THIS Pointer (see page 212) for using THIS pointer.
SUPER Pointer (see page 210) for using SUPER pointer.
Calling Methods
According to the IEC 61131-3 standard, methods such as normal functions (see page 178) can
have additional outputs. They can be assigned in the method call according to syntax:
<method>(in1:=<value> |, further input assignments, out1 => <output variable 1> | out2 => <output
variable 2> | ...further output variables)
This has the effect that the output of the method is written to the locally declared variables as given
within the call.
208 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Example
Assume that function blocks fub1 and fub2 EXTEND function block fubbase and IMPLEMENT
interface1. Method method1 is contained.
Possible use of the interfaces and method calls:
PROGRAM PLC_PRG
VAR_INPUT
b : BOOL;
END_VAR
VAR
pInst : POINTER TO fubbase;
instBase : fubbase;
inst1 : fub1;
inst2 : fub2;
instRef : REFERENCE to fubbase;
END_VAR
IF b THEN
instRef REF= inst1; (* Reference to fub1 *)
pInst := ADR(instBase);
ELSE
instRef REF= inst2; (* Reference to fub2 *)
pInst := ADR(inst1);
END_IF
pInst^.method1(); (* If b is true, fubbase.method1 is c
alled, else fub1.method1 is called *)
instRef.method1(); (* If b is true, fub1.method1 is call
ed, else fub2.method1 is called *)
Assume that fubbase of the upper example contains 2 methods method1 and method2. fub1
overrides method2 but not method1.
method1 is called as shown in the upper example.
pInst^.method1(); (* If b is true fubbase.method1 is called, else fub1.
method1 is called *)
For calling via THIS pointer, refer to THIS Pointer (see page 212).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 209
Program Components
SUPER Pointer
Overview
For each function block that extends a base function block, a pointer with name SUPER is
automatically available. It points to the base function block instances.
This provides an effective solution for the following issue:
SUPER offers access to methods of the base function block implementation. With the keyword
SUPER, a method can be called which is valid in the base (parent) class instance. Thus, no
dynamic name binding takes place.
SUPER may only be used in methods and in the associated function block implementation.
Because SUPER is a pointer to the base function block, you have to dereference it to get the
address of the function block: SUPER^.METH_DoIt
NOTE: The functionality of SUPER is not yet implemented for Instruction List.
210 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Example
Use of SUPER and THIS pointers.
FUNCTION_BLOCK FB_Base
VAR_OUTPUT
iCnt : INT;
END_VAR
METHOD METH_DoIt : BOOL
iCnt := -1;
PROGRAM PLC_PRG
VAR
myBase: FB_Base;
myFB_1: FB_1;
iTHIS: INT;
iBase: INT;
END_VAR
myBase();
iBase := [Link];
myFB_1();
iTHIS := myFB_1.iCnt;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 211
Program Components
THIS Pointer
Overview
For each function block, a pointer with name THIS is automatically available. It points to its own
function block instance.
This provides an effective solution for the following issues:
If a locally declared variable in the method hides a function block variable.
If you want to refer a pointer to its own function block instance for using in a function.
NOTE: The functionality of THIS is not yet implemented for Instruction List.
212 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Example 1
Local variable iVarB shadows the function block variable iVarB.
FUNCTION_BLOCK fbA
VAR_INPUT
iVarA: INT;
END_VAR
iVarA := 1;
PROGRAM PLC_PRG
VAR
MyfbB: fbB;
END_VAR
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 213
Program Components
Example 2
Function call that needs a reference to its own instance.
FUNCTION funA
VAR_INPUT
pFB: fbA;
END_VAR
...;
FUNCTION_BLOCK fbA
VAR_INPUT
iVarA: INT;
END_VAR
...;
PROGRAM PLC_PRG
VAR
MyfbB: fbB;
END_VAR
MyfbB(iVarA:=0 , iVarB:= 0);
[Link]();
214 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Section 7.3
Application Objects
Application Objects
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 215
Program Components
Overview
Along with the standard data types, you can define your own data types. You can create structures
(see page 744), enumeration types (see page 746), and references (see page 732) as data type
units (DUTs) in a DUT editor (see page 435).
For a description of the particular standard and the user-defined data types, refer to the description
of the data types (see page 722).
216 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Example
The following example contains 2 DUTS, defining structures struct1 and struct2; struct2
extends struct1, which means that you can use struct2.a in your implementation to access
variable a.
TYPE struct1 :
STRUCT
a:INT;
b:BOOL;
END_STRUCT
END_TYPE
TYPE struct2 EXTENDS struct1 :
STRUCT
c:DWORD;
d:STRING;
END_STRUCT
END_TYPE
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 217
Program Components
Overview
A global variables list (GVL) is used to declare global variables (see page 639). If a GVL is placed
in the Global node of the Software catalog → Variables → Global Variables or the Applications
tree, the variables will be available for the entire project. If a GVL is assigned to a certain
application, the variables will be valid within this application.
To add a GVL to an existing application, select the application node in the Software catalog →
Assets → POUs or Applications tree, click the green plus button and select Global Variable List....
Alternatively you can right-click the node and execute the command Add Object → Add Global
Variable List.... If you select the Global node in these views, the new GVL object will application-
independent.
Use the GVL editor (see page 437) to edit a global variable list.
The variables contained in a GVL can be defined to be available as network variables
(see page 963) for a broadcast data exchange with other devices in the network. For this purpose,
configure appropriate network properties (in the menu View → Properties → Network Variables or
Network Variable Sender Properties) for the GVL.
NOTE: The maximum size of a network variable is 255 bytes. The number of network variables is
not limited.
NOTE: Variables declared in GVLs get initialized before local variables of POUs.
218 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Select the library in the upper part of the Library Manager to get the module tree. Select Param in
order to open the tab Library Parameters showing the declarations. Select the cell in column Value
(editable) and use the empty space to open an edit field. Enter the desired new value for
g_c_Arraysize. It will be applied to the current, local scope of the library after having closed the
edit field.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 219
Program Components
Overview
A network variable list (receiver) is used in the Software catalog → Variables → Global Variables
view and in the Applications tree. It defines variables, which are specified as network variables in
another device within the network.
NOTE: The maximum size of a network variable is 255 bytes. The number of network variables is
not limited.
Thus you can add a network variable list (receiver) object to an application if a network variable list
(sender) with special network properties (network variable list) is available in one of the other
network devices. This is independent of whether defined in the same project or in different projects.
If several of appropriate network variable lists (sender) are found within the present project for the
present network, select the desired network variable list (sender) from a selection list Sender when
adding a network variable list (receiver) via the dialog box Add Object → Network Variable List
(Receiver). Network variable lists (sender) from other projects must be imported as described in
this chapter.
This means that each network variable list (receiver) corresponds exactly to one network variable
list (sender) in another device.
Dialog box Add Network Variable List (Receiver)
220 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
NOTE: Only arrays whose bounds are defined by a literal or a constant are transferred to the
remote application. Constant expressions in this case are not allowed for bounds definition.
Example: arrVar : ARRAY[0..g_iArraySize-1] OF INT ; is not transferred
arrVar : ARRAY[0..10] OF INT ; is transferred
For further information, refer to the Network Communication chapter (see page 963).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 221
Program Components
222 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Step 2: Define the network properties of the network variable list (sender):
3 Click OK. The dialog box is closed and the network variable
list (sender) network properties are set.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 223
Program Components
224 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Step 2: View and / or modify the network settings of the network variable list (receiver):
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 225
Program Components
3 Under the Application node of the controller The editor for prog_rec opens on the right-hand
Dev_Receiver, double-click the POU prog_rec. side.
4 Enter the following code for the variable –
ivar_local:
5 Log on with sender and receiver applications within The variable ivar_local in the receiver gets the
the same network and start the applications. values of iglobvar as currently displayed in the
sender.
226 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Persistent Variables
Overview
This object is a global variable list (GVL), which only contains persistent variables of an application.
Thus it has to be assigned to an application. For this purpose, it has to be inserted in the
Applications tree via selecting the respective node, clicking the green plus button, and selecting
Add Other Objects → Persistent Variables....
Only those variables which are declared with VAR PERSISTENT and which are contained in this
list are persistent. The Add all Instance Paths command (see EcoStruxure Machine Expert, Menu
Commands, Online Help) adds all PERSISTENT declarations found in other POUs to the list.
Variables declared with VAR PERSISTENT are also retain variables. Retain variables have the
capacity to keep their values after executing a Reset warm command (see EcoStruxure Machine
Expert, Menu Commands, Online Help). The difference is, that persistent variables are only
reinitialized upon executing the Reset origin command (see EcoStruxure Machine Expert, Menu
Commands, Online Help) or by a new application download (after the application had been
removed from the controller). An exception is made if you modified their names or data types.
Persistent variable list
For further information, refer to the description of remanent variables (see page 641).
Also refer to the description of the special commands for handling persistent variables
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
Edit a persistent variable list in the persistence editor, which corresponds to the GVL editor
(see page 437). The VAR_GLOBAL PERSISTENT RETAIN is already preset in the first line.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 227
Program Components
Step Action
1 Select the respective application node in the Applications tree, click the green plus
button, and select Add Other Objects → Persistent Variables....
Alternatively, you can right-click the application node, and execute the command Add
Object → Persistent Variables....
2 In the Add Persistent Variables dialog box type a name for this list in the Name text
box.
3 Click Add.
Result: A persistent variable node is created in the Applications tree. For an example,
refer to the Overview paragraph in this chapter.
228 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
External File
Overview
To add an external file to the Global node of the Applications Tree or Tools Tree, select the Global
node, click the green plus button and execute the commands Add other objects → External File....
Click the ... button to open the dialog box for browsing a file. The path of this file is entered in the
File path text box. In the Name text box, the name of the chosen file is entered automatically
without extension. You can edit this field to define another name for the file under which it should
be handled within the project.
Add External File dialog box:
Description of the What Do You Want to Do with the External File? Section of the Dialog Box
Select one of the following options:
Option Description
Remember the link. The file will be available in the project only if it is available in the defined link path
Remember the link and embed into A copy of the file will be stored internally in the project but also the link to the
project. external file will be recalled. As long as the external file is available as defined,
the defined update options will be implemented accordingly. Otherwise just the
file version stored in the project will be available.
Embed into project. Just a copy of the file will be stored in the project. There will be no further
connection to the external file.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 229
Program Components
Description of the When the External File Changes, Then Section of the Dialog Box
If the external file is linked to the project, you can additionally select one of the options:
Option Description
reload the file automatically. The file is updated within the project as soon as it has been changed
externally.
prompt whether to reload the file. A dialog box pops up as soon as the file has been changed externally.
You can decide whether the file is updated also within the project.
do nothing. The file remains unchanged within the project, even when it is changed
externally.
Button Description
Display file properties... This button opens the dialog box for the properties of a file. This dialog
box also appears when you select the file object in the Applications
Tree or Tools Tree and execute the command Properties. In the tab
External file of this dialog box, you can view and modify the properties.
Add After you have completed the settings, click the Add button to add the
file to the Global node of the Applications Tree or Tools Tree. It is
opened in that tool which is defined as default for the given file format.
230 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Text List
Overview
A text list is an object managed globally in the Global node of the Applications Tree or assigned to
an application in the Applications Tree.
It serves the following purposes:
Multi-language support for static (see page 232) and dynamic (see page 233) texts and tooltips
in visualizations and in the alarm handling
Dynamic text exchange
Text lists can be exported and (re-) imported (see page 236). Export is necessary, if a language
file in XML format has to be provided for a target visualization, but is also useful for translations
(see page 237).
Possible formats of text lists:
Text
XML
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 231
Program Components
232 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Example of a GlobalTextList
Create Global Text List
NOTICE
UNINTENDED MODIFICATION OF IDENTIFIERS
Do not modify the identifiers when editing the exported list.
Failure to follow these instructions can result in equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 233
Program Components
Detailed Example
This example explains how to configure a visualization element, which displays the corresponding
message when an error is detected in an application that processes error events identified via
numeric IDs assigned to an integer variable ivar_err.
Provide a dynamic textlist named ErrorList where the message texts for error IDs 0 to 4 are defined
in languages German, English, and Default:
Within a table cell, you can add a line break by pressing the keyboard shortcut Ctrl + Enter.
To use the error IDs in the visualization configuration, define a STRING variable, for example
strvar_err. To assign the integer value of ivar_err to strvar_err, use
strvar_err:=INT_TO_STRING(ivar_err);.
strvar_err can be entered as Textindex parameter in the configuration of the Dynamic texts
properties of a visualization element. This element will display the appropriate message in online
mode.
234 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
The next example is for processing the error ID using project variables and configuration of a
visualization element (Properties), which should display the appropriate message:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 235
Program Components
Formatting of Texts
The texts can contain formatting definitions (%s,%d,…), which allow to include the present values
of variables in a text. For the possible formatting strings, see the Visualization part of the
EcoStruxure Machine Expert online help.
When using text with formatting strings, the replacement is done in the following order:
The actual text string to be used is searched via list name and ID.
If the text contains formatting definitions, these are replaced by the value of the respective
variable.
236 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 237
Program Components
Image Pool
Overview
Image pools are tables defining the file path, a preview, and a string ID for each image. By
specifying the ID and (for unique accessing) additionally the image file name, the image can be
referenced, for example, when being inserted in a visualization (configuration of the properties of
an image element, refer to Using Images Which are Managed in Image Pools (see page 241) ).
In a library project, you can create an image pool. If you then declare the library to be a symbol
library, you can use the images it contains inside your project visualizations. To achieve this, right-
click the ImagePool node of the library project, select Properties, and set the Symbol library
settings in the Image Pool tab (by clicking the button Mark library as symbol library and optionally
selecting a Text list for symbol translation).
After you have added the library to your project, the image pool will appear (as you named it) in the
ToolBox when a visualization editor is active.
NOTE: Reduce the size of an image file as much as possible before adding it to an image pool.
Otherwise, the project size and the loading and storing efforts of visualization applications,
including images, can become large.
238 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Element Description
ID String ID (for example logo, y_icon, 2);
A unique referencing of an image is achieved by the combination of image list
name and ID (for example, List1.basic_logo).
File name Path of the image file (for example, C:\programs\images\[Link]).
Image formats supported by EcoStruxure Machine Expert:
BMP
EMF
GIF
ICO
JPG
PNG
SVG
TIFF
The controller you are using may not support all image formats. Consult the
Programming Guide specific to your controller for further information.
If the image file is stored in the directory for image files (as defined in Tools →
Options → Visualization, you only have to enter the file name in this text box.
Image Preview of the image.
Link type Information on how the image file is linked to the project.
Specify the Link type when you add the image file manually in the dialog box
Select image. Refer to the description Creating and Editing an Image Pool
(see page 240).
NOTE: If the target system does not support images in the vector image format SVG, they are
automatically converted to the format PNG during download. For information on the supported
image formats, refer to the device descriptions provided by your hardware manufacturer.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 239
Program Components
240 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Element Description
Image File
Enter the path of the image file or click the button for getting the
standard dialog box for browsing the local file system. Select the desired file
or files. Multiple selection is possible.
What do you want to do with Choose a link type:
the image file? Remember the link: The file is only available in the project if it is available
in the specified path. Files specified without path must be stored in the
project folder.
Remember the link and embed into project: A copy of the file is stored
internally in the project. The link to the specified path is stored as well. As
long as the image file is available under the stored path, the update action
as defined below, is valid. As soon as the image file is removed from the
specified location, only the copy of the file stored internally in the project
will be used.
Embed into project: Only a copy of the file is stored internally in the
project. The link to the external path is not stored.
If you choose the option Remember the link and embed into project, you can
select one of the following update actions:
When the image file changes, then
reload the file automatically.
prompt whether to reload the file.
do nothing.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 241
Program Components
242 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Program Components
Section 7.4
Application
Application
Application
Overview
An application is a set of objects which are needed for running a particular instance of the controller
program on a certain hardware device (controller). For this purpose, independent objects managed
in the Global node of the Applications tree are instantiated and assigned to a device. This meets
the concept of object-orientated programming. However, you can also use purely application-
specific POUs.
An application is represented by an application object in the Applications tree. Below an application
entry, insert the objects defining the application resource set.
One application is available for each controller. It is not possible to add further applications.
A part of each application is the Task Configuration controlling the run of a program (POU
instances or application-specific POUs). Additionally, it can have assigned resource objects like
global variable lists, libraries, and so on. These - in contrast to those managed in the Global node
of the Applications tree - can only be used by the particular application and children. For the rules,
refer to the description of arranging and configuring objects in the Devices tree (see page 44).
Consideration
When going to log in with an application on a target device (controller or simulation target), two
checks are performed: Which application is currently in the controller? Are the application
parameters in the controller matching those in the application within EcoStruxure Machine Expert?
Appropriate messages indicate mismatches and offer some ways to continue in this case. Also you
have the possibility to delete the application in the controller. Refer to the description of the Login
command (see page 254) for more details.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 243
Program Components
244 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Task Configuration
EIO0000002854 06/2019
Chapter 8
Task Configuration
Task Configuration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 245
Task Configuration
Task Configuration
Overview
The Task Configuration defines 1 or several tasks for controlling the processing of an application
program.
It is a resource object for an application (see page 243). It has to be inserted in the Applications
tree below an application node. A task can call an application-specific program POU, which is only
available in the Applications tree below the application. It can also call a program which is managed
in the Global node of the Applications tree. In the latter case, the program that is available globally
will be instantiated by the application.
You can edit a task configuration in the Task Configuration editor (see page 465).
In online mode, the Task Configuration editor provides a monitoring view that presents information
on cycles, cycle times, and task status.
As an additional functionality of the task configuration, if supported by the device, the monitoring
view allows a dynamic analysis of the POUs which are controlled by a task. It supplies information
about the cycle times, the quantity of function block calls and the unused code lines.
246 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Task Configuration
Adding Tasks
Introduction
You can add tasks to your application via the Applications tree.
Procedure
Step Action
1 In the Applications tree, select the Task Configuration node, click the green plus
button, and execute the command Task....
Alternatively, you can right-click the Task Configuration node, and select Add Object
→ Task... from the context menu.
Result: The Add Task dialog box opens.
2 In the Add Task dialog box, enter a name in the Name: text box.
Note: The name must neither contain any space nor exceed a length of 32
characters.
3 Click Add.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 247
Task Configuration
248 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Managing Applications
EIO0000002854 06/2019
Chapter 9
Managing Applications
Managing Applications
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 249
Managing Applications
Section 9.1
General Information
General Information
Introduction
Introduction
To run an application, you must first connect the PC to the controller, then download the application
to the controller.
NOTE: Due to memory size limitation, some controllers are not able to store the application source
but only a built application that is executed. This means that you are not able to upload the
application source from the controller to a PC.
WARNING
UNINTENDED EQUIPMENT OPERATION
Confirm that you have entered the correct device designation or device address in the
Communication Settings dialog when downloading an application.
Confirm that machine guards and tags are in place such that any potential unintended
machine operation will not result in personal injury or equipment damage.
Read and understand all user documentation of the software and related devices, as well as
the documentation concerning equipment or machine operation.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Preconditions
Verify that your application meets the following conditions before downloading it to the controller:
the active path is set for the correct controller,
the application you want to download is active,
the application is free of compilation errors.
250 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Boot Application
The boot application is the application that is launched on controller start. This application is stored
in the controller memory. To configure the download of the boot application, right-click the
Application node in the Applications tree and select the Properties command.
At the end of a successful download of a new application, a message is displayed asking you if you
want to create the boot application.
You can manually create a boot application in the following ways:
In offline mode: Click Online → Create boot application to save the boot application to a file.
In online mode, with the controller being in STOP mode: Execute the Online → Create boot
application command (see EcoStruxure Machine Expert, Menu Commands, Online Help) to
download the boot application to the controller.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 251
Managing Applications
Section 9.2
Building and Downloading Applications
252 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Building Applications
Overview
EcoStruxure Machine Expert provides different build procedures in the Build menu
(see EcoStruxure Machine Expert, Menu Commands, Online Help). These procedures serve to
handle syntactical checks, either just on the changed objects or on all objects of the active
application.
You can perform an offline code generation in order to check for compilation errors before
downloading the code to the device. For a successful login, the code generation must have been
completed without detecting any errors.
At each download, the compile information, containing the code and a reference ID of the loaded
application, is stored in the project directory in a file <projectname>.<devicename>.<application
ID>.compileinfo. The compileinfo file is deleted when the Clean or Clean all command is executed.
No code generation is performed when the project is compiled by the build commands (by default
in the Build menu). The build process checks the project in order to detect programming errors.
Any detected programming errors are displayed in the Messages view (message category Build).
During code generation, additional errors can be detected and displayed. These errors can only be
detected by the code generator or they are caused by memory allocation.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 253
Managing Applications
Login
Overview
The Online → Login command connects the application to the target device (controller or
simulation target) and thus changes into the online mode.
The default shortcut is Alt + F8.
WARNING
UNINTENDED EQUIPMENT OPERATION
Confirm that you have entered the correct device designation or device address in the
“Communication Settings” dialog when downloading an application.
Confirm that machine guards and tags are in place such that any potential unintended
machine operation will not result in personal injury or equipment damage.
Read and understand all user documentation of the software and related devices, as well as
the documentation concerning equipment or machine operation.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
If there is an online user management (also refer to the chapter Users and Groups (see page 143))
established on the target device, at login you are prompted to enter the appropriate user name and
password. For this purpose, the dialog box Device User Logon opens.
NOTE: The layout of EcoStruxure Machine Expert views can change when you connect to the
target device because the Online perspective (see page 53) is automatically selected when you
switch to online mode.
Selecting the View of the Communication Settings Tab in the Device Editor
Depending on the option selected for Communication page in the Tools → Options → Device
editor dialog box (see EcoStruxure Machine Expert, Menu Commands, Online Help), the
Communication Settings tab of the device editor is displayed in three different modes. Refer to the
description of the different tabs for details:
254 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Login Procedure
The steps of the login procedure are identical. They only differ in the presentation of the
Communication Settings tab.
For a successful login, the code generation must have been completed without detecting errors
(refer to the chapter Build Process Before Login (see page 256)).
Step Action
1
Execute the command Online → Login, or click the Login button from the toolbar, or press
ALT + F8.
Result: Since no target address has been set before, the Communication Settings tab of the
device editor opens in the mode you selected. A message box is displayed indicating that a valid
address has not been defined.
2 If only one controller has been detected by EcoStruxure Machine Expert, this controller is used
as target device.
If several controllers have been detected, double-click the controller you want to log in.
NOTE: In controller selection mode and in classic mode, only those controllers are listed that
have the same Target ID as the selected controller. To display all controllers in the list, set the
Filter criterion to None.
3
Execute the command Online → Login, or click the Login button from the toolbar, or press
ALT + F8.
Result: A message box displays to inform you of potential hazards.
4 Click Cancel to abort the login operation or press ALT + F to confirm the message and to log in
to the selected controller.
Result: If you press ALT + F the connection to the controller is established, and you can
download the application (see page 257).
Unsuccessful Login
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 255
Managing Applications
256 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Downloading an Application
Introduction
To run an application, first connect the PC to the controller, then download the application to the
controller.
Downloading a project allows you to copy the current project from EcoStruxure Machine Expert to
the controller memory.
NOTE: Due to memory size limitation, some controllers are not able to store the application source
but only a built application that is executed. This means that you are not able to upload the
application source from the controller to a PC.
WARNING
UNINTENDED EQUIPMENT OPERATION
Confirm that you have entered the correct device designation or device address in the
Communication Settings dialog when downloading an application.
Confirm that machine guards and tags are in place such that any potential unintended
machine operation will not result in personal injury or equipment damage.
Read and understand all user documentation of the software and related devices, as well as
the documentation concerning equipment or machine operation.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Preconditions
Verify that your application meets the following conditions before downloading it to the controller:
The active path is set for the correct controller.
The application you want to download is active.
The application is free of compilation errors.
Boot Application
The boot application is the application that is launched on controller start. This application is stored
in the controller memory. To configure the download of the boot application, right-click the
Application node in the Devices view and select the Properties command.
At the end of a successful download of a new application, a message is displayed asking you if you
want to create the boot application.
You can manually create a boot application in the following ways:
In offline mode: Click Online → Create boot application to save the boot application to a file.
In online mode, with the application being in STOP mode: Click Online → Create boot
application to download the boot application to the controller.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 257
Managing Applications
Operating Modes
The download method differs depending on the relationship between the loaded application and
the application you want to download. The 3 cases are:
Case 1: The application in the controller is the same as the one you want to load. In this case,
no download occurs, you just connect EcoStruxure Machine Expert to the controller.
Case 2: Modifications have been made to the application that is loaded in the controller in
comparison to the application in EcoStruxure Machine Expert. In this case, you can specify if
you want to download all or parts of the modified application or keep the application in the
controller as it is.
Case 3: A different or a new version of application is already available on the controller. In this
case, you are asked whether this application should be replaced.
Case 4: The application is not yet available on the controller. In this case, you are asked to
confirm the download.
Step Action
1 To connect to the controller, select Online → Login to ’Application[YourApplicationName; Plc Logic]’.
2 You are connected to the controller.
258 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Step Action
1 To connect to the controller, select Online → Login to ’Application[YourApplicationName; Plc Logic]’.
2 In case you modified your application, and you want to reload it into the controller, the following message
appears:
Login with online change Only the modified parts of an already running project is reloaded to the
controller.
Login with download The whole modified application is reloaded to the controller.
Login without any change The modifications are not loaded.
NOTE: If you select the option Login without any change, the changes you perform in the EcoStruxure
Machine Expert application are not downloaded to the controller. In this case, the information and status
bar in EcoStruxure Machine Expert will show RUNNING as operational state and will indicate Program
modified (Online change). This differs from the options Login with online change or Login with download,
where the information and status bar indicates Program unchanged.
In this case, monitoring of variables is possible, but the logic flow may be confusing because the values
on function block outputs may not match to the values on the inputs.
Examples
In LD, contact states are monitored based on the affected variables. This may have the effect that a blue
animated contact followed by a blue link (meaning true) is shown, although the coil connected to this
contact shows it as [Link] ST logic flow, an IF statement or a loop seems to be executed, but it is actually
not executed because the condition expression is different in the project and on the controller.
3 Select the suitable option and click OK.
NOTE: Consult the Programming Guide specific to your controller for important safety-related
information concerning the downloading of applications.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 259
Managing Applications
Step Action
1 To connect to the controller, select Online → Login to ’Application[YourApplicationName; Plc Logic]’.
2a In case, the controller is not in RUN mode, and you want to load a different application than the one
currently in the controller, the following message appears:
Refer to the hazard messages below before you click Yes to download the new application to the
controller, or No to cancel the operation.
2b In case, the controller is in RUN mode, and you want to load a different application than the one currently
in the controller, the following message appears:
Refer to the build messages below before you click Yes to download the new application to the controller,
or No to cancel the operation.
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that you have the correct application before confirming the download.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
If you click Yes, the application running in your controller will be overwritten.
260 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Step Action
1 To connect to the controller, select Online → Login to ’Application[YourApplicationName; Plc Logic]’.
2 In case the application is not yet available on the controller, you are asked to confirm the download. For
this purpose, a dialog box with the following text displays:
Click Yes to download the application to the controller, or No to cancel the operation.
NOTE: Consult the Programming Guide specific to your controller for important safety-related
information concerning the downloading of applications.
Online Change
The Online Change command modifies the running application program and does not affect a
restart process:
The program code can behave other than after a complete initialization because the machine
keeps its state.
Pointer variables keep their values from the last cycle. If there is a pointer on a variable, which
has changed its size due to an online change, the value will not be correct any longer. Verify
that pointer variables are reassigned in each cycle.
WARNING
UNINTENDED EQUIPMENT OPERATION
Thoroughly test your application code for proper operation before placing your system into
service.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: Consult the Programming Guide specific to your controller, chapter Controller States
Description for specific information.
If the application project currently running on the controller has been changed in the programming
system since it has been downloaded last, just the modified objects of the project will be loaded to
the controller while the program keeps running.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 261
Managing Applications
In the Online Change Memory Reserve view (see page 201), you configure a memory reserve for
the online change of function blocks. After you have made modifications on a function block and
you perform an online change, it is no longer necessary to copy the instance variables of the
function block to a new memory area.
Element Description
Login with online change This option is selected per default. If you confirm the dialog box by clicking OK,
the modifications will be loaded and immediately displayed in the online view
(monitoring) of the respective object or objects.
Login with download Activate this option to load and initialize the application project completely.
Login without any change Activate this option in order to keep the program running on the controller
unchanged. Afterwards, an explicit download can be performed, thus loading
the complete application project. It is also possible that you are asked again
whether an online change should be performed at the next relogin.
Update boot project This option is by default not selected.
To select this option, activate the option Implicit boot application on Online
Change in the Boot Application tab of the Properties dialog box of the
Application node.
A boot application is then automatically created with an online change.
Details Click this button to obtain the Application Information dialog box (Project name,
Last modification, IDE version, Author, Description) on the current application
within the IDE (Integrated Development Environment, i.e., EcoStruxure
Machine Expert) in comparison to that currently available on the controller.
Refer to the following figure.
262 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
For further information, refer to the Login chapter (see page 254).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 263
Managing Applications
264 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
If the option Download Application Info is activated in the Application Build Options tab of the View
→ Properties dialog box (see EcoStruxure Machine Expert, Menu Commands, Online Help), this
tab shows the following: The content of the application read from the controller is shown in the
column Uploaded code for application <App2> and can be compared to the content of the
application in the programming system. To update the left column Last generated code for
application <App2> with the latest version of the application active in the programming system,
click the button Application not up to date. Generate code now?. The contents of the applications
are compared and different objects are marked with colors as they are in the Project → Compare
function (see EcoStruxure Machine Expert, Menu Commands, Online Help). This more granular
information can help you to evaluate the effects downloading the new application.
If the online change will affect considerable changes in download code, like for example possible
moves of pointer addresses or necessary redirections of interface references (see page 185)
another message box is displayed after you have confirmed the Online change dialog box with OK
before download will be performed. It informs you about the effects you have to consider and
provides the option to abort the online change operation.
NOTE: After having removed implicit check function (such as CheckBounds) from your application,
no Online Change is possible, just a download. An appropriate message will appear.
Click the Details button in this message box to display detailed information, such as the number
and a listing of changed interfaces, POUs, affected variables, and so on.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 265
Managing Applications
266 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 267
Managing Applications
268 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Section 9.3
Running Applications
Running Applications
Running Applications
Introduction
This part shows how to start/stop an application.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 269
Managing Applications
Section 9.4
Maintaining Applications
Maintaining Applications
270 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Monitoring
Overview
In online mode, there are various possibilities to display the current values of the objects in the
controller:
You can see the values of the objects in a program editor screen while online. For details, see
the description of the respective editor.
You can view object values in the online view of the declaration editor. For details, refer to the
description of the declaration editor (see page 425).
You can view objects independently in lists through the command Watch. For details, refer to
the description of the watch view / watch list editor (see page 480). You can insert a variable in
a watch view by selecting it and executing the command Add watchlist from the context menu.
You can view values via trace sampling: recording and displaying of variable values from the
controller. For details, refer to the description of the trace object functionality (see page 518).
You can view object values that are contained in recipes: User-defined set of variables for
writing and watching these variables on the controller. Refer to the description of the recipe
manager (see page 495).
For information on monitoring of properties that are inserted beneath POUs or function blocks,
refer to the chapter Property (see page 183).
For information on monitoring of function calls, refer to the chapter Attribute Monitoring
(see page 691).
NOTE: If a value is not valid (for example, the result of calculating the square root of a negative
number), the result may be displayed as NaN (not a number) or INF (infinite value) depending on
the operation, the object, and the particular controller platform. Consult the Programming Guide
specific to your controller for more information.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 271
Managing Applications
Debugging
Overview
To evaluate potential programming errors, you can use the debugging functionality.
For testing purposes, an application can also run in simulation (see EcoStruxure Machine Expert,
Menu Commands, Online Help) without any required link to an actual target device. While
simulation avoids the need to connect to physical hardware, there are limitations to which you may
need to complete debugging online.
Conditional Breakpoints
The stop at the breakpoint can be dependent on the following conditions:
At the time, a specific boolean expression is TRUE.
Which cycle number is running.
Which task is executing.
When the value of a variable is modified (data breakpoint).
Declaring a specific debug task can help to avoid that several tasks are affected by the error check
(refer to the Breakpoints and Stepping in Applications with Multiple Tasks paragraph
(see page 275)).
Execution Points
In online mode, the Breakpoints dialog box (see EcoStruxure Machine Expert, Menu Commands,
Online Help) allows you to change a breakpoint and data breakpoint in such a way that it becomes
an execution point. Then the program does not stop at the position, but the code processing is
initiated.
272 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Symbols
Symbol Description
Breakpoint enabled.
Breakpoint disabled.
Stop at breakpoint.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 273
Managing Applications
Symbol Description
Data execution point disabled.
274 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Data Breakpoints
Data breakpoints allow you to stop program execution when the value of a variable changes.
This function is not available for all supported controllers. Consult the Programming Guide specific
to your controller.
The number of data breakpoints you can define depends on the number of registers that is
available in the controller you are using. A message is displayed when you attempt to set a data
breakpoint and the maximum number has been reached.
The following options exist for data breakpoints as for normal breakpoints:
Linking the halt at the data breakpoint to an additional condition, refer to Conditional Breakpoints
(see page 272).
Redefining a data breakpoint to a data execution point where the program does not halt, but
processes specific code, refer to Execution Points (see page 272).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 275
Managing Applications
276 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Core Dump
If... Then...
If you created a core dump explicitly by choosing the then an option is automatically available in the
command Create Core Dump, archive configuration.
If you copied the core dump from the controller, then you can add it to a project archive only by
choosing the function Additional files.
NOTE: A project archive with a core dump must include the download information; otherwise the
dump is unusable.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 277
Managing Applications
Step Action
1 Load the core dump from the controller by executing the command Debug → Load Core Dump.
Result: An online view of the application is displayed. You see the variable values and call stack
from the time when the error has been detected. This also includes the values of the I/O variables
in the mapping dialog of the device configurator and the task configuration. The message Core
dump loaded is displayed in the status line. The core dump file is copied as
<project_name>.<device_name>.<application_name>.<application-Guid>.core to the local
project directory.
2 Execute the command Debug → Load device log from Core Dump to load the device log from
the time the error has been detected into the project.
Result: The log view opens (as in online mode of the device configurator) displaying the events
at the time the core dump was created.
3 After you have completed the core dump analysis, execute the command Debug → Close Core
Dump.
Result: The core dump view of the application closes and the project returns to its views in
normal offline mode.
Step Action
1 Execute the command Debug → Create Core Dump.
Result: The creation of a new core dump starts. A progress bar appears in the status line
together with a cancel button.
A core dump file is saved to the local project directory as
<project_name>.<device_name>.<application_name>.<application-Guid>.core.
278 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Programming Support
Overview
EcoStruxure Machine Expert offers settings, dialogs and functionalities, which facilitate the input
of program code and indicate detected errors at an early stage.
For further information, refer to the descriptions of the following functions:
Input Assistant (see page 489)
Intelli-sense (see page 718)
Auto Declare... (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Smart Coding (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Static Analysis Light (see page 285)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 279
Managing Applications
Refactoring
Overview
Generally refactoring is the process of restructuring and improving existing software code without
changing its behavior.
Refactoring in EcoStruxure Machine Expert provides functionalities for renaming object names and
variable names. It allows you to show all usage locations of changed objects and variables and to
get renamed all those at once, or only individual ones. You can configure whether and at which
locations you should get asked for performing refactoring. Explicitly you can use the command
Refactoring → Rename.
For further information, also refer to Options, Refactoring (see EcoStruxure Machine Expert, Menu
Commands, Online Help).
Command Rename
The command Refactoring → Rename is used for a global, project wide renaming of object names,
and variable names.
It is available in the context menu if you set the cursor on a variable name in the declaration or if
you right-click one of the following objects in a navigator:
Functions
POUs
GVLs
Methods
Properties
Devices
The command is also available if you select variables and unit conversions within the editor for unit
conversions.
The command is not available in online mode.
Process of Renaming
After you have executed the Refactoring → Rename command, a dialog is displayed. It shows the
locations where the concerned name is used: In the right part of the window the particular
locations, in the left part the navigation tree where the concerned object is marked.
You can select the following commands for each location individually:
Reject/accept this change: Reject/accept single changes in the right window.
Reject/accept this object: Reject/accept all changes in the concerned object.
Reject/accept whole project: Reject/accept all changes in the project.
Accepted changes are displayed with a yellow background, rejected changes with gray
background.
280 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Option Description
Add inputs with placeholder Select this option to insert the standard placeholder text _REFACTOR_
text whenever the new variable occurs in the implementation code. You can
search for this standard text later in order to identify the affected locations.
Add inputs with the following Select this option to insert an initialization value whenever the new variable
value occurs in the implementation code. Enter the initialization value in the text box
on the right-hand side of the option Add inputs with the following value.
In order to accept or reject changes, right-click the changed locations or execute the commands in
the left or right part of the dialog box, as described in the Process of Renaming paragraph in this
chapter.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 281
Managing Applications
Example 2:
By refactoring, the fun block receives a new input variable input3 with the placeholder text
_REFACTOR_:
Before refactoring:
inst(input1 := a + b, input2 := 3, inputx := TRUE);
fun(a + b, 3, TRUE);
After refactoring:
inst(input1 := a + b, input2 := 3, input3 := _REFACTOR_, inputx := TRUE
);
fun(a + b, 3, input3:=_REFACTOR_, TRUE);
282 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Step Action
1 Right-click the declaration part and execute the command Refactoring → Reorder Variables.
Result: The Reorder dialog box opens with a list of VAR_INPUT variables.
2 Drag the invar1 : INT; entry to the position before the invar2. entry.
Result: The invar1 declaration is at the top position.
3 Click OK to close the dialog box.
Result: The Refactoring dialog box opens. The affected elements are marked in yellow.
4 Click OK to accept the new order of parameters of the function block. Have in mind that the
modified order of the parameters will be reflected also at the call usages of the POUs.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 283
Managing Applications
6 Execute the command Edit → Auto Declare.... As an alternative, use the shortcut Shift
+ F2.
Result: The Auto Declare dialog box
opens. The settings of the variable iA
are displayed.
7 Edit the Name and change iA into iCounter_A. Result: The Refactoring - Renaming
from iA to iCounterA dialog box opens.
The POUs where the variable is used
are highlighted in the tree structure.
8 Click OK to apply the renaming and to close the dialog –
box.
284 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Overview
The static analysis function checks the source code of a project for deviations from certain coding
directives before the project is downloaded to the target system. This follows the basic idea of the
lint analysis tool.
You define the desired set of rules in the Project Settings → Static Analysis Light dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
NOTE: The check is automatically performed at each code generation.
Deviations from the rules are displayed as messages of category Build in the Messages view. The
error numbers are displayed as SA<number>.
NOTE: The analysis is only done on the application code in the current project. Libraries are not
regarded.
NOTE: For GVL variables: If there are several applications in the project, then only objects below
the currently active application are checked. If there is only one application in the project, then also
any objects in the POUs pool are checked.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 285
Managing Applications
Example
Rule 24 gets disabled for two lines (that means that it is not necessary here to write, for example,
nTest:=DINT#99), and afterwards re-enabled:
{analysis -24}
nTest := 99;
iVar := INT#2;
{analysis +24}
Specifying multiple rules:
{analysis -10, -24, -18}
286 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Applications
Overview
Creating an archive in your controller allows you to have the complete project in your controller
which is useful for maintenance tasks. The following procedure describes how to create a project
archive automatically with the download procedure.
You can manually create a project archive be executing the File → Source download... command
as described in the Menu Commands online help (see EcoStruxure Machine Expert, Menu
Commands, Online Help).
Step Action
1 Execute the command Project → Project Settings.
2 In the Project Settings dialog box, select Source Download → Additional Files...
The following options can be selected:
Option to connect with the uploaded project:
Download information files
Options which are needed to connect with another EcoStruxure Machine Expert version:
Download information files
Library profile
Referenced devices
Referenced libraries
Visualization Profile
For further information, refer to the Project Settings - Source Download description
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 287
Managing Applications
3.) Upload the project (sources) from the controller by executing the Online → Source Upload...
command (see EcoStruxure Machine Expert, Menu Commands, Online Help).
288 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Logic Editors
EIO0000002854 06/2019
Part IV
Logic Editors
Logic Editors
Chapter 10
Common Features of Graphic Editors
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 291
Common Features of Graphic Editors
4 Zooming tool The zoom button opens a submenu where you can select one of the
given zoom factors for the chart. To specify another value, click the ...
button to open an edit dialog box. The current zoom factor is displayed
to the left of the button.
To zoom by mouse wheel, press the Ctrl key while scrolling the mouse wheel. The current zoom
level is increased or decreased in steps of 10 percent.
292 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
FBD/LD/IL Editor
EIO0000002854 06/2019
Chapter 11
FBD/LD/IL Editor
FBD/LD/IL Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 293
FBD/LD/IL Editor
Section 11.1
Information on the FBD/LD/IL Editor
294 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
FBD/LD/IL Editor
Overview
A combined editor is available for editing POUs in the languages FBD (function block diagram
(see page 296)), LD (ladder diagram (see page 297)), and IL (instruction list (see page 298)).
Activate the IL implementation language for EcoStruxure Machine Expert in the Tools → Options
dialog box, category FBD, LD and IL editor, tab (see EcoStruxure Machine Expert, Menu
Commands, Online Help) IL.
Therefore, a common set of commands and elements is used and an automatic internal conversion
between the three languages is done. In offline mode, the programmer can switch between editor
views (View).
Keep in mind that there are some special elements which cannot be converted and thus will only
be displayed in the appropriate language. Also, there are some constructs which cannot be
converted unambiguously between IL and FBD and therefore will be normalized at a conversion
back to FBD; specifically, negation of expressions and explicit/implicit output assignments.
You can define the behavior, look, and menus of the FBD/LD/IL editor in the Customize and
Options dialog boxes. You also have options to define the display of comments and addresses.
The editor opens in a bipartite window. When you edit an object programmed in FBD/LD/IL, the
upper part contains a declaration editor (see page 426), the lower part contains a coding area.
The programming language for a new object is specified when you create the object.
For further information refer to:
Working in the FBD and LD Editor View (see page 305)
Working in the IL Editor View (see page 310)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 295
FBD/LD/IL Editor
Overview
The Function Block Diagram is a graphically oriented programming language. It works with a list
of networks. Each network contains a graphical structure of boxes and connection lines which
represents either a logical or arithmetic expression, the call of a function block, a jump, or a return
instruction.
FBD networks
296 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Overview
The Ladder Diagram is a graphics-oriented programming language which resembles the structure
of an electric circuit.
On the one hand, the Ladder Diagram is suitable for constructing logical switches, on the other
hand it also allows you to create networks as in FBD. Therefore, the LD is useful for controlling the
call of other POUs.
The Ladder Diagram consists of a series of networks, each being limited by a vertical current line
(power rail) on the left. A network contains a circuit diagram made up of contacts, coils, optionally
additional POUs (boxes), and connecting lines.
On the left side, there is 1 or a series of contacts passing from left to right the condition ON or OFF
which corresponds to the boolean values TRUE and FALSE. To each contact a boolean variable
is assigned. If this variable is TRUE, the condition will be passed from left to right along the
connecting line. Otherwise, OFF will be passed. Thus, the coil or coils, which is/are placed in the
right part of the network, receive an ON or OFF coming from left. Correspondingly the value TRUE
or FALSE will be written to an assigned boolean variable.
Ladder Diagram network.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 297
FBD/LD/IL Editor
Overview
The instruction list (IL)is an assembler-like IEC 61131-3 conformal programming language.
This language supports programming based on an accumulator. The IEC 61131-3 operators are
supported as well as multiple inputs / multiple outputs, negations, comments, set / reset of outputs
and unconditional / conditional jumps.
Each instruction is primarily based on the loading of values into the accumulator by using the
LD operator. After that the operation is executed with the first parameter taken out of the
accumulator. The result of the operation is available in the accumulator, from where you should
store it with the ST instruction.
In order to program conditional executions or loops, IL supports both comparing operators such as
EQ, GT, LT, GE, LE, NE and jumps. The latter can be unconditional (JMP) or conditional (JMPC /
JMPCN). For conditional jumps, the value of the accumulator is referenced for TRUE or FALSE.
Syntax
An instruction list (IL) consists of a series of instructions. Each instruction begins in a new line and
contains an operator and, depending on the type of operation, 1 or more operands separated by
commas. You can extend the operator by a modifier.
In a line before an instruction, there can be an identification mark (label) followed by a colon (:)
(ml: in the example shown below). A label can be the target of a jump instruction (JMPC m1 in the
example shown below).
Place a comment as last element of a line.
You can insert empty lines between instructions.
298 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Example
LD BVar1
ST [Link]
CAL tonInst1(
PT:=t1,
ET=>tOut2)
LD toninst1.Q
JMPC mark1
ST [Link]
___________________________________________________________
markl:
LD iVar2
ADD 230
For further information, refer to:
Working in the IL Editor View (see page 310)
Modifiers and operators in IL (see page 300)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 299
FBD/LD/IL Editor
Modifiers
You can use the following modifiers in Instruction List (see page 298).
C with JMP, CAL, RET: The instruction will only be executed if the result of the preceding
expression is TRUE.
N with JMPC, CALC, RETC: The instruction will only be executed if the result of the preceding
expression is FALSE.
N with operators according to the Negation of the operand (not of the accumulator).
Operators table below (N in
Modifiers column)
( with operators according to the To be used for complex operands. For details, refer to the list of
Operators table below (( (left use cases for complex operands (see page 302).
parenthesis) in Modifiers column)
NOTE: Generally, it is not good practice to use the statement CALC (/RETC/JMPC) directly after
an STN, S or R operator, as those instructions arbitrarily modify the value of the accumulator and
thus could lead to difficult-to-find programming errors.
Operators
The table shows which operators can be used in combination with the specified modifiers.
The accumulator stores the current value, resulting from the preceding operation.
300 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
RET C, CN Unconditional (conditional) return of the POU and jump back to RET
the calling POU
RET = unconditional return
RETC = conditional return if accumulator is TRUE
RETCN = conditional return if accumulator is FALSE
See also IEC operators (see page 767) and Work in IL editor (see page 310) for how to use and
handle multiple operands, complex operands, function / method / function block / program / action
calls and jumps.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 301
FBD/LD/IL Editor
Example
Example IL program using some modifiers:
LD TRUE load TRUE to accumulator
ANDN bVar1 execute AND with negative value of bVar1
JMPC m1 if accum. is TRUE, jump to label "m1"
LDN bVar2 store negated value of bVar2...
ST bRes ... in bRes
___________________________________________________________
m1:
LD bVar2 store value of bVar2...
ST bRes ... in bRes
Using Operands
The table lists use cases for operands:
302 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Column 2:
Parameter value followed by a
comma , if followed by further
parameters.
Enter the right parenthesis )
after the last parameter.
According to the IEC standard
complex expressions are not
allowed here. Assign such
constructs to the function block or
the program before it is called.
Function call Row 1: LD X7
Column 1: GeomAverage 25
LD ST Ave
Column 2:
Input variable
Row 2:
Column 1:
Function name
Column 2:
Further input parameters,
separated by commas
The return value is written to the
accumulator.
Row 3:
Column 1:
ST
Column 2:
Variable to which the return
value is written
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 303
FBD/LD/IL Editor
Conditional jump:
The execution of the jump
depends on the loaded value.
304 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Overview
Networks are the basic entities in FBD and LD programming. Each network contains a structure
that displays a logical or an arithmetical expression, a POU (function, program, function block call,
and so on), a jump, a return instruction.
When you create a new object, the editor window automatically contains 1 empty network.
Refer to the general editor settings in the Options dialog box, category FBD/LD/IL for potential
editor display options.
Tooltip
Tooltips contain information on variables or box parameters.
The cursor being placed on the name of a variable or box parameter will prompt a tooltip. It shows
the respective type. In case of function block instances the scope, name, datatype, initial value,
and comment will be displayed. For IEC operators SEL, LIMIT, and MUX a short description on
the inputs will display. If defined, the address and the symbol comment will be shown as well as
the operand comment (in quotation marks in a second line).
Example: Tooltip on a POU output
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 305
FBD/LD/IL Editor
If you drag a function block, an operator, or a network from the ToolBox (see page 328) onto
the up arrow or down arrow on the left-hand side of the editor, a new network is automatically
created above or below the existing element.
To replace an element by another one, draw an appropriate other element on its position.
To reposition an input connection or an output connection of a box, select the connection pin
directly at the box and put it to the desired other position at the box via drag and drop.
Insert positions in LD editor
You can use the cut, copy, paste, and delete commands, available in the Edit menu, to arrange
elements. You can also copy an element by drag and drop: select the element within a network
by a mouse-click, press the CTRL key and while keeping the mouse button and the key
pressed, drag the element to the target position. As soon as that is reached (green position
marker), a plus-symbol will be added to the cursor symbol. Then, release the mouse-button to
insert the element.
For possible cursor positions, refer to Cursor Positions in FBD, LD, and IL (see page 316).
Inserting of EN/ENO boxes is handled diversely in the FBD and LD editor.
Refer to the description of the Insert Box command for further information (Inserting of EN/ENO
boxes is not supported in the IL editor).
306 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Selecting
You can select an element, also a network, via taking the respective cursor position by a mouse-
click or using the arrow or tab keys. Selected elements are indicated as red-shaded. Also refer
to Cursor Positions in FBD, LD, and IL (see page 316).
In the LD editor, you can also select the lines between elements in order to execute commands,
for example, for inserting a further element at that position.
Selected line in LD editor
Multi-selection of elements or networks is possible by keeping pressed the CTRL key while
selecting the desired elements one after the other.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 307
FBD/LD/IL Editor
FBD editor
LD editor
308 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 309
FBD/LD/IL Editor
Overview
The IL Instruction List (see page 298) editor is a table editor. The network structure of FBD or LD
programs is also represented in an IL program. Basically, one network (see page 330) is sufficient
in an IL program, but considering switching between FBD, LD and IL you also can use networks
for structuring an IL program.
Activate the IL implementation language for EcoStruxure Machine Expert in the Tools → Options
dialog box, category FBD, LD and IL editor, tab (see EcoStruxure Machine Expert, Menu
Commands, Online Help) IL.
Tooltip
Tooltips contain information on variables or box parameters.
Refer to Working in the FBD and LD Editor View (see page 305).
310 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Each program line is written in a table row, structured in fields by the table columns:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 311
FBD/LD/IL Editor
312 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Complex Operands
If a complex operand is to be used, enter an opening bracket before, then use the following lines
for the particular operand components. Below them, in a separate line, enter the closing bracket.
Example: Rotating a string by 1 character at each cycle.
Corresponding ST code:
stRotate := CONCAT(RIGHT(stRotate, (LEN(stRotate) -
1)), (LEFT(stRotate, 1)));
LD stRotate
RIGHT( stRotate
LEN
SUB 1
)
CONCAT( stRotate
LEFT 1
)
ST stRotate
Function Calls
Enter the function name in the operator field. Give the (first) input parameter as an operand in a
preceding LD operation. If there are further parameters, give the next one in the same line as the
function name. You can add further parameters in this line, separated by commas, or in
subsequent lines.
The function return value will be stored in the accumulator. The following restriction concerning the
IEC standard applies.
NOTE: A function call with multiple return values is not possible. Only 1 return value can be used
for a succeeding operation.
Example: Function GeomAverage, which has 3 input parameters, is called. The first parameter is
given by X7 in a preceding operation. The second one, 25, is given with the function name. The
third one is given by variable tvar, either in the same line or in the subsequent one. The return
value is assigned to variable Ave.
Corresponding ST code:
Ave := GeomAverage(X7, 25, tvar);
Function call in IL:
LD X7
GeomAverage 25
tvar
ST Ave
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 313
FBD/LD/IL Editor
314 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Action Call
To be performed like a function block or program call, the action name is to be appended to the
instance name or program name.
Example: Call of action ResetAction.
Corresponding ST code:
[Link]();
Action call in IL:
CAL [Link]()
Method Call
To be performed like a function call, the instance name with appended method name is to be
entered in the first column (operator).
Example: Call of method Home.
Corresponding ST code:
Z := [Link](TRUE, TRUE, TRUE);
Method call in IL:
LD TRUE
[Link] TRUE
TRUE
ST Z
Jump
A jump (see page 333) is programmed by JMP in the first column (operator) and a label name in
the second column (operand). The label is to be defined in the target network in the label
(see page 334) field.
The statement list preceding the unconditional jump has to end with one of the following
commands: ST, STN, S, R, CAL, RET, or another JMP.
This is not the case for a conditional jump (see page 333). The execution of the jump depends on
the value loaded.
Example: Conditional jump instruction; in case bCallRestAction is TRUE, the program should
jump to the network labeled with Cont.
Conditional jump instruction in IL:
LDN bCallResetAction
JMPC Cont
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 315
FBD/LD/IL Editor
IL Editor
This is a text editor, structured in form of a table. Each table cell is a possible cursor position. Also
refer to Working in the IL Editor View (see page 310).
In the left image, the possible cursor positions are marked by a red-frame. The right image shows
a box with the cursor being placed in the AND field. Keep in mind the possibility to enter addresses
instead of variable names if configured appropriately in the FBD, LD and IL editor Options dialog
box.
(2) Every input:
316 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
(5) Just before the lined cross above an assignment before a jump or a return instruction:
(6) The right-most cursor position in the network or anywhere else in the network besides the other
cursor positions. This will select the whole network:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 317
FBD/LD/IL Editor
(11) The connecting line between the contacts and the coils:
318 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
You can add new networks on the left-most side of the editor. The insertion of a new network before
an existing network is only possible before network 1.
(15) Begin or end of a network:
You can add contacts and function blocks at the begin of a network on the field Start here. You can
add the elements return, jump, and coil at the end of a network on the field Add output or jump here.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 319
FBD/LD/IL Editor
FBD/LD/IL Menu
Overview
When the cursor is placed in the FBD/LD/IL Editor (see page 295) window, the FBD/LD/IL menu
is available in the menu bar, providing the commands for programming in the currently set editor
view.
FBD/LD/IL menu in FBD editor view:
For a description of the commands, refer to the chapter FBD/LD/IL Editor Commands.
For configuration of the menu, refer to the description of the Customize Menu.
320 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Overview
In online mode, the FBD/LD/IL editor provides views for Monitoring (see page 321) and for writing
and forcing the values and expressions on the controller.
Debugging functionality (breakpoints, stepping, and so on) is available, see Breakpoint or Halt
Positions (see page 325).
For information on how to open objects in online mode, refer to the chapter User Interface in
Online Mode (see page 55).
Keep in mind that the editor window of an FBD, LD, or IL object also includes the Declaration
Editor in the upper part. Also refer to the chapter Declaration Editor in Online Mode
(see page 432).
Monitoring
If the inline monitoring is not explicitly deactivated in the Options dialog box, it will be supplemented
in FBD or LD editor by small monitoring windows behind each variable or by an additional
monitoring column showing the actual values (inline monitoring). This is even the case for
unassigned function block inputs and outputs.
The inline monitoring window of a variable shows a little red triangle in the upper left corner if the
variable is currently forced (see page 324), a blue triangle in the lower left corner if the variable is
currently prepared for writing or forcing. In LD, for contacts and coils the currently prepared value
(TRUE or FALSE) will be displayed down right below the element.
Example for a variable which is currently forced and prepared for releasing the force
Example for a contact variable which is currently prepared to get written or forced with value TRUE
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 321
FBD/LD/IL Editor
322 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Open a function by double-click or execute the command Browse - Go To Definition from the
context menu. Refer to the description of the User Interface in Online Mode (see page 55) for
further information.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 323
FBD/LD/IL Editor
Forcing/Writing of Variables
In online mode, you can prepare a value for forcing or writing a variable either in the declaration
editor (see page 432) or within the editor. Double-click a variable in the editor to open the following
dialog box:
Dialog box Prepare Value
You find the name of the variable completed by its path within the device tree (Expression), its type,
and current value. By activating the corresponding item, you can do the following:
Preparing a new value which has to be entered in the edit field.
Removing a prepared value.
Releasing the forced variable.
Releasing the forced variable and resetting it to the value it was assigned to just before forcing.
The selected action will be carried out on executing the menu command Force values (in the
Online menu) or by pressing F7.
For information on how the current state of a variable (forced, prepared value) is indicated at the
respective element in the network, refer to the section Monitoring (see page 321).
324 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
1 breakpoint set
2 breakpoint reached
As soon as a breakpoint position is reached during stepping or program processing, a yellow arrow
will be displayed in the breakpoint symbol and the red shaded area will change to yellow.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 325
FBD/LD/IL Editor
NOTE: A breakpoint will be set automatically in all methods which may be called. If an interface-
managed method is called, breakpoints will be set in all methods of function blocks implementing
that interface and in all derivative function blocks subscribing the method. If a method is called via
a pointer on a function block, breakpoints will be set in the method of the function block and in all
derivative function blocks which are subscribing to the method.
326 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Section 11.2
FBD/LD/IL Elements
FBD/LD/IL Elements
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 327
FBD/LD/IL Editor
FBD/LD/IL Toolbox
Overview
The FBD/LD/IL Editor (see page 295) provides a toolbox which offers the programming elements
for being inserted in the editor window by drag and drop. Open the toolbox by executing the
command ToolBox which is in the View menu.
It depends on the currently active editor view which elements are available for inserting (see the
respective description of the insert commands).
The elements are sorted in categories: General (general elements such as Network, Assignment
and so on), Boolean operators, Math operators, Other operators (for example,
SEL, MUX, LIMIT, and MOVE), Function blocks (for example,
R_TRIG, F_TRIG, RS, SR, TON, TOF, CTD, CTU), Ladder elements, and POUs (user-
defined).
The POUs category lists all POUs which have been defined below the same application as the
FBD/LD/IL object which is open in the editor. If a POU has been assigned a bitmap in its properties,
then this will be displayed before the POU name. Otherwise, the standard icon for indicating the
POU type will be used. The list will be updated automatically when POUs are added or removed
from the application.
The category Other operators contains among SEL, MUX, LIMIT, and MOVE operators a
conversion placeholder element. You can drag and drop this element to the appropriate position
of the network. The conversion type is set automatically, dependent on the required type of the
insert position. In some situations however the required conversion type cannot be determined
automatically. Change the element manually in this case.
To unfold the category folders, click the button showing the respective category name. See in the
following image: The category General is unfolded, the others are folded. The image shows an
example for inserting an Assignment element by drag and drop from the toolbox.
328 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
To insert an element in the editor, select it in the toolbox by a mouse-click and bring it to the editor
window by drag and drop. The possible insert positions will be indicated by position markers, which
appear as long as the element is drawn - keeping the mouse button pressed - across the editor
window. The nearest possible position will light up green. When you release the mouse button, the
element will be inserted at the green position.
If you drag a box element on an existing box element, the new one replaces the old one. If inputs
and outputs already have been assigned, those will remain as defined, but they will not be
connected to the new element box.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 329
FBD/LD/IL Editor
Network in FBD/LD/IL
Overview
A network is the basic entity of an FBD (see page 296) or LD (see page 297) program. In the
FBD/LD editor, the networks are arranged in a vertical list. Each network is designated on the left
side by a serial network number and has a structure consisting of either a logical or an arithmetic
expression, a program, function or function block call, and possibly jump or return instructions.
The IL Editor (see page 298), due to the common editor base with the FBD and LD editors, also
uses the network element. If an object initially was programmed in FBD or LD and then is converted
to IL, the networks will be still present in the IL program. Vice versa, if you start programming an
object in IL, you need at least 1 network element which might contain all instructions, but you can
also use further networks to structure the program.
A network optionally can get assigned a title, a comment and a label (see page 334).
You can switch the visibility of the title, the comment fields, and the network separator on and off
in the FBD, LD and IL editor options dialog box. If the option is activated, click in the network
directly below the upper border to open an edit field for the title. For entering a comment,
correspondingly open an edit field directly below the title field. The comment can be multi-lined.
Press ENTER to insert line breaks. Press CTRL + ENTER to terminate the input of the comment
text.
Whether and how a network comment is displayed in the editor, is defined in the FBD, LD, and
IL editor options dialog box.
To add a label (see page 334), which then can be addressed by a jump (see page 333), use the
command Insert label . If a label is defined, it will be displayed below the title and comment field or
- if those are not available - directly below the upper border of the network.
Comments and label in a network
330 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
You can set a network in comment state. This indicates that the network is not processed but
displayed and handled as a comment. To achieve this, use the command Toggle network
comment state.
On a currently selected network (cursor position 6 (see page 316)), you can apply the default
commands for copying, cutting, inserting, and deleting.
NOTE: Right-clicking (cursor position 6 (see page 316)) titles, comments, or labels will select this
entry only instead of the whole network. So the execution of the default commands does not affect
the network.
To insert a network, use command Insert Network or drag it from the toolbox (see page 328). A
network with all belonging elements can also be copied or moved (see page 305) by drag and drop
within the editor.
You can also create subnetworks (see page 337) by inserting branches.
RET Network
In online mode, an additional empty network will be displayed below the existing networks. Instead
of a network number, it is identified by RET.
It represents the position at which the execution will return to the calling POU and provides a
possible halt position (see page 321).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 331
FBD/LD/IL Editor
Assignment in FBD/LD/IL
Overview
Depending on the selected cursor position (see page 316) in FBD or LD, an assignment will be
inserted directly in front of the selected input (cursor position 2 (see page 316)), directly after the
selected output (cursor position 4 (see page 316)) or at the end of the network (cursor position 6
(see page 316)). In an LD network, an assignment will be displayed as a coil (see page 350).
Alternatively, drag the assignment element from the toolbox (see page 328) or copy or move
(see page 305) it by drag and drop within the editor view.
After insertion, the text string ??? can be replaced by the name of the variable that is to be
assigned. For this, use the ... button to open the Input Assistant.
In IL (see page 298), an assignment is programmed via LD and ST instructions. Refer to Modifiers
and Operators in IL (see page 300).
332 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Jump in FBD/LD/IL
Overview
Depending on the selected cursor position (see page 316) in FBD (see page 296) or LD
(see page 297), a jump will be inserted directly in front of the selected input (cursor position 2),
directly after the selected output (cursor position 4) or at the end of the network (cursor position 6).
Alternatively, drag the jump element from the toolbox (see page 328) or copy or move
(see page 305) it by drag and drop within the editor.
After insertion, you can replace the automatically entered ??? by the label to which the jump should
be assigned.
In IL (see page 298), a jump is inserted via a JMP instruction. See in this context the description
of the operators and modifiers in IL (see page 300).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 333
FBD/LD/IL Editor
Label in FBD/LD/IL
Overview
Below the network comment field each FBD (see page 296), LD (see page 297) or IL network have
a text input field for defining a label. The label is an optional identifier for the network and can be
addressed when defining a jump (see page 333). It can consist of any sequence of characters.
Position of a label in a network
See the Tools → Options → FBD, LD and IL editor dialog box for defining the display of comment
and title.
334 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Boxes in FBD/LD/IL
Overview
A box, insertable in an FBD (see page 296), LD (see page 297), or IL (see page 298) network, is
a complex element and can represent additional functions like timers, counters, arithmetic
operations, or also programs, IEC functions and IEC function blocks.
A box can have one or more inputs and outputs and can be provided by a library or can be
programmed by the user.
You can group the inputs and outputs of a function block in its declaration via the
attribute pingroup. In the display of the function block in an FBD or LD editor, the groups can
then be faded out and in. For further information, refer to the Attribute pingroup chapter
(see page 705).
If provided with the respective module and if the option Show box icon is activated, an icon is
displayed within the box.
Use in FBD, LD
You can position a box in a LD network or in an FBD network by using the command Insert Box,
Insert Empty Box. Alternatively, you can insert it from the toolbox (see page 328) or copy or move
it within the editor via drag and drop. For further information, refer to the description of the Insert
Box command.
Use in IL
In an IL (see page 298) program, a CAL (see page 300) instruction with parameters will be inserted
in order to represent a box element.
You can update the box parameters (inputs, outputs) - in case the box interface has been modified
- with the current implementation without having to reinsert the box by executing the Update
parameters command.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 335
FBD/LD/IL Editor
Overview
With a RETURN instruction, the FBD (see page 296), LD (see page 297) or IL (see page 298) POU
can be exited.
In an FBD or LD network, you can place it in parallel or at the end of the previous elements. If the
input of a RETURN is TRUE, the processing of the POU will immediately be exited.
Execute the command Insert Return to insert a RETURN instruction. Alternatively, drag the element
from the toolbox (see page 328) or copy or move (see page 305) it from another position within the
editor.
RETURN element
In IL, the RET (see page 300) instruction is used for the same purpose.
336 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Overview
In a Function Block Diagram (see page 296) or Ladder Diagram (see page 297) network, a branch
or a hanging coil splits up the processing line as from the current cursor position. The processing
line will continue in 2 subnetworks which will be executed 1 after each other from top to bottom.
Each subnetwork can get a further branch, such allowing multiple branching within a network.
Each subnetwork gets an own marker (an upright rectangle symbol). You can select it (cursor
position 11 (see page 316)) in order to perform actions on this arm of the branch.
Branch markers
In FBD, insert a branch via command Insert branch. Alternatively, drag the element from the
toolbox (see page 328). For the possible insert positions, refer to the description of the Insert
branch command.
NOTE: Cut and paste is not implemented for subnetworks.
A branch has been inserted at the SUB box output in the example shown below. This created 2
subnetworks, each selectable by their subnet marker. After that, an ADD box was added in each
subnetwork.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 337
FBD/LD/IL Editor
To delete a subnetwork, first remove all elements of the subnetwork, that is all elements which are
positioned to the right of the marker of the subnetwork. Then select the marker and execute the
standard Delete command or press the DEL key.
In the following image, the 3-input-OR element has to be deleted before you can select and delete
the marker of the lower subnetwork.
Delete branch or subnetwork
338 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
IL (Instruction List)
The IL (see page 298) does not support networks with branches. They will stay in the original
representation.
Parallel Branches
You can use parallel branches for setting up parallel branch (see page 340) evaluation in ladder
networks.
In contrast to the open branch (without the junction point), the parallel branches are closed. They
have common split and junction points.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 339
FBD/LD/IL Editor
Parallel Branch
Overview
A parallel branch allows you to implement a parallel evaluation of logical elements. This is
accomplished via a methodology described as Short Circuit Evaluation (SCE). SCE allows you to
by-pass the execution of a function block with a boolean output if certain parallel conditions are
evaluated to be TRUE. The condition can be represented in the LD editor by a parallel branch to
the function block branch. The SCE condition is defined by 1 or several contacts within this branch,
connected parallel or sequentially.
The vertical connections of short circuit evaluation branches executed in parallel are represented
by a double line in order to differentiate them from OR constructs that are represented by a single
line (see the figure Parallel branch for SCE in a ladder network).
NOTE: The term branch is also used for another element that splits off a signal flow. This branch
(see page 337) as opposed to the parallel branch has no junction point.
The parallel branch works as follows: first it will be parsed for the branches not containing a function
block. If 1 of such branches is evaluated to be TRUE, then the function block in the parallel branch
will not be called and the value at the input of the function block branch will be passed to the output.
If the SCE condition is evaluated to be FALSE, then the function block will be called and the
boolean result of the function block execution call will be passed on.
If all branches contain function blocks, then they will be evaluated in top-to-bottom order and the
outputs of them will be combined with logical OR operations. If there are no branches containing a
function block call, then the normal OR operation will be performed.
To insert a parallel branch with SCE function, select the function block box and execute the
command Insert Contact Parallel above or Insert Contact Parallel below. This is only possible if the
first input and the main output of the function block are of type BOOL.
Below is an example of the generated language model for the given network.
340 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
1 The double vertical connection lines indicate a construct that is subject to an SCE.
2 The single vertical connection line indicates an OR construct.
The processing is as shown in the following, whereby P_IN and P_OUT represent the boolean
value at the input (split point) and output (junction point) of the parallel branch, respectively.
P_IN := b1 AND b2;
IF ((P_IN AND cond1) AND (cond2 OR cond3)) THEN
P_OUT := P_IN;
ELSE
x1(IN := P_IN, PT := {p 10}t#2s);
tElapsed := [Link];
P_OUT := x1.Q;
END_IF
bRes := P_OUT AND b3;
The following images show the dataflow (blue) in case the function block is executed (condition
resulting from cond1, cond2 and cond3 is FALSE) or bypassed (condition is TRUE).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 341
FBD/LD/IL Editor
342 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Overview
The branch start / end element is an LD element.
It allows you to define the start / end point of a branch. If there is no start point defined, you can
use the element to define it. Is the start point already defined the element determines the end point.
For further information, refer to the chapter Parallel Branch (see page 340).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 343
FBD/LD/IL Editor
Set/Reset in FBD/LD/IL
FBD and LD
A boolean output in FBD (see page 296) or correspondingly an LD (see page 297) coil can be set
or reset. To change between the set states, use the respective command Set/Reset from the
context menu when the output is selected. The output or coil will be marked by an S or an R.
Set If value TRUE arrives at a set output or coil, this output/coil will become TRUE
and remain TRUE. This value cannot be overwritten at this position as long as
the application is running.
Reset If value TRUE arrives at a reset output or coil, this output/coil will become FALSE
and remain FALSE. This value cannot be overwritten at this position as long as
the application is running.
In the LD editor, you can insert set and reset coils by drag and drop. To perform this action, use
either the ToolBox, category Ladder elements, or the S and R elements from the tool bar.
Example:
Set coil, reset coil
IL
In an Instruction List, use the S and R (see page 300) operators to set or reset an operand.
344 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Set/Reset Coil
Overview
Coils (see page 350) can also be defined as set or reset coils.
You can recognize a set coil by the S in the coil symbol: (S). A set coil will not overwrite the value
TRUE in the appropriate boolean variable. That is, the variable once set to TRUE remains TRUE.
You can recognize a reset coil by the R in the coil symbol: (R). A reset coil will not overwrite the
value FALSE in the appropriate boolean variable. That is, the variable once set to FALSE will
remain FALSE.
In the LD editor, you can insert set coils and reset coils directly via drag and drop from the ToolBox,
category Ladder elements. In doing so, you can also replace already inserted coil elements by
others.
Set coil, reset coil
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 345
FBD/LD/IL Editor
Execute
Overview
The Execute element is a block with EN/ENO that you can insert in an FBD or LD network and
that you can fill with ST code. The ST code is executed when the block is activated for processing
with a TRUE signal at the EN input.
Drag the Execute element from the toolbox (see page 328) into the network or execute the
FBD/LD/IL → Execute command (see EcoStruxure Machine Expert, Menu Commands, Online
Help) to insert the element.
Entering ST Code
Online Mode
In online mode, you can open the ST editor by clicking the plus sign under the EN input on the
function block. The usual online functionalities (monitoring, debugging) are available in the editor.
346 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Example
Examples for an Execute block in the FBD network.
Offline mode, ST program inserted
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 347
FBD/LD/IL Editor
Section 11.3
LD Elements
LD Elements
348 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
FBD/LD/IL Editor
Contact
Overview
This is an LD element.
In LD (see page 297) in its left part, each network contains 1 or several contacts. Contacts are
represented by 2 vertical, parallel lines.
Contacts pass on condition ON (TRUE) or OFF (FALSE) from left to right. A boolean variable is
assigned to each contact. If this variable is TRUE, the condition is passed from left to right and
finally to a coil in the right part of the network. Otherwise the right connection receives the value
FALSE.
You can connect multiple contacts in series as well as in parallel. Contacts in parallel represent a
logical 'OR' condition such that only one of them need be TRUE to have the parallel branch transmit
the value TRUE. Conversely, contacts in series represent a logical 'AND' condition whereas all the
contacts must be TRUE to have the final contact transmit TRUE.
Therefore, the contact arrangement corresponds to either an electric parallel or a series circuit.
A contact can also be negated. This is indicated by the slash in the contact symbol.
A negated contact passes on the incoming condition (TRUE or FALSE) only if the assigned
boolean variable is FALSE.
You can insert a contact in an LD network via one of the commands Insert Contact or Insert
Contact (right) Insert Contact Parallel (above), Insert Contact Parallel (below), Insert Rising Edge
Contact, or Insert Falling Edge Contact which are part of the LD menu. Alternatively, you can insert
the element via drag and drop from the ToolBox (see page 328) or from another position within the
editor (drag and drop).
You can replace an already inserted contact by a new contact or a negated contact. For this
purpose, drag a contact or a negated contact from the toolbox (see page 328) onto an existing
contact and drop it there.
FBD and IL
If you are working in FBD (see page 296) or IL (see page 298) view, the command will not be
available. But contacts and coils inserted in an LD network will be represented by corresponding
FBD elements or IL instructions.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 349
FBD/LD/IL Editor
Coil
Overview
This is an LD element.
On the right side of an LD network, there can be any number of coils which are represented by
parentheses.
They can only be arranged in parallel. A coil transmits the value of the connections from left to right
and copies it to an appropriate boolean variable. At the entry line, the value ON (TRUE) or the value
OFF (FALSE) can be present.
Coils can also be negated. This is indicated by the slash in the coil symbol.
In this case the negated value of the incoming signal will be copied to the appropriate boolean
variable.
You can insert a coil in a network via one of the commands Insert Coil, Insert Set Coil, Insert Reset
Coil, or Insert Negated Coil in the LD menu. Alternatively, you can insert the element via drag and
drop from the ToolBox (Ladder elements) or via drag and drop from another position within the
editor. Also refer to Set and Reset Coils (see page 345).
FBD and IL
If you are working in FBD (see page 296) or IL (see page 298) view, the command will not be
available. But contacts and coils inserted in an LD network will be represented by corresponding
FBD elements or IL instructions.
350 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Continuous Function Chart (CFC) Editor
EIO0000002854 06/2019
Chapter 12
Continuous Function Chart (CFC) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 351
Continuous Function Chart (CFC) Editor
Overview
The Continuous Function Chart is an extension to the IEC 61131-3 standard, and is a graphical
programming language based on the Function Block Diagram (FBD) language (see page 296).
However, in contrast to the FBD language, there are no networks. CFC allows the free positioning
of graphic elements, which in turn allows for feedback loops.
For creating CFC programming objects in EcoStruxure Machine Expert, see the description of the
CFC editor (see page 353).
352 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
CFC Editor
Overview
The CFC editor is a graphical editor available for programming objects in the continuous function
chart (CFC) programming language (see page 352), which is an extension to the IEC 61131-3
programming languages. Choose the language when you add a new program organization unit
(POU) object to your project. For large projects, consider using the page-oriented version
(see page 369).
The editor will be available in the lower part of the window which opens when opening a CFC POU
object. This window also includes the declaration editor (see page 426) in its upper part.
CFC editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 353
Continuous Function Chart (CFC) Editor
The CFC editor in contrast to the FBD / LD editor allows free positioning (see page 363) of the
elements, which allows direct insertion of feedback paths. The sequence of processing is
determined by a list which contains all currently inserted elements and can be modified.
The following elements are available in a toolbox (see page 357) and can be inserted via drag and
drop:
box (operators, functions, function blocks, and programs)
input
output
jump
label
return
composer
selector
connection marks
comments
You can connect the input and output pins of the elements by drawing a line with the mouse. The
path of the connecting line will be created automatically and will follow the shortest possible route.
The connecting lines are automatically adjusted as soon as the elements are moved. For further
information, refer to the description of inserting and arranging elements (see page 363). For
complex charts, you can use connection marks (see page 358) instead of lines. You may also
consider the possibility of modifying the routing.
It may happen that elements get positioned in a way that they cover already routed connections.
These collisions are indicated by red connection lines. If there are any collisions in the chart, the
button in the upper right corner of the editor view gets a red outline: . To edit the collisions step
by step, click this button and execute the command Show next collision. Then the next found
concerned connection will be selected.
For complex charts, you can use connection marks (see page 358) instead of lines. You may also
wish to use the page-oriented version of the CFC editor.
A zoom function allows you to change the dimension of the editor window: Use the button in
the lower right corner of the window and choose between the listed zoom factors. Alternatively, you
can select the entry ... to open a dialog box where you can type in any arbitrary factor.
You can call the commands for working in the CFC editor from the context menu or from the CFC
menu which is available as soon as the CFC editor is active.
354 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
Overview
Cursor positions in a CFC program are indicated by a gray background when hovering over the
programming element.
When you click one of these shadowed areas, before releasing the mouse-button, the background
color will change to red. As soon as you release the mouse-button, this will become the current
cursor position, with the respective element or text being selected and displayed as red-colored.
There are 3 categories of cursor positions. See the possible positions indicated by a gray shaded
area as shown in the illustrations of the following paragraphs.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 355
Continuous Function Chart (CFC) Editor
356 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
Overview
The graphical elements available for programming in the CFC editor (see page 353) window are
provided by a toolbox. Open the toolbox in a view window by executing the command ToolBox in
the View menu.
Select the desired element in the toolbox and insert (see page 363) it in the editor window via drag
and drop.
Besides the programming elements, there is an entry , at the top of the toolbox list. As
long as this entry is selected, the cursor has the shape of an arrow and you can select elements in
the editor window for positioning and editing.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 357
Continuous Function Chart (CFC) Editor
CFC Elements
input You can select the text offered by ??? and replace it by a variable
or constant. The input assistance serves to select a valid
identifier.
output
358 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 359
Continuous Function Chart (CFC) Editor
output pin – Depending on the box type, you can add an additional output. For
this purpose, select the box element in the CFC network and draw
the output pin element on the box.
You can drag an input or output connection to another position at
the box while keeping pressed the Ctrl key.
Example of a Composer
A CFC program cfc_prog handles an instance of function block fublo1, which has an input
variable struvar of type structure. Use the composer element to access the structure
components.
Structure definition stru1 :
TYPE stru1 :
STRUCT
ivar:INT;
strvar:STRING:='hallo';
END_STRUCT
END_TYPE
Declaration and implementation of function block fublo1:
FUNCTION_BLOCK fublo1
VAR_INPUT
struvar:STRU1;
END_VAR
VAR_OUTPUT
fbout_i:INT;
fbout_str:STRING;
END_VAR
VAR
fbvar:STRING:='world';
END_VAR
fbout_i:=[Link]+2;
fbout_str:=CONCAT ([Link],fbvar);
360 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
1 composer
2 function block with input variable struvar of type structure stru1
Example of a Selector
A CFC program cfc_prog handles an instance of function block fublo2, which has an output
variable fbout of type structure stru1. Use the selector element to access the structure
components.
Structure definition stru1:
TYPE stru1 :
STRUCT
ivar:INT;
strvar:STRING:='hallo';
END_STRUCT
END_TYPE
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 361
Continuous Function Chart (CFC) Editor
362 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
Overview
The elements available for programming in the CFC editor are provided in the ToolBox
(see page 357) which by default is available in a window as soon as the CFC editor is opened.
The Tools → Options → CFC editor defines general settings for working within the editor.
Inserting
To insert an element, select it in the ToolBox (see page 357) by a mouse-click, keep the mouse-
button pressed and drag the element to the desired position in the editor window. During dragging,
the cursor will be displayed as an arrow plus a rectangle and a plus-sign. When you release the
mouse-button, the element will be inserted.
Selecting
To select an inserted element for further actions such as editing or rearranging, click an element
body to select the element. It will be displayed by default as red-shaded. By additionally pressing
the SHIFT key, you can click and select further elements. You can also press the left mouse-button
and draw a dotted rectangle around all elements which you want to select. As soon as you release
the button the selection will be indicated. By command Select all , all elements are selected at
once.
By using the arrow keys you can shift the selection mark to the next possible cursor position. The
sequence depends on the execution order or the elements, which is indicated by element numbers
(see page 365).
When an input pin is selected and you press CTRL + LEFT ARROW, the corresponding output will
be selected. When an output pin is selected and you press CTRL + LEFT ARROW, the
corresponding outputs will be selected.
Replacing Boxes
To replace an existing box element, replace the currently inserted identifier by that of the desired
new element. The number of input and output pins will be adapted if necessary due to the definition
of the POUs and thus some existing assignments could be removed.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 363
Continuous Function Chart (CFC) Editor
Moving
To move an element, select the element by clicking the element body (see possible cursor
positions (see page 355)) and drag it, while keeping the mouse-button pressed, to the desired
position. Then release the mouse-button to place the element. You also can use the Cut and Paste
commands for this purpose.
Connecting
You can connect the input and output pins of 2 elements by a connection line or via connection
marks.
Connection line: You can either select a valid point of connection that is an input or output pin of
an element (refer to Cursor Positions in CFC (see page 355)), and then draw a line to another point
of connection with the mouse. Or you can select 2 points of connection and execute the command
Select connected pins. A selected possible point of connection is indicated by a red filled square.
When you draw a line from such a point to the target element, you can identify the possible target
point of connection. When you then position the cursor over a valid connection point, an arrow
symbol is added to the cursor when moving over that point, indicating the possible connection.
The following figure provides an example: After a mouse-click on the input pin of the var1 element,
the red rectangle is displayed showing that this is a selected connection point. By keeping the
mouse button pressed, move the cursor to the output pin of the ADD box until the cursor symbol
appears as shown in the figure. Now release the mouse button to establish the connection line.
The shortest possible connection is created taking into account the other elements and
connections.
You can drag an input or output connection to another position at the box while keeping pressed
the Ctrl key.
Connection marks: you could as well use connection marks instead of connection lines in order to
simplify complex charts. Refer to the description of connection marks (see page 358).
Copying
To copy an element, select it and use the Copy and Paste commands.
Editing
After you have inserted an element, by default the text part is represented by ???. To replace this
by the desired text (POU name, label name, instance name, comment, and so on), click the text to
obtain an edit field. Also the button ... will be available to open the Input Assistant.
364 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
Deleting
You can delete a selected element or connection line by executing the command Delete, which is
available in the context menu or press the DEL key.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 365
Continuous Function Chart (CFC) Editor
Overview
In online mode, the CFC editor provides views for monitoring, writing and forcing the variables and
expressions on the controller. The debugging functionality (breakpoints, stepping, and so on) is
available as described below.
For information on how to open objects in online mode, refer to the description of the user
interface in online mode (see page 55).
The editor window of a CFC object also includes the declaration editor in the upper part. Refer
to the description of the declaration editor in online mode (see page 432).
For information on how to edit parameters in the CFC editor, refer to the description of the Edit
Parameters... command (see EcoStruxure Machine Expert, Menu Commands, Online Help).
Monitoring
The actual values are displayed in small monitoring windows behind each variable (inline
monitoring).
Online view of a program object PLC_PRG:
Note for the online view of a function block POU, that monitoring is only possible in an instance
view. In the base implementation of the function block POU, no values are displayed. The column
Value contains the text Value of the expression and the inline monitoring fields in the implemen-
tation part show three question marks each.
Boolean connections are monitored in the colors TRUE = blue and FALSE = black.
366 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
Forcing/Writing Variables
In online mode, you can prepare a value for forcing or writing a monitored variable either in the
declaration editor or - if the option Prepare values in implementation part is activated - also in the
implementation part. For working in the declaration editor, refer to the chapter Declaration Editor
in Online Mode (see page 432). In the implementation part, click the monitoring box next to the
respective element or directly the element to open the Prepare Value dialog box (see page 405).
For boolean variables, no dialog box opens, but clicking the value currently displayed next to the
variable directly toggles between the possible values to be forced or written. In the monitoring box
of a currently forced variable a red F is displayed.
Forced value in the implementation part
If the CFC option Prepare values in implementation part is enabled, then the value currently
prepared for writing or forcing is displayed behind the current value in angle brackets in the
monitoring field of a variable.
Prepared value in the implementation part
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 367
Continuous Function Chart (CFC) Editor
NOTE: A breakpoint will be set automatically in all methods which may be called. If an interface-
managed method is called, breakpoints will be set in all methods of function blocks implementing
that interface and in all derivative function blocks subscribing the method. If a method is called via
a pointer on a function block, breakpoints will be set in the method of the function block and in all
derivative function blocks which are subscribing to the method.
368 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Continuous Function Chart (CFC) Editor
Overview
In addition to the CFC standard editor, EcoStruxure Machine Expert provides the CFC editor
pagination. Besides the tools (see page 357) and commands of the standard CFC editor, this
editor allows you to arrange the elements on any number of different pages.
NOTE: You cannot convert POUs created in the language CFC page-oriented to normal CFC and
vice versa. You can copy elements between these 2 editors with the copy and paste commands
(via clipboard) or the drag and drop function.
CFC pagination
To change the size of the page execute the command Edit Page Size.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 369
Continuous Function Chart (CFC) Editor
Execution Order
The execution order of the pages is from top to the bottom. Within a page, the order follows the
rules of the standard CFC editor (refer to further information of execution order (see page 365)).
You can change the execution order of elements only within the associated page. You cannot
change the execution order of elements on different pages.
370 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Sequential Function chart (SFC) Editor
EIO0000002854 06/2019
Chapter 13
Sequential Function Chart (SFC) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 371
Sequential Function chart (SFC) Editor
SFC Editor
Overview
The SFC editor is available for programming objects in the IEC 61131-3 programming language
SFC - Sequential Function Chart (see page 374). Choose the language when you add a new POU
object to the project.
The SFC editor is a graphical editor. Perform general settings concerning behavior and display in
the Options → SFC editor dialog box.
The SFC editor is available in the lower part of the window which opens when you edit an SFC
POU object. This window also includes the Declaration Editor (see page 426) in the upper part.
SFC editor
372 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 373
Sequential Function chart (SFC) Editor
Overview
The Sequential Function Chart (SFC) is a graphically oriented language which describes the
chronological order of particular actions within a program. These actions are available as separate
programming objects, written in any available programming language. In SFC, they are assigned
to step elements and the sequence of processing is controlled by transition elements. For a
detailed description on how the steps will be processed in online mode, refer to Sequence of
Processing in SFC (see page 398).
For information on how to use the SFC editor in EcoStruxure Machine Expert, refer to the
description of the SFC Editor (see page 372).
Example
Example for a sequence of steps in an SFC module:
374 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Overview
Possible cursor positions in an SFC diagram in the SFC editor (see page 372) are indicated by a
gray shadow when moving with the cursor over the elements.
When you click a text cursor position, the string will become editable.
Select action name for editing:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 375
Sequential Function chart (SFC) Editor
When you click a shadowed area, the element is selected. It gets a dotted frame and is displayed
as red-shaded (for multiple selection, refer to Working in the SFC Editor (see page 377) ).
Selected step element
376 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Overview
By default, a new SFC POU contains an initial step and a subsequent transition. This chapter
provides information on how to add further elements, and how to arrange and edit the elements.
Navigating
Use the arrow keys to jump to the next or previous element in the chart.
Inserting Elements
To insert the particular SFC elements (see page 381), execute the respective commands from the
SFC menu. For further information, refer to the description of the SFC editor commands
(see EcoStruxure Machine Expert, Menu Commands, Online Help). Double-click an already
inserted step, transition, or action element, which does not yet reference a programming object, to
open a dialog box for assigning one.
Selecting Elements
Select an element or text field by clicking a possible cursor position. You can also give the selection
to an adjacent element by using the arrow keys. The element will change color to red. For example,
see the chapter Cursor Positions in SFC (see page 375).
NOTE: In contrast to previous versions of EcoStruxure Machine Expert, you can select and thus
also move (cut, copy, paste) or delete steps and transitions separately.
For multiple selection, the following possibilities are available:
Keep the SHIFT key pressed and then click the particular elements to be selected.
Press the left mouse-key and draw a rectangle (dotted line) around the elements to be selected.
Execute the command Select All, by default from the Edit menu.
Editing Texts
Click a text cursor position to open the edit field, where you can edit the text. If a text area has been
selected via the arrow keys, open the edit field explicitly by using the SPACE bar.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 377
Sequential Function chart (SFC) Editor
Deleting Elements
Select the elements and execute the command Delete or press the DEL key.
Consider the following:
Deleting a step also deletes the associated action list.
Deleting the initial step automatically sets the following step to be the initial one. This option
Initial step will be activated in the properties of this step.
Deleting the horizontal line preceding a branched area will delete all branches.
Deleting all particular elements of a branch will delete the branch.
378 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Overview
You can view and edit the properties of an SFC element in the Element Properties dialog box.
Open this dialog box via the command Element Properties, which is part of the View menu.
It depends on the currently selected element which properties are displayed.
You can configure whether the particular types of properties should be displayed next to an
element in the SFC chart from the View tab of the SFC editor options.
Common Properties
Property Description
Name Element name, by default <element><running number>
Examples: step name Step0, Step1, branch name branch0
and so on.
Comment Element comment, text stringExample: Reset the counter.
Press CTRL + ENTER to insert line breaks.
Symbol For each SFC element implicitly a flag is created, named like
the element.
Here you can specify whether this flag variable should be
exported to the symbol configuration and how the symbol
then should be accessible in the controller.
None: The symbol will be exported to the symbol
configuration, but it will not be accessible in the controller.
Read: The symbol will be exported to the symbol
configuration and it will be readable in the controller.
Write: The symbol will be exported to the symbol
configuration and it will be written to the controller.
Read/Write: Combination of read and write.
By default, this field is left empty. That is that no symbol is
exported to the symbol configuration.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 379
Sequential Function chart (SFC) Editor
Specific Properties
NOTE: Use the appropriate implicit variables to determine the status of actions and time outs via
SFC flags (see page 393).
380 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Overview
You can insert the graphic elements usable for programming in the SFC editor window by
executing the commands from the SFC menu.
For information on working in the editor, refer to the description in the chapter Working in the SFC
Editor (see page 377)
The following elements are available and are described in this chapter:
step (see page 381)
transition (see page 381)
action (see page 384)
branch (alternative) (see page 388)
branch (parallel) (see page 388)
jump (see page 390)
macro (see page 390)
Step / Transition
To insert a single step or a single transition, execute the command Step or Transition from the
ToolBox. Steps and transitions can also be inserted in combination, via command Insert step-
transition ( ) or Insert step-transition after ( ) from the toolbar.
A step is represented by a box primarily containing an automatically generated step name. It is
connected to the preceding and subsequent transition by a line. The box frame of the first step
within an SFC, the initial step, is double-lined.
The transition is represented by a small rectangle. After inserting it has a default name, Trans<n>,
whereby n is a running number.
Example for step and subsequent transition:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 381
Sequential Function chart (SFC) Editor
Recommendations on Transitions
A transition has to provide the condition on which the subsequent step shall become active as soon
as the condition value is TRUE. Therefore, a transition condition must have the value TRUE or
FALSE.
A transition condition can be defined in the following 2 ways:
NOTE: If a transition produces multiple statements, assign the desired expression to a transition
variable.
NOTE: Transitions which consist of a transition or a property object are indicated by a small triangle
in the upper right corner of the rectangle.
382 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Examples of transitions:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 383
Sequential Function chart (SFC) Editor
In contrast to previous versions of EcoStruxure Machine Expert, a transition call is handled like a
method call. It will be entered according to the following syntax:
<transition name>:=<transition condition>;
Example: trans1:= (a=100);
or just
<transition condition>;
Example: a=100;
See also an example (condition_xy) in the figure Examples of transitions.
Action
An action can contain a series of instructions written in one of the valid programming languages. It
is assigned to a step and, in online mode, it will be processed according to the defined sequence
of processing (see page 398) .
Each action to be used in SFC steps must be available as a valid POU within the SFC POU or the
project ( ).
Step names must be unique in the scope of the parent POU. An action may not contain a step
having the same name as the step to which it is assigned to. Otherwise, an error will be detected
during the build process.
Example of an action written in ST
The IEC conforming and the IEC extending step actions are described in the following paragraphs.
384 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Each action box in the first column shows the qualifier and in the second the action name.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 385
Sequential Function chart (SFC) Editor
386 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Action Action_AS1 is associated to step AS1 as a step action (left), or as an IEC action with
qualifier N (right). Due to the fact that in both cases 2 transitions are used, it will take 2 controller
cycles each before the initial step is reached again, assuming that a variable iCounter is
incremented in Action_AS1. After a reactivation of step Init, iCounter in the left example will
have value 1. In the right one however, it will have value 2 because the IEC action - due to the
deactivation of AS1 - has been executed twice.
For further information on qualifiers, refer to the list of available qualifiers (see page 392).
In contrast to IEC actions, step actions can be embedded in such a way that they can only be called
from the corresponding step. If you copy this step, new action objects are automatically created
and the implementation code is duplicated. Select the duplication mode for step actions as Copy
reference or Copy implementation in the dialog box that is displayed when you insert the first action
into the step. You can select the duplication mode later by activating the Duplicate on copy option
(see page 380) in the Element Properties dialog box. It is also possible to configure the Default
insertion method as a general option in the Tools → Options → SFC Editor dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 387
Sequential Function chart (SFC) Editor
Branches
A sequential function chart (SFC) can diverge; that is the processing line can be branched into 2 or
several further lines (branches). Parallel branches (see page 388) will be processed parallel
(simultaneously). In the case of alternative branches (see page 388), only one will be processed
depending on the preceding transition condition. Each branching within a chart is preceded by a
horizontal double (parallel) or simple (alternative) line and also terminated by such a line or by a
jump (see page 390).
Parallel Branch
A parallel branch has to begin and end with a step. Parallel branches can contain alternative
branches or other parallel branches.
The horizontal lines before and after the branched area are double-lines.
Processing in online mode: If the preceding transition (t2 in the example shown on the left) is
TRUE, the first steps of all parallel branches will become active (Step11 and Step21). The
particular branches will be processed in parallel to one another before the subsequent transition
(t3) will be recognized.
To insert a parallel branch, select a step and execute the command Insert branch right.
You can transform parallel and alternative branches to each other by executing the commands
Parallel or Alternative.
Automatically a branch label is added at the horizontal line preceding the branching which is
named Branch<n> whereby n is a running number starting with 0. You can specify this label when
defining a jump target (see page 390).
388 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Alternative Branch
The horizontal lines before and after the branched area are simple lines.
An alternative branch has to begin and end with a transition. Alternative branches can contain
parallel branches and other alternative branches.
If the step which precedes the alternative beginning line is active, then the first transition of each
alternative branch will be evaluated from left to right. The first transition from the left whose
transition condition has value TRUE, will be opened, and the following steps will be activated.
To insert alternative branches, select a transition and execute the command Insert branch right.
You can transform parallel and alternative branches from one another by executing the commands
Parallel or Alternative.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 389
Sequential Function chart (SFC) Editor
Jump
A jump is represented by a vertical connection line plus a horizontal arrow and the name of the
jump target. It defines the next step to be processed as soon as the preceding transition is TRUE.
You can use jumps to avoid that processing lines cross or lead upward.
Besides the default jump at the end of the chart, a jump may only be used at the end of a branch.
To insert a jump, select the last transition of the branch and execute the command Insert jump.
The target of the jump is specified by the associated text string which can be edited. It can be a
step name or the label of a parallel branch.
Macro
Main SFC editor view
390 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
A macro is represented by a bold-framed box containing the macro name. It includes a part of the
SFC chart, which thus is not directly visible in the main editor view. The process flow is not
influenced by using macros; it is just a way to hide some parts of the program, for example, in order
to simplify the display. To insert a macro box, execute the command Insert macro (after). The
macro name can be edited.
To open the macro editor, double-click the macro box or execute the command Zoom into macro.
You can edit here just as in the main editor view and enter the desired section of the SFC chart.
To get out, execute the command Zoom out of macro.
The title line of the macro editor shows the path of the macro within the current SFC example:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 391
Sequential Function chart (SFC) Editor
Overview
In order to configure in which way the actions (see page 384) should be associated to the
IEC steps, some qualifiers are available, which are to be inserted in the qualifier field of an action
element.
Available Qualifiers
The qualifiers L, D, SD, DS, and SL need a time value in the TIME constant format. Enter it directly
after the qualifier, separated by a blank space, for example L T#10s.
NOTE: When an IEC action has been deactivated, it will be executed one more time. The
implication is that each action will execute at least twice.
392 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Overview
Each SFC step and IEC action provides implicitly generated variables for watching the status
(see page 393) of steps and IEC actions during runtime. Also, you can define variables for
watching and controlling the execution of an SFC (timeouts, reset, tip mode). These variables can
also be generated implicitly by the SFC object.
Basically, for each step and each IEC action, an implicit variable is generated. A structure instance,
named for the element, for example, step1 for a step with step name step1. You can define in the
element properties (see page 379) whether for this flag a symbol definition should be exported to
the symbol configuration and how this symbol should be accessible in the controller.
The data types for those implicit variables are defined in library [Link]. This library will
automatically be included in the project as soon as an SFC object is added.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 393
Sequential Function chart (SFC) Editor
Symbol generation
In the element properties (see page 379) of a step or an action, you can define if a symbol
definition should be added to a possibly created and downloaded symbol configuration for the step
or action name flag. For this purpose, make an entry for the desired access right in column Symbol
of the element properties view.
NOTE: If you use the boolean flag <stepname>.x to force a certain status value for a step (for
setting a step active), be aware that this will affect uncontrolled states within the SFC.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not use the boolean flag <stepname>.x to force a status value for setting a step active.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
394 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
The following implicit variables (flags) can be used. For this purpose, you have to declare and
activate them in the SFC Settings dialog box.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 395
Sequential Function chart (SFC) Editor
The following figure provides an example of some SFC detected error flags in online mode of the
editor.
A timeout has been detected in step s1 in SFC object POU by flag SFCError.
Accessing Flags
For enabling access on the flags for the control of SFC execution (timeouts, reset, tip mode),
declare and activate the flag variables as described above (Control of SFC Execution
(see page 394)).
Syntax for accessing from an action or transition within the SFC POU:
<stepname>.<flag>
or
_<actionname>.<flag>
Examples:
status:=step1._x;
checkerror:=SFCerror;
Syntax for accessing from another POU:
<SFC POU>.<stepname>.<flag>
or
<SFC POU>._<actionname>.<flag>
396 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Examples:
status:=SFC_prog.step1._x;
checkerror:=SFC_prog.SFCerror;
Consider the following in case of write access from another POU:
The implicit variable additionally has to be declared explicitly as a VAR_INPUT variable of the
SFC POU
or it has to be declared globally in a GVL (global variable list).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 397
Sequential Function chart (SFC) Editor
Overview
In online mode, the particular action types will be processed according a defined sequence; see
the table below.
Definition of Terms
The following terms are used:
Term Description
active step A step, whose step action is being executed.
In online mode active steps are filled with blue color.
initial step In the first cycle after an SFC POU has been called, the initial step
automatically becomes active and the associated step action
(see page 384) is executed.
IEC actions IEC actions are executed at least twice:
The first time when they became active.
The second time - in the following cycle - when they have been
deactivated.
alternative branches If the step preceding the horizontal start line of alternative branches
is active, then the first transition of each particular branch will be
evaluated from left to right. The first transition from the left whose
transition condition has value TRUE will be searched and the
respective branch will be executed that is the subsequent step within
this branch will become active.
parallel branches If the double-line at the beginning line of parallel branches is active
and the preceding transition condition has the value TRUE, then in all
parallel branches each first step will become active. The branches
now will be processed in parallel to one another. The step
subsequent to the double-line at the end of the branching will become
active when all previous steps are active and the transition condition
after the double-line has the value TRUE.
398 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Sequential Function chart (SFC) Editor
Processing Order
Processing order of elements in a sequence:
Step Description
1. Reset of the IEC Actions All action control flags of the IEC actions (see page 384) get reset (not, however,
the flags of IEC actions that are called within actions).
2. Step exit actions (step All steps are checked in the order which they assume in the sequence chart (top to
deactivated) bottom and left to right) to determine whether the requirement for execution of the
step exit action is [Link] that is the case, it will be executed. An exit action will
be executed if the step is going to become deactivated (see page 381). This means
if the entry and step actions - if existing - have been executed during the last cycle,
and if the transition for the following step is TRUE.
3. Step entry actions(step All steps are tested in the order which they assume in the sequence to determine
activated) whether the requirement for execution of the step entry action is provided. If that is
the case, it will be executed. An entry action will be executed if the step-preceding
transition condition is TRUE and thus the step has been activated.
4. Timeout check, step active For non-IEC steps, the corresponding step active action is now executed in the
actions order in which they are positioned in the sequence (top -> down and left -> right).
5. IEC actions IEC actions (see page 384) that are used in the sequence are executed in
alphabetical order. This is done in 2 passes through the list of actions. In the first
pass, all the IEC actions that are deactivated in the current cycle are executed. In
the second pass, all the IEC actions that are active in the current cycle are
executed.
6. Transition check, activating Transitions (see page 381) are evaluated. If the step in the current cycle was active
next steps and the following transition returns TRUE (and if applicable the minimum active
time has already elapsed), then the following step is activated.
NOTE: An action may be executed multiple times in 1 cycle because it is called from more than
one other IEC actions when there are multiple steps active. That is to say, the same IEC action is
used simultaneously in different levels of an SFC, and this could lead to undesired effects.
Example: An SFC could have 2 IEC actions A and B, which are both implemented in SFC, and
which both call IEC action C. Then in IEC actions A and B both can be active in the same cycle
and furthermore, in both actions IEC action C can be active. Then C would be called twice.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not call IEC actions from multiple other IEC actions in the same cycle.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: Use implicit variables (see page 393) for determining the status of steps and actions or the
execution of the chart.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 399
Sequential Function chart (SFC) Editor
Overview
In online mode, the SFC editor provides views for monitoring (see below) and for writing and
forcing the variables and expressions on the controller. Debugging functionality like for the other
IEC languages (breakpoints, stepping, and so on) is not available in SFC. However, consider the
following hints for debugging SFC:
For information on how to open objects in online mode, refer to the description of the user
interface in online mode (see page 55).
The editor window of an SFC object also includes the declaration editor in the upper part. For
general information, refer to the chapter Declaration Editor in Online Mode (see page 432) . If
you have declared implicit variables (SFC flags) (see page 393) via the SFC Settings dialog
box, they will be added here, but will not be viewed in the offline mode of the declaration editor.
Consider the sequence of processing (see page 398) of the elements of a Sequential Function
Chart.
See the object properties or the SFC editor options and SFC defaults for settings concerning
compilation or online display of the SFC elements and their attributes.
Consider the possible use of flags (see page 393) for watching and controlling the processing
of an SFC.
Monitoring
Active steps are displayed as filled with blue color. The display of step attributes depends on the
set SFC editor options.
Online view of program object SFC_prog
400 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Structured Text (ST) Editor
EIO0000002854 06/2019
Chapter 14
Structured Text (ST) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 401
Structured Text (ST) Editor
Section 14.1
Information on the ST Editor
402 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
ST Editor
Overview
The ST editor is used to create programming objects in the IEC programming language Structured
Text (ST) or extended Structured Text which provides some extensions to the IEC 61131-3
standard.
The ST editor is a text editor. Therefore, use the corresponding text editor settings in the Options
and Customize dialog boxes to configure behavior, appearance, and menus. There you can define
the default settings for highlight coloring, line numbers, tabs, indenting, and many other options.
Further Information
To select blocks, press the ALT key and select the desired text area with the mouse.
The editor will be available in the lower part of a window which also includes the declaration editor
(see page 426) in the upper part.
If syntactic errors are detected during editing, the corresponding messages will be displayed in the
Precompile Messages window. This window is updated each time you reset the focus to the editor
window (for example, place your cursor in another window and then back to the editor window).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 403
Structured Text (ST) Editor
Overview
In online mode, the structured text editor (ST editor) provides views for monitoring (see page 404),
and for writing, and forcing the variables and expressions on the controller. Debugging
(breakpoints, stepping, and so on) is available. See Breakpoint positions in ST Editor
(see page 406).
For information on how to open objects in online mode, refer to the description of the user
interface in online mode (see page 55).
For information on how to enter prepared values for variables in online mode, see Forcing of
variables (see page 405).
The editor window of an ST object also includes the declaration editor in the upper part. For
information on the declaration editor in online mode, see Declaration Editor in Online Mode
(see page 432).
Monitoring
If the monitoring is not explicitly deactivated in the Options dialog box, small monitoring boxes will
be displayed behind each variable showing the actual value.
Online view of a program object PLC_PRG with monitoring:
404 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
Forcing of Variables
In addition to the possibility to enter a prepared value for a variable within the declaration of any
editor, the ST editor offers double-clicking the monitoring box of a variable within the implemen-
tation part (in online mode). Enter the prepared value in the rising dialog box.
Dialog box Prepare Value
You find the name of the variable completed by its path within the Devices Tree (Expression), its
type, and current value.
By activating the corresponding item, you can choose the following options:
preparing a new value which has to be entered in the edit field
removing a prepared value
releasing the variable that is being forced
releasing the variable that is being forced and resetting it to the value it was assigned before
forcing
To carry out the selected action, execute the command Debug → Force values (item Online) or
press the F7 key.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 405
Structured Text (ST) Editor
406 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
Breakpoint display in ST
NOTE: A breakpoint will be set automatically in all methods which may be called. If an interface-
managed method is called, breakpoints will be set in all methods of function blocks implementing
that interface and in all derivative function blocks subscribing the method. If a method is called via
a pointer on a function block, breakpoints will be set in the method of the function block and in all
derivative function blocks which are subscribing to the method.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 407
Structured Text (ST) Editor
Section 14.2
Structured Text ST
Structured Text ST
408 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
Structured Text ST
Overview
Structured Text is a textual high-level programming language, similar to PASCAL or C. The
program code is composed of expressions (see page 410) and instructions (see page 413). In
contrast to IL (Instruction List), you can use numerous constructions for programming loops, thus
allowing the development of complex algorithms.
Example
IF value < 7 THEN
WHILE value < 8 DO
value:=value+1;
END_WHILE;
END_IF;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 409
Structured Text (ST) Editor
Expressions
Overview
An expression is a construction which after its evaluation returns a value. This value is used in
instructions.
Expressions are composed of operators (see page 767), operands (see page 869), and/or
assignments. An operand can be a constant, a variable, a function call, or another expression.
Examples
33 (* Constant *)
ivar (* Variable *)
fct(a,b,c) (* Function call*)
a AND b (* Expression *)
(x*y) / z (* Expression *)
real_var2 := int_var; (* Assignment, see below *)
410 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
Order of Operations
The evaluation of an expression is performed by processing the operators according to certain
rules. The operator with the highest order of operation is processed first, then the operator with the
next operating level, and so on, until all operators have been processed.
Below you find a table of the ST operators in the order of their ordinal operating level:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 411
Structured Text (ST) Editor
Assignment as Expression
As an extension to the IEC 61131-3 standard (ExST), assignments can be used as an expression.
Examples:
int_var1 := int_var2 := int_var3 + 9; (* int_var1 and int_var2 both equal to the value
of int_var3 + 9*)
real_var1 := real_var2 := int_var; (* correct assignments, real_var1 and
real_var2 will get the value of int_var *)
int_var := real_var1 := int_var; (* a message will be displayed due to type mismatch
real-int *)
IF b := (i = 1) THEN (*Expression used inside of IF condition statement:
i := i + 1; First b will be assigned TRUE or FALSE, depending
END_IF on whether i is 1 or not, then the result value of b will
be evaluated.*)
412 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
Instructions
Overview
Instructions describe what to do with the given expressions (see page 410).
The following instructions can be used in ST:
Instruction Example
assignment (see page 414) A:=B; CV := CV + 1; C:=SIN(X);
Calling a function block (see page 415) and CMD_TMR(IN := %IX5, PT := 300);
using the function block output A:=CMD_TMR.Q
RETURN (see page 416) RETURN;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 413
Structured Text (ST) Editor
Instruction Example
JMP (see page 421) label1: i:=i+1;
IF i=10 THEN
JMP label2;
END_IF
JMP label1;
label2:
empty instruction ;
Assignment Operators
Default Assignment
On the left side of an assignment, there is an operand (variable, address) to which the value of the
expression on the right side is assigned by the assignment operator :=.
Also refer to the description of the MOVE operator (see page 780) which has the same function.
For an example with assignment, refer to the Example of a Call with Assignments paragraph
(see page 200) of the Calling a Function Block chapter.
Example
a:= b;
a gets the value of b.
Set operator S=
The value will be set: if it is once set to TRUE, it will remain TRUE.
Example
a S= b;
a is set to TRUE if b is TRUE while processing the assignment.
If b is FALSE while processing the assignment, the value of a will not be modified.
Reset operator R=
The value will be reset: if it is once set to FALSE, it will remain FALSE.
Example
a R= b;
a is set to FALSE as soon as b = TRUE.
NOTE: In case of a multiple assignment, set and reset assignments refer to the last member of the
assignment.
414 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
Example
a S= b R= fun1(par1,par2)
In this case, b will be the reset output value of fun1. But a does not get the set value of b, but gets
the set output value of fun1.
Consider that an assignment can be used as an expression (see page 410). This is an extension
to the IEC 61131-3 standard.
Assignment operator REF
This operator generates a reference to a value.
Syntax
REF= <variable>
Example
A : REFERENCE TO DUT;
B : DUT;
C : DUT;
A REF= B; // corresponds to A := ADR(B);
A := C; // corresponds to A^ := C;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 415
Structured Text (ST) Editor
RETURN Instruction
You can use the RETURN instruction to leave a POU.
Syntax
RETURN;
Example
IF b=TRUE THEN
RETURN;
END_IF;
a:=a+1;
If b is TRUE, instruction a:=a+1; will not be executed. As a result, the POU will be left
immediately.
IF Instruction
With the IF instruction you can test for a condition, and, depending upon this condition, execute
instructions.
Syntax
IF <boolean_expression1> THEN
<IF_instructions>
{ELSIF <boolean_expression2> THEN
<ELSIF_instructions1>
..
..
ELSIF <boolean_expression n> THEN
<ELSIF_instructions-1>
ELSE
<ELSE_instructions>}
END_IF;
The segment in brackets {} is optional.
If the <boolean_expression1> returns TRUE, then only the <IF_instructions> are executed and, as
a result, none of the other instructions. Otherwise, the boolean expressions, beginning with
<boolean_expression2>, are evaluated one after the other until 1 of the expressions returns TRUE.
Then only those instructions after this boolean expression and before the next ELSE or ELSIF are
evaluated. If none of the boolean expressions produce TRUE, then only the <ELSE_instructions>
are evaluated.
416 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
Example
IF temp<17
THEN heating_on := TRUE;
ELSE heating_on := FALSE;
END_IF;
Here, the heating is turned on when the temperature sinks below 17 degrees. Otherwise, it remains
off.
CASE Instruction
With the CASE instruction, you can combine several conditioned instructions with the same
condition variable in one construct.
Syntax
CASE <Var1> OF
<value1>: <instruction 1>
<value2>: <instruction 2>
<value3, value4, value5>: <instruction 3>
<value6..value10>: <instruction4>
..
..
<value n>: <instruction n>
ELSE <ELSE instruction>
END_CASE;
A CASE instruction is processed according to the following model:
If the variable in <Var1> has the value <Value I>, then the instruction <Instruction I> will be
executed.
If <Var 1> has none of the indicated values, then the <ELSE Instruction> will be executed.
If the same instruction is to be executed for several values of the variables, then you can write
these values one after the other separated by commas and thus condition the common
execution.
If the same instruction is to be executed for a value range of a variable, you can write the initial
value and the end value separated by 2 dots. Therefore, you can condition the common
condition.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 417
Structured Text (ST) Editor
Example
CASE INT1 OF
1, 5: BOOL1 := TRUE;
BOOL3 := FALSE;
2: BOOL2 := FALSE;
BOOL3 := TRUE;
10..20: BOOL1 := TRUE;
BOOL3:= TRUE;
ELSE
BOOL1 := NOT BOOL1;
BOOL2 := BOOL1 OR BOOL2;
END_CASE;
FOR Loop
With the FOR loop, you can program repeated processes.
Syntax
INT_Var:INT;
FOR <INT_Var> := <INIT_VALUE> TO <END_VALUE> {BY <step size>} DO
<instructions>
END_FOR;
The segment in brackets {} is optional.
The <instructions> are executed as long as the counter <INT_Var> is not greater than the
<END_VALUE>. This is checked before executing the <instructions> so that the <instructions> are
not executed if <INIT_VALUE> is greater than <END_VALUE>.
When <instructions> are executed, <INT_Var> is increased by <Step size>. The step size can
have any integer value. If it is missing, then it is set to 1. The loop will terminate when <INT_Var>
is greater than the <END_VALUE>.
Example
FOR Counter:=1 TO 5 BY 1 DO
Var1:=Var1*2;
END_FOR;
Erg:=Var1;
Assuming that the default setting for Var1 is 1. Then it will have the value 32 after the FOR loop.
NOTE: If <END_VALUE> is equal to the limit value for the data type of <INT_Var> (Counter in the
above example), you will produce an infinite, or endless, loop. If Counter is of type SINT, for
example, and the <END_VALUE> is 127 (the maximum positive value for a SINT type variable),
then the loop can never terminate because adding 1 to this maximum value would result in the
variable becoming negative and never exceeding the limits imposed by the FOR instruction.
418 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
WARNING
ENDLESS LOOP RESULTING IN UNINTENDED EQUIPMENT OPERATION
Ensure that the variable type used in FOR instructions is of a sufficient capacity (has a great
enough upper limit) to account for the <END_VALUE> + 1.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
You can use the CONTINUE instruction within a FOR loop. This is an extension to the IEC 61131-3
standard.
WHILE Loop
An alternative to the FOR loop is the WHILE loop, which executes the loop if, and for as long as, a
boolean condition is, and remains, TRUE. If the condition is not initially TRUE, the loop is not
executed. If the condition which was initially TRUE becomes FALSE, the loop is terminated.
Syntax
WHILE <boolean expression> DO
<instructions>
END_WHILE;
Evidently, the initial and ongoing boolean expression must assume a value of FALSE at some point
within the instructions of the loop. Otherwise, the loop will not terminate, resulting in an infinite, or
endless, loop condition.
WARNING
ENDLESS LOOP RESULTING IN UNINTENDED EQUIPMENT OPERATION
Ensure that the WHILE loop will be terminated within the instructions of the loop by creating a
FALSE condition of the boolean expression.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
The following is an example of instructions in the loop causing the loop to terminate:
WHILE Counter>0 DO
Var1 := Var1*2;
Counter := Counter-1;
END_WHILE
The REPEAT instruction has not yet been introduced so moving paragraph (with modification) to
below.
You can use the CONTINUE instruction within a WHILE loop.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 419
Structured Text (ST) Editor
REPEAT Loop
The REPEAT loop is another alternative to the FOR loop, as it is for the WHILE loop. The REPEAT
loop differs from the WHILE loop in that the exit condition is evaluated only after the loop has been
executed at least once, at the end of the loop.
Syntax
REPEAT
<instructions>
UNTIL <boolean expression>
END_REPEAT;
The <instructions> are carried out repeatedly as long as the <boolean expression> returns TRUE.
If <boolean expression> is produced already at the first UNTIL evaluation, then <instructions> are
executed only once. The <boolean expression> must assume a value of TRUE at some point
within the instructions of the loop. Otherwise, the loop will not terminate, resulting in an infinite, or
endless, loop condition.
WARNING
ENDLESS LOOP RESULTING IN UNINTENDED EQUIPMENT OPERATION
Ensure that the REPEAT loop will be terminated within the instructions of the loop by creating a
TRUE condition of the boolean expression.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
The following is an example of instructions in the loop causing the loop to terminate:
REPEAT
Var1 := Var1*2;
Counter := Counter-1;
UNTIL
Counter=0
END_REPEAT;
You can use the CONTINUE instruction within a REPEAT loop. This is an extension to the
IEC 61131-3 standard.
The WHILE and REPEAT loops are, in a certain sense, more powerful than the FOR loop since you
do not have to know the number of cycles before executing the loop. In some cases, you will
therefore only be able to work with these two loop types. If, however, the number of the loop cycles
is clear, then a FOR loop is preferable since, in most cases, it inherently excludes endless loops
(see hazard message in the FOR loop paragraph (see page 418)).
420 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Structured Text (ST) Editor
CONTINUE Instruction
As an extension to the IEC 61131-3 standard, the CONTINUE instruction is supported within FOR,
WHILE, and REPEAT loops. CONTINUE makes the execution proceed with the next loop cycle.
Example
FOR Counter:=1 TO 5 BY 1 DO
INT1:=INT1/2;
IF INT1=0 THEN
CONTINUE; (* to avoid division by zero *)
END_IF
Var1:=Var1/INT1; (* only executed, if INT1 is not "0" *)
END_FOR;
Erg:=Var1;
EXIT Instruction
The EXIT instruction terminates the FOR, WHILE or REPEAT loop in which it resides without regard
to any condition.
JMP Instruction
You can use the JMP instruction for an unconditional jump to a code line marked by a jump label.
Syntax
JMP <label>;
The <label> is an arbitrary, but unique identifier that is placed at the beginning of a program line.
The instruction JMP has to be followed by the indication of the jump destination that has to equal
a predefined label.
WARNING
ENDLESS LOOP RESULTING IN UNINTENDED EQUIPMENT OPERATION
Ensure that the use of the JMP instruction is conditional such that it does not result in an infinite,
or endless, loop.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
The following is an example of instructions in the create logical conditions that avoid an infinite, or
endless, loop between the jump and its destination:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 421
Structured Text (ST) Editor
aaa:=0;
_label1: aaa:=aaa+1;
(*instructions*)
IF (aaa < 10) THEN
JMP _label1;
END_IF;
As long as the variable i, being initialized with 0, has a value less than 10, the jump instruction of
the example above will affect a repeated flyback to the program line defined by label _label1.
Therefore, it will affect a repeated processing of the instructions comprised between the label and
the JMP instruction. Since these instructions also include the increment of the variable i, the jump
condition will be infringed (at the ninth check) and program flow will proceed.
You can also achieve this functionality by using a WHILE or REPEAT loop in the example.
Generally, using jump instructions reduces the readability of the code.
Comments in ST
There are 2 possibilities to write comments in a structured text object:
Start the comment with (* and close it with *). This allows you to insert comments which run
over several lines. Example: (*This is a comment.*)
Single-line comments as an extension to the IEC 61131-3 standard: // denotes the start of a
comment that ends with the end of the line. Example: // This is a comment.
You can place the comments everywhere within the declaration or implementation part of the
ST editor.
Nested comments: You can place comments within other comments.
Example
(*
a:=[Link]; (* to be checked *)
b:=b+1;
*)
In this example, the comment that begins with the first bracket is not closed by the bracket following
checked, but only by the last bracket.
422 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Object Editors
EIO0000002854 06/2019
Part V
Object Editors
Object Editors
Chapter 15
Declaration Editors
Declaration Editors
Overview
The textual declaration editor serves to create the declaration part of a POU object. It can be
supplemented by a tabular view. Any modification made in 1 of the views is immediately applied to
the other one.
Depending on the current settings in the declaration editor options, either only the textual or only
the tabular view will be available. You can switch between both via buttons (Textual / Tabular) at
the right border of the editor window.
Usually, the declaration editor is used in combination with the programming language editors. This
means, it will be placed in the upper part of the window which opens when you are going to edit or
view (monitor) an object in offline or online mode. The declaration header describes the POU type
(for example: PROGRAM, FUNCTION_BLOCK, FUNCTION). It can be extended by POU-global
pragma attributes.
The online mode of the declaration editor (see page 432) is structured like that of a Watch view.
Variable declaration is also performed in Global Variable Lists and Data Unit Types, which are
created in separate editors.
Also refer to the Variables Declaration chapter (see page 621).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 425
Declaration Editors
Overview
Textual editor view
Behavior and appearance are determined by the respective current text editor settings in the
Options and Customize dialog boxes. There you can define the default settings for highlight
coloring, line numbers, tabs, indenting, and many more options. The usual editing functions are
available such as copy and paste. Block selection is possible by pressing the ALT key while
selecting the desired text area with the mouse.
426 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Declaration Editors
Overview
Tabular editor view
The tabular view of the editor provides columns for the usual definitions for variable declaration
(see page 621): Scope, Name, Address, Data type, Initialization, Comment and (pragma)
Attributes. The particular declarations are inserted as numbered lines.
To add a new line of declaration above an existing one, first select this line and execute the
command Insert from the toolbar or the contextual menu.
To add a new declaration at the end of the table, click beyond the last existing declaration line and
also use the Insert command.
The newly inserted declaration by default first uses scope VAR and the recently entered data type.
The input field for the obligatory variable Name opens automatically. Enter a valid identifier and
close the field by pressing the Enter key or by clicking another part of the view.
Double-click a table cell to open the respective possibilities to enter a value.
Double-click the Scope to open a list from which you can choose the desired scope and scope
attribute keyword (flag).
Type in the Data type directly or click the > button to use the Input Assistant or the Array wizard.
Type in the Initialization value directly or click the ... button to open the Initialization value dialog
box (see page 429). This is useful especially in case of arrays and structured variables.
Each variable is declared in a separate line where the lines are numbered.
You can change the order of lines (line numbers) by selecting a line and move it one up or down
by the Move up or Move down command from the toolbar or the contextual menu.
You can sort the list of declarations according to each of the columns by clicking the header of the
respective column.
To delete one or several declarations, select the respective lines and press the Del key or execute
the Delete command from the contextual menu or click the button in the toolbar.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 427
Declaration Editors
Declaration of Arrays
For the declaration of array variables, use the arrow button > at the right side of the Type field and
select Array Wizard. The Array dialog box opens.
Fill at least the fields marked with a red exclamation mark icon. Define the Dimensions by entering
the lower and upper limits, and the Base Type of the variable. You can click the arrow button to
open the Input Assistant dialog box or another Array Wizard for declaring the base type.
You can define an array of variable length with [*,*,*]. Arrays of variable length can only be
used in VAR_IN_OUT declarations of function blocks, methods, and functions. To declare an array
of variable length, enter an asterisk * for each dimension. This results in
ARRAY [*..*] OF INT. After you have confirmed with OK, adapt the dimension string to [*]
(one asterisk only).
Example for a two-dimensional array of variable length:
ARRAY [*,*]
The Result area of the dialog box provides a preview of the configured array declaration.
For further information, refer to the Arrays description (see page 740).
Click OK to close the declaration dialog box. The variable declaration appears in the declaration
editor in accordance to the IEC syntax.
428 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Declaration Editors
Initialization Value
Initialization value dialog box
The Expressions of the variable are displayed with the present initialization values. Select the
desired variables and edit the initialization value in the field below the listing. Then click the Apply
value to selected lines button. To restore the default initializations, click the Reset selected lines
to default values button.
Press Ctrl + Enter to insert line breaks in the Comment entry.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 429
Declaration Editors
The Edit Declaration Header dialog box provides the following elements:
Element Description
Declaration Insert type (from the selection list) and name of the POU
object.
Comment Insert a comment. Press Ctrl + Enter to insert line breaks.
Attributes Opens the Attributes dialog box (see further below in this
chapter) for inserting pragmas and attributes.
430 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Declaration Editors
Attributes
In the Edit Declaration Header dialog box, click the Attributes... button to open the Attibutes dialog
box. It allows you to enter multiple attributes and pragmas in text format. Insert them without
enclosing {} braces, use a separate line per each. For the example shown in the following image,
see the corresponding textual view above in the graphic of the textual editor view (see page 426).
Attributes dialog box
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 431
Declaration Editors
Overview
The online view of the declaration editor presents a table similar to that used in watch views
(see page 482). The header line shows the actual object path <device name>.<application
name>.<object name>. The table for each watch expression shows the type and present value as
well as - if currently set - a prepared value for forcing or writing. If available, a directly assigned IEC
Address and / or Comment are displayed in further columns.
To establish a prepared value for a variable, either use the Prepare Value dialog box or click in the
assigned field of the column Prepared value and directly type in the desired value. In case of
enumerations, a list showing the enumeration values opens to select a value. In case of a boolean
variable, the handling is even easier.
You can toggle boolean preparation values by use of the Return or Space key according to the
following order:
If the value is TRUE, the preparation steps are FALSE -> TRUE -> nothing.
If the value is FALSE, the preparation steps are TRUE -> FALSE -> nothing.
If a watch expression (variable) is a structured type, for example, an instance of a function block
or an array variable, then a plus or minus sign precedes the expression. With a mouse-click on this
sign the particular elements of the instanced object can be additionally displayed (see fbinst in
the following image) or hidden (see aVar). Icons indicate whether the variable is an input ,
output or an ordinary variable .
If the expression is an array, you can define the range of the array indices to monitor. To achieve
this, double-click the Type column to open the Monitoring Range dialog box. Enter the Start Index
and the End Index to define the range.
When you point with the cursor on a variable in the implementation part, a tooltip shows the
declaration and comment of the variable. See the following image showing the declaration editor
in the upper part of a program object PLC_PRG in online view:
Online view of the declaration editor
432 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Device Type Manager (DTM) Editor
EIO0000002854 06/2019
Chapter 16
Device Type Manager (DTM) Editor
DTM Editor
Overview
The DTM editor view depends on the device type manager.
For further information on DTMs, refer to the Device Type Manager (DTM) User Guide
(see EcoStruxure Machine Expert, Device Type Manager (DTM), User Guide).
For a list of the DTM versions currently supported by EcoStruxure Machine Expert, refer to the
Release Notes of your EcoStruxure Machine Expert installation.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 433
Device Type Manager (DTM) Editor
434 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Data Unit Type (DUT) Editor
EIO0000002854 06/2019
Chapter 17
Data Unit Type (DUT) Editor
Overview
You can create user-defined data types (see page 722) in the Data Unit Type editor (DUT editor).
This is a text editor and behaves according to the currently set text editor options.
The DUT editor will be opened automatically in a window when you add a DUT object in the Add
object dialog box. In this case, it provides by default the syntax of an extended structure
declaration. You can use it as desired to enter a simple structure declaration or to enter the
declaration of another data type unit, for example an enumeration.
The editor also opens when you open an existing DUT object currently selected in the POUs view.
DUT editor window
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 435
Data Unit Type (DUT) Editor
436 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Global Variables List (GVL) Editor
EIO0000002854 06/2019
Chapter 18
Global Variables List (GVL) Editor
GVL Editor
Overview
The GVL editor is a Declaration Editor for editing Global Variables Lists. The GVL editor works as
does the Declaration Editor and corresponds to the options, both offine and online, set for the text
editor. The declaration starts with VAR_GLOBAL and ends with END_VAR. These keywords are
provided automatically. Enter valid declarations of global variables between them.
GVL editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 437
Global Variables List (GVL) Editor
438 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Network Variables List (NVL) Editor
EIO0000002854 06/2019
Chapter 19
Network Variables List (NVL) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 439
Network Variables List (NVL) Editor
Section 19.1
Information on the NVL Editor
Overview
The NVL editor is a Declaration Editor for editing Network Variables Lists. The NVL editor works
as does the Declaration Editor and corresponds to the options, both offine and online, set for the
text editor. The declaration starts with VAR_GLOBAL and ends with END_VAR.These keywords are
provided automatically. Enter valid variable declarations (see page 619) of global variables
between them.
NVL editor
440 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
Section 19.2
General Information on Network Variables
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 441
Network Variables List (NVL) Editor
Overview
The Network Variables List (NVL) feature consists of a fixed list of variables that can be sent or
received through a communication network. This enables data exchange within a network via
network variables, if supported by the controller (target system).
The list must be defined in the sender and in the receiver controllers (and can be handled in a
single or in multiple projects). Their values are transmitted via broadcasting through User
Datagram Protocol (UDP) datagrams. UDP is a connectionless Internet communications protocol
defined by IETF RFC 768. This protocol facilitates the direct transmission of datagrams on Internet
Protocol (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).
The NVL functionality is a powerful feature of EcoStruxure Machine Expert. It allows you to share
and monitor data between controllers and their applications. However, there are no restrictions as
to the purpose of the data exchanged between controllers, including, but not limited to, attempting
machine or process interlocking or even controller state changes.
NOTE: The type of the network variable is not shared between different controllers. You have to
ensure that the used types have the same definition on all devices; otherwise NVL communication
is not possible. This applies, for example, to the types SEC.ETH_R_STRUCT or
SEC.PLC_R_STRUCT. They are available by default in various controllers with different size or
fields.
Only you, the application designer and/or programmer, can be aware of all the conditions and
factors present during operation of the machine or process and, therefore, only you can determine
the proper communication strategies, interlocks and related safeties necessary for your purposes
in exchanging data between controllers using this feature. Strict care must be taken to monitor this
type of communication feature, and to be sure that the design of the machine or process will not
present safety risks to people or property.
442 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
WARNING
LOSS OF CONTROL
The designer of any control scheme must consider the potential failure modes of control paths
and, for certain critical control functions, provide a means to achieve a safe state during and
after a path failure. Examples of critical control functions are emergency stop and overtravel
stop, power outage and restart.
Separate or redundant control paths must be provided for critical control functions.
System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
Observe all accident prevention regulations and local safety guidelines.1
Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
1For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control" and to NEMA ICS 7.1 (latest
edition), "Safety Standards for Construction and Guide for Selection, Installation and Operation of
Adjustable-Speed Drive Systems" or their equivalent governing your particular location.
You can use Diagnostic (see EcoStruxure Machine Expert, Network Variable Configuration,
SE_NetVarUdp Library Guide) and Error Management (see EcoStruxure Machine Expert, Network
Variable Configuration, SE_NetVarUdp Library Guide) function blocks as well as network
properties parameters to monitor the health, status and integrity of communications using this
feature. This feature was designed for data sharing and monitoring and cannot be used for critical
control functions.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 443
Network Variables List (NVL) Editor
The corresponding NVL (sender) and NVL (receiver) contain the same variable declarations. You
can view their contents in the respective editor that opens after double-clicking the NVL (sender)
or NVL (receiver) node in the Devices tree.
An NVL (sender) contains the network variables of a sender. In the Network properties of the
sender, protocol and transmission parameters are defined. According to these settings, the
variable values are broadcasted within the network. They can be received by the controllers that
have a corresponding NVL (receiver).
NOTE: For network variables exchange, the respective network libraries must be installed. This is
done automatically for the network type UDP as soon as the network properties for an NVL
(sender) are set.
Network variables are broadcasted from the NVL (sender) to one or more NVL (receiver). For each
controller, you can define NVL (sender) as well as NVL (receiver). Thus each controller can act as
sender as well as receiver.
An NVL (sender) can be provided by the same or by another project. So, when creating an NVL
(receiver), the NVL (sender) can either be chosen from a selection list of all available NVL (sender)
within the network, or it can be read from an export file, which previously has been generated (for
example, by using the Link to File dialog box) from the NVL (sender).
NOTE: An export file is needed if the NVL (sender) to be used is defined within another project.
NVL Considerations
The following table shows the list of controllers that support the network variables list (NVL)
functionality:
444 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
The figure shows a network consisting of one sender and the maximum of seven receivers:
Controller Sender A: Sender with the NVL (sender) and receiver controller with network variables lists (NVL
(receiver))
Controller Receiver 1...7: Receivers (with NVL (receiver)) from A and sender controller (NVL (sender)) only
for A
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 445
Network Variables List (NVL) Editor
Overview
To exchange network variables between a sender and a receiver, one sender and one receiver
controller must be available in the EcoStruxure Machine Expert Devices tree. These are the
controllers that are assigned the network properties described below.
Proceed as follows to configure the network variables list:
Step Action
1 Create a sender and a receiver controller in the Devices tree.
2 Create a program (POU) for the sender and receiver controller.
3 Add a task for the sender and receiver controller.
NOTE: In order to maintain performance transparency, you should set the task priority of the
dedicated NVL task to something greater than 25, and regulate communications to avoid
saturating the network unnecessarily.
4 Define the NVL (sender) for the sender.
5 Define the NVL (receiver) for the receiver.
An example with further information is provided in the Appendix (see EcoStruxure Machine Expert,
Network Variable Configuration, SE_NetVarUdp Library Guide).
446 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
Description of parameters
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 447
Network Variables List (NVL) Editor
448 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 449
Network Variables List (NVL) Editor
Description of parameters
450 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 451
Network Variables List (NVL) Editor
Number Rule
1 Data transmission from one NVL (sender) to one NVL (receiver) should not exceed 200 bytes.
2 Data exchange between several NVL (sender) of one controller and their associated NVL (receiver)
should not exceed 1000 bytes of variables.
If the number of received / transmitted datagrams per cycle exceeds the limit several times, the
following may happen:
Loss of UDP (user datagram protocol) datagrams
Incoherent or inconsistent exchange of variables
452 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
NOTICE
LOSS OF DATA
Thoroughly test your application for proper transmission and reception of UDP datagrams prior
to placing your system into service.
Failure to follow these instructions can result in equipment damage.
NOTICE
LOSS OF COMMUNICATION
Ensure that the list identifier in the network is only used by one IP address.
Failure to follow these instructions can result in equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 453
Network Variables List (NVL) Editor
454 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
Operating State
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 455
Network Variables List (NVL) Editor
Example
Overview
In the following example, a simple network variables exchange is established. In the sender
controller, an NVL (sender) is created. In the receiver controller, the corresponding NVL (receiver)
is created.
Perform the following preparations in a standard project, where a sender controller Dev_Sender
and a receiver controller Dev_Receiver are available in the Devices tree:
Create a POU (program) prog_sender below the Application node of Dev_Sender.
Under the Task Configuration node of this application, add the task Task_S that calls
prog_sender.
Create a POU (program) prog_rec below the Application node of Dev_Receiver.
Under the Task Configuration node of this application, add the task Task_R that calls prog_rec.
NOTE: The two controllers must be configured in the same subnet of the Ethernet network.
456 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 457
Network Variables List (NVL) Editor
3 Click OK. The dialog box is closed and the NVL (sender)
network properties are set.
458 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 459
Network Variables List (NVL) Editor
Step 2: View and / or modify the network settings of the NVL (receiver):
3 Under the Application node of the controller The editor for prog_rec is opened on the right-hand
Dev_Receiver, double-click the POU prog_rec. side.
4 Enter the following code for the variable –
ivar_local:
5 Log on with sender and receiver applications within The variable ivar_local in the receiver gets the
the same network and start the applications. values of iglobvar as currently shown in the
sender.
460 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
Compatibility
Introduction
Even if the controllers work with applications of different versions of the programming system (for
example, V2.3 and V3.x), communication via network variables is possible.
However, the file formats of the different export files between versions (*.exp versus *.gvl) makes
it impossible to simply import and export these files between projects.
If an NVL (receiver) is set up in the latest version (for example, V3.x), the required network
parameters configuration must be provided by a sender of the latest version (for example, V3.x).
An export file *.exp created from a sender by an earlier version (for example, V2.3) does not
contain this information.
A solution for exchanging network variables between applications of different programming system
versions is provided in the following paragraphs.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 461
Network Variables List (NVL) Editor
Example
In this example, the variable trans23, that is defined in a V2.3 application, is made available for
a later version (V3.x).
The following conditions are defined:
Condition Description
1 In the earlier programming system version (V2.3) the project [Link] contains a global variables list
GVL_23 with the following declaration:
VAR_GLOBAL
trans23:INT;
END_VAR
2 The network properties of GVL_23 are configured as follows:
NOTE: The export of this GVL_23 creates a *.exp file, that only contains the following variable
declaration:
VAR_GLOBAL
trans23:INT;
END_VAR
The *.exp file does not contain any configuration settings.
462 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Variables List (NVL) Editor
The following table shows the next steps to be executed for re-creating GVL_23 in the latest
version (V3.x):
4 In the Build tab, set the Exclude from This setting allows you to keep the file on disk for later
Build option. modifications.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 463
Network Variables List (NVL) Editor
6 Add an NVL (receiver) object in the This serves to read the variable trans23 from the controller of
V3.x project from the [Link] export file the earlier programming system (V.2.3).
(with the Import from file: command). If both, the project from the earlier version (V2.3) as well as the
application from the latest version (V3.x), are running within the
network, the application from the latest version (V3.x) can read
variable trans23 from project [Link].
464 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Task Editor
EIO0000002854 06/2019
Chapter 20
Task Editor
Task Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 465
Task Editor
Overview
The task configuration defines one or several tasks for controlling the processing of an application
program. Thus, task configuration is an essential object for an application and must be available in
the Applications Tree.
At the topmost position of a task configuration tree, there is the entry Task Configuration .
Below there are the defined tasks, each represented by the task name. The POU calls of the
particular tasks are displayed in the task configuration tree.
You can edit the task tree (add, copy, paste, or remove tasks) by the appropriate commands
usable for the Applications tree. For example, for adding a new task, select the Task Configuration
node, click the green plus button, and execute the command Task.... Alternatively, you can right-
click the Task Configuration node, and execute the command Add Object → Task....
Configure the particular tasks in the task editor (see page 474) which additionally provides a
monitoring view in online mode. The options available for task configuration depend on the
controller platform.
Task configuration in Applications tree
Tasks
A task (see page 474) is used to control the processing of an IEC program. It is defined by a name,
a priority and by a type determining which condition will trigger the start of the task. You can define
this condition by a time (cyclic, freewheeling) or by an internal or external event which will trigger
the task; for example, the rising edge of a global project variable or an interrupt event of the
controller.
For each task, you can specify a series of program POUs that will be started by the task. If the task
is executed in the present cycle, these programs will be processed for the length of 1 cycle.
The combination of priority and condition will determine in which chronological order
(see page 478) the tasks will be executed.
For each task, you can configure a time control (watchdog). The possible settings depend on the
specific controller platform.
466 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Task Editor
Properties Tab
Overview
When the Task Configuration (see page 466) node is selected, the Properties tab will be opened
in the Task Configuration editor.
Task configuration, Properties tab, example
Information on the current task configuration as provided by the controller will be displayed, for
example, the maximum allowed numbers of tasks per task type.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 467
Task Editor
Overview
Use the System Events tab of the Task Configuration editor to call a project function by a system
event (not by a task). You can define the functions that are called per event, and you can activate
or deactivate each system event individually.
This function is not available for all supported controllers. Consult the Programming Guide specific
to your controller for further information.
Button Description
Add Event Handler... Opens the Add Event Handler dialog box that allows
you to define an assignment between an event and
the function it calls.
Remove Event Handler Deletes the selected list assignment.
Event Info Displays information of the corresponding event
library.
Open Event Function Opens the editor of the new function for the selected
assignment.
The implementation language of the new function is
selected in the Add Event Handler dialog box.
Element Description
Event Displays a list of system events for selection.
The available events depend on the target controller.
Unavailable events are marked with a red symbol.
Function to call Enter a name for the function.
A new POU, type Function is created with this name
and added to the Applications tree when you confirm
the Add Event Handler dialog box with OK.
Scope Select the option Application to make the new
function available for the application.
Select the option POUs to make the new function
available for the entire project.
Implementation language Select the programming language for the new
function.
Description Provides a short description of the selected event.
468 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Task Editor
Column Description
Name Indicates the name of the Event you defined in the
Add Event Handler dialog box.
Description Indicates a short description of the selected event.
Function to call Indicates the name of the function you defined with
the parameter Function to call in the Add Event
Handler dialog box.
Active The option is by default selected and the function is
activated.
To deactivate the function, deselect the option
Active.
The list of the System Events tab displays additional information in online mode. Consult the
Programming Guide specific to your controller for controller-specific information on the supported
system events.
Column Description
Event Status 0 indicates that no error has been detected.
If the value is not 0, then an error has been detected.
Number of Calls Indicates the number of times the event has occurred
and the associated function has been called.
Button Description
Online Reset Click the Online Reset button to reinitialize the event
lists, and to reset the counter for the events / function
calls. Events that are not correctly initialized are
displayed with a red Event Status cell.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 469
Task Editor
System Events
The table lists the system events that can be displayed:
470 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Task Editor
Monitor Tab
Overview
If it is supported by the target system, the monitoring functionality is allowed. This is a dynamic
analysis of the execution time and the number of the calls which are controlled by a task. In online
mode, the task processing can be monitored.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 471
Task Editor
IEC-Cycle Count Number of run cycles since having started the application;
0 if the function is not supported by the target system.
Cycle Count Number of already run cycles (depending on the target
system, this can be equal to the IEC Cycle Count, or bigger
if cycles are even counted when the application is not
running.)
Last Cycle Time (µs) Last measured runtime in µs
Average Cycle Time (µs) Average runtime of all cycles in µs
Max. Cycle Time (µs) Maximum measured runtime of all cycles in µs
Min. Cycle Time (µs) Minimum measured runtime of all cycles in µs
Jitter (µs) Last measured jitter* in µs
Min. Jitter (µs) Minimum measured jitter* in µs
Max. Jitter (µs) Maximum measured jitter* in µs
* jitter: Time that passes after the task has been started until the operating system indicates
that it is running.
To reset the values to 0 for a task, place the cursor on the task name field and execute the Reset
command available in the context menu.
472 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Task Editor
Overview
The Variable Usage tab of the Task Configuration provides an overview of the variables and their
usage in the tasks.
Column Description
Variables Indicates the name of the variable.
Type Indicates the data type of the variable.
Count Indicates the number of tasks that access the
variable.
<task name> Indicates the access to the variable:
r = read
w = write
rw = read/write
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 473
Task Editor
Overview
When you insert a task in the Task Configuration node of the Applications tree, the task editor view
for setting the task configuration opens with the Configuration tab.
It also opens if you double-click an available task (for example, MAST) in order to modify the
configuration of the task.
NOTE: You can modify the task name by editing the respective entry in the Applications tree.
Insert the desired attributes.
Priority
Priority (0...31) A number from 0...31; 0 is the highest priority, 31 is the lowest
The default value for new tasks is defined by your controller.
NOTE: Consider the controller-specific task settings to find appropriate
settings for your application tasks. This may be important when assigning
priority to tasks dedicated to communications, and its relation to topics such as
cyber security. You can increase system robustness by setting application
tasks to a higher priority than communication tasks.
Type
The target device defines which task types are supported. Not all types are available for some target devices.
Consult the Programming Guide specific to your controller for more information.
Cyclic The task will be processed cyclic according to the time definition (task cycle
time) given in the field Interval (see below).
Event The task will be started as soon as the variable defined in the Event field gets
a rising edge.
Freewheeling The task will be processed as soon as the program is started and at the end of
one run it will automatically be restarted in a continuous loop. There is no cycle
time defined.
External The task will be started as soon as the system event, which is defined in the
External Event field, occurs. It depends on the target, which events will be
supported and offered in the selection list. (Not to be mixed up with system
events.)
Status The task will be started if the variable defined in the Event field is TRUE.
474 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Task Editor
Entry Description
Interval (for Obligatory for task type Cyclic.
example, The time (in milliseconds [ms]]) after which the task should be restarted.
t#200ms) When you set the task cycle time, consider the bus system used by the application. For example, on
a CAN bus system, you can set the Bus cycle task in the CANopen I/O Mapping tab. The task cycle
time must match the transmission rate and the number of frames used on the bus. Additionally, the
times set for heartbeat, nodeguarding and sync always should be a multiple of the task cycle time.
Otherwise, CAN frames may go unrecognized. For further information, refer to the Device Editor part
of the EcoStruxure Machine Expert online help.
Event Obligatory for type Event or triggered by an External event.
A global boolean variable which will trigger the start of the task as soon as a rising edge is detected.
Use button ... or the Input Assistant to get a list of all available global event variables.
NOTE: If the event that is driving a task stems from an entry, there must be at least one task which
is not driven by events. Otherwise, the I/Os will never get updated and the task will never get started.
NOTE: Only internal IEC variables are permitted. Referencing a property (including system
parameter) in an event task will lead to a watchdog exception error (see page 476) being detected
during download.
Behavior at Point: 1 2 3 4
Status No start Start Start Start
Event No start Start No start because No start
the event
changed too fast
from TRUE to
FALSE and back
to TRUE
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 475
Task Editor
Watchdog Settings
For each task, you can configure a time control (watchdog).
The default watchdog settings depend on your controller.
When the Enable option is activated (check mark is set), the watchdog is enabled. When the task
watchdog is enabled, an Exception error is detected if the execution time of the task exceeds the
defined task time limit (Time). The application that contains the task in which the error occurred
and the corresponding child applications are stopped. This has the effect that the tasks of these
applications are also stopped. The defined Sensitivity is taken into account. If option Update IO
while in stop is enabled in the controller settings dialog box, the outputs are set to the pre-defined
default values depending upon the particular controller platform. This function is not available for
all supported controllers. Consult the Programming Guide specific to your controller.
The following cases may occur:
Several consecutive timeouts:
Sensitivity: 0, 1 - exception in cycle 1
Sensitivity: 2 - exception in cycle 2
Sensitivity: n - exception in cycle n
NOTE: The upper bound of Sensitivity (n) is controller dependent. For more information
concerning Sensitivity, Task time and other relevant parameters, consult the Programming
Guide for your controller, chapter System and Task Watchdog.
Single timeout: Exception if the cycle time of the present cycle is longer than
(task time limit * sensitivity).
Example:
Time=t#10 ms, Sensitivity=5 (An exception is indicated as soon as the task is running longer
than 50 ms.)
Time (e.g. t#200ms) Defines the allowable maximum execution time for a task. When a task
takes longer than this, the controller will report a task watchdog exception.
Sensitivity Defines the number of task watchdog exceptions that must occur before the
controller detects an application error.
476 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Task Editor
POUs
The POUs which are controlled by the task are listed here in a table with the POU name and an
optional Comment. Above the table there are commands for editing:
In order to define a new POU, open the Input Assistant dialog box via the command Add Call.
Choose 1 of the programs available in the project. You can also add POUs of type program to
the list by drag and drop from the Applications tree.
In order to replace a program call by another 1, select the entry in the table, open the Input
Assistant via command Change Call.. and choose another program.
In order to delete a call, select it in the table and use the command Remove Call.
The command Open POU opens the selected program in the corresponding editor.
The sequence of the listed POU calls from top to bottom determines the sequence of execution in
online mode. You can shift the selected entry within the list via the commands Move up and Move
down.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 477
Task Editor
478 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Watch List Editor
EIO0000002854 06/2019
Chapter 21
Watch List Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 479
Watch List Editor
Overview
A watch list is a user-defined set of project variables. They are displayed in the watch view for
monitoring (see page 482) the values in a table. Also, writing and forcing of the variables is
possible within the watch view.
Open a watch view via the Watch command submenu (by default in the View menu). It provides
an editor for creating watch lists (see page 481).
By default, you can set up 4 individual watch lists in the watch views Watch 1, Watch 2, Watch 3,
Watch 4. View Watch all Forces in online mode gets filled (see page 483) automatically with all
currently forced values of the active application.
480 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Watch List Editor
Procedure
Create a watch list by executing the following actions:
Online Mode
In online mode, the current variable value is shown in the column Value. Like at other monitoring
positions, you can define Prepared Values and force or write them. For further information, refer to
the chapters Force Values, Prepare Value Dialog Box (see EcoStruxure Machine Expert, Menu
Commands, Online Help) and Monitoring (see page 271).
In online mode, you can add a currently focused expression to the watch list by executing the
command Add Watch.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 481
Watch List Editor
Monitoring
A watch list (see page 480) (Watch<n>) in online mode shows the current value of a variable in the
Value column. This is the value the variable has between 2 task cycles.
Also a possibly assigned direct IEC address and/or comment are displayed. The components of
the view correspond to those of the online view of the declaration editor (see page 432).
See chapter Creating a Watch List (see page 481) for a description on how to set up such a watch
list and how to handle folds in case of structured variables.
Watch view in online mode
NOTE: In online mode you can add expressions to the watch list by use of the command Add
Watch.
482 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Watch List Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 483
Watch List Editor
484 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Tools Within Logic Editors
EIO0000002854 06/2019
Chapter 22
Tools Within Logic Editors
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 485
Tools Within Logic Editors
Overview
EcoStruxure Machine Expert provides the FFB (function and function block) finder that assists you
in finding a specific function or function block even if you do not know its exact name.
You can use the function and function block finder in the following programming languages that
allow to insert function blocks:
CFC
LD
IL
FBD
ST
486 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Tools Within Logic Editors
The FFB Finder dialog box contains the following elements for finding a function or function block:
Element Description
Find what In the Find what textbox, enter the name of the function or function block you want
to insert into your programming code.
As wildcards you can use a question mark (?), which replaces exactly one character,
or an asterisk (*), which can replace several characters or no character at all.
Company If you know the company that created the library which includes the function block
you are searching for, you can select the companies from the Company list.
This parameter is by default set to All companies.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 487
Tools Within Logic Editors
Element Description
Match case Check the Match case check box to perform a case-sensitive search.
By default, this check box is not selected.
Include comments in search Check the Include comments in search check box to search for the entered string
not only in the names of functions and function blocks but also in the comments that
are saved with them.
By default, this check box is not selected.
Search in project Libraries only Check the Search in project libraries only check box to limit the search to those
libraries that are used in the current application.
By default, this check box is not selected and the find operation includes all libraries
that are installed on the EcoStruxure Machine Expert PC.
Find Click the Find button or press the ENTER key to start searching for the function or
function block.
The selected function / function block will be inserted at the place where your cursor is positioned
in your programming code and the respective library will be loaded automatically.
Repeat this operation whenever you need assistance in finding a specific function / function block.
488 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Tools Within Logic Editors
Input Assistant
Overview
The Input Assistant dialog box and the corresponding command Input Assistant (by default in the
Edit → Smart Coding menu) are only available if the cursor is placed in a text editor window. The
dialog box offers the available project items for being inserted at the current cursor position.
Default shortcut: F2
Input Assistant dialog box
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 489
Tools Within Logic Editors
Element Description
Categories In this area, the project items are sorted by Categories.
Filter You can set a Filter for the category Variables. To display a certain type of variable,
select an entry from the list, such as Local variables, Global variables, Constants.
Items area
Name, Type, Address, Origin The Items area shows the available items and - depending on the category - also their
data Type, Address, and Origin for the category selected in the Categories area.
The Origin is shown for I/O variables (path within the Devices Tree) and library-
defined variables (library name and category).
You can sort the items by Name, Type, Address, Origin in ascending or descending
alphabetic order. To achieve this, click in the respective column header (arrow-up or
arrow-down symbol).
To hide or display the columns Type, Address or Origin, right-click the headline of the
respective column.
Structured view If the option Structured view is selected, the project items are displayed in a structure
tree supplemented with icons.
If the option is not selected, the project items are arranged flat. Each project item is
displayed with the POU it belongs to (example: GVL1.gvar1).
NOTE: If there are objects with the same name available in the Global node of the Applications
Tree as well as below an application (Applications Tree), only 1 entry is offered in the Input
Assistant because the usage of the object is determined by the usual call priorities (first the
application-assigned object, then the global one).
Element Description
Show documentation If the option Show documentation is selected, the Input Assistant dialog box is
extended by the Documentation field.
If the selected element is a variable and an address is assigned to this variable or a
comment has been added at its declaration, these are displayed here.
Insert with arguments If this option is selected, items which include arguments, for example functions, are
inserted with those arguments.
Example:
If function block FB1, which contains an input variable fb1_in and an output variable
fb1_out, is inserted with arguments, the following will be written to the editor:
fb1(fb1_in:= , fb1_out=> )
Insert with namespace prefix If this option is selected, the item is inserted with the prefixed namespace.
This option has to be selected when inserting objects into libraries which have defined
in their Properties that the use of the namespace prefix is obligatory (option Only allow
qualified access to all identifiers (see EcoStruxure Machine Expert, Functions and
Libraries User Guide) is selected).
490 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Tools
EIO0000002854 06/2019
Part VI
Tools
Tools
Chapter 23
Data Logging
Data Logging
Overview
You can monitor and analyze application data by examining the data log file (.log).
The figure shows an application that includes the 2 function blocks, LogRecord and Dump. The
LogRecord function block writes data to the buffer, which empties into the data log file (.log)
located into the controller memory. The buffer dumping is automatic when 80% full or it can be
forced by the Dump function. As a standard FTP client, a PC can access this data log file when the
controller acts as an FTP server. It is also possible to upload the file with EcoStruxure Machine
Expert or by the controller web server.
NOTE: Only controllers with file management functionality can support data logging. Refer to your
controller programming manual to see if it supports file management.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 493
Data Logging
Implementation Procedure
First declare and configure the data log files in your application before starting to write your
program.
494 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Recipe Manager
EIO0000002854 06/2019
Chapter 24
Recipe Manager
Recipe Manager
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 495
Recipe Manager
Recipe Manager
Overview
The Recipe Manager provides the functionality for handling user-defined lists of project variables,
named recipe definitions, and definite value sets for these variables within a recipe definition,
named recipes.
You can use recipes to modify or read recipe values for a specific set of variables (recipe definition)
on the controller. They can also be loaded from and saved to files. These interactions are possible
by using visualization elements which you have to configure appropriately (input configuration
execute command). You can also use certain recipe commands in the application (see page 505).
When you have selected a recipe, validate that the recipe is appropriate for the process that will
be controlled.
WARNING
UNINTENDED EQUIPMENT OPERATION
Conduct a safety analysis for the application and equipment installed.
Verify that recipe is appropriate for the process and equipment or function in the installation.
Supply appropriate parameters, particularly for limits and other safety-related elements.
Verify that all sensors and actuators are compatible with the recipe selected.
Thoroughly test all functions during verification and commissioning.
Provide independent paths for critical control functions (emergency stop, over-limit conditions
etc.) according to the safety analysis and applicable codes and regulations.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
By default, the recipe manager is loaded to the controller during download. It handles the writing
and reading of recipes when the application is running on the controller. However, it is not
necessary to load the recipe manager to the controller to use recipes only for exchanging
parameters during startup of the system (that is when EcoStruxure Machine Expert is still
connected to the controller). You can deactivate its download for this purpose using the option
Recipe Management in the PLC. The writing and reading of recipe values will then be handled by
the standard online commands and services. If the recipe management has to run on the controller,
because it is needed by the application program during run time, then the RecipeCommands
function block is responsible for handling the recipe commands.
For a description of the behavior of recipes in the various online modes, refer to the chapter Recipe
Definition (see page 500).
If the recipe manager is located on another controller other than the application being affected by
the recipes, the data server will be used to read/write the variables contained in the recipes.
Reading and writing of the variables is done synchronously. By calling g_RecipeM-
[Link] after reading/writing, you may verify if the transmission has been carried out
successfully (g_RecipeManager.LastError=0 in this case).
496 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 497
Recipe Manager
Parameter Description
Storage Type Select Textual or Binary storage type.
File Path Specify the location where the recipe is to be saved in the controller or in the
local file system. In the controller, the path must end with a backslash (\),
such as MyRecipes\.
File Extension Specify the file extension of the recipe file.
NOTE: A storage file can also be defined by the input on a visualization element (input
configuration - execute command - save/load a recipe from a file). However, when defining the
name of such a file in the visualization configuration, do not overwrite the * .txtrecipe file defined
here in the recipe manager.
Parameter Description
Separator In case of textual storage, the columns selected for storage will be separated
by a separator. Select 1 of the 6 options proposed.
Available Columns All columns of the recipe definition, represented by the respective header.
Selected Columns Selected columns of the recipe definition, that is, the columns to be stored.
At least the column containing the Current Value is included in this part. It
cannot be deselected.
arrow buttons The other columns can be shifted to the right or to the left by selecting the
respective entry and clicking the arrow buttons. You can also shift all entries
from one side to the other at once by using the double arrow buttons.
Up and Down buttons Click these buttons to adjust the order of the selected columns, which
represents the order of the columns in the storage file.
For each recipe, a file <recipe name>.<recipe definition>.<file extension> will
be created in the specified folder. This file will be reloaded to the recipe
manager at each restart of the application. For the update configuration of the
recipe storage files, refer to the description of the General tab (see page 499).
Save as default Click the Save as default button to use the settings made within this dialog
box as default settings for each further recipe manager inserted.
NOTE: Floating point values (type REAL/LREAL) are stored in the textual recipe files in decimal
format as well as in hexadecimal format. (Because the hexadecimal value represents the exact
value whereas the decimal REAL value represents the value to the seventh decimal place.)
Example: PLC_PRG.realVar:=22.0F16#1600000H-5
For manually modifying a value in the recipe file, edit the decimal value and remove the
subsequent hexadecimal entry. (If both values are available, the hexadecimal value is loaded.)
498 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
Parameter Description
Recipe Management in the If the recipe manager is not needed on the controller, because no recipes are
PLC to be handled during run time of the application, you can deactivate this option
so that the manager is not downloaded.
An automatic update of the recipe file is only possible after the download has
been performed. To download the recipe management to the controller, select
this option.
Save recipe
Save changes to recipe files This option is available only if the option Recipe Management in the PLC is
automatically selected.
Select the Save changes to recipe files automatically option to update recipe
files automatically in runtime mode whenever a recipe is changed.
Load recipe
Load only by exact match of Select the option Load only by exact match of the variable list to load recipe
the variable list files only if the file contains all variables available in the variable list of the
recipe definition of the application. The variables in the file must be in the
same order as in the variable list. Additional entries at the end are ignored.
Otherwise, the recipe cannot be loaded and the return value (see page 508)
ERR_RECIPE_MISMATCH is set ([Link]).
Load matching variables by Select the option Load matching variables by variable name to load only
variable name variables with matching variable names from the recipe file. No error status is
set when the variable list in the file is different from the list in the recipe
definition of the application. Thus, recipe files can also be loaded if variables
in the file or in the recipe definition have been deleted.
Write recipe
Limit the variable to min/max Select the option Limit the variable to min/max when recipe value is out of the
when recipe value is out of range to write the defined minimum or maximum value to the controller if the
the range recipe contains a value that is beyond the value range.
Do not write to a variable Select the option Do not write to a variable when the recipe value is out of the
when the recipe value is out min/max range to prevent a value from being written to the controller if the
of the min/max range recipe contains a value that is beyond the value range. The value that is
present in the controller will be retained.
Write Recipe
Click the Write Recipe button to write the selected values of a recipe to the variables in the
controller when the application is in online mode.
NOTE: The present values in the controller will be overwritten by the recipe values.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 499
Recipe Manager
Recipe Definition
Overview
The recipe manager (see page 496) handles 1 or several recipe definitions. A recipe definition
contains a list of variables and 1 or several recipes (value sets) for these variables. You can save
a recipe to a file or write recipe files to the controller. By using different recipes, you can assign
another set of values to a set of variables on the controller in one stroke. There is no limitation of
the number of recipe definitions, recipes, and variables per recipe.
Recipe Definition
You can add 1 or several Recipe Definition objects to a Recipe Manager node in the Tools tree.
To achieve this, click the green plus button of the Recipe Manager node and execute the command
Recipe Definition....
Double-click the node to view and edit recipe definitions including the particular recipes in a
separate editor view.
Recipe definition editor view
The editor window is titled with the name of the recipe definition.
500 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
Parameter Description
Variable In the table, you can enter several project variables for which you want to
define 1 or several recipes. For this purpose, you can use the command Insert
Variable when the cursor is in any field of any line. Alternatively, you can
double-click a Variable field, or you can select it and press the spacebar to get
into editor mode. Enter the valid name of a project variable, for example
plc_prg.ivar. You can click the ... button to open the Input Assistant.
You can also specify a POU, for example, a program like PLC_PRG shown in
the figure above. In this case, all variables defined within the POU are added
to the recipe definition automatically when you close the input field. The same
applies to data types or function blocks.
You can toggle between the normal and the structured view using the buttons
on the right side.
After you have modified the declaration of structured data types or POUs, the
recipe definition can be reduced or extended by the concerned variables
automatically. For further information, refer to the Update structured variables
command (see EcoStruxure Machine Expert, Menu Commands, Online
Help).
Type The Type field is filled automatically. Optionally, you can define a symbolic
Name.
Name You can define a symbolic Name.
Comment Enter additional information, such as the unit of the value recorded in the
variable.
Minimal Value and Maximal You can optionally specify these values which should be permissible for being
Value written on this variable.
Current Value This value is monitored in online mode.
Save changes to recipe files It is a good practice to activate this option in the General tab of the Recipe
automatically manager editor because it affects the usual behavior of a recipe
management: the storage files are updated immediately at any modification
of a recipe during run time. Consider that the option can only be effective as
long as the recipe manager is available on the controller.
You can remove a variable (line) from the table by pressing the DEL key when one of its cells is
selected. You can select multiple lines by keeping the CTRL key pressed while selecting cells. You
can copy the selected lines by copy and paste. The paste command inserts the copied lines above
the selected line. In doing so, recipe values are inserted in the matching recipe column, if available.
To add a recipe to the recipe definition, execute the Add a new recipe command (see EcoStruxure
Machine Expert, Menu Commands, Online Help) when the focus is in the editor view. For each
recipe, an own column is created, titled with the recipe name (example: R1 and R2 in the figure
above).
In online mode, a recipe can be changed either by an appropriately configured visualization
element (input configuration execute command) or by using the appropriate methods of the
function block RecipeManCommands of the Recipe_Management.library.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 501
Recipe Manager
The following methods are available in the contextual menu of a recipe column in the recipe
definition editor view:
ReadRecipe: The present variable values are taken into the recipe.
WriteRecipe: The recipe is written into the variables.
SaveRecipe: The recipe is stored into a default recipe file.
LoadRecipe: The recipe is loaded from a default recipe file.
CreateRecipe: A new recipe in the recipe definition is created.
DeleteRecipe: An existing recipe from a recipe definition is deleted.
See in the following paragraphs, how the recipes behave in the particular online states. It is a good
practice to set the option Save changes to recipe files automatically (in order to get the usual
behavior of a recipe management).
Recipe
You can add or remove a recipe offline or online. In offline mode, use the commands Add a new
recipe (see EcoStruxure Machine Expert, Menu Commands, Online Help) and Remove recipes
(see EcoStruxure Machine Expert, Menu Commands, Online Help) within the recipe manager
editor. In online mode, either configure an input on an appropriately configured visualization
element, or use the appropriate methods of function block RecipeManCommands of the
Recipe_Management.library.
When adding a recipe, a further column is added behind the right-most column, titled with the name
of the recipe (see the figure of the recipe definition editor view). The fields of a recipe column can
be filled with appropriate values. Thus, for the same set of variables, different sets of values can
be prepared in the particular recipes.
Actions Recipes Defined Within the Project Recipes Created During Run Time
Online Reset Warm The recipes of all recipe definitions get Dynamically created recipes remain
Online Reset Cold set with the values out of the open unchanged.
Download project.
Online Reset Origin The application is removed from the controller. If a new download is done
afterwards, the recipes will be restored like on an Online Reset Warm.
Shut down and restart the After the restart, the recipes are reloaded from the automatically created files. So
controller the status before shutdown will be restored.
Online Change The recipe values remain unchanged. During run time, a recipe can only be
modified by the commands of the RecipeManCommands function block.
Stop At a stop/start of the controller, the recipes remain unchanged.
502 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
NOTE: Floating point values (type REAL/LREAL) are stored in the textual recipe files in decimal
format as well as in hexadecimal format. (Because the hexadecimal value represents the exact
value whereas the decimal REAL value represents the value to the seventh decimal place.)
Example: PLC_PRG.realVar:=22.0F16#1600000H-5
For manually modifying a value in the recipe file, edit the decimal value and remove the
subsequent hexadecimal entry. (If both values are available, the hexadecimal value is loaded.)
Recipe handling in online mode if Save changes to recipe files automatically is NOT activated:
Actions Recipes Defined Within the Project Recipes Created During Run Time
Online Reset Warm The recipes of all recipe definitions Dynamically created recipes get
Online Reset Cold get set with the values out of the lost.
Download open project. However, these are
only set in the memory. In order to
store the recipe in a file, the save
command must be used explicitly.
Online Reset Origin The application is removed from Dynamically created recipes get
the controller. If a new download is lost.
done afterwards, the recipes will
be restored.
Shut down and restart the After the restart the recipes are reloaded from the initial values which
controller had been created at download from the values out of the project. So the
status as it was before shutdown will not be restored.
Online Change The recipe values remain unchanged. During run time, a recipe can only
be modified by the commands of the RecipeManCommands function
block.
Stop At a stop/start of the controller, the recipes remain unchanged.
Further information:
Concerning the storage of recipes in files, which are reloaded at a restart of the application, refer
to the description of the Recipe Manager Editor, Storage Tab (see page 497).
For a description of the particular RecipeManCommands methods (see page 505), refer to the
documentation within the library.
For the appropriate input configuration of a visualization element, refer to its help page (category
Input → execute command).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 503
Recipe Manager
Actions Description
Create recipe (= Add a new A new recipe is created in the specified recipe definition.
recipe)
Read recipe The values of the variables of the specified recipe definition are read from the
controller and are written to the specified recipe. This means that the values
will be stored implicitly (in a file on the controller). They will also be monitored
immediately in the recipe definition table in the Recipe Manager. In other
words, the recipe managed in the Recipe Manager gets updated with the
actual values from the controller.
Write recipe The values of the given recipe, as visible in the recipe manager, are written to
the variables on the controller.
Save Recipe The values of the specified recipe are written to a file with extension
*.txtrecipe, the name of which you have to define. For this purpose, the dialog
box for saving a file in the local file system opens.
NOTE: The implicitly used recipe files, necessary as a buffer for reading and
writing of the recipe values, may not get overwritten. This means that the
name for the new recipe file must be different from <recipe name>.<recipe
definition name>.txtrecipe.
Load Recipe The recipe which has been stored in a file (see the Save Recipe description)
can be reloaded from this file. The dialog box for browsing for a file opens for
this purpose. The filter is automatically set to extension *.txtrecipe. After
reloading the file, the recipe values will be updated accordingly in the recipe
manager.
Delete recipe (= Remove The specified recipe is removed from the recipe definition.
recipe)
Change recipe The value of the project variables can be changed. With a following write
recipe action, the appropriate project variables are written with the new
values.
Creating Specific Tasks for Modicon M241 and M251 Logic Controllers
For Modicon M241 and M251 logic controllers that should gain access to recipe files (create, read,
write, delete), create specific tasks (see page 474) with low priority and with the Watchdog function
disabled. Otherwise this can have an impact on the cycle time of the application.
504 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
RecipeMan Commands
Overview
When calling a recipe command, internal data access is performed. Depending on the device type,
this takes a few milliseconds. Verify that these calls are not performed by the MAST task or by a
task with a configured watchdog or a real-time task. This may lead to an application error and the
controller will enter the HALT state.
Consider that the option Save changes to recipe files automatically also performs a file access with
each modification of the recipe. Deactivate this option if the storage of the recipe is triggered by
the application.
Return Values
The following return values are possible for recipe commands:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 505
Recipe Manager
CreateRecipe
This method creates a new recipe in the specified recipe definition and afterwards reads the
controller values into the new recipe. At the end, the new recipe is stored in the default file.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
CreateRecipeNoSave
This method creates a new recipe in the specified recipe definition and afterwards reads the
controller values into the new recipe.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
DeleteRecipe
This method deletes a recipe from a recipe definition.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
506 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
DeleteRecipeFile
This method deletes the default recipe file from a recipe.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
LoadAndWriteRecipe
This method loads a recipe from the default recipe file and afterwards writes the recipe into the
controller variables.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
LoadFromAndWriteRecipe
This method loads a recipe from the specified recipe file and afterwards writes the recipe into the
controller variables.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
FileName: Name of the file
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 507
Recipe Manager
LoadRecipe
This method loads a recipe from the default recipe file. The default recipe file name is
<recipe>.<recipe definition>.<recipeextension>.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
ReadAndSaveRecipe
This method reads the controller values into the recipe and afterwards stores the recipe into the
default recipe file.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
ReadAndSaveRecipeAs
This method reads the controller values into the recipe and afterwards stores the recipe into the
specified recipe file. The content of an existing file would be overridden.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
FileName: Name of the file
508 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
SaveRecipe
This method stores the recipe into the default recipe file. The content of an existing file would be
overridden. The default recipe file name is <recipe>.<recipedefinition>.<recipeextension>.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
ReadRecipe
This method reads the controller values into the recipe.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
WriteRecipe
This method writes the recipe into the controller variables.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName: Name of the recipe
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 509
Recipe Manager
ReloadRecipes
This method reloads the list of recipes from the file system.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
GetRecipeCount
This method returns the number of recipes from the corresponding recipe definition.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
GetRecipeNames
This method returns the recipe names from the corresponding recipe definition.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
pStrings : The strings where the recipe values should be stored
iSize : The size of an array of strings
iStartIndex : The start index; can be used for a scrolling function
510 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
Example:
There are 50 recipes. To create a table which shows 10 recipe names at a time, define an array of
strings:
strArr: ARRAY[0..9] OF STRING;
Corresponding to the iStartIndex, the recipe names can be read from a specific area.
iStartIndex := 0;
The names 0...9 are returned.
iStartIndex := 20;
The names 20...29 are returned. In this example:
iSize := 10;
GetRecipeValues
This method returns the recipe variable values from the corresponding recipe.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName Name of the recipe
pStrings : The strings where the recipe values are to be stored
iSize : The size of an array of strings
iStartIndex : The start index; can be used for a scrolling function
iStringLength : The length of the string in the array
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 511
Recipe Manager
GetRecipeVariableNames
This method returns the variable name of the corresponding recipe.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName Name of the recipe
pStrings : The strings where the recipe values should be stored
iSize : The size of an array of strings
iStartIndex : The start index; can be used for a scrolling function
SetRecipeValues
This method sets the recipe values into the corresponding recipe.
Parameter Description
RecipeDefinitionName: Name of the recipe definition
RecipeName Name of the recipe
pStrings : The strings where the recipe values should be stored
iSize : The size of an array of strings
iStartIndex : The start index; can be used for a scrolling function
512 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
Example:
There are 50 recipes. To create a table which shows 10 recipe names at a time, define an array of
strings:
strArr: ARRAY[0..9] OF STRING;
Corresponding to the iStartIndex, the recipe names can be read from a specific area.
iStartIndex := 0;
The values 0...9 are set.
iStartIndex := 20;
The values 20...29 are set. In this example:
iStringLength := 80;
iSize := 10;
GetLastError
This method returns the last detected error of the previous operations.
Return values (see page 505): ERR_NO_RECIPE_MANAGER_SET, ERR_OK
ResetLastError
This method resets the last detected error.
Return values (see page 505): ERR_NO_RECIPE_MANAGER_SET, ERR_OK
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 513
Recipe Manager
Overview
You can apply recipe values from the controller to recipe definitions in the project, even if these
definitions have been modified in the project.
As a prerequisite, the option Recipe Management in the PLC has to be activated in the General
tab of the Recipe Manager editor and File Path has to be set to 'Recipes\'.
514 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Recipe Manager
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 515
Recipe Manager
Memory Usage
If the option Recipe Management in the PLC is activated in the General tab of the recipe manager
editor, then code is generated for the recipe manager and the recipe definitions. This code is saved
in the controller. The size of the memory used depends on the number of recipes and their
variables, as well as the data type of the variables. If the fields of the recipe definition are filled, this
also requires memory space.
You can use the values provided in the table as a guideline for determining the memory space:
516 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Trace Editor
EIO0000002854 06/2019
Chapter 25
Trace Editor
Trace Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 517
Trace Editor
Section 25.1
Trace Object
Trace Object
518 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Trace Basics
Trace Functionality
The trace functionality allows you to capture the progression of the values of variables on the
controller over a certain time, similar to a digital sampling oscilloscope. Additionally, you can set a
trigger to control the data capturing with input (trigger) signals. The values of trace variables are
steadily written to a EcoStruxure Machine Expert buffer of a specified size. They can be observed
in the form of a two-dimensional graph plotted as a function of time.
NOTE: The tracing of data is continued when you log off the controller.
If PC processor-consuming tasks are executed in EcoStruxure Machine Expert or on the PC
running EcoStruxure Machine Expert while a trace is running, it may happen that variable values
are not captured by the trace.
NOTICE
LOSS OF DATA
Avoid executing actions and/or PC applications that lead to a high processor load while running
a trace.
Failure to follow these instructions can result in equipment damage.
NOTE: The tracing of data can significantly increase the cycle time of the IEC task.
What data is captured is determined by an entry in the target settings (trace → trace manager).
The trace manager has advanced functionality. It allows you to:
Configure and trace parameters of the control system, such as the temperature curve of the
processor or the battery. For more information, refer to the variable settings (see page 528) and
to the record (trigger) settings (see page 531).
Read out device traces, such as the trace of the electric current of a drive. For more information,
refer to the description of the Upload Trace command (see EcoStruxure Machine Expert, Menu
Commands, Online Help).
Trace system variables of other system components.
Furthermore, the additional command (see EcoStruxure Machine Expert, Menu Commands,
Online Help) Online List is available.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 519
Trace Editor
NOTE:
If a trace is used in the visualization, device parameters cannot be traced or used for the trigger.
The trigger level cannot be set to an IEC expression, only literals and constants are supported.
The record condition cannot be set to an IEC expression of type BOOL, only variables are
supported.
If a property is traced or used for the trigger, it must be annotated with the attribute monitoring
(see page 691) in IEC declaration.
Configuration
Configure the trace data as well as the display settings of the trace data in the Configuration. It
provides commands for accessing the configuration dialog boxes. Several variables can be traced
and displayed at the same time, in different views such as multi-channel mode. Record traces of
variables with different trigger settings in their own trace object. You can create any number of
trace objects.
Tools tree with several trace objects
Commands for modifying the settings of the display are described in the Features paragraph
(see page 522). Zooming functionalities and a cursor are available as well as commands for
running the trace so that the graph can be compressed or stretched.
To integrate the readout of a trace within a visualization, use the visualization element Trace.
For further information on trace configuration for data recording, refer to the Record Settings
(see page 531).
520 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Overview
To insert a trace object in the Tools tree, select the Application node, click the green plus button,
and execute the command Trace.... Double-click the Trace node in the Tools tree to open the trace
editor.
Configuration
Newly created trace with contextual menu:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 521
Trace Editor
Configuration...: Opens the Trace Configuration dialog box with Record Settings
(see page 531).
Display Settings...: Opens the Display Settings dialog box (see page 538). It allows you to
configure the appearance of the graph and the coordinate system. This command is unavailable
until a configuration is loaded.
Features
For running the trace, use the following commands:
Add variable (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Download Trace (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Start/Stop Trace (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Reset Trigger (see EcoStruxure Machine Expert, Menu Commands, Online Help)
For customizing the view of the graphs, use the following commands:
Cursor (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Mouse Zooming (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Reset View (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Auto Fit (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Compress (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Stretch (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Convert to Multi-channel (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Convert to Single-channel (see EcoStruxure Machine Expert, Menu Commands, Online Help)
For further information, refer to the chapter (see page 543) Keyboard Operations for Trace
Diagrams.
For access to traces stored on the runtime system, use the following commands:
Online List (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Upload Trace (see EcoStruxure Machine Expert, Menu Commands, Online Help)
For access to traces stored on the disc, use the following commands:
Save Trace... (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Load Trace... (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Export symbolic trace config (see EcoStruxure Machine Expert, Menu Commands, Online Help)
Getting Started
In order to start the trace in online mode, download the trace configuration to the controller by
executing the Download Trace command. The graphs of the trace variables are displayed in the
trace editor window where you can store them to an external file. This file can be reloaded to the
editor. Also refer to the chapter Trace Editor in Online Mode (see page 542).
Step Action
1 Login and run the associated application.
Result: The application runs on the controller.
522 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Step Action
2 Download trace
Result: The trace graphs are immediately displayed according to the trace configuration.
3 Arrange the trace graphs, store the trace data, stop/start tracing.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 523
Trace Editor
Example
The trace editor shows an example of tracing in online mode. Four variables have been selected
for display in the variables tree in the right part of the dialog.
Trace in online mode
524 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Section 25.2
Trace Configuration
Trace Configuration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 525
Trace Editor
Overview
The Trace Configuration dialog box provides two different tree views on the left-hand side:
Trace Record tree view
Presentation (diagrams) tree view
Command Description
Add variable Opens the Variable Settings view (see page 528) on
the right-hand side.
To add a new variable, click the browse button (...),
and select a variable for tracing.
Assign to diagram Right-click a variable and execute the Assign to
diagram command to list the diagrams that do not
include the selected variable. Select a diagram to
display the selected variable in this diagram.
This command is deactivated if the selected variable
is already assigned to all diagrams.
Enabled The variables are by default enabled.
Deactivated variables are displayed as disabled.
They are not displayed or recorded.
526 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Command Description
Add diagram Adds a new diagram and displays it in the
Presentation (diagrams) tree view.
Add new variable Adds a new trace variable and opens the Variable
Settings view (see page 528) on the right-hand side.
Select a variable in the input field to trace the value
graph. Specify the display. The variable is assigned
to the selected diagram.
Add existing variable Right-click a diagram and execute the Add existing
variable command to list the trace variables where
the selected diagram is not displayed. Select a
variable to display it in the selected diagram.
This command is not available if all trace variables
are already displayed in the selected diagram.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 527
Trace Editor
Variable Settings
Overview
The Trace Configuration dialog box with Variable Settings opens when you select a trace variable
in the trace tree. It allows you to configure which variables should be traced and how they are
displayed.
Trace Configuration dialog box with Variable Settings
The trace variables are displayed in the left part of the window in a tree structure. The top node is
titled with the trace name.
Command Description
Add Variable Creates an anonymous entry in the trace tree.
In the right part of the dialog box, the settings of the new variable are
ready for configuration.
Delete Deletes the selected variable with the associated configuration.
528 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Parameter Description
Variable Enter the name (path) of the signal to specify the signal that is traced.
A valid signal is an IEC variable, a property, a reference, the contents of a
pointer, or an array element of the application. Allowed types are all IEC basic
types, except STRING, WSTRING or ARRAY. Enumerations are also
allowed, whose basic type is not a STRING, a WSTRING or an ARRAY. Click
the ... button to open the input assistant that allows you to obtain a valid entry.
Controllers that support parameter tracing provide a list if you click the
Variable: parameter. If you want to trace a device parameter, select the item
Parameter from this list. Then you can find one with the help of the input
assistant. Edit or verify the variable settings. Device parameters are only
supported if the CmpTraceMgr component is used. If device parameters are
used for trace (or for trigger) variables, it is not possible to activate the option
Generate Trace POU for visualization.
NOTE: If CmpTraceMgr is used for tracing, a Property (see page 183) that
is used as a trace (or trigger) variable must get the compiler attribute Attribute
Monitoring (see page 691).
Graph color Select a color from the color selection list in which the trace curve for the
variable is displayed.
Line type Specify the way samples are connected in the graph. Use Line for large
volumes of data. It is also the default value.
Line The samples are connected to a line (default).
Step The samples are connected in the shape of a staircase. Thus, a horizontal
line to the time stamp of the next sample followed by a vertical line to the
value of the next sample.
None The samples are not connected.
Point type Specify how the values themselves are drawn in the graph.
Dot The samples are drawn as dots (default).
Cross The samples are drawn as crosses.
None The samples are not displayed.
Activate Minimum Warning If this option is activated, the trace graph is displayed in the color defined in
Warning minimum color as soon as the variable exceeds the value defined in
Critical lower limit.
Critical lower limit If the value of the variable entered here has fallen below and Activate
minimum warning is active, the values of the curve changes in the following
specified color.
Warning minimum color Color value for the activated lower limit.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 529
Trace Editor
Parameter Description
Activate Maximum Warning If this option is activated, the trace graph is displayed in the color defined in
Warning maximum color as soon as the variable exceeds the value defined
in Critical upper limit.
Critical upper limit If the value of the variable entered here is exceeded and Activate maximum
warning is active, the values of the curve changes in the following specified
color.
Warning maximum color Color value for the activated upper limit.
Multi-Selection of Variables
By using the keyboard shortcuts Shift + mouse-click or Ctrl + mouse-click, you can select several
variables for editing. Then the modifications made in the dialog box Variable Settings are applied
to all selected variables. The same can be achieved with Shift + Up Arrow/Down Arrow or Ctrl + Up
Arrow/Down Arrow.
530 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Record Settings
Overview
The Trace Configuration dialog box with Record Settings opens if you execute the command
Configuration or if you double-click a trace variable in the trace tree. The configuration command
is also available in the contextual menu of the trace tree on the right part of the main trace editor
window.
NOTE: The settings completed in the dialog box Trace Configuration dialog box with Record
Settings are valid for all variables of the trace graph.
Trigger Basics
In most situations, it is not desired that tracing and displaying the input signals starts at random
moments, such as immediately after the previous measurement, or when the user presses the start
button. Most of the time it is preferred that the tracing is done when a trigger is fired for the
configured number of records (post trigger). This is called triggering and has to be defined here.
The following ways are used for triggering input signals:
by configuring a trigger variable
by configuring a record condition
or both
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 531
Trace Editor
Parameter Description
Enable Trigger Select the checkbox to enable the trigger system. It can be turned on or off
independently of the lower settings. If the trigger system is disabled, the trace
is free-running.
Trigger Variable Assign a variable. Specify which signal will be used as trigger by entering the
name (and path) of the signal.
A valid trigger signal is an IEC variable, a property, a reference, a pointer, an
array element of the application or an expression. Allowed types are all
IEC basic types, except STRING, WSTRING, or ARRAY. Enumerations are
also allowed, whose basic type is not a STRING, a WSTRING or an ARRAY.
The content of a pointer is not a valid signal. Click the ... button to open the
input assistant that allows you to obtain a valid entry.
Controllers that support using device parameters as triggers provide a list if
you click the Trigger Variable: parameter. If you want to use a device
parameter as trigger, select the item Trigger Parameter from this list. Open
the Input Assistant with the ... button and select traceable parameters. Under
Elements, the parameters available in the system are listed. You can also
type the parameter names directly or by copy and paste (from another
configuration) into the text field. Device parameters are only supported if the
trace manager is used.
NOTE: If CmpTraceMgr is used for tracing, a Property (see page 183) that
is used as a trace (or trigger) variable must get the compiler attribute Attribute
Monitoring (see page 691).
Trigger edge –
positive Trigger event on rising edge of the boolean trigger variable. Or as soon as
the value defined by Trigger Level for an analog trigger variable is reached
by an ascending run.
negative Trigger event on falling edge of the boolean trigger variable. Or as soon as
the value defined by Trigger Level for an analog trigger variable is reached
by a descending run.
both Trigger event on the conditions described for positive and negative.
Post Trigger Enter a number of records per trace signal, which are recorded after the
trigger is fired.
Default value: 50
Range: 0...4,294,967,295
Trigger Level Enter a value at which point the trigger fires.
With Trigger edge, you can specify whether it fires on a rising or a falling edge
of the trigger variable. It must be set if and only if an analog variable (variable
with numeric type, such as LREAL or INT) is used as trigger variable.
Directly enter a value. A GVL constant or an ENUM value is allowed if their
type is convertible to the trigger variable.
If IEC code is used, then you can also enter an arbitrary IEC expression of a
type that is convertible to that of the trigger variable.
Default value: – (empty)
532 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Parameter Description
Task From the list of available tasks, select the one where capturing of the input
signals takes place.
Record condition If you want to start the record by a condition, enter here a variable. If the trace
is started before, for example by pressing the start button, and the variable
assigned here becomes TRUE, the data capturing is started and the traced
graph will be displayed.
If CmpTraceMgr is used, the record condition has to be a variable of type
BOOL or of a bit-access. A content of a pointer is not a valid entry. Properties
are also supported.
If IEC code is used, an arbitrary IEC expression of type BOOL can also be
entered.
Comment Enter a comment text concerning the present record.
Resolution Enter a resolution of the trace time stamp in ms or μs.
For each captured signal, pairs of value and time stamp are stored and
transmitted to the programming system. The transmitted time stamps are
relative and refer to the start of the tracing.
If the trace task has a cycle time of 1 ms or less, use a time stamp with
resolution in μs. This option is only possible when a trace manager is
available in the controller.
Automatic restart Set this option if the trace configuration and the last content of the RTS trace
buffers is to be stored persistently on the target device.
This option is only possible when a trace manager is tracing in the controller.
Advanced... Click this button to open the Advanced Trace Settings dialog box
(see page 536). It allows you to set some additional settings for the trace
trigger.
NOTE: If you want to capture and display a trace signal with a different time base, you have to do
a record configuration in a separate trace object.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 533
Trace Editor
Display Mode
Overview
The Display mode view opens when you select an axis in the Presentation (diagrams) tree view.
The following parameters are available:
Parameter Description
Display mode Select the following scaling options:
Auto
The time axis is scaled automatically.
Fixed length
Select this option and define a constant length for
a time axis segment.
Fixed
Select this option and define a range for a time
axis segment by using the Minimum and
Maximum parameters.
Minimum When the Display mode → Fixed is selected, enter a
start value for the time axis segment.
Maximum When the Display mode → Fixed is selected, enter
an end value for the time axis segment.
Length Enter a value to define a constant length of the
segment. The start value is adapted accordingly.
Grid Select the option Grid to create a diagram with grid
lines in x-direction.
Select the color of the grid lines from the list next to
the Grid parameter.
Description Select the option Description and enter a describing
text in the box.
Tick marks section
Fixed spacing Select the option Fixed spacing to display tick marks.
Distance Enter a value to define the distance between the tick
marks.
Subdivisions Enter a value to define the number of subdivisions
between two tick marks.
534 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Element Description
Font Click the Font button to open the Font dialog box and
configure the font for the time axis.
Preview link Click the Preview link to see a preview of the diagram
you defined in the Display mode view.
Add variable link If a trace is selected in the Trace Record tree view,
click the Add variable link to add a new trace variable
to the Trace Record tree view.
Delete variable link If a trace variable is selected in the Trace Record tree
view, click the Delete variable link to delete the
selected trace variable from the Trace Record tree
view.
Preview
The preview of the diagram you defined in the Display mode view is displayed when you click the
Preview link in the Display mode view.
Underneath the preview of the diagram, the following elements are available:
Element Description
Backcolor parameter Select a color for the background of the diagram from
the list next to the Backcolor parameter.
Backcolor on selection parameter Select a color for the background of the selected
diagram from the list next to the Backcolor on
selection parameter.
Add diagram link If a diagram is selected, click the Add diagram link to
add a new diagram to the Display mode view.
Delete diagram link If a diagram is selected, click the Delete diagram link
to delete the selected diagram from the Display mode
view.
Reset display settings link Click the Reset display settings link to reset the
display settings of the selected diagram or the
selected y-axis to the default values.
OK button Click the OK button to confirm the configuration
settings and to save the trace configuration.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 535
Trace Editor
Overview
The Advanced Trace Settings dialog box opens if you click the Advanced... button in the Trace
Configuration dialog box (see page 532) with Record Settings. It includes settings for the data
recording, such as buffer size on the runtime or development system that the trace editor reads.
The interval that the application uses to record data is derived from the task configuration.
Advanced Trace Settings dialog box
You configure the buffer size by defining a number of samples. Using settings from the task
configuration, EcoStruxure Machine Expert calculates time intervals according to the number of
samples. The calculation is possible only if the task cycle time is determinable. The result is
displayed on the right, outside the table in a standardized style, for example, 1h1m1s1ms .
536 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 537
Trace Editor
Display Settings
Overview
The Display Settings dialog box includes the configuration for the display settings of the trace
diagram, for both the x-axis and y-axis, and provides a preview in the trace diagram.
Click the Display Settings button in the Trace Configuration dialog box, to open the Display
Settings dialog box.
You can manage the settings with the following buttons:
Button Description
Reset With this command, EcoStruxure Machine Expert resets the
settings to the default values.
Use as default With this command, EcoStruxure Machine Expert saves the settings
as default values.
X axis Tab
X axis tab of the Display Settings dialog box
538 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Parameter Description
Display mode Scaling
Auto If this option is activated, EcoStruxure Machine Expert scales automatically.
Fixed length If this option is activated, EcoStruxure Machine Expert displays a segment of
constant length.
Fixed If this option is activated, EcoStruxure Machine Expert displays a segment
from Minimum to Maximum.
Minimum Initial value of the segment.
Requirement: Display mode is set to Fixed.
Maximum End value of the segment.
Requirement: Display mode is set to Fixed.
Length Constant segment length; EcoStruxure Machine Expert adapts initial value.
Grid If this option is activated, a diagram with grid line in the y-direction is
displayed. Select the color of the grid lines from the list.
Tick marks –
Fixed spacing If this option is activated, EcoStruxure Machine Expert draws tick marks with
Distance and Subdivisions.
Distance Distance between tick marks.
Subdivision Number of subdivisions between tick marks.
Font Font used for the x-axis.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 539
Trace Editor
Y axis Tab
Y axis tab of the Display Settings dialog box
Parameter Description
Display mode Scaling
Auto If this option is activated, EcoStruxure Machine Expert scales
automatically.
Fixed If this option is activated, EcoStruxure Machine Expert displays a
segment from Minimum to Maximum.
Minimum Initial value of the displayed segment.
Requirement: Display mode is set to Fixed.
Maximum End value of the displayed segment.
Requirement: Display mode is set to Fixed.
Grid If this option is activated, a diagram with grid line is displayed. Select
the color of the grid lines from the list.
Description If this option is activated, the axis is labeled as Description.
Tick marks –
Fixed spacing If this option is activated, EcoStruxure Machine Expert draws tick
marks with Distance and Subdivisions.
Distance Distance between tick marks.
Subdivision Number of subdivisions between tick marks.
Font Font used for the y-axis.
540 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Parameter Description
Backcolor Choose the background color for the coordinate system from the
list.
Backcolor on Selection Choose the background color for the coordinate system from the
list. It is used as long as the diagram is selected in the trace window.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 541
Trace Editor
Section 25.3
Trace Editor in Online Mode
Overview
If a trace is running on the device, it is indicated in the trace dialog box Online List (see EcoStruxure
Machine Expert, Menu Commands, Online Help).
Download Trace
In order to start the trace in online mode, download explicitly the trace to the controller with the
Trace → Download Trace menu command (see EcoStruxure Machine Expert, Menu Commands,
Online Help) while the application is logged in. The graphs of the trace signals will be displayed in
the trace editor window.
While doing logins and logouts on the application without changing it, the traces are running
without a new download.
If the application code is changed, then it depends on the login mode, in what happens with the
traces:
Login with online change or Login without any change: The traces are still running.
Login with download: The traces in the controller are deleted and a new download of them is
necessary.
542 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trace Editor
Section 25.4
Keyboard Operations for Trace Diagrams
Keyboard Shortcuts
Overview
The following table desicribes keyboard and mouse actions:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 543
Trace Editor
544 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Trend Recording
EIO0000002854 06/2019
Chapter 26
Trend Recording
Trend Recording
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 545
Trend Recording
Section 26.1
Trend Recording Objects
546 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trend Recording
NOTICE
LOSS OF DATA
Stop the trend function and save the trend data before changing state of the controller from the
run state.
Failure to follow these instructions can result in equipment damage.
This function is not available for all supported controllers. Consult the Programming Guide specific
to your controller as to whether it supports trend recording.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 547
Trend Recording
Overview
To insert a trend recording object in the Tools tree, select the Application node, click the green plus
button, and execute the command Add other objects → Trend Recording.... Double-click an object
of the type Trend recording in the Tools tree to open the Trend Recording Editor.
Tools tree with trend recording objects:
548 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trend Recording
Section 26.2
Trend Recording Configuration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 549
Trend Recording
Overview
Double-click a trend recording object in the Tools tree or execute the command Visualization →
Edit trend recording to open the Trend Recording Editor.
The editor contains a tree view of the configuration and displays the Record Settings or the
Variable Settings, depending on the selection in the tree view.
550 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trend Recording
Record Settings
Overview
The Trend Recording dialog box with Record Settings opens when you select the top node in the
tree view of the Trend Recording Editor.
The recording of data is performed using the function of the runtime component that is also used
for tracing (see page 532). The settings that appear here are the same. The parameters that are
related to trigger settings are not required during trend recording and are therefore grayed out.
Element Description
Task parameter From the list, select the task in which data acquisition is executed.
In general, the trend recording runs in the same task as the main
program, for example, PLC_PRG.
Record condition parameter Refers to a variable of the type BOOL, to a bit or to a property. The
data acquisition is executed if the value is TRUE. The setting is
optional.
Comment parameter Enter a comment text.
Resolution parameter Resolution with which the time stamp is acquired.
Set the resolution of the time stamp to 1 μs if the trend task has a
cycle time of 1 ms or less.
Trend storage... button Click this button to open the Trend storage dialog box. It allows you
to configure further parameters that concern the behavior of the
trend recording at runtime.
Advanced... button Click this button to open the Advanced Trend Settings dialog box
(see page 553). It allows you to configure parameters that concern
the acquisition and storage of data.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 551
Trend Recording
Parameter Description
Maximum number of variables Defines the maximum number of trend variables that are managed
in the database. If you modify this value, EcoStruxure Machine
Expert updates the database on the controller by forcing a download
during next login to the controller. The database will then be
uploaded from the controller, the variables of the database will be
increased or decreased according to this new setting, and will be
downloaded to the controller.
Store every N milliseconds Number of ms defining the time interval at which the recorded data
is temporarily stored in a local buffer before being stored
persistently in the database. The time interval is converted internally
to the number of task cycles. The duration of a task cycle is defined
in the task configuration.
A high value results in a better runtime performance. The
disadvantage of this is that the greater the value, the amount of data
subject to be lost in the case of a controller change of state is
likewise increased.
A low value reduces this risk. The disadvantage of this is that the
control of a trend visualization is degraded with large amounts of
data.
Limit Activate an option to limit the recording.
No Limit The amount of trend recording data that is stored is not limited.
Use this option only for testing purposes, as using this setting will
eventually exhaust the file space in the controller if not regularly
maintained.
Maximum number This option defines the maximum number of data records that are
of records stored in the database. Each data record consists of time stamp and
the values of the trend variables.
NOTE: If this limit is reached, trend recording is stopped.
Maximum storage This option defines the maximum memory size reserved for trend
size storage. The number of records that can be stored within this
memory depends on the size of the individual records.
Select the suitable unit from the list (kilobytes (Kb), megabytes (Mb),
or gigabytes (GB)).
NOTE: If the memory reserved for trend storage is full, trend
recording continues, overwriting the oldest records.
552 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trend Recording
Parameter Description
Measure in every n-th cycle Defines how often data is acquired by the runtime system,
depending on the number of cycles completed.
The time interval is calculated according to the frequency by using
the settings from the task configuration. Thus, the calculation can
only be performed if at least the task cycle time is set. The result is
shown on the right of the input field, for example, 1h1m1s1ms.
The default setting is 1. This means that data is acquired every
cycle.
Additional Runtime Buffer for Defines the time, in ms, that the runtime system can use an
additional “overflow” buffer for recording data.
Example: 1000 ms
NOTE: This additional buffer can help to avoid loss of data if a
delay occurs during storage of the trend data.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 553
Trend Recording
Variable Settings
Overview
The Trend Recording dialog box with Variable Settings opens when you select a trend variable in
the tree view of the Trend Recording Editor. It allows you to configure which variables and
parameters should be recorded and how they are displayed.
The Trend Configuration dialog box with Variable Settings corresponds to the dialog box for tracing
(see page 528). The trend variables are displayed in the left part of the window in a tree structure.
The top node is titled with the trend name.
Parameter Description
Variable Select the IEC variable from the list whose value is acquired. The variable
must have a valid type.
Parameter Select the parameter from the list whose value is acquired. The parameter
must have a valid type.
Show variable name If the option Show variable name is selected, the name of the IEC variable is
displayed by the visualization in the trend diagram in runtime mode, either
alone or in parentheses after the Description.
If the option is not selected, the name of the IEC variable is displayed and
does not appear in parentheses after the Description.
Description Enter text for the tooltip that is displayed when a visualization user focuses
on the variable in the trend diagram. This text is inserted in the
GlobalTextList object where it can be localized.
If the option Show variable name is selected, then the tooltip is extended by
the variable name in parentheses.
Example: Sensor A (PLC_PRG.iSensor_A)
If you do not enter text in this Description box, the option Show variable
name is selected by default, and only the name of the variable is displayed.
Example: PLC_PRG.iSensor_A
If a legend is assigned to the trend, then the trend variable is labeled in the
legend and is displayed as the trend is configured here.
Graph color
Color with which the variable is displayed in the trend diagram. Click to
open the color selection dialog box.
Line type Defines how the acquired values are displayed as a line chart. Use the option
Line for large amounts of data.
554 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trend Recording
Parameter Description
Line The values are linked to form a line.
Step The values are linked in the form of steps.
None The values are not linked.
Point type Defines how the acquired values are displayed as a dot chart. Use the option
None for large amounts of data.
Dot The value is displayed as a dot.
Cross The value is displayed as a cross.
None The value is not displayed.
Activate minimum warning If this option is activated, a message is displayed when the variable value is
under the lower limit.
Critical lower limit If the value of the trend variable falls below the limit, the variable is displayed
in the Color defined for values below the limit.
Warning minimum color Color in which the variable is displayed when under the lower limit.
Activate maximum warning If this option is activated, a message is displayed when the variable value is
above the upper limit.
Critical upper limit If the value of the trend variable exceeds the limit, the variable is displayed
in the Color defined for values above the limit.
Warning maximum color Color in which the variable is displayed when above the upper limit.
A valid trend variable can be an IEC variable, a property, a reference, the contents of a pointer, an
ARRAY element, or an enumeration, as long as the type is not STRING, WSTRING, or ARRAY.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 555
Trend Recording
Overview
Configure trend recording by performing the following steps:
Assigning task.
Inserting trend variable.
Deleting trend variable.
Configuring trend memory.
Configuring advanced trend settings.
Assigning Task
Define the task in which the trend recording is to be executed. In general, the trend recording runs
in the same task as the main program, for example, PLC_PRG.
Step Action
1 Double-click a trend recording object in the Tools tree.
Result: The Trend Recording Editor opens.
2 Select the top node in the tree view.
Result: The Record Settings are displayed on the right-hand side of the dialog box.
3 Open the Task list and select the task in which the associated application runs.
Step Action
1 Double-click a trend object in the Tools tree.
Result: The Trend Recording Editor opens.
2 Execute the Add variable command, which is located below the tree view.
Result: A new variable is inserted and the corresponding variable settings are displayed.
3 Enter a valid IEC variable from the Variable list, or select the entry Parameters and enter a valid
parameter.
Result: A signal has been assigned to the trend variable.
4 Configure the display of the trend variable.
5 Configure the color of the trend variable.
Also refer to the Variable Settings of the Trace Configuration (see page 528).
556 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trend Recording
Step Action
1 Double-click a trend object in the Tools tree.
Result: The Trend Recording Editor opens.
2 Click a trend variable in the tree view.
Result: The variable is selected.
3 Execute the Delete variable command, which is located below the tree view or press the Delete
key.
Step Action
1 Double-click a trend object in the Tools tree.
Result: The Trend Recording Editor opens.
2 Select the top node in the tree view.
Result: The Record Settings are displayed on the right-hand side of the dialog box.
3 Click the Trend storage... button.
Result: The Trend Storage dialog box opens (see page 552).
4 Adapt the settings.
Step Action
1 Double-click a trend object in the Tools tree.
Result: The Trend Recording Editor opens.
2 Select the top node in the tree view.
Result: The Record Settings are displayed on the right-hand side of the dialog box.
3 Click the Advanced... button.
Result: The Advanced Trend Settings dialog box opens.
4 Adapt the settings.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 557
Trend Recording
Section 26.3
Recording Trend Data
Precondition
To start the recording process, a configured object of the type Trend recording is required.
Step Action
1 Start the controller.
2 Select the application that contains the trend recording and execute the command Application
→ Login.
3 Start the application.
Before you stop the controller or perform a download (execute the Online change command
(see EcoStruxure Machine Expert, Menu Commands, Online Help)), stop the trend recording
process to save the trend data to the database.
NOTICE
LOSS OF DATA
Stop the trend function and save the trend data before changing state of the controller from the
run state.
Failure to follow these instructions can result in equipment damage.
558 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Trend Recording
Step Action
1 Double-click a trend object.
Result: The Trend Recording Editor opens.
2 Select the top node in the tree view of the configuration.
Result: The Record settings are displayed on the right-hand side of the dialog box.
3 Assign a boolean variable to the Record Condition field.
The boolean variable controls the recording of the data.
4 Select the application that contains the trend recording and execute the command Application
→ Login.
5 Start the application.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 559
Trend Recording
560 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Unit Conversion
EIO0000002854 06/2019
Chapter 27
Unit Conversion
Unit Conversion
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 561
Unit Conversion
Overview
In the configuration editor UnitConversion, you define conversions which can be used for variables
in visualization elements and in the IEC editors. Add the editor as an object UnitConversion in the
Applications tree. You can rename it there.
UnitConversion editor
You can define various conversions for your project. Enter a Name and choose the Type for each.
The respective conversion formula is automatically displayed in the Setting column. Enter a
Condition to determine when the conversion should be executed. Depending on the selected Type,
define specific parameters in the area below the table.
562 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Unit Conversion
Conditions
You can select 3 conditions to define when the calculation is executed:
Condition Description
TRUE The conversion is always performed.
Language Language of the visualization (value of variable
[Link])
Variable The conversion is performed depending on a variable
value. The compare value can be a constant, a
variable or an IEC expression.
Parameter Description
Offset Value or variable
Parameter Description
Factor Value or variable
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 563
Unit Conversion
Parameter Description
Factor Value or variable
Offset Value or variable
Parameter Description
Base start value Lower value of the input range
Base end value Upper value of the input range
Target start value Lower value of the output range
Target end value Upper value of the output range
Example
Base start value: 0
Base end value: 1024
Target start value: 4.0
Target end value: 20.0
User-Defined Conversion
Use this conversion if you want to calculate the input value by a user-defined expression. Use the
variable rValue as input value. In this expression, all IEC operands can be used.
Parameter Description
Convert Expression to convert the input value
Reverse Expression to revert the calculated value
Switchable Conversion
Use this conversion if you want to use different conversions, depending on the language or a
variable value. All defined conversions can be used.
564 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Unit Conversion
Overview
You can use unit conversions in all IEC editors. If you create a conversion for each new conversion,
a function block is created automatically.
The function block includes 2 methods:
Method Description
Convert Calculation of the input value according to the
conversion formula.
Reverse Reverse calculation back to the input value.
Example in ST
In this example, Conv_4_20 is the name of the conversion.
VAR
rValue : REAL;
rConvertedValue : REAL;
END_VAR
rConvertedValue := Conv_4_20.convert(rValue);
Reverse calculation back to the input value.
rValue := Conv_4_20.reverse(rConvertedValue);
Example in CFC
In the CFC editor, enter the instance name of the conversion above the element. In the element,
the method is defined.
Example in CFC method Convert:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 565
Unit Conversion
566 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Symbol Configuration Editor
EIO0000002854 06/2019
Chapter 28
Symbol Configuration Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 567
Symbol Configuration Editor
Overview
The symbol configuration functionality allows you to create symbol descriptions. The symbols and
the variables they represent can then be accessed by external applications, such as Vijeo-
Designer or OPC server.
To configure symbols for an application, double-click the Symbol Configuration node in the Tools
tree. The Symbol configuration editor view opens.
The editor contains a table. Depending on the set filter, it shows the available variables, or just
those already selected for the symbol configuration. For this purpose, the concerned POUs or
libraries are listed in the Symbols column. You can expand them in order to show the particular
variables.
Element Description
View button The View button allows you to set the following filters to reduce the number of displayed
variables:
Unconfigured from Even variables not yet added to the symbol configuration, but
Project available for this purpose in the project, are displayed.
Unconfigured from Also variables from libraries, not yet added to the symbol
Libraries configuration, but available for this purpose in the project, are
displayed.
Symbols exported via This setting is effective only when the unconfigured variables are
attribute displayed (see the two filters described above).
It has the effect that also those variables are listed, which are
already selected for getting symbols by
{attribute 'symbol' := 'read'} within their declaration.
Such symbols are displayed grayed. The Attribute column shows
which access right is set for the variable by the pragma. Refer to the
following description of the Access Rights column (see page 570).
Build button The Build button allows you to build the project. The build run refreshes the variables view in
the configuration editor.
Settings button The Settings button allows you to activate the following options:
Support OPC UA This function is not supported.
features
Include comments in This has the effect that comments assigned to variables are also
XML exported to the symbol file.
Include node flags in This has the effect that the flags that contain the namespace are
XML also exported to the symbol file. They provide additional information
on the origin of the node in the namespace when OPC UA is active.
568 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Symbol Configuration Editor
Element Description
Configure comments Opens the Comments and Attributes dialog box that allows you to
and attributes... configure the contents of the symbol configuration and the XML file.
Configure Opens the Options tab of the Properties dialog box of the selected
synchronisation with controller. Refer to the description of the Access variables in sync
IEC tasks... with IEC tasks option in the EcoStruxure Machine Expert Menu
Commands Online Help (see EcoStruxure Machine Expert, Menu
Commands, Online Help).
NOTE: Do not activate the option Configure synchronisation with
IEC tasks... for motion and real time-critical application because the
delayed start of IEC tasks leads to a higher jitter.
For further information, refer to the paragraph Additional
Information on the Option Configure synchronisation with
IEC tasks... (see page 572).
Compatibility Layout Select this option to calculate the data output in the same way as in
SoMachine / SoMachine Motion versions prior to V4.3.
Do not use this layout together with exported STRUCTs that use the
attributes pack_mode or relative_offset.
The data layout created for the client is adapted as far as possible
to the layout created by the compiler.
Optimized Layout Select this option to calculate the data output in an optimized form,
independent of the internal compiler layout.
The optimization impacts only variables of a structured type and
function blocks. No gaps with padding bytes are generated for
members that are not published, for example, because they are
deactivated in the Symbol Configuration. For internal members, for
example, function blocks implementing interfaces, no gaps are
created either.
This option is by default selected for projects created with
SoMachine / SoMachine Motion versions V4.3 or later, or with
EcoStruxure Machine Expert. The setting is preserved after a
Project update.
This option requires SoMachine / SoMachine Motion versions V4.3
or later, or EcoStruxure Machine Expert. It is the default setting
when creating a new Symbol Configuration.
Tools button Save XML Scheme Opens the dialog box for saving a file in the file system. Allows you
File... to create an XSD (XML Schema Definition) format of the symbol
file, for use in external programs.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 569
Symbol Configuration Editor
Column Description
Symbols The column shows a list of POUs. You can select variables to be exported. If
you select variables of a structured data type, all members of the structure will
be exported.
You may also select only particular member variables in the dialog box
Symbol Configuration for Data Type. Click the browse ... button in the
Members column to open this dialog box. For further information, refer to the
description of the Members column.
Access Rights To modify the access rights for a selected item, click the Access Rights
column.
Each mouse-click switches the symbol within the following definitions:
: read-only
none
NOTE: With the POU property Link Always, an uncompiled POU can be forced to be downloaded
to the controller. If this property is set in the Build tab of the Properties dialog box of the selected
POU, then all variables declared in this POU are available, even if those variables are not
referenced by other code. Alternatively, you can use the pragma {attribute linkalways}
(see page 690) to make not compiled variables available in the symbol configuration.
570 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Symbol Configuration Editor
Variables which are configured to be exported but which are not valid in the application, for
example because their declaration has been removed, are shown in red. This also applies to the
concerned POU or library name.
By default, a symbol file is created with a code generation run. This file is transferred to the device
with the next download. If you want to create the file without performing a download, use the
command Generate code, by default available in the Build menu.
NOTE: Variables of a global variable list (GVL) will only be available in the symbol configuration if
at least one of them is used in the programming code.
Element Description
Symbol table contents
Enable extended OPC UA information This function is not supported.
Include comments
Include attributes
Also include comments and attributes for type nodes
XML symbol file contents
Include namespace node flags Namespace node flags provide additional
information about the origin of a node in the
namespace. Node flags are available in the symbol
table when OPC UA is activated.
Deselect this option to prevent namespace node
flags from being inserted in the XML file if your parser
cannot process them.
Include comments Select this option to save comments in the XML file.
In SoMachine / SoMachine Motion versions prior to
V4.4, this includes the setting Prefer docu comments.
Include attributes Select this option to save attributes in the XML file.
Also include comments and attributes for type nodes This option is only available if the option Include
comments or the option Include attributes is
activated.
If this option is selected, the information for type
nodes is also included (user-defined types, such as
STRUCT and ENUM elements).
If this option is not selected, comments and attributes
are only available for directly exported variables.
Select comments
These parameters are only available if one of the Include comments options is activated.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 571
Symbol Configuration Editor
Element Description
Include docu comments: Select the options to determine the kind of comments
///They start with triple slash and are usually /// that are saved in the symbol configuration.
formatted in ReST (library documentation)
Include normal comments:
(*IEC/ Pascal style comments *) // C++-Style
comments with double-slash
Always include both types of comments
Prefer docu comments, fallback to normal ones
Prefer normal comments, fallback to docu comments
Filter Attributes (case insensitive)
These parameters are only available if one of the Include attributes options is activated.
Include all attributes (“foo”, “bar”, “[Link]”) Select the options to determine the attributes that are
saved in the symbol configuration.
Match simple identifiers (“foo”, “bar”)
Include attributes starting with:
Filter Attributes with regular expression
The option Configure synchronisation with IEC tasks... is available at two different locations in
EcoStruxure Machine Expert:
In the Symbol configuration editor, as an option of the Settings button. (If a symbol configuration
is available in the application.)
In the Options tab of the Properties dialog box of the selected controller.
NOTE: In order for the setting to take effect, perform a Download or Online Change of the
applications on the controller and update the boot applications.
572 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Symbol Configuration Editor
Symbol Configuration
Overview
The symbol configuration is used to create symbols, provided with specific access rights. They
allow project variables to be accessed externally, for example by Vijeo-Designer. The description
of the symbols will be available in an XML file (symbol file) in the project directory. It will be
downloaded to the controller together with the application.
Symbol Information
The symbols defined for an application are exported to an XML file in the project directory (symbol
file) when the application is downloaded to the controller. This file is named according to the
following syntax:
<project name>.<device name>.<application name>.xml
Example: proj_xy.[Link]
Symbols for input addresses and variables that are mapped to input channels allow read-only
access. Write access is only allowed for testing purposes in simulation mode.
NOTE: In case a download to the controller is not possible, you can create the symbol configuration
file by executing the command Generate code.
Further on the symbol information is downloaded to the controller with the application. Depending
on the device description, it will be included in the application or a separate child application will be
generated. This will also be listed with the name <application name>._symbols in the Applications
view of the device editor (see page 134).
If the symbol configuration has been modified in online mode, you can reload it to the controller by
clicking the button Download in the editor window (see page 570).
For example, concerning the maximum number of applications on a controller, the symbol
application has to be handled as a normal application.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 573
Symbol Configuration Editor
Prerequisites
Variables that will be exchanged between the controller and (multiple) HMI devices using the
transparent Machine Expert protocol (see EcoStruxure Machine Expert, Introduction) must be
published in the controller using the Symbol configuration. They will then be available as
EcoStruxure Machine Expert variables in Vijeo-Designer.
574 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Symbol Configuration Editor
Step Action
1 Select the Application node in the Tools tree, click the green plus button, and
select the command Add other objects → Symbol configuration....
Result: The Add Symbol configuration dialog box will be displayed.
2 In the Add Symbol configuration dialog box, optionally configure settings like
whether to include comments or not. The settings can be modified later in the
Symbol configuration editor (see page 568).
3 Click the Add button.
Result: A Symbol configuration node is created under the Application node in the
Tools tree. The Symbol configuration is displayed on the right-hand side.
NOTE: Only one symbol configuration node can be created per device.
For details on the variables interchange between the controller and HMI part, refer to the chapter
EcoStruxure Machine Expert Controller-HMI Data Exchange (see page 577).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 575
Symbol Configuration Editor
576 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Controller - HMI Data Exchange
EIO0000002854 06/2019
Chapter 29
EcoStruxure Machine Expert Controller - HMI Data Exchange
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 577
Controller - HMI Data Exchange
Overview
By publishing the variables in EcoStruxure Machine Expert, they will automatically be available for
use in the Vijeo-Designer HMI application.
For variable exchange with the Machine Expert protocol, perform the following steps:
Create variables in the controller part.
Publish the variables by defining them as Symbols in the controller part. They are now available
in the HMI part as EcoStruxure Machine Expert variables.
Configure the physical connection (automatically setup by EcoStruxure Machine Expert).
NOTE: The last step is not necessary for XBTGC controllers because they may communicate with
their own control variables.
578 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller - HMI Data Exchange
Step Action
1 Select the Options... command from the Tools menu.
Result: The Options dialog box is displayed.
2 Select the entry Vijeo-Designer from the list on the left-hand side.
3 On the right-hand side, enable the check box Disable automatic symbol export.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 579
Controller - HMI Data Exchange
NOTE: Activating the Disable automatic symbol export function inhibits the automatic export of
EcoStruxure Machine Expert variables defined as Symbols to Vijeo-Designer. In order to perform
this transfer manually, right-click the Symbol configuration node in the Devices window and
execute the Export Symbols to Vijeo-Designer command. If you do not perform this manual
transfer, Vijeo-Designer may not show the correct symbols which, in turn, may lead to errors being
detected in the project.
WARNING
UNINTENDED EQUIPMENT OPERATION
Execute the Export Symbols to Vijeo-Designer command if you have activated the Disable
automatic symbol export before you start working in Vijeo-Designer.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
580 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller - HMI Data Exchange
Identifier Length
In Vijeo-Designer, the maximum length of the Symbol name is limited to 32 characters.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 581
Controller - HMI Data Exchange
Overview
Publish variables in the controller part of the EcoStruxure Machine Expert application within the
Symbol configuration editor or in the Variables view of the software catalog (see page 36) of a
POU.
Step Action
1 Create a Symbol Configuration node under the Application node in the Tools tree as described in the
Adding a Symbol Configuration chapter (see page 574).
2 Double-click the Symbol Configuration node to open the Symbol configuration editor.
3 In the Symbol configuration editor, select those elementary variables that you wish to publish for
communication with 1 or several HMI terminals by selecting or deselecting the check box in the Symbols
column:
You can also assign read/write access rights to each variable individually in the Access Rights column.
For further information, refer to the description of the Symbol configuration editor (see page 568).
Note: Only variables on elementary data types are available for interchange with HMI terminals.
4 For your settings to become valid, click the Download link in the Symbol configuration editor.
NOTE: The publishing mechanism consumes an overhead of about 50 Kbyte in the controller.
Each published variable consumes 11 bytes within the controller application.
582 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller - HMI Data Exchange
Step Action
1 Open the Variables view of the software catalog (see page 36).
2 To publish a variable, select the respective check box in the Publish column.
NOTE: Verify that the POU of the selected variables is called in a task. Otherwise the selected
variables will not be published.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 583
Controller - HMI Data Exchange
Selecting Variables
Those variables that have been published in the controller part are directly available in the HMI
part.
In the Expression Editor Pad of Vijeo-Designer, select the corresponding tab to have direct access
to the variables published in EcoStruxure Machine Expert.
584 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller - HMI Data Exchange
Procedure
To publish the above mentioned variable types, proceed as follows:
Step Action
1 In the Vijeo-Designer Variable Editor, select those variables you want to publish.
2 Right-click the selected variable(s) and execute the command Move to SoMachine from the context
menu.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 585
Controller - HMI Data Exchange
Step Action
4 Select the POU or GVL to which you want to add the selected Vijeo-Designer variable(s) and click OK.
Result: The selected variable(s) has / have been moved to the selected EcoStruxure Machine Expert
POU or GVL and is / are available throughout the EcoStruxure Machine Expert project.
586 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller - HMI Data Exchange
Overview
The runtime data exchange between the controller and the HMI is executed on different media,
depending on the selected hardware.
Configuration Example
The default settings below are valid for communications between M241 and an HMI panel via serial
line RS-485 using an XBTZ9008 cable (serial line SubD-RJ45).
Configuration of M241 with HMI panel:
M241 controller serial line configuration
Parameter Value
Physical Medium RS485
Baud rate 115200
Parity none
Data bits 8
Stop bits 1
HMI panel IO-Manager configuration using a driver: EcoStruxure Machine Expert - network with at
least one Scan-Group (for further information, refer to the Vijeo-Designer online help).
Parameter Value
Physical Medium RS485
Baud rate 115200
Parity none
Data bits 8
Stop bits 1
Equipment Name Controller device name (available in the Communication
Settings tab (see page 105)).
Configuration of XBTGC:
Device Configuration
XBTGC controller No configuration required.
HMI panel IO-Manager
Driver EcoStruxure Machine Expert - Combo with at least one
Scan-Group
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 587
Controller - HMI Data Exchange
Overview
The communication speed between controller and HMI depends largely on the number of variables
that are exchanged. Therefore, the time that is required to display the values on the HMI panels
when a controller-HMI-connection is established, as well as to the refresh time of the variables, are
affected accordingly.
This chapter provides reference values that have been achieved under optimum conditions. Actual
values depend on the total performance of your controller application (for example, the
communication task responsible for data exchange is executed with a low priority).
For data exchange using the Machine Expert protocol via Ethernet, this chapter indicates the
number of variables allowed to achieve a good data transmission performance. If you are using
serial line, consider to change to Ethernet for increasing the performance.
588 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller - HMI Data Exchange
Typical delay to establish a connection and display values on the HMI panel:
1 Time in seconds
2 Number of variables
3 XBTGT2330 + M258
4 XBTGT4330 + M258
1 Time in seconds
2 Number of variables
3 XBTGT2330 + M258
4 XBTGT4330 + M258
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 589
Controller - HMI Data Exchange
XBTGC 8000
XBTGT
XBTGH
HMIGTO
HMISTO
HMISTU
HMISCU series
Chapter Errors → Message List → Editor Error Messages→ 1300 - 1999→ Error 1301:
Error 1301: [Target] [target name] too many variables. Variable limit is [8000 or 12000].
NOTE: The Vijeo-Designer online help indicates that the total number of elements in an array must
not exceed 2048 (refer to the chapter Creating Variables → Array Variables). This limits the size
of (single or multidimensional) array variables that are shared via the EcoStruxure Machine Expert
Symbol Configuration. To overcome this limit, consider sharing an array of DUT (for example,
ARRAY[0..99] OF DUT_30, where DUT_30 is a user-defined type containing 30 distinct
INT variables, resulting in 3000 variables). In any case, the Error 1301 will be issued if the
maximum number of variables per target (8000 or 12000) is exceeded.
590 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller - HMI Data Exchange
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 591
Controller - HMI Data Exchange
592 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Cam Motion Editor
EIO0000002854 06/2019
Chapter 30
Cam Motion Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 593
Cam Motion Editor
Section 30.1
Cam Motion Editor - General Information
594 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
General Information
Overview
The cam motion editor is used to create and parameterize cam diagrams and assign them to
FB_MultiCam / MC_Cam_ID function blocks. In turn, these diagrams can then be used by the
Motion Sizer, for example, for drive sizing.
The cam diagrams are based on the motion laws defined in VDI 2143. They allow you to design
the motion of your axis in relation to the position of a master axis φ. Cam diagrams are used to
model the movement of a servo axis, which follows the motion of a virtual line shaft. The angle of
this line shaft is described by φ.
You can define segments for each cam diagram that correspond to the different sequences of
motion that your axis performs.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 595
Cam Motion Editor
Overview
To add a cam object to your project, right-click the Application node in the Tools tree, and execute
the command Add Object → CamDiagram... from the contextual menu.
Result: A Camdiagram node is inserted. By default, it contains a Segment subnode that is a child
object of the diagram object.
596 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
Procedure
To open the motion editor of a cam diagram or a cam segment, double-click the node in the Tools
tree:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 597
Cam Motion Editor
Section 30.2
Generating IEC Program Code from Cam Data
598 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
Overview
Cam diagrams are used as a basis to generate cam data structures with a corresponding number
of cam points.
These data structures can be used to parameterize the FB_MultiCam / MC_Cam_ID function
blocks or a POU with equivalent functionality.
Cam data is used to initialize function blocks/modules that are processing cam data structures in
the application program.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 599
Cam Motion Editor
;
[Link][1].lrX := 100;
[Link][1].lrY := 0;
[Link][1].lrM := 0;
[Link][1].lrK := 0;
[Link][1].lrLambda := 0.5;
[Link][1].lrC := 1;
[Link][1].etCamType := ET_CAMTYPE.SimplSin
;
In this example, [Link] is configured as target data structure.
The generated data is based on cam diagrams that were edited in offline mode. They are not
updated in online mode.
600 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
Overview
The Generated IEC source code tab of the cam motion editor provides the source code that has
been generated for the cam diagram in a read-only format. Whenever the cam diagram is modified,
the code is regenerated.
You can copy the IEC code for further usage in your program.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 601
Cam Motion Editor
Section 30.3
Online View and Functions of the Cam Motion Editor
Nevertheless, you can select the different tabs to display the offline information of a cam diagram.
When you select another cam motion editor while you are in online mode, the offline data of the
corresponding cam data structure will be displayed.
Online Change
The cam motion editor supports the Online change function (see page 261).
After a cam data structure has been downloaded to the controller, the individual segments will be
editable as soon as you have switched to offline mode.
When switching back to online mode, the modifications are detected and you will be prompted to
decide whether you want to log in and perform the online change (see page 259). If you confirm
this message with OK, the cam data structure will be updated.
For the modifications to become effective, the FB_MultiCam / MC_Cam_ID function blocks must
be switched to the adequate mode to take into account the modified cam data structure.
You can achieve this by setting the input parameter (for example, iq_xNewCam...) via the Debug
→ Force values command. For further information, refer to the description of FB_MultiCam in the
PD_PacDriveLib or FB_MultiCam / MC_Cam_ID in the CommonMotionType library guide.
602 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
Section 30.4
Discontinuous Courses of the Positions
Overview
The cam data structure is used to parameterize the FB_MultiCam / MC_Cam_ID function blocks.
The data structure cannot map any discontinuous courses of the positions. Therefore, the
FB_MultiCam / MC_Cam_ID function blocks do not move along inconsistently parameterized
cam courses.
In order to help avoid invalid parameterization, the positions are verified for inconsistencies.
For this purpose, the start point of a cam segment is compared to the end point of the preceding
segment. For each invalid parameterization, a compile error is generated.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 603
Cam Motion Editor
Section 30.5
Dialog Boxes
Dialog Boxes
604 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
Motion Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 605
Cam Motion Editor
End condition The condition that applies at the end point of the Dwell
selected cam segment. Velocity
Return
Motion
Motionprofile The motion law describes the profile of the segment. Straight line
The available motion profile depends on the Start Quadratic parabola
condition and End condition selected. Refer to the Polynomial of 5th degree
table Motion Profiles Available for Combinations of Simple sinus
Start and End Conditions (see page 609). Modified sinus
Modified acceleration trapezoid
General polynomial of the 5th degree
Sinus-straight line combination
The user-defined motion profiles
Input parameters Select from the list the parameters which you will The values listed in the table depend on
configure. Result: The corresponding text fields will the Motionprofile you selected. Refer to
become editable. The remaining parameter will be the following tables that list the
calculated by EcoStruxure Machine Expert. parameters that are available per motion
law.
Left segment edge - Start section
X The x coordinate of the start point of the selected Decimal number
cam segment. Unit: φ
Represents the angle of the virtual line shaft where the
segment starts.
Y The y coordinate of the start point of the selected Decimal number
cam segment. Unit: Position
Represents the position of the axis at the segment
start. This is the value of s at the position x.
606 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 607
Cam Motion Editor
Designation Description
C Cam percentage of a motion curve.
Valid interval: The value of the input field must be greater than 0 and less
than or equal to 1.
Examples:
C = 1: The course is bent or a cam.
C = 0.001: The course almost matches a straight line completely.
C = 0.4: The course has a straight line percentage of 60% and a
cam percentage of 40%.
Lambda Position of the inflexion point.
For dwell/dwell laws the inflexion point is within the valid interval: The
value of the input field must be greater than or equal to 0 and less than or
equal to 1.
For Lambda = 0.5, the inflexion point is precisely in the center of the cam
segment.
For Lambda = 0.00001, the inflexion point is almost at the left edge.
For the most dwell/velocity or velocity/dwell motion laws, Lambda is
exactly 1 or 0 and is precisely at the left or right edge.
608 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 609
Cam Motion Editor
Parameters for Motion Laws Quadratic parabola, Polynomial of 5th degree, Simple sinus, Modified sinus,
Modified acceleration trapezoid
The table lists the parameters that are available for the motion laws Quadratic parabola,
Polynomial of 5th degree, Simple sinus, Modified sinus, Modified acceleration trapezoid, and the
values they can have in accordance with the selected Start condition and End condition:
610 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 611
Cam Motion Editor
The table lists the parameters that are available for the motion law General polynomial of the 5th
degree and the values they can have in accordance with the selected Start condition=Motion
together with several End condition values:
612 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
The table lists the parameters that are available for the motion law General polynomial of the 5th
degree and the values they can have in accordance with the selected Start condition=Return
together with several End condition values:
The table lists the parameters that are available for the motion law General polynomial of the 5th
degree and the values they can have in accordance with the selected Start condition=Velocity
together with several End condition values:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 613
Cam Motion Editor
614 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Cam Motion Editor
Configuration
Configuration Tab
The Configuration tab allows you to select a target structure for its generation and to define the
properties.
The Configuration tab allows you to do the following:
Select a target structure for source code generation.
Define properties for this structure.
Assign the diagram to an axis (only in EDESIGN projects).
Element Description
Target technology The Target technology section allows you to select a target structure (cam data
structure) for source code generation.
Select a structure or click the browse button (...) to open the Input Assistant
dialog box.
After a target structure has been defined, cam data is written into this target
structure whenever the application program is started.
If the expression is undeterminable, a diagnostic message will be generated.
From the target defined, it is detected whether the data structures are
CommonMotionType or PacDriveLib structures and configuration is performed
accordingly.
MultiCam configuration The MultiCam configuration section allows you to configure the values of the
following parameters:
User table Id: Can be a positive integer (including 0).
Y - Period: Can be a positive floating-point number (including 0).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 615
Cam Motion Editor
616 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Programming Reference
EIO0000002854 06/2019
Part VII
Programming Reference
Programming Reference
Chapter 31
Variables Declaration
Variables Declaration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 619
Variables Declaration
Section 31.1
Declaration
Declaration
620 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
General Information
Overview
You can declare variables:
in the Variables view of the Software Catalog (see page 35)
in the Declaration Editor of a POU (see page 426)
via the Auto Declare dialog box (see page 630)
in a GVL editor
The kind (in the tabular declaration editor it is named Scope) of the variables to be declared is
specified by the keywords embracing the declaration of one or several variables. In the textual
declaration editor (see page 426), the common variable declaration is embraced by VAR and
END_VAR.
For further variable declaration scopes, refer to:
VAR_INPUT
VAR_OUTPUT
VAR_IN_OUT
VAR_GLOBAL
VAR_TEMP
VAR_STAT
VAR_EXTERNAL
VAR_CONFIG
The variable type keywords may be supplemented by attribute keywords (see page 641).
Example: RETAIN (VAR_INPUT RETAIN)
Syntax
Syntax for variable declaration:
<Identifier> {AT <address>}:<data type> {:=<initialization>};
The parts in braces {} are optional.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 621
Variables Declaration
Identifier
The identifier is the name of a variable.
Consider the following facts when defining an identifier.
no spaces or special characters allowed
no case-sensitivity: VAR1, Var1 and var1 are all the same variable
recognizing the underscore character: A_BCD and AB_CD are considered 2 different identifiers.
Do not use more than 1 underscore character in a row.
unlimited length
recommendations concerning multiple use (see next paragraph)
622 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Example: If Lib1 is referenced by Lib0, the module fun being part of Lib1 is accessed by
[Link]:
ivar := [Link](4, 5); (* return value of fun is copied to variable ivar in the
project *)
NOTE: Once the checkbox Publish all IEC symbols to that project as if this reference would
have been included there directly. has been activated within the Properties dialog box of the
referenced library Lib, the module fun may also be accessed directly via [Link].
Variables declared in GVLs or POUs of the Global node of the Applications tree can be
accessed by prefixing them with the operator "__POOL.".
AT <address>
You can link the variable directly to a definite address (see page 632) using the keyword AT.
In function blocks, you can also specify variables with incomplete address statements. In order that
such a variable can be used in a local instance, an entry has to exist for it in the variable
configuration.
Type
Valid data type (see page 722), optionally extended by an :=< initialization> (see page 629).
Pragma Instructions
Optionally, you can add pragma instructions (see page 652) in the declaration part of an object in
order to affect the code generation for various purposes.
Hints
Automatic declaration (see page 630) of variables is also possible.
For faster input of the declarations, use the shortcut mode (see page 631).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 623
Variables Declaration
Overview
Identifiers are defined:
at the declaration of variables (variable name)
at the declaration of user-defined data types
at the creation of POUs (functions, function blocks, programs)
In addition to the general items to be considered when defining an identifier (refer to chapter
General Information on variables declaration (see page 621)), consider the following recommen-
dations in order to make the naming as unique as possible:
Variable names (see page 624)
Variable names in Libraries (see page 626)
User-defined data types (DUTs) in Libraries (see page 627)
Functions, Function blocks, Programs (POU), Actions (see page 627)
POUs in Libraries (see page 628)
Variable Names
For naming variables in applications and libraries, follow the Hungarian notation as far as possible.
Find for each variable a meaningful, short description. This is used as the base name. Use a capital
letter for each word of the base name. Use small letters for the rest (example: FileSize).
624 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Simple declaration
Examples for simple declarations:
bySubIndex: BYTE;
sFileName: STRING;
udiCounter: UDINT;
Nested declaration
Example for a nested declaration where the prefixes are attached to each other in the order of the
declarations:
pabyTelegramData: POINTER TO ARRAY [0..7] OF BYTE;
Function block instances and variables of user-defined data types
Function block instances and variables of user-defined data types get a shortcut for the function
block or the data type name as a prefix (for example: sdo).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 625
Variables Declaration
Example
cansdoReceivedTelegram: CAN_SDOTelegram;
TYPE CAN_SDOTelegram : (* prefix: sdo *)
STRUCT
wIndex:WORD;
bySubIndex:BYTE;
byLen:BYTE;
aby: ARRAY [0..3] OF BYTE;
END_STRUCT
END_TYPE
Local constants
Local constants (c) start with prefix c and an attached underscore, followed by the type prefix and
the variable name.
Example
VAR CONSTANT
c_uiSyncID: UINT := 16#80;
END_VAR
Global variables and global constants
Global variables are prefixed by g_ and global constants are prefixed by gc_.
Example
VAR_GLOBAL
g_iTest: INT;
END_VAR
VAR_GLOBAL CONSTANT
gc_dwExample: DWORD;
END_VAR
626 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 627
Variables Declaration
POUs in Libraries
Structure
For creating method names, the same rules apply as for actions. Enter English comments for
possible inputs of a method. Add a short description of a method to its declaration. Start interface
names with letter I; for example, ICANDevice.
NOTE: Consider the usage of the namespace when using POUs declared in libraries.
628 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Variables Initialization
Further Information
For further information, refer to the following descriptions:
initializing arrays (see page 740)
initialization of structures (see page 744)
initialization of a variable with a subrange type (see page 749)
NOTE: Variables of global variables lists (GVL) are initialized before local variables of a POU.
NOTE: As from SoMachine version 4.0, variables in a function block are initialized in the following
order: First, the constants in accordance with the order of their declarations, then the other
variables in accordance with the order of their declarations.
For further information regarding initialization order, refer to the Attribute global_init_slot
(see page 682).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 629
Variables Declaration
Declaration
Declaration Types
You can declare variables manually by using the textual or tabular declaration editor
(see page 426) or automatically like explained in this chapter.
Automatic Autodeclaration
You can define in the Options dialog box, category Text editor → Editing, that the Auto Declare
dialog box should open as soon as a not yet declared string is entered in the implementation part
of an editor and the ENTER key is pressed. This dialog box supports the declaration of the variable
(see page 621).
Manual Autodeclaration
To open the Auto Declare dialog box manually:
execute the command Auto Declare, which by default is available in the Edit menu or
press the keys SHIFT+F2
If you select an already declared variable before opening the Auto Declare dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help), you can edit the declaration of
this variable.
630 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Shortcut Mode
Overview
The declaration editor (see page 426) and the other text editors where declarations are performed
support the shortcut mode.
Activate this mode by pressing CTRL+ENTER when you end a line of declaration.
It allows you to use shortcuts instead of completely typing the declaration.
Supported Shortcuts
The following shortcuts are supported:
All identifiers up to the last identifier of a line will become declaration variable identifiers.
The type of declaration is determined by the last identifier of the line.
If no type has been established through these rules, automatically BOOL is the type and the last
identifier will not be used as a type (see example 1).
Every constant, depending on the type of declaration, will turn into an initialization or a string
(see examples 2 and 3).
An address (as in %MD12) is extended by the AT keyword (see example 4).
A text after a semicolon (;) becomes a comment (see example 4).
All other characters in the line are ignored (see, for example, the exclamation point in
example 5).
Examples
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 631
Variables Declaration
AT Declaration
Overview
In order to link a project variable with a definite address, you can assign variables to an address in
the I/O Mapping view of a device in the controller configuration (device editor). Alternatively you
can enter this address directly in the declaration of the variable.
Syntax
<identifier> AT <address> : <data type>;
A valid address has to follow the keyword AT. For further information, refer to the Address
description (see page 887). Consider possible overlaps in case of byte addressing mode.
This declaration allows assigning a meaningful name to an address. Any changes concerning an
incoming or outgoing signal may only be done in a single place (for example, in the declaration).
Consider the following when choosing a variable to be assigned to an address:
Variables requiring an input cannot be accessed by writing. The compiler intercepts this
detecting an error.
AT declarations only can be used with local or global variables. They cannot be used with input
and output variables of POUs.
AT declarations are not allowed in persistent variable lists.
If AT declarations are used with structure or function block members, all instances will access
the same memory location of this structure / function block. This corresponds to static variables
in classic programming languages such as C.
The memory layout of structures is determined by the target as well.
Examples
xCounterHeat7 AT %QX0.0: BOOL;
xLightCabinetImpulse AT %IX7.2: BOOL;
xDownload AT %MX2.2: BOOL;
Note
If boolean variables are assigned to a BYTE, WORD or DWORD address, they occupy 1 byte with
TRUE or FALSE, not just the first bit after the offset.
The memory size for input, output, and memory data (declarations with AT %I, %Q and %M) is
predefined by the target device and can be overwritten in the properties of an application object
(see EcoStruxure Machine Expert, Menu Commands, Online Help) for PacDrive controllers
(PacDrive LMC Eco, PacDrive LMC Pro/Pro2).
632 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Keywords
Overview
Write keywords in uppercase letters in the editors.
The following strings are reserved as keywords. They cannot be used as identifiers for variables
or POUs:
-
&
(
)
*
,
.
..
/
:
:=
;
[
]
^
__CATCH
__CHECKLICENSE
__CHECKLICENSEBIT
__DELETE
__ENDTRY
__FINALLY
__ISVALIDREF
__MEMORYBARRIER
__NEW
__QUERYINTERFACE
__QUERYPOINTER
__THROW
__TRY
__XADO
Ι
+
<
<=
<>
=
>=
>
=>
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 633
Variables Declaration
ABS
ACOS
ADR
AND
AND_THEN
ASIN
ATAN
BITADR
BY
CASE
CONTINUE
COS
DO
ELSE
ELSIF
END_CASE
END_FOR
END_IF
END_REPEAT
END_WHILE
EXIT
EXP
EXPT
FALSE
FOR
IF
INI
LIMIT
LN
LOG
LOWER_BOUND
MAX
MIN
MOD
MOVE
MUX
NOT
OR
OR_ELSE
R=
REF=
REPEAT
RETURN
ROL
ROR
634 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
S=
SEL
SHL
SHR
SIN
SIZEOF
SQRT
SUPER
TAN
THEN
THIS
TO
TRUE
TRUNC
TRUNC_INT
UNTIL
UPPER_BOUND
WHILE
XOR
Additionally, the conversion operators as listed in the Input Assistant are handled as keywords.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 635
Variables Declaration
Section 31.2
Variable Types
Variable Types
636 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Variable Types
Overview
This chapter provides further information on the following variable types:
VAR local variables (see page 637)
VAR_INPUT input variables (see page 637)
VAR_OUTPUT output variables (see page 638)
VAR_IN_OUT input and output variables (see page 638)
VAR_GLOBAL global variables (see page 639)
VAR_TEMP temporary variables (see page 639)
VAR_STAT static variables (see page 639)
VAR_EXTERNAL external variables (see page 640)
VAR_INST instance variables (see page 640)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 637
Variables Declaration
638 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 639
Variables Declaration
640 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Overview
You can add the following attribute keywords to the declaration (see page 621) of the variable type
in order to specify the scope:
RETAIN: refer to Retain Variables (see page 641)
PERSISTENT: refer to Persistent Variables (see page 642)
CONSTANT: refer to Constants - CONSTANT (see page 643), Typed Literals (see page 644)
Retain Variables
Variables declared as retain variables are stored in a nonvolatile memory area. To declare this kind
of variable, use the keyword RETAIN in the declaration part of a POU or in a global variable list.
Example
VAR RETAIN
iRem1 : INT; (* 1. Retain variable*)
END_VAR
Retain variables maintain their value even after an unanticipated shutdown of the controller as well
as after a normal power cycle of the controller (or when executing the Online command Reset
Warm). At restart of the program, the retained values will be processed further on. The other (non-
retain) variables are newly initialized, either with their initialization values or with their default
initialization values (in case no initialization value was declared).
For example, you may want to use a retained value when an operation, such as piece counting in
a production machine, should continue after a power outage.
Retain variables, however, are reinitialized when executing the Online command Reset origin and,
in contrast to persistent variables, when executing the Online command Reset cold or in the course
of an application download.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 641
Variables Declaration
NOTE: Only the specific variables defined as VAR RETAIN are stored in nonvolatile memory.
However, local variables defined as VAR RETAIN in functions are NOT stored in nonvolatile
memory. Defining VAR RETAIN locally in functions is of no effect.
Using interfaces or function blocks out of System Configuration libraries in the retain program
section (VAR_RETAIN) will cause system exceptions, which may make the controller inoperable,
requiring a re-start.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not use interfaces out of the SystemConfigurationItf library in the retain program section
(VAR_RETAIN).
Do not use function blocks out of the SystemConfiguration library in the retain program section
(VAR_RETAIN).
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: The libraries SystemConfigurationItf and SystemConfiguration are only available for
PacDrive controllers (PacDrive LMC Eco, PacDrive LMC Pro/Pro2).
Persistent Variables
Persistent variables are identified by keyword PERSISTENT (VAR_GLOBAL PERSISTENT). They
are only reinitialized when executing the Online command Reset origin. In contrast to retain
variables, they maintain their values after a download.
NOTE: Do not use the AT declaration in combination with VAR PERSISTENT.
Application example:
A counter for operating hours, which should continue counting even after a power outage or a
download. Refer to the synoptic table on the behavior of remanent variables (see page 643).
You can only declare persistent variables in a special global variable list of object type persistent
variables, which is assigned to an application. You can add only one such list to an application.
NOTE: A declaration with VAR_GLOBAL PERSISTENT has the same effect as a declaration with
VAR_GLOBAL PERSISTENT RETAIN or VAR_GLOBAL RETAIN PERSISTENT.
Like retain variables, the persistent variables are stored in a separate memory area.
Example
VAR_GLOBAL PERSISTENT RETAIN
iVarPers1 : DINT; (* 1. Persistent+Retain Variable App1 *)
bVarPers : BOOL; (* 2. Persistent+Retain Variable App1 *)
END_VAR
642 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
NOTE: Persistent variables can only be declared inside the Persistent list object. If they are
declared elsewhere, they will behave like retain variables and they will be reported as a detected
Build error in the Messages view. (Retain variables can be declared in the global variable lists or
in POUs.)
At each reload of the application, the persistent variable list on the controller will be checked
against that of the project. The list on the controller is identified by the application. In case of
inconsistencies, you will be prompted to reinitialize all persistent variables (see EcoStruxure
Machine Expert, Menu Commands, Online Help) of the application. Inconsistency can result from
renaming or removing or other modifications of the existing declarations in the list.
NOTE: Carefully consider any modifications in the declaration part of the persistent variable list and
the effect of the results regarding reinitialization.
You can add new declarations only at the end of the list. During a download, these are detected
as new and will not demand a reinitialization of the complete list. If you modify the name or data
type of a variable, this is handled as a new declaration and provokes a reinitialization of the variable
at the next online change or download.
Constants - CONSTANT
Constants are identified by the keyword CONSTANT. You can declare them locally or globally.
Syntax
VAR CONSTANT<identifier>:<type> := <initialization>;END_VAR
Example
VAR CONSTANT
c_iCon1:INT:=12; (* 1. Constant*)
END_VAR
Refer to the Operands chapter (see page 869) for a list of possible constants.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 643
Variables Declaration
Typed Literals
Basically, in using IEC constants, the smallest possible data type will be used. If another data type
has to be used, this can be achieved with the help of typed literals without the necessity of explicitly
declaring the constants. For this, the constant will be provided with a prefix which determines the
type.
Syntax
<type>#<literal>;
Example
iVar1:=DINT#34;
If the constant cannot be converted to the target type without data loss, a message is issued.
You can use typed literals wherever normal constants can be used.
644 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Overview
You can use the variable configuration to map function block variables on the process image that
is on the device I/Os. This avoids the need of specifying the definite address already in the
declaration of the function block variable. The assignment of the definite address (see page 887)
in this case is done centrally for all function block instances in a global VAR_CONFIG list.
For this purpose, you can assign incomplete addresses to the function block variables declared
between the keywords VAR and END_VAR. Use an asterisk to identify these addresses.
Identifier Syntax
<identifier> AT %<I|Q>* : <data type>
Example of the use of incompletely defined addresses:
FUNCTION_BLOCK locio
VAR
xLocIn AT %I*: BOOL := TRUE;
xLocOut AT %Q*: BOOL;
END_VAR
In this example, 2 local I/O variables are defined: a local input (%I*) and a local output variable
(%Q*).
Define the addresses in the variable configuration in a global variable list (GVL) as follows:
Step Action
1 Execute the Add Object command.
2 Add a Global Variable List (GVL) object to the Devices Tree.
3 Enter the declarations of the instance variables with the definite addresses
between the keywords VAR_CONFIG and END_VAR.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 645
Variables Declaration
646 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Section 31.3
Method Types
Method Types
FB_Init
By default, the FB_Init method is available implicitly. It is used by EcoStruxure Machine Expert
to initialize a function block or a structure.
In order to influence the initialization, you can explicitly declare the FB_Init method by extending
the given default initialization code. This allows you to evaluate the return value.
FB_Reinit
The FB_Reinit method must be declared explicitly.
If the FB_Reinit method is available, it is called after the instance of the corresponding function
block has been copied (during an online change (see page 648) after modifications in the function
block declaration). It reinitializes the new instance module. The return value is not evaluated. In
order to achieve that the base function block is reinitialized, call FB_Reinit explicitly for that
function block. This allows you to evaluate the return value.
FB_Exit
The FB_Exit method must be declared explicitly.
If there is an implementation, then the method is called before the controller removes the code of
the function block instance (implicit call). The return value is not evaluated.
The following paragraphs provide use cases of these methods for different operating conditions.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 647
Variables Declaration
First Download
When you download an application to a controller that is in default state, the memory locations of
the variables are set to the desired initial state. The data areas of function blocks are set to the
desired values. You can influence this process by explicitly implementing FB_Init for function
blocks in the program code of the application.
The method parameters bInCopyCode set to FALSE and bInitRetains set to TRUE indicate
that a first download is being executed.
Online Change
When an Online Change command (see EcoStruxure Machine Expert, Menu Commands, Online
Help) is executed, the methods FB_Exit, FB_Init, and FB_Reinit can be used to influence the
initialization of function blocks.
During online change, the modifications made to the application in offline mode are downloaded to
the controller. The instances of function blocks are updated by the new instances as follows:
If you have only made changes in the implementation part of the function block and not in the
declaration part, the data areas are not replaced. The methods FB_Init, FB_Reinit, and
FB_Exit are not called.
If you have made changes in the declaration part of a function block, the copy process described
in the FB_Reinit paragraph (see page 647) is performed when the Online Change command
(see EcoStruxure Machine Expert, Menu Commands, Online Help) is executed. A list of the objects
that have been changed since the last download is provided in the Application Information dialog
box (see page 262). Open this dialog box by clicking the Details... button in the dialog box where
you select the option Login with online change.
The FB_Init and FB_Reinit method parameters bInCopyCode set to TRUE and
bInitRetains set to FALSE indicate that an online change is being executed.
CAUTION
INVALID POINTER
Verify the validity of the pointers when using pointers on addresses and executing the Online
Change command.
Failure to follow these instructions can result in injury or equipment damage.
648 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
NOTE: If you add the pragma (see page 699) {attribute no_copy} to a variable of a function
block, this variable will not be copied during online change; it will only be initialized.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 649
Variables Declaration
Starting an Application
Before the first cycle of the tasks of an application is executed, the initial assignments are
processed.
Example:
T1 : TON := (PT:=t#500ms);
The assignments are executed after FB_Init has been called. To be able to verify the impacts of
these assignments, attach the {attribute call_after_init} pragma (see page 673) to a
function block and a method of a function block (for example, called MyInit). Insert this attribute
above the declaration part of the function block and above the declaration part of the corresponding
method. Attach this pragma also to function blocks that extend other function blocks which are
using the {attribute call_after_init} pragma. It is a good practice to assign the same
name, the same signature, and the same attribute to the corresponding method. To achieve this,
call SUPER^.MyInit. Select a method name of your choice (except FB_Init, FB_Reinit, and
FB_Exit). The method is called after the initial assignments have been processed and before the
tasks of an application are started.
NOTE: When the explicitly defined initialization code is executed, then the function block has
already been initialized completely via the implicit initialization code. Due to this, calling
SUPER^.FB_Init is not allowed.
650 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Example for the Call Order of Derived Function Blocks for FB_Exit and FB_Init
The following is assumed for the POUs named in this list: SubFB EXTENDS MainFB and
SubSubFB EXTENDS SubFB:
Step Action
1 fbSubSubFb.FB_Exit(...);
2 fbSubFb.FB_Exit(...);
3 fbMainFb.FB_Exit(...);
4 fbMainFb.FB_Init(...);
5 fbSubFb.FB_Init(...);
6 fbSubSubFb.FB_Init(...);
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 651
Variables Declaration
Section 31.4
Pragma Instructions
Pragma Instructions
652 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Pragma Instructions
Overview
A pragma instruction is used to affect the properties of 1 or several variables concerning the
compilation or precompilation (preprocessor) process. This means that a pragma influences the
code generation.
NOTE: Consider that the available pragmas are not 1:1 implementations of C preprocessor
directives. They are handled as normal statements and therefore can only be used at statement
positions. They must not be used within an expression and not in the declaration part of editors.
A pragma can determine whether a variable will be initialized, monitored, added to a parameter list,
added to the symbol list (see page 714), or made invisible in the Library Manager. It can force
message outputs during the build process. You can use conditional pragmas to define how the
variable should be treated depending on certain conditions. You can also enter these pragmas as
definitions in the compile properties of a particular object.
You can use a pragma in a separate line, or with supplementary text in an implementation or
declaration editor line. Within the FBD/LD/IL editor, execute the command Insert Label and replace
the default text Label: in the arising text field by the pragma. In case you want to set a label as
well as a pragma, insert the pragma first and the label afterwards.
The pragma instruction is enclosed in curly brackets.
Syntax
{ <instruction text> }
The opening bracket can immediately come after a variable name. Opening and closing brackets
have to be in the same line.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 653
Variables Declaration
654 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Further Information
Depending on the type and contents of a pragma, the pragma operates on the subsequent
statement, respectively all subsequent statements, until 1 of the following conditions is met:
It is ended by an appropriate pragma.
The same pragma is executed with different parameters.
The end of the code is reached.
The term code in this context refers to a declaration part, implementation part, global variable list,
or type declaration.
NOTE: Pragma instructions are case-sensitive.
If the compiler cannot meaningfully interpret the instruction text, the entire pragma is handled as a
comment and is skipped.
Refer to the following pragma types:
Message Pragmas (see page 656)
Attribute Obsolete (see page 709)
Attribute Pragmas (see page 669)
Conditional Pragmas (see page 658)
Region Pragmas (see page 666)
Attribute Symbol (see page 714)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 655
Variables Declaration
Message Pragmas
Overview
You can use message pragmas to force the output of messages in the Messages view (by default
in the Edit menu) during the compilation (build) of the project.
You can insert the pragma instruction in an existing line or in a separate line in the text editor of a
POU. Message pragmas positioned within currently not defined sections of the implementation
code will not be considered when the project is compiled. For further information, refer to the
example provided with the description of the defined (identifier) in the chapter Conditional Pragmas
(see page 658).
NOTE: For messages of types information, alert, and detected error, you can reach the source
position of the message - that is where the pragma is placed in a POU - by executing the command
Next Message. This is not possible for the text type.
656 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 657
Variables Declaration
Conditional Pragmas
Overview
The ExST (Extended ST) language supports several conditional Pragma Instructions
(see page 653), which affect the code generation in the precompile or compile process.
NOTE: Do not use any conditional pragmas in the declaration part. They are not regarded.
The implementation code which will be regarded for compilation can depend on the following
conditions:
Is a certain data type or variable declared?
Does a type or variable have a certain attribute?
Does a variable have a certain data type?
Is a certain POU or task available or is it part of the call tree, etc...
NOTE: It is not possible for a POU or GVL declared in the POUs Tree to use a {define...}
declared in an application. Definitions in applications will only affect interfaces inserted below the
respective application.
{define identifier string} During preprocessing, all subsequent instances of the identifier will be
replaced with the given sequence of tokens if the token string is not empty
(which is allowed and well-defined). The identifier remains defined and in
scope until the end of the object or until it is undefined in an {undefine}
directive. Used for conditional compilation (see page 659).
{undefine identifier} The preprocessor definition of the identifier (by {define}, see first
row of this table) will be removed and the identifier hence is undefined. If
the specified identifier is not currently defined, this pragma will be ignored.
{IF expr} These are pragmas for conditional compilation. The specified expressions
... exprs are required to be constant at compile time; they are evaluated in
{ELSIF expr} the order in which they appear until one of the expressions evaluates to a
... non-zero value. The text associated with the successful directive is
{ELSE} preprocessed and compiled normally; the others are ignored. The order of
... the sections is determinate; however, the elsif and else sections are
{END_IF} optional, and elsif sections may appear arbitrarily more often.
Within the constant expr, you can use several conditional compilation
operators (see page 659).
<expr> Within the constant expression expr of a conditional compilation pragma
({if} or {elsif}) (see previous table), you can use several operators.
These operators may not be undefined or redefined via {undefine} or
{define}, respectively.
You can also use these expressions as well as the definition completed by {define} in the
Compiler defines: text field in the Properties dialog box of an object (View → Properties → Build).
658 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
defined (identifier)
This operator affects that the expression gets value TRUE, as soon as the identifier has been
defined with a {define} instruction and has not been undefined later by an {undefine}
instruction. Otherwise its value is FALSE.
Example on defined (identifier):
Precondition: There are 2 applications App1 and App2. Identifier pdef1 is defined in App2, but not
in App1.
{IF defined (pdef1)}
(* this code is processed in App1 *)
{info 'pdef1 defined'}
hugo := hugo + SINT#1;
{ELSE}
(* the following code is only processed in application App2 *)
{info 'pdef1 not defined'}
hugo := hugo - SINT#1;
{END_IF}
Additionally, an example for a message pragma (see page 656) is included:
Only information pdef1 defined will be displayed in the Messages view when the application is
compiled because pdef1 is defined. The message pdef1 not defined will be displayed when
pdef1 is not defined.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 659
Variables Declaration
defined (variable:variable)
When applied to a variable, its value is TRUE if this particular variable is declared within the current
scope. Otherwise it is FALSE.
Example on defined (variable:variable):
Precondition: There are 2 applications App1 and App2. Variable g_bTest is declared in App2,
but not in App1.
{IF defined (variable:g_bTest)}
(* the following code is only processed in application App2 *)
g bTest := x > 300;
{END_IF}
defined (type:identifier)
When applied to a type identifier, its value is TRUE if a type with that particular name is declared.
Otherwise it is FALSE.
Example on defined (type:identifier) :
Precondition: There are 2 applications App1 and App2. Data type DUT is defined in App2, but not
in App1.
{IF defined (type:DUT)}
(* the following code is only processed in application App1 *)
bDutDefined := TRUE;
{END_IF}
defined (pou:pou-name)
When applied to a POU name, its value is TRUE if a POU or an action with that particular POU
name is defined. Otherwise it is FALSE.
Example on defined (pou: pou-name):
Precondition: There are 2 applications App1 and App2. POU CheckBounds is available in App2,
but not in App1.
{IF defined (pou:CheckBounds)}
(* the following code is only processed in application App1 *)
arrTest[CheckBounds(0,i,10)] := arrTest[CheckBounds(0,i,10)] + 1;
{ELSE}
(* the following code is only processed in application App2 *)
arrTest[i] := arrTest[i]+1;
{END_IF}
660 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 661
Variables Declaration
662 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 663
Variables Declaration
NOT operator
The expression gets value TRUE when the inverted value of operator is TRUE. operator can
be one of the operators described in this chapter.
Example on NOT operator:
Precondition: There are 2 applications App1 and App2. POU PLC_PRG1 is used in App1 and
App2. POU CheckBounds is only available in App1:
{IF defined (pou: PLC_PRG1) AND NOT (defined (pou: CheckBounds))}
(* the following code line is only executed in App2 *)
bANDNotTest := TRUE;
{END_IF}
AND operator
The expression gets value TRUE if both operators are TRUE. operator can be one of the
operators listed in this table.
Example on AND operator:
Precondition: There are 2 applications App1 and App2. POU PLC_PRG1 is used in applications
App1 and App2. POU CheckBounds is only available in App1:
{IF defined (pou: PLC_PRG1) AND (defined (pou: CheckBounds))}
(* the following code line will be processed only in applications App1,
because only there "PLC_PRG1" and "CheckBounds" are defined *)
bORTest := TRUE;
{END_IF}
664 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
OR operator
The expression is TRUE if one of the operators is TRUE. operator can be one of the operators
described in this chapter.
Example on OR operator:
Precondition: POU PLC_PRG1 is used in applications App1 and App2. POU CheckBounds is only
available in App1:
{IF defined (pou: PLC_PRG1) OR (defined (pou: CheckBounds))}
(* the following code line will be processed in applications App1 and A
pp2, because both contain at least one of the POUs "PLC_PRG1" and "Chec
kBounds" *)
bORTest := TRUE;
{END_IF}
(operator)
(operator) braces the operator.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 665
Variables Declaration
Region Pragmas
Overview
Use region pragmas to group several lines into one block in a text editor. You can assign a name
to the block. Region pragmas can be nested.
The figure shows a program code that contains a region pragma in the extended and in the
collapsed view.
Region pragmas can be used in the ST editor and in the declaration editors. You can adapt syntax
highlighting to your individual requirements in the Tool → Options → Syntax Highlighting dialog
box (see EcoStruxure Machine Expert, Menu Commands, Online Help).
666 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Section 31.5
Attribute Pragmas
Attribute Pragmas
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 667
Variables Declaration
Topic Page
Attribute no_virtual_actions 703
Attribute pingroup 705
Attribute pin_presentation_order_inputs/outputs 707
Attribute obsolete 709
Attribute pack_mode 710
Attribute qualified_only 711
Attribute reflection 712
Attribute subsequent 713
Attribute symbol 714
Attribute warning disable 716
Attribute enable_dynamic_creation 717
668 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute Pragmas
Overview
You can assign attribute pragmas (see page 653) to a signature in order to influence the
compilation or pre-compilation that is the code generation.
There are user-defined attributes (see page 670), which you can use in combination with
conditional pragmas (see page 658).
Attributes are defined within the declaration part. An exception is made for the action and transition
objects which do not have a declaration part. You can define the attributes at the beginning of the
implementation part.
There are also the following predefined standard attribute pragmas:
attribute displaymode (see page 679)
attribute ExpandFully (see page 681)
attribute global_init_slot (see page 682)
attribute hide (see page 684)
attribute hide_all_locals (see page 685)
attribute initialize_on_call (see page 686)
attribute init_namespace (see page 687)
attribute init_On_Onlchange (see page 688)
attribute instance-path (see page 689)
attribute linkalways (see page 690)
attribute monitoring (see page 691)
attribute no_check (see page 698)
attribute no_copy (see page 699)
attribute no-exit (see page 700)
attribute noinit (see page 701)
attribute no_virtual_actions (see page 703)
attribute obsolete (see page 709)
attribute pack_mode (see page 710)
attribute qualified_only (see page 711)
attribute reflection (see page 712)
attribute subsequent (see page 713)
attribute symbol (see page 714)
attribute warning disable (see page 716)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 669
Variables Declaration
User-Defined Attributes
Overview
You can assign arbitrary user-defined or application-defined attribute pragmas to POUs, type
declarations, or variables. This attribute can be queried before compilation by conditional pragmas
(see page 658).
Syntax
{attribute 'attribute'}
This pragma instruction is valid for the subsequent POU declaration or variable declaration.
You can assign a user-defined attribute to:
a POU or action
a variable
a data type
Example on Variables
Attribute DoCount for variable ivar :
PROGRAM PLC_PRG
VAR
{attribute 'DoCount'};
ivar:INT;
bvar:BOOL;
END_VAR
670 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Example on Types
Attribute aType for data type DUT_1:
{attribute 'aType'}
TYPE DUT_1 :
STRUCT
a:INT;
b:BOOL;
END_STRUCT
END_TYPE
For the usage of conditional pragmas, refer to the chapter Conditional Pragmas (see page 658).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 671
Variables Declaration
Attribute call_after_global_init_slot
Overview
All functions and programs containing this attribute in an own line above their declaration part are
called after the global initialization (GlobalInit). The calling sequence is determined by the
attribute value.
NOTE: Compile errors will be detected (during code generation) if VAR_INPUT declarations are
used in functions or methods that contain this attribute. The reason is that the input variables are
unknown when the function is called implicitly during online change.
Syntax
{attribute 'call_after_global_init_slot' := '<slot>'}
Replace <slot> by an integer value defining the priority within the calling sequence: The lower
the value, the earlier the call. In case of several signatures carrying the same value for the attribute,
the sequence of their initialization remains undefined.
If a method is provided with the attribute, then it is called for all instances of the concerned function
block. All instances are called within the specified slot; however, you cannot control the order
among the instances themselves.
672 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute call_after_init
Overview
Use the pragma {attribute call_after_init} to define a method that is called implicitly
after the initialization of a function block instance. For performance reasons, attach the attribute
both to the function block itself and to the instance method to be called. The method has to be
called after FB_Init (see page 650) and after having applied the variable values of an initialization
expression in the instance declaration.
NOTE: Compile errors will be detected if VAR_INPUT declarations are used in methods that
contain this attribute. The reason is that the input variables are unknown when the method is called
implicitly during online change.
Syntax
{attribute 'call_after_init'}
Example
With the following definition:
{attribute 'call_after_init'}
FUNCTION_BLOCK FB
... <functionblock definition>
{attribute 'call_after_init'}
METHOD FB_AfterInit
... <method definition>
... declaration like the following:
inst : FB := (in1 := 99);
... will result in the following order of code processing:
inst.FB_Init();
inst.in1 := 99;
inst.FB_AfterInit();
So, in FB_Afterinit, you can react on the user-defined initialization.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 673
Variables Declaration
Attribute call_after_online_change_slot
Overview
All functions and programs containing this attribute in an own line above their declaration part are
called after an online change. The calling sequence is determined by the attribute value.
NOTE: Compile errors will be detected (during code generation) if VAR_INPUT declarations are
used in functions or methods that contain this attribute. The reason is that the input variables are
unknown when the function is called implicitly during online change.
Syntax
{attribute 'call_after_online_change_slot' := '<slot>'}
Replace <slot> by an integer value defining the priority within the calling sequence: The lower
the value, the earlier the call. If several modules have the same priority value for the attribute, then
the order in which they are called remains undefined.
If a method is provided with the attribute, then it is called for all instances of the concerned function
block. All instances are called within the specified slot; however, you cannot control the order
among the instances themselves.
NOTE: As the application cannot run during an online change, each code executed in this situation
can effect jitter. For this reason, minimize the code to be executed.
674 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute call_before_global_exit_slot
Overview
All functions and programs containing this attribute in an own line above their declaration part are
called after the GlobalExit. The GlobalExit is executed before a new download, at a reset,
or during an online change and affects modules which are provided with an FB_exit method. The
calling sequence is determined by the attribute value.
NOTE: Compile errors will be detected (during code generation) if VAR_INPUT declarations are
used in functions or methods that contain this attribute. The reason is that the input variables are
unknown when the function is called implicitly during online change.
Syntax
{attribute 'call_before_global_exit_slot' := '<slot>'}
Replace <slot> by an integer value defining the priority within the calling sequence: The lower
the value, the earlier the call. If several modules have the same priority value for the attribute, then
the order in which they are called remains undefined.
If a method is provided with the attribute, then it is called for all instances of the concerned function
block. All instances are called within the specified slot; however, you cannot control the order
among the instances themselves.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 675
Variables Declaration
Attribute call_on_type_change
Overview
Attach the Attribute call_on_type_change pragma to methods of a function block A in
order to achieve that this method is called when the data type is changed for one or more function
blocks B, C, etc. that are referenced by A. The function blocks can be referenced by pointers
(see page 734) or references (see page 732).
Syntax
{attribute 'call_on_type_change':= '<name of the first referenced function block>|<name of the
second referenced function block>|<name of the nth referenced function block>'}
Insert the Attribute call_on_type_change above the first line in the method declaration.
Examples
Example of a function block with references:
FUNCTION_BLOCK FB_A
...
VAR
var_pt: POINTER TO FB_B;
var_ref: REFERENCE TO FB_C;
END_VAR
...
Example of a method that is called when data types are changed in the referenced function blocks
FB_B and FB_C:
{attribute 'call_on_type_change' := 'FB_B,
FB_C'}
METHOD METH_react_on_type_change : INT
VAR_INPUT
...
676 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Overview
Insert the pragma {attribute 'const_replaced'} in the declaration of a global constant if
you explicitly want to activate the compiler option Replace constants for this constant. This has the
effect that the constant becomes available in the Symbol Configuration.
Correspondingly, you can insert the pragma {attribute 'const_non_replaced'} in order
to deactivate the compiler option Replace constants.
The option Replace constants is pre-defined for the whole project in the Project Settings →
Compile options dialog box (see EcoStruxure Machine Expert, Menu Commands, Online Help).
Syntax
{attribute 'const_replaced'}
{attribute 'const_non_replaced'}
Example
The constants iTestCon and bTestCon are available in the Symbol Configuration because
Replace constants is deactivated by pragmas.
VAR_GLOBAL CONSTANT
{attribute 'const_non_replaced'}
iTestCon : INT := 12;
{attribute 'const_non_replaced'}
bTestCon : BOOL := TRUE;
rTestCon : REAL := 1.5;
END_VAR
VAR_GLOBAL
iTestVar : INT := 12;
bTestVar : BOOL := TRUE;
END_VAR
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 677
Variables Declaration
Attribute 'dataflow'
Overview
The pragma {attribute 'dataflow'} enables you to control the dataflow when processing
function blocks in the FBD/LD/IL editor. The attribute defines the input or output of a function block
that is used as the connection to the next or previous function block.
You can assign this attribute to only one input and one output in the declaration of the function
block.
For function blocks without the {attribute 'dataflow'}, the dataflow is determined
automatically as follows:
The connection is established between an output and an input of the same type. The uppermost
input and output variables of the function block are used first. If there are no variables with the
same data type, then the uppermost output is connected to the uppermost input of the next function
block.
You can also change the control flow in the editor by using the pointer to connect the connector
pins of the function block to other positions. For further information, refer to the description of
Inserting, Arranging, and Replacing Elements (see page 305).
Syntax
{attribute 'dataflow'}
Example
The FB and the previous function block are connected using the input variable i1. The FB and the
next function block are connected using the output variable outRes1.
FUNCTION_BLOCK FB
VAR_INPUT
r1 : REAL;
{attribute 'dataflow'}
i1 : INT;
i2 : INT;
r2 : REAL;
END_VAR
VAR_OUTPUT
{attribute 'dataflow'}
outRes1 : REAL;
out1 : INT;
g1 : INT;
g2 : REAL;
END_VAR
678 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute displaymode
Overview
Use the pragma {attribute displaymode} to define the display mode of a single variable.
This setting will overwrite the global setting for the display mode of all monitoring variables done
via the commands of the submenu Display Mode (by default in the Online menu).
Position the pragma in the line above the line containing the variable declaration.
Syntax
{attribute 'displaymode':=<displaymode>}
The following definitions are possible:
- to display in binary format
{attribute 'displaymode':='bin'}
{attribute 'displaymode':='binary'}
- to display in decimal format
{attribute 'displaymode':='dec'}
{attribute 'displaymode':='decimal'}
- to display in hexadecimal format
{attribute 'displaymode':='hex'}
{attribute 'displaymode':='hexadecimal'}
Example
VAR
{attribute 'displaymode':='hex'}
dwVar1: DWORD;
END_VAR
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 679
Variables Declaration
Attribute estimated-stack-usage
Overview
The pragma {attribute 'estimated-stack-
usage' := '<allowed stack size in bytes>'} helps to prevent runtime systems with
an active stack check from issuing a message indicating that there is insufficient space in the stack.
This check is performed during the code generation. For recursive methods, you may want to
reduce the number of messages.
Syntax
{attribute 'estimated-stack-usage' := '<allowed stack size in bytes>'}
Insert Location
Insert this pragma in the line above the METHOD declaration in the declaration section of the
relevant method.
Example
{attribute 'estimated-stack-usage' := '99'}
METHOD xxMETH : INT
VAR_INPUT
END_VAR
VAR next: AFB;
big: ARRAY[0..100] OF DINT;
END_VAR
[Link]();
680 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute ExpandFully
Overview
Use the pragma {attribute 'ExpandFully'} to make all members of arrays used as input
variables for referenced visualizations accessible within the Visualization Properties dialog box.
Syntax
{attribute 'ExpandFully'}
Example
Visualization visu is intended to be inserted in a frame within visualization visu_main.
As input variable arr is defined in the interface editor of visu and will later be available for
assignments in the Properties dialog box of the frame in visu_main.
In order to get the available particular components of the array in the Properties dialog box, insert
the attribute ExpandFully in the interface editor of visu directly before arr.
Declaration in the interface editor of visu:
VAR_INPUT
{attribute 'ExpandFully'}
arr : ARRAY[0..5] OF INT;
END_VAR
Resulting Properties dialog box of frame in visu_main:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 681
Variables Declaration
Attribute global_init_slot
Overview
The pragma {attribute 'global_init_slot'} defines the sequence of initialization of
POUs or global variable lists.
Variables in a list (GVL or POU) are initialized from top to bottom.
If there are several global variable lists available, then the sequence of initialization is not defined.
The sequence of initialization is irrelevant for literal values, such as 1, 'hello', 3.6, or for
constants of base data types. However, if there are dependencies between the different lists, you
must define the sequence of initialization by yourself. To achieve this, you can assign a defined
initialization slot to a GVL or a POU using the attribute global_init_slot.
Syntax
{attribute 'global_init_slot' := '<slot>'}
Replace <slot> by an integer value that defines the position in the initialization order. The default
value for a POU (program, function block) is 50,000. The default value for a GVL is 49,990. A lower
value provokes an earlier initialization. In case of several POUs or GVLs carrying the same value
for the attribute global_init_slot, the sequence of their initialization remains undefined. This
will be indicated as a detected programming error in the Build category of the Messages view
(see EcoStruxure Machine Expert, Menu Commands, Online Help).
The pragma {attribute 'global_init_slot'} is valid for the entire GVL or POU and must
therefore be located above the VAR_GLOBAL or POU declaration.
682 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Example
The example includes 2 global variable lists GVL_1 and GVL_2 and a program PLC_PRG that uses
variables from both lists.
GVL_1 uses the variable B for initializing a variable A which is initialized in the GVL_2 with a value
of 1000.
GVL_1:
VAR_GLOBAL //49990
A : INT := GVL_2.B*100;
END_VAR
GVL_2:
VAR_GLOBAL //49990
B : INT := 1000;
C : INT := 10;
END_VAR
PLC_PRG:
PROGRAM PLC_PRG //50000
VAR
ivar: INT := GVL_1.A;
ivar2: INT;
END_VAR
ivar:=ivar+1;
ivar2:=GVL_2.C;
When building this example, a programming error is issued in the Build category of the Messages
view (see EcoStruxure Machine Expert, Menu Commands, Online Help) because GVL_2.B is
used for initializing GVL_1.A before GVL_2 has been initialized. To avoid this, use the
attribute global_init_slot in order to position GVL_2 before GVL_1 in the sequence of
initialization.
GVL_2 must have a slot value of 49989 or lower to achieve the earliest initialization within the
program.
GVL_2:
{attribute 'global_init_slot' := '100'}
VAR_GLOBAL
B : INT := 1000;
C : INT := 10;
END_VAR
You can even use GVL_2.C in the implementation part of PLC_PRG without a pragma because
both GVLs are initialized before the program in either case.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 683
Variables Declaration
Attribute hide
Overview
The pragma {attribute hide} helps you to prevent variables or even whole signatures from
being displayed within the functionality of listing components (see page 718) or the input assistant
or the declaration part in online mode. Only the variable subsequent to the pragma will be hidden.
Syntax
{attribute 'hide'}
To hide all local variables of a signature, use the attribute hide_all_locals (see page 685).
Example
The function block myPOU is implemented using the attribute:
FUNCTION_BLOCK myPOU
VAR_INPUT
a:INT;
{attribute 'hide'}
a_invisible: BOOL;
a_visible: BOOL;
END_VAR
VAR_OUTPUT
b:INT;
END_VAR
In the main program 2 instances of function block myPOU are defined:
PROGRAM PLC_PRG
VAR
POU1, POU2: myPOU;
END_VAR
When assigning an input value to POU1, the functionality of listing components (see page 718) that
works on typing POU1 in the implementation part of PLC_PRG will display the input variables a and
a_visible (and the output variable b). The hidden input variable a_invisible will not be
displayed.
684 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute hide_all_locals
Overview
The pragma {attribute 'hide_all_locals'} helps you to prevent all local variables of a
signature from being displayed within the functionality of listing components (see page 718) or the
input assistant. This attribute is identical to assigning the attribute hide (see page 684) to each
particular of the local variables.
Syntax
{attribute 'hide_all_locals'}
Example
The function block myPOU is implemented using the attribute:
{attribute 'hide_all_locals'}
FUNCTION_BLOCK myPOU
VAR_INPUT
a:INT;
END_VAR
VAR_OUTPUT
b:BOOL;
END_VAR
VAR
c,d:INT;
END_VAR
In the main program 2 instances of function block myPOU are defined:
PROGRAM PLC_PRG
VAR
POU1, POU2: myPOU;
END_VAR
When assigning an input value to POU1, the functionality of listing components (see page 718) that
works on typing POU1 in the implementation part of PLC_PRG will display the variables a and b.
The hidden local variables c or d will not be displayed.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 685
Variables Declaration
Attribute initialize_on_call
Overview
You can add the pragma {attribute initialize_on_call} to input variables. An input of a
function block with this attribute will be initialized at any call of the function block. If an input expects
a pointer and if this pointer has been removed due to an online change, then the input will be set
to NULL.
Syntax
{attribute 'initialize_on_call'}
686 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute init_namespace
Overview
A variable of type STRING or WSTRING, which is declared with the pragma
{attribute init_namespace} in a library, will be initialized with the current namespace of
that library. For further information, refer to the description of the library management
(see EcoStruxure Machine Expert, Functions and Libraries User Guide).
Syntax
{attribute 'init_namespace'}
Example
The function block POU is provided with all necessary attributes:
FUNCTION_BLOCK POU
VAR_OUTPUT
{attribute 'init_namespace'}
myStr: STRING;
END_VAR
Within the main program PLC_PRG an instance fb of the function block POU is defined:
PROGRAM PLC_PRG
VAR
fb:POU;
newString: STRING;
END_VAR
newString:=[Link];
The variable myStr will be initialized with the current namespace, for example [Link]. This
value will be assigned to newString within the main program.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 687
Variables Declaration
Attribute init_On_Onlchange
Overview
To initialize variables on online change, proceed as follows:
Step Action
1 Attach the pragma {attribute 'init_on_onlchange'} to a variable to initialize this
variable with each online change (see page 261).
2 Open the Build tab of the Properties dialog box of the application (see EcoStruxure Machine
Expert, Menu Commands, Online Help) and enter the string no_fast_online_change in the
Compiler defines box.
Syntax
{attribute 'init_on_onlchange' }
Insert Location
Insert this pragma in the line above the declaration of the variables.
688 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute instance-path
Overview
You can add the pragma {attribute instance-path} to a local string variable. This local
string variable will be initialized with the Applications tree path of the POU to which this string
variable belongs. Applying this pragma presumes the use of the attribute reflection (see page 712)
for the corresponding POU and the additional attribute noinit (see page 701) for the string variable.
Syntax
{attribute 'instance-path'}
Example
Assume the following function block POU being equipped with the attribute 'reflection':
{attribute 'reflection'}
FUNCTION_BLOCK POU
VAR
{attribute 'instance-path'}
{attribute 'noinit'}
str: STRING;
END_VAR
In the main program PLC_PRG an instance myPOU of function block POU is called:
PROGRAM PLC_PRG
VAR
myPOU:POU;
myString: STRING;
END_VAR
myPOU();
myString:=[Link];
After initialization of instance myPOU, the string variable str gets assigned the path of instance
myPOU, for example: [Link].PLC_PRG.myPOU. This path will be assigned to
variable myString within the main program.
NOTE: The length of a string variable may be arbitrarily defined (even >255). However, the string
will be cut (from its back end) if it gets assigned to a string variable of a shorter length.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 689
Variables Declaration
Attribute linkalways
Overview
Use the pragma {attribute 'linkalways'} to mark POUs or global variable lists for the
compiler in a way so that they are always included into the compile information. As a result, objects
with this option will always be compiled and downloaded to the controller. The compiler option Link
always affects the same.
Syntax
{attribute 'linkalways'}
When you use the symbol configuration editor, the marked POUs are used as a basis for the
selectable variables for the symbol configuration.
Example
The global variable list GVLMoreSymbols is implemented making use of the attribute
'linkalways':
{attribute 'linkalways'}
VAR_GLOBAS
g_iVar1: INT;
g_iVar2: INT;
END_VAR
With this code, the symbols of GVLMoreSymbols become selectable in the Symbol configuration.
690 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute monitoring
Overview
This attribute pragma allows you to get properties and function call results monitored in the online
view of the IEC editor or in a watch list.
Monitoring of Properties
Add the pragma in the line above the property definition. Then the name, type, and value of the
variables of the property will be displayed in the online view of the POU using the property or in a
watch list. Therein, you can also enter prepared values to force variables belonging to the property.
Example of property prepared for variable monitoring
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 691
Variables Declaration
692 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 693
Variables Declaration
NOTE: Forcing or writing of functions is not supported. You can implicitly implement forcing by
adding an additional input parameter for the particular function that serves as an internal force flag.
NOTE: Function monitoring is not possible on the compact runtime system.
694 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute namespace
Overview
In combination with the attribute symbol (see page 714), the pragma {attribute namespace}
allows you to redefine the namespace of project variables. You can apply it on complete POUs,
like GVLs or programs, but not on particular variables. The concerned variables will be exported
with the new namespace definition to a symbol file and after a download of this file be available on
the controller.
This also allows you to access variables from POUs or visualizations which originally have got
different namespaces. For example, it allows you to run a previous EcoStruxure Machine Expert
visualization also in a later EcoStruxure Machine Expert environment.
For further information, refer to the description of the symbol configuration. A new symbol file will
be created at a download or online change of the project. It is downloaded to the controller together
with the application.
Syntax
{attribute 'namespace' := '<namespace>'}
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 695
Variables Declaration
The replacements shown in the table result in the following entries in the symbol file:
<NodeList>
<Node name="">
<Node name="Var07" type="T_INT" access="ReadWrite">
</Node>
</NodeList>
<NodeList>
<Node name="Ext">
<Node name="Var02 " type="T_INT" access="ReadWrite"></Node>
</Node>
</NodeList>
<NodeList>
<Node name="App1">
<Node name="GVL2">
<Node name="Var02 " type="T_INT" access="ReadWrite"></Node>
</Node>
</Node>
</NodeList>
696 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute no_assign
Overview
Insert the pragma {attribute 'no assign'} as first line of the declaration part of a function
block. This has the effect that compile errors are generated if an instance of the function block is
assigned to another instance of the same function block. For example, you might want to avoid
such assignments if the function block contains pointers. This could cause issues because they
are copied when values are assigned.
NOTE: Use the {attribute 'no assign'} in function blocks with internal pointers to help to
avoid assigning an instance of the function block to another instance of the same function block.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 697
Variables Declaration
Attribute no_check
Overview
You can add the pragma {attribute 'no_check'} to the declaration of a POU in order to
suppress the call of any POUs for implicit checks. As checking functions may influence the
performance, apply this attribute to POUs that are frequently called or already approved.
NOTE: This attribute has an automatic effect also on the child objects of a POU.
Example: In programs with this attribute, no check functions are executed. Not even for actions that
are assigned to this program.
Syntax
{attribute 'no_check'}
698 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute no_copy
Overview
Generally, an online change will require a reallocation of instances, for example of POUs. The
value of the variables within this instance will get copied.
If, however, the pragma {attribute no_copy} is added to a variable, an online change copy
of this variable will not be performed; this variable will be initialized instead. This can be reasonable
in case of local pointer variable, pointing on a variable actually shifted by the online change (and
thus having a modified address).
Syntax
{attribute 'no_copy'}
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 699
Variables Declaration
Attribute no-exit
Overview
If a function block provides an FB_exit method (see page 647) , you can suppress its call for a
special instance with the help of assigning the pragma {attribute no-exit} to the function
block instance.
Syntax
{attribute 'no-exit'}
Example
Assume the method FB_Exit being added to a function block named POU:
700 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute no_init
Overview
Variables provided with the pragma {attribute no_init} will not be initialized implicitly. The
pragma belongs to the variable declared subsequently.
Syntax
{attribute 'no_init'}
also possible
{attribute 'no-init'}
{attribute 'noinit'}
Example
PROGRAM PLC_PRG
VAR
A : INT;
{attribute 'no_init'}
B : INT;
END_VAR
If a reset is performed on the associated application, the integer variable A will be again initialized
implicitly with 0, whereas variable B maintains the value it is currently assigned to.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 701
Variables Declaration
Attribute no_instance_in_retain
Overview
The pragma {attribute 'no_instance_in_retain'} helps to avoid that the instance of a
certain function block instance is stored in the retain memory area.
Insert it as first line of the declaration of the function block. This has the effect that a message is
created in case any instance of the POU is declared as a RETAIN variable.
Syntax
{attribute 'no_instance_in_retain'}
702 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute no_virtual_actions
Overview
This attribute is valid for function blocks, which are derived from a base function block implemented
in SFC, and which are using the main SFC workflow of the base class. The actions called therein
show the same virtual behavior as methods. This means that the base class actions may be
overridden by specific implementations related to the derived classes.
In order to help to prevent the action of the base class from being overridden, you can assign the
pragma {attribute 'no_virtual_actions'} to the base class.
Syntax
{attribute 'no_virtual_actions'}
Example
In the following example, the function block POU_SFC provides the base class to be extended by
the function block POU_child.
By use of the keyword SUPER, the derived class POU_child calls the workflow of the base class
that is implemented in SFC.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 703
Variables Declaration
The exemplary implementation of this workflow is restricted to the initial step. This is followed by
1 single step with associated step action ActiveAction concerned with the assignment of the
output variables:
an_int:=an_int+1; // counting the action calls
test_act:='father_action'; // writing string variable test_act
METH(); // Calling method METH for writing string var
iable test_meth
In case of the derived class POU_child, the step action will be overwritten by a specific implemen-
tation of ActiveAction. It differs from the original one by assigning the string 'child_action'
instead of 'father_action' to variable test_act.
Likewise, the method METH, assigning the string 'father_method' to variable test_meth
within the base class, will be overwritten such that test_meth will be assigned to
'child_method' instead.
The main program PLC_PRG will execute repeated calls to Child (an instance of POU_child). As
expected, the actual value of the output string report the call to action and method of the derived
class:
You can observe a different behavior if the base class is preceded by the attribute
'no_virtual_actions'
{attribute 'no_virtual_actions'}
FUNCTION_BLOCK POU_SFC...
Whereas method METH will still be overwritten by its implementation within the derived class, a call
of the step action will now result in a call of action ActiveAction of the base class. Therefore,
test_act will be assigned to string 'father_action'.
704 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute pingroup
Overview
Insert the pragma {attribute 'pingroup' := '<groupname>'} in the declaration of a
function block, for grouping the input pins or output pins (parameters). Then, in the respective box
of the FBD and LD editor, each pin group can be displayed, folded, or unfolded. Multiple groups
are possible and are differentiated by their names. The particular state (folded/unfolded) per box
is saved in the project options.
Inputs and outputs without attribute pingroup are always displayed above any possible group or
groups.
Syntax
{attribute 'pingroup' := '<groupname>'}
Example
Two groups are defined:
general (i1, out1)
group1 (i2, g1)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 705
Variables Declaration
706 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute pin_presentation_order_inputs/outputs
Overview
The pragmas define the order in which the inputs and outputs of a function block are displayed in
graphical language editors.
Syntax
{attribute 'pin_presentation_order_inputs' :=
'<input_k>,<input_l>,*,<input_m>'}
{attribute 'pin_presentation_order_outputs' :=
'<output_k>,<output_l>,*,<output_m>'}
The * character is the separator between the beginning and the end of the sorted list of input or
output parameters. The separator is replaced by undefined input or output parameters. If the
separator is not available, then the input or output parameters that are not defined explicitly in the
pragma will be added to the end of the sorted list.
The pragmas are inserted in the first line in the declaration part of a function block.
NOTE: The pragmas attribute 'pin_presentation_order_inputs and
attribute 'pin_presentation_order_outputs are not evaluated when the pragma
pingroup is used.
Example
{attribute 'pin_presentation_order_inputs' :=
'input_2,*,input_1'}
{attribute 'pin_presentation_order_outputs' :=
'output_2, output_1}
FUNCTION_BLOCK POU_BASE
VAR_INPUT
input_1 : BOOL;
input_2 : INT;
input_3 : INT;
input_4 : INT;
END_VAR
VAR_OUTPUT
output_1 : BOOL;
output_2 : INT;
output_3 : INT;
output_4 : BOOL;
END_VAR
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 707
Variables Declaration
This sample pragma definition leads to the following order of the input and output pins of the
POU_Base function block:
708 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute obsolete
Overview
You can add an obsolete pragma to a data type definition in order to cause a user-defined alert
during a build, if the respective data type (structure, function block, and so on) is used within the
project. Thus, you can announce that the data type is not used any longer.
Unlike a locally used message pragma (see page 656), this alert is defined within the definition and
thus global for all instances of the data type.
This pragma instruction is valid for the current line or - if placed in a separate line - for the
subsequent line.
Syntax
{attribute 'obsolete' := 'user-defined text'}
Example
The obsolete pragma is inserted in the definition of function block fb1:
{attribute 'obsolete' := 'datatype fb1 not valid!'}
FUNCTION_BLOCK fb1
VAR_INPUT
i:INT;
END_VAR
...
If fb1 is used as a data type in a declaration, for example, fbinst: fb1; the following alert will
be dumped when the project is built:
'datatype fb1 not valid'
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 709
Variables Declaration
Attribute pack_mode
Overview
The pragma {attribute 'pack_mode'} defines the mode a data structure is packed while
being allocated. Set the attribute on top of a data structure. It influences the packing of the whole
structure.
Syntax
{attribute 'pack_mode' := '<value>'}
The placeholder <value> can have the following values:
Depending on the structure, there may be no difference in the memory mapping of the individual
modes. For example, the memory allocation of a structure with pack_mode = 4 can correspond
to that of pack_mode = 8.
If structures are combined to arrays, bytes are added at the end of each structure to achieve that
the next structure is aligned.
Example
{attribute 'pack_mode' := '1'}
TYPE myStruct:
STRUCT
Enable: BOOL;
Counter: INT;
MaxSize: BOOL;
MaxSizeReached: BOOL;
END_STRUCT
END_TYPE
A variable of data type myStruct is instantiated aligned.
If the address of its component Enable is 0x0100, then the component Counter will follow on
address 0x0101, MaxSize on 0x0103 and MaxSizeReached on 0x0104.
With pack_mode=2, Counter would be found on 0x0102, MaxSize on 0x0104 and
MaxSizeReached on 0x0106.
710 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute qualified_only
Overview
When the pragma {attribute 'qualified_only'} is assigned on top of a global variable
list, the variables of this list can only be accessed by using the global variable name, for example
gvl.g_var. This works even for variables of enumeration type. It can be useful to avoid name
mismatch with local variables.
Syntax
{attribute 'qualified_only'}
Example
Assume the following global variable list (GVL) is provided with attribute 'qualified_only':
{attribute 'qualified_only'}
VAR_GLOBAL
iVar:INT;
END_VAR
Within POU PLC_PRG, the global variable has to be called with the prefix GVL, as shown in this
example:
[Link]:=5;
The following incomplete call of the variable will be detected as an error:
iVar:=5;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 711
Variables Declaration
Attribute reflection
Overview
The pragma {attribute 'reflection'} is attached to signatures. Due to performance
reasons, it is an obligatory attribute for POUs carrying the instance-path attribute
(see page 689).
Syntax
{attribute 'reflection'}
Example
Refer to the attribute instance-path example (see page 689).
712 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute subsequent
Overview
The pragma {attribute 'subsequent'} forces variables to be allocated in a row at one
location in memory. If the list changes, the whole list will be allocated at a new location. This
pragma is used in programs and global variable lists (GVL).
Syntax
{attribute 'subsequent'}
NOTE: If one variable in the list is RETAIN, the whole list will be located in retain memory.
NOTE: VAR_TEMP in a program with attribute subsequent will be detected as a compiler error.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 713
Variables Declaration
Attribute symbol
Overview
The pragma {attribute 'symbol'} defines which variables are to be handled in the symbol
configuration.
The following export operations are performed on the variables:
Variables are exposed as symbols in the symbol configuration.
Variables are exported to an XML file in the project directory.
Variables are exported to a file not visible and available on the target system for external access,
for example, by an OPC server.
Variables provided with that attribute will be downloaded to the controller even if they have not
been configured or are not visible within the symbol configuration editor.
NOTE: The symbol configuration has to be available as an object below the respective application
in the Tools Tree.
Syntax
{attribute 'symbol' := 'none' | 'read' | 'write' | 'readwrite'}
Access is only allowed on symbols coming from programs or global variable lists. For accessing a
symbol, specify the symbol name completely.
You can assign the pragma definition to particular variables or collectively to all variables declared
in a program.
To be valid for a single variable, place the pragma in the line before the variable declaration.
To be valid for all variables contained in the declaration part of a program, place the pragma in
the first line of the declaration editor. In this case, you can also modify the settings for particular
variables by explicitly adding a pragma.
The possible access on a symbol is defined by the following pragma parameters:
'none'
'read'
'write'
'readwrite'
714 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Example
With the following configuration, the variables A and B will be exported with read and write access.
Variable D will be exported with read access.
{attribute 'symbol' := 'readwrite'}
PROGRAM PLC_PRG
VAR
A : INT;
B : INT;
{attribute 'symbol' := 'none'}
C : INT;
{attribute 'symbol' := 'read'}
D : INT;
END_VAR
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 715
Variables Declaration
Overview
You can use the pragma warning disable to suppress alerts. To enable the display of the alert,
use the pragma warning restore.
Syntax
{warning disable <compiler ID>}
Compiler ID: Every alert and every error detected by the compiler has a unique ID, which is
displayed at the beginning of the description.
Example
VAR
{warning disable C0195}
test1 : UINT := -1;
{warning restore C0195}
test2 : UINT := -1;
END_VAR
In this example, an alert will be detected for test2. But no alert will be detected for test1.
716 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Attribute enable_dynamic_creation
Overview
The pragma enable_dynamic_creation is required for using the __NEW operator
(see page 851) for function blocks.
Syntax
{attribute 'enable_dynamic_creation'}
Insert the pragma in the first line in the declaration of the function block.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 717
Variables Declaration
Section 31.6
The Smart Coding Functionality
Smart Coding
Overview
Wherever identifiers (like variables or function block instances) can be entered (this can be inside
of the IEC 61131-3 language editors or inside Watch, Trace, Visualization windows), the smart
coding functionality is available. You can customize this feature in the SmartCoding section of the
Tools → Options dialog box.
718 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Variables Declaration
Examples
The smart coding functionality offers components of structure:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 719
Variables Declaration
720 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Data Types
EIO0000002854 06/2019
Chapter 32
Data Types
Data Types
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 721
Data Types
Section 32.1
General Information
General Information
Data Types
Overview
You can use standard data types (see page 723), user-defined data types (see page 738), or
instances of function blocks when programming in EcoStruxure Machine Expert. Each identifier is
assigned to a data type. This data type dictates how much memory space will be reserved and
what type of values it stores.
722 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Section 32.2
Standard Data Types
Overview
EcoStruxure Machine Expert supports all data types (see page 722) described by standard
IEC61131-3.
The following data types are described in this chapter:
BOOL (see page 723)
Integer (see page 723)
REAL / LREAL (see page 724)
STRING (see page 725)
WSTRING (see page 725)
Time Data Types (LTIME) (see page 726)
ANY and ANY_<type> (see page 726)
Additionally, some standard-extending data types (see page 729) are supported and you can
define your own user-defined data types (see page 738).
BOOL
BOOL type variables can have the values TRUE (1) and FALSE (0). 8 bits of memory space are
reserved.
For further information, refer to the chapter BOOL constants (see page 871).
NOTE: You can use implicit checks to validate the conversion of variable types (refer to the chapter
POUs for Implicit Checks (see page 192)).
Integer
The table lists the available integer data types. Each of the types covers a different range of values.
The following range limitations apply.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 723
Data Types
NOTE: Conversions from larger types to smaller types may result in loss of information.
For further information, refer to the description of number constants (see page 877).
NOTE: You can use implicit checks to validate the conversion of variable types (refer to the chapter
POUs for Implicit Checks (see page 192)).
REAL / LREAL
The data types REAL and LREAL are floating-point types. They represent rational numbers.
Characteristics of REAL and LREAL data types:
NOTE: The support of data type LREAL depends on the target device. See in the corresponding
documentation whether the 64-bit type LREAL gets converted to REAL during compilation
(possibly with a loss of information) or persists.
NOTE: If a REAL or LREAL is converted to SINT, USINT, INT, UINT, DINT, UDINT, LINT, or ULINT
and the value of the real number is out of the value range of that integer, the result will be undefined
and will depend on the target system. Even an exception is possible in this case. In order to get
target-independant code, handle any range exceedance by the application. If the REAL/LREAL
number is within the integer value range, the conversion will work on all systems in the same way.
When assigning i1 := r1; an error is detected. Therefore, the previous note applies when using
conversion operators (see page 813) such as the following:
i1 := REAL_TO_INT(r1);
For further information, refer to REAL/LREAL constants (operands) (see page 878).
NOTE: You can use implicit checks to validate the conversion of variable types (refer to the chapter
POUs for Implicit Checks (see page 192)).
724 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
STRING
A STRING data type variable can contain any string of characters. The size entry in the declaration
determines the memory space to be reserved for the variable. It refers to the number of characters
in the string and can be placed in parentheses or square brackets. If no size specification is given,
the default size of 80 characters will be used.
In general, the length of a string is not limited. But string functions can only process strings with a
length of 1...255 characters. If a variable is initialized with a string too long for the variable data
type, the string will be correspondingly cut from right to left.
NOTE: The memory space needed for a variable of type STRING is 1 byte per character +
1 additional byte. This means, the "STRING[80]" declaration needs 81 bytes.
Example of a string declaration with 35 characters:
str:STRING(35):='This is a String';
For further information, refer to WSTRING and STRING Constants (Operands) (see page 879).
NOTE: You can use implicit checks to validate the conversion of variable types (refer to the chapter
POUs for Implicit Checks (see page 192)).
WSTRING
The WSTRING data type differs from the STRING type (ASCII) by interpretation in Unicode format,
and needing two bytes for each character and two bytes extra memory space (each only one in
case of a STRING).
The library [Link] provides functions for WSTRING strings.
The number of characters for WSTRING depends on the contained characters. A size of 10 for
WSTRING means that the length of the WSTRING can take a maximum of 10 WORDS. For some
characters in Unicode, multiple WORDS are required for coding a character so that the number of
characters does not have to correspond to the length of the WSTRING (10 in this case). The data
type requires one WORD of extra memory as it is terminated with a 0.
If a size is not defined, then 80 WORDS plus one for the terminating character 0 are allocated.
Examples:
wstr:WSTRING:="This is a WString";
wstr10 : WSTRING(10) := "1234567890";
For further information, refer to the following descriptions:
STRING (see page 725)
STRING constants (see page 879) (operands)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 725
Data Types
Example of LTIME:
LTIME1 := LTIME#1000d15h23m12s34ms2us44ns
Compare to TIME size 32 bit and resolution milliseconds (see page 726).
For further information, refer to the following descriptions:
Data Types (see page 722)
TIME constants (see page 872)
DATE constants (see page 874)
DATE_AND_TIME constants (see page 875)
TIME_OF_DAY constants (see page 876)
NOTE: You can use implicit checks to validate the conversion of variable types (refer to the chapter
POUs for Implicit Checks (see page 192)).
ANY / ANY_<type>
When you implement a function, and one of the function inputs (VAR_INPUT) has a generic
IEC data type (ANY or ANY_<type>), then the data type of the call parameter is not defined as
unique. Variables of different data types can be passed to this function. The value passed and its
type can be requested within the function via a predefined structure.
Generic IEC data types that allow the use of elementary data types for function inputs:
726 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Example:
FUNCTION ANYBIT_TO_BCD : DWORD
VAR_INPUT
value : ANY_BIT;
END_VAR
If the function ANYBIT_TO_BCD is called, then a variable of data type BOOL, BYTE, WORD,
DWORD, or LWORD can be passed to the function as a parameter.
Predefined structure:
When compiling the code, an ANY data type is replaced internally with the following structure:
TYPE AnyType :
STRUCT
// the type of the actual parameter
typeclass : __SYSTEM.TYPE_CLASS ;
// the pointer to the actual parameter
pvalue : POINTER TO BYTE;
// the size of the data, to which the pointer points
diSize : DINT;
END_STRUCT
END_TYPE
The actual call parameter assigns the structure elements at runtime.
Example:
This code example compares whether the two passed variables have the same type and the same
value.
FUNCTION Generic_Compare : BOOL
VAR_INPUT
any1 : ANY;
any2 : ANY;
END_VAR
VAR
icount: DINT;
END_VAR
Generic_Compare := FALSE;
IF [Link] <> [Link] THEN
RETURN;
END_IF
IF [Link] <> [Link] THEN
RETURN;
END_IF
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 727
Data Types
// Byte comparison
FOR icount := 0 TO [Link]-1 DO
IF [Link][iCount] <> [Link][iCount] THEN
RETURN;
END_IF
END_FOR
Generic_Compare := TRUE;
RETURN;
// END_FUNCTION
Also refer to the description of the __VARINFO operator (see page 863).
728 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Section 32.3
Extensions to IEC Standard
Overview
This chapter lists the data types that are supported by EcoStruxure Machine Expert in addition to
the standard IEC 61131-3.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 729
Data Types
UNION
Overview
As an extension to the IEC 61131-3 standard, you can declare unions in user-defined types.
The components of a union have the same offset. This means that they occupy the same storage
location. Thus, assuming a union definition as shown in the following example, an assignment to
name.a also manipulates name.b.
Example
TYPE name: UNION
a : LREAL;
b : LINT;
END_UNION
END_TYPE
730 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
BIT
Overview
You can use the BIT data type only for particular variables within Structures (see page 744). The
possible values are TRUE (1) and FALSE (0).
A BIT element consumes 1 bit of memory space and allows you to address single bits of a structure
by name (for further information, refer to the paragraph Bit Access in Structures (see page 745)).
Bit elements which are declared one after another will be combined in bytes. In contrast to BOOL
types (see page 723), where 8 bits are reserved in any case, the use of memory space can get
optimized. On the other hand, the access to bits takes definitely more time. For that reason, use
the BIT data type if you want to store several boolean pieces of information in a compact format.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 731
Data Types
References
Overview
This data type is available in extension to the IEC 61131-3 standard.
A reference stores the address of an object (a variable) that is located elsewhere in memory; in this
respect, the behavior is identical to a pointer.
In contrast to a pointer, a variable behaves like an object when the syntax is concerned.
Additionally, variables declared as REFERENCE provide the following advantages compared to
POINTERS:
A reference does not have to be dereferenced explicitly (with ^) to access the contents of the
referenced object.
When passing values to input parameters of functions/function blocks/methods, the following
applies: If an input is declared as REFERENCE TO <data type>, a variable of the
corresponding <data type> can be passed (refInput := variable instead of
ptrInput :=ADR(variable)).
The compiler verifies that references of the same data type are assigned to each other.
For further information, refer to the Assignment operator REF description (see page 414).
Syntax
<identifier> : REFERENCE TO <data type>
Example Declaration
A : REFERENCE TO DUT;
B : DUT;
C : DUT;
A REF= B; // corresponds to A := ADR(B);
A := C; // corresponds to A^ := C;
NOTE: It is not possible to declare references like REFERENCE TO REFERENCE or ARRAY OF
REFERENCE or POINTER TO REFERENCE.
732 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 733
Data Types
Pointers
Overview
As an extension to the IEC 61131-3 standard, you can use pointers.
Pointers save addresses while an application program is running. A pointer can point to a variable
with any data type (see page 722). The possibility of using an implicit pointer monitoring function
is described further below in the paragraph CheckPointer function (see page 736).
Example
VAR
pt:POINTER TO INT; (* of pointer pt *)
var_int1:INT := 5; (* declaration of variables var_int1 and var_int2 *
)
var_int2:INT;
END_VAR
pt := ADR(var_int1); (* address of var_int1 is assigned to pointer pt *
)
var_int2:= pt^; (* value 5 of var_int1 gets assigned to var_int2 v
ia dereferencing of pointer pt; *)
734 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Function Pointers
EcoStruxure Machine Expert also supports function pointers. These pointers can be passed to
external libraries, but it is not possible to call a function pointer within an application in the
programming system. The runtime function for registration of callback functions (system library
function) expects the function pointer, and, depending on the callback for which the registration
was requested, the respective function will be called implicitly by the runtime system (for example,
at STOP). In order to enable such a system call (runtime system), set the respective properties (by
default under View → Properties... → Build) for the function object.
You can use the ADR operator (see page 809) on function names, program names, function block
names, and method names. Since functions can move after online change, the result is not the
address of the function, but the address of a pointer to the function. This address is valid as long
as the function exists on the target.
Executing the Online Change command can change the contents of addresses.
CAUTION
INVALID POINTER
Verify the validity of the pointers when using pointers on addresses and executing the Online
Change command.
Failure to follow these instructions can result in injury or equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 735
Data Types
CheckPointer Function
To monitor pointer access during runtime, you can use the implicit monitoring function
CheckPointer. You can adapt it, if required. To achieve this, add the POUs for implicit checks
object (see page 192) to the application. Activate the check box related to the category Pointer
Checks.
NOTE: You have to implement the CheckPointer function during machine commissioning to
verify whether the passed pointer refers to a valid memory address and whether the alignment of
the referenced memory area fits to the data type of the variable that the pointer points to.
CheckPointer monitors variables of type REFERENCE TO in a similar way.
NOTE: There is no implicit call of the check function for the THIS pointer.
Template:
Declaration part:
// Implicitly generated code : DO NOT EDIT
FUNCTION CheckPointer : POINTER TO BYTE
VAR_INPUT
ptToTest : POINTER TO BYTE;
iSize : DINT;
iGran : DINT;
bWrite: BOOL;
END_VAR
When called, the following input parameters are provided to the function:
ptToTest: Target address of the pointer
iSize: Size of referenced variable; the data type of iSize has to be integer-compatible and
has to cover the maximum potential data size stored at the pointer address.
iGran: Granularity of the access that is the largest non-structured data type used in the
referenced variable; the data type of iGran has to be integer-compatible
bWrite: Type of access (TRUE= write access, FALSE= read access); the data type of bWrite
has to be BOOL.
736 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 737
Data Types
Section 32.4
User-Defined Data Types
738 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Overview
Additionally, to the standard data types, you can define special data types within a project.
You can define them via creating DUT (Data Unit Type) objects in the POUs tree or Devices tree
or within the declaration part of a POU.
See the recommendations on the naming of objects (see page 624) in order to make it as unique
as possible.
See the following user-defined data types:
arrays (see page 740)
structures (see page 744)
enumerations (see page 746)
subrange types (see page 749)
references (see page 732)
pointers (see page 734)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 739
Data Types
Arrays
Overview
One, two and three-dimensional fields (arrays) are supported as elementary data types. You can
define arrays both in the declaration part of a POU and in the global variable lists. You can also
use implicit boundary checks (see page 742). You can declare arrays with defined length and with
variable length.
The data type ARRAY with variable length can only be declared for VAR_IN_OUT variables of
function blocks, methods, and functions. Use the operators
LOWER_BOUND(<array name>,<dim>) and UPPER_BOUND(<array name>,<dim>) to get
the lower and upper limits of this array.
740 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Initializing Arrays
Example for complete initialization of an array
arr1 : ARRAY [1..5] OF INT := [1,2,3,4,5];
arr2 : ARRAY [1..2,3..4] OF INT := [1,3(7)]; (* short for 1,7,7,7 *)
arr3 : ARRAY [1..2,2..3,3..4] OF INT := [2(0),4(4),2,3];
(* short for 0,0,4,4,4,4,2,3 *)
Example of the initialization of an array of a structure
Structure definition
TYPE STRUCT1
STRUCT
p1:int;
p2:int;
p3:dword;
END_STRUCT
END_TYPE
Array initialization
ARRAY[1..3] OF STRUCT1:= [(p1:=1,p2:=10,p3:=4723),(p1:=2,p2:=0,p3:=299)
,(p1:=14,p2:=5,p3:=112)];
Example of the partial initialization of an array
arr1 : ARRAY [1..10] OF INT := [1,2];
Elements where no value is pre-assigned are initialized with the default initial value of the basic
type. In the previous example, the elements arr1[3]...arr1[10] are therefore initialized with
0.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 741
Data Types
Example of the Initialization of an Array of Function Blocks with Additional Parameters in FB_Init
Example of a function block FB and method FB_Init with two parameters:
FUNCTION_BLOCK FB
VAR
_nId : INT;
_lrIn : LREAL;
END_VAR
METHOD FB_Init : BOOL
VAR_INPUT
bInitRetains : BOOL;
bInCopyCode : BOOL;
nId : INT;
lrIn : LREAL;
END_VAR
_nId := nId;
_lrIn := lrIN;
Example of array declaration with initialization:
PROGRAM PLC_PRG
VAR
inst : FB(nId := 11, lrIn := 33.44);
ainst : ARRAY [0..1, 0..1] OF FB[(nId :=
12, lrIn := 11.22), (nId := 13, lrIn :=
22.33), (nId := 14, lrIn := 33.55),(nId := 15,
lrIn := 11.22)];
END_VAR
742 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
As long as the index is within the range, the return value is the index itself. Otherwise, in
correspondence to the range violation either the upper or the lower limit of the field range will be
returned.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 743
Data Types
Structures
Overview
Create structures in a project as DUT (Data Type Unit) objects via the Add Object dialog box.
They begin with the keywords TYPE and STRUCT and end with END_STRUCT and END_TYPE.
Syntax
TYPE <structurename>:
STRUCT
<declaration of variables 1>
...
<declaration of variables n>
END_STRUCT
END_TYPE
<structurename> is a type that is recognized throughout the project and can be used like a
standard data type.
Nested structures are allowed. The only restriction is that variables may not be assigned to
addresses (the AT declaration is not allowed).
Example
Example for a structure definition named Polygonline:
TYPE Polygonline:
STRUCT
Start:ARRAY [1..2] OF INT;
Point1:ARRAY [1..2] OF INT;
Point2:ARRAY [1..2] OF INT;
Point3:ARRAY [1..2] OF INT;
Point4:ARRAY [1..2] OF INT;
End:ARRAY [1..2] OF INT;
END_STRUCT
END_TYPE
Initialization of Structures
Example:
Poly_1:polygonline := ( Start:=[3,3], Point1:=[5,2], Point2:=[7,3], Poi
nt3:=[8,5], Point4:=[5,7], End:= [3,5]);
Initializations with variables are not possible. For an example of the initialization of an array of a
structure, refer to Arrays (see page 740).
744 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Comparing Structures
For EQ operators (see page 806), it is possible to compare operands of type STRUCT (structure)
if the target system supports structured data types.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 745
Data Types
Enumerations
Overview
An enumeration is a user-defined type that is made up of a number of comma-delimited string
constants. These constants are referred to as enumeration values. Enumeration values are
identifiers for global constants in the project.
Enumeration values are recognized globally in all areas of the project even if they are declared
within a POU.
An enumeration is created in a project as a DUT object via the Add Object dialog box.
NOTE: Local enumeration declaration is only possible within TYPE.
Initialization
746 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 747
Data Types
748 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
Subrange Types
Overview
A subrange type is a user-defined type (see page 739) whose range of values is only a subset of
that of the basic data type. You can also use implicit range boundary checks (see page 750).
You can do the declaration in a DUT object but you can also declare a variable directly with a
subrange type.
Syntax
Syntax for the declaration as a DUT object:
TYPE <name>: <Inttype> (<ug>..<og>) END_TYPE;
Example
TYPE
SubInt : INT (-4095..4095);
END_TYPE
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 749
Data Types
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not change the declaration part of an implicit check function.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
Example
The assignment of a variable belonging to a signed subrange type entails an implicit call to
CheckRangeSigned. The default implementation of that function trimming a value to the
permissible range is provided as follows:
Declaration part:
// Implicitly generated code : DO NOT EDIT
FUNCTION CheckRangeSigned : DINT
VAR_INPUT
value, lower, upper: DINT;
END_VAR
Implementation part:
// Implicitly generated code : Only an Implementation suggestion
IF (value < lower) THEN
CheckRangeSigned := lower;
ELSIF(value > upper) THEN
CheckRangeSigned := upper;
ELSE
CheckRangeSigned := value;
END_IF
When called, the function gets the following input parameters:
value: the value to be assigned to the range type
lower: the lower boundary of the range
upper: the upper boundary of the range
750 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Data Types
As long as the assigned value is within the valid range, it will be used as return value of the function.
Otherwise, in correspondence to the range violation, either the upper or the lower boundary of the
range will be returned.
The assignment i:=10*y will now be replaced implicitly by
i := CheckRangeSigned(10*y, -4095, 4095);
If y, for example, has the value 1000, the variable i will not be assigned to 10*1000=10000 (as
provided by the original implementation), but to the upper boundary of the range that is 4095.
The same applies to function CheckRangeUnsigned.
NOTE: If neither of the functions is available, no type checking of subrange types occurs during
runtime. In this case, you can assign any DINT/UDINT value to a variable of subrange type
DINT/UDINT. You can assign any LINT/ULINT value to a variable of a subrange type LINT/ULINT.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 751
Data Types
752 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Programming Guidelines
EIO0000002854 06/2019
Chapter 33
Programming Guidelines
Programming Guidelines
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 753
Programming Guidelines
Section 33.1
Naming Conventions
Naming Conventions
General Information
Case-Sensitivity
Consider case-sensitivity, especially for prefixes, to improve readability when using designators in
the IEC program.
NOTE: The compiler is not case-sensitive.
Valid Characters
Use only the following letters, numbers and special characters in designators:
0...9, A...Z, a...z,
In order to be able to display the prefixes clearly, an underline is used as the separator. The syntax
is explained in the respective prefix section.
Do not use underscores in the basis name.
754 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Programming Guidelines
Examples
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 755
Programming Guidelines
Section 33.2
Prefixes
Prefixes
756 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Programming Guidelines
Prefix Parts
Overview
Prefixes are used to assign names by function.
The following parts of prefixes are available:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 757
Programming Guidelines
Order of Prefixes
Overview
Designators contain the scope prefix and the type prefix. Use the property prefix according to the
property of the variables (for example, for constants). An additional namespace prefix is used for
libraries.
Obligatory Order
The following order is obligatory:
scope][property][_][type][identifier]
Scope prefixes and property prefixes are separated from type prefixes by an underscore (_).
Example
Gc_dwErrorCode : DWORD;
diCycleCounter : DINT;
The additional namespace prefix is used for libraries:
[namespace].[scope][property][_][type][identifier]
Example
ExampleLibrary.Gc_dwErrorCode
758 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Programming Guidelines
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 759
Programming Guidelines
Scope Prefix
Overview
The scope prefix indicates the scope of variables and constants. It indicates whether it is a local or
global variable, or a constant.
Global variables are indicated by a capital G_ and a property prefix c is added to global constants
(followed by an underscore in each case).
NOTE: Additionally identify the global variables and constants of libraries with the namespace of
the library.
Example
VAR_GLOBAL CONSTANT
Gc_dwExample : DWORD := 16#0000001A;
END_VAR
Access to the global variable of a library with the namespace INF:
INF.G_dwExample := 16#0000001A;
760 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Programming Guidelines
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 761
Programming Guidelines
Examples
piCounter: POINTER TO INT;
aiCounters: ARRAY [1..22] OF INT;
paiRefCounter: POINTER TO ARRAY [1..22] OF INT;
apstTest : ARRAY[1..2] OF POINTER TO ST_MotionStructure;
rdiCounter : REFERENCE TO DINT;
ifMotion : IF_Motion;
762 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Programming Guidelines
Property Prefix
Overview
The property prefix identifies the properties of variables and constants.
NOTE:
Do not declare constants as RETAIN or PERSISTENT.
Do not declare any RETAIN variables within POUs. This administers the complete POU in the
retain memory area.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 763
Programming Guidelines
POU Prefix
Overview
The following program organization units (POU) are defined in IEC 61131-3:
function
function block
program
data structure
list type
union
interface
EcoStruxure Machine Expert offers additional POUs for the creation and management of test
cases:
test case
test series
test resources
The designator is composed of a POU prefix and as short a name as possible (for example,
FB_GetResult). Just like a variable, capitalize the first letter of each word in the basis name.
Write the rest in lower case letters. Form a composite POU name from a verb and a noun.
The prefix is written with an underscore before the name and identifies the type of POU based on
the table:
764 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Programming Guidelines
Namespace Prefix
Overview
You can view the namespace of a library in the Library Manager. Use a short acronym
(PacDriveLib -> PDL) as namespace. Do not change the default namespace of a library.
To reserve an unambiguous namespace for your own, self-developed libraries, contact your
Schneider Electric responsible.
Example
A function FC_DoSomething() is located within the library TestlibraryA (namespace TLA) as well
as in TestlibraryB (namespace TLB). The respective function is accessed by prefixing the
namespace.
If both libraries are located within a project, the following call-up results in an error detected during
compilation:
FC_DoSomething();
In this case, it is necessary to define clearly which POU is to be called up.
TLA.FC_DoSomething();
TLB.FC_DoSomething();
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 765
Programming Guidelines
766 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Operators
EIO0000002854 06/2019
Chapter 34
Operators
Operators
Overview
EcoStruxure Machine Expert supports all IEC operators. In contrast to the standard functions,
these operators are recognized implicitly throughout the project.
Besides the IEC operators, the following operators are supported which are not prescribed by the
standard:
ANDN
ORN
XORN
SIZEOF (refer to arithmetic operators (see page 768))
ADR
BITADR
content operator (refer to address operators (see page 808)
some scope operators (see page 865)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 767
Operators
Section 34.1
Arithmetic Operators
Arithmetic Operators
Overview
The following operators, prescribed by the IEC1131-3 standard, are available:
ADD
MUL
SUB
DIV
MOD
MOVE
Consider possible overflows of arithmetic operations in case the resulting value exceeds the range
of the data type used for the result variable. This may result in low values being written to the
machine instead of high values or vice versa.
WARNING
UNINTENDED EQUIPMENT OPERATION
Always verify the operands and results used in mathematical operations to avoid arithmetic
overflow.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
768 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
ADD
Overview
IEC operator for the addition of variables
Allowed types
BYTE
WORD
DWORD
LWORD
SINT
USINT
INT
UINT
DINT
UDINT
LINT
ULINT
REAL
LREAL
TIME
TIME_OF_DAY(TOD)
DATE
DATE_AND_TIME(DT)
In the FBD/LD editor, the ADD operator is an extensible box. This means, instead of a series of
concatenated ADD boxes, you can use 1 box with multiple inputs. Use the command Insert Input
for adding further inputs. The number is unlimited.
Example in IL
LD 7
ADD 2
ADD 4
ADD 7
ST iVar
Example in ST
var1 := 7+2+4+7;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 769
Operators
Examples in FBD
770 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
MUL
Overview
IEC operator for the multiplication of variables
Allowed types
BYTE
WORD
DWORD
LWORD
SINT
USINT
INT
UINT
DINT
UDINT
LINT
ULINT
REAL
LREAL
TIME
Example in IL
LD 7
MUL 2 ,
4 ,
7
ST Var1
Example in ST
var1 := 7*2*4*7;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 771
Operators
Examples in FBD
772 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
SUB
Overview
IEC operator for the subtraction of one variable from another one.
Allowed types:
BYTE
WORD
DWORD
LWORD
SINT
USINT
INT
UINT
DINT
UDINT
LINT
ULINT
REAL
LREAL
TIME
TIME_OF_DAY(TOD)
DATE
DATE_AND_TIME(DT)
Example in IL
LD 7
SUB 2
ST Var1
Example in ST
var1 := 7-2;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 773
Operators
Example in FBD
774 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
DIV
Overview
IEC operator for the division of one variable by another one:
Allowed types:
BYTE
WORD
DWORD
LWORD
SINT
USINT
INT
UINT
DINT
UDINT
LINT
ULINT
REAL
LREAL
TIME
Example in IL
(Result in Var1 is 4.)
LD 8
DIV 2
ST Var1
Example in ST
var1 := 8/2;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 775
Operators
Examples in FBD
Different target systems may behave differently concerning a division by zero error. It can lead to
a controller HALT, or may go undetected.
WARNING
UNINTENDED EQUIPMENT OPERATION
Use the check functions described in this document, or write your own checks to avoid division
by zero in the programming code.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: For more information about the implicit check functions, refer to the chapter POUs for
Implicit Checks (see page 192).
Check Functions
You can use the following check functions to verify the value of the divisor in order to avoid a
division by 0 and adapt them, if necessary:
CheckDivDInt
CheckDivLint
CheckDivReal
CheckDivLReal
For information on inserting the function, refer to the description of the POUs for implicit checks
function (see page 192).
The check functions are called automatically before each division found in the application code.
See the following example for an implementation of the function CheckDivReal.
776 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 777
Operators
MOD
Overview
IEC operator for the modulo division of one variable by another one.
Allowed types:
BYTE
WORD
DWORD
LWORD
SINT
USINT
INT
UINT
DINT
UDINT
LINT
ULINT
WARNING
UNINTENDED EQUIPMENT OPERATION
Use the check functions described in this document, or write your own checks to avoid division
by zero in the programming code.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: For more information about the implicit check functions, refer to the chapter POUs for
Implicit Checks (see page 192).
Example in IL
Result in Var1 is 1.
LD 9
MOD 2
ST Var1
Example in ST
var1 := 9 MOD 2;
778 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Examples in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 779
Operators
MOVE
Overview
IEC operator for the assignment of a variable to another variable of an appropriate data type.
The MOVE operator is possible for all data types.
As MOVE is available as a box in the graphic editors FBD, LD, CFC, there the (unlocking) EN/ENO
functionality can also be applied on a variable assignment.
Example in IL
Result: var2 gets value of var1
LD var1
MOVE
ST var2
You get the same result with
LD var1
ST var2
Example in ST
ivar2 := MOVE(ivar1);
You get the same result with
ivar2 := ivar1;
780 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
SIZEOF
Overview
This arithmetic operator is not specified by the standard IEC 61131-3.
You can use it to determine the number of bytes required by the given variable x.
The SIZEOF operator returns an unsigned value. The type of the return value will be adapted to
the found size of variable x.
Return Value of SIZEOF(x) Data Type of the Constant Implicitly Used for
the Found Size
0 ≤ size of x < 256 USINT
256 ≤ size of x < 65,536 UINT
65,536 ≤ size of x < 4,294,967,296 UDINT
4,294,967,296 ≤ size of x ULINT
Example in ST
var1 := SIZEOF(arr1); (* d.h.: var1:=USINT#10; *)
Example in IL
Result is 10
arr1:ARRAY[0..4] OF INT;
Var1:INT;
LD arr1
SIZEOF
ST Var1
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 781
Operators
Section 34.2
Bitstring Operators
Bitstring Operators
Overview
The following bitstring operators are available, matching the IEC1131-3 standard:
AND (see page 783)
OR (see page 784)
XOR (see page 785)
NOT (see page 786)
The following operators are not specified by the standard and are not available:
ANDN
ORN
XORN
782 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
AND
Overview
IEC bitstring operator for bitwise AND of bit operands.
If the input bits each are 1, then the resulting bit will be 1, otherwise 0.
Allowed types:
BOOL
BYTE
WORD
DWORD
LWORD
Example in IL
Result in Var1 is 2#1000_0010.
Var1:BYTE;
LD 2#1001_0011
AND 2#1000_1010
ST var1
Example in ST
var1 := 2#1001_0011 AND 2#1000_1010
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 783
Operators
OR
Overview
IEC bitstring operator for bitwise OR of bit operands.
If at least 1 of the input bits is 1, the resulting bit will be 1, otherwise 0.
Allowed types:
BOOL
BYTE
WORD
DWORD
LWORD
Example in IL
Result in var1 is 2#1001_1011.
var1:BYTE;
LD 2#1001_0011
OR 2#1000_1010
ST Var1
Example in ST
Var1 := 2#1001_0011 OR 2#1000_1010
Example in FBD
784 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
XOR
Overview
IEC bitstring operator for bitwise XOR of bit operands.
If only 1 of the input bits is 1, then the resulting bit will be 1; if both or none are 1, the resulting bit
will be 0.
Allowed types:
BOOL
BYTE
WORD
DWORD
LWORD
NOTE: XOR allows adding additional inputs. If more than 2 inputs are available, then an XOR
operation is performed on the first 2 inputs. The result, in turn, will be XOR combined with input 3,
and so on. This has the effect that an odd number of inputs will lead to a resulting bit = 1.
Example in IL
Result is 2#0001_1001.
Var1:BYTE;
LD 2#1001_0011
XOR 2#1000_1010
ST var1
Example in ST
Var1 := 2#1001_0011 XOR 2#1000_1010
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 785
Operators
NOT
Overview
IEC bitstring operator for bitwise NOT operation of a bit operand.
The resulting bit will be 1 if the corresponding input bit is 0 and vice versa.
Allowed types
BOOL
BYTE
WORD
DWORD
LWORD
Example in IL
Result in Var1 is 2#0110_1100.
Var1:BYTE;
LD 2#1001_0011
NOT
ST var1
Example in ST
Var1 := NOT 2#1001_0011
Example in FBD
786 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Section 34.3
Bit-Shift Operators
Bit-Shift Operators
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 787
Operators
SHL
Overview
IEC operator for bitwise left-shift of an operand.
erg:= SHL (in, n)
in: operand to be shifted to the left
n: number of bits, by which in gets shifted to the left
NOTE: If n exceeds the data type width, it depends on the target system how BYTE, WORD,
DWORD and LWORD operands will be filled. Some cause filling with zeros (0), others with
n MOD <register width>.
NOTE: The amount of bits which is considered for the arithmetic operation depends on the data
type of the input variable. If the input variable is a constant, the smallest possible data type is
considered. The data type of the output variable has no effect at all on the arithmetic operation.
Examples
See in the following example in hexadecimal notation the different results for erg_byte and
erg_word. The result depends on the data type of the input variable (BYTE or WORD), although
the values of the input variables in_byte and in_word are the same.
Example in ST
PROGRAM shl_st
VAR
in_byte : BYTE:=16#45; (* 2#01000101 )
in_word : WORD:=16#0045; (* 2#0000000001000101 )
erg_byte : BYTE;
erg_word : WORD;
n: BYTE :=2;
END_VAR
erg_byte:=SHL(in_byte,n); (* Result is 16#14, 2#00010100 *)
erg_word:=SHL(in_word,n); (* Result is 16#0114, 2#0000000100010100 *)
Example in FBD
788 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Example in IL
LD in_byte
SHL 2
ST erg_byte
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 789
Operators
SHR
Overview
IEC operator for bitwise right-shift of an operand.
erg:= SHR (in, n)
in: operand to be shifted to the right
n: number of bits, by which in gets shifted to the right
NOTE: If n exceeds the data type width, it depends on the target system how BYTE, WORD,
DWORD and LWORD operands will be filled. Some cause filling with zeros (0), others with
n MOD <register width>.
Examples
The following example in hexadecimal notation shows the results of the arithmetic operation
depending on the type of the input variable (BYTE or WORD).
Example in ST
PROGRAM shr_st
VAR
in_byte : BYTE:=16#45; (* 2#01000101 )
in_word : WORD:=16#0045; (* 2#0000000001000101 )
erg_byte : BYTE;
erg_word : WORD;
n: BYTE :=2;
END_VAR
erg_byte:=SHR(in_byte,n); (* Result is 16#11, 2#00010001 *)
erg_word:=SHR(in_word,n); (* Result is 16#0011, 2#0000000000010001 *)
Example in FBD
Example in IL
LD in_byte
SHR 2
ST erg_byte
790 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
ROL
Overview
IEC operator for bitwise rotation of an operand to the left.
erg:= ROL (in, n)
Allowed data types
BYTE
WORD
DWORD
LWORD
in will be shifted 1 bit position to the left n times while the bit that is furthest to the left will be
reinserted from the right
NOTE: The amount of bits which is considered for the arithmetic operation depends on the data
type of the input variable. If the input variable is a constant, the smallest possible data type is
considered. The data type of the output variable has no effect at all on the arithmetic operation.
Examples
See in the following example in hexadecimal notation the different results for erg_byte and
erg_word. The result depends on the data type of the input variable (BYTE or WORD), although
the values of the input variables in_byte and in_word are the same.
Example in ST
PROGRAM rol_st
VAR
in_byte : BYTE:=16#45;
in_word : WORD:=16#45;
erg_byte : BYTE;
erg_word : WORD;
n: BYTE :=2;
END_VAR
erg_byte:=ROL(in_byte,n); (* Result is 16#15 *)
erg_word:=ROL(in_word,n); (* Result is 16#0114 *)
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 791
Operators
Example in IL
LD in_byte
ROL n
ST erg_byte
792 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
ROR
Overview
IEC operator for bitwise rotation of an operand to the right.
erg:= ROR (in, n)
Allowed data types
BYTE
WORD
DWORD
LWORD
in will be shifted 1 bit position to the right n times while the bit that is furthest to the left will be
reinserted from the left.
NOTE: The amount of bits which is noticed for the arithmetic operation depends on the data type
of the input variable. If the input variable is a constant, the smallest possible data type is noticed.
The data type of the output variable has no effect at all on the arithmetic operation.
Examples
See in the following example in hexadecimal notation the different results for erg_byte and
erg_word. The result depends on the data type of the input variable (BYTE or WORD), although
the values of the input variables in_byte and in_word are the same.
Example in ST
PROGRAM ror_st
VAR
in_byte : BYTE:=16#45;
in_word : WORD:=16#45;
erg_byte : BYTE;
erg_word : WORD;
n: BYTE :=2;
END_VAR
erg_byte:=ROR(in_byte,n); (* Result is 16#51 *)
erg_word:=ROR(in_word,n); (* Result is 16#4011 *)
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 793
Operators
Example in IL
LD in_byte
ROR n
ST erg_byte
794 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Section 34.4
Selection Operators
Selection Operators
Overview
Selection operations can also be performed with variables.
For purposes of clarity the examples provided in this document are limited to the following which
use constants as operators:
SEL (see page 796)
MAX (see page 797)
MIN (see page 798)
LIMIT (see page 799)
MUX (see page 800)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 795
Operators
SEL
Overview
IEC selection operator for binary selection.
G determines whether IN0 or IN1 is assigned to OUT.
OUT := SEL(G, IN0, IN1) means:
OUT := IN0; if G=FALSE
OUT := IN1; if G=TRUE
Allowed data types:
IN0, ...,INn and OUT can be any identical data type. Make sure that variables of the identical
data type are used at these positions, especially when using user-defined data types. The compiler
verifies the identity of the types and returns compiler errors. Assigning function block instances to
interface variables is not supported.
G: BOOL
Example in IL
LD TRUE
SEL 3,4 (* IN0 = 3, IN1 =4 *)
ST Var1 (* result is 4 *)
LD FALSE
SEL 3,4
ST Var1 (* result is 3 *)
Example in ST
Var1:=SEL(TRUE,3,4); (* result is 4 *)
Example in FBD
Note
NOTE: An expression occurring ahead of IN0 will not be processed if G is TRUE. An expression
occurring ahead of IN1 will not be processed if G is FALSE.
796 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
MAX
Overview
IEC selection operator performing a maximum function.
The MAX operator returns the greater of the 2 values.
OUT := MAX(IN0, IN1)
IN0, IN1 and OUT can be any type of variable.
Example in IL
Result is 90
LD 90
MAX 30
MAX 40
MAX 77
ST Var1
Example in ST
Var1:=MAX(30,40); (* Result is 40 *)
Var1:=MAX(40,MAX(90,30)); (* Result is 90 *)
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 797
Operators
MIN
Overview
IEC selection operator performing a minimum function.
The MIN operator returns the lesser of the 2 values.
OUT := MIN(IN0, IN1)
IN0, IN1 and OUT can be any type of variable.
Example in IL
Result is 30
LD 90
MIN 30
MIN 40
MIN 77
ST Var1
Example in ST
Var1:=MIN(90,30); (* Result is 30 *);
Var1:=MIN(MIN(90,30),40); (* Result is 30 *);
Example in FBD
798 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
LIMIT
Overview
IEC selection operator performing a limiting function.
OUT := LIMIT(Min, IN, Max) means:
OUT := MIN (MAX (IN, Min), Max)
Max is the upper and Min the lower limit for the result. Should the value IN exceed the upper limit
Max, LIMIT will return Max. Should IN fall below Min, the result will be Min.
IN and OUT can be any type of variable.
Example in IL
Result is 80
LD 90
LIMIT 30 ,
80
ST Var1
Example in ST
Var1:=LIMIT(30,90,80); (* Result is 80 *);
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 799
Operators
MUX
Overview
IEC selection operator for multiplexing operation.
OUT := MUX(K, IN0,...,INn)) means:
OUT := INk
IN0, ...,INn and OUT can be any identical data type. Make sure that variables of the identical
data type are used at these positions, especially when using user-defined data types. The compiler
verifies the identity of the types and returns compiler errors. Assigning function block instances to
interface variables is not supported.
K has to be BYTE, WORD, DWORD, LWORD, SINT, USINT, INT, UINT, DINT, LINT, ULINT or
UDINT.
MUX selects the Kth value from among a group of values.
Example in IL
Result is 30
LD 0
MUX 30 ,
40 ,
50 ,
60 ,
70 ,
80
ST Var1
Example in ST
Var1:=MUX(0,30,40,50,60,70,80); (* Result is 30 *);
NOTE: An expression occurring ahead of an input other than INk will not be processed to save
run time. Only in simulation mode will all expressions be executed.
800 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Section 34.5
Comparison Operators
Comparison Operators
Overview
The following operators matching the IEC1131-3 standard are available:
GT (see page 802)
LT (see page 803)
LE (see page 804)
GE (see page 805)
EQ (see page 806)
NE (see page 807)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 801
Operators
GT
Overview
Comparison operator performing a Greater Than function.
The GT operator is a boolean operator which returns the value TRUE when the value of the first
operand is greater than that of the second.
The operands can be of any basic data type.
Example in IL
Result is FALSE
LD 20
GT 30
ST Var1
Example in ST
VAR1 := 20 > 30;
Example in FBD
802 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
LT
Overview
Comparison operator performing a Less Than function.
The LT operator is a boolean operator which returns the value TRUE when the value of the first
operand is less than that of the second.
The operands can be of any basic data type.
Example in IL
Result is TRUE
LD 20
LT 30
ST Var1
Example in ST
VAR1 := 20 < 30;
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 803
Operators
LE
Overview
Comparison operator performing a Less Than Or Equal To function.
The LE operator is a boolean operator which returns the value TRUE when the value of the first
operand is less than or equal to that of the second.
The operands can be of any basic data type.
Example in IL
Result is TRUE
LD 20
LE 30
ST Var1
Example in ST
VAR1 := 20 <= 30;
Example in FBD
804 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
GE
Overview
Comparison operator performing a Greater Than Or Equal To function.
The GE operator is a boolean operator which returns the value TRUE when the value of the first
operand is greater than or equal to that of the second.
The operands can be of any basic data type.
Example in IL
Result is TRUE
LD 60
GE 40
ST Var1
Example in ST
VAR1 := 60 >= 40;
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 805
Operators
EQ
Overview
Comparison operator performing an Equal To function.
The EQ operator is a boolean operator which returns the value TRUE when the operands are equal.
The operands can be of any basic data type.
Example in IL
Result is TRUE
LD 40
EQ 40
ST Var1
Example in ST
VAR1 := 40 = 40;
Example in FBD
806 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
NE
Overview
Comparison operator performing a Not Equal To function.
The NE operator is a boolean operator which returns the value TRUE when the operands are not
equal.
The operands can be of any basic data type.
Example in IL
LD 40
NE 40
ST Var1
Example in ST
VAR1 := 40 <> 40;
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 807
Operators
Section 34.6
Address Operators
Address Operators
808 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
ADR
Overview
This address operator is not specified by the standard IEC 61131-3.
ADR returns the address (see page 887) of its argument in a DWORD. This address can be
assigned to a pointer (see page 734) within the project.
NOTE: EcoStruxure Machine Expert allows you to use the ADR operator with function names,
program names, function block names, and method names.
Refer to the chapter Pointers (see page 734) and consider that function pointers can be passed to
external libraries. Nevertheless, there is no possibility to call a function pointer within EcoStruxure
Machine Expert. In order to enable a system call (runtime system), set the respective object
property (in the menu View → Properties... → Build) for the function object.
Example in ST
dwVar:=ADR(bVAR);
Example in IL
LD bVar
ADR
ST dwVar
WARNING
UNINTENDED EQUIPMENT OPERATION
Assign the value of any POINTER TO type variable(s) prior to the first use of it within a POU, and
at every subsequent cycle.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: POINTER TO variables of functions and methods should not be returned to the caller of this
function or passed to global variables.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 809
Operators
Content Operator
Overview
This address operator is not specified by the standard IEC 61131-3. You can dereference a pointer
by adding the content operator ^ (ASCII caret or circumflex symbol) after the pointer identifier.
Example in ST
pt:POINTER TO INT;
var_int1:INT;
var_int2:INT;
pt := ADR(var_int1);
var_int2:=pt^;
CAUTION
INVALID POINTER
Verify the validity of the pointers when using pointers on addresses and executing the Online
Change command.
Failure to follow these instructions can result in injury or equipment damage.
810 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
BITADR
Overview
This address operator is not specified by the standard IEC 61131-3.
BITADR returns the bit offset within the segment in a DWORD. The offset value depends on
whether the option Byte addressing in the target settings is activated or not.
The highest nibble in that DWORD indicates the memory area:
Memory: 16x40000000
Input: 16x80000000
Output: 16xC0000000
Example in ST
VAR
var1 AT %IX2.3:BOOL;
bitoffset: DWORD;
END_VAR
bitoffset:=BITADR(var1); (* Result if byte addressing=TRUE: 16x80000013
, if byte addressing=FALSE: 16x80000023 *)
Example in IL
LD Var1
BITADR
ST bitoffset
CAUTION
INVALID POINTER
Verify the validity of the pointers when using pointers on addresses and executing the Online
Change command.
Failure to follow these instructions can result in injury or equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 811
Operators
Section 34.7
Calling Operator
Calling Operator
CAL
Overview
IEC operator for calling a function block or a program.
Use CAL in IL to call up a function block instance. Place the variables that will serve as the input
variables in parentheses right after the name of the function block instance.
Example
Calling up the instance Inst of a function block where input variables Par1 and Par2 are 0 and
TRUE, respectively.
CAL INST(PAR1 := 0, PAR2 := TRUE)
812 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Section 34.8
Type Conversion Operators
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 813
Operators
Overview
It is not allowed to convert implicitly from a larger type to a smaller type (for example, from INT to
BYTE or from DINT to WORD). To achieve this, you have to perform special type conversions. You
can basically convert from any elementary type to any other elementary type.
Syntax
Typed conversion: <elem.type1>_TO_<elem.type2>
Overloaded conversion: TO_<elem.type2>
NOTE: At ...TO_STRING conversions the string is generated as left-justified. If it is defined too
short, it will be cut from the right side.
The following type conversions are supported:
BOOL_TO conversions (see page 815)
TO_BOOL conversions (see page 817)
conversion between integral number types (see page 819)
REAL_TO-/ LREAL_TO conversions (see page 820)
TIME_TO/TIME_OF_DAY conversions (see page 822)
DATE_TO/DT_TO conversions (see page 824)
STRING_TO conversions (see page 826)
TRUNC (see page 828) (conversion to DINT)
TRUNC_INT (see page 829)
ANY_NUM_TO_<numeric data type>
814 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
BOOL_TO Conversions
Definition
IEC operator for conversions from type BOOL to any other type.
Syntax
BOOL_TO_<data type>
Conversion Results
The conversion results for number types and for string types depend on the state of the operand:
Operand State Result for Number Types Result for String Types
TRUE 1 TRUE
FALSE 0 FALSE
Examples in ST
Examples in ST with conversion results:
Example Result
i:=BOOL_TO_INT(TRUE); 1
str:=BOOL_TO_STRING(TRUE); 'TRUE'
t:=BOOL_TO_TIME(TRUE); T#1ms
tof:=BOOL_TO_TOD(TRUE); TOD#00:00:00.001
dat:=BOOL_TO_DATE(FALSE); D#1970
dandt:=BOOL_TO_DT(TRUE); DT#1970-01-01-00:00:01
Examples in IL
Examples in IL with conversion results:
Example Result
LD TRUE 1
BOOL_TO_INT
ST i
LD TRUE 'TRUE'
BOOL_TO_STRI...
ST str
LD TRUE T#1ms
BOOL_TO_TIME
ST t
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 815
Operators
Example Result
LD TRUE TOD#00:00:00.001
BOOL_TO_TOD
ST tof
LD FALSE D#1970-01-01
BOOL_TO_DATE
ST dandt
LD TRUE DT#1970-01-01-00:00:01
BOOL_TO_DT
ST dandt
Examples in FBD
Examples in FBD with conversion results:
Example Result
1
'TRUE'
T#1ms
TOD#00:00:00.001
D#1970-01-01
DT#1970-01-01-00:00:01
816 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
TO_BOOL Conversions
Definition
IEC operator for conversions from another variable type to BOOL.
Syntax
<data type>_TO_BOOL
Conversion Results
The result is TRUE when the operand is not equal to 0. The result is FALSE when the operand is
equal to 0.
The result is TRUE for STRING type variables when the operand is TRUE. Otherwise the result is
FALSE.
Examples in ST
Examples in ST with conversion results:
Example Result
b := BYTE_TO_BOOL(2#11010101); TRUE
b := INT_TO_BOOL(0); FALSE
b := TIME_TO_BOOL(T#5ms); TRUE
b := STRING_TO_BOOL('TRUE'); TRUE
Examples in IL
Examples in IL with conversion results:
Example Result
LD 213 TRUE
BYTE_TO_BOOL
ST b
LD 0 FALSE
INT_TO_BOOL
ST b
LD T#5ms TRUE
TIME_TO_BOOL
ST b
LD 'TRUE' TRUE
STRING_TO_BOOL
ST b
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 817
Operators
Examples in FBD
Examples in FBD with conversion results:
Example Result
TRUE
FALSE
TRUE
TRUE
818 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Definition
Conversion from an integral number type to another number type.
Syntax
<INT data type>_TO_<INT data type>
For information on the integer data type, refer to the chapter Standard Data Types (see page 723).
Conversion Results
If the number you are converting exceeds the range limit, the first bytes for the number will be
ignored.
Example in ST
si := INT_TO_SINT(4223); (* Result is 127 *)
If you save the integer 4223 (16#107f represented hexadecimally) as a SINT variable, it will appear
as 127 (16#7f represented hexadecimally).
Example in IL
LD 4223
INT_TO_SINT
ST si
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 819
Operators
Definition
IEC operator for conversions from the variable type REAL or LREAL to a different type.
The value will be rounded up or down to the nearest whole number and converted into the new
variable type.
Exceptions to this are the following variable types:
STRING
BOOL
REAL
LREAL
Conversion Results
If a REAL or LREAL is converted to SINT, USINT, INT, UINT, DINT, UDINT, LINT or ULINT and
the value of the real number is out of the value range of that integer, the result will be undefined,
and may lead to a controller exception.
NOTE: Validate any range overflows by your application and verify that the value of the REAL or
LREAL is within the bounds of the target integer before performing the conversion.
When converting to type STRING, consider that the total number of digits is limited to 16. If the
(L)REAL number has more digits, then the sixteenth will be rounded. If the length of the STRING
is defined too short, it will be cut from the right end.
Example in ST
Examples in ST with conversion results:
Example Result
i := REAL_TO_INT(1.5); 2
j := REAL_TO_INT(1.4); 1
i := REAL_TO_INT(-1.5); –2
j := REAL_TO_INT(-1.4); –1
Example in IL
LD 2.75
REAL_TO_INT
ST i
820 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 821
Operators
TIME_TO/TIME_OF_DAY Conversions
Definition
IEC operator for conversions from the variable type TIME or TIME_OF_DAY to a different type.
Syntax
TIME_TO_<data type>
TOD_TO_<data type>
Conversion Results
The time will be stored internally in a DWORD in milliseconds (beginning with 12:00 A.M. for the
TIME_OF_DAY variable). This value will then be converted.
In case of type STRING the result is a time constant.
Examples in ST
Examples in ST with conversion results:
Example Result
str := TIME_TO_STRING(T#12ms); 'T#12ms'
dw := TIME_TO_DWORD(T#5m); 300000
si := TOD_TO_SINT(TOD#00:00:00.012); 12
Examples in IL
Examples in IL with conversion results:
Example Result
LD T#12ms 'T#12ms'
TIME_TO_STRI...
ST str
LD T#300000ms 300000
TIME_TO_DWORD
ST dw
LD TOD#00:00:00.012 12
TIME_TO_SINT
ST si
822 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Examples in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 823
Operators
DATE_TO/DT_TO Conversions
Definition
IEC operator for conversions from the variable type DATE or DATE_AND_TIME to a different type.
Syntax
DATE_TO_<data type>
DT_TO_<data type>
Conversion Results
The date will be stored internally in a DWORD in seconds since Jan. 1, 1970. This value will then
be converted.
For STRING type variables, the result is the date constant.
Examples in ST
Examples in ST with conversion results:
Example Result
b := DATE_TO_BOOL(D#1970-01-01); FALSE
i := DATE_TO_INT(D#1970-01-15); 29952
byt := DT_TO_BYTE(DT#1970-01-15-05:05:05); 129
str := DT_TO_STRING(DT#1998-02-13-14:20); 'DT#1998-02-13-14:20'
Examples in IL
Examples in IL with conversion results:
Example Result
LD D#1970-01-01 FALSE
DATE_TO_BOOL
ST b
LD D#1970-01-01 29952
DATE_TO_INT
ST i
LD D#1970-01-15-05:05: 129
DATE_TO_BYTE
ST byt
LD D#1998-02-13-14:20 'DT#1998-02-13-14:20'
DATE_TO_STRI...
ST str
824 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Examples in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 825
Operators
STRING_TO Conversions
Definition
IEC operator for conversions from the variable type STRING to a different type.
Syntax
STRING_TO_<data type>
Specifying Values
Specify the operand of type STRING matching the IEC61131-3 standard. The value must
correspond to a valid constant (literal) (see page 643) of the target type. This applies to the
specification of exponential values, infinite values, prefixes, grouping character ("_") and comma.
Additional characters after the digits of a number are allowed, as for example, 23xy. Characters
preceding a number are not allowed.
The operand must represent a valid value of the target data type.
NOTE: If the data type of the operand does not match the target type, or if the value exceeds the
range of the target data type, then the result depends on the processor type and is therefore
undefined.
Conversions from larger types to smaller types may result in loss of information.
CAUTION
LOSS OF DATA
When converting mismatched data types or when the value being converted is larger than the
target data type, be sure that the result is validated within your application.
Failure to follow these instructions can result in injury or equipment damage.
Example in IL
826 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Examples in ST
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 827
Operators
TRUNC
Definition
IEC operator for conversions from REAL to DINT. The whole number portion of the value will be
used.
The result of these functions is not defined if the input value cannot be represented with a DINT or
INT. The behavior of such input values is platform-dependent.
Examples in ST
Examples in ST with conversion results:
Example Result
diVar:=TRUNC(1.9); 1
diVar:=TRUNC(–1.4); –1
Example in IL
LD 1.9
TRUNC
ST diVar
828 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
TRUNC_INT
Definition
IEC operator for conversions from REAL to INT. The whole number portion of the value will be
used.
The result of these functions is not defined if the input value cannot be represented with a DINT or
INT. The behavior of such input values is platform-dependent.
Examples in ST
Examples in ST with conversion results:
Example Result
iVar:=TRUNC_INT(1.9); 1
iVar:=TRUNC_INT(-1.4); –1
Example in IL
LD 1.9
TRUNC_INT
ST iVar
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 829
Operators
ANY_..._TO Conversions
Definition
Conversion from any data type, or more specifically from any numeric data type to another data
type. As with any type of conversion, the size of the operands must be taken into account in order
to have a successful conversion.
Syntax
ANY_NUM_TO_<numeric data type>
ANY_TO_<any data type>
Example
Conversion from a variable of data type REAL to INT:
re : REAL := 1.234;
i : INT := ANY_TO_INT(re)
830 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
TO_<xxx> Conversions
Definition
Conversion of variables from one type to another type. The input type must not be specified
explicitly (overloaded conversion).
Also refer to the description of type conversion functions (see page 814).
Syntax
TO_<data type>
Example in ST
Conversion from a variable of data type REAL to INT:
VAR
iVar: INT;
bVar: BOOL;
strVar: STRING;
rVar: REAL;
END_VAR
wVar:=TO_WORD('123') (* result is 123 *)
bVar:=TO_BOOL(1); (* result is TRUE *)
strVar:=TO_STRING(342); (* result is '342' *)
iVar_=TO_INT(4.22); (* result is 4 *)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 831
Operators
Section 34.9
Numeric Functions
Numeric Functions
Overview
This chapter describes the available numeric IEC operators specified by the standard IEC 61131-
3.
832 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
ABS
Definition
Numeric IEC operator for returning the absolute value of a number.
In- and output can be of any numeric basic data type.
Example in IL
The result in i is 2.
LD –2
ABS
ST i
Example in ST
i:=ABS(–2);
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 833
Operators
SQRT
Definition
Numeric IEC operator for returning the square root of a number.
The input variable can be of any numeric basic data type, the output variable has to be type REAL
or LREAL.
Example in IL
The result in q is 4.
LD 16
SQRT
ST q
Example in ST
q:=SQRT(16);
Example in FBD
834 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
LN
Definition
Numeric IEC operator for returning the natural logarithm of a number.
The input variable can be of any numeric basic data type, the output variable has to be type REAL
or LREAL.
Example in IL
The result in q is 3.80666.
LD 45
LN
ST q
Example in ST
q:=LN(45);
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 835
Operators
LOG
Definition
Numeric IEC operator for returning the logarithm of a number in base 10.
The input variable can be of any numeric basic data type, the output variable has to be type REAL
or LREAL.
Example in IL
The result in q is 2.49762.
LD 314.5
LOG
ST q
Example in ST
q:=LOG(314.5);
Example in FBD
836 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
EXP
Definition
Numeric IEC operator for returning the exponential function.
The input variable can be of any numeric basic data type, the output variable has to be type REAL
or LREAL.
Example in IL
The result in q is 7.389056099.
LD 2
EXP
ST q
Example in ST
q:=EXP(2);
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 837
Operators
SIN
Definition
Numeric IEC operator for returning the sine of an angle.
The input defining the angle in radians can be of any numeric basic data type, the output variable
has to be of type REAL or LREAL.
Example in IL
The result in q is 0.479426.
LD 0.5
SIN
ST q
Example in ST
q:=SIN(0.5);
Example in FBD
838 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
COS
Definition
Numeric IEC operator for returning the cosine of an angle.
The input defining the angle in arch minutes can be of any numeric basic data type where the
output variable has to be of type REAL or LREAL.
Example in IL
The result in q is 0.877583.
LD 0.5
COS
ST q
Example in ST
q:=COS(0.5);
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 839
Operators
TAN
Definition
Numeric IEC operator for returning the tangent of a number. The value is calculated in arch
minutes.
The input variable can be of any numeric basic data type where the output variable has to be type
REAL or LREAL.
Example in IL
The result in q is 0.546302.
LD 0.5
TAN
ST q
Example in ST
q:=TAN(0.5);
Example in FBD
840 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
ASIN
Definition
Numeric IEC operator for returning the arc sine (inverse function of sine) of a number. The value
is calculated in arch minutes.
The input variable can be of any numeric basic data type where the output variable has to be type
REAL or LREAL.
Example in IL
The result in q is 0.523599.
LD 0.5
ASIN
ST q
Example in ST
q:=ASIN(0.5);
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 841
Operators
ACOS
Definition
Numeric IEC operator for returning the arc cosine (inverse function of cosine) of a number. The
value is calculated in arch minutes.
The input variable can be of any numeric basic data type where the output variable has to be type
REAL or LREAL.
Example in IL
The result in q is 1.0472.
LD 0.5
ACOS
ST q
Example in ST
q:=ACOS(0.5);
Example in FBD
842 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
ATAN
Definition
Numeric IEC operator for returning the arc tangent (inverse function of tangent) of a number. The
value is calculated in arch minutes.
The input variable can be of any numeric basic data type where the output variable has to be type
REAL or LREAL.
Example in IL
The result in q is 0.463648.
LD 0.5
ATAN
ST q
Example in ST
q:=ATAN(0.5);
Example in FBD
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 843
Operators
EXPT
Definition
Numeric IEC operator for exponentiation of a variable with another variable:
OUT = IN1 to the IN2
The input variable can be of numeric basic data types (SINT, USINT, INT, UINT, DINT, UDINT,
LINT, ULINT, REAL, LREAL, BYTE, WORD, DWORD, and LWORD) where the output variable has
to be type REAL or LREAL.
The result of this function is not defined if the following applies:
The base is negative.
The base is zero and the exponent is ≤ 0.
Example in IL
The result is 49.
LD 7
EXPT 2
ST Var1
Example in ST
var1:=EXPT(7,2);
Example in FBD
844 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Section 34.10
IEC Extending Operators
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 845
Operators
Overview
In addition to the IEC operators, EcoStruxure Machine Expert supports following IEC extending
operators:
ADR (see page 809)
BITADR (see page 811)
SIZEOF (see page 781)
__DELETE (see page 847)
__ISVALIDREF (see page 850)
__NEW (see page 851)
__QUERYINTERFACE (see page 854)
__QUERYPOINTER (see page 856)
scope operators (see page 865)
846 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
__DELETE
Definition
This operator is not specified by the IEC 61131-3 standard.
For compatibility information, refer to the EcoStruxure Machine Expert/CoDeSys compiler version
mapping table in the Compatibility and Migration User Guide (see EcoStruxure Machine Expert
Compatibility and Migration, User Guide).
The __DELETE operator deallocates the memory for objects allocated before via the __NEW
operator (see page 851).
__DELETE has no return value and its operand will be set to 0 after the operation.
Activate the option Use dynamic memory allocation in the Application build options view
(see EcoStruxure Machine Expert, Menu Commands, Online Help) (View → Properties... →
Application build options). Consult the Programming Guide specific to your controller for whether
the options are available on your controller.
Syntax
__DELETE (<pointer>)
If pointer is a pointer to a function block, the dedicated method FB_Exit will be called before the
pointer is set to NULL.
NOTE: Use the exact data type of the derived function block and not that of the base function block.
Do not use a variable of type POINTER TO BaseFB. This is necessary because if the base
function block implements no FB_Exit function, then at the later usage of __DELETE(pBaseFB),
no FB_Exit is called.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 847
Operators
Example
In the following example, the function block FBDynamic is allocated dynamically via _NEW from the
POU PLC_PRG. By doing so, FB_Init method will be called, in which a type DUT is allocated.
When __DELETE is called on, the function block pointer from PLC_PRG, FB_Exit will be called,
which in turn frees the allocated internal type.
FUNCTION_BLOCK FBDynamic
VAR_INPUT
in1, in2 : INT;
END_VAR
VAR_OUTPUT
out : INT;
END_VAR
VAR
test1 : INT := 1234;
_inc : INT := 0;
_dut : POINTER TO DUT;
END_VAR
out := in1 + in2;
848 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
PLC_PRG(PRG)
VAR
pFB : POINTER TO FBDynamic;
bInit: BOOL := TRUE;
bDelete: BOOL;
loc : INT;
END_VAR
IF (bInit) THEN
pFB := __NEW(FBDynamic);
bInit := FALSE;
END_IF
IF (pFB <> 0) THEN
pFB^(in1 := 1, in2 := loc, out => loc);
pFB^.INC();
END_IF
IF (bDelete) THEN
__DELETE(pFB);
END_IF
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 849
Operators
__ISVALIDREF
Definition
This operator is not specified by the IEC 61131-3 standard.
It allows you to check whether a reference points to a valid value.
For how to use and an example, see the description of the reference (see page 732) data type.
850 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
__NEW
Definition
This operator is not prescribed by the IEC 61131-3 standard.
The operator __NEW allocates memory for function block instances or arrays of standard data
types. The operator returns a suitably typed pointer to the object. If the operator is not used within
an assignment, a message is displayed.
Activate the option Use dynamic memory allocation in the Application build options view
(see EcoStruxure Machine Expert, Menu Commands, Online Help) (View → Properties... →
Application build options) to use the __NEW operator. Consult the Programming Guide specific to
your controller for whether the options are available on your controller.
If no memory could be allocated, by __NEW will return 0.
For deallocating, use __DELETE.
Syntax
__NEW (<type>, [<size>]
The operator creates a new object of the specified type <type> and returns a pointer to that
<type>. The initialization of the object is called after creation. If 0 is returned, the operation has
not been completed successfully.
NOTE: Use the exact data type of the derived function block and not that of the base function block.
Do not use a variable of type POINTER TO BaseFB. This is necessary because if the base
function block implements no FB_Exit function, then at the later usage of __DELETE(pBaseFB),
no FB_Exit is called.
If <type> is scalar, the optional operand <length> has to be set additionally and the operator
creates an array of scalar types with the size length.
Example
pScalarType := __New(ScalarType, length);
NOTE: A function block created with __NEW has a fixed memory area. The data layout cannot be
modified by an online change. Therefore, new variables cannot be added or deleted, and types
cannot be modified.
Therefore, only function blocks out of libraries (because they cannot change) and function blocks
with attribute enable_dynamic_creation are allowed for the __NEW operator. If a function
block changes with this flag so that copy code will be necessary, a message is produced.
NOTE: The code for memory allocation needs to be non-re-entrant.
A semaphore (SysSemEnter) is used to avoid 2 tasks try to allocate memory at the same time.
Thus, extensive usage of __New may produce higher jitter.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 851
Operators
852 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
IF (bInit) THEN
pFB := __NEW(FBDynamic);
bInit := FALSE;
END_IF
IF (pFB <> 0) THEN
pFB^(in1 := 1, in2 := loc, out => loc);
pFB^.INC();
END_IF
IF (bDelete) THEN
__DELETE(pFB);
END_IF
Example with an array:
PLC_PRG(PRG)
VAR
bInit: BOOL := TRUE;
bDelete: BOOL;
pArrayBytes : POINTER TO BYTE;
test: INT;
parr : POINTER TO BYTE;
END_VAR
IF (bInit) THEN
pArrayBytes := __NEW(BYTE, 25);
bInit := FALSE;
END_IF
IF (pArrayBytes <> 0) THEN
pArrayBytes[24] := 125;
test := pArrayBytes[24];
END_IF
IF (bDelete) THEN
__DELETE(pArrayBytes);
END_IF
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 853
Operators
__QUERYINTERFACE
Definition
This operator is not prescribed by the IEC 61131-3 standard.
At runtime, __QUERYINTERFACE is enabling a type conversion of an interface reference to
another. The operator returns a result with type BOOL. TRUE implies, that the conversion is
successfully executed.
Syntax
__QUERYINTERFACE(<ITF_Source>, < ITF_Dest>
The operator needs as the first operand an interface reference or a function block instance of the
intended type and as second operand an interface reference. After execution of
__QUERYINTERFACE, the ITF_Dest holds a reference to the intended interface if the object
referenced from ITF source implements the interface. In this case, the conversion is successful
and the result of the operator returns TRUE. In all other cases, the operator returns FALSE.
A precondition for an explicit conversion is that not only the ITF_Source but also ITF_Dest is
an extension of the interface __System.IQueryInterface. This interface is provided implicitly
and needs no library.
Example
Example in ST:
INTERFACE ItfBase EXTENDS __System.IQueryInterface
METHOD mbase : BOOL
END_METHOD
INTERFACE ItfDerived1 EXTENDS ItfBase
METHOD mderived1 : BOOL
END_METHOD
INTERFACE ItfDerived2 EXTENDS ItfBase
METHOD mderived2 : BOOL
END_METHOD
FUNCTION_BLOCK FB1 IMPLEMENTS ItfDerived1
METHOD mbase : BOOL
mbase := TRUE;
END_METHOD
METHOD mderived1 : BOOL
mderived1 := TRUE;
END_METHOD
END_FUNCTION_BLOCK
FUNCTION_BLOCK FB2 IMPLEMENTS ItfDerived2
METHOD mbase : BOOL
mbase := FALSE;
854 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
END_METHOD
METHOD mderived2 : BOOL
mderived2 := TRUE;
END_METHOD
END_FUNCTION_BLOCK
PROGRAM POU
VAR
inst1 : FB1;
inst2 : FB2;
itfbase1 : ItfBase := inst1;
itfbase2 : ItfBase := inst2;
itfderived1 : ItfDerived1 := 0;
itfderived2 : ItfDerived2 := 0;
bTest1, bTest2, xResult1, xResult2: BOOL;
END_VAR
xResult1 := __QUERYINTERFACE(itfbase1, itfderived1); // xResult = TRUE,
itfderived1 <> 0
// references the instance inst1
xResult2 := __QUERYINTERFACE(itfbase1, itfderived2); // xResult = FALSE
, itfderived2 = 0
xResult3 := __QUERYINTERFACE(itfbase2, itfderived1); // xResult = FALSE
, itfderived1 = 0
xResult4 := __QUERYINTERFACE(itfbase2, itfderived2); // xResult = TRUE,
itfderived2 <> 0
// references the instance inst2
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 855
Operators
__QUERYPOINTER
Definition
This operator is not specified by the IEC 61131-3 standard.
At runtime, __QUERYPOINTER is assigning an interface reference to an untyped pointer. The
operator returns a result with type BOOL. TRUE implies, that the conversion has been successfully
executed.
Syntax
__QUERYPOINTER (<ITF_Source>, < Pointer_Dest>
For the first operand, the operator requires an interface reference or a function block instance of
the intended type and for the second operand an untyped pointer. After execution of
__QUERYPOINTER, the Pointer_Dest holds the address of the reference to the intended
interface. In this case, the conversion is successful and the result of the operator returns TRUE. In
all other cases, the operator returns FALSE. Pointer_Dest is untyped and can be cast to any
type. The programmer has to ensure the actual type. For example, the interface could provide a
method returning a type code.
A precondition for an explicit conversion is that the ITF_Source is an extension of the interface
__System.IQueryInterface. This interface is provided implicitly and needs no library.
Example
TYPE KindOfFB
(FB1 := 1, FB2 := 2, UNKOWN := -1);
END_TYPE
INTERFACE Itf EXTENDS __System.IQueryInterface
METHOD KindOf : KindOfFB
END_METHOD
FUNCTION_BLOCK F_BLOCK_1 IMPLEMENTS ITF
METHOD KindOf : KindOfFB
KindOf := KindOfFB.FB1;
END_METHOD
FUNCTION_BLOCK F_BLOCK_2 IMPLEMENTS ITF
METHOD KindOf : KindOfFB
KindOf := KindOfFB.FB2;
END_METHOD
FUNCTION CAST_TO_ANY_FB : BOOL
VAR_INPUT
itf_in : Itf;
END_VAR
VAR_OUTPUT
pfb_1: POINTER TO F_BLOCK_1 := 0;
pfb_2: POINTER TO F_BLOCK_2 := 0;
856 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
END_VAR
VAR
xResult1, xResult2 : BOOL;
END_VAR
IF itf_in <> 0
CASE itf_in.KindOf OF
KindOfFB.FB1:
xResult1 := __QUERYPOINTER(itf_in, pfb_1);
KindOfFB.FB2 THEN
xResult2 := __QUERYPOINTER(itf_in, pfb_2);
END_CASE
END_IF
CAST_TO_ANY_FB := xResult1 OR xResult2;
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 857
Operators
AND_THEN
Definition
This operator is not specified by the IEC 61131-3 standard. It is only allowed for programming in
structured text (ST).
The AND_THEN performs an AND-operation of operands of type BOOL and BIT with short-
circuiting mode. This has the following effect:
If all operands are TRUE, then the result of the operation is TRUE, otherwise it is FALSE.
When one operand is FALSE, then the expressions at the other operands are not evaluated (lazy
evaluation). In this regard, the AND_THEN operator differs from the AND operator as defined in the
standard IEC-61131-3. AND always evaluates all expressions (see page 783).
In contrast to this, when using the standard IEC-operator AND, always all operands are evaluated
(see page 783).
858 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
OR_ELSE
Definition
This operator is not specified by the IEC 61131-3 standard. It is only allowed for programming in
structured text (ST).
The OR_ELSE performs an OR-operation of operands of type BOOL and BIT with short-circuiting
mode. This has the following effect:
If at least one of the operands is TRUE, then the result of the operation is TRUE, otherwise it is
FALSE.
When one operand is TRUE, then the expressions at the other operands are not evaluated (lazy
evaluation). In this regard, the OR_ELSE operator differs from the OR operator as defined in the
standard IEC-61131-3. OR always evaluates all expressions (see page 784).
Example
VAR
bEver: BOOL;
bX1: BOOL;
dw: DWORD := 16#000000FF;
END_VAR
bEver := FALSE;
bX := dw.8 OR_ELSE dw.1 OR_ELSE dw.1 OR_ELSE (bEver := TRUE);
dw.8 is FALSE and dw.1 is TRUE, thus the result of the operation (bX) is TRUE. However, the
expression at the third input is not executed, bEver remains FALSE. If you used the standard OR
operation instead (see page 784), bEver were set to TRUE.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 859
Operators
Definition
These operators are not specified by the IEC 61131-3 standard.
The __TRY, __CATCH, __FINALLY, __ENDTRY operators are used for specific handling of
exceptions in IEC code. With these operators, you can execute specific statements in case an error
is detected. Furthermore, the program is not stopped (as usual) when an exception is detected.
Syntax
__TRY
<statements_try>
__CATCH(exec)
<statements_catch>
__FINALLY
<statements_finally>
__ENDTRY
<statements_next>
Function
If an exception is detected while <statements_try> is executed (even in functions called from
there), then <statements_catch> is executed. In that way, execution does not stop as it is the
case when other exceptions are detected. However, there is a log message in the runtime system
with information about the range offset and the type of exception that has been detected.
After executing <statements_catch>, <statements_finally> is automatically executed (if
programmed), and then <statements_next> is executed.
The variable <exception> must be of type __SystemExceptionCode.
Example
If the statement in __TRY produces an exception, then program execution is not stopped, and then
the statements in __CATCH are executed. This means that the function exc is executed. Then the
statement in __ENDTRY is executed.
FUNCTION Tester : UDINT
VAR_INPUT
count : UDINT;
END_VAR
VAR_OUTPUT
strExceptionText : STRING;
END_VAR
VAR
exc : __SYSTEM.ExceptionCode;
860 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
END_VAR
__TRY
Tester := tryFun(count := count, testcase := g_testcase);
//This statement is tested. If it produces an exception, then the state
ment in __CATCH is executed first, and then the statement in __FINALLY.
__CATCH(exc)
HandleException(exc, strExceptionText => strExceptionText);
__FINALLY
GVL.g_count := GVL.g_count + 2;
__ENDTRY
Use the Stop execution on handled exceptions command (see EcoStruxure Machine Expert, Menu
Commands, Online Help) to stop execution at the error location despite the programmed exception
handling.
Type __System.Exception
TYPE ExceptionCode:
( RTSEXCPT_UNKNOWN := 16#FFFFFFFF,
RTSEXCPT_NOEXCEPTION := 16#00000000,
RTSEXCPT_WATCHDOG := 16#00000010,
RTSEXCPT_HARDWAREWATCHDOG := 16#00000011,
RTSEXCPT_IO_CONFIG_ERROR := 16#00000012,
RTSEXCPT_PROGRAMCHECKSUM := 16#00000013,
RTSEXCPT_FIELDBUS_ERROR := 16#00000014,
RTSEXCPT_IOUPDATE_ERROR := 16#00000015,
RTSEXCPT_CYCLE_TIME_EXCEED := 16#00000016,
RTSEXCPT_ONLCHANGE_PROGRAM_EXCEEDED := 16#00000017,
RTSEXCPT_UNRESOLVED_EXTREFS := 16#00000018,
RTSEXCPT_DOWNLOAD_REJECTED := 16#00000019,
RTSEXCPT_BOOTPROJECT_REJECTED_DUE_RETAIN_ERROR := 16#0000001A,
RTSEXCPT_LOADBOOTPROJECT_FAILED := 16#0000001B,
RTSEXCPT_OUT_OF_MEMORY := 16#0000001C,
RTSEXCPT_RETAIN_MEMORY_ERROR := 16#0000001D,
RTSEXCPT_BOOTPROJECT_CRASH := 16#0000001E,
RTSEXCPT_BOOTPROJECTTARGETMISMATCH := 16#00000021,
RTSEXCPT_SCHEDULEERROR := 16#00000022,
RTSEXCPT_FILE_CHECKSUM_ERR := 16#00000023,
RTSEXCPT_RETAIN_IDENTITY_MISMATCH := 16#00000024,
RTSEXCPT_IEC_TASK_CONFIG_ERROR := 16#00000025,
RTSEXCPT_APP_TARGET_MISMATCH := 16#00000026,
RTSEXCPT_ILLEGAL_INSTRUCTION := 16#00000050,
RTSEXCPT_ACCESS_VIOLATION := 16#00000051,
RTSEXCPT_PRIV_INSTRUCTION := 16#00000052,
RTSEXCPT_IN_PAGE_ERROR := 16#00000053,
RTSEXCPT_STACK_OVERFLOW := 16#00000054,
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 861
Operators
RTSEXCPT_INVALID_DISPOSITION := 16#00000055,
RTSEXCPT_INVALID_HANDLE := 16#00000056,
RTSEXCPT_GUARD_PAGE := 16#00000057,
RTSEXCPT_DOUBLE_FAULT := 16#00000058,
RTSEXCPT_INVALID_OPCODE := 16#00000059,
RTSEXCPT_MISALIGNMENT := 16#00000100,
RTSEXCPT_ARRAYBOUNDS := 16#00000101,
RTSEXCPT_DIVIDEBYZERO := 16#00000102,
RTSEXCPT_OVERFLOW := 16#00000103,
RTSEXCPT_NONCONTINUABLE := 16#00000104,
RTSEXCPT_PROCESSORLOAD_WATCHDOG := 16#00000105,
RTSEXCPT_FPU_ERROR := 16#00000150,
RTSEXCPT_FPU_DENORMAL_OPERAND := 16#00000151,
RTSEXCPT_FPU_DIVIDEBYZERO := 16#00000152,
RTSEXCPT_FPU_INEXACT_RESULT := 16#00000153,
RTSEXCPT_FPU_INVALID_OPERATION := 16#00000154,
RTSEXCPT_FPU_OVERFLOW := 16#00000155,
RTSEXCPT_FPU_STACK_CHECK := 16#00000156,
RTSEXCPT_FPU_UNDERFLOW := 16#00000157,
RTSEXCPT_VENDOR_EXCEPTION_BASE := 16#00002000
RTSEXCPT_USER_EXCEPTION_BASE :=16#00010000 )
UDINT ; END_TYPE
862 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
__VARINFO
Definition
This operator is not specified by the IEC 61131-3 standard.
Function
The __VARINFO operator provides information about a variable of the project at runtime. The
information is stored as a data structure in a variable of data type __SYSTEM.VAR_INFO.
Example
At runtime, the variable MyVarInfo contains the information about the variable MyVar.
//Declaration
VAR
MyVarInfo: __SYSTEM.VAR_INFO
MyVAR: INT;
END_VAR
//Program code
MyVarInfo:= __VARINFO (MyVar);
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 863
Operators
Type SYSTEM.VAR_INFO
A variable with data type __SYSTEM.VAR_INFO contains the following elements:
Element Description
ByteAddress Address of the variable.
ByteOffset Offset (in bytes).
Area Number of the memory area.
BitNr Number of the bit in the byte.
If it is not a bit type, the value is -1.
BitSize Size of the variable (in bits).
BitAddress Bit address of the variable.
TypeClass Data type class of the variable.
TypeName Data type of the variable.
NumElements For arrays: Number of array elements.
BaseTypeClass For arrays: Data type class of the base data type.
ElemBitSize For arrays: Bit size of an array element.
MemoryArea Information for the memory area: memory, input,
output, retain, global, local.
Symbol Variable name.
Comment Comment.
864 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Scope Operators
Definition
In extension to the IEC operators, there are several possibilities to disambiguate the access to
variables or modules if the variables or module name is used multiple times within the scope of a
project.
The following scope operators can be used:
global scope operator
global variable list name
enumeration name
library namespace
global node operator
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 865
Operators
Library Namespace
You can add the library namespace to a POU as a prefix separated by a dot to make the access
to the POU unique. By default, the namespace of a library is identical to the library name.
Example: LIB_A.FB_A
Syntax
<library namespace>.<library POU>
Example
If a library which is included in a project contains the POU FB_A and there is also a POU FB_A
defined locally in the project, then you can assign the name LIB_A.FB_A to the function block of
the library in order to differentiate from the POU.
var1 := FB_A(in := 12); // Call of the project function block FB_A
var2 := LIB_A.FB_A(in := 22); // Call of the library function block FB_
A
You can define another name for the namespace either in the Project Information when creating a
library project in the Project Information (by default in the Project menu), or later in the Properties
dialog box of an included library in the Library Manager.
Enumeration Name
You can use the type name of an enumeration to disambiguate the access to an enumeration
constant. Therefore, it is possible to use the same constant in different enumerations.
The enumeration name has to precede the constant name, separated by a dot (.).
Syntax
<enumeration name>.<constant name>
Example
The constant Blue is a component of enumeration Colors as well as of enumeration Feelings.
color := [Link]; // Access to enum value Blue in type Colors
feeling := [Link]; // Access to enum value Blue in type Feelings
866 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operators
Section 34.11
Initialization Operator
Initialization Operator
INI Operator
Overview
NOTE: The INI operator is obsolete. The method FB_init replaces the INI operator. For further
information about the FB_init method, refer to the chapter FB_init, FB_reinit Methods
(see page 650). However, the operator can still be used for keeping compatibility with projects
imported from earlier EcoStruxure Machine Expert versions.
You can use the INI operator to initialize retain variables which are provided by a function block
instance used in the POU.
Assign the operator to a boolean variable.
Syntax
<bool-variable> := INI(<FB-instance, TRUE|FALSE)
If the second parameter of the operator is set to TRUE, all retain variables defined in the function
block FB will be initialized.
Example in ST
fbinst is the instance of function block fb, in which a retain variable retvar is defined.
Declaration in POU
fbinst:fb;
b:bool;
Implementation part
b := INI(fbinst, TRUE);
ivar:=[Link] (* => retvar gets initialized *)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 867
Operators
868 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Operands
EIO0000002854 06/2019
Chapter 35
Operands
Operands
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 869
Operands
Section 35.1
Constants
Constants
870 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
BOOL Constants
Overview
BOOL constants are the logical values TRUE and FALSE.
Refer to the description of the data type BOOL (see page 723).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 871
Operands
TIME Constants
Overview
TIME constants are used to operate the standard timer modules. The time constant TIME is of size
32 bit and matches the IEC 61131-3 standard. Additionally, LTIME is supported as an extension
to the standard as time base for high-resolution timers. LTIME is of size 64 bit and resolution
nanoseconds.
The library [Link] provides functions for WSTRING strings.
The time declaration can include the following time units. They have to be used in the following
sequence, but it is not required to use all of them.
d: days
h: hours
m: minutes
s: seconds
ms: milliseconds
Example Description
TIME1 := T#14ms; –
TIME1 := T#100S12ms; (* The highest component may be allowed to
exceed its limit *)
TIME1 := t#12h34m15s; –
Example Description
TIME1 := t#5m68s; (* limit exceeded in a lower component *)
TIME1 := 15ms; (* T# is missing *)
TIME1 := t#4ms13d; (* incorrect order of entries *)
872 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 873
Operands
DATE Constants
Overview
Use these constants to enter dates.
Syntax
d#<date declaration>
Instead of d# you can also use the following:
D#
date
DATE
874 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
DATE_AND_TIME Constants
Overview
DATE constants and TIME_OF_DAY constants can also be combined to form so-called
DATE_AND_TIME constants.
Syntax
dt#<date and time declaration>
Instead of dt# you can use the following:
DT#
date_and_time
DATE_AND_TIME
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 875
Operands
TIME_OF_DAY Constants
Overview
Use this type of constant to store times of the day.
Syntax
tod#<time declaration>
Instead of tod# you can also use the following:
TOD#
time_of_day#
TIME_OF_DAY#
876 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
Number Constants
Overview
Number values can appear as binary numbers, octal numbers, decimal numbers, and hexadecimal
numbers. Integer values that are not decimal numbers are represented by the base followed by the
number sign (#) in front of the integer constant. The values for the numbers 10...15 in hexadecimal
numbers are represented by the letters A...F.
You can include the underscore character within the number.
Examples
14 (decimal number)
2#1001_0011 (dual number)
8#67 (octal number)
16#A (hexadecimal number)
Implicit conversions from larger to smaller variable types are not permitted. This means that a DINT
variable cannot simply be used as an INT variable. Use the type conversion functions
(see page 814).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 877
Operands
REAL/LREAL Constants
Overview
REAL and LREAL constants can be given as decimal fractions and represented exponentially. Use
the standard American format with the decimal point to do this.
Examples
878 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
String Constants
Overview
A string constant is an arbitrary sequence of characters. STRING (see page 725) constants are
preceded and followed by single quotation marks. WSTRING (see page 725) constants are
preceded and followed by double quotation marks. The characters are coded according to the
character set specified in ISO/IEC 8859-1. You may also enter blank spaces and special
characters (special characters for different languages, like accents or umlauts).
In strings, the combination of the dollar sign ($) followed by 2 hexadecimal numbers is interpreted
as a hexadecimal code according to the coding in ISO/IEC 8859-1. The code corresponds to
ASCII code. In addition, note the special cases presented in the table.
Hexadecimal Code
Combinations of characters starting with a dollar sign which are interpreted as hexadecimal code:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 879
Operands
Examples
Constant declaration of a STRING:
VAR CONSTANT
constA : STRING := 'Hello world';
constB : STRING := 'Hello world $21'; // Hello world!
END_VAR
Examples of WSTRING declarations:
wstr:WSTRING:="This is a WString";
wstr10 : WSTRING(10) := "1234567890";
880 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
Overview
Basically, in using IEC constants, the smallest possible data type will be used. An exception is
REAL/LREAL constants where LREAL is always used. If another data type has to be used, use
typed literals (typed constants) without the necessity of explicitly declaring the constants. For this
purpose, the constant will be provided with a prefix which determines the type.
Syntax
<Type>#<Literal>
<Type> is the desired data type. Possible entries are:
BOOL
SINT
USINT
BYTE
INT
UINT
WORD
DINT
UDINT
DWORD
REAL
LREAL
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 881
Operands
Section 35.2
Variables
Variables
882 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
Variables
Overview
You can declare variables either locally in the declaration part of a POU or in a global variable list
(GVL) or in a persistent variables list or in the I/O mapping of devices.
Refer to the chapter Variables Declaration (see page 619) for information on the declaration of a
variable, including the rules concerning the variable identifier and multiple use.
It depends on the data type (see page 721) where a variable can be used.
You can access available variables through the Input Assistant.
Syntax Access to
<array name>[Index1, Index2] 2-dimensional array (see page 740)
components
<structure name>.<variable name> structure (see page 744) variables
<function block name>.<variable name> function block and program variables
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 883
Operands
Overview
In integer variables, individual bits can be accessed. For this purpose, append the index of the bit
to be addressed to the variable and separate it by a dot. You can give any constant to the bit index.
Indexing is 0-based.
Syntax
<variablename>.<bitindex>
Example
a : INT;
b : BOOL;
...
a.2 := b;
The third bit of the variable a will be set to the value of the variable b, this means that variable a
will equal 3.
If the index is greater than the bit width of the variable, the following message will be generated:
'Index '<n>' outside the valid range for variable '<var>'!'
Bit addressing is possible with variables of the following data types:
SINT
INT
DINT
USINT
UINT
UDINT
BYTE
WORD
DWORD
If the data type does not allow bit accessing, the following message will be generated:
'Invalid data type '<type>' for direct indexing'.
Do not assign bit access to a VAR_IN_OUT variable.
884 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 885
Operands
886 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
Section 35.3
Addresses
Addresses
Direct Addresses
Overview
A direct address specified in EcoStruxure Machine Expert contains the following information:
Information on the memory location.
Memory format (size)
Offset of the memory location. The offset is specified by an integer number, which in case of a
bit address is followed by a dot and a number for the position of the bit.
Syntax
%<memory area prefix><size prefix><number|.number|.number....>
The following memory area prefixes are supported:
X single bit
None single bit
B byte (8 bits)
W word (16 bits)
D double word (32 bits)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 887
Operands
Examples
NOTE: The memory size for input, output, and memory data (declarations with AT %I, %Q and %M)
is predefined by the target device and can be overwritten in the properties of an application object
(see EcoStruxure Machine Expert, Menu Commands, Online Help) for PacDrive controllers
(PacDrive LMC Eco, PacDrive LMC Pro/Pro2).
Mode Example
Byte addressing ADR(%IW1) = ADR(%IB1)
Word addressing ADR(%IW1) = ADR(%IB2)
The range for the second element of the bit address that is the number following the dot, is as
follows:
byte addressing mode: 0...7
word addressing mode: 0...15
Also for the handling of bit addresses, you can configure the devices differently. They are then
interpreted correspondingly by the EcoStruxure Machine Expert compiler.
Example: In a byte-addressing device, the bit address %IX2.5 addresses byte 2 (IB2). In a word-
addressing device, however, it addresses word 2, which refers to a different location within the
memory.
NOTE: Boolean values are allocated bytewise if no explicit single-bit address is specified.
Example: A change in the value of varbool1 AT %QB7 affects the range from QX0.0 to QX0.7.
888 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Operands
Section 35.4
Functions
Functions
Functions
Overview
In ST, a function call can be used as an operand.
Example
Result := Fct(7) + 3;
For a general description of functions and their declarations, refer to the Function description in the
Program Organization Unit (POU) section of this Programming Guide (see page 178).
TIME() Function
This function returns the time (based on milliseconds) which has been passed since the system
was started.
The data type is TIME.
Example in IL
TIME
ST systime (* Result for example: T#35m11s342ms *)
Example in ST
systime:=TIME();
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 889
Operands
890 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
EcoStruxure Machine Expert Templates
EIO0000002854 06/2019
Part VIII
EcoStruxure Machine Expert Templates
Chapter 36
General Information about Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 893
General Information about Templates
Section 36.1
EcoStruxure Machine Expert Templates
894 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
General Information about Templates
Overview
EcoStruxure Machine Expert provides templates in order to make dedicated control and
visualization functionality that has been developed in one EcoStruxure Machine Expert project
easily available to other EcoStruxure Machine Expert projects. They help to standardize the usage
of field devices and application functions throughout different EcoStruxure Machine Expert
projects.
The following types of templates are available:
Device templates that are associated with a single field device or I/O module
Function templates that are associated with a high-level application function
EcoStruxure Machine Expert provides various templates, but you can also create your own
templates for functionalities you want to make available in other projects.
Step Action
1 Create your functionality within a EcoStruxure Machine Expert project and test it with the
appropriate hardware or in the simulation.
2 Save the functionality in a template library.
3 Open another EcoStruxure Machine Expert project and select the template from the template
library in order to make the functionality available to this project.
General Notes
When using EcoStruxure Machine Expert templates, note the following:
Templates are not controller-specific and can therefore be made available for any controller.
Verify that the controller to which you add the template is capable of executing the functionality
contained in the template.
After the template has been installed, you can freely adapt the created objects to your individual
requirements.
It is possible to install one template several times on the same controller device. In order to avoid
naming conflicts when creating the objects, they are renamed automatically during installation.
For further information, refer to the Naming of Objects section of the Adding Devices from
Template chapter (see page 910).
Templates do not support the use of direct representations of variables (for example %IX2.0).
However, you can use direct representations with an incomplete address specification (for
example %I*). For further information, refer to the chapter Variables configuration -
VAR_CONFIG (see page 645).
NOTE: Although this form of placeholder for direct addresses is available, avoid direct addressing
in your programs, and use symbolic addressing wherever and whenever possible.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 895
General Information about Templates
Supported Fieldbusses
EcoStruxure Machine Expert templates can include field devices that are linked to the following
fieldbusses:
CANopen
Modbus serial line (Modbus IOScanner)
Modbus TCP IO Scanner
SoftMotion General Drive Pool (LMC058)
CANmotion
Ethernet IP Scanner
Sercos3
896 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
General Information about Templates
Overview
The following paragraphs provide an overview of how to create new or change existing device or
function templates and to save them as files for transferring them to other PCs.
Template Libraries
Template libraries contain the definition of several device or function templates.
Write Protection
The standard template libraries included in the EcoStruxure Machine Expert scope of delivery are
write-protected, which means that they cannot be deleted or renamed.
NOTE: You cannot change write-protected libraries (uninstalling individual templates or changing
names), but you can completely uninstall them.
Template Administration
For administration of the available device and function templates in EcoStruxure Machine Expert,
select Tools → Template Repository in the EcoStruxure Machine Expert Logic Builder.
The Template Repository dialog box opens:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 897
General Information about Templates
From the Location list, select the type of templates to be displayed in the Installed Templates box:
<All locations> is selected by default: all available device and function templates are displayed
Legacy displays the device and function templates of EcoStruxure Machine Expert V3.1 (if
installed)
User: displays only those device and function templates that you have created or installed
System: displays the standard device and function templates delivered by EcoStruxure Machine
Expert
The path to the directory where the template libraries are stored is displayed below the Location
field.
The Installed Templates box lists the installed templates in 2 groups: Device Templates and
Function Templates. Each template library can either contain device templates or function
templates.
Step Action
1 Click the Install button in the Template Repository dialog box.
Result: A File open dialog box opens.
2 Browse to the folder where the template library file you want to install is saved.
3 Select the library file you want to install and click OK.
Result: The selected template library is installed and is indicated in the Template Repository
dialog box, including the device or function templates it contains.
Step Action
1 In the Installed Templates list of the Template Repository dialog box, select the template library
you want to remove.
2 To remove the selected template library, click the Uninstall button.
Result: The selected template library is removed from the installation.
898 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
General Information about Templates
Step Action
1 In the Installed Templates list of the Template Repository dialog box, select the template library
you want to rename.
2 Click the name of the template library you want to change.
Result: A box opens.
3 Enter the new name in the box and press Enter or leave the box.
Result: The template library is now assigned to the new name.
Step Action
1 To create a new template library, select the option User or <All locations> from the Location list.
2 To create a new template library for device templates, select the Device Templates node in the
Installed Templates list and click the Create Library button.
Result: A new template library with a default name is added at the bottom of the Device
Templates section of the Installed Templates list.
To create a new template library for function templates, select the Function Templates node in
the Installed Templates list and click the Create Library button.
Result: A new template library with a default name is added at the bottom of the Function
Templates section of the Installed Templates list.
3 Rename the new template library as stated above and fill it with device or function templates by
using for example the copy and paste operations described below.
Step Action
1 Select the template library you want to export in the Installed Templates list.
2 Click the Save As File... button.
3 In the Save File dialog box, navigate to the folder where you want to save the template library
file.
4 Transfer the template library file to the other PC and install it by using the Template Repository.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 899
General Information about Templates
900 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
General Information about Templates
The Properties dialog box for the selected library or template library is displayed.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 901
General Information about Templates
If the selected library or template library is not write-protected, the Properties dialog box contains
the following parameters that you can edit, along with their corresponding buttons:
Element Description
Template Name / Library Name box Indicates the name of the library or template library these properties apply to.
To change the name, click this box and adapt the name according to your
requirements.
Help ID box For Schneider Electric templates or template libraries, contains the reference
to the respective description in the online help.
If there is an online help document available for your templates, you can
enter a full reference to its location in the online help or a keyword
corresponding to an index in the online help.
Show Help button Opens the online help document specified in the Help ID box or the index of
the online help searching for the keyword specified in the Help ID box.
Info section –
Language list Contains the languages that are available for the graphical user interface of
EcoStruxure Machine Expert. If you select a language, the content of the
language-dependent elements Comment, Description, and Picture is
displayed in the selected language.
If no language-specific content is available, the default language English is
displayed.
Import From File Displays a standard Open dialog box. It allows you to browse for an XML file
button that contains the localized content of the language-dependent elements
Comment, Description, and Picture. The structure of this XML file must
follow the structure indicated in the example (see page 903).
Comment box Allows you to enter a short text (for example to provide an overview of the
contents and purpose of the selected library or template library). This text is
indicated as a tooltip when you select template libraries in EcoStruxure
Machine Expert.
Description box Allows you to enter a long text (for example to provide a detailed description
of the contents and purpose of the selected library or template library.
Picture parameter Allows you to enter a path to a language-specific picture.
... button You can also click the ... button to browse for the graphic file.
Supported graphic formats:
Bitmap: *.bmp
JPEG: *.jpg
Graphics interchange format: *.gif
Icon: *.ico
After the picture has been specified, it will be displayed in the Properties
dialog box.
If you click the OK button, the picture is embedded in the template.
The check box Read-Only is only available for template libraries to indicate whether the selected
template library is in read-only status. It is not possible to change the status of the template library
here.
902 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
General Information about Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 903
General Information about Templates
904 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Managing Device Templates
EIO0000002854 06/2019
Chapter 37
Managing Device Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 905
Managing Device Templates
Section 37.1
Managing Device Templates
906 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Device Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 907
Managing Device Templates
Overview
Device templates are related to a specific fieldbus device. They contain the following information:
Fieldbus device configuration
Control logic (controller programming) (optional)
Visualization elements (visualization programming) (optional)
You can create your own device templates from your project. For details, refer to the Steps to
Create a Device Template chapter (see page 915).
Step Action
1 Open the Devices & Modules view of the hardware catalog.
2 At the bottom of the Devices & Modules view, activate the option Device Template.
Result: The templates of field devices available in EcoStruxure Machine Expert are displayed in the
Devices & Modules view.
3 Select an entry in the Devices & Modules view, drag it to the Devices tree, and drop it at a suitable
subnode of a controller.
Remark: Suitable subnodes are highlighted by EcoStruxure Machine Expert.
Result: The Add Device From Template dialog box displays.
4 In the Add Device From Template dialog box, set the Device Name as well as the Device Address if the
fieldbus requires numerical addresses. In case the device templates includes control logic, select the
program (POU) in which the control logic is inserted.
5 Click the OK button.
Result: The device is created and parameterized according to the selected device template including the
optional visualization screens and control logic.
908 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Device Templates
Step Action
1 Open the Devices tree.
2 Right-click field device manager, and execute the command Add Device From Template from the
contextual menu.
Result: The Add Device From Template dialog box displays.
3 In the Add Device From Template dialog box, select the Device Template to be used, and set the Device
Name as well as the Device Address if the fieldbus requires numerical addresses. In case the device
templates includes control logic, select the program (POU) in which the control logic is inserted.
4 Click the OK button.
Result: The device is created and parameterized according to the selected device template including the
optional visualization screens and control logic.
NOTE: The undo / redo function is not available for the process of creating field devices.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 909
Managing Device Templates
Naming of Objects
In order to avoid naming conflicts if the same device template is used as a basis for creating
different field devices, the following naming conventions are applied to the field devices and the
associated objects (FB, visualization, and variables):
910 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Device Templates
Overview
You can create device templates based on field devices or I/O modules. The following description
applies to field devices as well as to I/O modules even though only the term field device is used to
increase readability.
The following paragraphs list:
The criteria that must be fulfilled in order to save a field device or I/O module, including logic and
visualization, as device template;
The information that is saved in the device template.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 911
Managing Device Templates
Overview
Each device template can be associated with 1 or more Logic Builder visualizations. The supported
types of visualizations are described as follows.
Supported Visualizations
EcoStruxure Machine Expert supports both types of visualizations:
Plain visualizations
Modular visualizations using frames
Plain Visualizations
Visualizations without frames are based on a single visualization object, created for the I/O device.
EcoStruxure Machine Expert references the data of the I/O device within the properties of the
visual elements. When you create a new device based on this device template, EcoStruxure
Machine Expert directly replaces the variables in the properties of the visual elements.
912 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Device Templates
Overview
You can include control logic into a device template if the logic contains one or more code sections
that exchange data with this field device in one of the following ways:
A code section uses a new variable that is defined in the I/O mapping of the field device.
A code section and the I/O mapping of the field device use a common variable that is defined in
a GVL or a controller program contained by the application to which the code section belongs.
NOTE: If you use structures or arrays, verify that they are only related to a single field device.
A code section and the field device use a fix device-specific variable (for example the axis-ref
variables used with the Altivar or Lexium drives).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 913
Managing Device Templates
914 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Device Templates
Overview
The following paragraphs list the steps that have to be performed in order to save field devices
meeting the criteria stated in Creating a Device Template on the Basis of Field Devices
(see page 911).
Step Action
1 Right-click the field device you want to save as device template in the Devices tree.
2 Select the command Save As Device Template from the contextual menu.
Result: EcoStruxure Machine Expert automatically builds the application. After the built process has been
successfully completed, the Save as Device Template dialog box will be displayed.
3 Define the new device template in the Save as Device Template dialog box as stated below.
4 Click OK to close the Save as Device Template dialog box and to create your new device template.
1 indicates the type of the field device on which the device template is based
2 indicates the fieldbus type of the field device
3 the name of the device template that will be created (initially the name of the original field device)
4 select the template library the device template will be added to
5 select function blocks and visualizations that should be saved with the device template
6 Properties button to add further information to the device template
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 915
Managing Device Templates
Step Action
1 In the Save as Device Template dialog box, click the ... button right to the Template Library text box.
Result: The Select Template Library dialog box will be displayed.
2 The Select Template Library dialog box displays all template libraries that have been installed for the
current project or have been created. Write-protected template libraries are not displayed.
To add the new device template to 1 of these template libraries, select the suitable entry and click OK.
Step Action
1 In the Save as Device Template dialog box, click the ... button to the right of the Function Blocks text box.
Result: The Select Function Block dialog box will be displayed.
The Select Function Block dialog box displays all function block instances contained by the control logic
of the field device (see page 913).
2 Select the check box of an individual function block to select it for the device template.
Or select the check box of a root node to select all elements below this node.
3 Click the OK button.
Step Action
1 In the Save as Device Template dialog box, click the ... button to the right of the Visualizations text box.
Result: The Select Visualizations dialog box will be displayed.
The Select Visualizations dialog box displays those visualizations that are linked with the field device or
with one of the selected function blocks.
2 Select the check box of an individual visualization to select it for the device template.
Or select the check box of a root node to select all elements below this node.
3 Click the OK button.
916 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Device Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 917
Managing Device Templates
918 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Managing Function Templates
EIO0000002854 06/2019
Chapter 38
Managing Function Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 919
Managing Function Templates
Section 38.1
Managing Function Templates
920 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Function Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 921
Managing Function Templates
Procedure
EcoStruxure Machine Expert provides two ways to add a function from a function template:
To add an application function from a function template via drag-and-drop, proceed as follows:
Step Action
1 Open the Macros view of the Software Catalog.
2 Drag a function template from the Macros view and drop it on a suitable node in a navigator.
Suitable nodes are:
An application node in the Applications tree
A folder node below an application node in the Applications tree
A controller node in the Functional tree
A functional module node in the Functional tree
Alternatively, you can add an application function from a function template by right-clicking a
suitable node in a navigator and executing the command Add Function From Template from the
contextual menu.
922 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Function Templates
The Add Function From Template dialog box provides the following elements to configure your
function:
Element Description
Function Name text box Enter a name that is used for the new folder of this application and for
the naming of the elements it contains.
Function Template Click the ... button and select a function template from the Select
Function Template dialog box.
I/O Devices table –
Device Name Contains the name of the future field device. You cannot change this
name.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 923
Managing Function Templates
Element Description
Device Type Indicates the type of the field device. You cannot edit this cell.
Fieldbus Type Indicates the fieldbus type of the field device. You cannot edit this cell.
Master Contains the fieldbus master to which the field device is connected. If
there are several masters, you can select the master of your choice
from the list.
Address Initially empty. For field devices on fieldbusses that require numerical
addresses (Modbus serial line and CANopen), click the ... button right
to the field and assign the address of your choice.
I/O Mapping table Lists the I/O variables that are part of the function template. It allows
you to map them to the I/O channels of existing devices and modules.
Name Contains the name of the I/O variable that has to be mapped on an
I/O channel.
Data Type Indicates the data type of the I/O channel to which the I/O variable was
originally mapped.
Mapping Click the ... button to open the Select I/O Mapping dialog box. It allows
you to select an I/O channel on which you can map the selected
variable.
After the variable has been mapped to an I/O channel, this Mapping
field contains the input or output address of the I/O channel on which
the variable is mapped.
Description Contains a description of the I/O variable.
Parameters table Lists the template parameters included in the function template.
Object Indicates the name of the GVL or program in which the variable is
defined. You cannot edit this field.
Name Contains the name of the variable. You cannot edit this cell.
Data Type Indicates the data type of the variable. You cannot edit this cell.
Default Indicates the default value of the variable. This is the initial value of the
variable when the template was created. You cannot edit this cell.
New Value Edit this cell if you want to assign a new value to the variable. If you
leave this cell empty, the Default value is used for this variable.
Enter a value that is valid for the given data type.
Description Contains a description of the variable.
OK button Confirm your settings by clicking the OK button.
Result: EcoStruxure Machine Expert verifies whether the settings are
correct and inserts the new application function as separate node
below the Application node or displays an error detection message.
924 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Function Templates
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 925
Managing Function Templates
The Select I/O Mapping dialog box contains the following columns:
Column Description
Channel Contains the tree structure. Each device is represented by the device name and
the device icon. Each I/O channel is represented by the channel name.
Address Contains the input / output address that corresponds to the I/O channel.
Mapping Contains the I/O variable that is currently mapped on the I/O channel.
Description Contains the description of the I/O channel.
Objects Created
The function template creates the following objects in your project:
Object Description
Root folder A new folder is created under the Application node in the Devices tree that is named as defined
in the Function Name text box.
Field devices The field devices that are included in the function template are created using names that apply
to the naming rules and are connected to the fieldbus master. The I/O mapping is automatically
adjusted, if necessary.
Objects available The objects that are included in the function template are created below the root folder in the
as subnodes of the respective navigator (Devices tree, Applications tree, Tools tree) using names that apply to the
root folder in the naming rules. The properties of the objects are automatically adjusted.
navigators
Task configuration The task configuration is adjusted as required by the function template.
Global variable The global variable lists that are included in the function template are created below the root
lists folder using names that apply to the naming rules.
External variables Global variables whose global variable lists do not belong to the function template are restored
in their original global variable list as follows:
If a global variable list with the original name does not already exist below the application, it
is created automatically.
If a global variable with the original name does not already exist in this global variable list, it
is created automatically.
If the type of global variable is not correct, EcoStruxure Machine Expert issues an error detection
message.
926 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Function Templates
Object Description
Persistent Persistent variables are restored in the respective variable list of the application as follows:
variables If a persistent variable list does not already exist below the application, it is created
automatically with its original name.
If a variable with the original name does not already exist in the persistent variable list, it is
created automatically.
If the type of persistent variable is not correct, EcoStruxure Machine Expert issues a message.
External objects Objects that are not included in the function template but are referenced by the function template
(such as function blocks and DUTs) are handled as follows:
If the object does not exist, it is created
If the object already exists and has not been modified, it remains unchanged
If the object already exists and modifications are detected, an error is reported in the
Messages view. To display further information on the detected modifications, click the entry
in the Messages view.
Any objects that are created with the instantiation of the function template are listed in the
Messages pane.
Naming of Objects
In order to avoid naming conflicts, if you instantiate the same function template several times on
the same controller device, the following naming conventions are applied to the application
functions and the associated objects:
NOTE: Use rather short names for your application functions so that they are completely displayed.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 927
Managing Function Templates
Overview
The following paragraphs list:
The criteria that must be fulfilled in order to save an application function with its associated field
devices, I/O modules, and visualizations as function template;
The information that is saved in the function template.
Otherwise, they will not be considered when executing the Build command.
928 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Function Templates
Template Parameters
A template parameter is a variable with an adjustable initial value.
Example:When a device is used via a communication function block, then you have to assign the
address of the device to this function block as an input parameter. To be able to set this address,
connect a variable to the function block and define the variable as a template parameter.
A variable can become a template parameter if the following conditions apply:
The variable is defined in a program or global variable list that is included in the function
template.
The variable has a simple data type (BOOL, any numeric data type, any STRING, alias types
based on a simple data type).
The initial value of the variable is explicitly defined as a literal value.
All variables that meet these conditions can be selected as template parameter when the function
template is saved (see page 933).
If a variable was selected as a template parameter, the initial value of this variable can be adjusted
when a new application function is created from the function template (see page 923).
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 929
Managing Function Templates
Overview
EcoStruxure Machine Expert provides 2 ways to create a function template:
From the Macros view using the Create New Template dialog box.
From the Applications tree or Functional tree using the Save as Function Template dialog box.
The following paragraphs list the steps that have to be performed in order to save already available
application functions that meet the criteria stated in Application Functions as Basis for Function
Templates (see page 928) as function templates.
Step Action
1 In the Macros view, expand the section My Template.
2 Select the My Template node, and click the green plus button.
Result: A new node with the default name LIB1 is inserted below the MyTemplate node.
3 Select the LIB1 node and click the green plus button.
Result: The Create New Template dialog box displays.
930 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Function Templates
Step Action
4 In the Function Template tab of the Create New Template dialog box, enter a Name for your function
template.
Drag the elements you want to include in the function template from the Applications tree to the Elements
box of the Function Template tab. The elements listed in this box is inserted in your function template.
NOTE: The elements must belong to the same application.
5 The Parameters tab of the Create New Template dialog box displays those variables that are included in
the elements you selected in the Function Template tab.
From the list of variables, select those you want to declare as template parameters by selecting the check
box of the variable or of a node.
6 The Properties tab of the Create New Template dialog box allows you to add further information to the
function template.
You can insert a link to the online help of this function template. The dialog box allows you to add further
textual information that can be localized, and you can add a graphic illustrating this function template. For
a description of these parameters, refer to the chapter Adding Further Information for Templates or
Template Libraries (see page 900).
7 Click the Save Template button.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 931
Managing Function Templates
Step Action
1 Right-click a subfolder of an application node in the Applications tree or a functional model node in the
Functional tree.
2 Execute the command Save As Function Template from the contextual menu.
Result: EcoStruxure Machine Expert automatically builds the application. After the built process has been
successfully completed, the Save As Function Template dialog box is displayed.
Step Action
1 In the Save as Function Template dialog box, click the ... button next to the Template Library text box.
Result: The Select Template Library dialog box is displayed.
2 The Select Template Library dialog box displays the template libraries that have been installed for the open
project or have been created. Write-protected libraries are not displayed.
To add your new function template to one of these template libraries, select the suitable entry and click OK.
932 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Managing Function Templates
Step Action
1 In the Save as Function Template dialog box, click the ... button to the right of the Parameters text box.
Result: The Select Variables as Parameters dialog box is displayed.
It displays the variables that are defined in the selected application.
2 Select the check box of an individual variable to select it as template parameter for the function template.
Or select the check box of a root node to select all elements below this node.
3 Click the OK button.
Result: The selected variables are displayed in the Parameters text box of the Save as Function Template
dialog box.
They are displayed in the Parameters table of the Add Function From Template dialog box where you can
assign New Values for these parameters.
Step Action
1 In the Save as Function Template dialog box, click the ... button right to the Template Name text box.
2 Browse to the already available function template you want to replace.
3 Select the function template you want to replace.
Result: The name of this function template is inserted in the Template Name text box and the name of the
template library where it is stored in is inserted in the Template Library text box.
4 Click OK to close the Save as Function Template dialog box and to replace the selected function template
with the new application function.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 933
Managing Function Templates
934 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Troubleshooting and FAQ
EIO0000002854 06/2019
Part IX
Troubleshooting and FAQ
Chapter 39
Generic - Troubleshooting and FAQ
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 937
Generic - Troubleshooting and FAQ
Section 39.1
Frequently Asked Questions
938 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Generic - Troubleshooting and FAQ
Overview
This section provides instructions on enabling analog inputs according to the CANopen standard
by setting the SDO (Service Data Object) 6423 to the value 1.
Procedure
Step Action
1 Double-click the node of your analog CANopen device in the Devices tree.
2 In the CANopen Remote Device tab of the editor, enable the option Enable Expert Settings.
Result: Additional tabs are displayed and the Service Data Object tab is populated with information.
3 Open the Service Data Object tab and click the New... button.
Result: The Select item from object directory dialog box is displayed.
4 From the list of objects, select object 6423, enter 1 as Value, and click OK.
Result: Analog input transmission on the CANopen bus is activated. You can now configure parameters
of the analog values as described in the hardware manual of your device.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 939
Generic - Troubleshooting and FAQ
Overview
Beside the PC configuration there are several other conditions which can increase the time
EcoStruxure Machine Expert is consuming during startup:
940 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Generic - Troubleshooting and FAQ
Overview
The menus and shortcuts of the EcoStruxure Machine Expert software differ depending on the
current state, that is, the window or editor that is currently open.
You can adapt the shortcuts and menus to your individual preferences or you can load the
EcoStruxure Machine Expert or CoDeSys standard shortcuts and menus as described in the
following sections.
Step Action
1 Execute the Customize command from the Tools menu.
Result: The Customize dialog box will be displayed.
2 In the Customize dialog box, click the Load... button.
Result: The Load Menu dialog box will be displayed.
3 In the Load Menu dialog box, navigate to the folder ...\Program Files\Schneider
Electric\SoMachine Software\Vx.x\LogicBuilder\Settings, select the file [Link], and
click Open.
Result: The Customize dialog box now shows the standard EcoStruxure Machine Expert
settings.
4 To load these standard settings to the EcoStruxure Machine Expert graphical user interface,
click OK.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 941
Generic - Troubleshooting and FAQ
Step Action
1 Execute the Customize command from the Tools menu.
Result: The Customize dialog box will be displayed.
2 In the Customize dialog box, click the Load button.
Result: The Load Menu dialog box will be displayed.
3 In the Load Menu dialog box, navigate to the folder ...\Program Files\Schneider
Electric\SoMachine Software\Vx.x\LogicBuilder\Settings\OriginalCoDeSys, select the file
[Link], and click Open.
Result: The Customize dialog box now shows the CoDeSys settings.
4 To load these CoDeSys settings to the EcoStruxure Machine Expert graphical user interface,
click OK.
NOTE: The menus and shortcuts of the EcoStruxure Machine Expert software differ, depending on
the window or editor that is currently open.
Expanding Menus
EcoStruxure Machine Expert main menus and context menus can be displayed in a collapsed or
full view. In the collapsed mode seldom used or disabled commands are hidden. After clicking the
arrow menu item at the bottom of a menu, the corresponding menu expands, showing all its
menu items.
For always showing the menus in the full viewing mode, activate the option Always show full menus
in the Tools → Options → Features dialog box.
942 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Generic - Troubleshooting and FAQ
How Can I Increase the Memory Limit Available for EcoStruxure Machine Expert on 32-
Bit Operating Systems?
Overview
Large EcoStruxure Machine Expert projects can stress a 32-bit operating system to the technical
limit regarding memory consumption. This is due to 32-bit operating systems providing only 2 GB
of memory for user processes such as EcoStruxure Machine Expert.
Step Action
1 Goto Start Menu → All Programs → Accessories.
2 Right-click Command Prompt and execute the command Run as Administrator.
3 Enter bcdedit /set IncreaseUserVa 3072.
4 Restart the computer.
Step Action
1 Goto Start Menu → All Programs → Accessories.
2 Right-click Command Prompt and execute the command Run as Administrator.
3 Enter bcdedit /deletevalue IncreaseUserVa.
4 Restart the computer.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 943
Generic - Troubleshooting and FAQ
Overview
This chapter provides tips that may help to reduce the memory consumption of the EcoStruxure
Machine Expert process on your system.
944 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Generic - Troubleshooting and FAQ
Good Practices
The list of good practices may help you to avoid a slow performance when working with
EcoStruxure Machine Expert:
Verify that the hardware of the PC meets the system requirements (see EcoStruxure Machine
Expert, Introduction).
Use a Solid State Drive (SSD) and verify that sufficient memory space is available. Contact your
IT administration for further details.
Consider uninstalling components that you do not need via the EcoStruxure Machine Expert
Configuration Manager.
If you are using Vijeo-Designer integrated in EcoStruxure Machine Expert, consider to disable
the automatic symbol export function. To achieve this, activate the option Disable automatic
symbol export in the EcoStruxure Machine Expert Logic Builder Options → Vijeo-Designer
dialog box (see EcoStruxure Machine Expert, Menu Commands, Online Help).
Consider activating the option Disable undo after deleting a DTM (performance optimization) in
the EcoStruxure Machine Expert Logic Builder Options → FDT Options dialog box
(see EcoStruxure Machine Expert, Menu Commands, Online Help) if this function is not
frequently used.
Avoid large POUs. EcoStruxure Machine Expert has no limit for the size of POUs programmed
in graphical languages like LD. Nevertheless, it is a good practice to call POUs in sequences
instead of creating one large POU.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 945
Generic - Troubleshooting and FAQ
Overview
This section provides instructions that may help you to solve issues that were detected when using
Modbus IOScanner on a Serial Line.
Step Action
1 Verify the integrity of your cable.
2 Verify that your cable is correctly connected between the controller and the Modbus Serial
slave.
3 Reset your controller.
After the communication to the slave has been re-established, a rising edge on the xReset entry
of the slave is required:
To reset xError.
To update the values of uiNumberOfCommunicatingSlaves.
To update the values of xAllSlavesOK.
946 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Generic - Troubleshooting and FAQ
Problem
The NVL communication has been suspended after an online change.
Solution
Restart the target controller.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 947
Generic - Troubleshooting and FAQ
948 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Accessing Controllers - Troubleshooting and FAQ
EIO0000002854 06/2019
Chapter 40
Accessing Controllers - Troubleshooting and FAQ
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 949
Accessing Controllers - Troubleshooting and FAQ
Section 40.1
Troubleshooting: Accessing New Controllers
950 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Accessing Controllers - Troubleshooting and FAQ
Overview
To access a new controller, adapt the network settings of the controller to the network of your
EcoStruxure Machine Expert PC. This chapter provides a step-by-step example.
Example
This example shows the steps to access an LMC058 with IP address [Link] from a PC with
IP address [Link] residing in subnet [Link].
Step Action
1 Connect the controller directly to the PC running EcoStruxure Machine Expert or to the network of the PC
using an Ethernet cable.
2 In EcoStruxure Machine Expert, open the Communication Settings view of the device editor
(see page 105).
Result: The LMC058 controller will be included in the list.
3 To adapt the communication settings of the controller, right-click the controller in the Communication
Settings list, and execute the command Edit communication settings... from the contextual menu.
Result: The Edit communication settings dialog box opens.
4 In the Edit communication settings dialog box, enter a free IP address available in your network.
When configuring IP addresses, refer to the hazard message below.
5 Click OK to confirm the Edit communication settings dialog box.
6 In the Communication Settings view, connect to the controller.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 951
Accessing Controllers - Troubleshooting and FAQ
Carefully manage the IP addresses because each device on the network requires a unique
address. Having multiple devices with the same IP address can cause unintended operation of
your network and associated equipment.
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that all devices have unique addresses.
Obtain your IP address from your system administrator.
Confirm that the device’s IP address is unique before placing the system into service.
Do not assign the same IP address to any other equipment on the network.
Update the IP address after cloning any application that includes Ethernet communications to
a unique address.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
NOTE: Some controllers support a parameter that helps to prevent them from being remotely
accessed (RemoteCommunicationAccess parameter of the LMC •0•C controllers.
952 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Accessing Controllers - Troubleshooting and FAQ
Overview
The used communication protocol offers a mechanism to connect to a controller independent of
the type of connection. For example, this allows access to a target controller that is connected via
Ethernet to another hop controller that is connected via USB to the PC itself.
1 PC
2 hop controller
3 target controller
4 USB
5 Ethernet
Address Information
In the example, USB uses a different protocol. It is therefore normally not possible to use the
IP address to address the target controller. Instead, the routing information is used that describes
the way to connect to the target controller over 1 or more hops.
This routing information is displayed as a tooltip of an entry of the controller list (in the following
example [Address] 0000.2001):
NOTE: Since this address only describes the way the controller is connected, it can change upon
each modification of the local PCs or the network adapter settings of the hop controller. For
example, upon activating or deactivating network adapters or upon starting/stopping services that
use network adapters. The address to a specific target can differ from different sending PCs.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 953
Accessing Controllers - Troubleshooting and FAQ
Nodename
Since the Nodename of the controller is a stable identifier in the system, it is used to identify the
target.
If IP Address is selected as Connection Mode, it is tried to get the information from the Nodename
itself. Some controllers (such as LMC •0•C) create the Nodename automatically including the
IP address. You can also configure the Nodename by yourself (as described in the FAQ Why is
the Controller not Listed in the Communication Settings View? (see page 957)) to enable the
system to find a controller by its IP address. If the IP address is missing in the nodename, it is tried
to get the IP address from a controller. But not all devices or their current firmware version support
the service. In this case, use the Connection Mode Nodename to connect or set a device name
that includes the IP address in brackets. For example MyDevice ([Link]).
954 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Accessing Controllers - Troubleshooting and FAQ
Section 40.2
FAQ - What Can I Do in Case of Connection Problems With the Controller?
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 955
Accessing Controllers - Troubleshooting and FAQ
Why is a Connection to the Controller not Possible Even Though the IP Address Seems to Fit?
If you have set the IP address of the controller as described in the Accessing New Controllers
chapter (see page 951), and you still cannot connect to the controller, the reason can be the subnet
mask. Since the used communication protocol requires an identical subnet mask on both the
sender and the receiver site, it may be possible that a ping to the controller is successful, but a
connection cannot be established.
In order to solve this issue, proceed as follows:
Step Action
1 In EcoStruxure Machine Expert, open the Communication Settings view of the device editor
(see page 105).
2 To adapt the communication settings of the controller, right-click the controller in the Communication
Settings list, and execute the command Edit communication settings... from the contextual menu.
Result: The Edit communication settings dialog box opens.
3 Adapt the Subnet mask configured for the controller exactly to the subnet mask of your EcoStruxure
Machine Expert PC.
Example:
Change [Link] to [Link].
NOTE: After you have changed the Connection Mode in the Communication Settings dialog box,
it may be required to perform the login procedure twice to gain access to the selected controller.
Step Action
1 In the Windows notification area, verify whether the Gateway Management Console icon is displayed in
956 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Accessing Controllers - Troubleshooting and FAQ
Step Action
1 Open the Tools → Options → Device editor dialog box (see EcoStruxure Machine Expert, Menu
Commands, Online Help).
2 Select the Communication page → Controller selection mode setting and confirm by clicking OK.
WARNING
UNINTENDED EQUIPMENT OPERATION
Verify that all devices have unique Nodenames before placing the system into service.
Update the Nodename after cloning any application that includes Ethernet communications to
a unique Nodename.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 957
Accessing Controllers - Troubleshooting and FAQ
Step Action
1 Right-click the device that is assigned a double Nodename in the list and execute the command
Change device name from the contextual menu.
Result: The Change device name dialog box is displayed.
2 In the Change device name dialog box, enter a unique Nodename in the New text box.
3 Click OK to confirm and to close the Change device name dialog box.
4 In the Communication Settings view, click the Update button to refresh the list of devices.
Result: The second device with the same Nodename of the device you just have changed will
now be displayed in the list.
5 Repeat steps 1...4 until you have eliminated any double Nodenames.
NOTE: Some controllers, such as the LMC •0•C controllers, create a Nodename automatically out
of the device name of the project after a project download and the IP address (for example, MyLMC
([Link])). This automatic name overwrites the Nodename you assigned if any changes are
executed on the controller.
958 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Accessing Controllers - Troubleshooting and FAQ
FAQ - Why has the Communication Between PC and Controller been Interrupted?
Step Action
1
Right-click the Gateway Tray Application icon in the Windows task bar .
2 Execute the command Restart Gateway from the contextual menu.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 959
Accessing Controllers - Troubleshooting and FAQ
960 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
EIO0000002854 06/2019
Appendices
Appendix A
Network Communication
Network Communication
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 963
Network Communication
Network Topology
Overview
The EcoStruxure Machine Expert control network is a system programmed to configure itself
(address assignment) to support transparent communication media and to route packets between
different networks. The routing mechanism is simple enough that any node in the network, that is,
even nodes with low resources, are able to reroute packets. So, large routing tables, complex
calculations, or requests during runtime are avoided.
The control network is configured hierarchically, that is, each node has one parent node and an
arbitrary number of children. A node without a parent is referred to as top-level node. Cycles are
not permitted, that is, a control network has a tree structure.
Parent-child relationships arise from the specification of network segments. A network segment
corresponds, for example, to a local Ethernet or a serial point-to-point connection. It distinguishes
between the main network (mainnet) and the subnetworks (subnet). Each node has, at most, one
main network, wherein it expects its parent. For each node, an arbitrary number of subnets can be
configured. The node acts as parent for all of them.
If a network segment had been defined simultaneously as subnet of several nodes, the network
would have several parents. However, the resulting configuration will be invalid, as each network
segment is allowed to have one single parent only.
964 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Communication
Overview
Addressing maps the topology of the control network to unique addresses. A node address
(see page 968) is built up hierarchically.
For each network connection, a local address identifying the node uniquely within its respective
local network is allocated by the relevant block driver. For the entire node address, this local
address is preceded by the subnet index the local network is assigned to by the parent.
Furthermore, it must be preceded by the node address of its parent.
The length of the subnet index (in bit) is determined by the device, whereas the length of the local
address is determined by the network type.
A node without a main network is a top-level node with address 0. A node with a main network that
does not contain a parent is also a top-level node and will be assigned to its local address in the
main network.
Example: Main net and sub nets
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 965
Network Communication
In the example, the addresses of the child nodes are given in hexadecimal representation. The first
4 digits represent the address of the particular parent within the main net. For example,
0x007A=122 for PLC1. The next byte (displayed in blue) is reserved for the subnet index and this
is followed by the local address, for example, C=12 for node ID 12.
Due to the structuring of the address, the routing algorithm can be kept relatively lean. For
example, no routing tables are necessary. Information is required locally: on the own address and
on the address of the parent node.
Thereon, a node may properly handle data packets.
If the target address equals the address of the current node, it is determined as receiver.
If the target address starts with the address of the current node, the packet is intended for a child
or descendant of the node and has to be forwarded.
Else, the receiver is not a descendant of the current node. The packet has to be forwarded to
the own parent.
Relative Addressing
Relative addressing is a special feature. Relative addresses (see page 969) do not contain the
node number of the receiver node, but directly describe the path from the sender to the receiver.
The principle is similar to a relative path in the file system: The address consists of the number of
steps the packet has to move up, that is, to the next respective parent, and the subsequent path
down to the target node.
The advantage of relative addressing is that 2 nodes within the same subtree are able to continue
the communication when the entire subtree is moved to another position within the overall control
network. While the absolute node addresses will change due to such a relocation, the relative
addresses are still valid.
Determination of Addresses
A node attempts to determine its own address as that coming from its parent or whether itself is a
top-level node. For this purpose, a node will send an address determination via a broadcast
message to its main network during boot-up. As long as this message is not responded to, the node
considers itself to be a top-level node, although it will continue to try to detect a parent node. A
parent node will respond by an address notification. Thereon, the node will complete its own
address and pass it to the subnets.
Address determination can be executed at bootup or on request of the programming PC.
966 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Communication
Structure of Addresses
Overview
Below is a detailed description on the structure of the following address types:
Network Addresses (see page 967)
Node Addresses (see page 968)
Absolute and Relative Addresses (see page 969)
Broadcast Addresses (see page 970)
Network Addresses
Network addresses represent a mapping of addresses of a network type (for example,
IP addresses) to logical addresses within a control network. This mapping is handled by the
respective block driver. Within an Ethernet with class C IP addresses, the first 3 bytes of the
IP address are the same for all network devices. Therefore, the last 8 bits of the IP address suffice
as a network address since they allow unambiguous mapping between the 2 addresses at the
block driver.
A node has separate network addresses for each network connection. Different network
connections may have the same network address since this address has to be unique only locally
for each network connection.
Terminology: In general, the network address of a node without a statement of the network
connection refers to the network address in the main network.
The length of a network address is specified in bits and can be chosen by the block driver as
required. Within a network segment, the same length must be used for all nodes.
A network address is represented as an array of bytes with the following coding:
Length of the network address: n bits
Required bytes: b = (n + 7) DIV 8
The (n MOD 8) lowest-order bits of the first byte and all remaining (n DIV 8) bytes are used for
the network address.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 967
Network Communication
Node Addresses
The node address indicates the absolute address of a node within a control network, and therefore,
is unique within the whole tree. The address consists of up to 15 address components, each
consisting of 2 bytes. The lower a node is located within the network hierarchy, the longer its
address.
The node address consists of the partial addresses of all predecessors of the node and the node
itself. Each partial address consists of one or several address components. The length is therefore
always a multiple of 2. The partial address of a node is formed from the network address of the
node in its main network and the subnet index of the main network in the parent node. The bits
required for the subnet index are determined by the router of the parent node. Filler bits are
inserted between the subnet index and the network address in order to ensure that the length of
the partial address is a multiple of 2 bytes.
Special cases:
Node has no main network: This means that there is no subnet index nor a network address in
the main network. In this case, the address is set to 0x0000.
Node with main network but without parent: In this case, a subnet index with 0-bit length is
assumed. The partial address corresponds to the network address, supplemented by filler bits
if required.
Example - node address
The node address representation is always hexadecimal. The individual address components
(2 bytes in each case) are separated by a colon (:). The bytes within a component display
sequentially without a separator (see example above). Since this represents a byte array and not
a 16-bit value, the components are not displayed in little-endian format. For manually entered
addresses missing digits in an address component are filled with leading zeros from the left:
274 = 0274. To improve readability, the output should always include the leading zeros.
968 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Network Communication
Example
Within the example, a letter will represent an address component, whereas a point will separate
the particular nodes. Since a node is allowed to have multiple address components, it is allowed
to have multiple letters within the example.
Node A: [Link].g
Node B: [Link].m
Address of the lowest common parent: [Link]
Relative address from A to B: -4/[Link].m (The number -4 results from the 4 components d, e, f,
and g. Therefore the packet has to be raised).
The relative address has to be adjusted with each pass through an intermediate node. It is
sufficient to adjust the address offset. This is always done by the parent node: If a node receives
a packet from one of its subnets, the address offset is increased by the length of the address
component of this subnet.
If the new address offset is < 0, the packet must be forwarded to the parent node.
If the address offset 1 ≥ 0, the packet must be forwarded to the child node of the local address
of which is located at the position described by the address offset within the relative address.
First, the address offset must be increased by the length of the local address of the child node
to ensure that the node sees a correct address.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 969
Network Communication
A special situation arises when the error described above occurs while determining the common
parent. In this case, the address offset at the “real” common parent is negative, but the magnitude
is greater than the length of the partial address of the subnet the packet originates from. The node
must detect this case, calculate the local address of the next child node based on the address of
the previous node and the length difference, and adapt the address offset such that the next node
will see a correct relative address. Also, the address components themselves remain unchanged
and only the address offset will be modified.
Broadcast Addresses
There are 2 types of broadcasts - global and local ones. A global broadcast is sent to all nodes
within a control network. The empty node address (length 0) is reserved for this purpose.
Local broadcasts are sent to all devices of a network segment. For this purpose, all bits of the
network address are set to 1. This is possible both in relative and in absolute addresses.
A block driver must be able to handle both broadcast addresses, that is, empty network addresses
and network addresses with all bits set to 1, must be interpreted and sent as broadcast.
970 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Python Script Language
EIO0000002854 06/2019
Appendix B
Python Script Language
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 971
Python Script Language
Section B.1
General Information
General Information
972 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Introduction
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 973
Python Script Language
Coding Conventions
In order to harmonize and facilitate the work of different programmers on the same programming
project, it makes sense to agree on a common programming style. EcoStruxure Machine Expert
adheres to the Style Guide for Python Code. The scripts and examples delivered with EcoStruxure
Machine Expert adhere to these conventions. For improved readability of code, it is a best practice
that your own code adheres to the same conventions.
For further information, refer to the Style Guide for Python Code at
[Link]
974 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Useful Links
For further information, refer to the following websites:
Official Python webpage providing a tutorial and language references at [Link]
Official Python blog at [Link]
Beginner’s Guide to Python at [Link]
Official CoDeSys forum providing examples and helpful information at
[Link]
IronPython interpreter at [Link]
PyTools (Visual Studio plugin) at [Link]
PyCharm (Visual Studio plugin) at [Link]
How to use PyCharm Debugging at
[Link]
Visual Studio Code at [Link]
Python extension at
[Link]
IronPython Cookbook at [Link]
Free Galileo Openbook (only available in German) at
[Link]
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 975
Python Script Language
Overview
EcoStruxure Machine Expert can be automated with the Python script language.
The Python scripting capabilities in EcoStruxure Machine Expert are exposed in various ways. The
table lists different entry points:
976 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
The following sections provide an overview of how Python scripting integrates in EcoStruxure
Machine Expert for different use cases.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 977
Python Script Language
978 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 979
Python Script Language
Script Debugging Using Integrated Development Environment (IDE) from Third-Party Vendors
The block diagram shows how an Integrated Development Environment (IDE) from third-party
vendors (for example, Visual Studio and PTVS) can be used for debugging Python scripts:
980 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Commands
At the input prompt (>>>), type your Python statements and press Enter to execute them.
The following sequence of commands provides an example on how to open a project, search a
device node and print the name:
IronPython 2.7.4 ([Link]) on .NET 4.0.30319.18444 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> projectName = "C:\\temp\\[Link]"
>>> proj = [Link](projectName)
>>> sercosNode = [Link]("SERCOSIII", True)[0]
>>> print(sercosNode.get_name(False))
SERCOSIII
>>>
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 981
Python Script Language
Usage:
[Link] [options] [[Link]|- [arguments]]
The [options] are defined in the list of command-line arguments below.
[arguments] is a placeholder for arguments that are passed to the script file.
Command-line arguments of the Logic Builder Shell:
You can combine different command-line arguments. For example, the -i argument can be
combined with a specified Python script file and -nologo.
The list shows only a selection of IronPython command-line arguments. For a complete list, refer
to the IronPython website and documentation.
Use Case 1
When executing scripts in Continuous Integration (CI) systems - for example, to Checkout a
EcoStruxure Machine Expert project from Subversion (SVN), compile the project and save as
library - you need the script output printed to a console. With the [Link] as real
console application, you can redirect the output or call it in a CI system (for example, Jenkins)
where the output is fetched and added to a build log.
Example:
[Link] [Link] > [Link]
982 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Use Case 2
You can integrate the [Link] as counterpart to Python Tools for Visual Studio (refer
to the chapter on debugging (see page 998)). In this case, the [Link] is used for
debugging communication between Visual Studio and EcoStruxure Machine Expert and to execute
the statements.
Use Case 3
[Link] allows you to use the built-in command-line debugging feature called pdb
module.
Example:
[Link] -m pdb [Link]
Use Case 4
Test your Python scripts in no UI mode to verify that it is working. In console mode, you can enter
input via the console. Keep in mind that reading input from the console is only possible in the
[Link]. In the Scripting Immediate view, that is available in the Logic Builder user
interface, no console input is possible. This has the effect that the statement readline() is
ignored.
Example:
import sys
print("Please enter a text: ")
text = [Link]()
print("Your entered text: " + text)
Use Case 5
Explore the Python and EcoStruxure Machine Expert API and documentation.
Use the built-in help() feature to access the Python help via the IronPython shell. To achieve
this, make sure that an Internet connection is available.
Example:
help() # start the built-in help module
topics # list all available topics
##### here you'll get the list of available topics #####
LIST # dumps the help to work with lists.
##### here you'll get the help working with lists #####
quit # leaf build-in help feature
Use the built-in dir() feature to print available api functions.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 983
Python Script Language
Example:
dir() # prints the list of defined variables and functions in cur
rent script scope
##### here you'll get the list of defined variables or functions in cur
rent script scope #####
import sys
dir(sys) # prints the available functions defined in sys module
##### here you'll get the list of defined variables or functions in sys
module #####
Use the inspectapi module to explore the EcoStruxure Machine Expert Python API. Due do
technical restrictions, the built-in dir() feature of Python cannot print the API help for the
EcoStruxure Machine Expert Python API. To achieve this, use the inspectapi.
Example:
[Link](projects) # prints the available API functions of "proj
ects" which provides access e.g. to open a SoMachine project
##### here you'll get the SoMachine API provided via "projects" variabl
e #####
Use Case 6
Use -i switch as argument passed to the [Link] in combination with a specified
script to get the shell prompt at the end of the script run. This can help to inspect interactively after
running a script, for example, to see the content of variables.
Debugging EcoStruxure Machine Expert Python Scripts with Command-Line Debugger Module pdb
The [Link] provides the built-in command line debugging feature pdb module (for
more documentation, refer to [Link] This is a feature for
experts and used to debug Python scripts or to find an issue. IronPython itself provides a module
that can be loaded into a shell. When you start your own script via the pdb function run(…), you
can debug the Python code in the console. The console application only provides text-based UI
possibilities.
984 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
NOTE: Using the command-line debugger can be complicated. For a more user-friendly debugging
experience, consider using Microsoft Visual Studio and PTVS (for further information, refer to
Using Logic Builder Shell with Microsoft Visual Studio and PTVS (see page 998)).
The module pdb defines an interactive source code debugger for Python programs. It provides the
following features:
Setting (conditional) breakpoints and single stepping at the source line level
Inspection of stack frames
Source code listing
Evaluation of arbitrary Python code in the context of any stack frame
To start a Python script directly in pdb, use the following command-line syntax:
[Link] -m pdb [Link]
Selection of pdb debugger commands (refer to the Python help on the Internet for more details):
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 985
Python Script Language
986 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 987
Python Script Language
13
14 sercosDeviceName = sercosDevice.get_name(False)
15
(Pdb) n
IOError: IOError(...oject'.")
> C:\temp\[Link](10)<module>()
-> [Link]("c:\\Temp\\[Link]")
(Pdb) q
SoMachine Logic Builder Shell terminated.
988 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
When you start the Logic Builder with user interface via [Link], then the following two
commands are available to open two views dedicated to scripting purposes:
View → Scripting Immediate
View → Scripting Watch
Script execution in the EcoStruxure Machine Expert user interface via the Execute Script File...
command or via the Scripting Immediate view:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 989
Python Script Language
The Scripting Immediate view allows you to enter Python statements and to execute them (using
the REPL).
To run a Python script file, click the ... button or enter the script name into the prompt textbox and
click the Go! button.
Click the Reset button to reset the Scripting Immediate view and to clear the current scope.
990 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Element Description
Add to watch button To add a watch expression, type the expression into
the Scripting Immediate view prompt, and click the
Add to watch button.
Remove watch button To remove a watch expression, select an entry in the
Scripting Watch view, and click the Remove watch
button.
Auto update option Select the Auto update option to enable the auto
update function for expressions in the Scripting
Watch view.
NOTE: The process of refreshing values can lead to
additional PC processor load.
Update values button The Scripting Watch view list is updated
automatically each time a statement is executed in
the Scripting Immediate view. To update the list
manually, click the Update values button.
Example
Enter and execute the following statement in the Scripting Immediate view.
projectName = "C:\\temp\\[Link]"
Proceed as follows:
Step Action
1 Enter projectName in the Scripting Immediate view.
2 Click the Add to watch button in the Scripting Watch view.
Result: The variable projectName is displayed in the Scripting Watch list.
When you assign a different value to the variable projectName, the changed content is
displayed.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 991
Python Script Language
Keyboard Commands in the Logic Builder Shell and the Scripting Immediate View
Overview
This chapter provides information on using the Logic Builder Shell started via the LogicBuild-
[Link] or the Logic Builder Scripting Immediate view.
992 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Explore EcoStruxure Machine Expert Python API (with dir() and inspectapi)
Overview
EcoStruxure Machine Expert provides a Python API that you can use for EcoStruxure Machine
Expert scripting. When you write Python scripts, most times you only need names of functions or
the list of required parameters and its names. You often also need the available functions of an
object returned by an API function you have called. The following functions allow you to explore
the EcoStruxure Machine Expert Python API to support you in developing Python scripts.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 993
Python Script Language
inspectapi Functions
Since the dir() function does not list all EcoStruxure Machine Expert Python API elements,
additional functions are provided to display them for Python script developers.
inspectapi is a Python module loaded automatically while starting the [Link] or
the Scripting Immediate view. As a result, a variable/module inspectapi is available in the
current scope. This variable is also listed by executing the dir() function.
The inspectapi variable/module provides the following functions:
Examples:
# To see the API of the inspect api itself
[Link](inspectapi)
Output:
Members of type 'InspectAPI'
Methods:
dir (obj, verbose = False)
dir_events (obj, verbose = False)
dir_fields (obj, verbose = False)
dir_methods (obj, verbose = False)
dir_properties (obj, verbose = False)
# To see the API of projects variable
[Link](projects)
994 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Output:
Members of type 'ScriptProjects'
Properties:
[get] all
[get] primary
Methods:
convert (stPath, stOutputPath, converter, bPrimary)
convert (stPath, stOutputPath, converterGuid, bPrimary)
create (stPath, bPrimary)
get_all ()
get_by_path (stPath)
get_primary ()
open (stPath, stPassword, bPrimary)
open (stPath, encryption_password, session_user, session_password, bP
rimary)
open_archive (stArchiveFile, stProjectPath, bOverwrite, stPassword)
open_archive (stArchiveFile, stProjectPath, bOverwrite, encryption_pa
ssword, session_user, session_password)
# open a project
proj = [Link]("c:\\temp\\[Link] ")
# To see API of primary project
[Link]([Link])
Output (truncated):
Members of type 'ScriptProject'
Properties:
[set] active_application
[get] dirty
[get] handle
[get] has_library_manager
[get] has_project_info
[get] is_root
[get] library
[get] path
[get] primary
[get] project
[get] svn
[get] user_management
Methods:
add (stName, id, stModuleId)
add (stName, iType, stId, stVersion, stModuleId)
check_all_pool_objects ()
clean_all ()
close ()
compare_to (projectFile)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 995
Python Script Language
996 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 997
Python Script Language
Using Logic Builder Shell with Microsoft Visual Studio and PTVS
Overview
With EcoStruxure Machine Expert and the [Link], you can develop and debug
Python scripts. To develop a EcoStruxure Machine Expert Python script, you can use the editors
presented in the Introduction chapter (see page 973).
It is a good practice to use an IDE from a third-party vendor such as Microsoft Visual Studio with
installed extension Python Tools for Visual Studio (PTVS). Visual Studio is a product from
Microsoft and is not part of the EcoStruxure Machine Expert delivery.
NOTE: Since Python Tools for Visual Studio (PTVS) (see [Link] are free
and open source, it may be that not all versions are fully compatible with the EcoStruxure Machine
Expert [Link] versions.
In the following figure, you can see the two tools that are working together with EcoStruxure
Machine Expert [Link].
998 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Step Action
1 Create a Visual Studio solution.
2 Add a Python project.
3 Add a Python script.
4 Configure the project to use the [Link] as interpreter.
5 Develop your script and execute it in Visual Studio.
Result: Visual Studio performs the following tasks:
Launching the [Link].
Establishing a TCP/IP connection between Visual Studio (+PTVS) and
[Link].
Sending the Python statements to the shell.
Getting feedback of results.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 999
Python Script Language
After you have clicked Start Debugging in Visual Studio, the [Link] is launched and
the script execution starts. If you have set a breakpoint in the script and the breakpoint is hit, Visual
Studio marks the current statement and you can use the debugger commands (Step-Into,
Step-Over, Run, …). You can see the script output in the Logic Builder Shell that has been
started.
1000 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
1 Debugger commands
2 Configured Python environment to be used for debugging
3 [Link] started by Visual Studio
4 Breakpoint in Python script
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1001
Python Script Language
Step Action
1 Start Visual Studio.
2 Execute the command Tools → Options → Python Tools → Environment Options.
Result: The Options dialog box is displayed.
3 In the Options dialog box, click the Add Environment button and create an environment, for
example with the name LogicBuilderShell_V4.x.
4 Set the Logic Builder Shell as Default Environment.
5 Set the Path to your [Link] (for example, C:\Program Files (x86)\Schneider
Electric\SoMachine Software\Vx.x\[Link]).
6 Set the Windows Path to your [Link] (for example, C:\Program Files
(x86)\Schneider Electric\SoMachine Software\Vx.x\[Link]).
7 Set the Library Path to the ScriptLib folder (for example, C:\Program Files (x86)\Schneider
Electric\SoMachine Software\Vx.x\LogicBuilder\ScriptLib\[Link]).
8 Set the Architecture to x86.
9 Set the Language Version to 2.7.
1002 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Step Action
1 Start Visual Studio.
2 Create a new solution.
3 Create a new IronPython application.
4 Right-click your project in the solution and execute the command Properties from the context
menu.
5 In the General tab, select your configured LogicBuilderShell_V4.x as Interpreter.
6 In the Debug tab, select IronPython (.NET) launcher as Launch mode.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1003
Python Script Language
Overview
With EcoStruxure Machine Expert and the [Link], you can develop and debug
Python scripts. To develop a EcoStruxure Machine Expert Python script, you can use the editors
presented in the Introduction chapter (see page 973).
It is a good practice to use an IDE from a third-party vendor such as JetBrains PyCharm. PyCharm
is a product from JetBrains and contains a free Community Edition and a purchasable Professional
Edition. It is not part of the EcoStruxure Machine Expert delivery but can be downloaded from
[Link] PyCharm is cross-platform and supports Windows, macOS,
and Linux.
In the following figure, you can see how PyCharm works together with EcoStruxure Machine Expert
[Link].
Step Action
1 Start PyCharm.
2 Create or open a PyCharm project or Python file.
3 Develop your script and execute it in PyCharm.
Result: PyCharm performs the following tasks:
Launching the [Link].
Establishing a TCP/IP connection between PyCharm and [Link].
Sending the Python statements to the shell.
Getting feedback of results.
1004 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
After you have executed the command Run → Debug..., or you have pressed Alt+Shift+F9 in
PyCharm, and selected the Python script to be executed, the [Link] is launched
and script execution starts. If you have set a breakpoint in the script and the breakpoint is hit,
PyCharm marks the present statement, and you can use the debugger commands. The script
output is displayed in the Console.
Python script debugging with PyCharm:
Step Action
1 Rename the [Link]:
Navigate to your [Link] (for example, C:\Program Files (x86)\Schneider
Electric\SoMachine Software\V4.40 Motion) in Windows Explorer.
Duplicate the files [Link] and [Link] by copying and pasting
them into the same directory.
Rename the files to [Link] and [Link] since Logic Builder uses IronPython as Python
interpreter.
2 Start PyCharm and open the Settings dialog box via Configure → Settings.
3 Open the Project Interpreter view, and execute the command Add Local from the button to the right of the
Project Interpreter: box.
Result: After this process has been completed (which may take some time), the Project Interpreter is
displayed and set as default.
4 Execute the command More... from the button to the right of the Project Interpreter: box.
5 Select the newly created entry, and click the pencil on the right to edit the properties.
6 Rename it to LogicBuilderShell_V4.x where x is the specific version of the Logic Builder Shell.
7 Click OK to apply the settings and to close the dialog boxes.
1006 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Step Action
1 Start PyCharm.
2 Open an existing project or Python file.
3 Click the Configure Python Interpreter link of the message in the header highlighted in yellow.
4 In the Settings dialog box, select the previously created LogicBuilderShell_V4.x as Project
Interpreter, and click OK to confirm.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1007
Python Script Language
Using Logic Builder Shell with Microsoft Visual Studio Code and Python Extension
Overview
With EcoStruxure Machine Expert and the [Link], you can develop and debug
Python scripts. To develop a EcoStruxure Machine Expert Python script, you can use the editors
presented in the Introduction chapter (see page 973).
It is a good practice to use an IDE from a third-party vendor such as Microsoft Visual Studio Code
with installed Python extension. Visual Studio Code is an open source product from Microsoft. It is
not part of the EcoStruxure Machine Expert delivery but can be downloaded from
[Link] Visual Studio Code is cross-platform and supports Windows,
macOS, and several Linux distributions.
NOTE: Since the Python extension (see
[Link] is free and open
source, it may be that not all versions are fully compatible with the EcoStruxure Machine Expert
[Link] versions.
In the following figure, you can see the two tools that are working together with EcoStruxure
Machine Expert [Link].
1008 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Step Action
1 Start Visual Studio Code.
2 Create or open a Python file.
3 Develop your script and execute it in Visual Studio Code.
Result: Visual Studio Code performs the following tasks:
Launching the [Link].
Establishing a TCP/IP connection between Visual Studio Code and [Link].
Sending the Python statements to the shell.
Getting feedback of results.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1009
Python Script Language
1 Debugger commands
2 Breakpoint in Python script
3 Debug Console of [Link] started by Visual Studio Code
4 Input box for directly issuing Python statements
For further information on how to use Visual Studio Code debugging, refer to
[Link]
1010 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Step Action
1 Start Visual Studio Code.
2 Execute the command View → Extensions or press Ctrl+Shift+X, and type python into the search box.
Result: The extension view opens, and a list of matching extensions is displayed.
3 Install the Python extension by clicking the Install button of the corresponding entry.
NOTE: Make sure to install the correct extension since there exist multiple different Python
implementations.
NOTE: If an error is detected during the installation, verify your Internet connection: An existing proxy of
the network you are connected to must be configured in Visual Studio Code using the [Link]* settings.
For further information regarding Visual Studio Code settings, refer to
[Link]
4 After the installation process of the Python extension has been completed successfully, restart Visual
Studio Code manually, or press the Reload button.
5 Configure the path to your [Link] (for example, C:\Program Files (x86)\Schneider
Electric\SoMachine Software\V4.40 Motion\[Link]) in your Visual Studio Code settings.
Open the [Link] file by executing the command File → Preferences → Settings, or press Ctrl+,,
and add the following lines inside the curly braces (adapt the path to your installation):
"[Link]": "C:\\Program Files (x86)\\Schneider Electric\\SoMachine
Software\\V4.40 Motion\\[Link]",
"[Link]": false
If the settings file already contains entries, append a final comma to the previous line.
After that it should look like this:
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1011
Python Script Language
Executing Scripts
Overview
You can execute script files ([Link]), containing a sequence of script commands, from the
EcoStruxure Machine Expert user interface.
For further information on running scripts form the EcoStruxure Machine Expert user interface,
refer to the chapter Script-Related Commands (see EcoStruxure Machine Expert, Menu
Commands, Online Help).
Batch Files
Frequently used commands
Command Description
- REM or :: The line is a comment and will be ignored.
cd Changes to another directory.
echo off The commands will not be displayed.
In order to prevent single commands from being displayed, insert an
@ character in front of the command.
echo Displays a string or a variable on the programming console.
set Declares a variable and assigns a value to this variable.
> Writes the output to a file. If the file already exists, it will be
overwritten.
>> Appends the output to a file. If the file does not already exist, it will be
created.
Application example:
@echo off
REM Go to the directory where EcoStruxure Machine Expert is installed
cd "<Replace this with the path to the [Link], for example,
C:\Program Files (x86)\Schneider Electric\SoMachine Software\>"
REM Run [Link] with no graphical user interface and the full
path to the script
[Link] --noui --
runscript="<Replace this with the full file path
where the script is stored, for example, D:\MyScripts\[Link]>"
pause
C# Console Application
Running the script in a C# application allows you to edit the script dynamically before the script is
executed by the engine. In addition, some previous steps can be performed in the C# application
as well
1012 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
using System;
using [Link];
using [Link];
using [Link];
using [Link];
namespace ExecuteScriptExample
{
class Program
{
static void Main(string[] args)
{
try
{
ProcessStartInfo psi = new ProcessStartInfo();
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1013
Python Script Language
Best Practices
Note that when mixing tabs and spaces for indentation: In Python, tab characters are internally
replaced by 8 spaces. Since numerous editors by default use 4 spaces, this can lead to code errors
that are difficult to find. Source code blocks appear to have the same size of the indent but actually
the indentation is different.
Therefore, care should be taken when using copy and paste commands.
To help to avoid this, configure your editor in such a way that it automatically replaces tab
characters by spaces.
Case Sensitivity
Python is a case-sensitive language (in contrast to, for example, structured text). This means that
MyVar and MYVAR refer to two different variables.
1014 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Colons (:)
Loop declarations and conditions end with a colon.
Example:
if len(messages) == 0:
print("--- Build successful ---")
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1015
Python Script Language
1016 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Enumerations (ENUM) do not exist as a language construct in Python. They are used to define
a fixed amount of constant values, for example, the days of a week. Enumeration values defined
in .NET can be accessed in IronPython via [Link] syntax (similar to static class
members), for example, [Link]. There are several patterns of emulating
enums in Python, for example, [Link] or
[Link]
Properties marked with { get; set; } are read-write, properties only marked with
{ get; } are read-only. They are similar to the @property decorator in Python.
For scripts the following entry points are available:
system: Basic functionality for integration in the EcoStruxure Machine Expert system. This
object provides all functions described under ISystem Interface, such as the exit of EcoStruxure
Machine Expert, the access to the message window or the query if the --noUI mode is running
by use of the ui_present command.
projects: Basic functionality for project management. This object provides all functions
described under IScriptProjects Interface, such as loading of projects and project archives.
Furthermore, it is the entry point to the individual projects.
online: Basic functionality for online connection to device. By use of the create_on-
line_application method, the online object of an application object can be created. This
online object allows login to controllers, starting applications and retrieving variable values.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1017
Python Script Language
For further information, refer to the chapter Schneider Electric Script Engine Examples in this
document (see page 1026) and to the [Link] files provided with EcoStruxure Machine
Expert.
1018 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
EcoStruxure Machine Expert provides a Python API that you can use in EcoStruxure Machine
Expert scripts.
The Python API consists of two categories:
Standard Python API and Python modules / packages
EcoStruxure Machine Expert Python API
The standard Python API (for dealing with strings, arrays, files, and so on) is part of the
EcoStruxure Machine Expert installation. For detailed help, consult the Internet (for example,
[Link] You can extend your EcoStruxure Machine Expert installation by
Python modules and packages available on the Internet.
To automate EcoStruxure Machine Expert, a EcoStruxure Machine Expert Python API is also
included in the EcoStruxure Machine Expert installation. It is used, for example, to open or close a
project, to change the project content or to compile a project and download it to a controller.
The EcoStruxure Machine Expert Python API concept is described in this chapter. Also refer to the
script engine examples (see page 1026). To explore the EcoStruxure Machine Expert Python API,
refer to the chapter Explore EcoStruxure Machine Expert API (see page 993).
For details of method / function descriptions or their parameter descriptions, refer to the section
Scripting Engine in the Software part of the EcoStruxure Machine Expert online help.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1019
Python Script Language
1020 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Searching and Navigating Within the EcoStruxure Machine Expert Tree Structure
A EcoStruxure Machine Expert project consists of devices, POUs, DUTs, GVLs, and so on, which
are organized in a tree of objects (see, for example, the Devices tree in the Logic Builder). This
tree of objects (the project tree) is attached to [Link]. In [Link], the
API allows you to search objects by using the find(…) method. You can navigate within the
project tree, for example, by using the get_children() method to get the immediate child
objects (for example, the controller devices). On each child object, you can call get_children()
again to get their immediate child objects, and so on.
NOTE: The methods available on the project tree objects can vary from object to object depending
on its type (POU, DUT, GVL, device). It is a best practice to use [Link](…) to see the
list of available API methods on an object.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1021
Python Script Language
Examples
Example of using a global API function to open a project:
[Link]("[Link]")
Example to find and rename a project tree object (after a project was loaded):
myObject = [Link]("SERCOSIII")[0]
[Link]("New_SERCOSIII_Name")
The figure shows the project tree object in the user interface and the traversed project tree printed
by a script:
1022 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1023
Python Script Language
Overview
You can configure icons that will be displayed in a toolbar to access up to 32 different script files
with one click.
To achieve this, you can create a maximum of two [Link] files each containing a maximum of
16 symbol entries.
Save the [Link] files at the following locations:
C:\ProgramData\SoMachine Software\Script Commands
<SoMM_Installation_Directory>\LogicBuilder\Script Commands, for example, C:\Program Files
(x86)\Schneider Electric\SoMachine Software\V4.40 Motion\LogicBuilder\Script Commands
When you start EcoStruxure Machine Expert, the script calls and the related icons are added to
the dialog box Tools → Customize in the tab Command Icons, category ScriptEngine Commands.
You can add them to a new or to an existing toolbar in the Toolbars tab of the Tools → Customize
dialog box.
1024 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
The ScriptEngine Commands list of the Tools → Customize dialog box contains the following
entries that you can add to a toolbar:
Start Process1
Start Process2
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1025
Python Script Language
Section B.2
Schneider Electric Script Engine Examples
1026 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
New Projects
Overview
This chapter shows how to create a new project with the Schneider Electric Script Engine.
Even though there are 4 different project types available, the code for creating them is identical. In
these 4 cases, the create_project method of the global object new_project is called.
This instantiates 2 data containers that consist of the following elements:
common project settings
controller settings
The project type property allows you to select one of the 4 project types:
Controller Settings
The controller settings consist of the following elements
Element Description
type type of the controller, can be retrieved from the
device identification of the controller
id ID of the controller, can be retrieved from the device
identification of the controller
version firmware version
device_name name of the device that you can assign
implementation_language 6 implementation languages are available
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1027
Python Script Language
1028 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Device Parameters
Overview
To change a parameter, the parameter ID and the ParameterSet are required.
In order to find the required device and list the respective parameters, use the find method that
finds objects by a given name or path in the project.
# Example-Device Lexium62
moduleName = 'DRV_Lexium62'
# find module/device in Project (you also can do this generic e.g. with
get_children()...)
module = [Link](moduleName, True)[0]
cnt = 1
for c in connectors:
print("Connector " +str(cnt) +" for "+moduleName +": ")
params = c.host_parameters
count = [Link]
print("Number of available Parameters for this connector: ", co
unt)
if count > 0:
for p in params:
print(p.visible_name + " - ID: %s " % [Link] + " -
Value: %s" % [Link])
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1029
Python Script Language
print(" - ")
print(" - Example for a single Parameter (ObjectType) - ")
objectType = params.by_id(268435457)
print("ObjectType: ", [Link])
cnt = cnt+1
print("--------------------------------------------------------
----------")
1030 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Compiler Version
Overview
With the compiler version extension, you can display the mapped compiler versions and you can
set a new compiler version by executing the script.
# Save project
[Link]()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1031
Python Script Language
Visualization Profile
Overview
With the visualization profile extension, you can display the visualization profiles and you can set
the active visualization profile of the project.
1032 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
# Save project
[Link]()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1033
Python Script Language
Update Project
Overview
With the update project extension, you can update your project. This is the same function as
provided by the Project Update dialog box that is displayed when you open the project in the
graphical user interface of EcoStruxure Machine Expert and click OK.
1034 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Update Libraries
Overview
With the update libraries extension, you can update the libraries of the project automatically. This
is the same function as provided by the Libraries → Automatic version mapping (all libraries)
command in the graphical user interface of EcoStruxure Machine Expert.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1035
Python Script Language
Overview
With the clean and build application extension, you can clean a project or build a new project.
# Clean application
new_project.clean_application(app)
1036 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Communication Settings
Overview
This example shows how to load or set the IP address of a controller of your choice by executing
the script.
def main():
if not [Link]:
[Link]("No active project.")
return
project = [Link]
#find the controller by the object name where address should be set
and read.
controller = [Link]('LMC_PacDrive', True)[0]
main()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1037
Python Script Language
Start ETEST
Overview
In software programming, the module ETEST is used to verify the correct functionality of individual
methods or algorithms of a program. ETEST is a white-box testing method, meaning that the
source code to be verified is known when designing test cases and determining the expected
results.
The procedure typically consists of 3 steps:
initializing the initial state
executing the operation that is to be tested
comparing the actual results with the expected results
1038 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
[Link]()
if test_elements == None:
print ("No test series 'TS_MySeries' found")
else:
# Print all testelements
for test_element in test_elements:
print ("Found test element in Series TS_MySeries: " + test_elem
[Link])
[Link]()
[Link]()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1039
Python Script Language
Overview
Once logged in to the application, you can reset the diagnostic messages of the controller. This is
an extension method of the controller object.
The following example shows how to reset diagnostic messages. You have to get the primary
project and log in to the application, as shown in the other examples (building an application
(see page 1036)).
1040 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
Once there is an instance of the controller object in the script, you can reboot the controller by using
a method on that object.
def perform_application_login(project):
app = project.active_application
onlineapp = online.create_online_application(app)
[Link]([Link], True)
def main():
if not [Link]:
[Link]("No active project.")
return
perform_application_login([Link])
main()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1041
Python Script Language
Convert Device
Overview
Converting devices within the project can become a complex procedure. This API simplifies the
conversion process and helps to avoid errors.
The conversion API accepts the DeviceID as object instance or as single parameter. This allows
using a DeviceID containing all elements mentioned in the above table or passing each element
as a single parameter.
The following example shows how to create a DeviceID for an LMCx00C controller with firmware
version [Link]:
Lmcx00c = DeviceID(4096, "1003 0082", "[Link]")
1042 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
def main():
# Set the project as primary project
proj = [Link]
controller = [Link]('LMC_PacDrive', True)[0]
drives = [Link]('DRV_Lexium62', True)
if len(drives) == 0:
print("Expected drive object not found")
return
drive = drives[0]
if not [Link]:
print("No project open.")
else:
main()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1043
Python Script Language
def main():
if not [Link]:
print("No project open.")
else:
main()
1044 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
def main():
proj = [Link]
controller = [Link]('LMC_PacDrive', True)[0]
drive = [Link]('DRV_Lexium62', True)[0]
if not [Link]:
print("No project open.")
else:
main()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1045
Python Script Language
Comparing Projects
Overview
There are several use cases where it is useful to have a script automatically comparing the
contents of 2 projects. The Python project comparison function allows you to compare 2 projects.
As a result it provides the information if the projects are different, as well as a detailed XML tree
that reflects the project tree and shows the differences for each object.
def main():
proj = [Link]
if not [Link]:
print("No project open.")
else:
main()
1046 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
EcoStruxure Machine Expert Logic Builder offers advanced functions for managing libraries, the
so-called forward compatible libraries (see EcoStruxure Machine Expert, Functions and Libraries
User Guide). They provide a convenient way to manage references and dependencies among
libraries.
This functionality is also available via scripts and can be used on the Library Manager of the entire
project or on a single application within the project. The following script shows how to check the
libraries for forward compatibility and valid references. It automatically maps the references and
explicitly sets library versions.
libmgr = app.get_library_manager()
print("# Checking all libraries:")
for lib in libmgr.get_libraries():
print("-
" + lib + " Is Forward Compatible Library? " + str(libmgr.is_library_f
orward_compatible(lib)))
if not libmgr.is_current_mapping_valid():
for lib in libmgr.get_invalid_library_mappings():
print("Library reference cannot be satisfied for: " + lib)
print("Trying to auto-map libraries to valid versions")
libmgr.make_auto_mapping()
else:
print("All mappings valid")
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1047
Python Script Language
Accessing POUs
Overview
The following examples show how to print and manipulate the code of a POU. They are only
available for textual programming languages.
proj = [Link]
pou = [Link]('SR_Main', True)[0]
1048 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
proj = [Link]
pou = [Link]('SR_Main', True)[0]
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1049
Python Script Language
Section B.3
CoDeSys Script Engine Examples
Overview
This chapter provides examples of frequently used members of the CoDeSysScript Engine. For a
complete description of the members of each namespace, refer to the CoDeSys API description.
1050 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Project
Overview
Since the examples for this namespace are relatively short and self-explanatory, their meaning is
not explained in detail. Complete examples are provided, where appropriate.
New Project
This method creates a new project.
It consists of 2 parameters:
a string specifying the location where the project will be stored
a boolean parameter: If TRUE, the project will be the new primary project. This parameter is
optional, the default value is TRUE.
The method returns the IProject instance (refer to the specification in the document Automation
Platform SDK) which can be used for further steps.
import os
try:
# Clean up any open project
if [Link]:
[Link]()
# Define the new path where the new project should be stored
project_path = r"C:\Python"
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1051
Python Script Language
Load Project
This method loads a project. Any open projects will not be closed.
The first parameter specifies the path of the project that will be loaded.
import os
try:
# Clean up any open project
if [Link]:
[Link]()
Save Project
This method saves the project at its physical location.
# Save project
[Link]()
1052 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Save Archive
This method saves the project as an archive. The additional categories which are selected by
default are included, but no extra files.
The first parameter specifies the path where the archive will be saved.
import os
Close Project
This method closes the project. If there are unsaved changes in this project, these changes will be
discarded.
# Clean up any open project:
if [Link]:
[Link]()
Find Objects
This method finds objects matching the given name.
It consists of 2 parameters:
The first parameter is the name of the object that is searched.
The second parameter specifies whether a recursive search is performed. This parameter is
optional, the default value is FALSE. This method returns a collection of objects.
# Search for
result_list = [Link]('MyController', True)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1053
Python Script Language
Native Import
This method imports the specified files in the native XML format in the top level of this project.
import os
try:
# Clean up any open project
if [Link]:
[Link]()
files = [Link](object_path)
1054 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
project_reference.save()
PLCOpenXML Import
This method imports the contents of the specified PLCopenXML file into the top level of the project.
import os
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1055
Python Script Language
try:
# Clean up any open project
if [Link]:
[Link]()
Native Export
This method exports the given objects in native format into a string, or a file at the given path. The
non-exportable objects are detected as an error, but the export continues.
import sys,io,os
def collect_objects(project_reference):
# List that stores all POU nodes
project_objects = []
1056 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
project_objects.append(node)
for i in project_objects:
print("Found: ", [Link], [Link], i.get_name())
return project_objects
try:
# Clean up any open project
if [Link]:
[Link]()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1057
Python Script Language
export_objects(collected_objects, project_reference)
except Exception as exception:
print("Error: " + str(exception))
if not [Link]:
print("Please turn on the 'Script Tracing' function to get detai
led information about the script execution.")
PLCOpenXML Export
This method exports the given objects in PLCopenXML format into a string, or a file at the given
path. The non-exportable objects are detected as an error, but the export continues.
import os
try:
1058 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
# Finds the object in the project, and return the first result
device = project_reference.find(object_name, True)
if device != None:
filename = [Link](object_path, device[0].get_name() + ".x
ml")
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1059
Python Script Language
Online Application
Overview
NOTE: Some of the online application commands can temporarily change the active application.
This interface is exported to Python, and thus complies to Python naming standards.
Prepared Values
This example shows how to write prepared values.
try:
# Trying to create online application
online_application = online.create_online_application()
1060 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Logout Application
This method logs out the application. If the application is not logged in, nothing happens.
# Get the project reference
project_reference = [Link]
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1061
Python Script Language
Start Application
This method starts the application.
# Get the project reference
project_reference = [Link]
Stop Application
This method stops the application.
# Get the project reference
project_reference = [Link]
1062 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Objects
Find
This method finds objects matching the given name.
It consists of 2 parameters:
The first parameter is the name of the object that is searched.
The second parameter specifies whether a recursive search is performed. This parameter is
optional, the default value is FALSE. This method returns a collection of objects.
# Search for the specified object
results = [Link]('MyController', True)
Remove
This method removes the object.
# Finds the MyController object in the project
results = [Link]("MyController", True)
Rename
This method renames the object to the new name.
# Finds the MyController object in the project
results = [Link]("MyController", True)
Import/Export
Refer to the description of imports/exports for projects (see page 1055). The only difference is that
the object is called for import / export, instead of the project.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1063
Python Script Language
Devices
Overview
This chapter describes methods for manipulating device objects.
Add
This method adds the specified device.
It consists of 3 parameters:
A string specifying the name of the device.
DeviceID specifying the ID of the device. For the DeviceID value, refer to the device
description of the device you want to add.
A string specifying the module ID.
if not(parent_device == None):
parent_device.add("Module_TM5C12D6T6L", DeviceID(51063, "101a 0363"
, "[Link]"))
Disable
This method marks this device as disabled during download.
# Finds the MyController object in the project
device = [Link]("MyController", True)[0]
if not(device == None):
[Link]()
Enable
This method marks this device as enabled during download.
# Finds the MyController object in the project
device = [Link]("MyController", True)[0]
if not(device == None):
[Link]()
1064 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Get Address
This method gets the address of the device. It returns a string.
# Finds the MyController object in the project
device = [Link]("MyController", True)[0]
if not(device == None):
print("Address: " + device.get_address())
if not(device == None):
print(str(device.get_device_identification()))
Get Gateway
This method returns the GUID of the gateway.
# Finds the MyController object in the project
device = [Link]("MyController", True)[0]
if not(device == None):
print("Gateway: " + str(device.get_gateway()))
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1065
Python Script Language
Insert
This method inserts the specified device at the specified index.
It consists of 4 parameters:
A string specifying the name of the device.
Int32 specifying the index where to insert the device.
DeviceID specifying the ID of the device. For the DeviceID value, refer to the device
description of the device you want to add.
A string specifying the module ID.
if not(parent_device == None):
# We need the amount of children to add the new device at the end
child_count = len(parent_device.get_children())
if not(device == None):
device.set_gateway_and_address(gateway, address)
if not(device == None):
device.set_simulation_mode (True)
1066 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Update
This method updates the specified device.
# This is a more generic approach to find and update a device by its de
vice description
import os
return newest_version
if not(device == None):
device_identification = device.get_device_identification()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1067
Python Script Language
1068 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1069
Python Script Language
Choose
This method allows you to choose between one of several listed items.
# Set the necessary fields
option_list = ["TM221C16R", "TM241C24R", "TM258LF66DT4L"]
# A python tuple will be returned with the index of the selected item o
r -1 if canceled
selected_item = [Link](dialog_message, option_list, True)
Error Detection
This method indicates an error detection message. It inhibits any further actions until the message
has been acknowledged.
[Link]("Error")
Info
This method indicates an information message. It inhibits any further actions until the message has
been acknowledged.
# Set the necessary fields
dialog_message = "Project update has been completed successfully"
1070 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Query String
This method queries the input or edit of a text string.
# Set the necessary fields
dialog_message = "Please enter a filename for your project:"
dialog_prefilled_text = "c:\Python\[Link]"
# If a project is opened, the project will be saved under the new namei
f([Link]):
[Link].save_as(project_name)
It returns a string with the entered text.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1071
Python Script Language
Warning
This method indicates a warning message. It inhibits any further actions until the message has
been acknowledged.
# Set the necessary fields
dialog_message = "Project update failed. Please check the log for detai
led errors."
1072 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Reading Values
Overview
The script opens an application in EcoStruxure Machine Expert and logs in to the device. If the
controller is not in RUNNING state, it will be set to RUNNING. Then the variable iVar1 is read and
displayed in the Messages view or command line. At the end, the application is closed.
try:
# Clean up any open project
if [Link]:
[Link]()
# Login to device
[Link]([Link], True)
# Wait 1 second
[Link](1000)
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1073
Python Script Language
1074 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
The script opens an application in EcoStruxure Machine Expert and logs in to the device. If the
controller is not in mode RUNNING, it will be set to RUNNING. Then the variable iVar1 is read
and displayed in the Messages view or command line. At the end, the application is closed.
# Login to application
online_application.login([Link], True)
# Wait 2 seconds
[Link](2000)
for i in range(len(watch_expressions)):
recipe_output_file.write(watch_expressions[i])
recipe_output_file.write(" = ")
recipe_output_file.write(watch_values[i])
recipe_output_file.write("\n")
# Close files
recipe_output_file.close()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1075
Python Script Language
# Send Email
# Import respective libraries
import smtplib
from [Link] import MIMEText
#open output file
recipe_output_file = open("C:\Python\Objects\[Link]", "r")
mail = MIMEText(recipe_output_file.read())
recipe_output_file.close()
# Send email
smtp = [Link]("Name of the SMTP Server")
[Link](sender, [to], mail.as_string())
[Link]()
1076 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
This example determines the objects in the Devices tree of the open project and prints them out in
the command line or Messages view. It can be started from the EcoStruxure Machine Expert user
interface or from the command line.
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1077
Python Script Language
Overview
This example imports a device in PLCOpenXML from Subversion via command line svn client.
It can be started from the EcoStruxure Machine Expert user interface or from the command line.
1078 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1079
Python Script Language
Overview
The script [Link] creates the objects MyStruct, MyAlias, and MyUnion in the
EcoStruxure Machine Expert project. The folder DataTypes must be available.
[Link]
# encoding:utf-8
from __future__ import print_function
STRUCT_CONTENT = """\
a : BOOL;
b : BIT;
c : BIT;
"""
UNION_WHOLE = """\
TYPE MyUnion :
UNION
Zahl : INT;
Prozent : MyAlias;
Bits : MyStruct;
END_UNION
END_TYPE
"""
proj = [Link]
folder = [Link]('DataTypes', recursive = True)[0]
# Create a struct DUT and insert the list of variables just into the right
# place in line two, row 0 (line numbering starts with line 0)
struktur = folder.create_dut('MyStruct') # [Link] is the
default
struktur.textual_declaration.insert(2, 0, STRUCT_CONTENT)
# Alias types get their "content" via the base type, which will just end
up
# as one line in the declaration part:
# TYPE MyAlias : INT (0..100); END_TYPE
bereich = folder.create_dut('MyAlias', [Link], "INT (0..100)")
# Instead of injecting the variables into the existing declaration,
# one can also just replace the complete declaration part, including the
# boilerplate code.
union = folder.create_dut('MyUnion', [Link])
union.textual_declaration.replace(UNION_WHOLE)
1080 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
In some cases, scripts have to interact with the user. Simple APIs are provided for common
interactions. The sample script System_UI_Test.py shows the possible functions.
System_UI_Test.py
# encoding:utf-8
from __future__ import print_function
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1081
Python Script Language
filter_index = 0)
print("The user did choose: '%s'" % res)
1082 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Python Script Language
Overview
The script [Link], provides information in the Project information object. Important
information items, such as Title and Version, have explicit properties. However, you can read and
write the other information fields by using the dictionary syntax. For example, those that are
recommended for the properties of a library project.
The example below may seem unrealistic, but similar code is used in build servers that create, test,
and possibly release automatic library projects and other projects. The ScriptEngine is one of the
key elements for creating CI (Continuous Integration) and CD (Continuous Delivery) systems.
[Link]
# encoding:utf-8
from __future__ import print_function
proj = [Link]("D:\[Link]")
info = proj.get_project_info()
[Link]()
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1083
Python Script Language
Overview
The following sample script can perform the checkout and installation of a library as part of a CT
(Continuous Testing) environment so that they can be tested. The SVN Add-on must be installed
on the PC and the SVN Add-on license must be activated.
Sample Script
import tempfile
if [Link]:
[Link]()
tempdir = [Link]()
URL = "svn://localhost/testrepo/trunk/SvnTestLibrary/"
repo = [Link][0]
librarymanager.install_library([Link], repo, True)
[Link]()
1084 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Controller Feature Sets for Migration
EIO0000002854 06/2019
Appendix C
Controller Feature Sets for Migration
Twido Controllers
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1085
Controller Feature Sets for Migration
M221 Controllers
Controller Dig In Dig Out Ana In MOD FC HSC PWM Serial ETH CART
TM221C16R 9 7 2 TM2/TM3 4 2 0 1 No 1
TM221C16T 9 7 2 TM2/TM3 4 2 2 1 No 1
TM221C24R 14 10 2 TM2/TM3 4 2 0 1 No 1
TM221C24T 14 10 2 TM2/TM3 4 2 2 1 No 1
TM221C40R 24 16 2 TM2/TM3 4 2 0 1 No 2
TM221C40T 24 16 2 TM2/TM3 4 2 2 1 No 2
TM221CE16R 9 7 2 TM2/TM3 4 2 0 1 Yes 1
TM221CE16T 9 7 2 TM2/TM3 4 2 2 1 Yes 1
TM221CE24R 14 10 2 TM2/TM3 4 2 0 1 Yes 1
TM221CE24T 14 10 2 TM2/TM3 4 2 2 1 Yes 1
TM221CE40R 24 16 2 TM2/TM3 4 2 0 1 Yes 2
TM221CE40T 24 16 2 TM2/TM3 4 2 2 1 Yes 2
TM221M16R/G 8 8 2 TM2/TM3 4 2 0 2 No 0
TM221M16T/G 8 8 2 TM2/TM3 4 2 2 2 No 0
TM221M32TK 16 16 2 TM2/TM3 4 2 2 2 No 0
TM221ME16R/G 8 8 2 TM2/TM3 4 2 0 1 Yes 0
TM221ME16T/G 8 8 2 TM2/TM3 4 2 2 1 Yes 0
TM221ME32TK 16 16 2 TM2/TM3 4 2 2 1 Yes 0
Dig In = number of digital inputs
Dig Out = number of digital outputs
Ana In = number of analog inputs
MOD = expansion modules
FC = number of fast counters
HSC = number of high-speed counters
PWM = number of pulse generators
Serial = number of serial ports
ETH = Ethernet ports
CART = number of cartridges
1086 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
Controller Feature Sets for Migration
Controller Dig In Dig Out Ana In MOD FC HSC PWM Serial ETH CART
TM241C24R 14 10 0 TM2/TM3 8 2 4 2 No 1
TM241C24T/U 14 10 0 TM2/TM3 8 2 4 2 No 1
TM241C40R 24 16 0 TM2/TM3 8 2 4 2 No 2
TM241C40T/U 24 16 0 TM2/TM3 8 2 4 2 No 2
TM241CE24R 14 10 0 TM2/TM3 8 2 4 2 Yes 1
TM241CE24T/U 14 10 0 TM2/TM3 8 2 4 2 Yes 1
TM241CE40R 24 16 0 TM2/TM3 8 2 4 2 Yes 2
TM241CE40T/U 24 16 0 TM2/TM3 8 2 4 2 Yes 2
TM241CEC24R 14 10 0 TM2/TM3 8 2 4 2 Yes 1
TM241CEC24T/U 14 10 0 TM2/TM3 8 2 4 2 Yes 1
HMISCU•A5 16 10 0 No 2 1 2 1 Yes 0
HMISCU•B5 8 8 2 No 2 1 2 1 Yes 0
Dig In = number of digital inputs
Dig Out = number of digital outputs
Ana In = number of analog inputs
MOD = expansion modules
FC = number of fast counters
HSC = number of high-speed counters
PWM = number of pulse generators
Serial = number of serial ports
ETH = Ethernet ports
CART = number of cartridges
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1087
Controller Feature Sets for Migration
1088 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Know-How Protection
EIO0000002854 06/2019
Appendix D
Know-How Protection
Know-How Protection
EIO0000002854 06/2019 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. 1089
Know-How Protection
1090 EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers. EIO0000002854 06/2019
EcoStruxure Machine Expert
Glossary
EIO0000002854 06/2019
Glossary
C
CFC
(continuous function chart) A graphical programming language (an extension of the IEC 61131-3
standard) based on the function block diagram language that works like a flowchart. However, no
networks are used and free positioning of graphic elements is possible, which allows feedback
loops. For each block, the inputs are on the left and the outputs on the right. You can link the block
outputs to the inputs of other blocks to create complex expressions.
D
DTM
(device type manager) Classified into 2 categories:
Device DTMs connect to the field device configuration components.
CommDTMs connect to the software communication components.
The DTM provides a unified structure for accessing device parameters and configuring, operating,
and diagnosing the devices. DTMs can range from a simple graphical user interface for setting
device parameters to a highly sophisticated application capable of performing complex real-time
calculations for diagnosis and maintenance purposes.
DUT
(data unit type) Along with the standard data types the user can define own data type structures,
enumerationen types, and references as data type units in a DUT editor.
E
element
The short name of the ARRAY element.
F
FBD
(function block diagram) One of 5 languages for logic or control supported by the standard IEC
61131-3 for control systems. Function block diagram is a graphically oriented programming
language. It works with a list of networks, where each network contains a graphical structure of
boxes and connection lines, which represents either a logical or arithmetic expression, the call of
a function block, a jump, or a return instruction.
G
GRAFCET
The functioning of a sequential operation in a structured and graphic form.
This is an analytical method that divides any sequential control system into a series of steps, with
which actions, transitions, and conditions are associated.
GVL
(global variable list) Manages global variables within an EcoStruxure Machine Expert project.
I
IL
(instruction list) A program written in the language that is composed of a series of text-based
instructions executed sequentially by the controller. Each instruction includes a line number, an
instruction code, and an operand (refer to IEC 61131-3).
L
LD
(ladder diagram) A graphical representation of the instructions of a controller program with symbols
for contacts, coils, and blocks in a series of rungs executed sequentially by a controller (refer to
IEC 61131-3).
M
MAC address
(media access control address) A unique 48-bit number associated with a specific piece of
hardware. The MAC address is programmed into each network card or device when it is
manufactured.
O
OPC UA
OPC Unified Architecture.
P
POU
(program organization unit) A variable declaration in source code and a corresponding instruction
set. POUs facilitate the modular re-use of software programs, functions, and function blocks. Once
declared, POUs are available to one another.
Python interpreter
A program that directly executes instructions that have been entered.
R
REPL
(read-eval-print-loop) A simple, interactive computer programming environment. It takes single
user inputs, evaluates them, and returns the result.
RTS
(request to send) A data transmission signal and CTS signal that acknowledges the RTS from the
destination node.
S
Sercos
(serial real-time communications system) A digital control bus that interconnects, motion controls,
drives, I/Os, sensors, and actuators for numerically controlled machines and systems. It is a
standardized and open controller-to-intelligent digital device interface, designed for high-speed
serial communication of standardized closed-loop real-time data.
SFC
(sequential function chart) A language that is composed of steps with associated actions,
transitions with associated logic condition, and directed links between steps and transitions. (The
SFC standard is defined in IEC 848. It is IEC 61131-3 compliant.)
shell
A shell is a (console) program that allows the user to interact with a program with a textual based
interface.
T
TLS
(transport layer security) A protocol for encrypted data transfer. Successor of SSL.
U
UDP
(user datagram protocol) A connectionless mode protocol (defined by IETF RFC 768) in which
messages are delivered in a datagram (data telegram) to a destination computer on an IP network.
The UDP protocol is typically bundled with the Internet protocol. 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).
UTC
(universal time coordinated) The primary time standard by which the world regulates clocks and
time.
Index
Symbols ADR
operator, 809
IronPython, 973
analog inputs
__DELETE
CANopen, 939
operator, 847
AND
__ISVALIDREF
IEC operator, 783
operator, 850
ANY, 726
__NEW
ANY_<type>, 726
operator, 851
ANY_NUM_TO
__QUERYINTERFACE
IEC operator, 830
operator, 854
ANY_TO
__QUERYPOINTER
IEC operator, 830
operator, 856
array, 761
"__POOL." operator, 866
array declaration, 428
ASIN
IEC operator, 841
0-9 ATAN
3 GB switch on Windows 7 32-bit, 943 IEC operator, 843
32-bit operating system automatic I/O mapping, 157
memory limit, 943 axis allocation
cam motion editor, 602, 605
A
ABS B
IEC operator, 833 BIT, 731
ACOS BITADR
IEC operator, 842 operator, 811
ADD BOOL, 723
IEC operator, 769 BOOL_TO
adding controllers, 70 IEC operator, 815
adding controllers by drag and drop, 66 boot application, 257
adding devices and modules by drag and Boot Application, 251
drop, 67 build-time performance, 945
adding devices from device template by drag
and drop, 68
adding devices from function template by C
drag and drop, 68
CAL
adding expansion devices by drag and drop,
IEC operator, 812
67
calculate value automatically
addressing, 965
cam motion editor, 602
D F
data types, 723 FAQ
DATE, 726 login to controller not successful, 956
DATE_AND_TIME, 726 FB_Exit, 647
DATE_TO FB_Init, 647
IEC operator, 824 FB_init
declaring IEC operator, 867
arrays, 428 FB_MultiCam, 599
H
health information L
fieldbus, 74 lambda
HMI - controller variable exchange, 588 law of motion, 609
HMI connection indications, 591 large EcoStruxure Machine Expert projects,
943
law of motion, 609
I LE
IEC code IEC operator, 804
generating from cam data, 598 LIMIT
IEC objects IEC operator, 799
fieldbus Diagnostic/O mapping, 74 literals
IEC source code typed, 644
generating, 614 LN
IEC source code of the cam diagram, 601 IEC operator, 835
IF local variables - END_VAR, 637
instruction, 416 local variables - VAR, 637
increasing build-time performance, 945 LOG
indications IEC operator, 836
HMI connection, 591 login, 250, 257
N R
NE REAL, 724
IEC operator, 807 REAL_TO
IEC operator, 820
recipes STRING_TO
memory usage, 516 IEC operator, 826
reducing memory consumption, 944 SUB
refreshing variables, 588 IEC operator, 773
region pragmas, 666 symbol configuration, 574
remanent variables, 641
REPEAT
instruction, 420 T
retain variables, 641 tagging catalog items, 49
RETURN TAN
instruction, 416 IEC operator, 840
ROL tasks
IEC operator, 791 adding, 247
ROR template libraries, 907
IEC operator, 793 templates, 894
routing, 965 temporary variables - VAR_TEMP, 639
run, 269 TIME, 726
time data types, 726
TIME_OF_DAY, 726
S IEC operator, 822
Script Engine, 973 TIME_TO
searching within catalogs, 49 IEC operator, 822
SEL TO_BOOL
IEC operator, 796 IEC operator, 817
selecting variables, 584 TOD, 726
Sercos transition, 191
installation of third-party devices, 63 TRUNC
SHL IEC operator, 828
IEC operator, 788 TRUNC_INT
shortcuts, 941 IEC operator, 829
SHR typed literals, 644
IEC operator, 790
SIN
IEC operator, 838 U
SIZEOF UNION, 730
IEC operator, 781 updating devices, 78
smart coding, 718 Use DTM Connection checkbox, 41
SQRT
IEC operator, 834
ST editor V
instructions, 413 VAR, 637
startup performance, 940 VAR_EXTERNAL, 640
static variables - VAR_STAT, 639 VAR_GLOBAL, 639
stop, 269 VAR_IN_OUT, 638
STRING, 725 VAR_INPUT, 637
VAR_INST, 640
VAR_OUTPUT, 638
VAR_STAT, 639
VAR_TEMP, 639
variable definition, 578
variable exchange
communication speed, 588
variable types, 578
variables, 637
persistent, 227
publishing, 582
publishing (HMI), 585
remanent, 227
visualizations, 912
W
WHILE
instruction, 419
WSTRING, 725
X
XOR
IEC operator, 785