FB_IEC870_5_101ErrorFifo
IEC 60870-5-10x error FIFO. The oldest entry is overwritten. The FIFO has a constant size. The size is determined by the constant: IEC870_MAX_ERROR_FIFO_SIZE (default: 10 elements).
The function block features three tasks:
- AddError (adds a new error message to the FIFO);
- RemoveError (removes the oldest error message from the FIFO);
- Reset (clears all error messages and resets the FIFO);
Error messages are normally added to the FIFO via the internal IEC 60870-5-10x device functions. The PLC application can read and analyses these error messages by calling the task: RemoveError.
VAR_INPUT
VAR_INPUT
putError : ST_IEC870_5_101ErrorFifoEntry;
putObj : ST_IEC870_5_101AOGen;
END_VAR
putError: Error message to be added to the FIFO.
putObj: Additional information about the application object (data point), to which the error message relates. This information is optional and not always present.
VAR_OUTPUT
VAR_OUTPUT
getError: ST_IEC870_5_101ErrorFifoEntry;
nErrors : UDINT;
bOk : BOOL;
getObj : ST_IEC870_5_101AOGen;
END_VAR
getError: Error message to be removed from the FIFO.
nErrors: Returns the current number of FIFO entries (error messages in the FIFO).
bOk: This variable becomes TRUE if a new entry was successfully added to or removed from the FIFO.
getObj: Additional information about the application object (data point), to which the error message relates. This information is optional and not always present.
Sample in ST:
In the following ST example, the device error FIFO is read, and the registered errors are written to the TwinCAT XAE->"Error List".
PROGRAM P_LogErrors
VAR_IN_OUT
fbErrors : FB_IEC870_5_101ErrorFifo;
END_VAR
REPEAT
fbErrors.RemoveError();
IF fbErrors.bOk THEN
ADSLOGSTR( ADSLOG_MSGTYPE_ERROR OR ADSLOG_MSGTYPE_LOG, 'IEC 60870-5-10x device error: 0x%s',
DWORD_TO_HEXSTR( fbErrors.getError.nErrId, 8, FALSE) );
END_IF
UNTIL NOT fbErrors.bOk
END_REPEAT
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) |