Download: Central station Tutorial (master, unbalanced mode)

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

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

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

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

Initialization sequence that is executed once/automatically after the connection is established:

Sample implementation of the following services:

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).

fbClient

FB_IEC870_5_101Master (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.

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.

hTable

T_HAODBTable (STRUCT)

Application object database handle. These variables are used to access the application object database and never directly the individual array elements.

F_iecCreateTableHnd

FUNCTION

In the initialization step, all array elements of AODB are initialized once with this function call. If successful, this function call returns the handle.

F_iecAddTableEntry

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.

fbHandler

FB_IEC870_5_101TableEventHandler (FB)

This function block informs the application when data point data has been changed or updated.