QualityGetPart
- Last UpdatedFeb 02, 2024
- 4 minute read
Extracts a requested part of the quality value from a variable tag's quality item.
Syntax
QualityGetPart(QUALITY Quality, INT Part)
Quality:
Specifies the quality variable.
Part:
The part to extract:
0 – The General Quality value
1 – Quality Substatus value
2 - The Quality Limit value
3 - The Extended Quality Substatus value
4 – The Tag Status Override flag
5 – The Tag Status Control Inhibit flag
6 - The DataSource error code
7 – The OPC Quality (General + Substatus + Limit)
Return Value
The value of the requested Quality part (see tables below), or -1 if error.
Part 0 - General Quality Values
|
Cicode label name |
Value |
Description |
|---|---|---|
|
QUAL_BAD |
0x00 |
Value is not useful for reasons indicated by the Substatus Bit Field. |
|
QUAL_UNCR |
0x01 |
The Quality of the value is uncertain for reasons indicated by the Substatus Bit Field. |
|
QUAL_GOOD |
0x03 |
The Quality of the value is Good. |
Part 1 - Quality Substatus Values
This part returns a value from one of the following substatus groups:
-
QUAL_BAD
-
QUAL_UNCR (uncertain)
-
QUAL_GOOD
To determine which substatus group the return value is from, you need to initially call the General Quality Value (part = 0).
-
Quality Substatus Values - QUAL_BAD
Cicode label name
Substatus Value
Quality Value
Description
QUAL_BAD_NON_SPECIFIC
0x00
0x00000000
The value is bad but no specific reason is known.
QUAL_BAD_CONFIGURATION_ERROR
0x01
0x00000004
There is some server-specific incorrect configuration. For example, the item in question has been deleted from the configuration.
QUAL_BAD_NOT_CONNECTED
0x02
0x00000008
The input is necessary to be logically connected to something but is not. This quality may reflect the fact that no value is available at this time, for reasons like the value may not have been provided by the data source.
QUAL_BAD_DEVICE_FAILURE
0x03
0x0000000c
An inoperative device has been detected.
QUAL_BAD_SENSOR_FAILURE
0x04
0x00000010
An inoperative sensor has been detected (the ‘Limits’ field can provide additional diagnostic information in some situations).
QUAL_BAD_LAST_KNOWN_VALUE
0x05
0x00000014
Communication has been lost, however, the last known value is available. The age of the value may be determined from the TIMESTAMP in the OPCITEMSTATE.
QUAL_BAD_COMM_FAILURE
0x06
0x00000018
Communication has been lost. There is no last known value available.
QUAL_BAD_OUT_OF_SERVICE
0x07
0x0000001C
The block is off scan or otherwise locked. This quality is also used when the active state of the item or the group containing the item is InActive.
QUAL_BAD_WAITING_FOR_INI_DATA
0x08
0x00000020
After items are added to a group, it may take some time for the server to actually obtain values for these items. In such cases, the client might perform a read (from cache), or establish a ConnectionPoint based subscription and/or execute a refresh on such a subscription before the values are available. This substatus is only available from OPC DA 3.0 or newer servers.
-
Quality Substatus Values - QUAL_UNCR
Cicode label name
Substatus Value
Quality Value
Description
QUAL_UNCR_NON_SPECIFIC
0x00
0x00000040
The value is uncertain but no specific reason is known.
QUAL_UNCR_LAST_USABLE_VALUE
0x01
0x00000044
Whatever was writing this value has stopped doing so. Regard the returned value as ‘stale’. This differs from a BAD value with Substatus 5 (0x14) (Last Known Value). This status is associated specifically with a detectable communication error on a ‘fetched’ value and indicates the failure of some external source to ‘put’ something into the value within an acceptable period of time. The age of the value can be determined from the TIMESTAMP in OPCITEMSTATE.
QUAL_UNCR_SENSOR_NOT_ACCURATE
0x04
0x00000050
Either the value has ‘pegged’ at one of the sensor limits (in which case, set the limit field to 1 or 2) or the sensor is otherwise known to be out of calibration via some form of internal diagnostics (in which case, set the limit field to 0).
QUAL_UNCR_ENG_UNIT_EXCEEDED
0x05
0x00000054
The returned value is outside the limits defined for this parameter. In this case the Limits field indicates which limit has been exceeded but does NOT necessarily imply that the value cannot move farther out of range.
QUAL_UNCR_SUBNORMAL
0x06
0x00000058
The value is derived from multiple sources and has less than the necessary number of Good sources.
-
Quality Substatus Values - QUAL_GOOD
Cicode label name
Substatus Value
Quality Value
Description
QUAL_GOOD_NON_SPECIFIC
0x00
0x000000c0
The value is good. There are no special conditions.
QUAL_GOOD_LOCAL_OVERRIDE
0x06
0x000000d8
The value has been Overridden. Typically this is means the input has been disconnected and a manually entered value has been "forced".
Part 2 - Quality Limit Values
|
Cicode label name |
Value |
Description |
|---|---|---|
|
QUAL_LIMITED_NOT_LIMITED |
0x0 |
The value is free to move up and down. |
|
QUAL_LIMITED_LOW |
0x1 |
The value has ‘pegged’ at some lower limit. |
|
QUAL_LIMITED_HIGH |
0x2 |
The value has ‘pegged’ at some high limit. |
|
QUAL_LIMITED_CONSTANT |
0x3 |
The value is a constant and cannot move. |
Part 3 - Extended Quality Substatus Values
|
Cicode label name |
Value |
Description |
|---|---|---|
|
QUAL_EXT_NON_SPECIFIC |
0x00 |
There is no specific extended substatus value. |
|
QUAL_EXT_SCHEDULED_OFFLINE |
0x01 |
The device is a scheduled device that is offline and no cache value is available. |
|
QUAL_EXT_INVALID_TAG |
0x02 |
The tag configuration is invalid. |
|
QUAL_EXT_INVALID_DATA |
0x03 |
The value of the tag is invalid. |
|
QUAL_EXT_SOFTWARE_ERROR |
0x04 |
An internal software error occurred in the device driver. |
|
QUAL_EXT_TOO_MANY_DEVICES |
0x05 |
Too many devices are attached. |
|
QUAL_EXT_COMM_NO_INIT |
0x06 |
Communication is not initialised. |
|
QUAL_EXT_COMM_BAD |
0x07 |
Bad communication. |
|
QUAL_EXT_TAG_OUT_OF_RANGE |
0x08 |
Tag address is out of range. |
|
QUAL_EXT_WRITE_ONLY |
0x09 |
Tag is not readable. |
|
QUAL_EXT_WRITE_PROTECTED |
0x0A |
Write operation is not authorised. |
|
QUAL_EXT_NO_CLUSTER_SPECIFIED |
0x0B |
No cluster is specified within a system or for a given tag. |
|
QUAL_EXT_CLUSTER_NOT_FOUND |
0x0C |
The requested cluster is not known or no clusters are available. |
|
QUAL_EXT_CLUSTER_DISABLED |
0x0D |
The requested cluster is disabled. |
|
QUAL_EXT_SESSION_NOT_CONNECTED |
0x0E |
Cannot connect to the requested session. |
|
QUAL_EXT_TAG_RESOLVE_TIMEOUT |
0x0F |
Tag could not be resolved. |
|
QUAL_EXT_VALUE_OUT_OF_RANGE |
0x10 |
Tag value is out of range. |
|
QUAL_EXT_COMM_DEV_BAD |
0x11 |
Communication loss - data source to PLC. |
|
QUAL_EXT_COMM_IOSERVER_BAD |
0x12 |
Communication loss - client to data source. |
|
QUAL_EXT_STALE |
0x13 |
Tag value is "stale". |
|
QUAL_EXT_NOT_REPLICATED |
0x14 |
Tag element value not replicated to every redundant data source. |
Part 4 - Tag Status Values - Override Flag
|
Cicode label name |
Value |
Description |
|---|---|---|
|
QTS_OVERRIDE |
0x01 |
The tag is in Override mode. |
Part 5 - Tag Status Values - Control Inhibit Flag
|
Cicode label name |
Value |
Description |
|---|---|---|
|
QTS_CONTROL_INHIBIT |
0x02 |
The tag is in Control Inhibit Mode. |
Related Functions
QualityIsBad, QualityIsControlInhibit, QualityIsGood, QualityIsOverrride, QualityIsUncertain, QualitySetPart, QualityToStr, QualityCreate
Example
INT qualityGeneral;
qualityGeneral = QualityGetPart(Tag1.Field.Q, 0);