ST_IEC870_5_104ProtocolParams

Syntax

TYPE ST_IEC870_5_104ProtocolParams :
STRUCT
    t0           : TIME := T#30s;
    t1           : TIME := T#15s;
    t2           : TIME := T#10s;
    t3           : TIME := T#20s;
    iK           : INT := 12;
    iW           : INT := 8;

    bSFrameACK   : BOOL := TRUE;
    bTESTFRAct   : BOOL := TRUE;
    bDTControlled: BOOL := TRUE;
    bControlDT   : BOOL := FALSE;

    bSTARTDTCon  : BOOL := TRUE;
    bSTOPDTCon   : BOOL := TRUE;
    bTESTFRCon   : BOOL := TRUE;

    eAcceptMode  : E_SocketAcceptMode := eACCEPT_ALL;
    sRemoteHost  : STRING(15) := '';
    nRemotePort  : UDINT := 0;

    APDULength   : BYTE(MIN_IEC870_5_104_APDULEN..MAX_IEC870_5_104_APDULEN) := MAX_IEC870_5_104_APDULEN;
    bThrottleMode: BOOL := FALSE;
    bPackFrames  : BOOL := FALSE;
    bRetainBuffer: BOOL := FALSE;
    bCOTFilter   : BOOL := TRUE;
    cotFilter    : T_IEC870_5_101COTBits := 2#10001111, 7(16#FF);
    eSwitchMode  : E_IEC870_5_104GrpSwitchMode := eIEC870_SWITCHMODE_OFF;
END_STRUCT
END_TYPE

t0: Cycle time for connection attempts (control station only).

t1: Max. timeout time for a response to a STARTDTAct, STOPDTAct or TESTFRAct frame.

t2: An S frame is sent after this time, at the latest.

t3: A test frame is sent after this time, at the latest.

iK: The connection is closed at the latest after this APDU was sent in I format but not acknowledged.

iW: The receiver acknowledges the reception at the latest after receipt of w APDUs in I format.

bSFrameACK: Send S frames.

bTESTFRAct: Send test frames.

bDTControlled : Wait for STARTDT, STOPDT frame from master.

bControlDT : Only for the master configuration: Send STARTDT to the slave.

bSTARTDTCon: Send STARTDT confirmation

bSTOPDTCon: Send STOPDT confirmation.

bTESTFRCon: Send TESTFR confirmation.

eAcceptMode : Determines whether connections are permitted to all remote clients, or only to clients with certain host and port addresses. Default: Accept all incoming connections. On the substation side this only works for a logical connection.

sRemoteHost: Host address of the remote client. If eAcceptMode = eACCEPT_ALL this parameter is ignored.

nRemotePort : Port address of the remote client. If eAcceptMode = eACCEPT_ALL this parameter is ignored.

APDULength: Maximum length of the APDU. Default values:

Max. length of APDU = 255 bytes - 1 start octet - 1 length octet = 253 octets;
Max. length of ASDU = 253 - 4 control octets = 249 octets;

bThrottleMode: The TCP/IP sockets are polled from the PLC. This parameter can be used to reduce the number of polling read access operations and therefore the system load, particularly if data are received only rarely (e.g. general interrogation or clock synchronization commands).

bPackFrames: By default a TCP/IP send call only sends a single APDU. The send performance can be increased substantially (thereby reducing send buffer overflows) by setting this parameter to TRUE.

bRetainBuffer: In the standard setting (FALSE) the internal Tc/Rx buffers are deleted when the connection is severed. If this flag is set to TRUE, the ASDUs in the internal send buffer that have not yet been sent are not deleted. Hence, offline buffering of approx. 100-200 measured values (dependent on the ASDU size) in the RAM memory is possible. The station always removes the ASDUs from the send buffer when their receipt has been confirmed. Please note that the ASDUs that have already been sent but not yet confirmed also remain in the buffer and are sent again the next time. The other station may then receive the values twice. You can configure this behavior via two further parameters: bCOTFilter and cotFilter.

bCOTFilter: Activates/deactivates the filter mask with the causes of transfer. This parameter is only valid when the bRetainBuffer parameter is also set to TRUE. A SessionID is incremented internally with each establishment of a new connection. This SessionID is always attached to the received and sent ASDUs. Hence, the ASDUs that have not yet been sent and remain in the offline buffer are assigned to the old connection. These ASDUs can then be filtered and discarded with the aid of the COT mask (cotFilter) (COT = Cause Of Transfer). This is sometimes necessary if the other communication partner does not accept the repeated ASDUs.

cotFilter: Filter mask with causes of transfer (COT = Cause Of Transfer). This parameter is only valid when the bRetainBuffer and bCOTFilter parameters have also been set. The cause of transfer of the ASDUs to be sent is only checked if their SessionID does not correlate to the current SessionID (i.e. the ASDUs originating from the previous connection). Each bit corresponds to a cause of transfer. The cause of transfer is only checked if the appropriate bit has been set.

The causes of transfer are coded in the following way in the bits:

cotFilter[0].7 = eIEC870_COT_UNUSED
cotFilter[0].6 = eIEC870_COT_CYCLIC
cotFilter[0].5 = eIEC870_COT_BACKGROUND
cotFilter[0].4 = eIEC870_COT_SPONTAN
cotFilter[0].3 = eIEC870_COT_INIT
cotFilter[0].2 = eIEC870_COT_REQ
cotFilter[0].1 = eIEC870_COT_ACT
cotFilter[0].0 = eIEC870_COT_ACT_CON
cotFilter[1].7 = eIEC870_COT_DEACT
cotFilter[1].6 = eIEC870_COT_DEACT_CON
cotFilter[1].5 = eIEC870_COT_ACT_TERM

... etc.

Default: Filtering of COT: eIEC870_COT_CYCLIC or eIEC870_COT_BACKGROUND or eIEC870_COT_SPONTAN enabled.

eSwitchMode : Redundancy group switching mode (reserved).

Requirements

Development environment

Target system type

PLC libraries to be linked (category group)

TwinCAT v3.1.4012.0

PC oder CX (x86, x64, ARM)

Tc2_IEC60870_5_10x (Communication->IEC60870)
Tc2_SerialCom (Communication->Serial)
Tc2_TcpIp (Communication->TcpIp)
Tc2_Utilities (System)