Functions and Liraries Introduction Guide So Machine)
Functions and Liraries Introduction Guide So Machine)
EIO0000000735.04
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical characteristics of the performance of the products contained herein. This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability of these products for specific user applications. It is the duty of any such user or integrator to perform the appropriate and complete risk analysis, evaluation and testing of the products with respect to the relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or subsidiaries shall be responsible or liable for misuse of the information contained herein. If you have any suggestions for improvements or amendments or have found errors in this publication, please notify us. No part of this document may be reproduced in any form or by any means, electronic or mechanical, including photocopying, without express written permission of Schneider Electric. All pertinent state, regional, and local safety regulations must be observed when installing and using this product. For reasons of safety and to help ensure compliance with documented system data, only the manufacturer should perform repairs to components. When devices are used for applications with technical safety requirements, the relevant instructions must be followed. Failure to use Schneider Electric software or approved software with our hardware products may result in injury, harm, or improper operating results. Failure to observe this information can result in injury or equipment damage. 2011 Schneider Electric. All rights reserved.
EIO0000000735 06/2011
Table of Contents
5 7 9
10 13
17
18 24
27
28 29 32
35
35
Chapter 5 How to Find a Function or Function Block with the FFB Finder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Function and Function Block Finder . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
37
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
EIO0000000735 06/2011
EIO0000000735 06/2011
Safety Information
Important Information
NOTICE Read these instructions carefully, and look at the equipment to become familiar with the device before trying to install, operate, or maintain it. The following special messages may appear throughout this documentation or on the equipment to warn of potential hazards or to call attention to information that clarifies or simplifies a procedure.
EIO0000000735 06/2011
PLEASE NOTE Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of the use of this material. A qualified person is one who has skills and knowledge related to the construction and operation of electrical equipment and its installation, and has received safety training to recognize and avoid the hazards involved.
EIO0000000735 06/2011
At a Glance
Document Scope This document introduces the libraries, libraries management and functions implementations in SoMachine. Validity Note This document has been updated with the release of SoMachine V3.0. User Comments We welcome your comments about this document. You can reach us by e-mail at techcomm@schneider-electric.com.
EIO0000000735 06/2011
EIO0000000735 06/2011
1
Overview This chapter describes the generalities about libraries and the library management in SoMachine. Whats in this Chapter? This chapter contains the following topics:
Topic Generalities About Libraries Library Management in SoMachine Page 10 13
EIO0000000735 06/2011
Library Repository The Library Repository is the editor that manages libraries installed in SoMachine. The Library Repository allows you to install or remove libraries. A library can be used in a SoMachine project only if it is installed in the Library Repository. With the installation of SoMachine, a set of libraries is installed by default. You can install new libraries or new versions of existing libraries.
10
EIO0000000735 06/2011
Managing Libraries by Using Library Managers Libraries declared in a project are managed in the Library Manager editor. Within a SoMachine project, 2 different Library Managers are available at 2 different locations for different use cases of libraries:
Use Case Location of the Library Manager
libraries available for the in the POUs window whole project libraries available for a specific controller in the Devices window for each controller, where it is a subnode of the Application node
EIO0000000735 06/2011
11
The figure below shows the Library Manager in the POUs window and the Library Manager in the Devices window on the left-hand side of the SoMachine Program tab:
For more information about library management, refer to CoDeSys online help: Concepts and Base Components / Library Management. For more information about Library Repository, refer to CoDeSys online help: Menu Commands / Installation / Library Repository. For more information about Library Manager, refer to CoDeSys online help: Editors / Library Manager Editor. In SoMachine, features embedded in libraries might be used for the automation as well as for the system (internal). In both cases, libraries are managed with the Library Manager of SoMachine.
12
EIO0000000735 06/2011
EIO0000000735 06/2011
13
Namespace A library namespace is a symbol that allows the unique access to the attached library components (functions, function blocks, variables). The use of namespaces is optional, but necessary if 2 components of 2 different libraries used in the same project have the same name. The full name <namespace>.<component> will then allow a unique access to the correct component.
Case 1 Description There is a function block GEN in the library Util. The namespace of the library Util is Util. An instance of the function block GEN can be declared with or without the library namespace if the name GEN is unique within the project: MyGenerator: Util.GEN; or MyGenerator: GEN; A function block GEN has been created within the project. The use of the library Util namespace will allow the system to access the function block GEN of the library Util. Without namespace, the project function block GEN will be accessed: MyGenerator_Util: Util.GEN; MyGenerator_Project: GEN; Another library, also containing a function block called GEN, is declared in the project with namespace NewLib. The use of the namespace becomes mandatory to identify the correct function block GEN to be accessed: MyGenerator_Util: Util.GEN; MyGenerato_NewLib: NewLib.GEN;
A default namespace is defined for each library. Schneider Electric libraries default namespaces start with the prefix SE. Default namespace of a library declared in a project can be customized in the library Properties editor called from the Library Manager (In the Library Manager of a project, right click on the library then select the Properties field).
14
EIO0000000735 06/2011
Placeholder Placeholder is a mechanism used to manage the compatibility between versions of devices and versions of libraries. When SoMachine or existing devices are upgraded or when new devices are integrated, attached Device Description Files are installed. The Device Description File contains the placeholders that define versions of libraries compatible with the device version. When manually adding a library to a device, use the placeholder to help maintain compatibility between the device version and the library version independent of the version of SoMachine. NOTE: The placeholders are defined in the Device Description Files. When the user creates a new library, there is no placeholder defined in the Device Description Files for this new library. The placeholder mechanism cannot be used when adding this custom library to the device library manager. In a project created with a previous version of SoMachine software, the versions of the libraries declared in the project will be either: kept unchanged for libraries declared with a specified version, automatically updated with the latest versions for libraries declared using the latest version concept (version identified with * in the Library Manager), automatically updated with the versions defined in the controller Device Description File after a controller device update command for libraries declared using the placeholder concept.
WARNING
UNINTENDED EQUIPMENT OPERATION Verify the SoMachine libraries contained in your program are the correct version after updating SoMachine software. Verify that the library versions updated are consistent with your application specifications. Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000000735 06/2011
15
Different ways to Declare a Library in a Project There are different ways to declare a library in a project. The libraries are automatically declared when adding: a controller: IEC 61131 basic libraries: Standard and Util libraries Controller PLCSystem library Other libraries to manage embedded controller features (for example: M238 High Speed Counting) specific controller features (for example: DataLogManager, Visualization) a fieldbus manager (for example: CANopen or CANmotion manager) a fieldbus device (for example: TeSys, Altivar, Lexium) Some libraries must be added manually (for example: Toolbox and Solution libraries). NOTE: You should use only functions and function blocks documented in the online help or function or function blocks that you have thorougly tested with your application.
16
EIO0000000735 06/2011
Libraries Overview
2
Overview This chapter provides an overview of the libraries available in SoMachine. Whats in this Chapter? This chapter contains the following topics:
Topic Schneider Electric Libraries Other Libraries Used in SoMachine Page 18 24
EIO0000000735 06/2011
17
Libraries Overview
Category: Communication The following table describes the libraries available in the Communication category:
Name IoDrvASI refer to AS-Interface (see Modicon M238 Logic Controller, Programming Guide) IoDrvDistributedIo IoDrvModbusSerial Namespace SEN_ASI Description AS-Interface bus management functions bus management functions for distributed I/O on CANopen Modbus devices I/O scanning management for Modbus_IOScanner manager (for further information about Modbus Manager configuration, please refer to online help CoDeSys Programming System Help / Editors / Device Editors / Modbus Configuration Editor / Modbus Device Editor) USER YES
SEN_DIO SEN_MODBUS
NO NO
M2xx Communication refer to Functions to Get/Set Serial Line Configuration (see Modicon M238 Logic Controller, Programming Guide)
SEN_COM
YES Serial Line port configuration getting and setting on M238, M258 and LMC058 controllers
18
EIO0000000735 06/2011
Libraries Overview
Name
Namespace
USER YES
SEN_MOD Modem refer to Modem Library (see SoMachine, Modem Functions, Modem Library Guide) SEN PLCCommunication refer to PLCCommunication Library (see SoMachine, Modbus and ASCII Read/Write Functions, PLCCommunication Library Guide)
YES Management of explicite data exchanges between controller and devices through Modbus or ASCII protocols NOTE: This library is not supported by the ATV IMC Drive Controller.
Category: Controller The following table describes the libraries available in the Controller category:
Name DataLogging refer to DataLogging Library (see SoMachine, Data Logging Functions, DataLogging Library Guide) Namespace SEDL Description Data logging management of controllers that support file management operations USER YES
The following table describes the libraries available in the Controller ATV IMC category:
Name Namespace Description ATV IMC High Speed Counting management USER YES
SEC_HSC ATV IMC HSC refer to High Speed Counting (see ATV IMC Drive Controller, High Speed Counting, ATV IMC HSC Library Guide) ATV IMC PLCSystem refer to PLCSystem Library (see ATV IMC Drive Controller, System Functions and Variables, ATV-IMC PLCSystem Library Guide) ATV IMC SysLib V2.3 refer to Controller Inside Programming Tool ATV IMC UserLib refer to ATV IMC Template and UserLib Library Guide SEC
YES
SEC_SL23
Functions and Function Blocks for YES compatibility with Controller Inside applications (CoDeSys v2.3) ATV IMC - ATV71 host interface management YES
SEC_USER
EIO0000000735 06/2011
19
Libraries Overview
The following table describes the libraries available in the Controller LMC058 category:
Name LMC058 Expert IO refer to High Speed Counting (see Modicon LMC058 Motion Controller, High Speed Counting, LMC058 Expert I/O Library Guide) refer to Pulse Width Modulation (see Modicon LMC058 Motion Controller, Pulse Width Modulation, LMC058 Expert I/O Library Guide) Namespace SEC_EXP Description USER
SEC_MC LMC058 Motion refer to High Speed Counting (see Modicon LMC058 Motion Controller, High Speed Counting, LMC058 Expert I/O Library Guide) LMC058 PLCSystem refer to PLCSystem Library (see Modicon LMC058 Motion Controller, System Functions and Variables, LMC058 PLCSystem Library Guide) LMC058 Relocation Table SEC
Functions used to get immediate YES motion axis value and to reset the detected error. LMC058 System Functions and Variables YES
SEC_RELOC
System library for Relocation Table (see Modicon LMC058 Motion Controller, Programming Guide) management.
NO
The following table describes the libraries available in the Controller M238 category:
Name M238 ASi Interface M238 HSC refer to High Speed Counting (see Modicon M238 Logic Controller, High Speed Counting, M238 HSC Library Guide) M238 PLCSystem refer to PLCSystem Library (see Modicon M238 Logic Controller, System Functions and Variables, M238 PLCSystem Library Guide) Namespace SEC_ASIITF SEC_HSC Description System library for AS-Inteface bus management M238 High Speed Counting management USER NO YES
SEC
YES
20
EIO0000000735 06/2011
Libraries Overview
Name
Namespace
USER YES
SEC_PTOPWM M238 PTOPWM refer to Pulse Train Output / Pulse Width Modulation (see Modicon M238 Logic Controller, Pulse Train Output, Pulse Width Modulation, M238 PTOPWM Library Guide) M238 Relocation Table SEC_RELOC
NO System library for Relocation Table (see Modicon M238 Logic Controller, Programming Guide) management.
The following table describes the libraries available in the Controller M258 category:
Name M258 Expert IO refer to High Speed Counting (see Modicon M258 Logic Controller, High Speed Counting, M258 Expert I/O Library Guide) refer to Pulse Width Modulation (see Modicon M258 Logic Controller, Pulse Width Modulation, M258 Expert I/O Library Guide) Namespace SEC_EXP Description M258 Expert I/O management USER YES
SEC M258 PLCSystem refer to PLCSystem Library (see Modicon M258 Logic Controller, System Functions and Variables, Modicon M258 PLCSystem Library Guide) M258 Relocation Table SEC_RELOC
YES
System library for Relocation Table (see Modicon M258 Logic Controller, Programming Guide) management.
NO
The following table describes the libraries available in the Controller XBTGC category:
Name XBT PLCSystem XBTGC HSC refer to High Speed Counting (see Magelis XBT GC HMI Controller, High Speed Counting, XBT GC HSC Library Guide) Namespace SEC SEC_HSC Description XBT System Functions and Variables XBTGC High Speed Counting management USER YES YES
EIO0000000735 06/2011
21
Libraries Overview
Name
Namespace
USER YES
SEC XBTGC PLCSystem refer to PLCSystem Library (see Magelis XBTGC, XBTGT, XBTGK HMI Controller, System Functions and Variables, XBT PLCSystem Library Guide) SEC_PTOPWM XBTGC PTOPWM refer to Pulse Train Output / Pulse Width Modulation (see Magelis XBTGC HMI Controller , Pulse Train Output, Pulse Width Modulation, XBTGC Library Guide)
YES
Category: Devices The following table describes the libraries available in the Devices category:
Name Altivar Library refer to Altivar Library Guide Namespace SE_ATV Description IEC 61131-3 standard compliant function blocks for the control of ATV variable speed drives Functions SM_Servo_Startup and SM_Stepper_Startup and associated Vizualisation components to ease motion drives and steppers commissioning. USER YES
SEM_LXM_SM
YES
SE_ILX
YES IEC 61131-3 standard compliant function blocks for the control of Lexium Integrated Drives IEC 61131-3 standard compliant function blocks for the control of Lexium 32, Lexium 05 and Lexium SD3 drives on CANopen fieldbus YES
SE_LXM
TeSys Library refer to TeSys Library (see SoMachine, TeSys Motor Starters Functions, TeSys Library Guide)
SE_TESYS
YES Control of TeSys U motor starter-controller and TeSys T motor management system. The library also offers function blocks for generic control of 1 or 2 directions / 1 or 2 speed motors.
22
EIO0000000735 06/2011
Libraries Overview
Category: Solution The following table describes the libraries available in the Solution category:
Name Namespace Description Conveying applications function blocks Hoisting applications function blocks Packaging applications function blocks USER YES
SE_CONV Conveying refer to SoMachine Conveying Application Functions Conveying Library Guide Hoisting refer to SoMachine Hoisting Application Functions Hoisting Library Guide SE_HOIST
YES
SE_PACK Packaging refer to SoMachine Packaging Application Functions Packaging Library Guide
YES
NOTE: The Solution libraries have to be installed from the SoMachine Solution Extension DVD. Category: Util The following table describes the libraries available in the Util category:
Name Toolbox refer to Toolbox (see SoMachine, Miscellaneous Functions, Toolbox Library Guide) Namespace SE_TBX Description Set of utility Functions and Function Blocks complementary to the automatically declared Standard and Util libraries Functions used to get and set the interval of a Cyclic Task. USER YES
SE_TBXADV Toolbox_Advance refer to Toolbox_Advance (see SoMachine, Manage a Cyclic Task Interval, Toolbox_Advance Library Guide)
YES
EIO0000000735 06/2011
23
Libraries Overview
Functions for SoftMotion basic management (for YES further information about basic management, please refer to CoDeSys Programming System Help / Libraries / SoftMotion Libraries / SM3_Basic Library) NOTE: This library is only supported on Modicon LMC058 Motion Controller. Functions for SoftMotion CNC management (for YES further information about CNC management, please refer to CoDeSys Programming System Help / Libraries / SoftMotion Libraries / SM3_CNC Library) NOTE: This library is only supported on Modicon LMC058 Motion Controller. SoftMotion system management libraries NO
SM3_CNC
SM3_CNC
SM3_Drive_ 24
EIO0000000735 06/2011
Libraries Overview
System Libraries The following table describes the library available in the (Miscellaneous) category:
Name CmpEventMgr Namespace Description Event system management library USER NO
The following table describes the libraries available in the Application Common category:
Name Standard64 Standard Namespace Standard64 Standard Description Functions for wide characters strings management and long timers IEC programming standard functions and function blocks (for further information about standard functions, please refer to CoDeSys Programming System Help / Libraries / Standard Library). Programming additional functions and function blocks (for further information about additional functions, please refer to CoDeSys Programming System Help / Libraries / Util Library) USER YES YES
Util
Util
YES
Libraries available in Intern category: some of these libraries are for internal system use only. The following table describes the libraries available in the System SysLibs category:
Name Cmp Sys ISys Namespace Description System management libraries USER NO
SysTime SysTime refer to Real Time Clock management (see SoMachine, Getting & Setting Real Time Clock, SysTime Library Guide)
YES
The following table describes the library available in the System SysLibs23 category:
Name Sys23 Namespace Description System management libraries for CoDeSys v2.3 projects migration USER NO
EIO0000000735 06/2011
25
Libraries Overview
CAA Technical Workgroup Libraries The following table describes the libraries available in the Application CAA category:
Name CAA Namespace Description Libraries from CoDeSys Automation Alliance workgroup (for further information about CAA functions, please refer to CoDeSys Programming System Help / Libraries / System Libraries / CAA Libraries). Functions blocks for CANopen fieldbus management from application USER NO
CAA CiA 405 refer to CAA CiA 405 Library (see SoMachine, CANopen Management Functions, CAA CiA 405 Library Guide)
CIA405
YES
The following table describes the library available in the Intern CAA category:
Name CAA Namespace Description USER
NO Libraries from CoDeSys Automation Alliance workgroup (for further information about CAA functions, please refer to CoDeSys Programming System Help / Libraries / System Libraries / CAA Libraries).
26
EIO0000000735 06/2011
Overview Each function can be represented in the following languages: IL: Instruction List ST: Structured Text LD: Ladder Diagram FBD: Function Block Diagram CFC: Continuous Function Chart This chapter provides functions and function blocks representation examples and explains how to use them for IL and ST languages. Whats in this Chapter? This chapter contains the following topics:
Topic Differences Between a Function and a Function Block How to Use a Function or a Function Block in IL Language How to Use a Function or a Function Block in ST Language Page 28 29 32
EIO0000000735 06/2011
27
28
EIO0000000735 06/2011
2 3 4
To illustrate the procedure, consider the Functions IsFirstMastCycle (without input parameter) and SetRTCDrift (with input parameters) graphically presented below:
Function without input parameter: IsFirstMastCycle Graphical Representation
EIO0000000735 06/2011
29
30
EIO0000000735 06/2011
Using a Function Block in IL language The following procedure describes how to insert a function block in IL language:
Step 1 Action Open or create a new POU in Instruction List language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the variables that the function block requires, including the instance name. Function Blocks are called using a CAL instruction: Use the Input Assistant to select the FB (right-click and select Insert Box in context menu). Automatically, the CAL instruction and the necessary I/O are created. Each parameter (I/O) is an instruction: Value to inputs are set by ":=". Values to outputs are set by "=>". 4 5 In the CAL right-side field, replace ??? with the instance name. Replace other ??? with an appropriate variable or immediate value.
2 3
To illustrate the procedure, consider this example with the TON Function Block graphically presented below:
Function Block TON Graphical Representation
In IL language, the function block name is used directly in the Operator Column:
Function Block TON Representation in SoMachine POU IL Editor
EIO0000000735 06/2011
31
2 3
To illustrate the procedure, consider the function SetRTCDrift graphically presented below:
Function SetRTCDrift Graphical Representation
32
EIO0000000735 06/2011
Using a Function Block in ST Language The following procedure describes how to insert a function block in ST language:
Step 1 Action Open or create a new POU in Structured Text language. NOTE: The procedure to create a POU is not detailed here. For more information, refer to the SoMachine global help. Create the input and output variables and the instance required for the function block: Input variables are the input parameters required by the function block Output variables receive the value returned by the function block Use the general syntax in the POU ST Editor for the ST language of a Function Block. The general syntax is: FunctionBlock_InstanceName(Input1:=VarInput1, Input2:=VarInput2,... Ouput1=>VarOutput1, Ouput2=>VarOutput2,...);
To illustrate the procedure, consider this example with the TON function block graphically presented below:
Function Block TON Graphical Representation
EIO0000000735 06/2011
33
34
EIO0000000735 06/2011
4
Creating Your Own Libraries
Overview SoMachine allows you to save a SoMachine project file (<projectname>.project) as a library file (<projectname>.library) and vice-versa. The library file only includes the objects managed in the POUs window.
EIO0000000735 06/2011
35
Procedure To create your own library project via the Program tab, proceed as follows:
Step 1 Action The SoMachine Program tab provides 2 different ways to create a new library project: Either by using the File New menu and selecting the Empty Library project template from the Categories Basic Controllers. Or by using the File Save project as... menu and selecting from the Save as type list box the Library file type. Fill in the mandatory fields in the File Project Project information. In your library project create your: functions and function blocks datatype definitions global variables visualization objects libraries NOTE: Only the objects managed in the POUs window will be considered for a library project. NOTE: If you add standard SoMachine libraries to your own library, always use placeholders to reference them. For details on referencing libraries by placeholders refer to the Adding Libraries chapter (see SoMachine, Programming Guide). 4 Execute the command File Save project and install library into library repository. Result: Your library is now installed on your PC and can be added to any project on your PC using the Library manager.
2 3
NOTE: For more detailed information refer to the CoDeSys online help. To check the syntax and find your potential errors, use the command Check all Pool objects in the menu build, before using Save the project as a compiled library or Save project and install library into library repository. It is best to first code your logic in a regular project application and use the tools available to debug your logic, such as breakpoints and inspection of data values. Once a library is compiled, the logic can not be viewed or modified.
36
EIO0000000735 06/2011
EIO0000000735 06/2011
37
FFB Finder
How to Find a Function or Function Block with the FFB Finder When you are about to create programming code in the editor of the Program tab, go to the place where you want to insert the function block and open the FFB finder as follows: select the menu Edit FFB Finder or right-click at the respective place in the editor and select the command FFB Finder... from the context menu The FFB Finder dialog box opens:
38
EIO0000000735 06/2011
FFB Finder
The FFB Finder dialog box contains the following elements for finding a function or function block:
Element Find what Description In the Find what textbox enter the name of the function or function block you want to insert into your programming code. As wildcards you can use a question mark (?), which replaces none or a maximum of one character, or an asterisk (*), which can replace several characters. If you know the company that created the library which includes the function block you are searching for, you can select the following companies from the Company list: 3S - Smart Software Solutions GmbH CAA Technical Workgroup Schneider Electric System This parameter is by default set to All companies. Match case Include comments in search Check the Match case check box to perform a case sensitive search. By default, this check box is not selected. Check the Include comments in search check box to search for the entered string not only in the names of functions and function blocks but also in the comments that are saved with them. By default, this check box is not selected. Check the Search in project libraries only check box to limit the search on those libraries that are used in the current project. By default, this check box is not selected and the find operation includes all libraries that are installed on the SoMachine PC. Click the Find button or press the ENTER key to start searching for the function or function block.
Company
Find
Results Returned by the FFB Finder Any function or function block that matches the entered search criteria will be listed in the Results list with the Name of the function or function block as well as the Library it is saved in, its Version, and the Company that created it. A comment, if available, will be displayed in the column on the right side. The column Loaded on the left side indicates whether the library, the function or function block is saved in, is already used in the current project. To display further information on one of the functions or function blocks, select it from the list. In the field below, a graphic of the function / function block with its inputs and outputs will be displayed, as well as a description or any further information, if available.
EIO0000000735 06/2011
39
FFB Finder
Integrating a Function / Function Block into the Programming Code To integrate a function / function block that was found by the FFB Finder in your programming code, select it in the Results list, and either double-click the selected entry in the Results list, or click the OK button. The selected function / function block will be inserted at the place where your cursor is positioned in your programming code and the respective library will be loaded automatically. Repeat this operation whenever you need assistance in finding a specific function / function block.
40
EIO0000000735 06/2011
Index
B C A
C
creating libraries, 35
F
FFB Finder, 37 Function and Function Block Finder, 37 Functions Differences Between a Function and a Function Block, 28 How to Use a Function or a Function Block in IL Language, 29 How to Use a Function or a Function Block in ST Language, 32
L
libraries, 10, 13 library creation, 35 Library Manager, 10 Library Repository, 10
EIO0000000735 06/2011
41
Index
42
EIO0000000735 06/2011