ST_IEC870_5_101TBuffer

From product version:  TwinCAT PLC Library IEC60870-5-104 substation v2.0.6 / IEC60870-5-101 substation v2.0.2 and higher.

This data structure is used for data exchange (TX/RX data buffer) via the IEC60870-5-104/101 Transport Interface.

TYPE ST_IEC870_5_101TBuffer :
STRUCT
    eDbg        : E_IEC870_5_101FifoDbgFlags :=eIEC870_FIFO_DBG_OFF; (* enable/disable log view hex output *)
    asduFmt     : ST_IEC870_5_101AsduFmtParams; (* ASDU frame format parameters *)
    asduSize    : BYTE := 0; (* max. length of ASDU data *)
    mode        : DWORD := 0;
    dataLink    : ST_IEC870_5_101DataLink; (* internal tx/rx buffer *)
    bOverwrite  : BOOL := FALSE;(* TRUE = Overwrite oldest entry, FALSE = don't overwrite *)
END_STRUCT
END_TYPE

eDbg: Debug output parameter.

asduFmt: ASDU format parameter.

asduSize: Maximum length of ASDU data.

mode: Reserved, not used. This value must be zero.

dataLink: The access to the elements of this data structure should only occur with an instance of the function block FB_IEC870_5_101TBufferCtrl, not directly.

 

The TX/RX data buffer uses internal two send Fifos and one receive Fifo:

  1. Class 1 send Fifo  with (high prior) data;
  2. Class 2 send Fifo with (low prior) data;
  3. Receive Fifo (for Class 1 and Class 2 data);

The lower transport functions of the library emtpy first the class 1 Fifo and afterwards the class 2 Fifo. The class 2 data are only sent, if the class 1 Fifo contains no data to be sent.

 

Each internal Fifo hast a fixed size of 10000 bytes. This is enough for the most applications, because the number of frames which can once be sent is limited by the iK and iW protocol parameters.
According to experience it is possible to store 200 ADSUs with an information element (object), or approx. 20 ADSUs with with a sequence of 100 information elements (objects) in each Fifo.

 

If a higher number of frames (to be sent or to be received) should be buffered ( e.g. ~20000), they can be kept in external buffers/Fifos which are defined by the PLC programmer. The PLC application can refill the TwinCAT send Fifos with own Fifo entries, or empty the TwinCAT receive Fifo.

As an alternative it is possible to use two buffers and to fill/read them alternately and give them to the communication block .

 

bOverwrite: Implemented from IEC870-5-104 slave library  v3.0.14 and higher. Activates/deactivates the overwriting of the oldest messages in the send buffer if the max. permissible buffer size is exceeded. This parameter is active only in the offline mode, (i.e. if the connection has been interrupted) and if offline data storage has additionally been activated via the bRetainBuffer parameter in the protocol parameters (ST_IEC870_5_104ProtPara). In online mode, i.e. if data transfer has been started, no older messages are overwritten (otherwise some intermediate values would possibly be missing).

 

 

 

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.10.0 Build >= 1301

PC or CX (x86, ARM)

TcIEC870_5_101.Lib
( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib; are included automatically )