Prerequisites
- ctrlX CORE
- ctrlX PLC app
- Telecontrol Configurator (Demo license valid for 30 minutes)
- Client IEC 104 Simulator
Overview
In this tutorial, it will be shown how to use and configure the IEC 60870-5 protocol in the ctrlX CORE. For this purpose, a Codesys package from 3S-Systems GmbH will be used. This package allows to create a IEC 60870-5-104 server to which it is possible to send or receive data from a Slave.
First, the package will be configured to be able to create the server. There, some information objects will be defined. These information objects are used to send or receive data from the slave or master. Once the server is running in the ctrlX CORE, a slave simulator will be used to send and receive commands from the server.Configuration
1. ctrlX CORE configuration
Note: It will be assumed that the user knows how to connect to the ctrlX CORE from the Engineering computer. Otherwise, check the following link: QUICK START GUIDE CTRLX CORE.
1. Connect the CtrlX CORE with the Engineering computer and access the ctrlX Automation interface.
2. Install the PLC app. The PLC app will be used to run the program that creates the server.
- To perform this step, it is recommended to follow the steps explained in this FAQ for ctrlX Store.
3. The app is installed. In the ctrlX CORE web interface, the “Settings” menu es clicked -> Access “Apps” -> Change to “Service mode” because otherwise, it will not be possible to install the apps, and the “Install from file” button is clicked. A new window will be opened where the previously downloaded file is selected.
Once installed, the app will be visible as shown in the previous figure.
4. Access the PLC app. Go to Homepage, click over "Configure PLC applications" and "Start ctrlX PLC Engineering"
2. Install the Telecontrol Package
1. Download the Telecontrol program. The program can be found here. Download the app and keep the file in a reachable folder.
2. Return back to the PLC program and create a new project.
- Select ctrlX CORE and click over "Ok"
3. Install the package. Click over "Tools" -> "Package Manager"
- Select the "Install" button and open the file downloaded from the Codesys store
- Accept the trust verification and start with the installation
- Follow all the steps and click over the finish button.
- Close all the ctrlX PLC windows and the installation will automatically start. Once the installation has finished, the window shown in the next figure should appear. Click over "Finish", open the PLC program, and select the same project as before.
Note: The PLC program can be opened from the ctrlX CORE interface as shown at the beginning of the tutorial, or from the ctrlX WORKS program in the Engineering Tools section.
4. Add Telecontrol Configurator to the project: 1. Right click over "Device" -> 2. "Add Device"
- 1. Select "Telecontrol Configurator" -> 2. Click "Add Device" -> Close the window
- Now the following view should be visible:
5. Open the Telecontrol Configurator. Double click over "Telecontrol_Configurator (Telecontrol Configurator)" and the app interface opens.
Note: To briefly understand how the app works it is recommended to watch the following Youtube video
3. Telecontrol package configuration
First, the IEC 60870-5 Server will be configured.
1. Configure the Link Layer
- Select the type of client. In this case a Multi Client configuration will be used
- Establish the TCP port. In this case the 2404 port will be used
2. Configure the Station Address (also known as Common Address). When selecting the Station Address it is possible to define the address as shown in the next figure:
When the ASDU address is changed, the address changes also automatically as shown in the left side of the figure. In this case, the ASDU address is 1.
Additionally, in this section, the information objects the user wants to use are created. In the "Add objects" section it is possible to choose between Monitoring and control direction objects.
As the names tell, the monitoring direction objects are used to "monitor" server status, and the control direction are used to send commands from any client connected to the server.
Per default some Single-Point, Double-Point, Step-Point and Measured information objects are created with their individual Information Object Address (IOA). These addresses are very important because they identify each object inside of the server. The IOA can be configured by selecting the information object, and in the Object address section. When the object address is changed, the second format of the address also changes automatically. In this case, the IOA = 1.0.1 has been selected, and in the second format it is equivalent to 65537.
The same configuration can be done for the different information objects. For this tutorial, we will focus on the Measured values objects because the objective is to write some values over them.
3. Configure a Monitoring direction information object
To configure the 257 IOA, the following steps will be followed:
- Type: Object 13
- Object address: 0.1.1
- IEE 754: Write "humidity" or any other variable name
- The other configurations are not relevant for this tutorial
4. Configure a Control Direction information object
In this case, a "Set point command" will be configured. This information object will be used to send a value from the slave.
To add this object, it is required to click over "Set point command" in the "Add objects" menu as shown here:
Click over the new added information object, and fill the following blank spaces:
- Type: Object 50
- Object address: 0.2.2 = 514
- IEE 754: The previously defined variable in the Measured value object should appear
Note: It is important to remember the type of object because later it will be required to define the object again.
5. Generate the code. Press "F11" or click over the button shown in the following image:
Common problems:
- In the case the PLC program is not able to generate the code, click over "sysTelecontrol_Task10" to change the priority
6. Check some of the generated lines of code
- In the "fbIEC60870_Server1 (FB)" section, at the end of the lines of code, the defined objects can be seen.
- In the same section it is also possible to read all the defined objects.
- Each object has its identification has shown in the following image:
- In the Global variables section, it is possible to read the variable defined in the "Measured value" object and which was also matched with the "Set-point command"
7. Login and transfer the PLC program to the ctrlX CORE: Click over the button shown in the following figure.
- Enter the credentials
- Click over the "Run" button
Now the server is running in the ctrlX CORE, and we can try to send commands or read the values from a slave as it will be shown in the next chapter.
4. Slave simulator configuration
In this chapter, it will be shown how to create a "Simulated client" to test if the server is working as expected. For this purpose, the Client IEC 104 Simulator will be used. This program can be downloaded in the official webpage .
1. Install the "Client IEC 104 Simulator". Note: The "Server IEC 104 Simulator" is not required to install
2. Open the simulator and click over "Add client". Next, introduce the Server IP Address. This is the ctrlX CORE IP Address. Check that the Port number is 2404 and nothing else is required to change.
3. In the "Data_Objects_1" section, click over "Start Communication" and if the server is correctly configured, a similar image as shown should appear:
As it can be seen, all the different objects defined in the Telecontrol Configurator appear here.
4. Send a command to the server
- Right click over the main interface and select "Point Command"
- Select the Command object defined in the Telecontrol configurator. In this case: "Set Point Float"
- Check that the Object type matches with the one configured in the Telecontrol configurator
- Enter the IOA of the "Set-point command". In this case it was 514
- Enter a value that will be sent to the server
- Send Set Point Float Command
- Check that the value has been updated in the "Measured value" object. In this case it is the one with the IOA = 257.
As it can be seen, the slave has successfully sent a command with the use of the command object and given this value to the measured value object.