EFB Toolkit For Unity Pro

Transcription

EFB Toolkit for Unity Pro33003021 12/2014EFB Toolkit for Unity Proa SoCollaborative softwareUser Manual33003021.1012/2014www.schneider-electric.com

The information provided in this documentation contains general descriptions and/or technicalcharacteristics of the performance of the products contained herein. This documentation is notintended as a substitute for and is not to be used for determining suitability or reliability of theseproducts for specific user applications. It is the duty of any such user or integrator to perform theappropriate and complete risk analysis, evaluation and testing of the products with respect to therelevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates orsubsidiaries shall be responsible or liable for misuse of the information contained herein. If youhave any suggestions for improvements or amendments or have found errors in this publication,please notify us.No part of this document may be reproduced in any form or by any means, electronic ormechanical, including photocopying, without express written permission of Schneider Electric.All pertinent state, regional, and local safety regulations must be observed when installing andusing this product. For reasons of safety and to help ensure compliance with documented systemdata, only the manufacturer should perform repairs to components.When devices are used for applications with technical safety requirements, the relevantinstructions must be followed.Failure to use Schneider Electric software or approved software with our hardware products mayresult in injury, harm, or improper operating results.Failure to observe this information can result in injury or equipment damage. 2014 Schneider Electric. All rights reserved.233003021 12/2014

Table of ContentsSafety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . .About the Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Chapter 1 Introduction to the EFB Toolkit Methodology . . . . . . .Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Chapter 2 EFB Toolkit Services and User Functions . . . . . . . . . .Program Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .How to Register the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Product Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .EFB Toolkit Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Installable Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Comparison Between the Different Block Types . . . . . . . . . . . . . . . . .Multi Language Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Help on Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Chapter 3 Coding Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Coding Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Constant Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Local Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .EFB Data Instances. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .EN/ENO Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Extensible Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Chapter 4 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . .EF/EFB Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .EF Program Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .EFB Header File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .EFB Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .DDT Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Chapter 5 Debugging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Debug Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Best Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Recommendations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Chapter 6 System Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .System Service Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33003021 457606466717279808182823

6.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s AliGetProgStat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s log to phy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s obj to log. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s obj nbr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s rd 16bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s rd 1bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s rd bit attrib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s rd internalwords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s rd Nbits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s rd sysbit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s rd sysword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s wr 16bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s wr 1bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s wr bits attrib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s wr internalwords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s wr Nbits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s wr sysbit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s wr sysword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s cnt 100ms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s cnt 10ms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s cnt 1ms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s date and time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s syscnt 10ms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s current task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s set ffb error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s set ffb error addi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s diag RegisterExtError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s diag DeregisterError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s of passw check. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s of passw test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s demask it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s GetUSecs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s mask it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s proc indic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .s proc type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4815133003021 12/2014

Appendix A PL7/Concept EF/EFB Migration. . . . . . . . . . . . . . . . . . .A.1A.2A.3A.4A.5A.6Index33003021 12/2014PL7 and Concept EF/EFB Migration . . . . . . . . . . . . . . . . . . . . . . . . . .PL7 EF Migration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .PL7 EF Migration Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Retrieving Source Files from the PL7 Development Environment . . .Migration Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .PL7 EF Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Unity Pro EF Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Concept EF/EFB Migration Procedure . . . . . . . . . . . . . . . . . . . . . . . .Retrieving Source Files from a Concept Development Environment .Migrating the Function Block Code to Unity Pro . . . . . . . . . . . . . . . . .Concept EF/EFB Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Unity Pro EF Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Other Case Studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .User-defined Data Types (PL7 only) . . . . . . . . . . . . . . . . . . . . . . . . .Floating Point Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ANY. Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .REF. Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Determining the PLC State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Reporting User Defined Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Extensible inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Comparison Between PL7/Concept and Unity Pro . . . . . . . . . . . . . . .Common System for EF/EFBs in Unity Pro . . . . . . . . . . . . . . . . . . . . .Data Types Comparison: PL7/Concept and Unity Pro . . . . . . . . . . . .PL7 SDKC Include File: Cstsyst.h Versus SystemLib.h (PL7Only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .An Empty Frame for a Unity Pro EF . . . . . . . . . . . . . . . . . . . . . . . . . .Example EF1 Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Example EF1 Header File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Example EF1 C-Source Template . . . . . . . . . . . . . . . . . . . . . . . . . . .Programming Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761771781791801841851891911941951961992032055

633003021 12/2014

Safety InformationImportant InformationNOTICERead these instructions carefully, and look at the equipment to become familiar with the devicebefore trying to install, operate, or maintain it. The following special messages may appearthroughout this documentation or on the equipment to warn of potential hazards or to call attentionto information that clarifies or simplifies a procedure.33003021 12/20147

PLEASE NOTEElectrical equipment should be installed, operated, serviced, and maintained only by qualifiedpersonnel. No responsibility is assumed by Schneider Electric for any consequences arising out ofthe use of this material.A qualified person is one who has skills and knowledge related to the construction and operationof electrical equipment and its installation, and has received safety training to recognize and avoidthe hazards involved.833003021 12/2014

About the BookAt a GlanceDocument ScopeThis documentation describes the EFB Toolkit.Validity NoteThis documentation is valid for EFB Toolkit V8.0 SP1.Product Related InformationProgramming Language ’C’The programming language ’C’ is a powerful language that offers many features, such as pointers.But programming in ’C’ naturally contains risks, for example:You can define a pointer and modify the address to which the pointer points freely in yourprogram. You can cast a pointer to any type you like, etc. If you are programming function blocks in ’C’, you have to be aware of outcomes from each of thefunction blocks. A ’C’ coded function block is a piece of code compiled from a standard ’C’ compilerused inside the PLC. There are no security checks inside Unity Pro or inside the PLC that checkthe function block code for correct operation. If the code is not correct, the PLC memory may becorrupted at any location inside the PLC. As a consequence the PLC may crash or behaveunexpectedly.WARNINGUNEXPECTED PLC BEHAVIOR Check the function block code to make sure that it is working correctly.For the test and debugging phase, use the PLC Simulator of Unity Pro instead of a real PLC.Failure to follow these instructions can result in death, serious injury, or equipmentdamage.Schneider Electric does not take any warranty for ’C’ coded function blocks written by users

Step Action Comment. 1File New familyCreates a new family project. 2 Select a family name The user has to select a family name. This name corresponds to the name of the family displayed in Unity Pro and the family directory. Result:After that actions the new family appears in