PLC API The time stamp of the log entry, in s, is stored in the first column of the file. The other columns contain the data of the function block input fLogData . When the mode is set to eCTRL_MODE_ACTIVE the log file is opened and entries are written into the file. The file remains open until the function block's mode is set to eCTRL_MODE_PASSIVE . It is essential that the file is closed by switching into eCTRL_MODE_PASSIVE before attempting to analyze the log file. If this is not done, it is possible that not all the entries will be written into the file. The function block makes it possible to work with or without an external buffer.
The external buffer is used if a buffer address and a buffer size greater than zero are parameterized. In the absence of an external buffer, an internal buffer with the size of 255 bytes is used. Inputs VAR_INPUT fLogData : T_CTRL_LOGGER_DATA; eMode : E_CTRL_MODE; END_VAR VAR_GLOBAL CONSTANT nCTRL_LOGGER_DATA_ARRAY_SIZE : UINT := 10; END_VAR TYPE T_CTRL_LOGGER_DATA : ARRAY [1..nCTRL_LOGGER_DATA_ARRAY_SIZE] OF FLOAT; END_TYPE Outputs VAR_OUTPUT eState : E_CTRL_STATE; bFileOpen : BOOL bFileClosed : BOOL fBufferUsage : FLOAT bBusy : BOOL eErrorId : E_CTRL_ERRORCODES; bError : BOOL; END_VAR TF4100 125 Version: 2.2.4 Operating without an external buffer:
The bBusy output is TRUE when the logging of a row has been started. The following data set will not be logged until the bBusy output is FALSE again. The fBufferUsage output indicates how full the internal buffer is. Operating with an external buffer: The user must create a buffer larger than 255 bytes and with the type ARRAY OF BYTES. The individual messages are temporarily stored in the external buffer, and this buffer is written into the file as quickly as possible. The fBufferUsage output indicates how full the buffer is. The function block is stopped and an error is output if the buffer overflows.
Name Type Description fLogData T CTRL _ _ LOGGER DATA _ Array containing the values that are to be written into the log file. eMode E CTRL MODE _ _ Input that specifies the operation mode [} 173] of the function block.