OPC Classic represents a quality of a data value by several bit-coded fields. OPC Studio components encapsulate the OPC quality in a DAQuality class. The bit fields in OPC quality are inter-dependent, making it a bit complicated to encode or decode it. The DAQuality type takes care of this complexity. In addition, it offers symbolic constants that represent the individual coded options, and also has additional functionality such as for converting the quality to a string.
The following table attempts to depict the elements of DAQuality and their relations:
property DAQualityChoice QualityChoiceBitField { get; } property bool IsBad { get; } property bool IsGood { get; } property bool IsUncertain { get; } |
SubStatus | property DALimitChoice LimitBitField { get; set; } |
property DAStatusChoice StatusBitField { get; set; } SetQualityAndSubStatus(…) |
You can see that the StatusBitField is actually consisted of QualityChoiceBitField, and a SubStatus. But the semantics of SubStatus is highly dependent on QualityChoiceBitField, and therefore the SubStatus cannot be accessed separately. For the same reason, you cannot directly set the QualityChoiceBitField without providing a value for SubStatus at the same time. Instead, you can call SetQualityAndSubstatus method to modify the two fields at the same time.
Note that OPC Alarms and Events specification “borrows” the quality type from OPC Data Access, and therefore the DAQuality type is used with OPC Alarms and Events as well.
Constants for DAQuality values are contained in the DAQualities enumeration.