Comply with the following constraints for writing a CSV file:
File operations are time-consuming processes. To help prevent influencing time-critical control functions in your application, create a separate task with lower priority for these processes. For more information about task management, refer to the chapter System and Task Watchdogs in the Programming Guide of your controller.
The timeout parameter i_timTimeout is used to monitor the file operation. If the value specified for the timeout is exceeded during execution of the function block, the write operation is canceled and the function block indicates an error. To select an appropriate value for the timeout parameter, consider that the file operation takes several task cycles. Thus, calculate the product of the number of required task cycles and the task interval to specify the minimum value for the timeout parameter.
The number of cycles depends, besides the amount of data to be written, on the size of the processing block which can be specified by the parameter Gc_uiCsvWriteProcessingBlockSize in the GPL. The writing data to the file is split into several write operations to reduce the load for the single task cycle. During each write operation, one data block is processed and written to the file. The larger the processing block size the fewer cycles are required for creating and writing the file. However, a larger block size increases the execution time of each write operation.
Do not process the data from the buffer provided via i_stTableReadValues.pbyTable as long as the output q_xBusy of function block indicates TRUE.
Do not access the same file with different function blocks at the same time. Use the output q_xBusy to lock the execution of different function blocks.