Any data logged or trended variables in a tag module must be declared with a class in the range of 1 to 6, using syntax similar to that shown in the example below:
Value (1);
The class specifies the type of data to log, as shown in the following table:
|
Class: |
Data Type: |
|
1 |
Bit |
|
2 |
Unsigned Byte |
|
3 |
16 Bit Signed Integer |
|
4 |
32 Bit Signed Integer |
|
5 |
Single Precision Floating Point |
|
6 |
Text |
If there are no variables in this class range, the tag's value will be used and will be assumed to have a class of 5.
The order in which the variables are declared determines the order in which their values are stored in the data file (using the extension ".DAT"). Both the data logger and the Trend Manager use this information.
Once a data logging file has been created, do not add to, delete, or change the order of the class 1 to 6 variables. If you must do so, delete the data logging file first; otherwise, the Trend Manager will misinterpret the file contents as valid data.
It is however, possible to swap the order of two variables that do not have the same class. For example, it is acceptable to swap the order of a class 1 variable and a class 2 variable, but it is not acceptable to swap the order of two class 5 variables.
If it is permissible for the data to be trended but not logged, the tag must be added to the "Trenders" tag group. Then, for each data logged value in the tag module, an instance of the VTS Logger module must be launched in a script once when the tag is started. Launching the Logger module will log all of the class 1 through class 6 variables.
The VTS Logger module takes the following parameters:
• Point - The object value of the tag to log to disk;
• Interval - Time interval between logs, in seconds;
• Trigger - A pointer to the value that changes state when data is to be recorded. This can be used to trigger a log on change. Incrementing a counter would be a suitable way to trigger this value, or have it point to the actual data value that is to be logged on change;
• Records - The number of records in the file; and
• Buffers - The number of records to hold in RAM before writing to disk.
The advantage of coding the Logger call into the tag module is that the user doesn't have to do any configuration work to reap the benefits of data logging. It is probably better to use the standard Logger tag to perform this task, rather than coding the Logger call into the tag module. The Logger call will be less expensive in terms of memory, but it will give the user less flexibility, and it will mean more code maintenance for you.
Any tags that call the Logger module will be automatically added to the "Loggers" and "Trenders" tag groups.