beckhoff TF4100 — 4.2.1.6.3 FB_CTRL_LOG_MAT_FILE

PLC API The input data is written at equal time intervals in the columns of the data array. A time stamp for the relevant entry, in s, can be stored in the first column. The time interval between the entries is specified in the tLogCycleTime parameter. If, for instance, "tLogCycleTime := T\#2s" is chosen, then an entry is made in the file every 2s. 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, which will then not be consistent. 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 1500 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 nLoggedColumns : DINT; bBusy : BOOL eErrorId : E_CTRL_ERRORCODES; bError : BOOL; END_VAR TF4100 128 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 1500 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. If a buffer overflow occurs, the function block is stopped and an error is output. 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.