Time Stamp and Quality Tags Configuration
- Last UpdatedMar 14, 2024
- 4 minute read
The Plant SCADA OPCLX driver can use additional variable tags for quality and time stamp values. Quality or time stamp tags are duplicates of a variable tag, with an appended "!Q" or "!T" or "!M" in the address field to define their purpose. Quality tags need to be configured as either INT or DIGITAL data types, whereas time stamp tags need to be configured as LONG data types.
Below table shows the example of quality or timestamp tags:
|
Address |
Plant SCADA type |
Description |
|---|---|---|
|
[OPCTopic]<item_id>!Q |
INT |
The quality reported for the item. |
|
[OPCTopic]<item_id>!T |
LONG |
The second's component of the timestamp reported for the item (in UTC seconds). |
|
[OPCTopic]<item_id>!M |
LONG |
The milliseconds component of the timestamp reported for the item. |
If you need to know if an OPC item is good or bad quality (that is, not uncertain), you should consider using DIGITAL data types for quality tags in combination with [OPCLX]DigitalQualityUncertainIsBad, rather than using Cicode to compare the value of an INT quality tag against 0xC0
Note: The quickest way to create a quality or time stamp tag in Plant SCADA is to locate the relevant variable tag using the Variable Tags dialog box. Edit it as required to create a quality or time stamp tag, and save it. This creates a copy of the original variable tag with the required changes saved.
To create a quality tag:
-
Go to the System Model activity of the Plant SCADA Studio.
-
On the menu below the Command Bar, select Variables.
-
Add a row to the Grid Editor, or locate and display the equipment to which you want to associate the quality tag.
-
Type the required information in each column, or in the fields in the Property Grid.
-
In the Tag Name box, enter an appropriate and unique name for the quality tag, such as "<Tagname>_Quality".
-
In the Data Type box, choose INT or DIGITAL from the menu.
-
In the I/O Device box, select the appropriate I/O device for the tag (if not already displayed).
-
In the Address box, enter the name of the tag you want to associate with the quality value (if not already displayed), and append "!Q" directly to the end of the address (without the quotes and without any spaces).
-
Click Save.
Note: If the exclamation mark character (!) is already defined in the tag address field (for example, you have already used it to declare an array size "!A[n]"), you either need to include another exclamation mark (for example, append "!Q" to the tag address) after the closing square bracket of the array size declaration, or you can specify quality for arrayTag!A[5] with arrayTag!Q".
To create a time stamp tag:
-
Go to the System Model activity of the Plant SCADA Studio.
-
On the menu below the Command Bar, select Variables.
-
Add a row to the Grid Editor, or locate and display the equipment to which you want to associate the quality tag.
-
Type the required information in each column, or in the fields in the Property Grid.
-
In the Tag Name box, enter an appropriate and unique name for the quality tag, such as "<Tagname>_sTimestamp" (for seconds) or "<Tagname>_msTimestamp" (for milliseconds).
-
In the Data Type box, choose LONG from the menu.
-
In the I/O Device box, select the appropriate I/O device for the tag (if not already displayed).
-
In the Address box, enter the name of the tag you want to associate with a time stamp value (if not already displayed), and append "!T" or "!M" (as appropriate).
Note: If there is already an exclamation mark with other declarations included in the tag address, you do not need to include them for timestamping. For example, a time stamp tag monitoring TagName!A[64] can be addressed as TagName!T.
-
Click Save.
Note: Time stamps store the number of seconds since 01/01/1970 when using the "!T" element, or the number of milliseconds since midnight using the "!M" element. If you want to store a complete time in millisecond accuracy, you need to create two separate time stamp tags, one for seconds and one for milliseconds, each addressed appropriately.
Examples
In the following examples, an OPC device tag defined on a OPC server is associated with the base Plant SCADA variable tag named Present_Value:
|
Variable Tag Name |
Present_Value |
|
Address |
[OPCLX_test]present_value |
|
Plant SCADA Data Type |
Data type required by project (for a list of data types, see Data Types) |
Example 1
Use the following settings to associate a Plant SCADA variable tag with the quality stamp of the OPC register value:
|
Variable Tag Name |
Present_Value |
|
Address |
[OPCLX_test]present_value!Q |
|
OPCLX Type |
VT_QUALITY |
|
Plant SCADA Data Type |
INT or DIGITAL |
Example 2
The following tag definition reads the timestamp value measured in seconds from 1/Jan/1970:
|
Variable Tag Name |
Present_Value |
|
Address |
[OPCLX_test]present_value!T |
|
OPCLX Type |
VT_TIMESTAMP |
|
Plant SCADA Data Type |
LONG |
Example 3
The tag definition below reads the Millisecond time stamp value measured in UTC FileTime from beginning (midnight) of the current day:
|
Variable Tag Name |
Present_Value |
|
Address |
[OPCLX_test]present_value!M |
|
OPCLX Type |
VT_MILLISECOND |
|
Plant SCADA Data Type |
LONG |
The base Plant SCADA tag needs to be defined in Plant SCADA before the time stamp and quality values of the associated OPC server tag value can be read.
See also Data Types and Quality Values.