An Open-source Development Environment for Industrial Automation with EtherCAT and PLCopen Motion Control∗ I. Kim, T. Kim∗ , M. Sung Dept. of Mech. and Inf. Eng. University of Seoul, Seoul 130-743, Korea
[email protected]
Abstract Standards conformance and integrated development are key features of modern automation systems. This paper introduces an integrated development environment (IDE) that enables high-speed EtherCAT communication and standardized motion programming. On the basis of our previous work, we extended and customized open-source software components to provide a completely open architecture IDE, that is compliant with the relevant industrial standards. The major components of our IDE are IEC 61131-3 and PLCopen TC6 compliant editor, EtherCAT communication support, and PLCopen TC2 compliant motion control library. Since the whole procedures from the project setup to run-time monitoring are highly automated, the presented IDE allows developers to integrate coordinated motion with control logics seamlessly and efficiently.
1. Introduction Owing to the proliferation of programmable logic controllers (PLCs) in various industries, it is becoming very important for developers and field engineers with different domain backgrounds and skills to easily handle PLCbased systems. On the other hand, as the information technologies rapidly integrate with mechanical devices, there is an ever-increasing need for reliable and scalable software components in industrial automation. However, unfortunately, conventional proprietary approaches to programming PLCs made it difficult to integrate components from different vendors when building large and complex control automation systems. This limitation is getting worse with the growing demands for modern automated systems where large number of devices should be synchronously operated over a fieldbus network. In order to solve this problem, the International ∗ This research was supported in part by Basic Science Research Program through the National Research Foundation of Korea(NRF) funded by the Ministry of Education (No. 2013R1A1A2004984) and in part by the National Research Foundation of Korea(NRF) grant funded by the Korea government (No. 2012015266).
E. Tisserant, L. Bessard, C. Choi R & D Center, Higen Motor Co., Ltd. Changwon 641-714, Korea
Electrotechnical Commission (IEC) introduced the IEC 61131-3 standard [4]. The standard defines programming languages and common practices for developing PLCbased industrial automation systems. PLCopen [3] technical committees (TCs) also provide standards for various topics related to control programming. The purpose of all these standards is to decrease development and maintenance costs of applications by the code reusability and easy integration of external software modules. Another noticeable trend in industrial automation is the active use of IDE. It is widely accepted that, by the use of an IDE, we can achieve higher efficiency during the system development while increasing the software quality. The requirements for industrial automation IDE may be summarized as the ease of use, the cross-development support for heterogeneous environments, and the conformance to the open standards relevant to industrial control systems. From the viewpoint of costs, it may be undesirable to employ commercial IDEs or implement the IDE fully-compliant to the existing standards from scratch. In this paper, we introduce an intelligent IDE for industrial systems, that is compliant with exiting standards and has been constructed solely from open-source software components. The primary goal of our IDE is, but not limited to, the rapid development of real-time Ethernetbased coordinated motion applications. In the previous work [6], the authors presented an IEC 61131-3 compliant multi-platform IDE, called Beremiz. We extended and customized the Beremiz IDE in order to support EtherCAT [1], that is one of the most popular real-time Ethernet communication profiles, and motion functions that conform to the PLCopen standards.
2. Background Modern industrial automation systems demand seamless integration of high-speed communication and motion control (MC) functions with conventional control logics. In accordance with the trend, there is a compelling need for a self-contained, scalable IDE to support various industrial communication protocols and reusable motion control libraries.
EtherCAT, a real-time Ethernet-based fieldbus standard, provides many favorable features for industrial automation, i.e., short cycle times, low communication jitter, and interoperability with TCP/IP. Owing to these advantages, it is currently gaining increasing attention in industrial automation field. For this reason, we choose EtherCAT as the target communication technology to support. We consider a well-known, open-source EtherCAT master stack from IgH [2] as the base of our implementation. IgH master stack provides most of the essential EtherCAT features, i.e., Process Data Object (PDO), Service Data Object (SDO), Distributed Clock (DC), and slave ESC management in the form of C APIs. As for motion programming, engineers were required to use or select a wide range of proprietary motion control hardware to come up with application requirements. And thus, software should be rewritten for each application even though the functions are the same. To overcome the limitation, PLCopen TC2 motion standards provide a way to implement standard motion control libraries (MCLs) that are reusable across different platforms. The PLCopen MCL provides a set of administrative and control function blocks (FBs) for single-axis and coordinated multi-axes motion. The motion FB interfaces are IEC 61131-3 compliant, so they can easily be integrated with PLC control logics.
3. Implementation of Automation IDE 3.1. Overview of Our Automation IDE The basic components of the IDE are PLCOpen Editor, MatIEC back-end compiler, and a configuration tree of instantiated extensions. The PLCOpen Editor lets programmers write PLC applications using the languages defined in the IEC 61131-3 standard. The MatIEC back-end compiler translates textual form of automation programs to corresponding ANSI C codes. The resulting code can be executed in various runtime environments such as MS Windows, generic Linux, and Xenomai-patched Linux. The IDE also supports extensions such as communication profiles (CANopen and EtherCAT), HMI authoring tools (SVG and wxGlade), and programming interface with other languages (C and python). As shown in Fig. 1, the IDE provides a project-based application management. Programmers can write PLC programs in the program editing panel shown in the center of the figure. Users can also easily embody IEC 611313 compliant program organization unit (POU) libraries, shown in the right panel of main user interface, in their application just by drag-and-drop. During run-time, the right panel is used as a debug window, monitoring and displaying user-selected PLC variables. The project information is saved in an XML file according to the PLCopen TC6 XML schema. This greatly improves the compatibility with other PLC programming tools. As shown in Fig. 2, the development host running our IDE generally connects to and interacts with target PLC
Figure 1. User interface of our IDE Beremiz PLC Executable
PLCopen Editor Compiler support (MatIEC, gcc) Extensions (HMI, EtherCAT ..)
Development Host
Request
PLC Runtime
PYRO Channel HMI
EtherCAT
Reply
Motor Drive 0
Motor Drive 1
..
Motion Controller
Figure 2. Interaction between the IDE and target system system through an RPC channel, called PYRO (PYthon Remote Object). Over the channel, the IDE transfers PLC executable image to the target PLC system during development phase, and controls and monitors the target system at run-time. 3.2. EtherCAT Extension Nowadays, it is essential for the PLC programming environment to provide the support for high-speed industrial communication profiles. To cope with this trend, we implement a communication profile extension for EtherCAT, an emerging industrial Ethernet standard. The EtherCAT extension consists of a root node, EtherCAT master sub-nodes, and EtherCAT slave sub-nodes. The root node lets users import profile information used in the connected EtherCAT devices by collecting standard EtherCAT device description files in XML schema. The master sub-node configuration includes device initialization service data and explicit process data mapping between devices. With slave sub-nodes, users can select device types and profiles, and browse device object dictionary variables to be used in PLC programs. The EtherCAT extension also supports servo drive profiles, i.e., the CiA 402 profile from CANopen in Automation (CiA) [5], including drive state machine management and control mode selection. Many of the essential functions of an EtherCATbased automation system are actually implemented in an EtherCAT master protocol stack. Instead of implementing the features from scratch, we chose a well-known open-source implementation, i.e., IgH EtherCAT master stack [2], as the base of our implementation.
Table 1. EtherCAT management features Item Description Network Management Configuration Auto/manual device scanning using slave EEPROM and XML information. Monitoring General information on the slave devices and packet traffic information, e.g., packet drop rate. Slave Device Management Slave State Slave state transition control and monitoring. PDO Configuration of PDO mapping and run-time monitoring of PDO variables. SDO SDO upload and download. EEPROM Run-time monitoring of EEPROM contents. Image export to binary file. Slave Controller Configuration and monitoring of registers in slave controllers. DC DC configuration, i.e., DC cycles, DC offsets, and clock drift compensation period.
Figure 4. Motion FB interface
Figure 5. Kinematic editor Figure 3. EtherCAT slave management The EtherCAT extension generates C codes that use IgH EtherCAT APIs, according to the configuration node settings and EtherCAT variables explicitly used by PLC programs and implicitly through the CiA 402 profile by using MCL. Although the latest version of the master stack covers most of standard features, we had to customize and modify the stack into a more user-friendly form in order to integrate it with our IDE. For example, applications are usually handcrafted when using the original IgH stack. Since it is a too cumbersome and errorprone job, we implemented C wrapper functions to automate the generation of EtherCAT management code. Table 1 summarizes the EtherCAT management functions supported by our IDE, which are comparable to commercial products in many aspects. Figure 3 illustrates the snapshot of the EtherCAT slave management function. 3.3. Motion Extension and PLCopen MC Library The motion plugin implements the foundation for PLCopen MC functions. It consists of PLCopen TC2 motion FB interfaces and a motion kernel object. As shown in Fig. 4, the motion FB interfaces abstract the PLC interfaces to the motion functions. The PLCOpen Editor presents XML representation of those interfaces to users as a library. The motion kernel object performs per-FB computation, inverse kinematic solving, and online tra-
jectory generation. The body of motion FBs described in PLCopen TC6 XML contains ST (Structured Text) code that uses MatIEC capability to insert C pragmas into ST code. Those inserted C statements act as stub codes and call FB dedicated interfaces into the motion kernel. During build procedure, they are linked with PLC codes to generate the automation runtime. It is notable that the stub C files have been automatically generated from the specification documents. There exist numerous motion functions defined in the standard, and for each FB, many of same-type parameters and function logics are repeated. Instead of manually writing the codes, we devised a procedure to automatically generate HTML documentations, C codes of the motion kernel, and XML description of motion FB interfaces out of the motion specification documents using tools such as PDFMiner, PyPeg, and YSLT. This feature could contribute to rapid prototyping, allowing us to focus on the main motion function. To aid the motion programming, two supplementary editors have been added to the IDE UI, i.e., Cam Editor and Kinematic Editor. The Cam Editor allows users to specify Cams associating axes positions to be synchronized, and define acceleration, velocity, and position of time profiles. The Kinematic Editor is used to describe the kinematic model of the target motion device, which is characterized by relevant properties on each axis and linkage (see Fig. 5). Currently, a working prototype of the
motion component has been constructed, covering most of the standard FBs for single-axis, multi-axis, and coordinated motion. 3.4. PLC Application Development Procedure In general, the application development procedure with our IDE consists of the following steps: project configuration, coding, target executable build-up, and run-time verification. To begin with, programmers create a PLC project and configure the basic properties of target system such as the target run-time OS and the period of real-time control task. Note that the information of PDO variables at the controlled devices, i.e., servo drives, are also gathered during the network scanning.
easily construct such a sophisticated motion control application using the supplied motion FBs and supplementary libraries. The motion system has a master control cycle of 500 µs, and it includes a 3D user interface allowing users to command and monitor the rendered motion.
Extensions (HMI, CAN ..)
Motion Extension
PLCOpen TC2 FB Types and Definitions Cam Editor Kinematic Chain Editor
Other libs.
PLCopen Lib. provider
Extension Controller
Editor panel
Config. Panel
EtherCAT Device Profile
Network Configuration Object Dict. Control EtherCAT Wrapper API
Figure 7. 3-axis cartesian robot application developed with our IDE
Extension Code Templates
PLCOpen Editor
TC 2 FB
Extention Support Module
EtherCAT Extension
PLC code (ST)
MatIEC Compiler
4. Conclusion and Future Works
Target-Specific Code Templates
gcc toolchain
PLC Executable
: Original Part : Newly Implemented
Figure 6. PLC application build procedure After then, during the coding phase, PLC application codes are written in IEC 61131-3 compliant languages. In this phase, motion control FBs provided by the IDE and process control variables are usually integrated into the application source code. According to the requirements of application, programmers can also easily integrate HMI components with control logics through HMI extension. In the build-up phase, the PLC application codes are converted into their corresponding C codes, and the target executable image is finally built by linking the main PLC codes with the target OS-dependent task management stubs (see Fig. 6). And finally, run-time behavior of target system can be monitored remotely through the PYRO channel. Although the development procedure seems to be complicated, most of the steps are automated and thus transparent to programmers. 3.5. Demonstration: 3-axis Coordinated Motion For demonstration and validation purpose, we have built a motion system operating a 3-axis cartesian robot such that its tool center point accurately follows a requested curve in the 3D space. Figure 7 shows the target PLC system which consists of a Xenomai-based PC and commercial EtherCAT servo drives. Following the development steps described in the previous section, we could
In this paper, we introduce the design and implementation of an open-source, standard-compliant IDE that enables high-speed EtherCAT communication and standardized motion programming. The developed IDE has a number of notable features, which include the integration of EtherCAT programming and administrative functions, commercial-grade real-time performance using Xenomai Linux, and user interfaces for motion development and monitoring. The implementation of essential parts of the PLCopen Motion Control specification has been nearly completed. Its logical and timing correctness is currently being validated using a 3-axis cartesian robot. Future work includes researches on the motion kernel architecture for multi-core processor and formal verification of the control software using timed automata.
References [1] EtherCAT: Ethernet for control automation technology. [Online]. Available: http://www.ethercat.org. [2] IgH, EtherCAT Master for Linux. [Online]. Available: http://www.etherlab.org. [3] PLCopen Technical Committee 2: Motion Control. [Online]. Available: http://www.plcopen.org. [4] IEC Std, IEC 61131-3: Programmable Controllers - Part 3: Programming Languages, 2nd Ed., 2005. [5] ETG.6010, Implementation Guideline for CiA402 Drive Profile, Feb. 2010. [6] E. Tisserant, L. Bessard, and M. de Sousa. An Open Source IEC 61131-3 Integrated Development Environment. In Proc. 5th IEEE International Conference on Industrial Informatics, pages 183–187, June 2007.