Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI Interface for OPC DA

Data type compatibility

  • Last UpdatedMay 21, 2025
  • 3 minute read

PI Interface for OPC DA supports all PI point data types collected in your PI Data Archive, including string. The only data type the interface does not support is BLOB.

The data type of a PI point must be compatible with the data type of the corresponding OPC item. For example, if a string value from the OPC server is to be put into an Int32 PI point, the string must contain a number. If a 64-bit floating-point value is to be put into an Int16 point, its value must not overflow the target data type.

PI Interface for OPC DA specifies the desired data type when requesting information from the OPC server and the OPC server is responsible for delivering the requested data type if it can.

PI Interface for OPC DA normally requests values using the following default data types:

PI System data type (pointtype)

OPC data type

Digital

Two-byte Integer (VT_I2)

Int16

Two-byte Integer (VT_I2)

Int32

Four-byte Integer (VT_I4)

Float32

Four-byte Float (VT_R4)

Float64

Eight-byte Float (VT_R8)

String

String (VT_BSTR)

For additional details on the PointType values, see Data Archive Administration.

If your OPC server does not permit clients to specify a data type, set location2 to 8 for all your OPC-based PI points to configure the interface to request the canonical, or native, data type from the OPC server.

Note: PI Interface for OPC DA might receive data for which no reasonable conversion is possible. Where possible, always specify the OPC data type that matches the PI point.

Int16 and Int32 point types

If you use a Int16 point type and expect negative numbers from the OPC server, this does not occur because this point type is an unsigned 15 bit integer. You should use the Int32 data type instead.

Additionally, the Int32 point type does not support the full range of Int32 values. The lowest 32,767 values of the 32-bit range are reserved. If you expect values in the reserved range (-2147483647 to -2147450880) from the OPC server, you should use a float point type instead.

OPC numeric strings

Some OPC servers return certain numeric data types only as strings. To interpret string-formatted Int16, Int32, Float32, and Float64 values, set location2 to 1. PI Interface for OPC DA requests the data as a string (VT_BSTR) and interprets the data as a number.

Digital PI points contain integer values that correspond to specific strings in the digital state table in the point's digital set property. Some devices read and write the string value rather than the integer value. To read and write digital points as string values, set location2 to 1. Make sure that the strings used by the OPC server are identical to the strings in the digital set, including punctuation and spaces. For optimal performance, read digital points as numbers whenever possible.

Boolean values

Some OPC servers send Boolean values as 0 and -1 when read as integers. This approach creates a problem when reading that data into a digital PI point, because "-1" is not the value that must be stored. To handle the data from such servers, the interface uses the absolute value of any integer or real values read for digital points. Because digital point values are actually offsets into the digital set for the point, and a negative offset has no functional meaning, this issue does not cause problems for properly-written servers.

PI Interface for OPC DA can also request the item as a Boolean (VT_BOOL). This approach only works for items that have two possible states, because any non-zero value is interpreted as 1. To have items read and written as though they were Boolean values, set location2 to 2.

Four-byte integers

If your OPC server does not support the two-byte integer (VT_I2) data type, you can configure PI Interface for OPC DA to request the data as a four-byte integer (VT_I4) by setting location2 to 3.

Float64 values

To handle eight-byte floating-point numbers (VT_R8), set the location2 of the target point to 5. Data Archive stores the value as a four-byte floating-point number, with possible loss of precision. If the number is too large to fit in the point, a status of BAD INPUT is stored.

TitleResults for “How to create a CRG?”Also Available in