Controlled station connection redundancy (slave)

A more complex substation application with different data points in both directions and two connections to the central station. The sample application uses the TwinCAT IEC 60870-5-104 high-level interface.

Download TwinCAT XAE Project (*.zip): TutorialSampleSlave104R.zip

In the sample project, the following station parameters are set for the substation:

Data point configuration (it should be the same as the data point configuration of the central station):

Sample implementation of the following services:

The following table briefly describes the main components of the project:

Component

Type

Description

MAIN

PRG

This program part implements the telecontrol protocol

hServer

T_HSERVER (STRUCT)

The server connection handle.

fbServer

FB_IEC870_5_104SlaveGrp (FB)

Implements the substation. An instance of this function block can only communicate with one central station. For each additional central station to communicate with, another instance of this function block is required.

F_CreateServerHnd

FUNCTION

This function initializes the server connection handle.

AODB

ARRAY OF ST_IEC870_5_101AODBEntry (STRUCT)

Application object database. It's an array variable. An array element is required for each data point.

F_iecInitAOEntry

FUNCTION

In the initialization step, the individual data points of the station are configured once with this function call.

memory

ST_MemoryData (STRUCT)

This structure contains constantly updated process data – either received or to be sent.

F_iecSetAOQuality

FUNCTION

This function demonstrates how the quality flags of M_SP_NA_1(IOA := 100) can be set/reset.

F_iecGetAOQuality

FUNCTION

This function demonstrates how the quality flags of M_SP_NA_1(IOA := 100) can be queried.

aConnections

ARRAY OF ST_IEC870_5_104ServerConnection (STRUCT)

Each array element represents a connection to the central station.