I used UpdateValue method for writing history data. How to write value with BAD quality ? I can set Questionable property but I cann't set isGood property. Please advise me ...
Keep this rule in mind: if the value matches the point type, e.g. the value is a float or Single in .NET for a Float32 tag, then the value is defined to be good (even if that value is NaN). If the value does not match the point type, e.g. a digital state, then it must be bad.
Ok, but what I should to do if value types is matche ? For example, my task is writing OPC float tag with value 100 and quality BAD into PI tag - How I can do it ? Is it possible for PISDK ?
For a point type of float, it's not possible to write a float value and have the PIValue.IsGood property report as false. Also, to my knowledge, the IsGood property is read-only and is determined from the point type and PIValue.Value object type. See the documentation on PIValue.IsGood in PISDK.chm.
I think the problem you are running into arises from the fact that the PI tag stores either the value or quality of an event from OPC (in the PIValue.Value object), while OPC provides the value and quality information separately.
There are some workarounds to collect both the value and quality from OPC:
1) From non-good data from OPC, you can write a PI digital state indicating the OPC quality, and then put the "value=100" in the annotation. Therefore, calling IsGood on the PIValue object will return false.
2) Do the reverse. Put the OPC quality in the annotation and send 100 to the PIValue.Value property.
3) Create two tags. One to report the OPC value and the other the OPC quality.
You can also use the questionable flag on a PI tag for these OPC quality states.
Which option depends on what you are trying to indicate with these non-good values and how they'll be read or used by other applications. If you have the PI OPC interface 2.5 documentation, you can also look there for ideas on how we've handled storing both the value and quality.
Retrieving data ...