The CSV File Tag represents a comma separated variables (CSV) file that the driver reads and extracts values from.
The CSV File driver supports write operations using a CSV Update File:
Although CSV is not a formal standard, the Internet Engineering Task Force (IETF) has published the memo RFC 4180, which describes the format and layout of CSV files. The driver supports CSV files conforming to RFC 4180.
The CSV File supports the configuration properties of the Core Tag plus these additional configuration properties:
Property | Type | Version | Description |
---|---|---|---|
ReadInterval | TIME | 1.6 | The interval between each read. An interval value of zero (T#0s) disables periodic query execution. See Interval and Offset for information on how Intervals and Offsets define the time of activities. |
ReadOffset | TIME | 1.6 | The offset added to the ReadInterval to get the actual read time. See Interval and Offset for information on how Intervals and Offsets define the time of activities. |
FileName | WSTRING | 1.6 | The name of the CSV file to read. |
RetryAttempts | UINT | 1.6 | The maximum number of consecutive file open failures before a file access attempt is considered failed. |
RetryInterval | TIME | 1.6 | The interval between consecutive file open attempts. |
AlarmSeverity | UINT | 1.6 | The severity of the alarm raised when all attempts to read the CSV file have failed. |
UpdateFileName | WSTRING | 1.6 | The name of the optional CSV update file. Write requests to tags are appended to this file. If write operations are not required, this field can be left blank. |
The CSV File driver can support write operations using a CSV update file. When a write request is made on a tag, a new line is appended to the CSV update file. The format of the new line is:
TagName=Value
The tag name is taken from the WriteTagName property of the tag. To complete the write request, an external program should periodically read and delete the CSV update file.
The driver expects the CSV File and CSV Update File will be occasionally inaccessible because an external program is accessing these file(s). To avoid false alarms, the CSV File driver will try up to RetryAttempts to open the external file before reporting an error. The delay between retry attempts is configured by the RetryInterval property.
If the driver can not access the CSV File after exhausting all of the retry attempts, an alarm will be raised on the CSV File object. If the driver can not access the CSV Update File after exhausting all of the retry attempts, the write request(s) that initiated the update will be failed.
Similarly, the external program generating the CSV file should be prepared to deal with Fernhill SCADA reading the file and preventing the external program from updating it.
The CSV File supports the dynamic properties of the Alarm Tag, plus these additional dynamic properties:
Property | Type | Description |
---|---|---|
FileState | UINT | A code indicating the state of the external CSV File. The value 15 indicates the CSV file was successfully read. Other values indicate an error. The ErrorMessage property may give additional information. |
ErrorMessage | WSTRING | An error message providing additional information. |
ReadTimer | TimerStatus | The status of the read timer. |
The FileState property can be used to diagnose problems with the CSV file:
ServerState | Description |
---|---|
0 | Initial state before the driver has started |
1 | The driver was unable to open the CSV File |
15 | The CSV file was successfully read |
The CSV File supports the tag commands of the Alarm Tag plus these tag commands:
Tag Command | Version | Description |
---|---|---|
Refresh | 1.6 | Requests an immediate read of all of the tags associated with this CSV File. |
Note: Event triggered data reads (from the Refresh tag command) and periodic data reads (defined by the ReadInterval property) are independent. You can use the Refresh tag command, or the ReadInterval property, or both to determine when the tags are read.
The CSV File Tag builds on the features of these tag types:
To learn how activities are scheduled using Interval and Offset.
To learn about the IO Analog Data Tag that can be associated with the CSV File.
To learn about the IO Digital Data Tag that can be associated with the CSV File.
To learn about the IO String Data Tag that can be associated with the CSV File.
To learn about the IO Word Data Tag that can be associated with the CSV File.
To learn about the IO Double Word Data Tag that can be associated with the CSV File.
CSV File DriverFor an overview of the CSV File Driver.
For definitions of the terms used in Fernhill SCADA.