Client - Base Sample Project

This example shows the fundamental TwinCAT implementation of the communication of a TwinCAT IEC 61850 Client and the use of some methods to read data from a Server. The GOOSE components and reporting are not included in this example in the interests of simplicity. These and other functionalities are covered in separate examples. The Client implemented here attempts to establish a connection to the Server with the host address: "127.0.0.1" and port number: 102 after the PLC program start. These values can be adapted in the PLC sample code. The PLC development environment will output a warning with a note about this when translating. Double-clicking on this message will take you to the corresponding location in the PLC code.

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

The example described here uses the state machine that is described in the "General Client project structure" chapter. The States 0, 1, 11 and 100 are identical to the state machine described there. Other states were modified for the example or new states were also added.

In State 10, several IF instructions are listed that activate commands (method calls) of the Client block. The command is activated and the corresponding Client method called via a rising edge at one of the Boolean variables in the IF statement. For test purposes, the user can set the values of the Boolean variables to "TRUE" in the online view and in this way initiate the command processing.

Following the successful processing of a command, the state machine is set to State 0. If several of the Boolean variables have been set to "TRUE", the uppermost IF statement will be processed first with the respective command. The more frequent and complex the commands sent to the Server, the longer the Client will take to process them.

Some of the Boolean variables are listed in the following table. In addition, they contain the method names and a description of the function.

Commands in Sample01

Variable name

Method name

Description

bGetServerDirectory

GetServerDirectoryReq

Returns a list of all the Logical Devices of an IED (Intelligent Electronic Device).

bGetLogicalDeviceDirectory

GetLogicalDeviceDirectoryReq

Returns a list of all Logical Nodes within a Logical Device.

bGetLogicalNodeDirectory

GetLogicalNodeDirectoryReq

Returns a list of all instances of a certain Logical Node Class. In our example, it is the class: "E_AcsiLogicalNodeClass.DataSet".

bGetAllServerValues

GetAllServerValuesReq

Reads all data values of the specified IED.

bGetAllDataValues_LLN0_ST

GetAllDataValuesReq

Reads all data values of a specified Logical Node and of the specified Functional Constraint.

bGetDataValues_LLN0_ST_Beh

GetDataValuesReq

Reads all data values of a specified Data Object and of the specified Functional Constraint.

The naming of the Boolean variables is only an example and can be adapted as desired. It is only intended to show which values can be read by connecting the variables.