The JSup tags keep a quality status that can be used to detected some communication problems and statuses.
This quality status can affect the quality of some calculated tag, if the calculation is based on tag with bad quality.
These the possible tag quality status:
- UNKNOWN: should never occur, maybe for an incompatible (older) JSup version.
- NOT_FOUND: a tag proxy not correctly linked to a tag.
- CONFIG_ERROR: the value read from the device could not be assigned to the tag.
- BAD_ITEM: a tag I/O hook is invalid and was not accepted by the driver or the remote device.
- BAD_SENSOR: the sensor associated to the measure has some problem (used by OPC client driver) only.
- DEVICE_FAILURE: the remote device is not available or it failed to respond.
- COMM_FAILURE: communication error (the remote device is not connected or available)
- CONVERSION_ERROR: the raw value read from the remote device cannot be converted/assigned to the tag.
- OUT_OF_RANGE_RAW: the raw value read from the remote device is out of the defined min/max range.
- TIMEOUT: if a timeout occurred while reading the value from the remote device.
- EVALUATION_ERROR: if the expression to be calculated to assign a value to a tag produced an evaluation exception.
- BASED_ON_BAD_VALUES: if some value (tag) used to calculate a value has, in turn, a bad quality status.
- CANT_WRITE: the value is valid, but could not be written to the remote device.
- WRITE_PENDING: the value is valid and it's about to be written to the remote device. A tag has this quality if it has an I/O hook in a Write on change channel only between the change of the tag value and the acknowledge of the successful write to the remote device.
- GOOD: the status of the tag is good, its value is valid and correctly synced with the remote device, if any.
Red indicates bad quality status, while green indicates good quality status.
Graphical representation of quality
The quality of the tag (or the tags) associated with an automation graphical object can be showed with the standard JSup library class QualityPainter.
This class is to be used in quality dedicated rigid binder that must be the topmost in the graphical object binder (see quality overlay in the right graphic navigator example), the content of this binder should be:
- tooltip Java paint (see JSup Animations - Special), positioned in the corner where the quality icon is to be displayed (see below), with the following animations:
- 'overlay'' Java paint that have to cover all the automation graphical object, with the following animations:
- Visible: when the following Java code returns true:
return QualityPainter.processIfIsVisible( thisGraphObj, QualityPainter.LEFT, QualityPainter.TOP, _StatoUtenzaA.ref() );
The call of the processIfIsVisible evaluates the quality to be shown, based on the tag ref (or tags refs: more than a tag ref can be passed, separated with commas).
The position of the quality icon is determined, in this example, by the constants LEFT and TOP; it must be chosen to avoid to cover important information. Java paint: with the following Java code:
QualityPainter.processPaintOverlay( g2, thisGraphObj );
- Visible: when the following Java code returns true:
The quality layer is normally invisible (when the quality of tag is good) and it's only shown when tag quality become bad, showing that status of the automation object/measure is not reliable (see the picture on the right).
This QualityPainter class allows to show the communication status of every single object in a graphical page (window).