CODESYS and EtherCAT

The core design of the motion control system are

  1. Hardware: Industrial PC with EtherCAT, and many other communication ports
  2. Software: CODESYS development software and IEC 61131-3 Programming Languages standards.

EtherCAT is a global standard for real-time communication in robotics and automation applications. EtherCAT Version 1 was established in 2003. EtherCAT is based on Ethernet hardware. An EtherCAT based multi-axis motion control system hardware consists “motion controller” as the EtherCAT “Master” and individual servo drives, and I/O’s as the EtherCAT “Slaves”. Logically, all EtherCAT Slaves are daisy chained in a single loop including the EtherCAT Master. The communication protocol (rules of communication) is specialized for real-time input-output handling especially suitable for high performance, high precision, coordinated, motion control applications. The real-time motion control communication happens through EtherCAT between the Master and Slaves as “EtherCAT datagram” – a formatted message string.

Think of the EtherCAT communication protocol as the following analogy: a train travels on a closed path, like a circular path, starting at head-quarters station (“master”) and stopping at multiple stations (“slaves”) and ending up again at the “master”. The train has multiple cars. Let us assume that for each station there is a reserved car. At each station, people/goods who are supposed to get off at that station gets off and people/goods who want to get on the train gets on the train and takes their assigned place on the assigned car reserved for that station. By analogy, the train is the “EtherCAT datagram”. Railway is the RJ45 connector and cables. Head-quarter station is the master node. A station is the Slave node. Train car assigned to a station is the space reserved (allocated) for each station. Goods/people travel in a train car is data/commands associated with that station.

CODESYS software development tool, one of the World’s most widely used, has two components: the part that runs as CODESYS runtime engine on the target controller/device (CODESYS RTE) and the part the runs on a Laptop PC as IDE environment (CODESYS IDE). CODESYS is short for Control Development System. CODESYS provides a programming platform, that is an integrated development environment (IDE). In a typical application, we develop an application software on a Laptop PC using CODESYS IDE, and then download it to the Target Device (Motion Controller) which has CODESYS Runtime to run and test it.

CODESYS RTE: Runtime engine of CODESYS runs on the “Target” Controller(s), i.e. motion controller. There are over 400 industrial controllers in the market currently supports CODESYS Runtime, and that number increases everyday. This software turns a target controller hardware (i.e. ECU) into IEC-61131-3 programable device.

CODESYS IDE : CODESYS IDE is a software development environment for real-time control systems, including motion control systems. It is basically an IDE (integrated development environment) to use on laptop PCs to develop software for real-time control systems. CODESYS provides the usual tools of any IDE; editor, compiler, debugger, libraries for IEC-61131-3 programming languages standard.

IEC-61131-3 is an international standard for a collection of programming languages for embedded software development. CODESYS is a commercial implementation which supports IEC-61131-3, plus extensions . The only difference between the CODESYS IDE and general purpose IDE (i..e Visual C++ IDE) is that CODESYS is specifically targeted for real-time embedded control systems. We use it for motion control systems. The use of the editors and debugging functions is very similar the proven development program environments of advanced programming languages such as Visual C++. For different applications, we can add additional libraries to simplify the software development, i.e. CODESYS libraries for Motion Control, CNC, Robotic Motion Control.

To this end, specific to motion control applications, PLCopen Motion Control Function Blocks defines a set of libraries specifically for motion control, hardware independent and IEC-61131-3 conforming. CODESYS IDE provides a commercial implementation of the PLCopen Motion Control Function Blocks.

A typical industrial control software used to be in the order of a few hundred lines of PLC Ladder Logic code. Now, with increasing integration, capabilities and sophistication, the industrial control software size is in in the order of hundreds of thousands of lines code. To manage this complexity, standardization in software is necessary so that layers of software can be build one upon the other by different vendors/supplier chain to solve an end-user automation project.