Applies To: |
|
Summary: |
The quality of a tag can be retrieved using the Cicode function SubscriptionGetAttribute(iHandle, "VALUEQUALITY"). But what do these returned values mean? |
Solution: |
Quality in the PSI (Publish Subscribe
Infrastructure) is a 32bit value divided into two 16bit components
for Specific and General quality. Only the General Quality is
returned by SubscriptionGetAttribute(). The Specific Quality is
available only in diagnostic logging (i.e. in tracelog.dat) and is
not discussed here.
The General quality of a PSI value closely resembles the definition of quality from the OPC-DA 3 specification, with extensions provided for the substatus field. The 16 bits of the general quality are divided as follows from MSB to LSB : CCCC CCCC QQ SSSS LL Where: All values below are presented as a binary representation of the bits in these bitfields.
Values for extended substatus (CCCC CCCC)0000 0000 = There is no specific extended substatus value Values for quality field (QQ)00 = Tag value is bad, value should not be considered as
current/correct
Values for substatus field (SSSS)The substatus field values change depending on the quality (QQ) field and the extended substatus field (CCCC CCCC). Where the latter is non-zero, the substatus field will generally be zero. When QQ = 00 (Bad) 0000 = Reason for bad quality is
non-specific or could not be determined. When QQ = 01 (Uncertain): 0000 = There is no specific reason why
the value is uncertain. When QQ = 11 (Good): 0000 = The value is good. There are no
special conditions.. Values for the limit field (LL)00 = The value is free to move up or down Cicode FunctionsThe attached Cicode functions may be used to retrieve the quality for any tag (TagQuality), get the description of the quality (QualityToStr), break the quality up into each of the above components (QualityGetpart), and check if it's Good (QualityIsGood), Bad (QualityIsBad), or Uncertain (QualityIsUncertain). These functions emulate the built-in functions with the same name in Citect 7.20. |
Keywords: |
Quality, Cicode, SubscriptionGetAttribute, VALUEQUALITY |
Related Links