F_iecResetStream

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

 

F_iecResetStream 1:
F_iecResetStream

The function initialises ans resets the stream variable. As an option the internal data buffer of the stream variable can be initialised with a defined number of zero bytes. The return value of the function delivers the number of successfull initialised zero bytes.

FUNCTION F_iecResetStream: UDINT

VAR_INPUT
    cbLength : UDINT; (* number of init data bytes *)
END_VAR
VAR_IN_OUT
    stream  : ST_IEC870_5_101Stream;
END_VAR

cbLength: Number of data bytes to be initialised.

stream: Variable to be initialized.

 

Example in ST:

After run the internal buffer odf the stream variable is reset and initialised with 5 zero bytes.

PROGRAM P_ResetStream
VAR
    stream : ST_IEC870_5_101Stream;
    bReset : BOOL := TRUE;
END_VAR
IF bReset THEN
    bReset := FALSE;
    F_iecResetStream( 5, stream );
END_IF

 

Memory description of stream variable after run:

length

data

5

16#00

16#00

16#00

16#00

16#00

...

...

...

...

...

...

IEC870_MAX_ASDU_DATA_BYTE

 

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.10.0 Build >= 1301

PC or CX (x86)

CX (ARM)

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