Reading OPC quality into a digital PI point
- Last UpdatedMay 21, 2025
- 1 minute read
To store OPC quality in a digital PI point, use transformations and scaling to translate quality to a digital state set of Bad Value, Questionable Value, Invalid Value, or Good Value.
To define such a PI point, set location2 to 4 to read the quality of the item rather than its value, then define a mathematical transformation that translates the quality values to an integer from 0 to 3. Divide the quality number by a conversion factor that produces the proper number.
OPC quality is returned in ranges of values, as follows:
|
Range |
Description |
|---|---|
|
Less than 0x40 |
Bad Value |
|
Greater than or equal to 0x40 and less than 0x80 |
Questionable Value |
|
Greater than or equal to 0x80 and less than 0xc0 |
Not used by OPC |
|
Greater than or equal to 0xc0 |
Good Value |
Because each range has the same size (decimal 64), you can use a simple conversion to obtain the corresponding digital state, as follows:
|
Convers |
TotalCode |
SquareRoot |
Dzero |
Operation |
|---|---|---|---|---|
|
Not 0 |
3 |
0 |
Defined |
Input points: Value = (Value / convers) – Dzero Output points: Value = (Value + Dzero) * convers |
Define the point attributes as follows:
|
Attribute |
Setting |
|---|---|
|
convers |
64 |
|
totalcode |
3 |
|
squareroot |
0 |
|
exdesc |
"Dzero=0" |