Download: Central station (master)
Simple central station application that uses the TwinCAT IEC 60870-5-102 low-level interface. This sample application can communicate with up to three substations via an RS232 interface. However, in the program only the communication to the first substation is activated.
Download TwinCAT XAE Project (*.zip): LowLevelMasterSample102.zip
In the sample project, the following station parameters are set for the central station:
- Standard PC interface: COM1.
- Baud rate: 19200 baud.
- Link address: 220 (first substation), 221 (second substation), 222 (third substation).
- Link address size: 2 octets.
- Common ASDU address: 7 (first substation), 8 (second substation), 9 (third substation).
- Common ASDU address size: 2 octets.
Sample implementation of the following services:
- Retrieves a list of single points with time tag of a selected period (C_SP_NB_2) every 30 seconds.
- Retrieves the manufacturer and product specification (C_RD_NA_2) every 10 seconds.
The following table briefly describes the main components of the project:
Component | Type | Description |
---|---|---|
P_MAIN_LowSpeed | PRG | This program part implements the telecontrol protocol (slow task). |
P_SerialComm_HighSpeed | PRG | This program part implements TwinCAT background communication via the serial interfaces of the PC (fast task). |
aClients | ARRAY OF FB_IEC870_5_102M (FB) | Implements the central station. An instance of this function block can only communicate with one substation. For each additional substation to communicate with, another instance of this function block is required. |
fbServices | FB_IEC870_5_102MServices ( FB) | Includes a simple implementation of some services such as reading the manufacturer/product specification, retrieving the list of single points, etc. |
aProcData | ARRAY OF ST_IEC870_5_102MProcData (STRUCT) | Here you can found constantly updated process data – either received or to be sent. |
sysPara | ST_IEC870_5_102MSysPara (STRUCT) | Configuration of the system parameters of the central station and the implemented services. |
fbLog | FB_IEC870_DebugLogFifo (FB) | A simple log buffer for debugging/troubleshooting purposes. |