Central station Minimal (Master)

Simple central station application that uses the TwinCAT IEC 60870-5-104 high-level interface.

Download TwinCAT XAE Project (*.zip): MiniMasterSample104.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 substations):

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

MAIN

PRG

This program part implements the telecontrol protocol (slow task).

fbClient

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

bSPI

BOOL

The received ON/OFF value is mapped into this PLC variable directly to the allocated flag address: AT%MX0.0.

bSCS

BOOL

The ON/OFF value to be sent is mapped directly from the flag address AT%MX1.5 of this allocated PLC variable.

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.