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

Inherited from

Input

Enable

BOOL

FALSE

A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. A falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.

AbbLConC2

Output

Busy

BOOL

FALSE

Operation is running (while output Error is FALSE)

AbbLConC2

Error

BOOL

FALSE

Operation is stopped with error (while output Busy is FALSE). This output is TRUE for at least one cycle or until Enable is set to FALSE. The output ErrorID gives more details about the error.

AbbLConC2

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: