Applies To:
  • CitectSCADA 7.00, 7.10

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:
    CCCC CCCC = 8 bit extended substatus field.
    QQ = 2 bit quality field.
    SSSS = 4 bit substatus field.
    LL = 2 bit limit status field.

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
0000 0001 = The device is a scheduled device that is offline and no cache value is available
0000 0010 = The tag configuration is invalid
0000 0011 = The value of tag is invalid
0000 0100 = Internal software error occurred in the device driver
0000 0101 = Too many devices attached
0000 0110 = Communication is not initialised
0000 0111 = Bad communication
0000 1000 = Tag address is out of range
0000 1001 = Tag is not readable
0000 1010 = The write operation is unauthorised
0000 1011 = No cluster is specified within a system or for a given tag
0000 1100 = The requested cluster in not known or no clusters are available
0000 1101 = The requested cluster is disabled
0000 1110 = Cannot connect to the requested session
0000 1111 = Tag could not be resolved

Values for quality field (QQ)

00 = Tag value is bad, value should not be considered as current/correct
01 = The quality of the value could not be determined, it may be valid
10 = Unused
11 = The value is good and is considered current/correct for the tag

 

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.
    0001 = There is some server specific problem with the configuration.
    0010 = The input is required to be logically connected to something but is not.
    0011 = A device failure has been detected.
    0100 = A sensor failure had been detected.
    0101 = Communications have failed. However, the last known value is available.
    0110 = Communications have failed. There is no last known value available.
    0111 = The block is off scan or otherwise locked.
    1000 = The susbscription has not yet received valid data for the tag.

When QQ = 01 (Uncertain):

    0000 = There is no specific reason why the value is uncertain.
    0001 = The returned value should be regarded as 'stale'.
    0010 = Not used.
    0011 = Not used.
    0100 = Sensor is known to be faulty, value may not be accurate.
    0101 = The returned value is outside the limits defined for this parameter.
    0110 = The value is derived from multiple sources and has less than the required number of good sources.

When QQ = 11 (Good):

    0000 = The value is good. There are no special conditions..
    0001 = Not used.
    0010 = Not used.
    0011 = Not used.
    0100 = Not used.
    0101 = Not used.
    0110 = The value has been Overridden, eg. the source is disconnected and a value has been manually set.

Values for the limit field (LL)

00 = The value is free to move up or down
01 = The value has 'pegged' at some lower limit
10 = The value has 'pegged' at some high limit
11 = The value is a constant and cannot move

Cicode Functions

The 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

Attachments

Quality.ci