Download: Central station (master)
Simple central station application that uses the TwinCAT IEC 60870-5-103 low-level interface. This sample application can communicate with up to 10 substations via an RS232 interface. However, in the program only the communication to the first substation is activated.
Download TwinCAT XAE Project (*.zip): LowLevelMasterSample103.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), ..., 229 (tenth substation).
- Link address size: 1 octet (fixed).
- Common ASDU address: 220 (first substation), 221 (second substation), 222 (third substation), ..., 229 (tenth substation).
- Common ASDU address size: 1 octet (fixed).
Sample implementation of the following services:
- Clock synchronization (C_SYN_TA_3) every 60 seconds.
- General interrogation (C_IGI_NA_3) every 60 seconds.
- General command (C_GRC_NA_3) if the member variable ST_IEC870_5_103MProcData.eCmdCtrl has been set to the value eIEC870_CMD_EXECUTE.
- Receipt of messages with timestamp (M_TTM_TA_3).
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_103M (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_103MServices ( FB) | Includes a simple implementation of some services such as general interrogation, clock synchronization, etc. |
aProcPara | ARRAY OF ST_IEC870_5_103MProcData (STRUCT) | Here you can found constantly updated process data – either received or to be sent. |
sysPara | ST_IEC870_5_103MSysPara (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. |