FB_CsvRead Rules and Constraints

Rules and Constraints

Comply with the following constraints for reading a CSV file:

  • Only CSV files with ASCII encoding are supported.

    It is not verified whether the file encoding is actually ASCII. If the file contains characters outside the range of the ASCII character code set, the values rendered by the application are not valid.

  • The values read from the file are stored as STRING values in the application. This applies even to numeric values. Before they can be processed, the values need to be converted to the appropriate datatype. To achieve this, it is a good practice to use the STRING_TO_ conversion functions. The conversion functions require a specific syntax of the STRING values depending on the target datatype. Consider these requirements when creating the files to simplify the processing of read values.

  • 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 read operation. If the value specified for the timeout is exceeded during execution of the FB_CsvRead function block, the read operation is canceled and the function block generates an error. To select an appropriate value for the timeout parameter, consider that the read 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 size of the file to be read, on the size of the processing block which can be specified by the parameter Gc_uiCsvReadProcessingBlockSize in the GPL. Analyzing the content of the file is split into several read operations to reduce the load for the single task cycle. During each read operation, one data block is processed and, if requested, stored to the buffer. The larger the processing block size, the fewer cycles are required for reading the file. However, a larger block size increases the execution time of this single read operation.

  • The character code specified as delimiter is not supported as part of a value.

  • 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.