EcoStruxure™ Control Expert - System - Block Library - 10/2019

330
33002539.21 www.schneider-electric.com EcoStruxure™ Control Expert 33002539 10/2019 EcoStruxure™ Control Expert System Block Library Original instructions 10/2019

Transcript of EcoStruxure™ Control Expert - System - Block Library - 10/2019

Page 1: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control Expert

33002539 10/2019

3300

2539

.21

www.schneider-electric.com

EcoStruxure™ Control ExpertSystemBlock LibraryOriginal instructions

10/2019

Page 2: EcoStruxure™ Control Expert - System - Block Library - 10/2019

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 33002539 10/2019

Page 3: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Table of Contents

Safety Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Part I General information . . . . . . . . . . . . . . . . . . . . . . . . . 15Chapter 1 Block Types and their Applications. . . . . . . . . . . . . . . . . 17

Block Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18FFB Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20EN and ENO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Chapter 2 Availability of the Block on Various Hardware Platforms 27Block Availability on the Various Hardware Platforms. . . . . . . . . . . . . 27

Part II File Management . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Chapter 3 Implementing File Management . . . . . . . . . . . . . . . . . . . 33

File Management on Memory Cards . . . . . . . . . . . . . . . . . . . . . . . . . . 34Function Block Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36File Descriptor knowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

Chapter 4 Formatting a Memory Card. . . . . . . . . . . . . . . . . . . . . . . 39Erasing the Memory Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

Chapter 5 CREATE_FILE: Create a Data Storage File . . . . . . . . . . 41CREATE_FILE: Create a Data Storage File . . . . . . . . . . . . . . . . . . . . 41

Chapter 6 OPEN_FILE: Open a File . . . . . . . . . . . . . . . . . . . . . . . . 45OPEN_FILE: Open a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

Chapter 7 SET_FILE_ATTRIBUTES: Set File Attributes. . . . . . . . . 49SET_FILE_ATTRIBUTES: Sets the File Attributes . . . . . . . . . . . . . . . 49

Chapter 8 GET_FILE_INFO: Retrieve File Attributes . . . . . . . . . . . 51GET_FILE_INFO: Retrieves the File Attributes . . . . . . . . . . . . . . . . . 51

Chapter 9 GET_FREESIZE: View Available Space on Memory Card 55GET_FREESIZE: View Available Space of the File Partition on the Memory Card. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Chapter 10 SEEK_FILE: Position in a File . . . . . . . . . . . . . . . . . . . . 57SEEK_FILE: Position in the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

Chapter 11 WR_DATA_TO_FILE: Write Data to a File . . . . . . . . . . . 61WR_DATA_TO_FILE: Writes Data to a File . . . . . . . . . . . . . . . . . . . . 61

Chapter 12 RD_FILE_TO_DATA: Read Data in a File . . . . . . . . . . . 63RD_FILE_TO_DATA: Read Data from a File. . . . . . . . . . . . . . . . . . . . 63

Chapter 13 CLOSE_FILE: Close a File . . . . . . . . . . . . . . . . . . . . . . . 65CLOSE_FILE: Close the File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

33002539 10/2019 3

Page 4: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Chapter 14 DELETE_FILE: Delete a File . . . . . . . . . . . . . . . . . . . . . . 67DELETE_FILE: Delete a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

Chapter 15 Memory Card File Management EFB Error Codes. . . . . . 69Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

Chapter 16 Memory Card File Management EF Examples. . . . . . . . . 71Definition of the Example and Declaration of Variables . . . . . . . . . . . . 72Offline Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Online Example: Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74Example written in ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Chapter 17 WRITE_U_PCMCIA: Writing data to the memory card. . . 83Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Chapter 18 READ_U_PCMCIA: Reading data in the memory card . . 87Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

Chapter 19 WRITE_U_PCMCIA and READ_U_PCMCIA Functions Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91WRITE_U_PCMCIA and READ_U_PCMCIA Example . . . . . . . . . . . . 91

Chapter 20 WRITE_V_PCMCIA: Write Variable to PCMCIA Card . . . 93Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

Chapter 21 READ_V_PCMCIA: Read Variable from PCMCIA Card. . 97Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

Chapter 22 PRJ_VERS: Project Version. . . . . . . . . . . . . . . . . . . . . . . 101PRJ_VERS: Project Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Part III Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105Chapter 23 HALT: Stopping the program . . . . . . . . . . . . . . . . . . . . . . 107

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Chapter 24 ITCNTRL : Triggering of TIMER type event processing . . 109

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109Chapter 25 MASKEVT: Global masking of events . . . . . . . . . . . . . . . 113

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113Chapter 26 UNMASKEVT: Global unmasking of events. . . . . . . . . . . 115

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Part IV Hot Stand By . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

Chapter 27 HSBY_BUILD_OFFLINE: Allowed Build Offline Mismatch 119HSBY_BUILD_OFFLINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

Chapter 28 HSBY_RD: Reading the Hot Standby command register 121HSBY_RD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

Chapter 29 HSBY_ST: Reading the Hot Standby status register . . . . 125HSBY_ST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

4 33002539 10/2019

Page 5: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Chapter 30 HSBY_SWAP: Initiate the swapping between primary and standby CPU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Using the Hot Standby system with the HSBY_SWAP DFB . . . . . . . . 129

Chapter 31 HSBY_WR: Writing to the Hot Standby command register 135HSBY_WR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

Chapter 32 REV_XFER: Writing and reading the two Reverse-Transfer-Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139REV_XFER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

Part V Power Supply Maintenance . . . . . . . . . . . . . . . . . . . 143Chapter 33 PWS_DIAG: Redundant Power Supply Diagnostics . . . 145

Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145Chapter 34 PWS_CMD: Redundant Power Supply Control . . . . . . . 153

Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Part VI SFC Management. . . . . . . . . . . . . . . . . . . . . . . . . . . 157

Chapter 35 CLEARCHART: Reset all active steps . . . . . . . . . . . . . . 159Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

Chapter 36 FREEZECHART: Freeze sequence . . . . . . . . . . . . . . . . 163Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

Chapter 37 INITCHART: Reset all active steps and start sequence normally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

Chapter 38 RESETSTEP: Reset a specific step in the sequence. . . 171Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

Chapter 39 SETSTEP: Set a specific step in the sequence . . . . . . . 175Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

Chapter 40 SFCCNTRL: SFC Control. . . . . . . . . . . . . . . . . . . . . . . . 177Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178Parameter description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

Chapter 41 SFC_RESTORE: SFC Save and Restore . . . . . . . . . . . 189Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190Requirements and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194Save and Restore Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197Saving the Active Steps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198Restoring the Steps for Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200Resuming the SFC Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201Interaction with SFCCNTRL Function Block . . . . . . . . . . . . . . . . . . . . 203STATUS Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

33002539 10/2019 5

Page 6: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Part VII SysClock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207Chapter 42 FREERUN: Free-running timer. . . . . . . . . . . . . . . . . . . . . 209

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209Chapter 43 GET_TS_EVT_M: Reading the M340 and M580 Time

Stamped Event Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . 211Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

Chapter 44 GET_TS_EVT_Q: Reading the Quantum Time Stamped Event Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

Chapter 45 NOP850_EVTS: Converting External Events to NOP Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227NOP850_EVTS Elementary Function Block for the 140 NOP 850 00 . 228NOP850_EVTS Elementary Function Block Operations for the BMENOP0300 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

Chapter 46 PTC: Reading the stop date and code . . . . . . . . . . . . . . . 239Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

Chapter 47 RRTC_DT: Reading the system date . . . . . . . . . . . . . . . . 241Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241

Chapter 48 RRTC_DT_MS: Network real-time clock function. . . . . . . 243Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

Chapter 49 R_NTPC: Network real-time clock function . . . . . . . . . . . 247Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

Chapter 50 SCHEDULE: Real-time clock function . . . . . . . . . . . . . . . 251Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

Chapter 51 T850_TO_T870 and T870_TO_T870: Converting the Time Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255T850_TO_T870 and T870_TO_T850 Elementary Functions for the 140 NOP 850 00 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256T850_TO_T870 and T870_TO_T850 Elementary Functions for the BMENOP0300 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

Chapter 52 WRTC_DT: Updating the system date . . . . . . . . . . . . . . . 261Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

Part VIII System Specials. . . . . . . . . . . . . . . . . . . . . . . . . . . . 263Chapter 53 FORCE_BIT : Function Block. . . . . . . . . . . . . . . . . . . . . . 265

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265Chapter 54 IS_BIT_FORCED:Function Block . . . . . . . . . . . . . . . . . . . 267

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

6 33002539 10/2019

Page 7: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Chapter 55 IS_PAR_CON: Is Parameter Connected . . . . . . . . . . . . 269Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270How to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

Chapter 56 SET_VAL: Transfering data from one variable to another 273Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

Chapter 57 SIG_WRITE: Write a Signature . . . . . . . . . . . . . . . . . . . 277SIG_WRITE: Write a Signature in Memory Card. . . . . . . . . . . . . . . . . 277

Chapter 58 SIG_CHECK: Check a Signature . . . . . . . . . . . . . . . . . . 281SIG_CHECK: Check Signature in Memory Card. . . . . . . . . . . . . . . . . 281

Chapter 59 UNFORCE_BIT: Function Block . . . . . . . . . . . . . . . . . . 285Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

Part IX SCADAPack System Status . . . . . . . . . . . . . . . . . . . 287Chapter 60 SYST_TIME: SCADAPack System Time . . . . . . . . . . . . 289

Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289Chapter 61 SYST_READ_TASK_BIT: SCADAPack System Task Bit 291

Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291Chapter 62 SYST_RESET_TASK_BIT: SCADAPack Reset Task. . . 293

Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293Chapter 63 SYST_READ_FLOAT_STATUS: Floating Operation

Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297Appendix A EFB Error Codes and Values . . . . . . . . . . . . . . . . . . . . . 299

Common Floating Point Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300Error Codes of EFBs with STATUS parameter . . . . . . . . . . . . . . . . . . 301Details of STATUS error code from 31ss to 37ss . . . . . . . . . . . . . . . . 304Details of EFB TCP/IP Ethernet Error Codes 5mss . . . . . . . . . . . . . . 311Details of EFB Modbus Plus Error Codes 6mss . . . . . . . . . . . . . . . . . 315Quantum EFB SY/MAX Specific Error Codes . . . . . . . . . . . . . . . . . . . 316EtherNet/IP Detected Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

33002539 10/2019 7

Page 8: EcoStruxure™ Control Expert - System - Block Library - 10/2019

8 33002539 10/2019

Page 9: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Safety Information

Important Information

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

33002539 10/2019 9

Page 10: EcoStruxure™ Control Expert - System - Block Library - 10/2019

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

BEFORE YOU BEGINDo not use this product on machinery lacking effective point-of-operation guarding. Lack of effective point-of-operation guarding on a machine can result in serious injury to the operator of that machine.

This automation equipment and related software is used to control a variety of industrial processes. The type or model of automation equipment suitable for each application will vary depending on factors such as the control function required, degree of protection required, production methods, unusual conditions, government regulations, etc. In some applications, more than one processor may be required, as when backup redundancy is needed.Only you, the user, machine builder or system integrator can be aware of all the conditions and factors present during setup, operation, and maintenance of the machine and, therefore, can determine the automation equipment and the related safeties and interlocks which can be properly used. When selecting automation and control equipment and related software for a particular application, you should refer to the applicable local and national standards and regulations. The National Safety Council's Accident Prevention Manual (nationally recognized in the United States of America) also provides much useful information.In some applications, such as packaging machinery, additional operator protection such as point-of-operation guarding must be provided. This is necessary if the operator's hands and other parts of the body are free to enter the pinch points or other hazardous areas and serious injury can occur. Software products alone cannot protect an operator from injury. For this reason the software cannot be substituted for or take the place of point-of-operation protection.

WARNINGUNGUARDED EQUIPMENT Do not use this software and related automation equipment on equipment which does not have

point-of-operation protection. Do not reach into machinery during operation.Failure to follow these instructions can result in death, serious injury, or equipment damage.

10 33002539 10/2019

Page 11: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Ensure that appropriate safeties and mechanical/electrical interlocks related to point-of-operation protection have been installed and are operational before placing the equipment into service. All interlocks and safeties related to point-of-operation protection must be coordinated with the related automation equipment and software programming.NOTE: Coordination of safeties and mechanical/electrical interlocks for point-of-operation protection is outside the scope of the Function Block Library, System User Guide, or other implementation referenced in this documentation.

START-UP AND TESTBefore using electrical control and automation equipment for regular operation after installation, the system should be given a start-up test by qualified personnel to verify correct operation of the equipment. It is important that arrangements for such a check be made and that enough time is allowed to perform complete and satisfactory testing.

Follow all start-up tests recommended in the equipment documentation. Store all equipment documentation for future references.Software testing must be done in both simulated and real environments.Verify that the completed system is free from all short circuits and temporary grounds that are not installed according to local regulations (according to the National Electrical Code in the U.S.A, for instance). If high-potential voltage testing is necessary, follow recommendations in equipment documentation to prevent accidental equipment damage.Before energizing equipment: Remove tools, meters, and debris from equipment. Close the equipment enclosure door. Remove all temporary grounds from incoming power lines. Perform all start-up tests recommended by the manufacturer.

WARNINGEQUIPMENT OPERATION HAZARD Verify that all installation and set up procedures have been completed. Before operational tests are performed, remove all blocks or other temporary holding means

used for shipment from all component devices. Remove tools, meters, and debris from equipment.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 11

Page 12: EcoStruxure™ Control Expert - System - Block Library - 10/2019

OPERATION AND ADJUSTMENTSThe following precautions are from the NEMA Standards Publication ICS 7.1-1995 (English version prevails): Regardless of the care exercised in the design and manufacture of equipment or in the selection

and ratings of components, there are hazards that can be encountered if such equipment is improperly operated.

It is sometimes possible to misadjust the equipment and thus produce unsatisfactory or unsafe operation. Always use the manufacturer’s instructions as a guide for functional adjustments. Personnel who have access to these adjustments should be familiar with the equipment manufacturer’s instructions and the machinery used with the electrical equipment.

Only those operational adjustments actually required by the operator should be accessible to the operator. Access to other controls should be restricted to prevent unauthorized changes in operating characteristics.

12 33002539 10/2019

Page 13: EcoStruxure™ Control Expert - System - Block Library - 10/2019

About the Book

At a Glance

Document ScopeThis document describes the functions and function blocks of the System library.

Validity NoteThis document is valid for EcoStruxure™ Control Expert 14.1 or later.

Related Documents

Title of documentation Reference numberEcoStruxure™ Control Expert, Program Languages and Structure, Reference Manual

35006144 (English), 35006145 (French), 35006146 (German), 35013361 (Italian), 35006147 (Spanish), 35013362 (Chinese)

EcoStruxure™ Control Expert, Operating Modes 33003101 (English), 33003102 (French), 33003103 (German), 33003104 (Spanish), 33003696 (Italian), 33003697 (Chinese)

EcoStruxure™ Control Expert, System Bits and Words, Reference Manual

EIO0000002135 (English), EIO0000002136 (French), EIO0000002137 (German), EIO0000002138 (Italian), EIO0000002139 (Spanish), EIO0000002140 (Chinese)

EcoStruxure™ Control Expert, Standard, Block Library

33002519 (English), 33002520 (French), 33002521 (German), 33003678 (Italian), 33002522 (Spanish), 33003679 (Chinese)

EcoStruxure™ Control Expert, Communication, Block Library

33002527 (English), 33002528 (French), 33002529 (German), 33003682 (Italian), 33002530 (Spanish), 33003683 (Chinese)

Modicon M580 Hot Standby, System Planning Guide for Frequently Used Architectures

NHA58880 (English), NHA58881 (French), NHA58882 (German), NHA58883 (Italian), NHA58884 (Spanish), NHA58885 (Chinese)

M580 IEC 61850, BMENOP0300 Module, Installation and Configuration Guide

QGH11908 (English), QGH11910 (French), QGH11911 (German), QGH11913 (Italian), QGH11914 (Spanish), QGH11915 (Chinese)

Quantum using EcoStruxure™ Control Expert, Hot Standby System, User Manual

35010533 (English), 35010534 (French), 35010535 (German), 35013993 (Italian), 35010536 (Spanish), 35012188 (Chinese)

33002539 10/2019 13

Page 14: EcoStruxure™ Control Expert - System - Block Library - 10/2019

You can download these technical publications and other technical information from our website at www.schneider-electric.com/en/download.

Quantum using EcoStruxure™ Control Expert, Ethernet Network Modules, User Manual

33002479 (English), 33002480 (French), 33002481 (German), 31007213 (Italian), 33002482 (Spanish), 31007112 (Chinese)

Premium using EcoStruxure™ Control Expert, Hot Standby, User Manual

35012068 (English), 35012070 (French), 35012069 (German), 35012072 (Italian), 35012071 (Spanish), 35012073 (Chinese)

System Time Stamping, User Guide EIO0000001217 (English), EIO0000001707 (French), EIO0000001708 (German), EIO0000001710 (Italian), EIO0000001709 (Spanish), EIO0000001711 (Chinese)

Title of documentation Reference number

14 33002539 10/2019

Page 15: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertGeneral information33002539 10/2019

General information

Part IGeneral information

OverviewThis section provides general information on the System libraryNOTE: For a detailed description of system objects (%S and %SW), refer to EcoStruxure™ Control Expert, System Bits and Words, Reference Manual.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page1 Block Types and their Applications 172 Availability of the Block on Various Hardware Platforms 27

33002539 10/2019 15

Page 16: EcoStruxure™ Control Expert - System - Block Library - 10/2019

General information

16 33002539 10/2019

Page 17: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertBlock Types and their Applications33002539 10/2019

Block Types and their Applications

Chapter 1Block Types and their Applications

OverviewThis chapter describes the different block types and their applications.

What Is in This Chapter?This chapter contains the following topics:

Topic PageBlock Types 18FFB Structure 20EN and ENO 23

33002539 10/2019 17

Page 18: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

Block Types

Block TypesDifferent block types are used in Control Expert. The general term for the block types is FFB.There are the following types of block: Elementary Function (EF) Elementary Function Block (EFB) Derived Function Block (DFB) ProcedureNOTE: Motion Function Blocks are not available on the Quantum platform.

Elementary FunctionElementary functions (EF) have no internal status and one output only. If the input values are the same, the output value is the same for the executions of the function, for example the addition of two values gives the same result at every execution.An elementary function is represented in the graphical languages (FBD and LD) as a block frame with inputs and an output. The inputs are represented on the left and the outputs on the right of the block frame. The name of the function, that is the function type, is shown in the center of the block frame.The number of inputs can be increased with some elementary functions.NOTE: Unity Pro is the former name of Control Expert for version 13.1 or earlier.

NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A variable must be connected to the EF’s output and must be used to connect the input of the element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu Tools → Program → Languages → Common.

CAUTIONUNEXPECTED BEHAVIOR OF EQUIPMENTFor Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when your application relies on persistent output data of an EF.Failure to follow these instructions can result in injury or equipment damage.

18 33002539 10/2019

Page 19: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

Elementary Function BlockElementary function blocks (EFB) have an internal status. If the inputs have the same values, the value on the outputs can have another value during the individual executions. For example, with a counter, the value on the output is incremented.An elementary function block is represented in the graphical languages (FBD and LD) as a block frame with inputs and outputs. The inputs are represented on the left and the outputs on the right of the block frame. The name of the function block, that is the function block type, is shown in the center of the block frame. The instance name is displayed above the block frame.

Derived Function BlockDerived function blocks (DFBs) have the same properties as elementary function blocks. They are created by the user in the programming languages FBD, LD, IL and/or ST.

ProcedureProcedures are functions with several outputs. They have no internal state.The only difference from elementary functions is that procedures can have more than one output and they support variables of the VAR_IN_OUT data type.

Procedures do not return a value.Procedures are a supplement to IEC 61131-3 and must be enabled explicitly.There is no visual difference between procedures and elementary functions.NOTE: Unity Pro is the former name of Control Expert for version 13.1 or earlier.

NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A variable must be connected to the EF’s output and must be used to connect the input of the element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu Tools → Program → Languages → Common.

CAUTIONUNEXPECTED BEHAVIOR OF EQUIPMENTFor Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when your application relies on persistent output data of an EF.Failure to follow these instructions can result in injury or equipment damage.

33002539 10/2019 19

Page 20: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

FFB Structure

StructureEach FFB is made up of an operation (name of the FFB), the operands are required for the operation (formal and actual parameters) and an instance name for elementary/derived function blocks.Call of a function block in the FBD programming language:

CAUTIONUNEXPECTED APPLICATION BEHAVIORDo not call several times the same block instance within a PLC cycleFailure to follow these instructions can result in injury or equipment damage.

20 33002539 10/2019

Page 21: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

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

OperationThe operation determines which function is to be executed with the FFB, e.g. shift register, conversion operations.

OperandThe operand specifies what the operation is to be executed with. With FFBs, this consists of formal and actual parameters.

Formal/actual parametersInputs and outputs are required to transfer values to or from an FFB. These are called formal parameters.Objects are linked to formal parameters; these objects contain the current process states. They are called actual parameters.At program runtime, the values from the process are transferred to the FFB via the actual parameters and then output again after processing. The data type of the actual parameters must match the data type of the input/output (formal parameters). The only exceptions are generic inputs/outputs whose data type is determined by the actual parameter. If the actual parameters consist of literals, a suitable data type is selected for the function block.

FFB Call in IL/STIn text languages IL and ST, FFBs can be called in formal and in informal form. For detail, refer to chapter Programming Language (see EcoStruxure™ Control Expert, Program Languages and Structure, Reference Manual).Example of a formal function call:out:=LIMIT (MN:=0, IN:=var1, MX:=5);

33002539 10/2019 21

Page 22: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

Example of an informal function call:out:=LIMIT (0, var1, 5);NOTE: The use of EN and ENO is only possible for formal calls.

VAR_IN_OUT variableFFBs are often used to read a variable at an input (input variables), to process it and to output the altered values of the same variable (output variables).This special type of input/output variable is also called a VAR_IN_OUT variable.

The input and output variable are linked in the graphic languages (FBD and LD) using a line showing that they belong together.Function block with VAR_IN_OUT variable in FBD:

Function block with VAR_IN_OUT variable in ST:MY_EXAMP1 (IN1:=Input1, IN2:=Input2, IO1:=Comb_IN_OUT,

OUT1=>Output1, OUT2=>Output2); The following points must be considered when using FFBs with VAR_IN_OUT variables: The VAR_IN_OUT inputs must be assigned a variable. Literals or constants cannot be assigned to VAR_IN_OUT inputs/outputs.

The following additional limitations apply to the graphic languages (FBD and LD): When using graphic connections, VAR_IN_OUT outputs can only be connected with

VAR_IN_OUT inputs. Only one graphical link can be connected to a VAR_IN_OUT input/output. Different variables/variable components can be connected to the VAR_IN_OUT input and the

VAR_IN_OUT output. In this case the value of the variables/variable component on the input is copied to the output variables/variable component.

No negations can be used on VAR_IN_OUT inputs/outputs. A combination of variable/address and graphic connections is not possible for VAR_IN_OUT

outputs.

22 33002539 10/2019

Page 23: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

EN and ENO

DescriptionAn EN input and an ENO output can be configured for the FFBs.

If the value of EN is equal to "0" when the FFB is invoked, the algorithms defined by the FFB are not executed and ENO is set to "0".

If the value of EN is equal to "1" when the FFB is invoked, the algorithms defined by the FFB will be executed. After the algorithms have been executed successfully, the value of ENO is set to "1". If certain error conditions are detected when executing these algorithms, ENO is set to "0".

If the EN pin is not assigned a value, when the FFB is invoked, the algorithm defined by the FFB is executed (same as if EN equals to "1"), Please refer to Maintain output links on disabled EF (see EcoStruxure™ Control Expert, Operating Modes).If the algorithms are executed successfully, then value of ENO is set to "1", else ENO is set to "0".

If ENO is set to "0" (caused by EN=0 or a detected error condition during execution or unsuccessful algorithm execution): Function blocks EN/ENO handling with function blocks that (only) have one link as an output parameter:

If EN from FunctionBlock_1 is set to "0", the output connection OUT from Function-Block_1 retains the status it had in the last correctly executed cycle.

EN/ENO handling with function blocks that have one variable and one link as output parameters:

If EN from FunctionBlock_1 is set to "0", the output connection OUT from Function-Block_1 retains the status it had in the last correctly executed cycle. The variable OUT1 on the same pin, either retains its previous status or can be changed externally without influencing the connection. The variable and the link are saved independently of each other.

33002539 10/2019 23

Page 24: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

Functions/ProceduresNOTE: Unity Pro is the former name of Control Expert for version 13.1 or earlier.

NOTE: With Unity Pro V4.0 and earlier versions the deactivation of an EF (EN=0) causes links connected to its Input/Output to be reset. To transfer the state of the signal do not use a link. A variable must be connected to the EF’s output and must be used to connect the input of the element. With Unity Pro V4.1 and later versions you can maintain the output links even if an EF is deactivated by activating the option Maintain output links on disabled EF (EN=0) via the menu Tools → Program → Languages → Common.As defined in IEC61131-3, the outputs from deactivated functions (EN-input set to "0") is undefined. (The same applies to procedures.) Here is an explanation of the output status in this case: EN/ENO handling with functions/procedures that (only) have one link as an output

parameter:

If EN from Function/Procedure_1 is set to "0", the output connection OUT from Function/Procedure_1 is also set to "0".

EN/ENO handling with function blocks that have one variable and one link as output parameters:

If EN from Function/Procedure_1 is set to "0", the output connection OUT from Function/Procedure_1 is also set to "0". The variable OUT1 on the same pin, either retains its previous status or can be changed externally without influencing the connection. The variable and the link are saved independently of each other.

The output behavior of the FFBs does not depend on whether the FFBs are called up without EN/ENO or with EN=1.

CAUTIONUNEXPECTED BEHAVIOR OF EQUIPMENTFor Unity Pro V4.0 and earlier versions, do not use links to connect function blocks outputs, when your application relies on persistent output data of an EF.Failure to follow these instructions can result in injury or equipment damage.

24 33002539 10/2019

Page 25: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

Conditional/Unconditional FFB Call"Unconditional" or "conditional" calls are possible with each FFB. The condition is realized by pre-linking the input EN. EN connected

conditional calls (the FFB is only processed if EN = 1) EN shown, hidden, and marked TRUE, or shown and not occupied

unconditional calls (FFB is processed independent from EN)NOTE: For disabled function blocks (EN = 0) with an internal time function (e.g. DELAY), time seems to keep running, since it is calculated with the help of a system clock and is therefore independent of the program cycle and the release of the block.

Note for IL and STThe use of EN and ENO is only possible in the text languages for a formal FFB call, e.g.MY_BLOCK (EN:=enable, IN1:=var1, IN2:=var2,ENO=>error, OUT1=>result1, OUT2=>result2);Assigning the variables to ENO must be done with the operator =>.

With an informal call, EN and ENO cannot be used.

CAUTIONUNEXPECTED APPLICATION EQUIPMENTDo not disable function blocks with internal time function during their operation.Failure to follow these instructions can result in injury or equipment damage.

33002539 10/2019 25

Page 26: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Block Types and their Applications

26 33002539 10/2019

Page 27: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertAvailability of the Function Blocks33002539 10/2019

Availability of the Block on Various Hardware Platforms

Chapter 2Availability of the Block on Various Hardware Platforms

Block Availability on the Various Hardware Platforms

IntroductionNot all blocks are available on all hardware platforms. The blocks available on your hardware platform can be found in the following tables.NOTE: The functions and function blocks in this library are not defined in IEC 61131-3.

EventsAvailability of the blocks:

Hot StandbyAvailability of the blocks:

Block name Block type M340 M580 Quantum Momentum PremiumHALT Procedure + + + + +ITCNTRL Procedure + + + + +MASKEVT Procedure + + + + +UNMASKEVT Procedure + + + + ++ Yes- No

Block name Block type M340 M580 Quantum Momentum PremiumHSBY_BUILD_OFFLINE EFB - BME H58 •••• - - -HSBY_RD EFB - - 140 CPU 67• 60/

140 CPU 67• 61- -

HSBY_ST EFB - - 140 CPU 67• 60/140 CPU 67• 61

- -

HSBY_SWAP (see page 129)

DFB - - 140 CPU 67• 60/140 CPU 67• 61

- TSX H57 ••

+ Yes- No

33002539 10/2019 27

Page 28: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Availability of the Function Blocks

Power Supply MaintenanceAvailability of the blocks:

SFC ManagementAvailability of the blocks:

HSBY_WR EFB - - 140 CPU 67• 60/140 CPU 67• 61

- -

REV_XFER EFB - - 140 CPU 67• 60/140 CPU 67• 61

- -

Block name Block type M340 M580 Quantum Momentum Premium

+ Yes- No

Block name Block type M340 M580 Quantum Momentum PremiumPWS_DIAG EFB - + - - -PWS_CMD EFB - + - - -+ Yes- No

Block name Block type M340 M580 Quantum Momentum PremiumCLEARCHART EF + + + + +FREEZECHART EF + + + + +INITCHART EF + + + + +RESETSTEP Procedure + + + + +SETSTEP Procedure + + + + +SFCCNTRL EFB + + + + +SFC_RESTORE EFB - + + + ++ Yes- No

28 33002539 10/2019

Page 29: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Availability of the Function Blocks

System ClockAvailability of the blocks:

System SpecialsAvailability of the blocks:

Block name Block type M340 M580 Quantum Momentum PremiumFREERUN EF + + + + TSX P57 5••GET_TS_EVT_M EFB + + - - -GET_TS_EVT_Q EFB - - +(2) - -NT850_EVTS EFB - + + - -PTC Procedure + + + + +RRTC_DT Procedure + + + - +R_NTPC Procedure + + + + +RRTC_DT_MS Procedure + + +(1) + +SCHEDULE Procedure + + + + +T850_TO_T870 EF - + + - -T870_TO_T850 EF - + + - -WRTC_DT Procedure + + + + ++ Yes- No(1) Not available for legacy Quantum.(2) M340 Ethernet remote I/O drop addressed from a Quantum platform.

Block name Block type M340 M580 Quantum Momentum PremiumFORCE_BIT Procedure + + + + +IS_BIT_FORCED EF + + + + +IS_PAR_CON EF + + + + +PRJ_VERS EFB + + + + +SET_VAL EF + + - - -SIG_CHECK EF + + - - -SIG_WRITE EF + + - - -UNFORCE_BIT Procedure + + + + ++ Yes- No

33002539 10/2019 29

Page 30: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Availability of the Function Blocks

Memory Card File ManagementAvailability of the blocks:

Block name Block type M340 M580 Quantum Momentum PremiumCREATE_FILE EFB + + - - -OPEN_FILE EFB + + - - -SET_FILE_ATTRIBUTES EFB + + - - -GET_FILE_INFO EFB + + - - -GET_FREESIZE EFB + + - - -SEEK_FILE EFB + + - - -WR_DATA_TO_FILE EFB + + - - -RD_FILE_TO_DATA EFB + + - - -CLOSE_FILE EFB + + - - -DELETE_FILE EFB + + - - -WRITE_V_PCMCIA Procedure - - + - +WRITE_U_PCMCIA Procedure - - + - +READ_V_PCMCIA Procedure - - + - +READ_U_PCMCIA Procedure - - + - ++ Yes- No

30 33002539 10/2019

Page 31: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertMemory Card File Management33002539 10/2019

File Management

Part IIFile Management

OverviewThis section describes the elementary functions and elementary function blocks of the File Management family.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page3 Implementing File Management 334 Formatting a Memory Card 395 CREATE_FILE: Create a Data Storage File 416 OPEN_FILE: Open a File 457 SET_FILE_ATTRIBUTES: Set File Attributes 498 GET_FILE_INFO: Retrieve File Attributes 519 GET_FREESIZE: View Available Space on Memory Card 55

10 SEEK_FILE: Position in a File 5711 WR_DATA_TO_FILE: Write Data to a File 6112 RD_FILE_TO_DATA: Read Data in a File 6313 CLOSE_FILE: Close a File 6514 DELETE_FILE: Delete a File 6715 Memory Card File Management EFB Error Codes 6916 Memory Card File Management EF Examples 7117 WRITE_U_PCMCIA: Writing data to the memory card 8318 READ_U_PCMCIA: Reading data in the memory card 8719 WRITE_U_PCMCIA and READ_U_PCMCIA Functions Example 9120 WRITE_V_PCMCIA: Write Variable to PCMCIA Card 9321 READ_V_PCMCIA: Read Variable from PCMCIA Card 9722 PRJ_VERS: Project Version 101

33002539 10/2019 31

Page 32: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Memory Card File Management

32 33002539 10/2019

Page 33: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertImplementing File Management33002539 10/2019

Implementing File Management

Chapter 3Implementing File Management

IntroductionThis chapter describes implementation of file management on memory cards.

What Is in This Chapter?This chapter contains the following topics:

Topic PageFile Management on Memory Cards 34Function Block Operating Modes 36File Descriptor knowledge 38

33002539 10/2019 33

Page 34: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Implementing File Management

File Management on Memory Cards

At a GlanceThe tables below set out the methods for using the memory card once it has been formatted.NOTE: The operations presented below only concern the Modicon M580 and M340 range.

Creating a FileThe table below sets out the method for creating a file and adding information to it.

Opening a File for Reading/WritingThe table below sets out the methods for opening a file to read it or write data into it.

Step Action Related function Comment1 Create the file CREATE_FILE

(see page 41)Returns the identifier (file descriptor) which will be used by the other functions.

2 Set the file attributes SET_FILE_ATTRIBUTES (see page 49)

Optional

3 Display available space GET_FREESIZE (see page 55)

OptionalThis function can be called at any time.

4 Positioning in the file SEEK_FILE (see page 57)5 Write data into the file WR_DATA_TO_FILE

(see page 61)6 Close the file CLOSE_FILE (see page 65)

Step Action Related function Comment1 Open the file OPEN_FILE

(see page 45)Returns the identifier (file descriptor) which will be used by the other functions.

2 Retrieve the file attributes GET_FILE_INFO (see page 51)

Optional

3 Position in the file SEEK_FILE (see page 57) Optional4 Display available space GET_FREESIZE

(see page 55)OptionalThis function can be called at any time.

5 Write data WR_DATA_TO_FILE (see page 61)

6 Position in the file SEEK_FILE (see page 57)7 Read data RD_FILE_TO_DATA

(see page 63)8 Close the file CLOSE_FILE

(see page 65)

34 33002539 10/2019

Page 35: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Implementing File Management

Deleting a FileThe table below sets out the method for deleting a file

Function Limitations The number of files that may be open at the same time is limited to 16.The number of files that can be created depends on the storage capacity of the memory card.The functions can only be used in the MAST task.The memory card must have DATA-STORAGE rights to be able to use these functions.

Step Action Related function1 Delete the file DELETE_FILE (see page 67)

33002539 10/2019 35

Page 36: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Implementing File Management

Function Block Operating Modes

At a GlanceThe various operating modes of the function blocks depend on the following parameters: REQ DONE ERROR STATUS

Parameter DescriptionExecution of all EFBs of this family is asynchronous without exception towards application execution (the service can be executed over several cycles). Before starting a new operation, the DONE and ERROR bits of the previous operation must be tested, and the STATUS word must be consulted if the ERROR bit is at 1.All of the file management EFs are configured with the following parameters:

The file system EFs can only be used in the MAST task. They are all executed asynchronously to the task without exception. If the EFs are called by another task, the following error code is immediately returned: SDCARD_WRONG_USER_TASK.

Parameter Type DescriptionREQ EBOOL Starts a full operation on rising edge.DONE BOOL Sets to 1 when the operation is finished.

This output is reset to zero when the block is enabled by a rising edge on the REQ input.

ERROR BOOL Sets to 1 in case of error during execution of the operation.This output is reset to zero when the block is enabled by a rising edge on the REQ input.

STATUS WORD Error code. (see page 69)This word is only representative when an error has occurred (ERROR = 1).

36 33002539 10/2019

Page 37: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Implementing File Management

IllustrationThe figure below illustrates how the block parameters operate:

33002539 10/2019 37

Page 38: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Implementing File Management

File Descriptor knowledge

At a glanceA file descriptor is an abstract value, that contains all the necessary information for the handle of a file: A pointer to the file, the access rights to this file, the access conditions to the file (read, write or read/write), the current position in the file, etc.

OperationIt is possible to use one or more descriptors simultaneously or sequentially on one file in order to create multiple accesses (read, write or read/write) at the same position or at different positions (beginning, end, middle etc...).A file descriptor is: Allocated (via OPEN_FILE, CREATE_FILE), used (via RD_FILE_TO_DATA, WR_DATA_TO_FILE, SEEK_FILE, GET_FILE_INFO), realesed (via CLOSE_FILE).

It is used to identify a transaction to a file and it is possible to have many transactions on the same file.

EFB instanceThe EFB instance is considered as a tool that realize an action on a file in a given context. The instance is represented by the file descriptor.With the same EFB instance, it is possible to work on many transactions sequentially through one or many file descriptors.Via these file descriptors, it is posssible to work on the same file or on different files.NOTE: The file descriptor will be lost and then you won’t be able to close the file. In this case you could reach the maximum number of files opened, as you can’t close the files already open, and for each new opening you will get an error.

NOTE: In case of FILE_DELETED error code (error code 17) you must close the corresponding file to release the associated file descriptor

CAUTIONUNEXPECTED APPLICATION BEHAVIORDo not open a file with the same variable as file descriptor when the file is not closed.Failure to follow these instructions can result in injury or equipment damage.

38 33002539 10/2019

Page 39: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertFormatting a Memory Card33002539 10/2019

Formatting a Memory Card

Chapter 4Formatting a Memory Card

Erasing the Memory Card

ErasingErasing the memory card is possible by using the %SW93 word via the Control Expert animation table but normally has not to be used. Erasing or formatting the card on a PC using Windows commands may render the card unusable.When the memory card is erased, the default directory \DataStorage\ is created.Before erasing with Control Expert, the user must download an application by default. Otherwise, the %SW93 system word does not exist.

NOTE: Erasing is only possible when the PLC is in STOP mode.

%SW93 Operating ModeThe erasing command and status of the memory card are provided by the %SW93 system word.

SW93.0: a rising edge starts the erasing.

SW93.1: gives the status of the system file partition:

0: invalid system file partition (incorrect format, erasing in progress, etc.), 1: Valid system file partition.The figure below displays the statuses of the %SW93.0 and %SW93.1 bits.

SaveIt is recommended that users save the file partition (data stored, manufacturer or user Web pages) with the FTP client, which can be launched from Control Expert.Users can save Web pages with FactoryCast or WAD (Web Application Designer). They can therefore restore pages in case of problems.Unity Loader also allows files to be saved on the memory card.

33002539 10/2019 39

Page 40: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Formatting a Memory Card

40 33002539 10/2019

Page 41: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertCREATE_FILE33002539 10/2019

CREATE_FILE: Create a Data Storage File

Chapter 5CREATE_FILE: Create a Data Storage File

CREATE_FILE: Create a Data Storage File

Function DescriptionThe CREATE_FILE function enables creation of a file called FILENAME, if it doesn’t exist, and allows it to be opened with the specified ModeFlag flag: O_RDONLY: opening in read-only mode (value 0), O_WRONLY: opening in write-only mode (value 1), O_RDWR: opening in read and write mode (value 2),

This flag is reset to 0 once the file is closed. The file is created in the \DataStorage\. sub-directoryIf you use the simulator mode the file is created in the temporary user folder.To access the file by FTP refer to this page (see EcoStruxure™ Control Expert, Operating Modes).NOTE: Each time a file is opened, a random value is returned by the FileDescriptor parameter. This will be used when you close the file. If you open a new file without closing the previous one, a new FileDescriptor parameter value is returned, and you will not be able to close the previous file.Therefore you should save the FileDescriptor parameter after opening a file.When the maximum number of opened files is reached, an error is returned if you try to open any further files.NOTE: If the file already exists, the behavior of CREATE_FILE is similar to that of OPEN_FILE.

The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the CREATE_FILE function is as follows:

33002539 10/2019 41

Page 42: EcoStruxure™ Control Expert - System - Block Library - 10/2019

CREATE_FILE

Ladder RepresentationThe representation in Ladder of the CREATE_FILE function is as follows:

IL representationRepresentation:CAL CREATE_FILE_Instance (REQ:=CreateFileStart, SLOT:=CreateFileSlot, FILENAME:=CreateFileName, MODEFLAG:=CreateFileModeFlag, DONE=>CreateFileDone, ERROR=>CreateFileError, STATUS=>CreateFileStatus, FILEDESC=>CreateFileDescriptor)

ST representationRepresentation:CREATE_FILE_Instance (REQ:=CreateFileStart, SLOT:=CreateFileSlot, FILENAME:=CreateFileName, MODEFLAG:=CreateFileModeFlag, DONE=>CreateFileDone, ERROR=>CreateFileError, STATUS=>CreateFileStatus, FILEDESC=>CreateFileDescriptor);

42 33002539 10/2019

Page 43: EcoStruxure™ Control Expert - System - Block Library - 10/2019

CREATE_FILE

Parameter DescriptionThe following table describes the input parameters:

The following table describes the output parameters:

Description of common parameters (see page 36).

Parameter Type CommentSLOT DINT This parameter specifies the slot address of the memory card (always

has address 0).FILENAME STRING This parameter specifies the name of the file to create.

Maximum number of characters : 64Characters like ‘ ?’ or ‘ * ‘ are not allowed.

MODEFLAG INT This parameter specifies the opening mode. O_RDONLY (0): opened in read-only mode, O_WRONLY (1): opened in write-only mode, O_RDWR (2): opened in read and write mode.

Parameter Type CommentFILEDESC DINT This parameter allows the DATA_STORAGE function to access the file.

33002539 10/2019 43

Page 44: EcoStruxure™ Control Expert - System - Block Library - 10/2019

CREATE_FILE

44 33002539 10/2019

Page 45: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertOPEN_FILE33002539 10/2019

OPEN_FILE: Open a File

Chapter 6OPEN_FILE: Open a File

OPEN_FILE: Open a File

Function DescriptionThe OPEN_FILE function enables a file named FileName to be opened (in the \DataStorage\ directory). The file must already exist. The argument mode has one of the following values: O_RDONLY, O_WRONLY, O_RDRW.

The file is opened in binary mode. This means that there is no translation of specific characters like CTRL-Z (EOF marker) or carriage return/line break.A maximum number of 16 files can be opened simultaneously.If you use the simulator mode the file is opened in the temporary user folder.To access the file by FTP refer to this page (see EcoStruxure™ Control Expert, Operating Modes).NOTE: Each time a file is opened, a random value is returned by the FileDescriptor parameter. This will be used when you close the file. If you open a new file without closing the previous one, a new FileDescriptor parameter value is returned, and you will not be able to close the previous file.Therefore you should save the FileDescriptor parameter after opening a file.When the maximum number of opened files is reached, an error is returned if you try to open any further files.NOTE: It is still possible to modify the status of a file in the file system although the file is already open.The status of a file (Read Only, Read/Write) is not evaluated when the file is opened, but only when data are written into. (For example it is possible to open a Read Only file in R/W mode without any error). Thus, as long as the file is in read only mode in the file system, any writing request will lead to an error (error 14) although the file has been opened successful in R/W mode. As soon as the file is in R/W mode again, the writing requests will work again without the obligation to close and reopen the file.The additional parameters EN and ENO can be configured.

33002539 10/2019 45

Page 46: EcoStruxure™ Control Expert - System - Block Library - 10/2019

OPEN_FILE

FBD RepresentationThe representation in FBD of the OPEN_FILE function is as follows:

Ladder RepresentationThe representation in Ladder of the OPEN_FILE function is as follows:

IL representationRepresentation:CAL OPEN_FILE_Instance (REQ:=OpenFileStart, SLOT:=OpenFileSlot, FILENAME:=OpenFileName, MODEFLAG:=OpenFileModeFlag, DONE=>OpenFileDone, ERROR=>OpenFileError, STATUS=>OpenFileStatus, FILEDESC=>OpenFileDescriptor)

ST representationRepresentation:OPEN_FILE_Instance (REQ:=OpenFileStart, SLOT:=OpenFileSlot, FILENAME:=OpenFileName, MODEFLAG:=OpenFileModeFlag, DONE=>OpenFileDone, ERROR=>OpenFileError, STATUS=>OpenFileStatus, FILEDESC=>OpenFileDescriptor);

46 33002539 10/2019

Page 47: EcoStruxure™ Control Expert - System - Block Library - 10/2019

OPEN_FILE

Parameter DescriptionThe following table describes the input parameters:

The following table describes the output parameters:

Description of common parameters (see page 36).

Parameter Type CommentSLOT DINT This parameter specifies the slot address of the memory card (always

has address 0).FILENAME STRING This parameter specifies the name of the file to open.MODEFLAG INT This parameter specifies the opening mode.

O_RDONLY (0): opened in read-only mode, O_WRONLY (1): opened in write-only mode, O_RDWR (2): opened in read and write mode.

Parameter Type CommentFILEDESC DINT This parameter allows the DATA_STORAGE function to access the file.

33002539 10/2019 47

Page 48: EcoStruxure™ Control Expert - System - Block Library - 10/2019

OPEN_FILE

48 33002539 10/2019

Page 49: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSET_FILE_ATTRIBUTES33002539 10/2019

SET_FILE_ATTRIBUTES: Set File Attributes

Chapter 7SET_FILE_ATTRIBUTES: Set File Attributes

SET_FILE_ATTRIBUTES: Sets the File Attributes

Function DescriptionThe SET_FILE_ATTRIBUTES function enables the file attributes to be set.

The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the SET_FILE_ATTRIBUTES function is as follows:

Ladder RepresentationThe representation in Ladder of the SET_FILE_ATTRIBUTES function is as follows:

33002539 10/2019 49

Page 50: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SET_FILE_ATTRIBUTES

IL representationRepresentation:CAL SET_FILE_ATTRIBUTES_Instance (REQ:=SetFileAttributesStart, FILEDESC:=SetFileAttributesDescriptor, ATTRIBUTES:=SetFileAttributes, DONE=>SetFileAttributesDone, ERROR=>SetFileAttributesError, STATUS=>SetFileAttributesStatus)

ST representationRepresentation:SET_FILE_ATTRIBUTES_Instance (REQ:=SetFileAttributesStart, FILEDESC:=SetFileAttributesDescriptor, ATTRIBUTES:=SetFileAttributes, DONE=>SetFileAttributesDone, ERROR=>SetFileAttributesError, STATUS=>SetFileAttributesStatus);

Parameter DescriptionThe following table describes the input parameters:

Description of common parameters (see page 36).

Parameter Type CommentFILEDESC DINT This parameter specifies the file descriptor returned

by the CREATE_FILE or OPEN_FILE functions.ATTRIBUTES WORD This parameter specifies the attributes to set. Only

two attributes are accepted by the system: SET_RDONLY (1): the file is write protected, CLR_RDONLY (0): Clears the read-only

attribute.

50 33002539 10/2019

Page 51: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertGET_FILE_INFO33002539 10/2019

GET_FILE_INFO: Retrieve File Attributes

Chapter 8GET_FILE_INFO: Retrieve File Attributes

GET_FILE_INFO: Retrieves the File Attributes

Function DescriptionThe GET_FILE_INFO function enables information on the file to be obtained.

The OPEN_FILE (see page 45) function must be enabled before the GET_FILE_INFO block because the value of FileDescriptor (see page 47) comes from the output parameter of the OPEN_FILE or CREATE_FILE block.

The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the GET_FILE_INFO function is as follows:

33002539 10/2019 51

Page 52: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_FILE_INFO

Ladder RepresentationThe representation in Ladder of the GET_FILE_INFO function is as follows:

IL representationRepresentation:CAL GET_FILE_INFO_Instance (REQ:=GetFileInfoStart, FILEDESC:=GetFileInfo-Descriptor, DONE=>GetFileInfoDone, ERROR=>GetFileInfoError, STATUS=>GetFileInfoStatus, ATTRIBUTES=>GetFileInfoAttributes, LENGTH=>GetFileInfoLength, ACCESSTIME=>GetFileInfoAccessTime, MODTIME=>GetFileInfoModifiedTime, CHANGESTATTIME=>GetFileInfoChangeStatusTime)

ST representationRepresentation:GET_FILE_INFO_Instance (REQ:=GetFileInfoStart, FILEDESC:=GetFileInfoDe-scriptor, DONE=>GetFileInfoDone, ERROR=>GetFileInfoError, STATUS=>GetFileInfoStatus, ATTRIBUTES=>GetFileInfoAttributes, LENGTH=>GetFileInfoLength, ACCESSTIME=>GetFileInfoAccessTime, MODTIME=>GetFileInfoModifiedTime, CHANGESTATETIME=>GetFileInfoChangeStatusTime);

52 33002539 10/2019

Page 53: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_FILE_INFO

Parameter DescriptionThe following table describes the input parameter:

The following table describes the output parameters:

Description of common parameters (see page 36).

Parameter Type CommentFILEDESC DINT This parameter specifies the file descriptor returned by

the OPEN_FILE functions.

Parameter Type CommentATTRIBUTES WORD This bit field specifies the file attributes:

Bit 0: read-only file Bit 1: hidden file Bit 2: system file Bit 3: volume label (not a file) Bit 4: sub-directory Bit 5: subject to archival

LENGTH UDINT This parameter specifies the size of the file in bytes.

ACCESSTIME DATEANDTIME This parameter specifies the date and time when the file was last accessed.

NOTE: This parameter is not updated for M580 PLCs.

MODTIME DATEANDTIME This parameter specifies the date and time when the file was last modified.

CHANGESTATETIME DATEANDTIME This parameter specifies the date and time when the last file status change took place.

33002539 10/2019 53

Page 54: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_FILE_INFO

54 33002539 10/2019

Page 55: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertGET_FREESIZE33002539 10/2019

GET_FREESIZE: View Available Space on Memory Card

Chapter 9GET_FREESIZE: View Available Space on Memory Card

GET_FREESIZE: View Available Space of the File Partition on the Memory Card

Function DescriptionThe GET_FREESIZE function displays the amount of available space on the memory card.

This available space is linked to the system file partition, which contains both storage data and Web pages.The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the GET_FREESIZE function is as follows:

Ladder RepresentationThe representation in Ladder of the GET_FREESIZE function is as follows:

33002539 10/2019 55

Page 56: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_FREESIZE

IL representationRepresentation:CAL GET_FREESIZE_Instance (REQ:=GetFreeSizeStart, SLOT:=GetFreeSizeSlot, DONE=>GetFreeSizeDone, ERROR=>GetFreeSizeError, STATUS=>GetFreeSizeStatus, SIZE=>GetFreeSize)

ST representationRepresentation:WRITE GET_FREESIZE_Instance (REQ:=GetFreeSizeStart, SLOT:=GetFreeSizeSlot, DONE=>GetFreeSizeDone, ERROR=>GetFreeSizeError, STATUS=>GetFreeSizeStatus, SIZE=>GetFreeSize);

Parameter DescriptionThe following table describes the input parameter:

The following table describes the output parameter:

Description of common parameters (see page 36).

Parameter Type CommentSLOT BYTE This parameter specifies the slot address of the

memory card (always has address 0).

Parameter Type CommentSIZE UDINT This parameter specifies the size in bytes of the

available space on the memory card.

56 33002539 10/2019

Page 57: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSEEK_FILE33002539 10/2019

SEEK_FILE: Position in a File

Chapter 10SEEK_FILE: Position in a File

SEEK_FILE: Position in the File

Function DescriptionThe SEEK_FILE function sets the current position in the file at the position specified by the Offset argument.The Whence argument assigns the file position pointer. It has three values:

SEEK_SET (value 0): this places the pointer at the position corresponding to the offset (default value : to overwrite the file),

SEEK_CUR (value 1): places the pointer at the current position + offset, SEEK_END (value 2): places the pointer at the position corresponding to the file size + offset.

Useful if you want to overwrite last variables of the file (negative offset) or to write in the file from the end in order to not overwrite data.

33002539 10/2019 57

Page 58: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SEEK_FILE

The following figure illustrates the positioning of the pointer according to the offset: (differents values of offset in this diagram).

The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the SEEK_FILE function is as follows:

58 33002539 10/2019

Page 59: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SEEK_FILE

Ladder RepresentationThe representation in Ladder of the SEEK_FILE function is as follows:

IL representationRepresentation:CAL SEEK_FILE_Instance (REQ:=SeekFileStart, FILEDESC:=SeekFileDescriptor, OFFSET:=SeekFileOffset, WHENCE:=SeekFileWhence, DONE=>SeekFileDone, ERROR=>SeekFileError, STATUS=>SeekFileStatus)

ST representationRepresentation:SEEK_FILE_Instance (REQ:=SeekFileStart, FILEDESC:=SeekFileDescriptor, OFFSET:=SeekFileOffset, WHENCE:=SeekFileWhence, DONE=>SeekFileDone, ERROR=>SeekFileError, STATUS=>SeekFileStatus);

Parameter DescriptionThe following table describes the input parameters:

Description of common parameters (see page 36).

Parameter Type CommentFILEDESC DINT This parameter specifies the file descriptor returned by

the CREATE_FILE or OPEN_FILE functions.OFFSET DINT This parameter specifies the offset of the movement.WHENCE INT Seek Mode:

SEEK_SET (0) - set to Offset, SEEK_CUR (1) - set to the current position plus Offset, SEEK_END (2) - set to the file size plus Offset.

33002539 10/2019 59

Page 60: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SEEK_FILE

60 33002539 10/2019

Page 61: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertWR_DATA_TO_FILE33002539 10/2019

WR_DATA_TO_FILE: Write Data to a File

Chapter 11WR_DATA_TO_FILE: Write Data to a File

WR_DATA_TO_FILE: Writes Data to a File

Function DescriptionThe WR_DATA_TO_FILE function enables a direct address variable (%MW1000), a located variable (VAR0 @ %MW1000), or an unlocated variable to be written to a file.

The value written is added after the current position in the file. After writing, the current position of the file is updated.NOTE: When you use the WR_DATA_TO_FILE function with string data type, It creates in the file an array of bytes whose size is the maximum size declared (for instance if you declare a STRING[100] it writes 100 bytes in the file).If you read it with an EFB of Control Expert the function read the 100 bytes but it sees only the first characters before the first NULL character. if you use a third party software or tool and if you've got many null characters in the 100 bytes, it could see many string instead of one.NOTE: It is still possible to modify the status of a file in the file system although the file is already open. The status of a file (Read Only, Read/Write) is not evaluated when the file is opened, but only when data.The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the WR_DATA_TO_FILE function is as follows:

33002539 10/2019 61

Page 62: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WR_DATA_TO_FILE

Ladder RepresentationThe representation in Ladder of the WR_DATA_TO_FILE function is as follows:

IL representationRepresentation:CAL WR_DATA_TO_FILE_Instance (REQ:=WriteDataToFileStart, FILEDESC:=WriteDataToFileDescriptor, VARIABLE:=WriteDataToFileVariable, DONE=>WriteDataToFileDone, ERROR=>WriteDataToFileError, STATUS=>WriteDataToFileStatus)

ST representationRepresentation:WR_DATA_TO_FILE_Instance (REQ:=WriteDataToFileStart, FILEDESC:=WriteData-ToFileDescriptor, VARIABLE:=WriteDataToFileVariable, DONE=>WriteDataToFileDone, ERROR=>WriteDataToFileError, STATUS=>WriteDataToFileStatus);

Parameter DescriptionThe following table describes the input parameters:

Description of common parameters (see page 36).

Parameter Type CommentFILEDESC DINT This parameter specifies the file descriptor returned by

the CREATE_FILE or OPEN_FILE functions.VARIABLE ANY This parameter specifies the variable to write to the file.

Any direct address variable (%MW1000), located variable (VAR0 @ %MW1000), or unlocated variable (single type, table, structure) can be written.To write a table of %MW or direct variables, the syntax used is %MW1000:10 (10 words from %MW1000).

62 33002539 10/2019

Page 63: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertRD_FILE_TO_DATA33002539 10/2019

RD_FILE_TO_DATA: Read Data in a File

Chapter 12RD_FILE_TO_DATA: Read Data in a File

RD_FILE_TO_DATA: Read Data from a File

Function DescriptionThe RD_FILE_TO_DATA function allows data to be read from a file, at the current position of the file, and enables it to be copied into a direct address variable (%MW1000), a located variable (VAR0 @ %MW1000), or an unlocated variable. After reading, the current position in the file is updated.

This elementary function reads a number of bytes that correspond to the size of the variable in the specified file.The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the RD_FILE_TO_DATA function is as follows:

Ladder RepresentationThe representation in Ladder of the RD_FILE_TO_DATA function is as follows:

33002539 10/2019 63

Page 64: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RD_FILE_TO_DATA

IL representationRepresentation:CAL RD_FILE_TO_Instance (REQ:=ReadFileToDataStart, FILEDESC:=ReadFileTo-DataDescriptor, DONE=>ReadFileToDataDone, ERROR=>ReadFileToDataError, STATUS=>ReadFileToDataStatus, VARIABLE=>ReadFileToDataVariable, NBBYTESRD=>ReadFileToDataNumberBytesReadStatus)

ST representationRepresentation:RD_FILE_TO_Instance (REQ:=ReadFileToDataStart, FILEDESC:=ReadFileToDataD-escriptor, DONE=>ReadFileToDataDone, ERROR=>ReadFileToDataError, STATUS=>ReadFileToDataStatus, VARIABLE=>ReadFileToDataVariable, NBBYTESRD=>ReadFileToDataNumberBytesReadStatus);

Parameter DescriptionThe following table describes the input parameters:

The following table describes the output parameters:

Description of common parameters (see page 36).

Parameter Type CommentFILEDESC DINT This parameter specifies the file descriptor returned by

the CREATE_FILE or OPEN_FILE functions.

Parameter Type CommentVARIABLE ANY This parameter specifies the variable or table which will

receive the data.Any direct address variable (%MW1000), located variable (VAR0 @ %MW1000), or unlocated variable (single type, table, structure) can be used as a destination.To copy to a table or direct variables, the syntax used is %MW1000:10 (10 words starting at %MW1000).

NBBYTESRD UDINT This parameter specifies the size effectively read. It may be smaller than the size of the variable.The main reason why the NBBYTESRD can be smaller than the Variable size is that:File size- read start position < Variable sizeThen the read variable is only updated with the number of bytes read and the other bytes of data come from the last reading.

64 33002539 10/2019

Page 65: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertCLOSE_FILE33002539 10/2019

CLOSE_FILE: Close a File

Chapter 13CLOSE_FILE: Close a File

CLOSE_FILE: Close the File

Function DescriptionThe CLOSE_FILE function enables the specified file to be closed and the file descriptor to be freed.

NOTE: If the user want to disable access to the card in order to extract it for example, he will set to 1 the bit %S65. In this case all current accesses are finished, consequently all open files will be automatically closed. (To enable again the access to the card %S65 must be reset to 0.)

NOTE: Each time a file is opened, a random value is returned by the FileDescriptor parameter. This will be used when you close the file. If you open a new file without closing the previous one, a new FileDescriptor parameter value is returned, and you will not be able to close the previous file.Therefore you should save the FileDescriptor parameter after opening a file.When the maximum number of opened files is reached, an error is returned if you try to open any further files.The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the CLOSE_FILE function is as follows:

33002539 10/2019 65

Page 66: EcoStruxure™ Control Expert - System - Block Library - 10/2019

CLOSE_FILE

Ladder RepresentationThe representation in Ladder of the CLOSE_FILE function is as follows:

IL representationRepresentation:CAL CLOSE_FILE_Instance (REQ:=CloseFileStart, FILEDESC:=CloseFileDe-scriptor, DONE=>CloseFileDone, ERROR=>CloseFileError, STATUS=>CloseFileStatus)

ST representationRepresentation:CLOSE_FILE_Instance (REQ:=CloseFileStart, FILEDESC:=CloseFileDescriptor, DONE=>CloseFileDone, ERROR=>CloseFileError, STATUS=>CloseFileStatus);

Parameter DescriptionThe following table describes the input parameter:

Description of common parameters (see page 36).

Parameter Type CommentFILEDESC DINT This parameter specifies the file descriptor returned

by CREATE_FILE or OPEN_FILE.

66 33002539 10/2019

Page 67: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertDELETE_FILE33002539 10/2019

DELETE_FILE: Delete a File

Chapter 14DELETE_FILE: Delete a File

DELETE_FILE: Delete a File

Function DescriptionThe DELETE_FILE function enables deletion of the file named FileName.

NOTE: When using the DELETE_FILE function, always close an opened file before deleting it using the CLOSE_FILE function. Otherwise: The opened file counter is not updated, opened files limitations (see page 35). The FileDescriptor (FD) output parameter is not released.

The additional parameters EN and ENO can be configured.

FBD RepresentationThe representation in FBD of the DELETE_FILE function is as follows:

WARNINGHAZARD OF OVERFLOW OF FILE DESCRIPTORSAlways close an opened file before deleting it with the DELETE_FILE function.Deleting an open file can be done without user information message and can lead to the increment of the number of file descriptors up to an overflow.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 67

Page 68: EcoStruxure™ Control Expert - System - Block Library - 10/2019

DELETE_FILE

Ladder RepresentationThe representation in Ladder of the DELETE_FILE function is as follows:

IL representationRepresentation:CAL DELETE_FILE_Instance (REQ:=DeleteFileStart, SLOT:=DeleteFileSlot, FILENAME:=DeleteFileName, DONE=>DeleteFileDone, ERROR=>DeleteFileError, STATUS=>DeleteFileStatus)

ST representationRepresentation:DELETE_FILE_Instance (REQ:=DeleteFileStart, SLOT:=DeleteFileSlot, FILENAME:=DeleteFileName, DONE=>DeleteFileDone, ERROR=>DeleteFileError, STATUS=>DeleteFileStatus);

Parameter DescriptionThe following table describes the input parameters:

Description of common parameters (see page 36).

Parameter Type CommentSLOT BYTE This parameter specifies the memory card slot (always

at zero).FILENAME STRING This parameter specifies the name of the file to delete.

Maximum number of characters : 64

68 33002539 10/2019

Page 69: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertFile Management EFB Error Codes33002539 10/2019

Memory Card File Management EFB Error Codes

Chapter 15Memory Card File Management EFB Error Codes

Error Codes

At a GlanceAn error code is valid until the next time the EF that generated it is initialized.

Table of Error CodesThe following table describes the error codes that can be generated for EFB functions:

Value Description1 The memory card is missing in the slot.2 The memory card doesn't support data storage (wrong part number) Or the file

system structure has been deleted on the memory card (probably the memory card has been reformatted on a PC).

3 The slot number is incorrect (has to be 0).4 Attempt to write in a memory card write-protected by the switch.5 Attempt to open more than 16 files at the same time.6 Attempt to write when there is no more space available in the memory card for

data storage.7 Attempt to open a file that doesn't exist on the memory card.11 The file name size exceed 64 characters.13 The file name is incorrect or empty.14 Attempt to write a file opened in read only mode.17 The file has been deleted (occurs when a file descriptor exist and the file has

been deleted by DELETE_FILE EFB or by FTP command).21 The file descriptor is incorrect.23 Attempt to execute a data storage function block in a task different than the

MAST.-1 Other errors than the previous ones.

33002539 10/2019 69

Page 70: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EFB Error Codes

70 33002539 10/2019

Page 71: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertFile Management EF Examples33002539 10/2019

Memory Card File Management EF Examples

Chapter 16Memory Card File Management EF Examples

OverviewThis chapter gives usage examples for memory card file management EFBs.

What Is in This Chapter?This chapter contains the following topics:

Topic PageDefinition of the Example and Declaration of Variables 72Offline Example 73Online Example: Procedure 74Example written in ST 77

33002539 10/2019 71

Page 72: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

Definition of the Example and Declaration of Variables

DefinitionThe EFB WR_DATA_TO_FILE and RD_FILE_TO_DATA allow variables to be written into a file and data in a file to be read. These elementary functions make up part of the basis of file management and can therefore be used to build whatever type of application that requires these functions.The example only uses the following four functions: OPEN_FILE, to open an already created file (see page 41), WR_DATA_TO_FILE, to write data, RD_FILE_TO_DATA, to read data, CLOSE_FILE to close the file.

Declaration of VariablesThe table below shows the details of the variables to be declared for the parameters used:

NOTE: The temporary identification number FileDesc enables, amongst other things, several people to open the same file at the same time to work on it. The number used for FileDesc is freed once the file is closed using the CLOSE_FILE function. FileDesc is managed automatically by the system.

Name of the variable.

Type Comment

cmd_open EBOOL File opening bit.cmd_write EBOOL Write data to file bit.cmd_read EBOOL Read file data bit.cmd_close EBOOL Close file bit.FileName STRING File name. By default the value is ‘test’:FileDesc INT FileDesc is the number automatically assigned when a file is

opened. This unique and temporary identification number will be assigned by the OPEN_FILE function.

72 33002539 10/2019

Page 73: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

Offline Example

At a GlanceThe figure below describes the elementary blocks with the variables declared beforehand, offline:

33002539 10/2019 73

Page 74: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

Online Example: Procedure

ProcedureIn this example, the data is to be written into a file, which is then to be closed, after which it is re-opened to read the data from the same file. The table below describes the procedure to follow for this example:

Step Action1 Execute the OPEN_FILE function by enabling the cmd_open bit, by right-clicking on the Req

input parameter.Result: A unique and temporary identification number is assigned to the opening instance as a FileDesc output. (In this case, we have assigned value 5 to this output. Use this value to declare the FileDesc input variable for the WR_DATA_TO_FILE and CLOSE_FILE functions.)The graphic below is a representation of the function after execution:

Disable cmd_open by right-clicking on the Req input parameter.

2 In the WR_DATA_TO_FILE block, force the %MW10 variable to the value 100 by right-clicking on the variable input parameter.

3 Execute the WR_DATA_TO_FILE function by enabling the cmd_write bit by right-clicking on the Req input parameter.Result: the value of the variable is written into the test file.The graphic below is a representation of the function after execution:

Disable cmd_write by right-clicking on the Req input parameter.

74 33002539 10/2019

Page 75: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

4 Execute the CLOSE_FILE function by enabling the cmd_close bit by right-clicking on the Req input parameter.Result: The file is closed and the FileDesc identification number is freed for use at a later date.The graphic below is a representation of the function after execution:

Disable cmd_close by right-clicking on the Req input parameter.

5 Execute the OPEN_FILE function again by enabling the cmd_open bit by right-clicking on the Req input parameter.Result: It is a new opening instance, so a new FileDesc number is assigned, in this case 6. Use these values to declare the FileDesc input variable for the RD_FILE_TO_DATA and CLOSE_FILE functions.The graphic below is a representation of the function after execution:

Disable cmd_open by right-clicking on the Req input parameter.

Step Action

33002539 10/2019 75

Page 76: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

6 In the RD_FILE_TO_DATA block, force the %MW10 variable to the value 120 by right-clicking on the variable input parameter. By doing this, it is possible to check that the value retrieved by the RD_FILE_TO_DATA function is correct.The graphic below is a representation of the function before execution:

7 Execute the RD_FILE_TO_DATA function by enabling the cmd_read bit, by right-clicking on the Req input parameter.Result: The function reads the file data, i.e., the value of the variable written beforehand with the WR_DATA_TO_FILE function. This value can be found in the Variable output parameter.The graphic below is a representation of the function after execution:

Disable cmd_read by right-clicking on the Req input parameter.

8 Execute the CLOSE_FILE function by enabling the cmd_close bit by right-clicking on the Req input parameter.Result: The file is closed and the FileDesc identification number is freed for use at a later date.The graphic below is a representation of the function after execution:

Disable cmd_close by right-clicking on the Req input parameter.

Step Action

76 33002539 10/2019

Page 77: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

Example written in ST

At a glanceIn this example we use the following EFBs in order to perform some actions on a file: CREATE_FILE, OPEN_FILE, SEEK_FILE WR_DATA_TO_FILE RD_FILE_TO_DATA CLOSE_FILE

Declaration of variablesThe table below shows the details of the variables to be declared for the parameters used:

Variable name Type Commentclose_req EBOOL Enable CLOSE_FILE function bitcreate_req EBOOL Enable CREATE_FILE function bitfileDesc DINT FileDesc is the number automatically assigned

when a file is opened. This unique and temporary identification number will be assigned by the OPEN_FILE function.

NbBytesRd UDINT Specify the size effectively read of the variable. read_req EBOOL Enable RD_FILE_TO_DATA function bit variable INT variable read in the fileseek_req EBOOL Enable SEEK_FILE function bit write_req EBOOL Enable WR_DATA_TO_FILE function bit variable_tab ARRAY[0..9] OF INT Array for the different values of the variables

written in the filecmd_write EBOOL write file bitGO_STORE EBOOL Bit used to start the creation of the filecmd_seek EBOOL seek file bitError_WR BOOL Error during execution of WR_DATA_TO_FILE

function bitcmd_close EBOOL close file bitGO_RESTORE EBOOL Bit used to start the re-opening of the fileopen_req EBOOL Enable OPEN_FILE function bit cmd_read EBOOL read file to data bitDone_WR BOOL Writing in the file operation completed bit

33002539 10/2019 77

Page 78: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

CodeThis code perform the following actions : Create the file or seek it if it is already created, Write data in the file, Close the file, Open the closed file, Read the data written in the file, Close the file.(*********************************************************Create a file 'TEST.bin' if doesn't exist and open it inappend mode(SEEK).Write a data and close the file*********************************************************)(******* Begin CREATE part *******)if RE(GO_STORE) then (* Set GO_STORE to start *) create_req := 1;

Done_OPEN BOOL Opening the file operation completed bitStatus_WR WORD Error code (useful when Error_WR:=1)Done_SEEK BOOL Seeking the file operation completed bitError_SEEK BOOL Error during execution of SEEK_FILE function bitStatus_SEEK WORD Error code (useful when Error_SEEK:=1)Done_CREATE BOOL Creating the file operation completed bitError_CREATE BOOL Error during execution of CREATE_FILE

function bitStatus_CREATE WORD Error code (useful when Error_CREATE:=1)Done_CLOSE BOOL Closing the file operation completed bitError_CLOSE BOOL Error bit for CLOSE_FILE functionStatus_CLOSE WORD Error code (useful when Error_CLOSE:=1)Error_OPEN BOOL Error during execution of OPEN_FILE function

bitStatus_OPEN WORD Error code (useful when Error_OPEN:=1)Done_RD BOOL Reading the file operation completed bitError_RD BOOL Error during execution of RD_FILE_TO_DATA

function bitStatus_RD WORD Error code (useful when Error_RD:=1)

Variable name Type Comment

78 33002539 10/2019

Page 79: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

end_if;CREATE (REQ := create_req,(* Rising edge on REQ input to start the CREATE *)SLOT := 0,FILENAME := 'TEST.bin',MODEFLAG := 2,(* Read/Write mode *)DONE => Done_CREATE, ERROR => Error_CREATE,STATUS => Status_CREATE,FILEDESC => fileDesc);create_req := 0;if GO_STORE then if (Done_CREATE and not Error_CREATE) then GO_STORE := 0 ; seek_req := 1; cmd_seek := 1; end_if;end_if;(******* End CREATE part *******)(******* Begin SEEK part *******)SEEK (REQ := seek_req;(* Rising edge on REQ input to start the SEEK *)FILEDESC := fileDescOFFSET := 0,WHENCE := 2;(* SEEK_END *)DONE => Done_SEEK,ERROR => Error_SEEK,STATUS => Status_SEEK);seek_req := 0;if cmd_seek then if (Done_SEEK and not Error_SEEK) then cmd_seek := 0; write_req := 1; cmd_write := 1;

33002539 10/2019 79

Page 80: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

end_if; end_if;(******* End SEEK part *******)(******* Begin WRITE part *******)variable_tab[0] := variable_tab[0] + 1;WRITE (REQ := write_req,(* Rising edge on REQ input to start the WRITE *)FILEDESC := fileDesc,VARIABLE := variable_tab,DONE => Done_WR,ERROR => Error_WR,STATUS => Status_WR);write_req := 0;if cmd_write then if (Done_WR and not Error_WR) then cmd_write := 0; close_req := 1; cmd_close := 1; end_if;end_if;(******* End WRITE part *******)(******* Begin CLOSE part *******)CLOSE (REQ := close_req,(* Rising edge on REQ input to start the CLOSE *)FILEDESC := fileDesc,DONE => Done_CLOSE,ERROR => Error_CLOSE,STATUS => Status_CLOSE);close_req := 0;if cmd_close then if (Done_CLOSE and not Error_CLOSE) then cmd_close := 0; end_if;end_if;(******* End CLOSE part *******)

80 33002539 10/2019

Page 81: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

(*********************************************************Open the file 'TEST.bin', read the first data and close the file**********************************************************(******* Begin OPEN part *******)if RE(GO_RESTORE) then(* Set GO_RESTORE to start *) open_req := 1;end_if;OPEN (REQ := open_req,(* Rising edge on REQ input to start the OPEN *)SLOT := 0,FILENAME := 'TEST.bin',MODEFLAG := 0,DONE => Done_OPEN,ERROR => Error_OPEN,STATUS => Status_OPEN,FILEDESC => fileDesc);open_req := 0;if GO_RESTORE then if (Done_OPEN and not Error_OPEN) then GO_RESTORE := 0 ; read_req := 1; cmd_read := 1; end_if;end_if;(******* End OPEN part *******)(******* Begin READ part *******)READ (REQ := read_req,(* Rising edge on REQ input to start the READ *)FILEDESC := fileDesc,DONE => Done_RD,ERROR => Error_RD,STATUS => Status_RD,VARIABLE => variable,NBBYTESRD => NbBytesRd);

33002539 10/2019 81

Page 82: EcoStruxure™ Control Expert - System - Block Library - 10/2019

File Management EF Examples

read_req := 0;if cmd_read then if (Done_RD and not Error_RD) then cmd_read := 0; close_req := 1;(* Same CLOSE part than the CREATE/SEEK/WRITE/CLOSE *) cmd_close := 1; end_if;end_if;(******* End READ part *******)

82 33002539 10/2019

Page 83: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertWRITE_U_PCMCIA33002539 10/2019

WRITE_U_PCMCIA: Writing data to the memory card

Chapter 17WRITE_U_PCMCIA: Writing data to the memory card

Description

Function DescriptionThe WRITE_U_PCMCIA function transfers data from the PLC RAM memory to the user memory card archiving zone. The function WRITE_U_PCMCIA allows addessing the PLC zone’s beginning to be copied to the PCMCIA card up to 65 535 (instead of 32 767 for WRITE_PCMCIA function) and is therefore recommended to be used instead of WRITE_PCMCIA function.

The additional parameters EN and ENO can be configured.

An example using the function WRITE_U_PCMCIA is available, WRITE_U_PCMCIA and READ_U_PCMCIA Example (see page 91).

Representation in FBDRepresentation:

33002539 10/2019 83

Page 84: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRITE_U_PCMCIA

Representation in LDRepresentation:

Representation in ILRepresentation:LD Slot_NumberWRITE_U_PCMCIA Dest_Address, Words_Number, Source_Address, Write_State

Representation in STRepresentation:WRITE_U_PCMCIA(Slot_Number, Dest_Address, Words_Number, Source_Address, Write_State);

Description of the parametersThis table describes the input parameters:

Parameter Type CommentSlot_Number INT PCMCIA card slot:

0 = upper slot 1 = lower slot

Dest_Address DINT First address where the data is written in the memory card.

Words_Number INT Number of words to write.Source_Address UINT First address where the data is read from the

PLC (%MW). The upper limit of the address is: 65 535.

84 33002539 10/2019

Page 85: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRITE_U_PCMCIA

This table describes the output parameters:

Parameter Type CommentWrite_State INT Code providing the result of the write command execution:

16#0000: write performed correctly 16#0102: Source_Address + Words_Number - 1

is greater than the maximum number of declared words in the PLC

16#0104: no valid application or no word in the PLC 16#0201: no file zone in the memory card 16#0202: memory card error 16#0204: memory card write-protected 16#0241: Dest_Address < 0 16#0242: Dest_Address + Words_Number-1 is

greater than the highest address of the memory card 16#0401: Words_Number ≤ 0 16#0402: Slot_Number is different from 0 and 1 16#0501: unsupported service

33002539 10/2019 85

Page 86: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRITE_U_PCMCIA

86 33002539 10/2019

Page 87: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertREAD_U_PCMCIA33002539 10/2019

READ_U_PCMCIA: Reading data in the memory card

Chapter 18READ_U_PCMCIA: Reading data in the memory card

Description

Function DescriptionThe READ_U_PCMCIA function transfers data from the user memory card archiving zone to the PLC RAM memory. The function READ_U_PCMCIA allowss addressing the PLC zone’s beginning to be copied to the PCMCIA card up to 65 535 (instead of 32 767 for READ_PCMCIA function) and is therefore recommended to be used instead of READ_PCMCIA function.

The additional parameters EN and ENO can be configured.

An example using the function READ_U_PCMCIA is available, WRITE_U_PCMCIA and READ_U_PCMCIA Example (see page 91).

Representation in FBDRepresentation:

33002539 10/2019 87

Page 88: EcoStruxure™ Control Expert - System - Block Library - 10/2019

READ_U_PCMCIA

Representation in LDRepresentation:

Representation in ILRepresentation:LD Slot_NumberREAD_U_PCMCIA Source_Address, Words_Number, Dest_Address, Read_State

Representation in STRepresentation:READ_U_PCMCIA(Slot_Number, Source_Address, Words_Number, Dest_Address, Read_State);

Description of the ParametersThis table describes the input parameters:

Parameter Type CommentSlot_Number INT PCMCIA card slot:

0 = upper slot, 1 = lower slot

Source_Address DINT First address where the data is read from the memory card (0...).

Words_Number INT Number of words to be read.Dest_Address UINT First address where the data is written in the

PLC (%MW). The upper limit of the address is: 65 535.

88 33002539 10/2019

Page 89: EcoStruxure™ Control Expert - System - Block Library - 10/2019

READ_U_PCMCIA

This table describes the output parameters:

Parameter Type CommentRead_State INT Code providing the result of the read command

execution: 16#0000: read performed correctly 16#0102: Dest_Address + Words_Number -1

is greater than the maximum number of declared words in the PLC.

16#0104: no valid application or no word in the PLC 16#0201: no file zone in the memory card 16#0202: memory card error 16#0204: memory card write-protected 16#0241: Source_Address < 0, 16#0242: Dest_Address + Words_Number-1 is

greater than the highest address of the memory car,. 16#0401: Words_Number ≤ 0 16#0402: Slot_Number is different from 0 and 1 16#0501: Words_Number = unsupported service

33002539 10/2019 89

Page 90: EcoStruxure™ Control Expert - System - Block Library - 10/2019

READ_U_PCMCIA

90 33002539 10/2019

Page 91: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertWRITE_U_PCMCIA and READ_U_PCMCIA Example33002539 10/2019

WRITE_U_PCMCIA and READ_U_PCMCIA Functions Example

Chapter 19WRITE_U_PCMCIA and READ_U_PCMCIA Functions Example

WRITE_U_PCMCIA and READ_U_PCMCIA Example

ObjectivesThis example shows how to use the READ_U_PCMCIA and WRITE_U_PCMCIA function blocks by: Writing values from words (%MW100 to %MW109) to a memory card. Reading values from the memory card to words (%MW110 and %MW119).NOTE: In this example, to use those function blocks, a memory card must be connected into the PLC.

Configuration of the CPUIn this example, the TSX MRP C007M SRAM memory card is connected into the upper slot A of the CPU (parameter SLOT = 0 for the functions blocks). In addition, for data storage purposes, the CPU is configured with 2000 kB of memory.NOTE: The data storage is used for READ_U_PCMCIA and WRITE_U_PCMCIA function blocks. The 2000 kB of data storage represents:

The READ_U_PCMCIA and WRITE_U_PCMCIA functions are working with word addresses:

Addresses from 0 to 1024000 for the memory card can be used.

33002539 10/2019 91

Page 92: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRITE_U_PCMCIA and READ_U_PCMCIA Example

Programming the MAST sectionIn the MAST section of the program, program as follows: The memory card is connected into slot 0. The WRITE_U_PCMCIA function writes 10 words to address 10000 on the memory card from

%MW100. The READ_U_PCMCIA reads 10 words from address 10000 on the memory card to %MW110. Representation of WRITE_U_PCMCIA and READ_U_PCMCIA in FBD language:

Representation of WRITE_U_PCMCIA and READ_U_PCMCIA in ST language:WRITE_U_PCMCIA (0,10000,10,100,Status_write);READ_U_PCMCIA (0,10000,10,110,Status_read);

Testing the ExampleBy using animation tables with words: %MW100 to %MW119, the values from %MW100 to %MW109 are copied to %MW110 to %MW119 via the memory card.

92 33002539 10/2019

Page 93: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertWRITE_V_PCMCIA33002539 10/2019

WRITE_V_PCMCIA: Write Variable to PCMCIA Card

Chapter 20WRITE_V_PCMCIA: Write Variable to PCMCIA Card

Description

Function descriptionThe WRITE_V_PCMCIA function transfers variables from the PLC RAM memory to a given location in the user memory card.

Representation in FBDThe representation in FBD of the WRITE_V_PCMCIA function is as follows:

1 Slot number2 Memory card address3 Number of BYTEs to be write4 Source variable address5 Write status

33002539 10/2019 93

Page 94: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRITE_V_PCMCIA

Representation in LDThe additional parameters EN and ENO can be configured.

The representation in LD of the WRITE_V_PCMCIA function is as follows:

1 Slot number2 Memory card address3 Number of BYTEs to be write4 Source variable address5 Write status

Representation in ILThe representation in IL of the WRITE_V_PCMCIA function is as follows:LD SLOTWRITE_V_PCMCIA SLOT, DEST, NUM, EMIS, CR

Representation in STThe representation in ST of the WRITE_V_PCMCIA function is as follows:WRITE_V_PCMCIA(SLOT, DEST, NUM, EMIS, CR);

94 33002539 10/2019

Page 95: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRITE_V_PCMCIA

Description of the parametersThe following table describes the Input parameters:

The following table describes the Output parameters:

Parameter Type CommentSLOT INT PCMCIA card slot:

0 = upper slot, 1 = lower slot

DEST DINT First address where the variable is written in the memory card.

NUM UDINT Number of BYTEs to write.EMIS ANY First address of the variable in the PLC.

Parameter Type CommentCR INT Code providing the result of the write command's

execution: 0000 hex: write performed correctly 0201 hex: no file zone in the memory card 0202 hex: memory card error 0204 hex: memory card write-protected 0241 hex: DEST < 0 0401 hex: NUM = 0 0402 hex: SLOT is different from 0 and 1 0501 hex: unsupported service

33002539 10/2019 95

Page 96: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRITE_V_PCMCIA

96 33002539 10/2019

Page 97: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertREAD_V_PCMCIA33002539 10/2019

READ_V_PCMCIA: Read Variable from PCMCIA Card

Chapter 21READ_V_PCMCIA: Read Variable from PCMCIA Card

Description

Function descriptionThe READ_V_PCMCIA function transfers variables from the user memory card to the PLC’s RAM.

The additional parameters EN and ENO can be configured.

Representation in FBDRepresentation:

1 Slot number2 Memory card address3 Number of BYTEs to be read4 Destination variable address5 Read status

33002539 10/2019 97

Page 98: EcoStruxure™ Control Expert - System - Block Library - 10/2019

READ_V_PCMCIA

Representation in LDRepresentation:

1 Slot number2 Memory card address3 Number of BYTEs to be read4 Destination variable address5 Read status

Representation in ILRepresentation:LD SLOTREAD_V_PCMCIA SRC, NUM

Representation in STRepresentation:READ_V_PCMCIA(SLOT, SRC, NUM);

98 33002539 10/2019

Page 99: EcoStruxure™ Control Expert - System - Block Library - 10/2019

READ_V_PCMCIA

Description of the parametersThe following table describes the READ_V_PCMCIA Input parameters:

The following table describes the READ_V_PCMCIA Output parameters:

Parameter Type CommentSLOT INT PCMCIA card slot:

0 = upper slot, 1 = lower slot

SRC DINT Source address where the variable is read from the memory card (0...).

NUM UDINT Number of BYTEs to be read. Use the SIZEOF (see EcoStruxure™ Control Expert, Standard, Block Library) function to find this number.

Parameter Type CommentRCPT ANY Destination address of every located or

unlocated variable (DDT).CR INT Code providing the result of the read

command's execution: 0000 hex: read performed correctly 0201 hex: no file zone in the memory card 0202 hex: detected memory card error 0204 hex: memory card write-protected 0241 hex: SRC < 0 0280 hex: NUM input value not consistent

with the RCT output or not consistent with the PCMCIA memory structure

0401 hex: NUM = 0 0402 hex: SLOT is different from 0 and 1 0501 hex: NUM = unsupported service

33002539 10/2019 99

Page 100: EcoStruxure™ Control Expert - System - Block Library - 10/2019

READ_V_PCMCIA

100 33002539 10/2019

Page 101: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertPRJ_VERS33002539 10/2019

PRJ_VERS: Project Version

Chapter 22PRJ_VERS: Project Version

PRJ_VERS: Project Version

Function DescriptionThe PRJ_VERS function allows you to obtain information about the current project open in Control Expert.To access this information in Control Expert:

Step Action1 On the Tools menu, click PLCScreen.

Results: The PLCScreen opens.2 Click on the Information tab.3 On the left side of the PLCScreen, click SYSTEM INFORMATION →

APPLICATION → INFORMATION.Results: Information about the application is displayed on the right side of the PLCScreen.

33002539 10/2019 101

Page 102: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PRJ_VERS

FBD RepresentationThe representation in FBD of the PRJ_VERS function (with example data) is as follows:

NOTE: For an explanation of these parameters, refer to Parameter Descriptions (see page 104).

102 33002539 10/2019

Page 103: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PRJ_VERS

Ladder RepresentationThe representation in LD of the PRJ_VERS function is (with example data) as follows:

IL RepresentationThe representation in IL of the PRJ_VERS function is as follows:

CAL FBI_PRJ_VERS ( OS_VERSION :=> OS_VERSION, UNITY_VERSION := > UNITY_VERSION, LIB_VERSION := > LIB_VERSION, PRJ_NAME := > PRJ_NAME, PRJ_VERSION := > PRJ_VERSION, MAJOR_VERSION :=> MAJOR_VERSION, MINOR_VERSION :=> MINOR_VERSION, BUILD_VERSION :=> BUILD_VERSION, SIGNATURE :=> SIGNATURE, LAST_MODIFIED :=> LAST_MODIFIED, SECOND :=> SECOND, MINUTE :=> MINUTE, HOUR :=> HOUR,

33002539 10/2019 103

Page 104: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PRJ_VERS

DAY :=> DAY, MONTH :=> MONTH, YEAR :=> YEAR )

ST RepresentationThe representation in ST of the PRJ_VERS function is as follows: FBI_PRJ_VERS(OS_VERSION, UNITY_VERSION, LIB_VERSION, PRJ_NAME, PRJ_VERSION, MAJOR_VERSION, MINOR_VERSION, BUILD_VERSION, SIGNATURE, LAST_MODIFIED, SECOND, MINUTE, HOUR, DAY, MONTH, YEAR);

Parameter DescriptionsThe following table describes the PRJ_VERS output parameters:

Parameter Type CommentOS_VERSION INT*100 Processor version

UNITY_VERSION INT*100 Control Expert versionLIB_VERSION INT*100 LibSet VersionPRJ_NAME String[68] Project namePRJ_VERSION UDINT Project versionMAJOR_VERSION INT Project version (major)MINOR_VERSION INT Project version (minor)BUILD_VERSION INT Build versionSIGNATURE UDINT Build signatureLAST_MODIFIED DT Build lastSECOND INT Build version modified (secod)MINUTE INT Build version modified (minute)HOUR INT Build version modified (hour)DAY INT Build version modified (day)MONTH INT Build version modified (month)YEAR INT Build version modified (year)

104 33002539 10/2019

Page 105: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertEvents33002539 10/2019

Events

Part IIIEvents

OverviewThis section describes the elementary functions and elementary function blocks of the Events family.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page23 HALT: Stopping the program 10724 ITCNTRL : Triggering of TIMER type event processing 10925 MASKEVT: Global masking of events 11326 UNMASKEVT: Global unmasking of events 115

33002539 10/2019 105

Page 106: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Events

106 33002539 10/2019

Page 107: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertHALT33002539 10/2019

HALT: Stopping the program

Chapter 23HALT: Stopping the program

Description

Description of the functionThe HALT function in an application program can be used to halt its execution (stop all tasks), which effectively freezes the variable objects of this program.In order for execution to resume, a program halted in this way must be initialized (using the INIT command). The instructions that follow the HALT instruction are therefore not executed.NOTE: When the PLC is in HALT, tasks are stopped (see EcoStruxure™ Control Expert, Operating Modes). Check the behavior of the associated I/Os.The additional parameters EN and ENO can be configured.

FBD representationRepresentation:

LD representationRepresentation:

IL representationRepresentation:HALT

33002539 10/2019 107

Page 108: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HALT

ST representationRepresentation:HALT();

108 33002539 10/2019

Page 109: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertITCNTRL33002539 10/2019

ITCNTRL : Triggering of TIMER type event processing

Chapter 24ITCNTRL : Triggering of TIMER type event processing

Description

Description of the functionThe ITCNTRL function is a timer that triggers the TIMER type event processing (see EcoStruxure™ Control Expert, Program Languages and Structure, Reference Manual) selected by the EVENT input, when the current value reaches the preset value.

The preset and time base values are selected in the event processing properties dialog box (see EcoStruxure™ Control Expert, Operating Modes).NOTE: TIMER event processing are not available on all PLCs, see the available functions for Each Type of PLC (see EcoStruxure™ Control Expert, Program Languages and Structure, Reference Manual). Additional parameters EN and ENO can be configured.

Representation in FBDRepresentation:

33002539 10/2019 109

Page 110: EcoStruxure™ Control Expert - System - Block Library - 10/2019

ITCNTRL

Representation in LDRepresentation:

Representation in ILRepresentation:LD EnableITCNTRL Reset_Timer, Hold_Timer, Nb_task_Event , Status_Timer, Current_Value

Representation in STRepresentation:ITCNTRL(ENABLE := Enable_Timer, RESET := Reset_Timer, HOLD := Hold_Timer, EVENT := Nb_Task_Event, STATUS => Status_Timer, VALUE => Current_Value);

110 33002539 10/2019

Page 111: EcoStruxure™ Control Expert - System - Block Library - 10/2019

ITCNTRL

Description of the parametersThe following table describes the input parameters:

The following table describes the output parameters:

Parameter Type CommentEnable BOOL Enable input selected,.

on state 1: the event processing is triggered when the timer has elapsed. on state 0: no event is emitted

Reset_Timer BOOL On state 1 reset the timerHold_Timer BOOL On state 1 freeze the timer incrementation. Nb_Task_Event BYTE Input word which determines the TIMER event

processing number to be triggered.

Parameter Type CommentStatus_Timer WORD Status word:

bit0 = 1 execution delayed by a masking of the interruption.

bit 1 =1 event processing number not valid bit 2 = 1 validated timer (Enable input image). bit 3 = 1 "frozen" timer (Hold_Timer input

image). bit 4 =1 as soon as ITCNTRL is called the first

time with the input Reset_Timer or Hold_Timer at 1 (out-of-phase mode). It is reset to 0 on a cold start.

bit 5 = 1 FIFO memory stack of the saturated interruptions.

Current_Value TIME Current timer value.This value is increased by 0 to the preset value. When the preset value is reached, it is reset to 0. If the associated TIMER type event processing is confirmed, it is executed.

33002539 10/2019 111

Page 112: EcoStruxure™ Control Expert - System - Block Library - 10/2019

ITCNTRL

112 33002539 10/2019

Page 113: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertMASKEVT33002539 10/2019

MASKEVT: Global masking of events

Chapter 25MASKEVT: Global masking of events

Description

Description of the functionThe MASKEVT function performs global masking of events (1).

Events are stored in the PLC's memory, but any associated event processing tasks remain inactive, as long as the masking operation is valid, until the next UNMASKEVT instruction.

NOTE: It is recommended to use this instruction only for short masking sequence, in the same task cycle. In other cases, %S38 should be used. Events are automatically unmasked by the system on change of mode (stop -> run, ...). It is not recommended to execute masking sequences when event timers are active, because they will be reset to 0.The additional parameters EN and ENO can be configured.

(1) except for interruptions generated by FIPWAY telegrams.

FBD representationRepresentation:

LD representationRepresentation:

IL representationRepresentation:MASKEVT

33002539 10/2019 113

Page 114: EcoStruxure™ Control Expert - System - Block Library - 10/2019

MASKEVT

ST representationRepresentation:MASKEVT();

114 33002539 10/2019

Page 115: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertUNMASKEVT33002539 10/2019

UNMASKEVT: Global unmasking of events

Chapter 26UNMASKEVT: Global unmasking of events

Description

Description of the functionThe UNMASKEVT function performs global unmasking of events.

The events that were stored during the masking period are processed. The event processing mechanism is operational until the next MASKEVT instruction.

NOTE: It is recommended to use this instruction only for short masking sequence, in the same task cycle. In other cases, %S38 should be used. Events are automatically unmasked by the system on change of mode (stop -> run, ...). It is not recommended to execute masking sequences when event timers are active, because they will be reset to 0.The additional parameters EN and ENO can be configured.

FBD representationRepresentation:

LD representationRepresentation:

IL representationRepresentation:UNMASKEVT

33002539 10/2019 115

Page 116: EcoStruxure™ Control Expert - System - Block Library - 10/2019

UNMASKEVT

ST representationRepresentation:UNMASKEVT();

116 33002539 10/2019

Page 117: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertHot Stand By33002539 10/2019

Hot Stand By

Part IVHot Stand By

OverviewThis section describes the elementary functions and elementary function blocks of the Hot Stand By family.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page27 HSBY_BUILD_OFFLINE: Allowed Build Offline Mismatch 11928 HSBY_RD: Reading the Hot Standby command register 12129 HSBY_ST: Reading the Hot Standby status register 12530 HSBY_SWAP: Initiate the swapping between primary and standby CPU 12931 HSBY_WR: Writing to the Hot Standby command register 13532 REV_XFER: Writing and reading the two Reverse-Transfer-Registers 139

33002539 10/2019 117

Page 118: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Hot Stand By

118 33002539 10/2019

Page 119: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertHSBY_BUILD_OFFLINE33002539 10/2019

HSBY_BUILD_OFFLINE: Allowed Build Offline Mismatch

Chapter 27HSBY_BUILD_OFFLINE: Allowed Build Offline Mismatch

HSBY_BUILD_OFFLINE

Function DescriptionThe HSBY_BUILD_OFFLINE function block is used to make offline modifications to an application program in a Modicon M580 Hot Standby system. The function block allows or not a build offline mismatch.The additional parameters EN and ENO may also be configured.

NOTE: Refer to the Modicon M580 Hot Standby documentation for more information on offline application modification with allowed build offline mismatch (see Modicon M580 Hot Standby, System Planning Guide for, Frequently Used Architectures).NOTE: HSBY_BUILD_OFFLINE function is available on CPUs with OS firmware V2.15 or later.

FBD RepresentationRepresentation:

LD RepresentationRepresentation:

33002539 10/2019 119

Page 120: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_BUILD_OFFLINE

IL RepresentationRepresentation:CAL HSBY_BUILD_OFFLINE_Instance (ALLOW_MISMATCH:=Allow_Mismatch, STATUS=>Status)

ST RepresentationRepresentation:HSBY_BUILD_OFFLINE_Instance (ALLOW_MISMATCH:=Allow_Mismatch, STATUS=>Status)

Description of ParametersThe following table describes the input parameter:

The following table describes the output parameter:

Optional ENO parameter description:

Parameter Type CommentAllow_Mismatch BOOL Parameter description:

1: Allow a build offline mismatch.0: Do not allow a build offline mismatch.

Parameter Type CommentStatus WORD Status report:

0000 hex Operation processed successfully.0001 hex: The EFB version is not compatible with the CPU

firmware version.0002 hex: The application is not a Hot Standby application.

ENO Value Description

1 Operation processed successfully.Status output parameter equals 0.

0 Operation not processed.Status output parameter is not equal to 0 as described in previous output parameter table.

120 33002539 10/2019

Page 121: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertHSBY_RD33002539 10/2019

HSBY_RD: Reading the Hot Standby command register

Chapter 28HSBY_RD: Reading the Hot Standby command register

HSBY_RD

Function DescriptionThis EFB allows you to use the Hot Standby function. It searches (together with the other Hot Standby EFBs) the configuration of the respective Quantum PLC for the required components. These components refer to hardware that is actually connected. Therefore, the correct behavior of this EFB on the simulators cannot be guaranteed.The HSBY_RD EFB checks system word %SW60 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) to see if a Hot Standby configuration exists: If a Hot Standby configuration is present the contents of the command register are returned and

the HSBY_ConfigurationFound output parameter is set to 1. If a Hot Standby configuration is not present the contents of the command register are returned

and the HSBY_ConfigurationFound output parameter is set to 0.

EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation:

33002539 10/2019 121

Page 122: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_RD

Representation in LDRepresentation:

Representation in ILRepresentation:CAL HSBY_RD_Instance (HSBY=>HSBY_ConfigurationFound, INV_KEY=>InvalidateKeypad, PCA_RUN=>PLC_A_Running, PCB_RUN=>PLC_B_Running, SBY_OFF=>StandbyOff, EXC_UPD=>ExecUpdate, SWP_MB1=>SwapAddressModbusPort1)

Representation in STRepresentation:HSBY_RD_Instance (HSBY=>HSBY_ConfigurationFound, INV_KEY=>InvalidateKeypad, PCA_RUN=>PLC_A_Running, PCB_RUN=>PLC_B_Running, SBY_OFF=>StandbyOff, EXC_UPD=>ExecUpdate, SWP_MB1=>SwapAddressModbusPort1);

122 33002539 10/2019

Page 123: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_RD

Parameter DescriptionsDescription of the output parameters:

Parameter Data type MeaningHSBY BOOL 1 = Hot Standby configuration found

0 = Hot Standby configuration not foundINV_KEY BOOL 1 = The submenu for the Hot Standby PLC button is

disabled.0 = The submenu for the Hot Standby PLC button is not disabled.

PCA_RUN BOOL For the local rack PLC with the Hot Standby CPU A:1 = Command Register is selected for RUN0 = Command Register is selected for OFFLINE

PCB_RUN BOOL For the local rack PLC with the Hot Standby CPU B:1 = Command Register is selected for RUN0 = Command Register is selected for OFFLINE

SBY_OFF BOOL 1 = ???0 = The Standby PLC switches to the OFFLINE mode as soon as both PLCs receive a different program.

EXC_UPD BOOL 1 = Operating System update in the Standby-PLC is possible with the primary CPU PLC still running. 0 = ???(After Operating System Update, the Standby CPU PLC changes back to the ONLINE mode.)

SWP_MB1 BOOL If a switchover has occurred, for Modbus ports 1:1 = There is no swapping of addresses0 = There is swapping of address

SWP_MB2 BOOL Not used. ReservedSWP_MB3 BOOL Not used. Reserved

33002539 10/2019 123

Page 124: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_RD

124 33002539 10/2019

Page 125: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertHSBY_ST33002539 10/2019

HSBY_ST: Reading the Hot Standby status register

Chapter 29HSBY_ST: Reading the Hot Standby status register

HSBY_ST

Function DescriptionThis EFB allows you to use the Hot Standby function. It searches (together with the other Hot Standby EFBs) the configuration of the respective Quantum PLC for the required components. These components refer to hardware that is actually connected. Therefore, the correct behavior of this EFB on the simulators cannot be guaranteed.This EFB is used to read the IEC Hot Standby status register %SW61 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual). If there is no Hot Standby configuration present, the HSBY output is set to 0.

EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation:

33002539 10/2019 125

Page 126: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_ST

Representation in LDRepresentation:

Representation in ILRepresentation:CAL HSBY_ST_Instance (HSBY=>HSBY_ConfigurationFound, THIS_OFF=>PLC_Offline, THIS_PRY=>Primary_PLC, THIS_SBY=>Standby_PLC, REMT_OFF=>Remote_PLC_Offline, REMT_PRY=>PrimaryRemote_PLC, REMT_SBY=>StandbyRemote_PLC, LOGIC_OK=>IdenticalPrograms, THIS_ISA=>HSBY_ModuleSwitchA, THIS_ISB=>HSBY_ModuleSwitchB)

126 33002539 10/2019

Page 127: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_ST

Representation in STRepresentation:HSBY_ST_Instance (HSBY=>HSBY_ConfigurationFound, THIS_OFF=>PLC_Offline, THIS_PRY=>Primary_PLC, THIS_SBY=>Standby_PLC, REMT_OFF=>Remote_PLC_Offline, REMT_PRY=>PrimaryRemote_PLC, REMT_SBY=>StandbyRemote_PLC, LOGIC_OK=>IdenticalPrograms, THIS_ISA=>HSBY_ModuleSwitchA, THIS_ISB=>HSBY_ModuleSwitchB);

Parameter DescriptionsDescription of output parameters:

Parameter Data type MeaningHSBY BOOL 1 = Hot Standby configuration found

0 = Hot Standby configuration not foundTHIS_OFF BOOL 1 = This PLC is offline

0 = This PLC is not offlineTHIS_PRY BOOL 1 = This PLC is the Primary CPU PLC

0 = This PLC is not the Primary CPU PLCTHIS_SBY BOOL 1 = This PLC is the Standby CPU PLC

0 = This PLC is not the Standby CPU PLCREMT_OFF BOOL 1 = The other (remote) PLC is OFFLINE

0 = The other (remote) PLC is not OFFLINEREMT_PRY BOOL 1 = The other PLC is the Primary CPU PLC

0 = The other PLC is not the Primary CPU PLCREMT_SBY BOOL 1 = The other PLC is the Standby CPU PLC

0 = The other PLC is not the Standby CPU PLCLOGIC_OK BOOL 1 = The programs for both PLCs are identical and

application mismatch is active.0 = The programs are not the identical.

THIS_ISA BOOL 1 = This PLC chose the CPU with the lower IP address between both Hot Standby CPUs. This is the Hot Standby CPU A.0 = This is not CPU A.

THIS_ISB BOOL 1 = This PLC chose the CPU with the higher IP address between both Hot Standby CPUs. This is the Hot Standby CPU B.0 = This is not CPU B.

33002539 10/2019 127

Page 128: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_ST

128 33002539 10/2019

Page 129: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertHSBY_SWAP33002539 10/2019

HSBY_SWAP: Initiate the swapping between primary and standby CPU

Chapter 30HSBY_SWAP: Initiate the swapping between primary and standby CPU

Using the Hot Standby system with the HSBY_SWAP DFB

Function DescriptionThe HSBY_SWAP function block is used to initiate the swapping between primary and standby CPU.

EN and ENO can be configured as additional parameters.

This function block is convenient to be used to activate a swap by program logic. This swap between primary and standby CPU can be performed in the Hot Standby mode only.Please refer to: the Premium using EcoStruxure™ Control Expert, Hot Standby, User Manual for information

regarding Premium hot standby CPUs.the Quantum using EcoStruxure™ Control Expert, Hot Standby System, User Manual for information regarding Quantum hot standby CPUs.

This means that when the HSBY is running, the standby PLC becomes the primary PLC, and the old primary PLC becomes the standby PLC activated by the program logic. NOTE: It is not mandatory to use this function for performing a hot standby swap. Indeed, you may rely on register %SW60, as described in the Conditions for Switchover (see Premium using EcoStruxure™ Control Expert, Hot Standby, User Manual) for Premium or in the Conditions for Switchover (see Quantum using EcoStruxure™ Control Expert, Hot Standby System, User Manual) for Quantum.NOTE: The DFB should not be used in the first section of the application.

Advantages of the Swapping FunctionThe advantages of swapping could be the following: The health of the standby PLC is monitored. It is checked that the standby PLC can take over. The switchover could be tested at regular intervals.

WARNINGUNEXPECTED EQUIPMENT OPERATIONThe HSBY_SWAP DFB must be called for the purpose of testing the application only.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 129

Page 130: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_SWAP

Example of a Hot Standby ApplicationThe illustration below shows an example of a hot standby application:

Steps for Changing StatusA Hot Standby swapping function is processed as follows:

Step Action1 Status: PLC-A is the primary controller, PLC-B is the standby controller.

PLC-A sets itself to offline.Result:PLC-B becomes the primary controller.

2 Status: PLC-A is offline, PLC-B is the primary controller.PLC-B sets PLC-A to run-modeResult:PLC-A is the standby controller.

3 Status: PLC-A is the standby controller, PLC-B is the primary controller.EFB outputs will be set.Result:Hot Standby swapping function is completed.

130 33002539 10/2019

Page 131: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_SWAP

Representation in FBDRepresentation

Representation in LDRepresentation

33002539 10/2019 131

Page 132: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_SWAP

Parameter DescriptionDescription of the input parameter

Description of output parameters

Error Status TableThe following table explains the error codes:

NOTE: The system words %SW60 and %SW61 reflect the status of the primary and the secondary PLC.

Parameter Data Type MeaningSTART BOOL START = 1 starts the HSBY_SWAP operation.

The value of 1 must be applied until the operation has finished or until an error has occurred.

Parameter Data Type MeaningACTIVE BOOL ACTIVE = 1 indicates that an HSBY_SWAP operation is in

progress.DONE BOOL DONE = 1 indicates that the HSBY_SWAP operation has been

completed successfully.ERROR BOOL ERROR = 1 indicates that an error has occurred, or that the

current HSBY_SWAP operation has been aborted.STATUS INT An error code (STATUS) is generated by the HSBY_SWAP block.

A complete list is shown in the error code table.

Error Codes Fault Description0 OK1 The function HSBY_SWAP has been aborted.

2 Hot Standby not activated (%SW61.15=0).

3 Standby does not exist.5 The swap was unsuccessful.

132 33002539 10/2019

Page 133: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_SWAP

Switchover Using Command Register System Bit %SW60.1 or %SW60.2Another way of forcing a switchover is setting the bits in the Command Register. To achieve this, do the following:

Step Action1 Open file 1.2 Connect to the primary,3 Ensure the controller order of the primary is A or B.4 Access

Command Register system bit %SW60.1If the connected controller order is A.

Command Register system bit %SW60.2If the connected controller order is B.

5 Set bit to 0.

NOTE: Ensure that the standby switched to primary.

6 Open file 2.7 Connect to the new primary controller.8 Access the Command Register system bit used in step 4.9 Set bit to 1.

NOTE: Ensure that the standby controller is now online.

10 Ensure both primary and standby controllers are in Run Primary and in Run Standby mode.

33002539 10/2019 133

Page 134: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_SWAP

134 33002539 10/2019

Page 135: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertHSBY_WR33002539 10/2019

HSBY_WR: Writing to the Hot Standby command register

Chapter 31HSBY_WR: Writing to the Hot Standby command register

HSBY_WR

Function DescriptionThis EFB allows you to use the Hot Standby function. It searches (together with the other Hot Standby Fibs) the configuration of the respective Quantum PLC for the required components. These components refer to hardware that is actually connected. Therefore, the correct behavior of this EFB on the simulators cannot be guaranteed.HSBY_WR is used to set different Hot Standby Modes for the Primary CPU. Setting the respective modes means changing the Hot Standby Command register %SW60 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual), which is carried out automatically by the function block. If there is no Hot Standby configuration, the HSBY_ConfigurationFound output is set to 0, otherwise it is set to 1.EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation:

33002539 10/2019 135

Page 136: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_WR

Representation in LDRepresentation:

Representation in ILRepresentation:CAL HSBY_WR_Instance (INV_KEY:=InvalidateKeypad, PCA_RUN:=PLC_A_Running, PCB_RUN:=PLC_B_Running, SWP_MB1:=SwapAddressModbusPort1, HSBY=>HSBY_ConfigurationFound)

Representation in STRepresentation:HSBY_WR_Instance (INV_KEY:=InvalidateKeypad, PCA_RUN:=PLC_A_Running, PCB_RUN:=PLC_B_Running, SWP_MB1:=SwapAddressModbusPort1, HSBY=>HSBY_ConfigurationFound);

136 33002539 10/2019

Page 137: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_WR

Parameter DescriptionDescription of the input parameters:

Description of the output parameters:

Parameter Data type Meaning INV_KEY BOOL In the submenu for the Hot Standby PLC button:

1 = Changes are not allowed.0 = Changes are allowed.

PCA_RUN BOOL If 1 -> 0, then the Hot Standby ‘A’ CPU on the local rack is forced into OFFLINE mode.If 0 -> 1 and its button mode is in RUN mode, then the Hot Standby ‘A’ CPU is forced into the RUN mode.

PCB_RUN BOOL If 1 -> 0, then the Hot Standby ‘B’ CPU on the local rack is forced into OFFLINE mode.If 0 -> 1 and its button mode is in RUN mode, then the Hot Standby ‘B’ CPU is forced into the RUN mode.

SWP MB1 BOOL If 0 and there is a Switchover, then the Modbus address on port 1 of the NEW Primary CPU PLC changes: New Primary CPU PLC address = old Primary

CPU address New Standby CPU PLC address = new Primary

CPU address + 128.If 1 and there is a Switchover, then the Modbus address on Port 1 of the PLC does not change: New Primary CPU PLC address = old Standby

CPU address New Standby CPU PLC address = old Primary

CPU addressSWP_MB2 BOOL Not used. Reserved

SWP MB3 BOOL Not used. Reserved

Parameter Data type Meaning HSBY BOOL 1 = Hot Standby configuration found.

0 = Hot Standby configuration not found.

33002539 10/2019 137

Page 138: EcoStruxure™ Control Expert - System - Block Library - 10/2019

HSBY_WR

138 33002539 10/2019

Page 139: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertREV_XFER33002539 10/2019

REV_XFER: Writing and reading the two Reverse-Transfer-Registers

Chapter 32REV_XFER: Writing and reading the two Reverse-Transfer-Registers

REV_XFER

Function DescriptionThis EFB allows you to use the Hot Standby function. It searches (together with the other Hot Standby EFBs) the configuration of the respective Quantum PLCs for the required components. These components refer to hardware that is actually connected.REV_XFER provides the ability to transmit 2 registers (%SW62/63) from the Standby PLC to the Primary PLC. The two registers EFB are used by the application program (in the first section) to register diagnostic information.REV_XFER can only be used in the first executable section of the project. The parameter addresses TO_REV1 and TO_REV2 have to be in the Non-Transfer Area to prevent being overwritten by the Primary CPU.NOTE: Take care that, if the PLC is in Offline mode, the reverse transfer will not transfer the data because the Hot Standby condition is no longer valid. As additional parameters, EN and ENO are projected.

Appearance in FBDAppearance:

33002539 10/2019 139

Page 140: EcoStruxure™ Control Expert - System - Block Library - 10/2019

REV_XFER

Appearance in LDAppearance:

Appearance in ILAppearance:CAL REV_XFER_Instance (TO_REV1:=Standby_PLC_FirstReg, TO_REV2:=Standby_PLC_SecondReg, HSBY=>HSBY_ConfFlag, PRY=>Primary_PLC_Flag, SBY=>Standby_PLC_Flag, FR_REV1=>FirstRevTransReg, FR_REV2=>SecondtRevTransReg)

Appearance in STAppearance:REV_XFER_Instance (TO_REV1:=Standby_PLC_FirstReg, TO_REV2:=Standby_PLC_SecondReg, HSBY=>HSBY_ConfFlag, PRY=>Primary_PLC_Flag, SBY=>Standby_PLC_Flag, FR_REV1=>FirstRevTransReg, FR_REV2=>SecondtRevTransReg);

140 33002539 10/2019

Page 141: EcoStruxure™ Control Expert - System - Block Library - 10/2019

REV_XFER

Parameter DescriptionDescription of input parameters:

Description of the output parameters:

Parameter Data type DescriptionTO_REV1 INT Describes the first reverse transfer register if this

PLC is the Standby PLC. Data in this register are transferred from the Standby CPU to the Primary CPU at each scan.

TO_REV2 INT Describes the second reverse transfer register if this PLC is the Standby CPU. Data in this register are transferred from the Standby CPU to the Primary CPU at each scan.

Parameter Data type DescriptionHSBY BOOL 1 = This is a Hot Standby configuration.

0 = This is not a Hot Standby configuration.PRY BOOL 1 = This PLC is the Primary CPU PLC.

0 = This PLC is not the Primary CPU PLC.SBY BOOL 1 = This PLC is the Standby CPU PLC.

1 = This PLC is not the Standby CPU PLC.FR_REV1 INT Content of first reverse transfer register %SW62

(see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual). Output only if HSBY is 1.

FR_REV2 INT Content of second reverse transfer register %SW63 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual). Output only if HSBY is 1.

33002539 10/2019 141

Page 142: EcoStruxure™ Control Expert - System - Block Library - 10/2019

REV_XFER

142 33002539 10/2019

Page 143: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertPower Supply Maintenance33002539 10/2019

Power Supply Maintenance

Part VPower Supply Maintenance

IntroductionThe advanced diagnostics for redundant power supplies use a specific protocol for power supplies installed in a main rack with an Ethernet backplane.These function blocks are used for redundant power supplies that are located: Within a Modicon M580 configuration. In a main rack. Therefore they do not apply to power supplies located in an extension rack (using

a BMXXBE•••• extender module). In a dedicated BMEXBP••02 rack.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page33 PWS_DIAG: Redundant Power Supply Diagnostics 14534 PWS_CMD: Redundant Power Supply Control 153

33002539 10/2019 143

Page 144: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Power Supply Maintenance

144 33002539 10/2019

Page 145: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertPWS_DIAG33002539 10/2019

PWS_DIAG: Redundant Power Supply Diagnostics

Chapter 33PWS_DIAG: Redundant Power Supply Diagnostics

Description

Description of the FunctionThe PWS_DIAG function block is used to read the status of redundant power supplies (see Modicon X80, Racks and Power Supplies, Hardware Reference Manual) in a Modicon M580 PAC main rack with an Ethernet backplane (local or remote rack, other connected Modicon M580 PAC).The power supply status is interpreted with the PWS_DIAG_DDT (see page 149) or PWS_DIAG_DDT_V2 DDT type.The additional parameters EN and ENO may also be configured.

NOTE: Redundant power supplies function is available on CPUs with OS firmware V2.12 or later, and BMECRA31210 communication adapters with firmware V2.16 or later.

FBD RepresentationRepresentation:

33002539 10/2019 145

Page 146: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_DIAG

LD RepresentationRepresentation:

IL RepresentationRepresentation:CAL PWS_DIAG_Instance (ENABLE:=Enable, ABORT:=Abort, IP_ADDRESS:=IP_Address, DONE=>OperationSuccessful, ACTIVE=>OperationActiv, ERROR=>FaultyOperation, STATUS=>ErrorCode, LEFT_PWS=>LeftPwsDiagnostics, RIGHT_PWS=>RightPwsDiagnostics)

ST RepresentationRepresentation:PWS_DIAG_Instance (ENABLE:=Enable, ABORT:=Abort, IP_ADDRESS:=IP_Address, DONE=>OperationSuccessful, ACTIVE=>OperationActiv, ERROR=>FaultyOp-eration, STATUS=>ErrorCode, LEFT_PWS=>LeftPwsDiagnostics, RIGHT_PWS=>RightPwsDiagnostics);

146 33002539 10/2019

Page 147: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_DIAG

Description of ParametersThe following table describes the input parameters:

The following table describes the output parameters:

Parameter Type CommentEnable BOOL Set to 1 to diagnose the status of a power supply.Abort BOOL Set to 1 to abort the current operation.IP_Address STRING The IP_Address parameter value depends on the location of

the redundant power supplies to diagnose:In the local rack of the CPU: Leave the parameter empty, or

use a variable with an empty string, or enter the CPU IP address.

In a distant rack: Enter the IP address of the communication adapter of the rack that contains the power supply module to diagnose.Example of IP address: 192.168.10.5 or 192.168.010.005

Parameter Type CommentOperationSuccessful BOOL Operation completed indication. Set to 1 when the execution of

the operation is completed successfully.OperationActiv BOOL Operation in progress indication. Set to 1 when the execution of

the operation is in progress.FaultyOperation BOOL Set to 1 if an error is detected by the function block.ErrorCode WORD Code providing the detected error identification (see page 301).LeftPwsDiagnostics PWS_DIAG_DDT

orPWS_DIAG_DDT_V2

Diagnostic data (see page 149) for the power supply located on the left side of the rack (CPS1 marking on the rack).

RightPwsDiagnostics PWS_DIAG_DDTorPWS_DIAG_DDT_V2

Diagnostic data (see page 149) for the power supply located on the right side of the rack (CPS2 marking on the rack).

33002539 10/2019 147

Page 148: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_DIAG

Terminology Used in PWS_DIAG_DDT or PWS_DIAG_DDT_V2 Type and Power Supply ConcernedRedundant power supplies representation in a rack:

CPS1: Left-most power supply marking on the rack.CPS2: Right-most power supply marking on the rack.

Description of the power supply concerned by the State field bits of the function block output parameters:

NOTE: The power supply (Pws••• field or bit) is the one that currently provides the diagnostic data that appear in the structure. The other power supply (OtherPws••• bit) is the second power supply located on the same backplane that communicates some of its diagnostic data to the power supply currently diagnosed.

Parameter PWS_DIAG_DDT or PWS_DIAG_DDT_V2 Field

Bits of the State Field Concerned Power Supply

LeftPwsDiagnostics State Bits 0...4(Pws•••)

CPS1(left-most power supply)

Bits 5...7(OtherPws•••)

CPS2(right-most power supply)

RightPwsDiagnostics State Bits 0...4(Pws•••)

CPS2(right-most power supply)

Bits 5...7(OtherPws•••)

CPS1(left-most power supply)

148 33002539 10/2019

Page 149: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_DIAG

Description of PWS_DIAG_DDT and PWS_DIAG_DDT_V2 TypeDetailed description of PWS_DIAG_DDT and PWS_DIAG_DDT_V2 structures:

Field Size ValuePwsMajorVersion 1 BYTE Power supply major firmware version.PwsMinorVersion 1 BYTE Power supply minor firmware version.Model 1 BYTE Model identifier.

State (1 BYTE) Bit 0 PwsDiagOperating mode of the power supply: 0: Normal mode. 1: Diagnostic ongoing.

NOTE: The diagnostics occurs when the power supply performs an auto-test every 10 hours of cumulated operating time.

State (continued) Bit 1 PwsDefectStatus of the power supply: 0: Healthy. 1: At least one defect detected (minor or major). Possible cause if an under voltage is detected: internal defect

detected, or over current. Possible cause if an over current is detected: internal defect

detected, or too many modules on the configuration, or any module defect detected, or backplane defect detected, or module hot-plugged.

State (continued) Bit 2 PwsModeRole of the power supply: 0: Slave (ready to provide full power to the rack). 1: Master (currently providing full power to the rack).

State (continued) Bit 3 PwsPositionPosition of the power supply: 0: Left side of the rack (CPS1). 1: Right side of the rack (CPS2).

State (continued) Bit 4 PwsDefectVoltageMajor status of the power supply: 0: Healthy. 1: Detected a major defect on output voltage that generates a role swap

(the power supply role changed from master to slave, or the power supply remains slave).NOTE: When this bit is set, PwsDefect (Bit 1) is also set.

33002539 10/2019 149

Page 150: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_DIAG

State (continued) Bit 5 OtherPwsDefectVoltageMajor status of the other power supply: 0: Healthy or no communication with the other power supply. 1: Detected a major defect on output voltage that generates a role swap

(the power supply role changed from slave to master, or the power supply remains master).NOTE: When this bit is set, OtherPwsDefect (Bit 7) is also set.

State (continued) Bit 6 OtherPwsComOKCommunication of the diagnosed power supply with the other power supply: 0: No communication. 1: Communication established.

State (continued) Bit 7 OtherPwsDefectStatus of the other power supply: 0: Healthy or no communication with the other power supply. 1: At least one defect detected (minor or major). Possible cause if an under voltage is detected: internal defect

detected, or over current. Possible cause if an over current is detected: internal defect

detected, or too many modules on the configuration, or any module defect detected, or backplane defect detected, or module hot-plugged.

I33BacPos 1 UINT Current drawn on the 3.3 Vdc (see Modicon X80, Racks and Power Supplies, Hardware Reference Manual) power supply internally and delivered to the rack as a producer (unit: mA, accuracy: +/-5%, value range: 20...4500 mA).The master delivers current to the rack, the slave does not deliver current to the rack.

V33Buck 1 UINT Voltage measured on the 3.3 Vdc (see Modicon X80, Racks and Power Supplies, Hardware Reference Manual) power supply output (unit: mV, accuracy: +/-2%, value range: 3238...3471 mV).

NOTE: On a master power supply, the voltage on the output corresponds to the rack voltage. On a slave, the voltage on the output represents the voltage that can be applied to the rack if it becomes a master.

I24Bac 1 UINT Current drawn on the 24 Vdc (see Modicon X80, Racks and Power Supplies, Hardware Reference Manual) power supply internally and delivered to the rack as a producer (unit: mA, accuracy: +/-5%, value range: 36...1750 mA). The master delivers current to the rack, the slave does not deliver current to the rack.

Field Size Value

150 33002539 10/2019

Page 151: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_DIAG

V24Int 1 UINT Voltage measured on the 24 Vdc (see Modicon X80, Racks and Power Supplies, Hardware Reference Manual) power supply output (unit: mV, accuracy: +/-2%, value range: 23512...24593 mV).

NOTE: On a master power supply, the voltage on the output corresponds to the rack voltage. On a slave, the voltage on the output represents the voltage that can be applied to the rack if it becomes a master.

Temperature 1 INT Internal power supply temperature measured (unit: °C, accuracy: +/-1%).OperTimeMasterSincePO 1 UDINT Operating time as master since last power on (unit: s).OperTimeSlaveSincePO 1 UDINT Operating time as slave since last power on (unit: s).OperTimeMaster 1 UDINT Operating time as master since manufacturing (unit: s).OperTimeSlave 1 UDINT Operating time as slave since manufacturing (unit: s).Work 1 UDINT Energy delivered by the power supply since manufacturing (unit: mWh).RemainingLTPC 1 UINT Estimated remaining life time in percent.

The estimated remaining life time value represents the wear of some components in the power supply. This value is a theoretical estimation based on an algorithm that integrates several parameters such as working temperature, up-time, power consumption, and so on. When this value reaches 0% the power supply may still be working perfectly, but there is a high likelihood that a hardware defect occurs soon.

NOTE: When the estimated remaining life time reaches 0, there is no automatic swap (the power supply is used as long as it delivers the requested current and voltages).

RemainingLTMO 1 UINT Estimated remaining life time in months.

NOTE: Only available in the PWS_DIAG_DDT_V2 structure, RemainingLTMO refers to the same value as RemainingLTPC but converted in months (see above).

NbPowerOn 1 UINT Number of power-on since manufacturing or since last clear command with PWS_CMD (see page 153).

NbUnderVoltageLow 1 UINT Number of under voltage detected below low threshold (94 Vac +/-5%) on primary voltage since manufacturing or since last clear command with PWS_CMD (see page 153).

NbUnderVoltageHigh 1 UINT Number of under voltage detected below high threshold (194 Vac +/-5%) on primary voltage since manufacturing or since last clear command with PWS_CMD (see page 153).

Field Size Value

33002539 10/2019 151

Page 152: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_DIAG

152 33002539 10/2019

Page 153: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertPWS_CMD33002539 10/2019

PWS_CMD: Redundant Power Supply Control

Chapter 34PWS_CMD: Redundant Power Supply Control

Description

Description of the FunctionThe PWS_CMD function block is used to control redundant power supplies (see Modicon X80, Racks and Power Supplies, Hardware Reference Manual) in a Modicon M580 PAC main rack with an Ethernet backplane (local or remote rack, other connected Modicon M580 PAC).PWS_CMD function block provides the following command: Swap master and slave power supplies. Clear some diagnostic counters. Start a power supply auto-diagnostic.The power supply command is built with the PWS_CMD_DDT (see page 156) DDT type.The additional parameters EN and ENO may also be configured.

NOTE: Redundant power supplies function is available on CPUs with OS firmware V2.12 or later, and BMECRA31210 communication adapters with firmware V2.16 or later.

FBD RepresentationRepresentation:

33002539 10/2019 153

Page 154: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_CMD

LD RepresentationRepresentation:

IL RepresentationRepresentation:CAL PWS_CMD_Instance (ENABLE:=Enable, ABORT:=Abort, IP_ADDRESS:=IP_Address, CMD:=Command, DONE=>OperationSuccessful, ACTIVE=>OperationActiv, ERROR=>FaultyOperation, STATUS=>ErrorCode, DATA=>Data)

ST RepresentationRepresentation:PWS_CMD_Instance (ENABLE:=Enable, ABORT:=Abort, IP_ADDRESS:=IP_Address, CMD:=Command, DONE=>OperationSuccessful, ACTIVE=>OperationActiv, ERROR=>FaultyOperation, STATUS=>ErrorCode, DATA=>Data);

154 33002539 10/2019

Page 155: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_CMD

Description of ParametersThe following table describes the input parameters:

The following table describes the output parameters:

Parameter Type CommentEnable BOOL Set to 1 to send a command to a power supply.Abort BOOL Set to 1 to abort the current operation.IP_Address STRING The IP_Address parameter value depends on the location of

the redundant power supplies to control:In the local rack of the CPU: Leave the parameter empty or use

a variable with an empty string, or enter the CPU IP address.In a distant rack: Enter the IP address of the communication

adapter of the rack that contains the power supply module to control.Example of IP address: 192.168.10.5 or 192.168.010.005

Command PWS_CMD_DDT Command data (see page 156) for the power supply to control.

Parameter Type CommentOperationSuccessful BOOL Operation completed indication.

Set to 1 when the execution of the operation is completed successfully.

OperationActiv BOOL Operation in progress indication.Set to 1 when the execution of the operation is in progress.

FaultyOperation BOOL Set to 1 if an error is detected by the function block.ErrorCode WORD Code providing the detected error identification (see page 301).Data ANY Data needs to be declared (as a simple UINT for example), but

it remains empty.

33002539 10/2019 155

Page 156: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PWS_CMD

Description of PWS_CMD_DDT TypeDetailed description of PWS_CMD_DDT structure:

Field Size ValueCode 1 BYTE Command code:

1: Swap power supply role. NOTE: Both power supplies need to be set as target (PwsTarget = 3) to apply the swap command.

2: Reserved.3: Clear power supply diagnostic counters.

The following counters are cleared: NbPowerOn NbUnderVoltageLow NbUnderVoltageHighNOTE: This command applies to the power supply selected in the target (PwsTarget).

4: Start power supply auto-diagnostic.This command triggers a sequence during which the slave power supply checks its capability to deliver the required current to the rack: During this sequence: The slave power supply temporarily delivers

the power on the rack and PwsDiag bit is set to 1.If a failure is detected on the output voltage: PwsDefect and PwsDefectVoltage bits are set to 1 and maintained until the slave power supply is power-cycled or replaced.

After this sequence: The master power supply plays its role again and provides full power to the rack.

NOTE: Both power supplies need to be set as target (PwsTarget = 3) to apply the auto-diagnostic command.

NOTE: Use this command punctually to apply the auto-diagnostic once. If a frequent status is needed, use this command once every minute for example. Do not send this command permanently because it may maintain the power supplies in a swap sequence.

PwsTarget 1 BYTE Targeted power supply on the rack:1: Power supply on the left side of the rack (CPS1).2: Power supply on the right side of the rack (CPS2).3: Both power supplies.

156 33002539 10/2019

Page 157: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSFC Management33002539 10/2019

SFC Management

Part VISFC Management

OverviewThis section describes the elementary functions and elementary function blocks of the SFC Management family.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page35 CLEARCHART: Reset all active steps 15936 FREEZECHART: Freeze sequence 16337 INITCHART: Reset all active steps and start sequence normally 16738 RESETSTEP: Reset a specific step in the sequence 17139 SETSTEP: Set a specific step in the sequence 17540 SFCCNTRL: SFC Control 17741 SFC_RESTORE: SFC Save and Restore 189

33002539 10/2019 157

Page 158: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC Management

158 33002539 10/2019

Page 159: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertCLEARCHART33002539 10/2019

CLEARCHART: Reset all active steps

Chapter 35CLEARCHART: Reset all active steps

Description

Function descriptionThis function is to reset sequences.

With a 1 signal at the input ClearSequence, the sequence is stopped and all steps are reset. As long as the 1 signal is at the input, the sequence stays in this mode, i.e. it cannot be started.This state remains even if input ClearSequence reverts back to 0.

The status (sequence reset) is shown with a 1 signal at the output ClearState.

Only when there is a 0 signal at the input ClearSequence, the sequence can be started with the function block SFCCNTRL (see page 178) (Input INIT), the function INITCHART (see page 167) or another external step activation command.

WARNINGUNEXPECTED SYSTEM BEHAVIORDo not use CLEARCHART to find error on controllers of machine tools, process or material management system if they are running.Failure to follow these instructions can result in death, serious injury, or equipment damage.

WARNINGUNINTENDED EQUIPMENT OPERATIONAvoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and RESETSTEP commands altogether.

Carefully check the interactions between these function blocks and analyze the resulting impact on SFC.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 159

Page 160: EcoStruxure™ Control Expert - System - Block Library - 10/2019

CLEARCHART

Since the sequence is permanently reset as long as there is a 1 signal at the input ClearSequence, you should take the following measures to prevent a permanent blocking of the sequence: Conditional call of the function CLEARCHART via the input EN. Conditional call of the function CLEARCHART via e.g. IF statement in the programming

language ST. Use edge recognition (R_TRIG) at the input ClearSequence.

NOTE: The output ClearState shows the current state of the sequence, i.e. the sequence can also be reset with the function block SFCCNTRL (see page 178) (Input CLEAR), the function INITCHART (see page 167), the procedure RESETSTEP (see page 171) (reset the last/only active step) or and other control command (external).EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation:

Representation in LDRepresentation:

Representation in ILRepresentation:LD SectionNameCLEARCHART ClearChartST ClearState

160 33002539 10/2019

Page 161: EcoStruxure™ Control Expert - System - Block Library - 10/2019

CLEARCHART

Representation in STRepresentation:ClearState := CLEARCHART (SectionName, ClearChart) ;

Parameter descriptionDescription of input parameters:

Description of output parameters:

Parameter Data type DescriptionCHARTREF SFCCHART_STATE Association with the SFC section to be controlled is

done via the name of the section.If an SFC section is created then it is automatically assigned with a variable of data type SFCCHART_STATE. The variable that is created always has the name of the respective SFC section.)

CLEAR_I BOOL 0->1: Reset all active steps in the sequence.

Parameter Data type DescriptionCLEAR_O BOOL 1: Sequence was reset, i.e. the sequence has no

active step

33002539 10/2019 161

Page 162: EcoStruxure™ Control Expert - System - Block Library - 10/2019

CLEARCHART

162 33002539 10/2019

Page 163: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertFREEZECHART33002539 10/2019

FREEZECHART: Freeze sequence

Chapter 36FREEZECHART: Freeze sequence

Description

Function descriptionThe function is to "freeze" the sequence (evaluation of transitions is turned off).

The current state of the sequence is frozen by a 1 signal at the input FreezeSequence. The status of the transitions is no longer evaluated. Therefore, it is no longer possible to move on in the sequence, even if the transition condition of the "active" transition is true. This function can be used in conjunction with the functions for step-by-step processing (function block SFCCNTRL (see page 178) (Inputs STEPUN and STEPDEP) or external SFC control command) for error correction.The output SequenceFreezed is 1 when the sequence is frozen.

NOTE: The output shows the current status of the sequence, i.e. the sequence can also be frozen with the function block SFCCNTRL or another external SFC control command.

EN and ENO can be configured as additional parameters.

WARNINGUNEXPECTED SYSTEM BEHAVIORDo not use FREEZECHART to find error on controllers of machine tools, process or material management system if they are running.Failure to follow these instructions can result in death, serious injury, or equipment damage.

WARNINGUNINTENDED EQUIPMENT OPERATIONAvoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and RESETSTEP commands altogether.

Carefully check the interactions between these function blocks and analyze the resulting impact on SFC.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 163

Page 164: EcoStruxure™ Control Expert - System - Block Library - 10/2019

FREEZECHART

Representation in FBDRepresentation:

Representation in LDRepresentation:

Representation in ILRepresentation:LD SectionNameFREEZECHART SectionNameST SequenceFreezed

Representation in STRepresentation:SequenceFreezed := FREEZECHART (SectionName, FreezeSequence) ;

164 33002539 10/2019

Page 165: EcoStruxure™ Control Expert - System - Block Library - 10/2019

FREEZECHART

Parameter descriptionDescription of the input parameter:

Description of the output parameter:

Parameter Data type MeaningSectionName SFCCHART_STATE Association with the SFC section to be controlled is

done via the name of the section.If an SFC section is created then it is automatically assigned with a variable of data type SFCCHART_STATE. The variable that is created always has the name of the respective SFC section.)

FreezeSequence BOOL 1: Freeze sequence (turn off evaluation of transitions)

Parameter Data type MeaningSequenceFreezed BOOL 1: Sequence was frozen (evaluation of transitions

was turned off)

33002539 10/2019 165

Page 166: EcoStruxure™ Control Expert - System - Block Library - 10/2019

FREEZECHART

166 33002539 10/2019

Page 167: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertINITCHART33002539 10/2019

INITCHART: Reset all active steps and start sequence normally

Chapter 37INITCHART: Reset all active steps and start sequence normally

Description

Function descriptionThis function is to reset and normally start sequences.

WARNINGUNEXPECTED SYSTEM BEHAVIORDo not use INITCHART to find error on controllers of machine tools, process or material management system if they are running.Failure to follow these instructions can result in death, serious injury, or equipment damage.

WARNINGUNINTENDED EQUIPMENT OPERATIONAvoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and RESETSTEP commands altogether.

Carefully check the interactions between these function blocks and analyze the resulting impact on SFC.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 167

Page 168: EcoStruxure™ Control Expert - System - Block Library - 10/2019

INITCHART

In relation to all functions and function blocks for sequence control, INITCHART has the highest priority. Reset sequence

With a 1 signal at the input InitSequence, the sequence is stopped and all steps are reset. As long as the 1 signal is at the input, the sequence stays in this mode, i.e. it cannot be started.Since the sequence is permanently reset as long as there is a 1 signal at the input InitSequence, you should take the following measures to prevent a permanent blocking of the sequence: Conditional call of the function INITCHART via the input EN. Conditional call of the function INITCHART via e.g. IF statement in the programming

language ST. Use edge recognition (R_TRIG) at the input InitSequence.

Start sequence normallyWith a 1->0 edge at the input InitSequence, the sequence is started normally, i.e. the initial step is activated. This is shown for one cycle with a 1 signal at the output InitState.

NOTE: The output InitState shows the current status of the sequence, i.e. the sequence can also be normally started with the function block SFCCNTRL (see page 178) (input INIT) or another external control command.EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation:

Representation in LDRepresentation:

168 33002539 10/2019

Page 169: EcoStruxure™ Control Expert - System - Block Library - 10/2019

INITCHART

Representation in ILRepresentation:LD SectionNameINITCHART InitializeChartST InitState

Representation in STRepresentation:InitState := INITCHART (SectionName, InitializeChart) ;

Parameter descriptionDescription of input parameters:

Description of output parameters:

Parameter Data type DescriptionCHARTREF SFCCHART_STATE Association with the SFC section to be controlled is

done via the name of the section.If an SFC section is created then it is automatically assigned with a variable of data type SFCCHART_STATE. The variable that is created always has the name of the respective SFC section.)

INIT_I BOOL 0->1: Reset all active steps in the sequence.1->0: Start standard sequence (set initial step)

Parameter Data type DescriptionINIT_O BOOL 1: Sequence was started normally (on for only one

cycle)

33002539 10/2019 169

Page 170: EcoStruxure™ Control Expert - System - Block Library - 10/2019

INITCHART

170 33002539 10/2019

Page 171: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertRESETSTEP33002539 10/2019

RESETSTEP: Reset a specific step in the sequence

Chapter 38RESETSTEP: Reset a specific step in the sequence

Description

Function descriptionThis procedure is to reset a step in a sequence.NOTE: The procedure can only be used in the operation mode "Multi-Token".This procedure resets the specified step.Since the step stays reset as long as this procedure (RESETSTEP) is running (the procedure is run cyclically), you should take one of the following measures to prevent a permanent resetting of the step: Conditional call of the procedure RESETSTEP via the input EN. Conditional call of the procedure RESETSTEP via e.g. IF statement in the programming

language ST. Use edge recognition (R_TRIG) at the input.

When the last/only active step of the sequence is reset, the sequence can only be restarted with the function block SFCCNTRL (see page 178) (input INIT), the function INITCHART (see page 167) or the procedure SETSTEP (see page 175) or another external step activation command.

WARNINGUNEXPECTED SYSTEM BEHAVIORDo not use RESETSTEP to find error on controllers of machine tools, process or material management system if they are running.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 171

Page 172: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RESETSTEP

EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation:

Representation in LDRepresentation:

Representation in ILRepresentation:LD StepNameRESETSTEP

Representation in STRepresentation:RESETSTEP (StepName);

WARNINGUNINTENDED EQUIPMENT OPERATIONAvoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and RESETSTEP commands altogether.

Carefully check the interactions between these function blocks and analyze the resulting impact on SFC.Failure to follow these instructions can result in death, serious injury, or equipment damage.

172 33002539 10/2019

Page 173: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RESETSTEP

Parameter descriptionDescription of the input parameter:

Parameter Data type MeaningStepName SFCSTEP_STATE Assignment of the step to be reset via the name of

the step.(If an SFC step is created then it is automatically assigned with a variable of data type SFCSTEP_STATE. The variable that is created always has the name of the respective SFC step.)

33002539 10/2019 173

Page 174: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RESETSTEP

174 33002539 10/2019

Page 175: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSETSTEP33002539 10/2019

SETSTEP: Set a specific step in the sequence

Chapter 39SETSTEP: Set a specific step in the sequence

Description

Function descriptionThis procedure is to set a step in a sequence.NOTE: The procedure can only be used in the operation mode "Multi-Token".This procedure sets the specified step, in addition to the already active step(s). Already active steps are not affected by this procedure.Since the step stays set as long as this procedure (SETSTEP) is running (the procedure is run cyclically), you should take one of the following measures to prevent a permanent setting of the step: Conditional call of the procedure SETSTEP via the input EN. Conditional call of the procedure SETSTEP via e.g. IF statement in the programming language

ST. Use edge recognition (R_TRIG) at the input.

EN and ENO can be configured as additional parameters.

WARNINGUNEXPECTED SYSTEM BEHAVIORDo not useSETSTEP to find error on controllers of machine tools, process or material management system if they are running.Failure to follow these instructions can result in death, serious injury, or equipment damage.

WARNINGUNINTENDED EQUIPMENT OPERATIONAvoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and RESETSTEP commands altogether.

Carefully check the interactions between these function blocks and analyze the resulting impact on SFC.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 175

Page 176: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SETSTEP

Representation in FBDRepresentation:

Representation in LDRepresentation:

Representation in ILRepresentation:LD StepNameSETSTEP

Representation in STRepresentation:SETSTEP (StepName);

Parameter descriptionDescription of the input parameter:

Parameter Data type MeaningStepName SFCSTEP_STATE Assignment of the step to be set via the name of the

step.(If an SFC step is created then it is automatically assigned with a variable of data type SFCSTEP_STATE. The variable that is created always has the name of the respective SFC step.)

176 33002539 10/2019

Page 177: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSFCCNTRL33002539 10/2019

SFCCNTRL: SFC Control

Chapter 40SFCCNTRL: SFC Control

IntroductionThis chapter describes the SFCCNTRL block.

What Is in This Chapter?This chapter contains the following topics:

Topic PageDescription 178Parameter description 183

33002539 10/2019 177

Page 178: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

Description

Function descriptionThis function block is to control the execution sequences.For example, you can go through step by step, processing transition conditions can be turned on or off or the sequence can be reset to its initialization state.

EN and ENO can be configured as additional parameters.

WARNINGUNEXPECTED SYSTEM BEHAVIORDo not use INIT, CLEAR, DISTRANS, DISACT, STEPUN and STEPDEP to find errors when controlling machine tools, processes or material management systems, if they are running.Failure to follow these instructions can result in death, serious injury, or equipment damage.

WARNINGUNINTENDED EQUIPMENT OPERATIONAvoid using SFCCNTRL command with CLEARCHART, FREEZCHART, INITCHART, SETSTEP and RESETSTEP commands altogether.

Carefully check the interactions between these function blocks and analyze the resulting impact on SFC.Failure to follow these instructions can result in death, serious injury, or equipment damage.

WARNINGUNINTENDED EQUIPMENT OPERATIONDo not use more than one instance of this block for each SFC section.Failure to follow these instructions can result in death, serious injury, or equipment damage.

178 33002539 10/2019

Page 179: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

Representation in FBDRepresentation:

33002539 10/2019 179

Page 180: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

Representation in LDRepresentation:

180 33002539 10/2019

Page 181: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

Representation in ILRepresentation:CAL SFCCNTRL_Instance (CHARTREF:=SectionName, INIT:=InitializeChart, CLEAR:=ClearChart, DISTIME:=DisableTimeCheck, DISTRANS:=DisableTransitions, DISACT:=DisableActions, STEPUN:=StepUnconditional, STEPDEP:=StepTransDependent, RESETERR:=ResetTimeErrors, DISRMOTE:=DisableRemoteControl, ALLTRANS:=CalcAllTransitions, RESSTEPT:=ResetStepTimes, INITST=>InitState, CLEARST=>ClearState, TIMEDIS=>TimeCheckDisabled, TRANSDIS=>TransitionsDisabled, ACTDIS=>ActionsDisabled, MODECHG=>OperatingModeChanged, STATECHG=>StatusChanged, TIMEERR=>TimeError, TERRACT=>PendingTimeError)

Representation in STRepresentation:SFCCNTRL_Instance (CHARTREF:=SectionName, INIT:=InitializeChart, CLEAR:=ClearChart, DISTIME:=DisableTimeCheck, DISTRANS:=DisableTransitions, DISACT:=DisableActions, STEPUN:=StepUnconditional, STEPDEP:=StepTransDependent, RESETERR:=ResetTimeErrors, DISRMOTE:=DisableRemoteControl, ALLTRANS:=CalcAllTransitions, RESSTEPT:=ResetStepTimes, INITST=>InitState, CLEARST=>ClearState, TIMEDIS=>TimeCheckDisabled, TRANSDIS=>TransitionsDisabled, ACTDIS=>ActionsDisabled, MODECHG=>OperatingModeChanged, STATECHG=>StatusChanged, TIMEERR=>TimeError, TERRACT=>PendingTimeError) ;

Parameter descriptionDescription of input parameters:

Parameter Data type DescriptionCHARTREF SFCCHART_STATE Association with the SFC section to be controlled is

done via the name of the sectionIf an SFC section is created then it is automatically assigned with a variable of data type SFCCHART_STATE. The variable that is created always has the name of the respective SFC section.)

INIT BOOL 0->1: Reset all active steps in the sequence.1->0: Start standard sequence (set initial step)

CLEAR BOOL 0->1: Reset all active steps in the sequence.

33002539 10/2019 181

Page 182: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

Description of output parameters:

DISTIME BOOL 1: Turn off time monitoringDISTRANS BOOL 1: Turn of evaluation of the transitions (freeze sequence)DISACT BOOL 1: Turn off processing of the actions and reset all actions

in the sequenceSTEPUN BOOL 0->1: Activate the next step, independent of the

transition conditionSTEPDEP BOOL 0->1: Activate the next step, dependent on the transition

conditionRESETERR BOOL 0->1: Reset the time monitoring error.DISRMOTE BOOL 1: Prevent control of the sequence using processing

parameters of the Online Animation PanelALLTRANS BOOL 1: Calculate all transition sectionsRESSTEPT BOOL 0->1: Deactivate and reset time calculation

1->0: Restart time calculationReminder: If the RESSTEPT function is active, steps with a defined delay time are never activated (With RESSTEPT, the current step time is reset continually and so the defined delay time can never be achieved.)

Parameter Data type DescriptionINITST BOOL 1: Sequence was started normally (on for only one

cycle)CLEARST BOOL 1: Sequence was reset, i.e. the sequence has no

active stepTIMEDIS BOOL 1: Time monitoring was turned offTRANSDIS BOOL 1: Evaluation of the transitions was turned offACTDIS BOOL 1: Processing of the actions was turned off and all

actions in the sequence were resetMODECHG BOOL 1: Operation mode of the sequence was changed

(on for only one cycle)STATECHG BOOL 1: Status of the sequence was changed (on for only

one cycle)TIMEERR BOOL 1: Error in the time monitoring has occurred (on for

only one cycle)TERRACT BOOL 1: There is currently an error in the time monitoring

Parameter Data type Description

182 33002539 10/2019

Page 183: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

Parameter description

General

CHARTREFAssociation with the SFC to be controlled.If an SFC section is created then it is automatically assigned with a variable of data type SFCCHART_STATE. The variable that is created always has the name of the respective SFC section. This variable is used for assigning the function block SFCCNTRL to the SFC section to be controlled.NOTE: The data type SFCCHART_STATE can’t be created by the user, and the value cannot be modified; so in the animation table this variable cannot be modified and the value field stay empty.

INITReset sequence and start normally.This input to the function block has the highest priority, above all other inputs. Reset sequence

With a 0->1 Edge at the input, the sequence is stopped and all steps are reset. No operator access is possible.This status remains as long as the input is 1. The status (sequence reset) is shown with a 1 signal at the output CLEARST.

Start sequence normallyWith a 1->0 edge at the input and 0 at CLEAR, the sequence is started normally, i.e. the initial step is activated. This is shown for one cycle with a 1 signal at the output INITST.

WARNINGUNEXPECTED SYSTEM BEHAVIORDo not use INIT, CLEAR, DISTRANS, DISACT, STEPUN and STEPDEP to find errors when controlling machine tools, processes or material management systems, if they are running.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 183

Page 184: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

Interaction of INIT, CLEAR, INITST and CLEARST:

Interaction of INIT, CLEAR, INITST and CLEARST:

CLEARReset sequenceWith a 0->1 Edge at the input, the sequence is stopped and all steps are reset. No operator access is possible.The status (sequence reset) is shown with a 1 signal at the output CLEARST.

This state remains even if input reverts back to 0. The sequence can only be started by a 1->0 edge on the input INIT, of the function INITCHART (see page 167) or another step activation command (external), while CLEAR is 0.

Phase Description1 If there is a 0->1 edge at input INIT, all steps in the sequence are reset and the

output CLEARST is set to 1.

2 If there is a 1->0 edge at input INIT, the initial step in the sequence is set, the output INITST is set to 1 for one cycle and the output CLEARST is set to 0.

3 If there is a 0->1 edge at input INIT, all steps in the sequence are reset and the output CLEARST is set to 1.

4 A 1->0 edge at input CLEAR, has no influence on the state of the sequence or the outputs of the function block.

5 If the sequence is already in the status "reset", a 0->1 edge at input INIT, has no influence on the state of the sequence or the outputs of the function block.

6 If the sequence is already in the status "reset", a 0->1 edge at input CLEAR, has no influence on the state of the sequence or the outputs of the function block.

7 When CLEAR is 1, a 1->0 edge at input INIT, has no influence on the state of the sequence (CLEARST) or the outputs of the function block.

184 33002539 10/2019

Page 185: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

DISTIMETurn off time monitoringThe time monitoring of the active step is suppressed by a 1 signal at the input. The execution time will continue to be calculated, but no error will be reported if the time is outside the upper and lower limits.Already existing errors are not affected by this function (Animation or Output TERRACT).

DISTRANSTurn off transition evaluationThe current state of the sequence is frozen by a 1 signal at the input. The status of the transitions is no longer evaluated. Therefore, it is no longer possible to move on in the sequence, even if the transition condition of the "active" transition is true. This function can be used in conjunction with STEPUN and STEPDEP for error correction.

DISACTTurn off processing of the actionsAll active actions are reset with a 1 signal at the input.

STEPUNActivate the next step, independent of the transition conditionWith a 0->1 edge at the input, independent of the status of the transition condition, the current active step(s) are deactivated and the next step(s) is activated. However, this occurs first after the delay time (step time) of the active step has run out.Using this command with simultaneous branching, all branches are activated and for alternative branching, the left branch is always activated.The input STEPDEP is used for process dependent activation of branches.

STEPDEPActivate the next step, dependent on the transition conditionWith a 0->1 edge at the input and a successful transition condition, the next step(s) is activated. However, this occurs first after the delay time (step time) of the active step has run out.The control command is only sensible when there is a 1 signal at the input DISTRANS.

By freezing the transitions(DISTRANS = 1), it is possible to manually process the sequence, step by step, with this control command. In this way, the transitions are dependent on the transition conditions.

33002539 10/2019 185

Page 186: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

RESETERRReset the time monitoring error.With a 0->1 edge at the input, display of all time monitoring errors with the animation of the SCF section are turned off. Currently displayed time monitoring errors are updated. Existing time monitoring errors are reported anew. If there are no time monitoring errors, the output TERRACT is reset.

DISRMOTEPrevent control of the chart using processing parameters of the SFC Animation Panel.A 1 signal at the input prevents control of the SFC chart with the processing parameters of the SFC Animation Panel (initialize, turn off time monitoring, turn off evaluation of the transitions, turn off processing of the actions). Despite this, the SFC chart continues to be controlled by the SFCCNTRL function block.Setting DISRMOTE to 1 means that SFCNTRL is dominant. If DISRMOTE is not set or is set to 0, the inputs DISTRANS, DISACT, DISTIME and INIT of the SFCNTRL function block and the corresponding inputs in the SFC Animation Panel are treated as a logical OR combination. Setting DISRMOTE to 1 causes that the controls of the SFC Animation Panel are disabled.

Setting DISRMOTE to 0 causes that the controls of the SFC Animation Panel are enabled and all other components of the SFC section variable (SFCCHART_STATE) stay unchanged.

When setting DISRMOTE to 1 or 0 the value is assigned to the SFC section variable of the controlled SFC chart. This causes a problem, if the SFCCNTRL function block sets the variable to 1 (and blocks the SFC Animation Panel) and then the SFCCNTRL function block instance is deleted. In this case, the blocking value stays till next Rebuild all in offline mode. This problem could happen when the SFC section variable assigned to the CHARTREF input is replaced in online mode (meaning

that the SFCCNTRL function block instance is assigned to another SFC section), the SFCNTRL function block instance is deleted or the section with the SFCNTRL function block instance is deleted.

Work around for online mode: Create a new SFCCNTRL function block instance, assign the correct SFC section name to the CHARTREF input and set DISRMOTE to 0. This will unblock the SFC Animation Panel. Now you can delete this SFCCNTRL function block instance again.

Preventing the problem: To prevent to described problem, always make sure that DISRMOTE is set to 0 before deleting a SFCCNTRL function block instance.

NOTE: Please also refer to the SFC_RESTORE function block (Interaction with SFCCNTRL Function Block, page 203).

186 33002539 10/2019

Page 187: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

ALLTRANSCalculate all transition sectionsWith a 1 signal at the input, all transition sections are calculated (even if the corresponding step is not active). For processing of the sequence, only the active transitions continue to be evaluated. This function only serves to display the animation of all transition statuses simultaneously.NOTE: Due to the additional processing of all transition sections whose step is inactive, the cycle time of the program may be considerably increased.

RESSTEPTDeactivate time calculationWith a 0->1 signal, all time monitoring errors (minimum and maximum monitoring time), the elapsed time since activation of the step and the output TERRACT are all reset. As well, all time errors in the diagnosis are cancelled and the time monitoring of the step is stopped. This status is valid as long as the 1 signal is present. With a 1->0 edge, all times (starting with 0) are recalculated and the time monitoring is activated.NOTE: If the RESSTEPT function is active, steps with a defined delay time are never activated. (With RESSTEPT, the current step time is reset continually and so the defined delay time can never be achieved.)

INITSTSequence started normallyWith a 1->0 edge at the input INIT, the sequence is started normally, i.e. the initial step is activated. This is shown for one cycle with a 1 signal at the output INITST.

see also INIT, page 183NOTE: The output shows the current status of the sequence, i.e. the sequence can also be normally started with the function INITCHART (see page 167) or another external control command.

CLEARSTSequence was resetWith a 0->1 Edge at the input INIT or CLEAR, the sequence is stopped and all steps are reset.

This state is maintained until a 1->0 edge at the input INIT occurs.

see also INIT, page 183NOTE: The output shows the current status of the sequence, i.e. the sequence can also be reset with the function INITCHART (see page 167), CLEARCHART (see page 159) or RESETSTEP (see page 171) (reset the last/only active step) or another external control command.

33002539 10/2019 187

Page 188: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFCCNTRL

TIMEDISTime monitoring was turned offThe output is 1 if the display of the time error was turned off, independent of if the display was turned off with the function block itself (input DISTIME) or via SFC control commands.

TRANSDISEvaluation of the transitions was turned offThe output is 1 if the evaluation of the transitions was stopped.NOTE: The output shows the current status of the sequence, i.e. the sequence can also be frozen with the function FREEZECHART (see page 163) or another external SFC control command.

ACTDISProcessing of the actions was turned off and all actions in the sequence were resetThe output is 1 if the display of the actions was stopped, independent of if the display was stopped with the function block itself (input DISACT) or via SFC control commands.

MODECHGOperation mode of the sequence was changedThe output is 1 for a cycle, if one or more operation modes of the sequence was changed, independent of if the change was done with the function block itself (setting or resetting the inputs INIT, CLEAR (see page 184), DISTIME, DISACT or DISTRANS) or via external SFC control commands.

STATECHGStatus of the sequence was changedThe output is 1 for a cycle, if the status of the sequence was changed, independent of if the change was caused by processing the sequence, done with the function block itself or via external SFC control commands.

TIMEERRAn error in the time monitoring has occurredThe output is 1 for a cycle if one or more time monitoring errors have occurred.

TERRACTThere is currently an error in the time monitoringThe output remains 1 when one or more time monitoring errors exist.

188 33002539 10/2019

Page 189: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSFC_RESTORE33002539 10/2019

SFC_RESTORE: SFC Save and Restore

Chapter 41SFC_RESTORE: SFC Save and Restore

IntroductionThis chapter describes the SFC_RESTORE block.

What Is in This Chapter?This chapter contains the following topics:

Topic PageDescription 190Requirements and Restrictions 194Save and Restore Strategy 197Saving the Active Steps 198Restoring the Steps for Activation 200Resuming the SFC Sections 201Interaction with SFCCNTRL Function Block 203STATUS Error Messages 204

33002539 10/2019 189

Page 190: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Description

Function DescriptionThis function block is used to restart all SFC charts of an application with a given set of active steps at a state, saved before a CPU failure.In a recovery situation it is possible to set a group of steps that represent a given state in the process and to continue at that point.The behavior of the charts will be like using INITCHART and SETSTEP, i.e. the step time is reset to 0 and P/P1 actions are executed.For more information please refer to Save and Restore Strategy, page 197.

EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation

WARNINGUNINTENDED EQUIPMENT OPERATIONCheck the state of all SCF charts before re-starting your process application.Failure to follow these instructions can result in death, serious injury, or equipment damage.

190 33002539 10/2019

Page 191: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Representation in LDRepresentation

Representation in ILRepresentation:CAL SFC_RESTORE_Instance (SLOT:=Slot_Number, ADR_W:=Dest_Address, SPACE_KW:=Words_Number, SAVE:=Save_In, RESTORE:=Restore_In, RESUME:=Resume_In, STATUS=>Save_Restore_State, NUMSAVED=>saved_charts, NUMFAILED=>failed_charts, NUMPOSBL=>possible_charts)

Representation in STRepresentation:SFC_RESTORE_Instance (SLOT:=Slot_Number, ADR_W:=Dest_Address, SPACE_KW:=Words_Number, SAVE:=Save_In, RESTORE:=Restore_In, RESUME:=Resume_In, STATUS=>Save_Restore_State, NUMSAVED=>saved_charts, NUMFAILED=>failed_charts, NUMPOSBL=>possible_charts);

33002539 10/2019 191

Page 192: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Parameter DescriptionThe SFC_RESTORE function block is used to access memory (SLOT, ADR_W, SPACE_KW) and to select the possible modes (SAVE, RESTORE, RESUME).

It also gives the status of operation (STATUS).

The amount of memory as an input parameter (SPACE_KW) determines the space that can be used by SFC Interpreter.This memory area starts at the given address (ADR_W) and exclusive use by SFC system is supposed.Description of input parameters

Parameter Data Type DescriptionSLOT INT PCMCIA card slot

0: upper slot (default) 1: lower slot

ADR_W DINT address of the archiving zone where SFC data is stored in memory card (word offset)

SPACE_KW INT This number determines the size of the memory in kilo words that the SFC interpreter is allowed to use.The SFC-Interpreter calculates the number of SFC-sections that can be saved in this space. The result is visualized at the NUMPOSBL output.

NOTE: There is a system limitation for the number of SFC sections being saved. Any space reserved beyond this system limitation won't be used.

SAVE BOOL 0: save mode not selected 1: save mode selected

active only if RESTORE = 0 and RESUME = 0

1->0falling edge = saving is stoppedThis event is reported to diagnostic buffer.

RESTORE BOOL 0: restore mode not selected 0->1

rising edge = saved steps from storage area are restored in each SFC sectionThis event is reported to diagnostic buffer. All SFC sections enter mode disable transitions and disable actions.

1: no SAVE / no RESTORE / no RESUME 1->0

falling edge = no activity

192 33002539 10/2019

Page 193: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Description of output parameters

RESUME BOOL 0: resume mode not selected 0->1

rising edge = resume all SFC charts to normal mode if RESTORE = 0This event is reported to diagnostic buffer.

1: no activity, but prevents SAVE 1->0

falling edge = no activity

Parameter Data type DescriptionSTATUS INT 0 = OK

STATUS error message (see STATUS Error Messages, page 204)

NUMSAVED INT number of SFC sections on which the save was performed during the last scan

NUMFAILED INT number of SFC sections that could not be saved during the last scan

NUMPOSBL INT number of SFC sections that fits into the given memory space

Parameter Data Type Description

33002539 10/2019 193

Page 194: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Requirements and Restrictions

GeneralThe analyzer will check the following rules and errors will be reported if not matched in the application: The EFB must not be used more than once in the whole application. A PCMCIA card of type DATA must be present in right slot. Data size must match the memory borders.

Only 1 SFC_RESTOREOnly 1 SFC_RESTORE function block is used to control SFC save and restore.

NOTE: SFC_RESTORE can only be used once in an application (single control instance).

NOTE: The number of saved SFC-sections is limited to 250.

Location of SFC_RESTOREIt is recommended to locate the usage of SFC_RESTORE in a section executed before the first SFC section.A change at input(s) will then affect all SFC sections in the same scan.It is also strongly recommended to not disable this EFB or the section, in which this EFB is located, because otherwise the saved data will be inconsistent to the SFC charts.

SFC_RESTORE Disabled or DeletedIf the SFC_RESTORE function block is disabled or deleted, the SFC interpreter is no more notified.

This will be detected after some scans and the SFC save and restore feature will be shut off. No more saves are done.The data in the PCMCIA memory card is kept and a warning is registered to the diagnostic buffer.

Currently Active ModeThe currently active mode/action is calculated according to the following table.

Mode/Action Save Value Restore Value Resume Value

idle 0 0 0save 1 0 0restore 0 or 1 0 -> 1 (rising edge) 0 or 1resume 0 or 1 0 0 -> 1 (rising edge)

194 33002539 10/2019

Page 195: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

PCMCIA Memory CardThe SFC_RESTORE function block can only be used in CPUs with a PCMCIA memory card slot.

The presence of a suitable PCMCIA memory card is checked at analyze time in the configuration data.An error is reported if missing or wrong slot is selected.If given as constant value, it is checked additionally that the memory area fits into the card memory starting from the given address.Nevertheless, a run-time error will be shown at the STATUS output if the card is not present (like WRITE_PCMCIA, e.g. 16#0201: no file zone in the memory card).

Estimation of MemoryTo estimate the amount of memory needed to save your SFC sections, you can use the following formula:bytes Σ = 570 + n*210

570 bytes needed for data managementn number of SFC sections210 bytes needed per SFC sectionNOTE: Values may change in case of OS update.

Memory AreaStarting at the address given by the ADR_W input, the SFC interpreter assumes a memory area of SPACE_KW * 2 Kbytes usable by SFC save and restore feature.

The integrity of this memory is verified by a checksum per block.If an error is detected (e.g. checksum error), the related block is marked as invalid and an error is reported.As in the next scan SFC will try to save active steps again, the lack of restore-possibility could be temporary.

NOTE: Take into account that even the READ_PCMCIA and WRITE_PCMCIA blocks can manage the PCMCIA memory card.

WARNINGUNINTENDED EQUIPMENT OPERATIONProvide enough memory in the PCMCIA memory card for the SFC save and restore feature.Use this memory area is exclusively used by the SFC save and restore feature and there will be no overlapping with other parts of your application.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 195

Page 196: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Number of Saved SFC SectionsAccording to the SPACE_KW input, a certain amount of memory is used. There is no check at build time whether this amount of memory is suitable.If more SFC sections are detected at run time than fit into memory, an error will be reported.It is still possible to restore SFC charts that have been saved.If the number of active SFC sections increases (enable sections, add with online modification), this type of error could be detected spontaneously at run time.To give help on the number of SFC sections in the application, 3 outputs are available: NUMSAVED: number of saved SFC sections NUMFAILED: number of not saved SFC sections NUMPOSBL: maximum number of SFC sections that could be saved in the current scenario

NOTE: If there is no need to economize memory, it is recommended to add some memory space for future expansion. The number of saved SFC-sections is limited to 250.

Memory Not ClearedNew parameters at the EFB, according to an online build/change, will be taken into account.In case of an address change, the new memory will be used.NOTE: The old memory will not be cleared.A change at SPACE_KW will result in an increase or decrease of the used memory.

The presence and exclusive availability of that memory is assumed.

New Save in Case of Build In case of a build/change of any modified part of the application, the saved data is invalidated.That is because the application signature, which is used to identify good pairs of application and storage, is changed in any case.NOTE: To be able to perform a restore again, it is mandatory to save again after a build/change.

196 33002539 10/2019

Page 197: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Save and Restore Strategy

Save StrategyThe save strategy is based on a save of the active steps to a CPU-external memory area (PCMCIA memory card).In the environment of individual sections, it is known, whether active steps have changed. Only in this case (or to recover from an error), the save will be performed.NOTE: If the state of a chart does not change, there is no update of data in the cartridge.Only the StepIDs (internal identifiers) of the active steps are saved due to memory consumption and needed time to save.The save is done individually for each SFC section in its context.

Restore StrategyIn case of restore, the StepIDs are read from the PCMCIA memory card area and activated in the charts.Those StepIDs must be consistent, i.e. all steps must be present and they must identify the same objects in the SFC sections as at the save-time.NOTE: To ensure this, there must not be a change/build of the application between saving and restoring of steps.

33002539 10/2019 197

Page 198: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Saving the Active Steps

OverviewIn case of Save mode, save will be done at the end of the processing of every chart.

If a change of the active steps of a chart occurs, the new StepIDs (internal identifier) are stored to the memory and a status is memorized.This is repeated for all SFC sections following in the scan.At next execution of the EFB, the cumulated status of save operation is retrieved and shown at the output.If more than 1 error is detected, the most significant one (see STATUS Error Messages, page 204) will be displayed.

Effects of Modifying the ApplicationIf the application is modified (adding, deleting, moving or disabling SFC sections), this will influence the saved data.

ChecksumIt will be checked whether the data fits into memory space according to user settings (number of SFC sections and number of active steps per SFC section).A checksum is created for each section and will provide a certain security, that content is not damaged.NOTE: If a check fails, the related data is marked as invalid.

Modification Effectadding an SFC section Active steps are immediately saved when section is

executed.deleting an SFC section No more save, data in memory is removed.moving an SFC section Data will be stored in different order.disabling an SFC section No more save, but data is still valid.

Saved again if enabled.

198 33002539 10/2019

Page 199: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Update of Stored Data If SFC sections are not executed because execution condition is false, the StepIDs (internal

identifier) of the last execution are still available. If executed again, the StepIDs will be updated. Newly added SFC sections will store their StepIDs as soon as they are executed. Stored data of deleted SFC sections will be immediately deleted.In general after a build/change all data are invalidated as they are not usable because of changed application signature. This avoids memory shortage due to obsolete data.In this environment, a restore after a CPU failure is probably a mix of chart data of 2 scans, as the CPU failure most likely will occur somewhere within the scan.NOTE: In such a scenario it might be possible to have inconsistent states between charts.

33002539 10/2019 199

Page 200: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Restoring the Steps for Activation

OverviewIf a rising edge (0->1) of RESTORE is detected, then the first executed SFC section will perform the restore operation for all sections.The all-at-once recovery is necessary to ensure that every SFC section gets back the stored StepIDs (internal identifier), even the disabled ones.If a high signal is active at the RESTORE input, no SAVE and no RESUME will be performed, even if those inputs are active.This is necessary to prevent overwriting the save area and to provide a clear separation of operating modes.

CLEARCHART / SETSTEPTo perform a RESTORE operation, a CLEARCHART will be executed.

This resets all steps and actions and also de-registers all SFC errors from diagnostic buffer.After that, for each StepID taken from the storage area, a SETSTEP operation will be performed.

General CheckBefore starting the RESTORE operation, a general check is performed to ensure integrity of the memory card data.The application build ID must be equal and the version must be in valid range.If not all of the checks succeed, the restore operation is aborted.An error (An INIT was done due to restore error) is notified to EFB and diagnostic buffer.

NOTE: The PLC will not enter the HALT state. All SFC charts will start with INIT steps.

Individual ChecksThere are also checks within individual sections: save operation must be completed the checksum must fit StepID must be validIf an error occurs during recovery of individual sections, then the SFC section currently in progress is forced to the initial state.A warning (Not all SFC charts could be restored / resumed / initialized) is notified.Detecting such failures will not prevent the complete restore mechanism to restore as much steps as possible.

200 33002539 10/2019

Page 201: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Resuming the SFC Sections

OverviewAfter having checked that SFC sections are in correct state, it is possible to use RESUME input to set all SFC charts to enabled action and transition mode.For behavior in case of interaction with SFCCNTRL function block please refer to Interaction with SFCCNTRL Function Block, page 203.

Check SFC Charts

Performing a Complete Restore CycleTo perform a complete restore cycle of SFC charts, you must perform the following steps:

WARNINGUNINTENDED EQUIPMENT OPERATIONCheck the state of all SFC charts before re-starting your process application.Failure to follow these instructions can result in death, serious injury, or equipment damage.

Step Action Comment1 Load application. Must be the same application that did the save

of the steps.This action may be optional, depends on the situation.

2 Reset SAVE input. This prevents overwriting of saved data.

3 Reset RESUME input. -

4 Perform a PLC → Init. Already done if application is newly loaded.This action may be optional.

5 Set RESTORE input. The rising edge will initiate the restore of all charts in the next executed SFC section.Should be set before RUN to bring SFC into disabled mode.

6 Run application. -7 Reset RESTORE input. -

8 Check SFC charts. The rising edge of RESTORE input will disable actions and transitions for all SFC charts.Note:Be careful to ensure that no harm can occur before activating SFC charts. See safety message Check SFC Charts, page 201 above.

33002539 10/2019 201

Page 202: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Timing Diagram

1 Normal operation.2 CPU failure.3 Reset SAVE input.4 Perform a PLC -> Init.5 Set RESTORE input and PLC -> Run.6 Reset RESTORE input.7 As a result of (5) all SFC actions/transitions are disable. It is now possible to enable SFC actions/transitions

using the SFC Animation Panel.8 Set and reset RESUME input.9 Set SAVE input.10 Normal operation.

9 Individually enable the charts using the SFC Animation Panel.

This action may be optional, depends on the situation.

10 Set RESUME input. Rising edge of RESUME input will enable all SFC transitions and actions. Note:This will remove DisableTransitions and DisableActions flags from all SFC sections.

11 Reset RESUME input. -

12 Set SAVE input. After system works well again, probably enable again to save the active steps.

Step Action Comment

202 33002539 10/2019

Page 203: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

Interaction with SFCCNTRL Function Block

OverviewSome SFC section(s) might also be controlled by SFCCNTRL function block(s).

If inputs DISTRANS and/or DISACT of the SFCCNTRL function block are used, this will influence the behavior of RESTORE and RESUME inputs of the SFC_RESTORE function block as described below.

DISRMOTE = 1In case the DISRMOTE input is 1 the SFCCNTRL function block has the mastership.

After performing a RESTORE or a RESUME with the SFC_RESTORE function block the value that is present at the inputs DISTRANS / DISACT of the SFCCNTRL function block will be active.

DISRMOTE = 0In case the DISRMOTE input is 0 the SFCCNTRL function block and remote control (SFC Animation Panel or SFC_RESTORE function block) have same level of priority.

It works as a "wired or": a TRUE from any source will disable transition / action.

To achieve a FALSE value, any source that activates it to TRUE must remove it.

In this case, control coming from the SFC_RESTORE function block has the same result as SFC Animation Panel, i.e. it is taken as the same source.After performing a RESTORE, the chart will be in the disabled mode, nevertheless what value is active at SFCCNTRL function block.

The SFCCNTRL function block could hold it on disabled, but to enable it, SFC Animation Panel or RESUME input of the SFC_RESTORE function block must be used.

33002539 10/2019 203

Page 204: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

STATUS Error Messages

Error HandlingThe PLC will not enter the HALT state due to storage failure, but a warning is given in 2 stages: Error message is provided at EFB output STATUS. Error message is send to diagnostic buffer.

Memory Access MessagesPCMCIA card memory access messages

SFC Specific MessagesNew SFC specific messages/warnings have been defined additionally to the PCMCIA card memory access messages.

Code Description16#0000 action performed correctly16#0102 ADR_W + SPACE_KW - 1 is greater than the maximum number of

declared words in the PLC16#0104 no valid application or no word in the PLC16#0201 no file zone in the memory card16#0202 memory card error16#0204 memory card write-protected16#0241 ADR_W < 0

16#0242 ADR_W + SPACE_KW -1 is greater than the highest address of the memory card

16#0401 SPACE_KW = 0

16#0402 Slot_Number is different from 0 and 1

16#0501 unsupported service

Code Description16#a4F4 end of SAVE model

16#a5F4 RESTORE initiated

16#a6F4 RESUME initiated

16#a7F4 nothing saved. Nothing restored, because nothing has been saved 16#a8F4 communication lost with SFC_RESTORE EFB

204 33002539 10/2019

Page 205: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

NOTE: If more than 1 status has to be reported, only the most significant is shown at the STATUS output of the EFB. Significance increases with higher numbers (in hexadecimal or unsigned notification). INIT warning (16#aeF4) is most significant.

NOTE: If error 16#a0F4 (SFC command undefined) is shown at the EFB STATUS, the OS in the PLC does not support SFC_Restore feature (e.g. wrong version of OS).

Reports to Diagnostic BufferThe following events are reported to diagnostic buffer, but not to EFB.

16#a9F4 Too much SFC sections for SFC_Restore. SPACE_KW parameter of SFC_RESTORE EFB exceeds system limitation

NOTE: This warning indicates that the maximal card space, which is visualized at the NUMPOSBL output, can be fine tuned by reducing the SPACE_KW parameter.

16#aaF4 saved data not valid16#abF4 not all charts could be restored / resumed / initialized16#acF4 memory space too small16#adF4 application has changed16#aeF4 an INIT was done due to restore error

Code Description

Code Description16#a4F4 End of SAVE mode

16#a5F4 RESTORE initiated

16#a6F4 RESUME initiated

16#a9F4 Too much SFC sections for SFC_Restore. SPACE_KW parameter of SFC_RESTORE EFB exceeds system limitation

NOTE: This warning indicates that the maximal card space, which is visualized at the NUMPOSBL output, can be fine tuned by reducing the SPACE_KW parameter.

33002539 10/2019 205

Page 206: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SFC_RESTORE

206 33002539 10/2019

Page 207: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSysClock33002539 10/2019

SysClock

Part VIISysClock

OverviewThis section describes the elementary functions and elementary function blocks of the SysClock family.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page42 FREERUN: Free-running timer 20943 GET_TS_EVT_M: Reading the M340 and M580 Time Stamped Event Buffer 21144 GET_TS_EVT_Q: Reading the Quantum Time Stamped Event Buffer 21945 NOP850_EVTS: Converting External Events to NOP Modules 22746 PTC: Reading the stop date and code 23947 RRTC_DT: Reading the system date 24148 RRTC_DT_MS: Network real-time clock function 24349 R_NTPC: Network real-time clock function 24750 SCHEDULE: Real-time clock function 25151 T850_TO_T870 and T870_TO_T870: Converting the Time Format 25552 WRTC_DT: Updating the system date 261

33002539 10/2019 207

Page 208: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SysClock

208 33002539 10/2019

Page 209: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertFREERUN33002539 10/2019

FREERUN: Free-running timer

Chapter 42FREERUN: Free-running timer

Description

Function descriptionThis function enables a free-running counter, which can be used for run time measurement of sections and application programs.EN and ENO can be configured as additional parameters.

Run time determination of a sectionDetermine the run time of a section:

Run time determination of a programDetermine the run time of a program:

Step Action1 Place one FREERUN function at the start of the section and one at the end.

2 Use the execution sequence to ensure that the FREERUN function at the start of the section is executed first and the one at the end of the section is executed last.

3 Calculate the delta of the two values obtained.Delta displays the run time of the section in microseconds.

Step Action1 Place a FREERUN function at the start of the first section of the program and one

at the end of the last section.2 Use the execution sequence to ensure that the FREERUN function at the start of

the first section is executed first and the one at the end of the section is executed last.

3 Calculate the delta of the two values obtained.This delta displays the run time of the program in microseconds.

33002539 10/2019 209

Page 210: EcoStruxure™ Control Expert - System - Block Library - 10/2019

FREERUN

Representation in FBDRepresentation:

Representation in LDRepresentation:

Representation in ILRepresentation:FREERUNST MeasuredTime

Representation in STRepresentation:MeasuredTime := FREERUN () ;

Parameter descriptionDescription of the output parameter:

Parameter Data type MeaningMeasuredTime DINT Shows the time measured since the program started

in microseconds.

210 33002539 10/2019

Page 211: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertGET_TS_EVT_M33002539 10/2019

GET_TS_EVT_M: Reading the M340 and M580 Time Stamped Event Buffer

Chapter 43GET_TS_EVT_M: Reading the M340 and M580 Time Stamped Event Buffer

Description

Description of the FunctionThe GET_TS_EVT_M function block gets the time stamped data in: BMX ERT 1604T when located in Modicon M340 local drop, BMX ERT 1604T when located in Modicon M580 local and remote drops, BME P58 xxx Modicon M580 CPU, BMX CRA 312 10 of a Modicon M580, BME CRA 312 10 of a Modicon M580.

This function allows reading the event buffer to make it available for the PLC application.The additional parameters EN and ENO can be configured.

33002539 10/2019 211

Page 212: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_M

FBD RepresentationRepresentation:

212 33002539 10/2019

Page 213: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_M

LD RepresentationRepresentation:

IL RepresentationRepresentation:CAL GET_TS_EVT_M_Instance (CTRLSTAMP:=RawBuffer, ENABLE:=GetTsEnable, ADR:=ModuleAddress, ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait, CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive, ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer, BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)

ST RepresentationRepresentation:GET_TS_EVT_M_Instance (CTRLSTAMP:=RawBuffer, ENABLE:=GetTsEnable, ADR:=ModuleAddress, ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait, CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive, ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer, BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)

33002539 10/2019 213

Page 214: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_M

Description of the ParametersThe following table describes the input parameters:

The following table describes the output parameters:

Parameter Type CommentENABLE BOOL Set to 1 to send the request to the concerned module.ADR ANY_ARRAY_INT Array containing the Modbus slave address, result of ADDM

(see EcoStruxure™ Control Expert, Communication, Block Library) or ADDMX (see EcoStruxure™ Control Expert, Communication, Block Library) function.

ABORT BOOL Set to 1 to abort the current operation.NUMBER INT Maximum number of events to be read in the module local buffer.TIMEOUT INT Maximum time to wait for the drop reply. The time base for this

parameter is 100 ms.

NOTE: TIMEOUT = 0 corresponds to an infinite waiting value.CMD INT Set to:

0: read the module buffer 1: reset the module buffer

Parameter Type CommentDONE BOOL Function block completed indication. Set to 1 when the execution of the

function block is completed successfully.ACTIVE BOOL Function block in progress indication. Set to 1 when the execution of the

function block is in progress.ERROR BOOL Set to 1 if an error is detected by the function block.STATUS WORD Code providing a communication and operation report (see page 216).

Byte 0: communication report Byte 1: operation report

214 33002539 10/2019

Page 215: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_M

The following table describes the input/output parameters:

DIAG_BUFF ANY_ARRAY_INT Description: Byte 0: Percentage of buffer filled Byte 1: Diagnostic flags: Bit 0 = 1: The time is OK and synchronized. Bit 1 = 1: Buffer is full, events may be lost.

This occurs in the Overwrite mode, some or all events since the last response has been overwritten.The Overwrite mode is only available if the BM• CRA 312 10 is in the Applicative mode and is not supported by the BMX ERT 1604T.

Bit 2 = 1: Buffer is full, time stamping has stopped.This occurs in the Stop When Full mode, which is supported by the BMX ERT 1604T and the BM• CRA 312 10 in the System mode.Any new events detected before reading the event buffer are lost.

Bit 3 = 1: The read request is the first one since the 140 CRA 312 10 or BM• CRA 312 10 was powered-on (this bit is not used by the BMX ERT 1604T).

BUFFER ANY_ARRAY_INT Raw buffer containing event time stamp entries: Word 0: Byte 0: Reserved Byte1: Value of the variable after change detection

Word 1: Event ID Word 2: Number of seconds since 1970/01/01 midnight (bit 15 to 0) Word 3: Number of seconds since 1970/01/01 midnight (bit 31 to 16) Word 4: Fraction of second (bit 15 to 0) Word 5: Byte 0: Fraction of second (bit 23 to 16) Byte 1: Time quality

NOTE: BUFFER size should be a multiple of 6 otherwise error 16#0900 will be raised

NB_EVENT INT Number of new events read in the BMX ERT 1604T local buffer.

Parameter Type CommentCTRLSTAMP DDT

CTRL_STAMPSpecifies the CPU raw record buffer: BEGIN index: INT END index: INT Operating MODE (a detailed description of the Operating mode word

(see page 217) is given below): WORD.

Parameter Type Comment

33002539 10/2019 215

Page 216: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_M

STATUS Parameter DescriptionThe following table describes the STATUS parameter:

NOTE: If an error code is not described in the table above, seeOther error codes.NOTE: ENO parameter is set to 1 on a correct exchange.

Communication Report (Byte 0) Operation Report (Byte 1)Value Description Value Description00 hex Correct exchange (request processed

successfully)00 hex Positive result01 hex The number of events in the PLC buffer reaches

the maximal value.02 hex The buffer is full and events have been

overwritten since the last exchange.04 hex Buffer is full and the recording stops

01 hex Exchange stop on timeout 00 hex Default value02 hex Exchange stop on user request (CANCEL) 00 hex Default value03 hex Incorrect address format 00 hex Default value04 hex Incorrect destination address 00 hex Default value06 hex Incorrect specific parameters 01 hex Invalid CMD parameter.

02 hex User parameters have changed between 2 invocations while the EFB execution is active.

07 hex Problem in sending to the destination 00 hex Default value09 hex Insufficient receive buffer size (<1 EVT) or

buffer size is not a multiple of 6 integers00 hex Default value

0B hex No processor system resources 00 hex Default valueFF hex Incorrect exchange (request processed

with failure)FF hex General communication error

216 33002539 10/2019

Page 217: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_M

CTRLSTAMP Parameter DescriptionCTRL_STAMP DDT structure example and link with the PLC buffer:

The example above shows the CTRL_STAMP content after writing 32 events (1 event entry is 6 words long) in the PLC buffer configured as follows: PLC buffer is located and there are 32 events to write Stop the recording when the buffer is full and continue with the previous value on power on.Operating MODE word structure:

Buffer level: If BEGIN Index = END Index then the buffer is empty If END Index + 6 = BEGIN Index then the buffer is full (in the preceding equation, 6 represents

the size of 1 event). The buffer is full when there is one space left for 1 event (6 x INT).

EFB behavior on buffer full depends on the Operating MODE parameter, bit 1 value: If Behavior on raw records buffer overrun is set to 0 (stop the recording), the buffer is not filled

with new data. If Behavior on raw records buffer overrun is set to 1 (overwrite buffer), elder data or overwritten

with newer data. In this case, the EFB updates both BEGIN Index and END Index.

33002539 10/2019 217

Page 218: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_M

Operating Mode of Enable, Active, Done and Error ParametersThe ENABLE, ACTIVE, DONE (or SUCCESS) and ERROR parameters operate as follows:

(1) DONE = 1 if no error, DONE = 0 if error(2) ERROR = 0 if no error, ERROR = 1 if error

The ENABLE parameter is written by the application.

The ACTIVE, DONE and ERROR parameters are read by the application.

To launch the communication function only once, the ENABLE signal needs to be reset to 0 once the ACTIVE parameter is set to 0. If the ENABLE parameter is maintained to 1 once the ACTIVE parameter is set to 0, the communication function is launched again and the ACTIVE parameter will be set to 1 on the next cycle.

218 33002539 10/2019

Page 219: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertGET_TS_EVT_Q33002539 10/2019

GET_TS_EVT_Q: Reading the Quantum Time Stamped Event Buffer

Chapter 44GET_TS_EVT_Q: Reading the Quantum Time Stamped Event Buffer

Description

Description of the FunctionThe GET_TS_EVT_Q function block gets the time stamped data in a BMX CRA 312 10 Ethernet RIO module or in a BMX ERT 1604T module in a remote I/O drop (Quantum architecture). This function allows reading the event buffer in the source time stamp I/O module (BMX CRA 312 10 or BMX ERT 1604T) and to make it available for the Quantum PLC application.The additional parameters EN and ENO can be configured.

FBD RepresentationRepresentation:

33002539 10/2019 219

Page 220: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_Q

LD RepresentationRepresentation:

IL RepresentationRepresentation:CAL GET_TS_EVT_Q_Instance (CTRLSTAMP:=RawBuffer, ENABLE:=GetTsEnable, ADR:=ModuleAddress, ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait, CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive, ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer, BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)

ST RepresentationRepresentation:GET_TS_EVT_Q_Instance (CTRLSTAMP:=RawBuffer, ENABLE:=GetTsEnable, ADR:=ModuleAddress, ABORT:=GetTsAbort, NUMBER:=NbEventsToRead, TIMEOUT:=TimeToWait, CMD:=ModuleCmd, DONE=>GetTsSuccessfull, ACTIVE=>GetTsActive, ERROR=>GetTsFaulty, STATUS=>ErrorCode, DIAG_BUFF=>DiagBuffer, BUFFER=>TimeStamp, NB_EVT=>NbNewEvents)

220 33002539 10/2019

Page 221: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_Q

Description of the ParametersThe following table describes the input parameters:

The following table describes the output parameters:

Parameter Type CommentENABLE BOOL Set to 1 to send the request to the concerned module.ADR ANY_ARRAY_INT Array containing the Modbus slave address, result of ADDMX

(see EcoStruxure™ Control Expert, Communication, Block Library) function.

ABORT BOOL Set to 1 to abort the current operation.NUMBER INT Maximum number of events to be read in the module local buffer.

NOTE: When the requested event number is 0, an incorrect specific parameter error is raised (Communication Report (Byte 0) = 06 hex) and diag buffer is not updated.

TIMEOUT INT Maximum time to wait for the drop reply. The time base for this parameter is 100 ms.

NOTE: TIMEOUT = 0 corresponds to an infinite waiting value.CMD INT Set to:

0: read the module buffer 1: reset the module buffer

Parameter Type CommentDONE BOOL Function block completed indication. Set to 1 when the execution of the

function block is completed successfully.ACTIVE BOOL Function block in progress indication. Set to 1 when the execution of the

function block is in progress.ERROR BOOL Set to 1 if an error is detected by the function block.STATUS WORD Code providing a communication and operation report (see page 223)

Byte 0: communication report Byte 1: operation report

33002539 10/2019 221

Page 222: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_Q

The following table describes the input/output parameters:

DIAG_BUFF ANY_ARRAY_INT Description: Byte 0: Percentage of buffer filled Byte 1: Diagnostic flags: Bit 0 = 1: The time is OK and synchronized. Bit 1 = 1: Buffer is full, events may be lost.

This occurs in the Overwrite mode, some or all events since the last response has been overwritten.The Overwrite mode is only available if the BM• CRA 312 10 is in the Applicative mode and is not supported by the BMX ERT 1604T.

Bit 2 = 1: Buffer is full, time stamping has stopped.This occurs in the Stop When Full mode, which is supported by the BMX ERT 1604T and the BM• CRA 312 10 in the System mode.Any new events detected before reading the event buffer are lost.

Bit 3 = 1: The read request is the first one since the 140 CRA 312 10 or BM• CRA 312 10 was powered-on (this bit is not used by the BMX ERT 1604T).

BUFFER ANY_ARRAY_INT Raw buffer containing event time stamp entries: Word 0: Byte 0: Reserved Byte1: Value of the variable after change detection

Word 1: Event ID Word 2: Number of seconds since 1970/01/01 midnight (bit 15 to 0) Word 3: Number of seconds since 1970/01/01 midnight (bit 31 to 16) Word 4: Fraction of second (bit 15 to 0) Word 5: Byte 0: Fraction of second (bit 23 to 16) Byte 1: Time quality (see System Time Stamping, User Guide)

NOTE: BUFFER size should be a multiple of 6 otherwise error 16#0900 will be raised

NB_EVENT INT Number of new events read in the BMX CRA 312 10 or BMX ERT 1604T local buffer (Ethernet RIO drop).

Parameter Type CommentCTRLSTAMP DDT

CTRL_STAMPSpecifies the CPU raw record buffer: BEGIN index: INT END index: INT Operating MODE (a detailed description of the Operating mode word

(see page 224) is given below): WORD.

Parameter Type Comment

222 33002539 10/2019

Page 223: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_Q

STATUS Parameter DescriptionThe following table describes the STATUS parameter:

NOTE: If an error code is not described in the table above, see Generic error codes (see page 301).NOTE: ENO parameter is set to 1 on a correct exchange.

Communication Report (Byte 0) Operation Report (Byte 1)Value Description Value Description00 hex Correct exchange (request processed

successfully)00 hex Positive result01 hex The number of events in the PLC buffer reaches

the maximal value.02 hex The buffer is full and events have been

overwritten since the last exchange.04 hex Buffer is full and the recording stops

01 hex Exchange stop on timeout 00 hex Default value02 hex Exchange stop on user request (CANCEL) 00 hex Default value03 hex Incorrect address format 00 hex Default value04 hex Incorrect destination address 00 hex Default value06 hex Incorrect specific parameters 00 hex Default value or event number is set to 0

01 hex Invalid CMD parameter

02 hex User parameters have changed between 2 invocations while the EFB execution is active

09 hex Insufficient receive buffer size (<1 EVT) or buffer size is not a multiple of 6 integers

00 hex Default value

0B hex No processor system resources 00 hex Default valueFF hex Incorrect exchange (request processed

with detected failure)FF hex General communication error detected

33002539 10/2019 223

Page 224: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_Q

CTRLSTAMP Parameter DescriptionCTRL_STAMP DDT structure example and link with the PLC buffer:

The example above shows the CTRL_STAMP content after writing 32 events (1 event entry is 6 words long) in the PLC buffer configured as follows: PLC buffer is located and there are 32 events to write Stop the recording when the buffer is full and continue with the previous value on power on.Operating MODE word structure:

Buffer level: If BEGIN Index = END Index then the buffer is empty If END Index + 6 = BEGIN Index then the buffer is full (in the preceding equation, 6 represents

the size of 1 event). The buffer is full when there is one space left for 1 event (6 x INT).

EFB behavior on buffer full depends on the Operating MODE parameter, bit 1 value: If Behavior on raw records buffer overrun is set to 0 (stop the recording), the buffer is not filled

with new data. If Behavior on raw records buffer overrun is set to 1 (overwrite buffer), elder data or overwritten

with newer data. In this case, the EFB updates both BEGIN Index and END Index.

224 33002539 10/2019

Page 225: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_Q

Operating Mode of Enable, Active, Done and Error ParametersThe ENABLE, ACTIVE, DONE (or SUCCESS) and ERROR parameters operate as follows:

(1) DONE = 1 if no error, DONE = 0 if error(2) ERROR = 0 if no error, ERROR = 1 if error

The ENABLE parameter is written by the application.

The ACTIVE, DONE and ERROR parameters are read by the application.

To launch the communication function only once, the ENABLE signal needs to be reset to 0 once the ACTIVE parameter is set to 0. If the ENABLE parameter is maintained to 1 once the ACTIVE parameter is set to 0, the communication function is launched again and the ACTIVE parameter will be set to 1 on the next cycle.

33002539 10/2019 225

Page 226: EcoStruxure™ Control Expert - System - Block Library - 10/2019

GET_TS_EVT_Q

226 33002539 10/2019

Page 227: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertNOP850_EVTS33002539 10/2019

NOP850_EVTS: Converting External Events to NOP Modules

Chapter 45NOP850_EVTS: Converting External Events to NOP Modules

Subject of this ChapterThis chapter describes the NOP850_EVTS function.

What Is in This Chapter?This chapter contains the following topics:

Topic PageNOP850_EVTS Elementary Function Block for the 140 NOP 850 00 228NOP850_EVTS Elementary Function Block Operations for the BMENOP0300 234

33002539 10/2019 227

Page 228: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

NOP850_EVTS Elementary Function Block for the 140 NOP 850 00

IntroductionUse the NOP850_EVTS elementary function block (EFB) to: Manage and synchronize the transfer of external events from an ERT or CRA into the memory

of the 140 NOP 850 00 module. Manage the transfer external events between a PLC and the 140 NOP 850 00.

Representation in FBD

Input Parameters

Input parameter Type DescriptionENABLE BOOL Start transferring.ERT BYTE ERT type:

0 = Quantum 1 = Mx80

NOTE: When ERT type is: Quantum: the time stamp is local time (UTC+TimeZone).

The module converts local time into UTC and includes it in ERT reports. The time zone is set in the SNTP configuration window of the Modicon IEC61850 Configuration Tool.

Mx80: the time stamp is UTC time. No configuration is necessary.

EVT Either: IED_EVT_M

(see page 230), or IED_EVT_Q

(see page 231)

Event description, including value, quality, time stamp and ID. Type depends upon the platform, either Mx80 or Quantum.

228 33002539 10/2019

Page 229: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Output Parameters

Data Type Structure - IED_RPTIED_RPT

RPT IED RPT (see page 229)

Report information.

TIMEOUT INT Time threshold in 100 ms for triggering an event. A value greater than 0.

Input parameter Type Description

Output parameter Type DescriptionDONE BOOL A value of 1 (true) indicates the function block completed

successfully.ACTIVE BOOL A value of 1 (true) indicates execution of the function block

is in progress.ERROR BOOL A value of 1 (true) indicates the function block detects an

execution error.STATUS INT Identifies the detected error:

1 = Input parameter is not valid. 2 = <Reserved> 3 = Time format is not valid.

NOTE: Only dates after January 01, 2000 are valid.

4 = Time out occurrence (default 10 s) 5 = Parameter change during runtime

RPT_BUFF IED ERT BUF (see page 230)

Raw buffer containing event time stamp entities.

Element Type DescriptionStatus WORD Report status:

Bits 0...7: Report enabled/disabled. Each bit represents one report instance: 0 = disabled 1 = enabled

Bits 8...15: Buffer overflow: 0 = No buffer overflow 1 = Overflow

DaChgCnt WORD A counter value that increments each time a report is generated.

33002539 10/2019 229

Page 230: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Data Type Structure - IED_ERT_BUFIED_ERT_BUF

Data Type Structure - IED_EVT_MIED_EVT_M: This structure describes the format of events used by Mx80 devices using the IEC61850 format:

Element Type DescriptionNewTS BYTE Time stamp of the new event.EvtSrc BYTE Event source:

0 = Quantum 1 = Mx80

EventEntity WORD[6] Event entity, which can be either: IED_EVT_M (see page 230) or IED_EVT_Q (see page 231)

Element Type DescriptionRese1 BYTE <Reserved>Value BYTE Input value.EventID WORD An event identifier, either:

The channel number; or A user-defined value.

SecondSince Epoch

DWORD The interval, in seconds, from 1970-01-01 00:00:00 UTC to the present.

FracOfSec_L WORD The fraction of the current second when the value element, above, has been determined. The fraction of second is calculated as:(SUM from i = 0 to 23 of bi*2**–(i+1) s).

FracOfSec_H BYTE

230 33002539 10/2019

Page 231: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Data Structure - IED_EVT_QIED_EVT_Q: This structure describes the format of events used by Quantum devices using the IEC61850 format:

TimeQuality BYTE TimeQuality describes provides information regarding the sending IED, and consists of the following attributes:Bits Attribute Type Description0...4 Time

AccuracyCODED ENUM

The accuracy class of the time source. Only the value of 10 = 1 ms is supported.

5 Clock Not Synchronized

BOOL When set to 1, this indicates the time source of the sending IED is not synchronized with external UTC time.

6 Clock Failure BOOL When set to 1, this indicates the time source of the sending IED is unreliable.

7 Leap Seconds Known

BOOL When set to 1, this indicates that SecondSinceEpoch value includes all leap year seconds. When set to 0, this indicates leap seconds are not included and seconds are calculated from the current date assuming a constant day length of 86400 s.

Element Type Description

Element Type DescriptionRese1 BYTE <Reserved>Value BYTE Input value.EventID WORD An event identifier, either:

The channel number; or A user-defined value.

Rese2 BYTE <Reserved>Month BYTE Month: 0...12Year BYTE Year: 00...99 (indicating 2000 to 2099)Ms_Lsb BYTE Time in milliseconds: 0...59999 (least significant byte).Ms_Msb BYTE Time in milliseconds: 0...59999 (most significant byte).Min BYTE Invalid time/minutes: 0...59Hour BYTE Summer time/hours: 0...23Day BYTE Weekday.Day of the month: 1...31

33002539 10/2019 231

Page 232: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Quantum ERT FBD Example

232 33002539 10/2019

Page 233: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Mx80 CRA FBD Example

33002539 10/2019 233

Page 234: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

NOP850_EVTS Elementary Function Block Operations for the BMENOP0300

IntroductionUse the NOP085_EVTS elementary function block (EFB) to: Manage and synchronize the transfer of external events from an ERT or CRA into the memory

of the BMENOP0300 module. Manage the transfer external events between a PLC and the BMENOP0300 module.

Representation in FBD

NOTE: When the timestamped event originates at a Quantum platform, the time stamp is local time

(UTC+TimeZone). The BMENOP0300 firmware converts this local time into UTC and includes it in the outgoing report control block. The time zone depends on the BMENOP0300 SNTP configuration in Modicon IEC61850 Configuration Tool.

When the timestamped event originates at an M80 platform, the time stamp is UTC time and BMENOP0300 firmware includes it in the outgoing report control block without conversion.

Input Parameters

Input parameter Type DescriptionENABLE BOOL Start transferringERT BYTE ERT type:

0 = Quantum ERT 1 = Mx80 ERT

234 33002539 10/2019

Page 235: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Output Parameters

EVT One of the following: IED_EVT_Q

(see M580 IEC 61850, BMENOP0300 Module, Installation and Configuration Guide)

IED_EVT_M (see M580 IEC 61850, BMENOP0300 Module, Installation and Configuration Guide)

Event description, including value, quality, time stamp, ID, DDT, and IED_EVT_x

RPT IED RPT (see M580 IEC 61850, BMENOP0300 Module, Installation and Configuration Guide)

Report information. DDT IED_RPT

TIMEOUT INT Time threshold in 100 ms increments for triggering an event (a value greater than 0)

Input parameter Type Description

Output parameter Type DescriptionDONE BOOL A value of 1 (true) indicates the function block completed

successfully.ACTIVE BOOL A value of 1 (true) indicates execution of the function block

is in progress.ERROR BOOL A value of 1 (true) indicates the function block detects an

execution error.STATUS INT Identifies the detected error:

1 = Input parameter is not valid. 2 = <Reserved> 3 = Time format is not valid.

NOTE: Only dates after January 01, 2000 are valid.

4 = time out occurrence (default 10 s) 5 = parameter change during runtime 6 = Data change counter of report is abnormal

NOTE: This EFB restarts if a time out (4) or abnormal data change counter event (6) occurs.

33002539 10/2019 235

Page 236: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Quantum ERT FBD Example

RPT_BUFF IED ERT BUF (see M580 IEC 61850, BMENOP0300 Module, Installation and Configuration Guide)

Raw buffer containing event time stamp entities.Output parameter Type Description

236 33002539 10/2019

Page 237: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

Mx80 ERT FBD Example

33002539 10/2019 237

Page 238: EcoStruxure™ Control Expert - System - Block Library - 10/2019

NOP850_EVTS

238 33002539 10/2019

Page 239: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertPTC33002539 10/2019

PTC: Reading the stop date and code

Chapter 46PTC: Reading the stop date and code

Description

Description of the functionThe PTC function reads the date and code of the most recent PLC stop, and saves the information in an integer table. The additional parameters EN and ENO can be configured.

FBD representationRepresentation:

LD representationRepresentation:

IL representationRepresentation:PTCST Stop_Date

ST representationRepresentation:PTC (Stop_Date);

33002539 10/2019 239

Page 240: EcoStruxure™ Control Expert - System - Block Library - 10/2019

PTC

Description of the parametersThe following table describes the output parameters:

Parameter Type CommentStop_Date ARRAY [0..4] OF

INTTable of 5 integers containing the date in the first four words (equivalent of %SW54 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) to %SW57 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual)) and the error code in the last word. The error code is the one indicated in the %SW58 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) system word: 1 = switch from RUN to STOP by the terminal, 2 = stop on software fault (PLC task overflow), 4 = mains power cut, 5 = stop on hardware fault, 6 = stop on HALT instruction.

Example: Stop at 22:53:10 on January 8, 2001. The contents of Stop_Date were as follows:Stop_Date[0]=16#1000Stop_Date[1]=16#2253Stop_Date[2]=16#0108Stop_Date[3]=16#2001Stop_Date[4]=16#0006

240 33002539 10/2019

Page 241: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertRRTC_DT33002539 10/2019

RRTC_DT: Reading the system date

Chapter 47RRTC_DT: Reading the system date

Description

Description of the functionThe RRTC_DT function captures the current date from the PLC's real-time clock, it’s the Local Time value.You have to configure at least once the PLC Time with Control Expert in the PLC Screen (tab Real-time clock).NOTE: For M580 PLCs, the system words %SW49 to %SW53 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) give the current time in UTC (Coordinated Universal Time).The additional parameters EN and ENO can be configured.

FBD representationRepresentation:

LD representationRepresentation:

33002539 10/2019 241

Page 242: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RRTC_DT

IL representationRepresentation:RRTC_DTST Result_Date

ST representationRepresentation:RRTC_DT(Result_Date);

Description of the parametersThe following table describes the output parameters:

Parameter Type CommentResult_Date DT Result_Date contains the current date value in DT

format.

242 33002539 10/2019

Page 243: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertRRTC_DT_MS33002539 10/2019

RRTC_DT_MS: Network real-time clock function

Chapter 48RRTC_DT_MS: Network real-time clock function

Description

Description of the FunctionThe RRTC_DT_MS function is used to recover the PLC date and time in UTC (Coordinated Universal Time) with a 10 ms precision. The function result will be returned by two outputs that have different format: A display format. A calculation format.NOTE: For M580 PLCs, the system words %SW49 to %SW53 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) give the date and time in UTC (Coordinated Universal Time) too. To obtain the Local Time value use the RRTC_DT (see page 241) function.

The additional parameters EN and ENO can be configured.

FBD RepresentationRepresentation:

33002539 10/2019 243

Page 244: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RRTC_DT_MS

LD RepresentationRepresentation:

IL RepresentationRepresentation:RRTC_DT_MS(Display, Calc, Status)

ST RepresentationRepresentation:RRTC_DT_MS(Display, Calc, Status);

Description of the ParametersThis table describes the output parameters:

Parameter Type CommentDisplay Display_NTPC The Display output contains the PLC date and time. The

Display_NTPC type is a predefined structure comprising a DT type element and an INT type element. This gives us: Display.DT_value containing the date, Display.Milisecond containing the number of milliseconds of

this date, as the second is the minimum measurement unit for the DT format.

Calc Calc_NTPC The Calc output contains the date and time acquired on an NTP server (as in a Display variable, only with a different format). The Calc_NTPC type is a predefined structure comprising a UDINT type element and an INT type element. This gives us: Calc.Seconds containing the number of seconds passed since

January 1, 1980, at 00:00. Calc.Fraction_Second containing the number of milliseconds to add

for the precision of the result to be around a millisecond.

244 33002539 10/2019

Page 245: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RRTC_DT_MS

Runtime errorsIf the low byte or the high byte of STATUS output is set to 0, the %S18 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) bit is set to 1 by the PLC system.

STATUS INT The low byte is managed by the CPU. When the low byte is set to 0: the clock value is not available the date and time are not updated within last two minutes

When the low byte is set to 1: the date and time are updated within the last two minutes the date and time are acceptable

If the processor is NTP client, the high byte is managed by the Ethernet module. When the high byte is set to 0, the clock value transferred to CPU is not acceptable.When the high byte is set to 1, the updated date/time received from server and sent to module is: within two minute time interval acceptable (10 ms or less error)

For a valid time in CPU, the low and high bytes of the STATUS parameter must be set to 1. If not, it generates a runtime error (below).

Parameter Type Comment

33002539 10/2019 245

Page 246: EcoStruxure™ Control Expert - System - Block Library - 10/2019

RRTC_DT_MS

246 33002539 10/2019

Page 247: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertR_NTPC33002539 10/2019

R_NTPC: Network real-time clock function

Chapter 49R_NTPC: Network real-time clock function

Description

Description of the FunctionThe R_NTPC function is available for M340, M580, Premium and Quantum PLCs. It is used to recover the date and time for an NTP server in two formats: A display format. A calculation format.NOTE: This function requires connection to an Ethernet network enabling access to an NTP (see Quantum using EcoStruxure™ Control Expert, Ethernet Network Modules, User Manual) server.The additional parameters EN and ENO can be configured.

FBD RepresentationRepresentation:

LD RepresentationRepresentation:

33002539 10/2019 247

Page 248: EcoStruxure™ Control Expert - System - Block Library - 10/2019

R_NTPC

IL RepresentationRepresentation:R_NTPC(Display, Calc, Status)

ST RepresentationRepresentation:R_NTPC(Display, Calc, Status);

Description of the ParametersThe following table describes the output parameters:

Parameter Type CommentDisplay Display_NTPC The Display output contains the date and time acquired on an NTP

server. The Display_NTPC type is a predefined structure comprising a DT type element and an INT type element. This gives us: Display.DT_value containing the date, Display.Milisecond containing the number of milliseconds of

this date, as the second is the minimum measurement unit for the DT format.

Calc Calc_NTPC The Calc output contains the date and time acquired on an NTP server (as in a Display variable, only with a different format). The Calc_NTPC type is a predefined structure comprising a UDINT type element and an INT type element. This gives us: Calc.Seconds containing the number of seconds passed since

January 1, 1980, at 00:00. Calc.Fraction_Second containing the number of milliseconds to add

for the precision of the result to be around a millisecond.STATUS INT The low byte is managed by the CPU. When the low byte is set to 0:

the clock value is not available the date and time are not updated within last two minutes

When the low byte is set to 1: the date and time are updated within the last two minutes the date and time are acceptable

If the processor is NTP client, the high byte is managed by the Ethernet module. When the high byte is set to 0, the clock value transferred to CPU is not acceptable.When the high byte is set to 1, the updated date/time received from server and sent to module is: within two minute time interval acceptable (10 ms or less error)

For a valid time in CPU, the low and high bytes of the STATUS parameter must be set to 1. If not, it generates a Runtime error, see following explanation.

248 33002539 10/2019

Page 249: EcoStruxure™ Control Expert - System - Block Library - 10/2019

R_NTPC

Runtime errorsIf the low byte or the high byte of STATUS output is set to 0, the %S18 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) bit is set to 1 by the PLC system.

33002539 10/2019 249

Page 250: EcoStruxure™ Control Expert - System - Block Library - 10/2019

R_NTPC

250 33002539 10/2019

Page 251: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSCHEDULE33002539 10/2019

SCHEDULE: Real-time clock function

Chapter 50SCHEDULE: Real-time clock function

Description

Description of the functionThe SCHEDULE function is used to control actions at pre-defined or calculated times and dates.

It sets the OUT output to 1 if the date provided by the PLC clock at the time the function is called falls within the period programmed in the input parameters.The additional parameters EN and ENO can be configured.

FBD representationRepresentation:

33002539 10/2019 251

Page 252: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SCHEDULE

LD representationRepresentation:

IL representationRepresentation:LD DBEGSCHEDULE DEND, WEEK, HBEG, HEND, Date_OK

ST representationRepresentation:SCHEDULE(DBEG, DEND, WEEK, HBEG, HEND, Date_OK);

Description of the parametersThe following table describes the input parameters:

Parameter Type CommentDBEG INT Integer coding the start date of the period (month-day) in

BCD (threshold values: 01-01 to 12-31).DEND INT Integer coding the end date of the period (month-day) in

BCD (threshold values: 01-01 to 12-31).WEEK INT Integer coding the day(s) of the week taken into account in

the period defined by the DBEG and DEND parameters.The 7 least significant bits represent the 7 days of the week: bit 6 = Monday, bit 5 = Tuesday, etc., bit 0 = Sunday.

252 33002539 10/2019

Page 253: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SCHEDULE

The following table describes the output parameters:

NOTE: The two parameters DBEG and DEND define a range of days in the year. This period may extend

over two calendar years. Example : from October 10 to April 7. February 29 may be used in this period, and will be ignored in non-leap years.

The two parameters HBEG and HEND define a range of time in the day. This range may extend over two days. Example : from 22:00 to 06:10:20.

If one of the DBEG and DEND dates, or one of the HBEG and HEND times is incorrect, (i.e. does not correspond to a real date or time) the Date_OK output will be 0 and the %S18 bit will be set to 1.

It is possible to lighten the load on the PLC processor when the requirement for precision is low by pacing calls to the SCHEDULE function via the %S6 or %S7 system bits.

HBEG DINT Double integer coding the start time of the period in the day (hours-minutes-seconds) in BCD day time format. Threshold values: 00:00:00, 23:59:59.

HEND DINT Double integer coding the end time of the period in the day (hours-minutes-seconds) in BCD day time format. Threshold values : 00:00:00, 23:59:59.

Parameter Type CommentDate_OK EBOOL The Date_OK output is set to 1 if the date provided by

the PLC clock at the time the function is called falls within the period programmed in the input parameters.

Parameter Type Comment

33002539 10/2019 253

Page 254: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SCHEDULE

ExamplesProgramming two non-continuous time ranges:

SCHEDULE (16#0501,16#1031,2#0000000001111100,16#08300000,16#12000000,Date1_OK);

(*start date: 1st May*)(*end date: October 31*)(*Monday to Friday*)(*start time: 08:30*)(*end time: 12:00*)(*result in Date1_OK*)

SCHEDULE (16#0501,16#1031,2#0000000001111100,16#14000000,16#18000000,Date2_OK);

(*start date: 1st May*)(*end date: October 31*)(*Monday to Friday*)(*start time: 14:00*)(*end time: 18:00*)(*result in Date2_OK*)

%Q0.0 :=Date1_OK OR Date2_OK; (*assignment of the output to Date1_OK or Date2_OK*)

254 33002539 10/2019

Page 255: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertT850_TO_T870 and T870_TO_T85033002539 10/2019

T850_TO_T870 and T870_TO_T870: Converting the Time Format

Chapter 51T850_TO_T870 and T870_TO_T870: Converting the Time Format

Subject of this ChapterThis chapter describes the T850_TO_T870 and T870_TO_T850 functions.

What Is in This Chapter?This chapter contains the following topics:

Topic PageT850_TO_T870 and T870_TO_T850 Elementary Functions for the 140 NOP 850 00 256T850_TO_T870 and T870_TO_T850 Elementary Functions for the BMENOP0300 258

33002539 10/2019 255

Page 256: EcoStruxure™ Control Expert - System - Block Library - 10/2019

T850_TO_T870 and T870_TO_T850

T850_TO_T870 and T870_TO_T850 Elementary Functions for the 140 NOP 850 00

IntroductionThe 140 NOP 850 00 module is a device that sends and receives data timestamped according to the IEC60870 protocol. Some Quantum ERT devices send and receive data timestamped according to the IEC 61870 protocol.To enable data transfer between devices that support different timestamp structures, you can use the following elementary functions in your program logic: T850_TO_T870: This EF takes IEC61850 timestamped data (for example, data generated by

the 140 NOP 850 00 module) and converts it to the more easily readable IEC 60870 format. T870_TO_T850: This EF takes IEC 60870 timestamped data generated by a Quantum ERT

device and converts it to the IEC61850 format where it can be used by the 140 NOP 850 00 module.

T850_TO_T870 Representation in FBDThe following graphic depicts the T850_TO_T870 function:

T850_TO_T870 Parameters:

T870_TO_T850 Representation in FBDThe following graphic depicts the T870_TO_T850 function:

Parameter Type DescriptionInput parameters:IN TIME_850_FORMAT The IEC61850 timestamp format. Output parameters:OUT TIME_870_FORMAT The IEC 60870 timestamp format.

256 33002539 10/2019

Page 257: EcoStruxure™ Control Expert - System - Block Library - 10/2019

T850_TO_T870 and T870_TO_T850

T870_TO_T850 Parameters:

Data Type Structure - TIME_850_FORMAT

Data Type Structure - TIME_870_FORMAT

Parameter Type DescriptionInput parameters:IN TIME_870_FORMAT The IEC 60870 timestamp format. Output parameters:OUT TIME_850_FORMAT The IEC61850 timestamp format.

Element Type DescriptionSeconds DWORD Seconds since 01-01-1970.

NOTE: Only dates after January 01, 2000 are valid.

Ms_Quality DWORD Milliseconds in IEC61850 format in low three bytes; highest byte manages quality.

Element Type Descriptionms WORD From 0...59999 msmin BYTE Numerical minute reference: 0...59. The highest bit

indicates time validity: 0 = valid time 1 = invalid time

hour BYTE Numerical hour reference: 0...23

NOTE: SU (summertime) is not supported.

day BYTE Numerical day reference: 1...31.

NOTE: Day of week is not supported.

mon BYTE Numerical month reference: 1...12.year BYTE Numerical year reference: 0...99.reserved BYTE <Reserved>

33002539 10/2019 257

Page 258: EcoStruxure™ Control Expert - System - Block Library - 10/2019

T850_TO_T870 and T870_TO_T850

T850_TO_T870 and T870_TO_T850 Elementary Functions for the BMENOP0300

IntroductionThe BMENOP0300 module is a device that sends and receives data timestamped according to the IEC 61850 protocol. Some Mx80 ERT devices send and receive data timestamped according to the IEC60870 protocol.To enable data transfer between devices that support different timestamp structures, you can use the following elementary functions in your program logic: T850_TO_T870: This EF takes IEC60870 timestamped data (for example, data generated by

the BMXNOR0200 module) and converts it to the more easily readable IEC 61850 format. T870_TO_T850: This EF takes IEC 61850 timestamped data generated by the BMENOP0300

module and converts it to the IEC60870 format where it can be used by other Mx80 ERT devices.

T850_TO_T870 Representation in FBDThe following graphic depicts the T850_TO_870 function:

T850_TO_T870 Parameters

Parameter Type DescriptionInput parameters:IN TIME_850_FORMAT the IEC61850 timestamp formatOutput parameters:OUT TIME_870_FORMAT the IEC 60870 timestamp format

258 33002539 10/2019

Page 259: EcoStruxure™ Control Expert - System - Block Library - 10/2019

T850_TO_T870 and T870_TO_T850

T870_TO_T850 Representation in FBDThe following graphic depicts the T870_TO_T850 function:

T870_TO_T850 Parameters

Data Type Structure: TIME_850_FORMAT

Parameter Type DescriptionInput parameters:IN TIME_870_FORMAT the IEC 60870 timestamp formatOutput parameters:OUT TIME_850_FORMAT the IEC61850 timestamp format

Element Type DescriptionSeconds DWORD seconds since 01-01-1970

NOTE: Only dates after January 01, 2000 are valid.

Ms_Quality DWORD milliseconds in IEC61850 format in low three bytes (Highest byte manages quality.)

33002539 10/2019 259

Page 260: EcoStruxure™ Control Expert - System - Block Library - 10/2019

T850_TO_T870 and T870_TO_T850

Data Type Structure: TIME_870_FORMAT

Element Type Descriptionms WORD from 0...59999 msmin BYTE Numerical minute reference: 0...59. The highest bit

indicates time validity: 0 = valid time 1 = invalid time

hour BYTE numerical hour reference: 0...23

NOTE: SU (summertime) is not supported.

day BYTE numerical day reference: 1...31.

NOTE: Day of week is not supported.

mon BYTE numerical month reference: 1...12year BYTE numerical year reference: 0...99reserved BYTE <reserved>

260 33002539 10/2019

Page 261: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertWRTC_DT33002539 10/2019

WRTC_DT: Updating the system date

Chapter 52WRTC_DT: Updating the system date

Description

Description of the functionThe WRTC_DT function updates the current date in the PLC's real-time clock.

The additional parameters EN and ENO can be configured.

FBD representationRepresentation:

LD representationRepresentation:

IL representationRepresentation:LD Date1WRTC_DT

ST representationRepresentation:WRTC_DT(Date1);

33002539 10/2019 261

Page 262: EcoStruxure™ Control Expert - System - Block Library - 10/2019

WRTC_DT

Description of the parametersThe following table describes the input parameters:

Parameter Type CommentDate1 DT Date1 must contain the current date value in DT

format. The contents of this variable must be assigned by the program before launching the function.

262 33002539 10/2019

Page 263: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSystem Specials33002539 10/2019

System Specials

Part VIIISystem Specials

OverviewThis section describes the elementary functions and elementary function blocks of the System Specials family.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page53 FORCE_BIT : Function Block 26554 IS_BIT_FORCED:Function Block 26755 IS_PAR_CON: Is Parameter Connected 26956 SET_VAL: Transfering data from one variable to another 27357 SIG_WRITE: Write a Signature 27758 SIG_CHECK: Check a Signature 28159 UNFORCE_BIT: Function Block 285

33002539 10/2019 263

Page 264: EcoStruxure™ Control Expert - System - Block Library - 10/2019

System Specials

264 33002539 10/2019

Page 265: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertFORCE_BIT33002539 10/2019

FORCE_BIT : Function Block

Chapter 53FORCE_BIT : Function Block

Description

Function descriptionThe FORCE_BIT function allows to force a boolean variable of type EBOOL to 0 or 1. If the variable is already forced to 0 (or to 1), this EF can change the forced value to 1 (or to 0) without needing to call the UNFORCE_BIT EF before.

The additional parameters EN and ENO can be configured.

NOTE: The behaviour of FORCE_BIT function depends on the state of %S79 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) system bit.NOTE: The behavior of forced outputs (%M) is different for Modsoft/NxT/Concept and Control Expert. With Modsoft/NxT/Concept you cannot force outputs when the Memory Protect switch of the

Quantum CPU is set to the "On" position.With Control Expert you can force outputs even when the Memory Protect switch of the Quantum CPU is set to the "On" position.

With Modsoft/NxT/Concept, forced outputs maintain their values following to a cold start.With Control Expert, forced outputs lose their values following to a cold start.

WARNINGUNEXPECTED VARIABLE BEHAVIOREnsure that the behavior of the forced outputs is consistent with the application.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 265

Page 266: EcoStruxure™ Control Expert - System - Block Library - 10/2019

FORCE_BIT

Representation in LDRepresentation:

Representation in FBDRepresentation:

Representation in ILRepresentation:CAL FORCE_BIT ( VARIABLE := Variable,VALUE := Value)

Representation in STRepresentation:FORCE_BIT ( VARIABLE := Variable,VALUE := Value)

Description of parametersThe following table describes the input parameters:

Parameter Type CommentVARIABLE EBOOL Variable to be forced, should be a located

EBOOL.

VALUE BOOL Forcing value

266 33002539 10/2019

Page 267: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertIS_BIT_FORCED33002539 10/2019

IS_BIT_FORCED:Function Block

Chapter 54IS_BIT_FORCED:Function Block

Description

Function descriptionThe IS_BIT_FORCED function tests if a located EBOOL variable is forced.

The additional parameters EN and ENO can be configured.

Representation in LDRepresentation:

Representation in FBDRepresentation:

Representation in ILRepresentation:CAL IS_BIT_FORCED (IN := Input)ST Output

Representation in STRepresentation:Output:= IS_BIT_FORCED(IN := Input);

33002539 10/2019 267

Page 268: EcoStruxure™ Control Expert - System - Block Library - 10/2019

IS_BIT_FORCED

Description of parametersThe following table describes the input parameter:

The following table describes the output parameter:

Parameter Type CommentInput EBOOL Variable to be tested as forced, this

variable is a located EBOOL variable.

Parameter Type CommentOutput BOOL Result:

true if Input is forced false if Input is not forced

268 33002539 10/2019

Page 269: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertIS_PAR_CON33002539 10/2019

IS_PAR_CON: Is Parameter Connected

Chapter 55IS_PAR_CON: Is Parameter Connected

IntroductionThis chapter describes the function block IS_PAR_CON.

What Is in This Chapter?This chapter contains the following topics:

Topic PageDescription 270How to Use 272

33002539 10/2019 269

Page 270: EcoStruxure™ Control Expert - System - Block Library - 10/2019

IS_PAR_CON

Description

Function descriptionThis function is used in a DFB code to know if an input parameter (pin) or an input/output parameter (pin) is connected or linked to a variable when you use an instance of this DFB.NOTE: The function is only usable inside a DFB code. It is not pertmitted to use IS_PAR_CON outside a DFB code.In the DFB code you must enter the name of the input or input/output parameters you want to check. It is not possible to enter the pin number. Please refer to Example, page 272.EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation:

Representation in LDRepresentation:

Representation in ILRepresentation:LD Pin_to_checkIS_PAR_CONST Result

Representation in STRepresentation:Result := IS_PAR_CON (Pin_to_check) ;

270 33002539 10/2019

Page 271: EcoStruxure™ Control Expert - System - Block Library - 10/2019

IS_PAR_CON

Parameter descriptionDescription of the input parameters:

Description of the output parameter:

Parameter Data type MeaningINP Any name of the parameter (DFB pin) to be checked

Parameter Data type MeaningOUTP BOOL 1: Parameter (DFB pin) is connected

0: Parameter (DFB pin) is not connected

33002539 10/2019 271

Page 272: EcoStruxure™ Control Expert - System - Block Library - 10/2019

IS_PAR_CON

How to Use

ExampleIn the example, the input parameters (pins) of the following DFB shall be checked whether they are connected or not.

In this case the code of the DFB looks as follows:(* Functional code of MY_COUNTER *)IF RE (Reset) THEN internal_value:=0;END_IF;IF RE (Count) THEN internal_value:=internal_value+1;END_IF;IF(internal_value>=Preset) THEN SET (Done);ELSE RESET (Done);END_IF;

(* Check if parameters are connected *)ResetConnected := IS_PAR_CON (Reset) ;PresetConnected := IS_PAR_CON (Preset) ;CountConnected := IS_PAR_CON (Count) ;

272 33002539 10/2019

Page 273: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSET_VAL33002539 10/2019

SET_VAL: Transfering data from one variable to another

Chapter 56SET_VAL: Transfering data from one variable to another

Description

Description of the functionThe SET_VAL function is used to transfer data form a variable to another.

Public and Private variables are accessible by the EF and the variable path is taken from the Global variables.NOTE: For a safety application, the variable path is taken from PROCESS scope according to the current location of the SET_VAL instance.

The additional parameters EN and ENO can also be configured.

OS Version RequirementTo use this EF in an application, the minimum required OS version for the CPU is:

FBD representation

Platform Minimum OS versionM340 3.20M580 3.10

33002539 10/2019 273

Page 274: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SET_VAL

LD representation

IL representationRepresentation:CAL SET_VAL (WRITE_REQ := Write, DEST := VariablePath, DATA := InputValue, ERROR => SetValError, OUT => OutputValue)

ST representationRepresentation:SET_VAL (WRITE_REQ := Write, DEST := VariablePath, DATA := InputValue, ERROR => SetValError, OUT => OutputValue);

Parameter DescriptionThe following table describes the input parameters:

Parameter Data Type SignificanceWRITE_REQ BOOL Set to 1, it writes the value from the DATA parameter to the variable

addressed by the DEST parameter and move it to the OUT parameter.Set to 0, it reads the variable value addressed by the DEST parameter and move it to the OUT parameter.

(1) with restrictions. The following data types mapped on ANY are not supported: IODDT instance, Device DDT instance, DDT instance that contains reference (REF), and ARRAY OF EBOOL, EFB and DFB.

(2) Except ARRAY

274 33002539 10/2019

Page 275: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SET_VAL

The following table describes the output parameters:

NOTE: The data types of the DATA value and OUT value, and the variable addressed by DEST value must match. The data type for DATA is checked by the EF while the data type for DEST is checked at runtime.

Project SettingsThe Data dictionary must be enabled in order that SET_VAL EF can retrieve variable definition in the PLC.Enabling the option Include DFB/PU private variables allows access to private variables.For more detailed information refer to chapter Project Settings (see EcoStruxure™ Control Expert, Operating Modes).

DEST STRING Path of the variable to be written with DATA input parameter value.Example: 'MyVar.subfield[6]'.If variable path starts with '.' character, the path is relative to the current location of the SET_VAL instance. For example when SET_VAL is used within a DFB it can access

any variable from this DFB (outputs(2), public, private, private DFB instances) with syntax .MyVar.

For example when SET_VAL is used within a Program Unit it can access any variable from this Program Unit (public, private, private DFB instances) with syntax .MyVar.

NOTE: Variable of type DDT that contains BOOL with extracted bit definition is not supported in the Data dictionary, so variable of this type will not be seen by input, and output parameters of the EF.

DATA ANY(1) Data to be written to the variable identified in the DEST input. If DATA input is not connected, the default value written is zero.

Parameter Data Type SignificanceERROR BOOL Set to 1 in case of detected error.OUT ANY(1) Provides the value of the variable specified by the DEST input at all

times.(1) with the same restrictions than DATA parameter.

Parameter Data Type Significance

(1) with restrictions. The following data types mapped on ANY are not supported: IODDT instance, Device DDT instance, DDT instance that contains reference (REF), and ARRAY OF EBOOL, EFB and DFB.

(2) Except ARRAY

33002539 10/2019 275

Page 276: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SET_VAL

Error CodesIn case of detected error during the block execution, a message is displayed in the diagnostic buffer, which indicates the application error code.The following table describes the detected application error codes:

Detected error code DescriptionAPPLICATION ERROR 1 DEST parameter is a null stringAPPLICATION ERROR 2 DEST parameter is too long (>1000 characters)APPLICATION ERROR 3 DEST and DATA Type mismatchAPPLICATION ERROR 4 Variable or field is not found in data dictionaryAPPLICATION ERROR 5 Variable path syntax errorAPPLICATION ERROR 6 Variable type is not an arrayAPPLICATION ERROR 7 Array out of boundsAPPLICATION ERROR 8 Array variable has too many subscriptsAPPLICATION ERROR 9 Array dimensions exceed the max supportedAPPLICATION ERROR 10 Extracted bit is not supported on variable typeAPPLICATION ERROR 11 Invalid extracted bit rankAPPLICATION ERROR 12 Variable is read onlyAPPLICATION ERROR 13 The data dictionary is not present in the application, enable it in the project

settingsAPPLICATION ERROR 15 Internal error with sub-code

276 33002539 10/2019

Page 277: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSIG_WRITE33002539 10/2019

SIG_WRITE: Write a Signature

Chapter 57SIG_WRITE: Write a Signature

SIG_WRITE: Write a Signature in Memory Card

Function DescriptionThe SIG_WRITE function allows writing a specific signature to a memory card BMX RM •••. An application embedding the SIG_CHECK EF only runs on a memory card that contains an expected signature.SIG_WRITE writes a signature to the memory card inserted in a BMX P34 •••• CPU. The signature consists of 8 words (16 bytes).This EF can take several tenths of milliseconds to perform a physical write to the memory card, therefore, make sure that the application can support the extra time.NOTE: %S62 is set to 1 when a card contains a signature, no matter what the value of the 8 words written.NOTE: This EF can only be used on a BMX P34 ••••, Version 2.2 or higher.

FBD RepresentationThe representation in FBD of the SIG_WRITE function (with example data) is as follows:

33002539 10/2019 277

Page 278: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SIG_WRITE

Ladder RepresentationThe representation in Ladder of the SIG_WRITE function (with example data) is as follows:

IL RepresentationThe representation in IL of the SIG_WRITE function (with example data) is as follows:

SIG_WRITE ( SIG0 := 16#45de, SIG1 := 16#78aa, SIG2 := 16#2cde, SIG3 := 16#ac3f, SIG4 := 16#5c81, SIG5 := 16#2702, SIG6 := 16#b312, SIG7 := 16#2ed4, )ST sigStat

ST RepresentationThe representation in ST of the SIG_WRITE function is as follows: STATUS:=SIG_WRITE(SIG0, SIG1, SIG2, SIG3, SIG4, SIG5, SIG6, SIG7);

278 33002539 10/2019

Page 279: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SIG_WRITE

Parameter DescriptionThe following table describes the SIG_WRITE Input parameters:

The following table describes the SIG_WRITE Output parameters:

Parameter Type CommentSIG0..SIG7 WORD 8 Words containing the signature to write into the

memory card

Parameter Type CommentSTATUS WORD Result of writing operation:

1. No detected error2. Detected error, such as no memory card or the card

is write protected

33002539 10/2019 279

Page 280: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SIG_WRITE

280 33002539 10/2019

Page 281: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSIG_CHECK33002539 10/2019

SIG_CHECK: Check a Signature

Chapter 58SIG_CHECK: Check a Signature

SIG_CHECK: Check Signature in Memory Card

Function DescriptionThe SIG_CHECK function prevents an application from running when the SD-card does not have the expected signature.The signature consists of 8 words (16 bytes). Use the SIG_WRITE (see page 277) function to write the signature to a SD-card.This EF checks a signature given as parameter against the one that is stored in the memory card BMX RM ••• inserted in the CPU.If the signature in the memory card is different, the CPU goes to the Halt state with error code 0002 in %SW125.NOTE: %S62 is set to 1 when a card contains a signature, no matter the value of the 8 words written.NOTE: This EF can only be used on a BMX P34 ••••, Version 2.2 or higher.

FBD RepresentationThe representation in FBD of the SIG_CHECK function (with example data) is as follows:

33002539 10/2019 281

Page 282: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SIG_CHECK

Ladder RepresentationThe representation in LD of the SIG_CHECK function (with example data) is as follows:

IL RepresentationThe representation in IL of the SIG_CHECK function (with example data) is as follows:

SIG_CHECK ( SIG0 := 16#45de, SIG1 := 16#78aa, SIG2 := 16#2cde, SIG3 := 16#ac3f, SIG4 := 16#5c81, SIG5 := 16#2702, SIG6 := 16#b312, SIG7 := 16#2ed4, )ST %M0

ST RepresentationThe representation in ST of the SIG_CHECK function is as follows: SIG_CHECK(SIG0, SIG1, SIG2, SIG3, SIG4, SIG5, SIG6, SIG7);

282 33002539 10/2019

Page 283: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SIG_CHECK

Parameter DescriptionThe following table describes the SIG_CHECK Input parameters:

The following table describes the SIG_CHECK Output parameters:

Parameter Type CommentSIG0..SIG7 WORD Words containing the signature to check

Parameter Type CommentOUTP BOOL TRUE if the SD card signature is equal to the input

parameters of the function and FALSE if not.

ENO BOOL Always TRUE

33002539 10/2019 283

Page 284: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SIG_CHECK

284 33002539 10/2019

Page 285: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertUNFORCE_BIT33002539 10/2019

UNFORCE_BIT: Function Block

Chapter 59UNFORCE_BIT: Function Block

Description

Function descriptionThe UNFORCE_BIT function unforces a located EBOOL variable. If the variable is not forced, this EF has not effect.The additional parameters EN and ENO can be configured.

NOTE: The behaviour of UNFORCE_BIT function depends on the state of %S79 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual) system bit.NOTE: The behavior of forced outputs (%M) is different for Modsoft/NxT/Concept and Control Expert. With Modsoft/NxT/Concept you cannot force outputs when the Memory Protect switch of the

Quantum CPU is set to the "On" position.With Control Expert you can force outputs even when the Memory Protect switch of the Quantum CPU is set to the "On" position.

With Modsoft/NxT/Concept, forced outputs maintain their values following to a cold start.With Control Expert, forced outputs lose their values following to a cold start.

Representation in LDRepresentation:

WARNINGUNEXPECTED VARIABLE BEHAVIOREnsure that the behavior of the forced outputs is consistent with the application.Failure to follow these instructions can result in death, serious injury, or equipment damage.

33002539 10/2019 285

Page 286: EcoStruxure™ Control Expert - System - Block Library - 10/2019

UNFORCE_BIT

Representation in FBDRepresentation:

Representation in ILRepresentation:CAL UNFORCE_BIT (IN := Input)

Representation in STRepresentation:UNFORCE_BIT (IN := Input);

Description of parametersThe following table describes the input parameter:

Parameter Type CommentInput EBOOL Variable to be unforced, should be a located

EBOOL.

286 33002539 10/2019

Page 287: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSCADAPack System Status33002539 10/2019

SCADAPack System Status

Part IXSCADAPack System Status

OverviewThis section describes the elementary functions and elementary function blocks of the SCADAPack System Status family.

What Is in This Part?This part contains the following chapters:

Chapter Chapter Name Page60 SYST_TIME: SCADAPack System Time 28961 SYST_READ_TASK_BIT: SCADAPack System Task Bit 29162 SYST_RESET_TASK_BIT: SCADAPack Reset Task 29363 SYST_READ_FLOAT_STATUS: Floating Operation Status 295

33002539 10/2019 287

Page 288: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SCADAPack System Status

288 33002539 10/2019

Page 289: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSYST_TIME33002539 10/2019

SYST_TIME: SCADAPack System Time

Chapter 60SYST_TIME: SCADAPack System Time

Description

Function DescriptionUse the SYST_TIME function to return the time elapsed since the completion of the most recent task cycle.EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation

Parameter DescriptionThe SYST_TIME function consists of the following parameters:

Output parameters: STB10MS STB100MS STB1S STB1MN S1MSCOUNTThis function has no input parameter.

33002539 10/2019 289

Page 290: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SYST_TIME

Output Parameters

Parameter Data Type MeaningSTB10MS BOOL TimeBase10ms. This bit toggles every 5 ms.STB100MS BOOL TimeBase100ms. This bit toggles every 50 ms.STB1S BOOL TimeBase1s. This bit toggles every 500 ms.STB1MN BOOL TimeBase1mn. This bit toggles every 30 s.S1MSCOUNT DINT msFreeCount. Free running counter with 1 ms increment.

290 33002539 10/2019

Page 291: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSYST_READ_TASK_BIT33002539 10/2019

SYST_READ_TASK_BIT: SCADAPack System Task Bit

Chapter 61SYST_READ_TASK_BIT: SCADAPack System Task Bit

Description

Function DescriptionUse the SYST_READ_TASK_BIT function to read and return the value of one of the following specified system task bits: %S17, %S18, or %S21.EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation

Parameter DescriptionThe SYST_READ_TASK_BIT function consists of the following parameters:

Input parameter: NUMOutput parameter: OUTP

Input Parameters

Parameter Data Type MeaningNUM INT Number of the system bit for the specified task: %S17, %S18, or

%S21.

33002539 10/2019 291

Page 292: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SYST_READ_TASK_BIT

Output Parameters

Parameter Data Type MeaningOUTP BOOL Value of the system bit.ENO BOOL If mapped, displays false (0) if an invalid NUM value is configured.

292 33002539 10/2019

Page 293: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSYST_RESET_TASK_BIT33002539 10/2019

SYST_RESET_TASK_BIT: SCADAPack Reset Task

Chapter 62SYST_RESET_TASK_BIT: SCADAPack Reset Task

Description

Function DescriptionUse the SYST_RESET_TASK_BIT function to set to a value of 0 to one of the following specified system task bits: %S17, %S18, or %S21.EN and ENO can be configured as additional parameters.

NOTE: Schneider Electric recommends that the EN parameter be enabled only when it is required to acknowledge the information set by the corresponding %S, which has been set to a value of 1 by the system.

Representation in FBDRepresentation

Parameter DescriptionThe SYST_RESET_TASK_BIT function consists of the following parameters:

Input parameter: NUM

Input Parameters

Parameter Data Type MeaningNUM INT Number of the system bit for the specified task to be reset: %S17,

%S18, or %S21.

33002539 10/2019 293

Page 294: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SYST_RESET_TASK_BIT

Output Parameters

Parameter Data Type MeaningENO BOOL If mapped, displays false (0) if an invalid NUM value is configured.

294 33002539 10/2019

Page 295: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertSYST_READ_FLOAT_STATUS33002539 10/2019

SYST_READ_FLOAT_STATUS: Floating Operation Status

Chapter 63SYST_READ_FLOAT_STATUS: Floating Operation Status

Description

Function DescriptionUse the SYST_READ_FLOAT_STATUS function to read %SW17 and return the status of a detected error on a floating operation.The function has no input parameter.EN and ENO can be configured as additional parameters.

Representation in FBDRepresentation

Parameter DescriptionThe SYST_READ_FLOAT_STATUS function consists of the following output parameter: OUTPThe SYST_READ_FLOAT_STATUS function includes no input parameter.

Output Parameters

Parameter Data Type MeaningOUTP WORD Status word:

bit 0 = 1 Invalid operation / result is not a number. bit 1 = 1 Denormalized operand / result is acceptable bit 2 = 1 Division by 0 / result is infinity. bit 3 = 1 Overflow / result is infinity. bit 4 = 1 Underflow / result is0. bit 5 to bit 15 not used

33002539 10/2019 295

Page 296: EcoStruxure™ Control Expert - System - Block Library - 10/2019

SYST_READ_FLOAT_STATUS

296 33002539 10/2019

Page 297: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control Expert

33002539 10/2019

Appendices

33002539 10/2019 297

Page 298: EcoStruxure™ Control Expert - System - Block Library - 10/2019

298 33002539 10/2019

Page 299: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertEFB Error Codes and Values33002539 10/2019

EFB Error Codes and Values

Appendix AEFB Error Codes and Values

IntroductionThe following tables show the error codes and error values created for the EFBs of the Library.

What Is in This Chapter?This chapter contains the following topics:

Topic PageCommon Floating Point Errors 300Error Codes of EFBs with STATUS parameter 301Details of STATUS error code from 31ss to 37ss 304Details of EFB TCP/IP Ethernet Error Codes 5mss 311Details of EFB Modbus Plus Error Codes 6mss 315Quantum EFB SY/MAX Specific Error Codes 316EtherNet/IP Detected Error Codes 318

33002539 10/2019 299

Page 300: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Common Floating Point Errors

IntroductionThe following table shows the common error codes and error values created for floating point errors. These error information are displayed in the Diagnostic Viewer and the error code values are written in %SW125 (see EcoStruxure™ Control Expert, System Bits and Words, Reference Manual).

Common Floating Point ErrorsTable of common floating point errors

Error codes Error value in Dec

Error value in Hex

Error description

FP_ERROR -30150 16#8A3A Base value (not apearing as an error value)E_FP_STATUS_FAILED_IE -30151 16#8A39 Illegal floating point operationE_FP_STATUS_FAILED_DE -30152 16#8A38 Operand is denormalized - not a valid REAL

numberE_FP_STATUS_FAILED_ZE -30154 16#8A36 Illegal divide by zeroE_FP_STATUS_FAILED_ZE_IE -30155 16#8A35 Illegal floating point operation / Divide by zeroE_FP_STATUS_FAILED_OE -30158 16#8A32 Floating point overflowE_FP_STATUS_FAILED_OE_IE -30159 16#8A31 Illegal floating point operation / OverflowE_FP_STATUS_FAILED_OE_ZE -30162 16#8A2E Floating point overflow / Divide by zeroE_FP_STATUS_FAILED_OE_ZE_IE -30163 16#8A2D Illegal floating point operation / Overflow /

Divide by zeroE_FP_NOT_COMPARABLE -30166 16#8A2A Internal error

300 33002539 10/2019

Page 301: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Error Codes of EFBs with STATUS parameter

Form of the Function Error CodeSTATUS parameter error codes appear as Mmss, where: M is the high code m is the low code ss is a subcode

Common Error CodesHexadecimal error codes description:

Hex. Error Code

Description

1001 Abort by user.1002 Warm Start initiated abort.2001 An operation type that is not supported has been specified in the control block.2002 One or more control block parameters were modified while the MSTR element was active (this

only applies to operations which require several cycles for completion). Control block parameters may only be modified in inactive MSTR components.

2003 Invalid value in the length field of the control block.2004 Invalid value in the offset field of the control block.2005 Invalid value in the length and offset fields of the control block.2006 Unauthorized data field on slave.2007 Unauthorized network field on slave.2008 Unauthorized network routing path on slave.2009 Routing path equivalent to their own address.200A Attempt to get more global data words than available.200B Peer cop conflict on WR/RD global.200C Bad pattern for change address request.200D Bad address for change address request.200E The control block or data buffer is not assigned, or (incorrect size, parts of the control block

or data buffer are located outside of the %MW (4x) range.200F Space for response in data buffer is too small.2010 Control buffer length invalid.2011 Invalid parameter.2012 Syntax error in “rail.slot.chan” string.2013 Module missing, not detected, or not configured.2015 No channel data (channel out of bound).

33002539 10/2019 301

Page 302: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

2016 Abort on timeout.2017 Invalid task context.2018 Ethernet security system service error.2019 Invalid answer data (received data do not correspond to the expected answer).201A Invalid answer checksum.201B Compatibility issue (for example, EF or DDT version not compatible with firmware version).30ss Exceptional response by the Modbus slave with specific ss exception code (see page 303).31ss Exceptional Control Expert protocol error response by the Modbus slave with specific ss

error code (see page 304).32ss Exceptional Control Expert protocol IO request error acknowledgement by the Modbus slave

with specific ss error code (see page 305).33ss UNI-TE specific report.34ss Generic communication report (see page 306) (correspond to Communication Report field of

Premium/M340 EF Management Parameters).35ss Generic Operation Report in case of correct exchange (see page 307) (correspond to

Operation Report field of Premium/M340 EF Management Parameters when Communication Report = 16#00).

36ss Generic Operation Report in case of refused message (see page 307) (correspond to Operation Report field of Premium/M340 EF Management Parameters when Communication Report = 16#FF).

37ss CIP General Status Code. (see page 308)4001 Inconsistent response by the Modbus slave.4002 Inconsistent Modbus Umas response.4003 Inconsistent UNI-TE response (depending on the module).4004 Read request for the status words not accepted by the module channel.4005 Command parameters not accepted by the module channel.4006 Adjustment parameters not accepted by the module.4007 SDO abort code (4 bytes) may be found in data field if data field is available.5mss TCP/IP Ethernet specific error codes (see page 311).6mss Modbus Plus specific routing path error (see page 315).

The subfield m shows where the error occurred (a 0 value means local node, 2 means 2nd device in route, and so on).

7mss SY/MAX specific error codes (see page 316).8mss EtherNet/IP detected error codes (see page 318).

Hex. Error Code

Description

302 33002539 10/2019

Page 303: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Modbus Specific Exception Function Codes (30ss)This table lists the ss hexadecimal values in 30ss error codes:

The ss value corresponds to the Modbus Exception code returned by the Modbus slave device in case of error (second byte of the Modbus exception PDU): exception-function_code = request function code + 0x80: 1 byte exception_code: 1 byte (returned as ss in 16#30ss error code

F001 Wrong destination node was specified for the MSTR operation. Referenced S985 option not present or in reset mode.

F002 Component not fully initialized.

Hex. Error Code

Description

Hex. Error Code

Description

3001 Slave does not support requested operation.3002 Non-existing slave registers were requested.3003 An unauthorized data value was requested.3004 Unrecoverable error detected in the slave.3005 Slave has accepted a lengthy program command.3006 Function cannot currently be carried out: lengthy command running.3007 Slave has rejected lengthy program command.300A Gateway unable to allocate an internal communication path.300B No response obtained from target device.30FF Modbus extended exception. Additional data available in data field (if data field provided):

Exception length: represents the length of the extended exception response, not including these 2 bytes.

Exception data: error information specific to the function code involved.

33002539 10/2019 303

Page 304: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Details of STATUS error code from 31ss to 37ss

Control Expert Protocol Error Codes (31ss)This table lists the ss hexadecimal value in 31ss error code:

Hex. Error Code

Description

3100 Generic Control Expert Protocol error.3180 Generic communication error.3181 PLC is reserved by someone else.3182 You must reserve the PLC.3183 Unknown request or subcode.3184 Unknown object (for example: %Z not implemented).3185 The response could not be built.3186 Request has invalid parameters (for example: the request is badly built, or has few/many

parameters or has a bad Csa command, and so on.)3187 Bad sequence (for example: EndDownload executed before BeginDownload).3188 The size of the response exceed the size of the available buffer.3189 Module not configured (may be bad address).318A Action is not permitted on this object.318B Busy state: the previous operation is still working, or all internal resources are busy for the

I/O request, or too much parallel upload, and so on.3190 Generic error: something wrong in application.3191 Access violation: write read-only block, or read-only variable, or download while memory is

protected, and so on.3192 Object not accessible because it is in use.3193 Out of bounds: exceeds the range of %MW, or too many breakpoints, or call stack too large,

and so on.3194 Invalid length.3195 Reference to a non-existent resource or task, or variable address is not in the DFB data area,

and so on.3196 The object or resource is already defined. For example: trying to start an already started, or

a breakpoint-ID already used, and so on.3197 Data inconsistent or data state not allowed. For example: wrong data or bad value when

writing an object.3198 The object exists but is not initialized.3199 Channel out of bounds in an I/O request.319A Request not yet implemented.

304 33002539 10/2019

Page 305: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Control Expert Protocol IO Request Error Acknowledgement (32ss)This tables lists the ss hexadecimal values in 32ss error code:

31A0 Incompatible application, wrong target, or platform.31A1 Signature check failed.31A2 Wrong PCMCIA memory configuration.31B0 PLC is not in the right mode: download with PLC in RUN mode, or debug while PLC in

NOCONF, try to step a task, not break-pointed, upload operation aborted by download or OnlineChange, and so on.

31B1 Mode cannot be changed: an I/O forces premium to stop.31B2 An internal timeout occurred.31B3 The watchdog time is elapsed.31FF Undefined general error.

Hex. Error Code

Description

Hex. Error Code

Description

3202 Exchange error.3207 Another explicit exchange is in progress.3209 Operation is impossible.320A Data is rejected by the IOB.320B Writing is not authorized.320C Maximum number of exchanges.3284 Unknown object.3286 Invalid read buffer.328A Unknown or invalid action.328B All the buffers are in use.3293 Object out of range.3297 Object value forbidden (write operations only).3299 Channel out of range.

33002539 10/2019 305

Page 306: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Generic Communication Report (34ss)This table lists the ss hexadecimal value in 34ss error code:

The ss value corresponds to the Communication Report code (see EcoStruxure™ Control Expert, Communication, Block Library) returned by existing communications EFs on Premium/Atrium/Mxxx platforms.

Hex. Error Code

Description

3401 Exchange stop on timeout.3402 Exchange stop on user request (CANCEL).

3403 Incorrect address format.3404 Incorrect destination address3405 Incorrect management parameter format.3406 Incorrect specific parameters.3407 Error detected in sending to the destination.3409 Reserved.340A Insufficient receive buffer size.340B No processor system resources.340C Incorrect exchange number.340D No telegram received.340E Incorrect length.340F Telegram service not configured.3410 Network module missing.3411 Request missing.3412 Application server already active.3413 UNI-TE V2 transaction number incorrect.

306 33002539 10/2019

Page 307: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Generic Operation Report (35ss and 36ss)This report byte is specific to each function and specifies the result of the operation on the remote application.Generic operation report in case of correct exchange is coded under the form 16#35ss. If the message is refused by the remote device, the report has the form 16#36ss.This table lists the ss hexadecimal value in 35ss error code:

The ss value in 35ss codes corresponds to operation report field of Premium/M340 EF Management Parameters when Communication Report (see EcoStruxure™ Control Expert, Communication, Block Library)= 16#00.This table lists the ss hexadecimal value in 36ss error code:

Hex. Error Code

Description

3501 Request not processed.3502 Incorrect response.

Hex. Error Code

Description

3601 No resources towards the processor.3602 No line resources.3603 No device or device without resources.3604 Line error.3605 Length error.3606 Faulty communication channel.3607 Addressing error.3608 Application error.360B No system resources.360C Communication function not active.360D Destination missing.360F Intra-station routing problem or channel not configured.3611 Address format not managed.3612 No destination resources.3614 Non-operational connection (example: Ethernet TCP/IP).3615 No resource on the local channel.3616 Access not authorized (example: Ethernet TCP/IP).3617 Inconsistent network configuration (example: Ethernet TCP/IP).3618 Connection temporarily unavailable.

33002539 10/2019 307

Page 308: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

The ss value in 36ss codes corresponds to operation report field of Premium/M340 EF Management Parameters when Communication Report (see EcoStruxure™ Control Expert, Communication, Block Library)= 16#FF.

CIP General Status Code (37ss)The following table lists the status codes that may be present in the general status code field of a detected CIP error response message:

3621 Application server stopped.3630 Transmission error.

Hex. Error Code

Description

General Status Code (in hex)

Status Name Description of Status

3701 Connection unsuccessful A connection-related service was unsuccessful along the connection path.

3702 Resource unavailable Resources needed for the object to perform the requested service were unavailable.

3703 Invalid parameter value See status code 0x20, which is the preferred value to use for this condition.

3704 Path segment error The path segment identifier or the segment syntax was not understood by the processing node. Path processing stops when a path segment error is detected.

3705 Path destination unknown The path is referencing an object class, instance, or structure element that is not known or is not contained in the processing node. Path processing stops when a path destination unknown error is detected.

3706 Partial transfer Only part of the expected data was transferred.3707 Connection lost The messaging connection was lost.3708 Service not supported The requested service was not implemented or was not defined for

this object class/instance.3709 Invalid attribute value Invalid attribute data detected.370A Attribute list error An attribute in the Get_Attribute_List or

Set_Attribute_List response has a non-zero status.

370B Already in requested mode/state

The object is already in the mode/state being requested by the service.

370C Object state conflict The object cannot perform the requested service in its current mode/state.

370D Object already exists The requested instance of object to be created already exists.

308 33002539 10/2019

Page 309: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

370E Attribute not settable A request to modify a non-modifiable attribute was received.370F Privilege violation A permission/privilege check was unsuccessful.3710 Device state conflict The mode/state of the device prohibits the execution of the

requested service.3711 Reply data too large The data to be transmitted in the response buffer is larger than the

allocated response buffer.3712 Fragmentation of a primitive

valueThe service specified an operation that is going to fragment a primitive data value, that is, half a REAL data type.

3713 Not enough data The service did not supply enough data to perform the specified operation.

3714 Attribute not supported The attribute specified in the request is not supported.3715 Too much data The service supplied more data than was expected.3716 Object does not exist The object specified does not exist in the device.3717 Service fragmentation

sequence not in progressThe fragmentation sequence for this service is not currently active for this data.

3718 No stored attribute data The attribute data of this object was not saved prior to the requested service.

3719 Store operation unsuccessful The attribute data of this object was not saved due to an unsuccessful attempt.

371A Routing unsuccessful, request packet too large

The service request package was too large for transmission on a network in the path to the destination. The routing device was forced to abort the service.

371B Routing unsuccessful, response packet too large

The service response packet was too large for transmission on a network in the path from the destination. The routing device was forced to abort the service.

371C Missing attribute list entry data The service did not supply an attribute in a list of attributes that was needed by the service to perform the requested behavior.

371D Invalid attribute value list The service is returning the list of attributes supplied with status information for those attributes that were invalid.

371E Embedded service error An embedded service resulted in a detected error.371F Vendor-specific error A vendor-specific error has been detected. The additional code field

of the error response defines the particular error encountered. Use this general code only when none of the codes presented in this table or within an object class definition accurately reflect the detected error.

General Status Code (in hex)

Status Name Description of Status

33002539 10/2019 309

Page 310: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

NOTE: Taken by permission from The CIP Networks Library, Volume 1, Common Industrial Protocol (CIP™), Edition 3.6, April 2009.

3720 Invalid parameter A parameter associated with the request was invalid. This code is used when a parameter does not meet the requirements of this specification and/or the requirements defined in an application object specification.

3721 Write-once value or medium already written

An attempt was made to write to a write-once medium (for example, WORM drive, PROM) that has already been written, or to modify a value that cannot be changed once established.

3722 Invalid reply received An invalid reply is received (for example, reply service code does not match the request service code, or reply message is shorter than the minimum expected reply size). This status code a serve for other causes of invalid replies.

3723 Buffer overflow The message received is larger than the receiving buffer can handle. The entire message was discarded.

3724 Message-format error The format of the received message is not supported by the server.3725 Key failure in path The key segment that was included as the first segment in the path

does not match the destination module. The object-specific status indicates which part of the key check was unsuccessful.

3726 Path size invalid The size of the path that was sent with the service request is either not large enough to allow the request to be routed to an object or too much routing data was included.

3727 Unexpected attribute in list An attempt was made to set an attribute that is not able to be set at this time.

3728 Invalid member ID The member ID specified in the request does not exist in the specified class/instance/attribute.

3729 Member not settable A request to modify a non-modifiable member was received.372A Group 2 only server — general

errorThis detected error code may only be reported by DeviceNet group 2 only servers with 4 Kb or less code space and only in place of service not supported, attribute not support, or attribute not settable.

372B Unknown Modbus error A CIP to Modbus translator received an unknown Modbus exception code.

372C Attribute not gettable A request to read a non-readable attribute was received.372D...37CF – Reserved by CIP for future extensions.37D0...37FF Reserved for object class and

service errorsThis range of detected error codes is used to indicate object class-specific detected errors. Use this range only when none of the codes presented in this table accurately reflect the error that is detected.

General Status Code (in hex)

Status Name Description of Status

310 33002539 10/2019

Page 311: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Details of EFB TCP/IP Ethernet Error Codes 5mss

TCP/IP Ethernet Network Specific Error Codes (5mss)NOTE: Ethernet errors are managed by the Ethernet modules or the Ethernet coprocessor except for error code 5050 (hex).

Hex. Error Code

Meaning

5001 Inconsistent response by the network5004 Interrupted system call5005 I/O error5006 No such address5009 Socket descriptor is invalid500C Not enough memory500D Authorization denied5011 Entry exists5016 Argument is invalid5017 Internal table has run out of space5020 Connection is lost5023 This operation was blocked and the socket is non-blocking5024 The socket is non-blocking and the connection can not be closed5025 The socket is non-blocking and a previous connection attempt has not been

finalized5026 Socket operation performed on a non-socket5027 The destination address is not valid5028 Message too long5029 Wrong type of protocol for the socket502A Protocol not available502B Protocol not supported502C Socket type not supported502D Operation not supported on a socket502E Protocol family not supported502F Address family not supported5030 Address already in use5031 Address not available5032 Network is out of order

33002539 10/2019 311

Page 312: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

NOTE: Error code 5055 (hex) can occur before an error code 503C (hex). No remote device takes precedence over a timeout.

5033 Network is unreachable5034 Network dropped connection on reset5035 Connection aborted by the peer5036 Connection reset by the peer5037 An internal buffer is required but can not be assigned5038 Socket already connected5039 Socket not connected503A Cannot send after socket shutdown503B Too many references, cannot splice503C Connection timed out (see note below)503D Connection refused5040 Host is out of order5041 The destination host could not be reached from this node5042 Directory not empty5046 NI_INIT returned ‘-1’5047 MTU is not valid5048 Hardware length is not valid5049 Route specified cannot be found504A Collision in Select call: these conditions have already been selected by

another task504B Task ID is invalid5050 No network resource5051 Length error5052 Addressing error5053 Application error5054 Client can not process the request5055 No network resource5056 Non-operational TCP connection5057 Incoherent configuration51ss SMTP service error codes (see page 313)53ss Modbus client service error codes (see page 314)

Hex. Error Code

Meaning

312 33002539 10/2019

Page 313: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

SMTP Service Error Codes (51ss)Hexadecimal SMTP service error codes:

Hex. Error Code

Meaning

5100 Internal error5101 SMTP component not operational5102 Mail header not configured5103 Invalid mail header value5104 Cannot connect to the SMTP server5105 Error in transmitting content of email body to the SMTP server5106 Closing SMTP connection with the server returned an error5107 SMTP HELO request failed5108 SMTP MAIL request failed. SMTP server may require authentication5109 SMTP RCPT request failed510A No recipient has been accepted by the SMTP server510B SMTP DATA request failed510C Send email request contains an invalid length510D Authentication failed510E A reset component request has been received while the connection was

open

33002539 10/2019 313

Page 314: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Modbus Client Service Error Codes (53ss)Hexadecimal Modbus client service error codes:

Hex. Error Code

Meaning

5300 Not used (reserved for future use)5301 The component has run out of resources5302 The IP address provided is not appropriate. For example: 0.0.0.0, or

broadcast address, or multicast address, etc.5303 The transaction has timed-out. The remote server accepted a request and

has not answered within 2 minutes.5304 All connections are currently used5305 Access denied5306 Network can not be reached5307 Host is down5308 Network dropped connection on reset5309 Network is down530A Connection refused530B Connection timed out530C Wrong MBAP header

314 33002539 10/2019

Page 315: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Details of EFB Modbus Plus Error Codes 6mss

Modbus Plus Specific Error Codes (6mss)NOTE: The m field in 6mss error code is an Index in the routing information that shows where an error has been detected. m = 0 means that the error has been detected in the local node, m = 2 means it has been detected in the second device in the route, and so on.

Hex. Error Code Description6m01 No response reception6m02 Access to program denied6m03 Node out of service and unable to communicate6m04 Unusual response received6m05 Router-node data path busy6m06 Slave out of order6m07 Wrong destination address6m08 Unauthorized node type in routing path6m10 Slave has rejected the command6m20 Slave has lost an activated transaction6m40 Unexpected master output path received6m80 Unexpected response receivedF001 Wrong destination node was specified for the MSTR operation

33002539 10/2019 315

Page 316: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

Quantum EFB SY/MAX Specific Error Codes

SY/MAX-Specific Error CodesWhen using SY/MAX Ethernet, three additional types of errors may appear in the CONTROL[1] register of the control block. The error codes have the following meaning: 71xx Error: Errors found by the SY/MAX remote device 72xx Error: Errors found by the server 73xx Error: Errors found by the Quantum translator

SY/MAX-Specific Hexadecimal Error CodesSY/MAX-specific hexadecimal error codes:

Hex. Error Code

Description

7101 Invalid opcode found by the SY/MAX remote device7103 Invalid address found by the SY/MAX remote device7109 Attempt to write to a write protected register found by the SY/MAX remote

deviceF710 Receiver overflow found by the SY/MAX remote device7110 Invalid length found by the SY/MAX remote device7111 Remote device not active, no connection (occurs when retry attempts and

time-out have been used up), found by the SY/MAX remote device7113 Invalid parameter in a read operation found by the SY/MAX remote device711D Invalid route found by the SY/MAX remote device7149 Invalid parameter in a write operation found by the SY/MAX remote device714B Invalid drop number found by the SY/MAX remote device7101 Invalid opcode found by the SY/MAX server7203 Invalid address found by the SY/MAX server7209 Attempt to write to a write protected register found by the SY/MAX serverF720 Receiver overflow found by the SY/MAX server7210 Invalid length found by the SY/MAX server7211 Remote device not active, no connection (occurs when retry attempts and

time-out have been used up), found by the SY/MAX server7213 Invalid parameter in a read operation found by the SY/MAX server721D Invalid route found by the SY/MAX server7249 Invalid parameter in a write operation found by the SY/MAX server724B Invalid drop number found by the SY/MAX server

316 33002539 10/2019

Page 317: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

7301 Invalid opcode in an MSTR block request from the Quantum translator

7303 Read/Write QSE module status (200 route address out of range)7309 Attempt to write to a write protected register when a status write is carried

out (200 route)731D Invalid route found by the Quantum translator.

Valid routes: dest_drop, 0xFF 200, dest_drop, 0xFF 100+drop, dest_drop, 0xFF All other routing values produce an error

734B One of the following errors occurred: No CTE (configuration extension table) has been configured No CTE table entry has been made for the QSE model slot number No valid drop has been specified The QSE module has not been reset after the creation of the CTE.

Note: After writing and configuring the CTE and downloading to the QSE module, the QSE module must be reset for the modifications to become effective.

When using an MSTR instruction no valid slot or drop has been specified

Hex. Error Code

Description

33002539 10/2019 317

Page 318: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

EtherNet/IP Detected Error Codes

EtherNet/IP Detected Error CodesEtherNet/IP hexadecimal detected error codes include:

Detected Error Code (hex)

Description

800D Timeout on the explicit message request8012 Bad device8015 Either:

Nor resources to handle the message, or Internal detected error: no buffer available, no link available, impossible to send to the

TCP task8018 Either:

Another explicit message for this device is in progress, or TCP connection or encapsulation session in progress

8030 Timeout on the Forward_Open requestNote: The following 81xx detected errors are Forward_Open response detected errors that originate at the remote target and are received via the CIP connection.8100 Connection in use or duplicate Forward_Open8103 Transport class and trigger combination not supported8106 Ownership conflict8107 Target connection not found8108 Invalid network connection parameter8109 Invalid connection size8110 Target for connection not configured8111 RPI not supported8113 Out of connections8114 Vendor ID or product code mismatch8115 Product type mismatch8116 Revision mismatch8117 Invalid produced or consumed application path8118 Invalid or inconsistent configuration application path8119 Non-Listen Only connection not opened811A Target object out of connections811B RPI is smaller than the production inhibit time8123 Connection timed out8124 Unconnected request timed out

318 33002539 10/2019

Page 319: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

8125 Parameter detected error in unconnected request and service8126 Message too large for unconnected_send service8127 Unconnected acknowledge without reply8131 No buffer memory available8132 Network bandwidth not available for data8133 No consumed connection ID filter available8134 Not configured to send scheduled priority data8135 Schedule signature mismatch8136 Schedule signature validation not possible8141 Port not available8142 Link address not valid8145 Invalid segment in connection path8146 Detected error in Forward_Close service connection path8147 Scheduling not specified8148 Link address to self invalid8149 Secondary resources unavailable814A Rack connection already established814B Module connection already established814C Miscellaneous814D Redundant connection mismatch814E No more user-configurable link consumer resources: the configured number of resources for

a producing application has reached the limit814F No more user-configurable link consumer resources: there are no consumers configured for

a producing application to use8160 Vendor specific8170 No target application data available8171 No originator application data available8173 Not configured for off-subnet multicast81A0 Detected error in data assignment81B0 Optional object state detected error81C0 Optional device state detected errorNote: All 82xx detected errors are register session response detected errors.

Detected Error Code (hex)

Description

33002539 10/2019 319

Page 320: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EFB Error Codes and Values

8200 Target device does not have sufficient resources8208 Target device does not recognize message encapsulation header820F Reserved or unknown detected error from target

Detected Error Code (hex)

Description

320 33002539 10/2019

Page 321: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertGlossary33002539 10/2019

Glossary

AANY

There is a hierarchy among the various data types. In the DFBs, it is sometimes possible to declare variables that can contain several types of values. In that case we use ANY_xxx types.

The figure below describes this hierarchical structure:

BBOOL

BOOL is the abbreviation for the Boolean type. This is the basic data type in computing. A BOOL variable can have either of the following two values: 0 (FALSE) or 1 (TRUE).

A bit extracted from a word is of type BOOL, for example: %MW10.4.

33002539 10/2019 321

Page 322: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Glossary

BYTEWhen 8 bits are grouped together, they are called a BYTE. You can enter a BYTE either in binary mode or in base 8.The BYTE type is encoded in an 8 bit format which, in hexadecimal format, ranges from 16#00 to 16#FF.

DDATE_AND_TIME

See DT.

DDTDDT is the abbreviation of Derived Data Type.A derived data type is a set of elements with the same type (ARRAY) or with different types (structure).

DINTDINT is the abbreviation of Double INTeger (encoded in 32 bits).

The upper/lower limits are as follows: -(2 to the power of 31) to (2 to the power of 31) - 1.Example:-2147483648, 2147483647, 16#FFFFFFFF.

322 33002539 10/2019

Page 323: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Glossary

DTDT is the abbreviation of Date and Time.

The DT type, encoded in BCD in a 64 bit format, contains the following information:

the year encoded in a 16 bit field; the month encoded in an 8 bit field; the day encoded in an 8 bit field; the time encoded in an 8 bit field; the minutes encoded in an 8 bit field; the seconds encoded in an 8 bit field.NOTE: The 8 least significant bits are not used.The DT type must be entered as follows:

DT#<Year>-<Month>-<Day>-<Hour>:<Minutes>:<Seconds>This table shows the upper/lower limits of each field:

EEBOOL

EBOOL is the abbreviation of Extended BOOLean. An EBOOL type has a value (0 (FALSE) or 1 (TRUE), but also rising or falling edges and forcing functions.

An EBOOL variable occupies one byte in memory.

The byte contains the following information: one bit for the value; one bit for the history (whenever the object changes state, the value is copied to the history bit); one bit for forcing (equal to 0 if the object is not forced, or 1 if the bit is forced).The default value of each bit is 0 (FALSE).

Field Limits CommentYear [1990,2099] YearMonth [01,12] The leading 0 is displayed; it can be omitted during data entry.Day [01,31] For months 01/03/05/07/08/10/12

[01,30] For months 04/06/09/11[01,29] For month 02 (leap years)[01,28] For month 02 (non-leap years)

Hour [00,23] The leading 0 is displayed; it can be omitted during data entry.Minute [00,59] The leading 0 is displayed; it can be omitted during data entry.Second [00,59] The leading 0 is displayed; it can be omitted during data entry.

33002539 10/2019 323

Page 324: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Glossary

ENEN stands for ENable; it is an optional block input. When the EN input is enabled, an ENO output is set automatically. If EN = 0, the block is not enabled; its internal program is not executed, and ENO is set to 0.

If EN = 1, the block's internal program is run and ENO is set to 1. If an error occurs, ENO is set to 0.

If the EN input is not connected, it is set automatically to 1.

ENOENO stands for Error NOtification; this is the output associated with the optional input EN.

If ENO is set to 0 (because EN = 0 or in case of an execution error): the status of the function block outputs remains the same as it was during the previous scanning

cycle that executed correctly; the output(s) of the function, as well as the procedures, are set to "0".

FFBD

FBD is the abbreviation of Function Block Diagram. FBD is a graphical programming language that works like a flowchart. By adding simple logical blocks (AND, OR, etc.), each function or function block in the program is represented in this graphical format. For each block, the inputs are on the left and the outputs on the right. Block outputs can be linked to inputs of other blocks in order to create complex expressions.

IIL

IL is the abbreviation of Instruction List.This language is a series of basic instructions. It is very close to assembly language used to program processors.Each instruction is made up of an instruction code and an operand.

INTINT is the abbreviation of single INTeger (encoded in 16 bits).

The upper/lower limits are as follows: -(2 to the power of 15) to (2 to the power of 15) - 1.Example:-32768, 32767, 2#1111110001001001, 16#9FA4.

324 33002539 10/2019

Page 325: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Glossary

LLD

LD is the abbreviation of Ladder Diagram. LD is a programming language that represents instructions to be executed as graphical diagrams very similar to electrical diagrams (contacts, coils, etc.).

MMultitoken

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

SST

ST is the abbreviation of Structured Text.The structured literal language is a developed language similar to computer programming languages. It can be used to organize a series of instructions.

STRINGA STRING variable is a series of ASCII characters. The maximum length of a string is 65,534 characters.

TTIME

The TIME type expresses a time in milliseconds. Encoded in 32 bits, this type can be used to obtain times from 0 to 2 32-1 milliseconds.The TIME type has the following units: days (d), hours (h), minutes (m), seconds (s) and milliseconds (ms). A literal value of type TIME is represented by a combination of the preceding types prefixed with T#, t#, TIME# or time#.

Examples: T#25h15m, t#14,7S, TIME#5d10h23m45s3ms

33002539 10/2019 325

Page 326: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Glossary

UUDINT

UDINT is the abbreviation of Unsigned Double INTeger (encoded in 32 bits). The upper/lower limits are as follows: 0 to (2 to the power of 32) - 1.Example:0, 4294967295, 2#11111111111111111111111111111111, 8#37777777777, 16#FFFFFFFF.

UINTUINT is the abbreviation of the Unsigned INTeger format (encoded in 16 bits). The upper/lower limits are as follows: 0 to (2 to the power of 16) - 1.Example:0, 65535, 2#1111111111111111, 8#177777, 16#FFFF.

WWORD

The type WORD is encoded in a 16 bit format and is used to perform processing on series of bits.

This table shows the upper/lower limits of each of the bases that can be used:

Examples of representation

Base Lower limit Upper limitHexadecimal 16#0 16#FFFFOctal 8#0 8#177777Binary 2#0 2#1111111111111111

Data Representation in one of the bases0000000011010011 16#D31010101010101010 8#1252520000000011010011 2#11010011

326 33002539 10/2019

Page 327: EcoStruxure™ Control Expert - System - Block Library - 10/2019

EcoStruxure™ Control ExpertIndex33002539 10/2019

Index

Aavailability of the instructions, 27

CCLEARCHART, 159CLOSE_FILE, 65convert external events to NOP - instructions

NOP850_EVTS, 227convert time format - instructions

T850_TO_T870, 255T870_TO_T850, 255

CREATE_FILE, 41

DDELETE_FILE, 67

Eelementary function

T850, 258T850_TO_T870, 256, 258T870_TO_T850, 256

elementary function blockNOP850_EVTS, 228, 234

33002539 10/2019

error codes, 299CREAD_REG, 301CWRITE_REG, 301EXCH_QX, 301GET_TS_EVT_M, 301GET_TS_EVT_Q, 301INPUT_CHAR_QX, 301PRINT_CHAR_QX, 301PWS_CMD, 301PWS_DIAG, 301READ_PARAM_MX, 301READ_REG, 301READ_REG_QX, 301READ_SDO, 301READ_STS_MX, 301READ_STS_QX, 301RESTORE_PARAM_MX, 301SAVE_PARAM_MX, 301WRITE_PARAM_MX, 301WRITE_REG, 301WRITE_REG_QX, 301WRITE_SDO, 301

event management - instructionsHALT, 107ITCNTRL, 109MASKEVT, 113UNMASKEVT, 115

327

Page 328: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Index

Ffile management - instructions

CLOSE_FILE, 65CREATE_FILE, 41DELETE_FILE, 67general information, 31GET_FILE_INFO, 51GET_FREESIZE, 55OPEN_FILE, 45RD_FILE_TO_DATA, 63SEEK_FILE, 57SET_FILE_ATTRIBUTES, 49WR_DATA_TO_FILE, 61

FORCE_BIT, 265FREERUN, 209FREEZECHART, 163

GGET_FILE_INFO, 51GET_FREESIZE, 55GET_TS_EVT_M, 211

time stamping, 211GET_TS_EVT_Q, 219

time stamping, 219

HHALT, 107hot standby - instructions

HSBY_BUILD_OFFLINE, 119HSBY_RD, 121HSBY_ST, 125HSBY_SWAP, 129HSBY_WR, 135REV_XFER, 139

HSBY_BUILD_OFFLINE, 119HSBY_RD, 121, 121HSBY_ST, 125, 125HSBY_SWAP, 129HSBY_WR, 135, 135

328

IINITCHART, 167instructions

availability, 27IS_BIT_FORCED, 267IS_PAR_CON, 269ITCNTRL, 109

MMASKEVT, 113memory card management function

SIG_CHECK, 281SIG_WRITE, 277

NNOP850_EVTS, 227, 228, 234

OOPEN_FILE, 45

PPCMCIA card - instructions

READ_U_PCMCIA, 87WRITE_U_PCMCIA, 83

power supply management - instructionsPWS_CMD, 153PWS_DIAG, 145

PRJ_VERS, 101Project Version

PRJ_VERS, 101PTC, 239PWS_CMD, 153PWS_CMD_DDT, 156PWS_DIAG, 145PWS_DIAG_DDT, 148PWS_DIAG_DDT_V2, 148

RR_NTPC, 247

33002539 10/2019

Page 329: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Index

RD_FILE_TO_DATA, 63Read Variable from PCMCIA Card

READ_V_PCMCIA, 97READ_U_PCMCIA, 87, 91READ_V_PCMCIA, 97RESETSTEP, 171REV_XFER, 139, 139RRTC_DT, 241RRTC_DT_MS, 243

SSCADAPack System Status

SYST_READ_FLOAT_STATUS, 295SYST_READ_TASK_BIT, 291SYST_RESET_TASK_BIT, 293SYST_TIME, 289

SCHEDULE, 251SEEK_FILE, 57SET_FILE_ATTRIBUTES, 49SET_VAL, 273SETSTEP, 175SFC management - instructions

CLEARCHART, 159FREEZECHART, 163INITCHART, 167RESETSTEP, 171SETSTEP, 175SFC_RESTORE, 189SFCCNTRL, 177

SFC_RESTORE, 189SFCCNTRL, 177SIG_CHECK, 281SIG_WRITE, 277SYST_READ_FLOAT_STATUS, 295SYST_READ_TASK_BIT, 291SYST_RESET_TASK_BIT, 293SYST_TIME, 289system specials - instructions

FORCE_BIT, 265IS_BIT_FORCED, 267IS_PAR_CON, 269UNFORCE_BIT, 285

33002539 10/2019

system time and date - instructionsFREERUN, 209GET_TS_EVT_M, 211GET_TS_EVT_Q, 219PTC, 239R_NTPC, 247RRTC_DT, 241RRTC_DT_MS, 243SCHEDULE, 251WRTC_DT, 261

TT850_TO_T870, 255, 256T870_TO_T850, 255, 256, 258time stamping

GET_TS_EVT_M, 211GET_TS_EVT_Q, 219

timer - instructionsFREERUN, 209

transfer data - instructionsSET_VAL, 273

UUNFORCE_BIT, 285UNMASKEVT, 115

WWR_DATA_TO_FILE, 61Write Variable to PCMCIA Card

WRITE_V_PCMCIA, 93WRITE_U_PCMCIA, 83, 91WRITE_V_PCMCIA, 93WRTC_DT, 261

329

Page 330: EcoStruxure™ Control Expert - System - Block Library - 10/2019

Index

330 33002539 10/2019