With PI there is usually a state from "SYSTEM" digital state set used.
Digital state numbers are 15 bit unsigned integer values. State sets are used to translate state numbers into status texts. Independently from the point type PI stores the state number with a negative sign (i.e. -248 = "No Data").
You may also be interested in the "Questionable", "Annotated" and "Substituted" bit stored with each event.
Regarding to digital state SYSTEM:
I was reading PI SDK documentation for C++. I found method "IsGood" for object PIValue. This property should represent if value contains valid data or some error state. So, when IsGood returns FALSE, then PIValue.Value returns state from the SYSTEM digital state.
So, I suppose that PIValue contains either valid data or error. It doesn't contain quality of tag with valid data. Is it correct? Or is this information save in annotations of PI tag?
You are right. If IsGood returns false, the event wears a state from SYSTEM digital state set rather than a value.
If the value of an existent event is changed, PI sets the substituted flag.
In case of an annotated event, the annotated flag will be set.
The questionable bit is set when the event has been marked questionable.
I have one additional question. If you have a look on OPC statuses in link above... They have 3 kinds of status (Bad, Uncertain, Good).
I guess that Bad quality can correspond to value from digital set SYSTEM. Does it make sense?
What about Good and Uncertain qualities. Does PI Value contain similar data?
Please see these parts in link above:
Substatus for UNCERTAIN Quality:
Substatus for GOOD Quality:
The Limit BitField
Thank you very much!
I expect the following being equivalent but this may vary depending on the data source:
Quality information in PI
IsGood=False with more detailed status information from the SYSTEM Digital State Set
Event with value corresponding the point type but Questionable bit set
Since you are also asking for sub statuses of UNCERTAIN and GOOD, the Substituted bit would correspond to "Local Override" of status GOOD but PI doesn't have per-se additional reason codes for UNCERTAIN. What can be done here is storing quality information on a separate tag by using a custom Digital State set.
If this information isn't helpful or doesn't fully answer your question, please give us a better understanding of what you would like to achieve.
Thank you Gregor.
It is exactly what I'm looking for!