Data type handling attribute (location2)
- Last UpdatedNov 16, 2022
- 3 minute read
The location2 attribute configures handling of data types for PI Interface for OPC DA.
Valid settings for location2 are as follows:
|
Value |
Description |
|---|---|
|
0 |
Normal processing; no special handling is used. |
|
1 |
Read and write value as a string. For digital points, the strings read from the OPC server must match the strings in the digital state set used by the PI point. For integer and real points, the interface requests a string value, and translates it to a number. |
|
2 |
Read value as a Boolean. Boolean values are either zero or nonzero. For numeric points, any value but 0 (False) is set to -1 (True). Use this option to correctly convert an OPC server Boolean value into the PI System digital state, which prevents the PI point from receiving Bad quality values for a Boolean value that is True. |
|
3 |
Read value as a four-byte integer. This setting accommodates servers that cannot send the value as a two-byte integer, which is how digital points are normally read. |
|
4 |
Stores the quality of the item rather than the value. |
|
5 |
Request real points as VT_R8 items (eight-byte real). By default, the interface requests real points as VT_R4 items (four-byte real). For float32 points (including all PI2 Real points), values that cannot fit in a 32-bit floating-point number lose precision. This setting is included to support servers that do not translate VT_R8 data to VT_R4 data and to permit the use of float32 points where the benefit of greater precision is not worth the overhead of using float64 points. |
|
6 |
Read time stamps from the OPC server as strings and transform them into seconds. The PI point can be an int or a float. The format of the time stamp string is specified in the interface batch file using the tf parameter. |
|
7 |
Read time stamps from the OPC server as VT_DATE variables. These values can be translated into time stamp strings or passed to Data Archive as a number of seconds, suitable for use in computations. If the value is translated into a string, the format of the time stamp string is specified in the interface batch file using the tf parameter. |
|
8 |
Directs the OPC server to send the canonical data type. The interface tries to transform the value into the proper data type for the PI point. Use with caution, because the transformation can fail if the source data type is not compatible with the PI point data type, or if the value cannot be represented using the PI point data type. |
|
>= 1024 |
When a post-processing DLL is used with PI Interface for OPC DA, directs the data to be processed by the DLL. Adding any of the above settings (1-8) to 1024 enables those options to be used during processing. The Location2 tag attribute specifies what special handling should be done with the data, such as asking for a different data type than would normally be requested for a given tag type. When using certain OPC-DA plug-ins the value 1024 is added to whatever value Location2 already has. This allows most standard functionality of the interface to be maintained, and allows the OPC-DA plugin code to apply additional rules. Thus, if the tag is a Float32, but the OPC server can only provide the data if it has a VT_R8 (64-bit floating point number), and the interface is using the Time Array plug-in, Location2 would ordinarily be set to 5. To do the same thing for a tag that will receive an array of time-series data, set Location2 = 5 + 1024 = 1029. |