Introduction
This guide shows how to operate an IO-Link Master to read acylic process data using ADS over EtherCAT (AoE) and cyclic procress data from an IO-Link sensor with the EtherCAT interface on a real ctrlX CORE. This application note leads step by step through the whole process, from hardware setup through engineering until testing.
ctrlX AUTOMATION has been designed as an open system. In context of IO-Link this means that it supports any IO-Link master which fulfills the requirements of the EtherCAT specification (ETG.5001) and provides a suitable ESI file.
ctrlX I/O Engineering does not support IO-Link configuration using IO-Link Device Description (IODD) files. Configuration is done via EtherCAT Modular Device Profile (MDP) mechanisms.
In our example we have chosen devices from ifm, but others can be used accordingly.
Prerequisites
Hardware
Following devices will be used in this application note:
- ctrlX CORE hardware
- IO-Link Master (ifm AL1930)
- IO-Link Temperature Sensor (ifm TS2289)
- IO-Link Signal Converter (ifm TP3231)
Software
Following software must be installed:
- Rexroth PLC app on the ctrlX CORE
- Rexroth EtherCAT Master app on the ctrlX CORE
- ctrlX I/O Engineering and PLC Engineering (parts of ctrlX WORKS)
For operation of Rexroth PLC app and Rexroth EtherCAT Master an adequate software license is required!
Set up a ctrlX I/O Engineering
- Open the web based engineering of the ctrlX CORE either via your network folder of Microsoft Windows, from ctrlX WORKS or directly by entering the IP in a web browser and login.
- Open the home bar and start to configure the EtherCAT Master.
- Add a new EtherCAT Master configuration.
- Select the correct port for the EtherCAT Master at XF 50. In this example the name is “ethercatmaster”.
- The system will create the EtherCAT Master. When this is successful, open the ctrlX I/O Engineering by clicking on the corresponding link.
- Right click on the ethercatmaster and scan for new devices.
- The ctrlX CORE will find the ifm IO-Link Master, but the device is unkown, because the ESI File isn´t installed in the device repository of IO Engineering. As long as a slave device is unkown, it can´t be insert to the fieldbus configuration.
- The ESI File can be downloaded from the offical website of the IO-Link Master supplier.
- To install the ESI-File into the the device repository, click in the menu bar on tools and open the device repository.
- Click on Install to add the current IO-Link Master - ESI-File to the device repository.
- Once the installation is completed, the installed device descriptions will be displayed and the device repository can be closed.
- Scan for new devices again, now the ifm IO-Link Master AL1930 should been detected.
- Click on the “insert all newly scanned devices”-button in order to copy all EtherCAT devices from the control to the project.
- Click apply and OK to create the device in the I/O-Project.
- In this example, there is only one sensor connected to channel one of ifm AL1930. Therefore channel one has to be activated by selection of the appropriate process data size. Remaining channels must be deactivated. The process data length and layout can be found in the corresponding data sheet. In case of ifm Signal Converter TP3231, the length is two Bytes.
If the appropriate process data size can not be found in the selection, the next best fitting (larger) process data size has to be chosen. - The IO-Link Master channels need to be configured, because in this application only one sensor input is used.
- The temperature sensor is connected to channel one. The input process data length is set to 4 bytes.
- The remaining channels will be set to "Deactivate Slot".
- Once the configuration is completed, click on the “download the fieldbus configuration” button.
- After the fieldbus configuration is downloaded successfully to the ctrlX CORE, the EtherCAT status should be switched to “OP”. To validate this, you can click on the “EtherCAT” bar to see the current state of the EtherCAT Master and all connected slaves. The fieldbus configuration can now also be seen in the ctrlX CORE Data Layer.
- To get the signal from the connected temperature sensor to the PLC, the IO-Link Master must be configured as an IO-Link user, which using the AoE (ADS over EtherCAT) Protocol. In order to see the AoE-address, open ctrlX I/O Engineering and double left click on ifm IO-Link Master to open the settings. Now activate the expert settings to get access to all adjustments of the IO-Link Master.
- Open the AoE tab and automatically AoE is enabled. When AoE is activated, then save the I/O-project and download the configuration to the control and accept the upcoming wizard. The NetID will be important for reading acyclic data with the upcoming PLC program.
Set up a ctrlX PLC Engineering
- Open the “Home” bar and click on the “Configure PLC applications” link.
- Initially, there is no PLC program on the ctrlX Core. To create a PLC program, open the ctrlX PLC Engineering via the "Start ctrlX PLC Engineering" button.
- In the ctrlX PLC Engineering click in the menu bar on file, then on new project and select standard project.
- When a new standard project is selected, the program will ask you for which device you want to create the project and which programming language for your PLC program should be used. In this example, the device is a real ctrlX Core and structured text (ST) is selected.
- Now the startup project tree looks like in the following picture.
- To configure the ctrlX CORE Realtime Data right click on DataLayer_Realtime, Edit and then "Online from ctrlX Core".
- Add the fieldbus realtime data and apply changes.
- Add the ifm Master AL1930 to the realtime data.
- Add IO-Link channel one and apply changes.
- The converter unit only provides two bytes of process data. Select channel TxPDO.input_byte_0, TxPDO.input_byte_1 and apply changes.
- Now the IO-Link Master channel one only shows the configured bytes.
- To be able to publish variables to the ctrlX CORE Data Layer, two things need to be insert to the project. Add a symbol configuration and a global variable list to your application.
- Insert the variables to the GVL and delete the preinsert first line. In this example, one boolean variable "bAcylicExecute", two bytes "ByInputByte0" and "ByInputByte1", one word "PDV1" and one real variable "Temperature" are defined.
- The two bytes of the cyclic process data will be divided into two spearated bytes "ByInputByte0" and "ByInputByte1". This two bytes will be joined to an word and then converted into an integer value. The following code will be used to evalutate the acutal temperature and store it in the variable "Temperature".
- At this point of the example, it is possible to get the actual temperature from the sensor.
- The variable “bAcyclicExecute” will be used to start the acyclic read of the vendor and the product ID. Set up an example program in the "PLC_PRG" where “strVendor” shows the vendor of the converter unit and "strProductID" shows the Product ID.
- To run the code on the ctrlX CORE, open the library manager. Press the “Add Library” button. Search for CXA_EthercatMaster and double left click on the “CXA_EthercatMaster” library or press the OK button to add the library to the PLC project.
- After integration of the CXA_EthercatMaster library, you can add the program code to read inputs over AoE. In the declaration part of the PLC_PRG some new variables must be added, like in the picture below.
- Now the function block needs to be inserted in the PLC program. For easier implementation, the input assistant can be used here.
- If the user wants to see all IO's of the function block, the check box “insert with arguments” needs to be checked.
- This is how it looks like, when all arguments are be insert and the variables are allocated to the IOs.
- Read vendor of the converter unit
- Read the product ID
- There are two ways to add these variables to the symbol configuration:
- Execute a “Build” and tick the variables you like
- Add a pragma to the global variable list that causes all variables in this list to be published
- The communication settings are set automatically by default, so it is possible to directly log into the control. In order to inspect the settings, double click on the target on the left hand side.
- A security warning will be displayed because the certificate for the communication is self-signed and thus not provided by an official certificate authority. Please go on logging in with your user and password available on the control and download the created project.
- The application is started via the play button in the top menu bar or alternatively by right clicking on "Application" and press "Start".
-
Now variables can be manipulated in your program PLC_PRG. To manipulate the the value of bAcyclicExecute double left click on it in the PLC_PRG and then press "CTRL + F7" or alternatively use the "Write Values" in the "Debug" menu bar to change between true and false.
-
To check the data in the ctrlX Data Layer, open the viewer via the link in the "Settings" bar in the web interface of your ctrlX CORE. There the variables are visible and changeable. Please refresh the view with the small button on right if the values are static.
-
GVL
-
PLC_PRG (To see the variables actual value, the bAcyclicExecute must be set to true, to start the acyclic reading process over AoE)
Related Links
- Video Set up a ctrlX PLC project to publish variables to the Data Layer
- Get the ctrlX CORE - PLC app
- Documentation ctrlX PLC app
- Documentation ctrlX EtherCAT Master app
- Forum ctrlX PLC
-