LogFileReduce (FB)

FUNCTION_BLOCK LogFileReduce EXTENDS AbbLConC2

This function block is used to maintain the file ring buffer in the multifile logging.

This function block is only usable in connection with LogMultifile. The function block is depended on outputs FileMoved and MovedFilename of LogMultifile. These outputs to be connected to the homonymous input of the LogFileReduce.

The function block can manage up to 20 file names, beyond that oldest file will be deleted.

InOut:

Scope

Name

Type

Initial

Comment

Input

FileMoved

BOOL

FALSE

2: File has been moved with MovedFilename - connect output with the same name in LogMultifile

MovedFilename

STRING

‘’

3: Timestamp file including path: FilePath + filename, connect output with the same name in LogMultifile

ADRbufferFiles

POINTER TO STRING

4: Buffer files array, connect using ADR operator. Array size should be larger than NumFiles configured

NumFiles

UDINT

0

5: Number of needed filenames in stack. When this number is exceeded, then delete the supernumerary file, maximum 20 files possible

Output

ErrorID

ERROR_ID

NO_ERROR

3: ErrorID is always accompanied by an error and abort of the function block processing, Refer ERROR_ID enumeration for details of the error

FileError

FILE.ERROR

FILE.ERROR.NO_ERROR

4: File operation error details, see CAA_File Library for error details

Message

LOG_ENUM_STATE

zLOG_IDLE

5: Messages of the processing of the function block, block is not aborted only a detailed message is provided from enumeration LOG_ENUM_STATE

ActualNumFiles

UDINT

6: Actual number of files in FilePath - please define this as VAR_RETAIN

Methods:

B_CyclicAction

D_AbortAction

E_ResetAction

Structure: