The OPC Data Access standard uses Fieldbus quality flags. The interface translates those quality flags to the closest approximation within the PI System State table. The low 8 bits of the Quality flags are currently defined in the form of three bit fields, Quality, Sub-status and Limit status. The 8 Quality bits are arranged as follows:
QQSSSSLL
The tables at the end of this section give the transformation to PI status. The second table gives the status codes that will be used if the PI system is version 3.3 or higher. That version of PI is the first that defines the states needed by the OPC interface so that the interface will not use the Archive Offline and other states which were causing some confusion.
Questionable Qualities -- Store the Status or the Value?
Because the PI archive stores either the quality or the value, the interface will translate the qualities in the “questionable” category to GOODSTAT, and set the “questionable value” flag for the data value. “Bad quality” flags get the corresponding PI status stored for the tag. If the quality is SUBSTITUTED_ST, the interface will currently store the status rather than the value sent. This behavior can be changed with the /SQ parameter in the startup file. Setting /SQ=Y parameter will cause the interface to store the quality (translated to a PI digital state) if the quality is anything but GOOD. Similarly, if /SQ=I is set, the interface will ignore the "questionable" quality, and treat the value as if it had good quality.
Quality
no /SQ parameter
/SQ=Y
/SQ=I
GOOD
value
value
value
Questionable
value, parameter
digital state
value
BAD
digital state
digital state
digital state
The behavior can be enhanced to send only GOOD quality data by setting the /SG parameter. If the /SG is set, only GOOD quality data will be sent to PI. Questionable quality data and BAD quality data will be ignored.
If the /SQ=I or /SQ=Y flag is also set, then Questionable Quality data will be sent to PI as described above. BAD quality data will continue to be ignored.
The quality information will continue to be sent to tags that are configured to store quality instead of values.
Storing Quality Information Directly
Storing the quality in a separate PI tag is also an option, so both the values reported and the qualities that came with those values are recorded, with no loss of granularity. Setting Location2=4 for a tag tells the interface to store the quality for the associated ItemID rather than the value. Since OPC qualities are unsigned, 16-bit integers, the interface expects to have an Int32 tag to receive them. The values are stored in PI without any change, and their status is always GOOD. To understand what those quality values represent, please go to http://www.opcfoundation.org and download the OPC Data Access specifications, which contain a brief discussion of quality data. The OPC quality table can also be found in the PI OPCClient User’s Guide.
Note: The column on the left in the tables below is a bit mask. The first number, for instance, would correspond to a hexadecimal value between 0xC0 (11000000 bit mask) and 0xFF (11111111 bit mask).
Quality States Used with PI Systems Earlier than PI 3.3
Quality States Used with PI Systems Version PI 3.3 and Later
Good Quality
Quality
OPC Definition
PI Status
11SSSSLL
Non-specific
Good
Except
110110LL
Local Override
_SUBStituted
Not Used by OPC
Quality
OPC Definition
PI Status
10SSSSLL
Invalid
Bad Input
Questionable
Quality
OPC Definition
PI Status
010110LL
Sub-Normal
Bad_Quality
010101LL
Engineering Units Exceeded
QQSSSS01
Low Limited
Under LCL
QQSSSS10
High Limited
Over UCL
Otherwise
Inp OutRange
010100LL
Sensor Not Accurate
QQSSSS01
Low Limited
Under Range
QQSSSS10
High Limited
Over Range
Otherwise
Out of calibration
Invalid Data
010011LL
Invalid
Bad Input
010010LL
Invalid
Bad Input
010001LL
Last Usable Value
No_Sample
010000LL
Non-specific
Doubtful
Bad Quality
Quality
OPC Definition
PI Status
000111LL
Out of Service
Out of Service
000110LL
Comm Failure
Comm Fail
000101LL
Last Known Value
Scan Timeout
000100LL
Sensor Failure
Equip Fail
000011LL
Device Failure
Unit Down
000010LL
Not Connected
Not Connected
000001LL
Configuration Error
Configure
000000LL
Non-specific
Bad
Through the use of the /AS=system_digitalcommand line option, it is possible to replace the default PI statuses (i.e. digital states) listed in the table above with custom states. To use this command line option it is necessary to create a marker digital state in the system digital state set that corresponds to system_digital. Following this marker state, 18 digital states can be created to override the default statuses listed in the above tables. The order of the digital states along with the PI statuses that are replaced are listed in the table below.