OPC Quality Codes: Decoder Calculator & Table

Share:
SCADA
OPC Quality Codes in SCADA: What 192, 0 and 64 Mean, OPC UA StatusCodes and How to Fix Bad or Uncertain Tags

A SCADA tag that shows Bad or Uncertain tells you where the data path broke, as long as you can read its quality byte. Here we decode the standard OPC DA values and common OPC UA StatusCodes for fault finding on the plant.

OPC DA quality byte OPC UA StatusCode Substatus table Decoder calculator Field fixes

Every value an OPC server sends carries a quality flag that says Good, Bad or Uncertain and why. Once you can decode it bit by bit, you know where to start looking for the fault.

Hello everyone, today we are going to decode opc quality codes, the small numbers behind every Bad or Uncertain tag on your SCADA screen, and learn how to fix each one.
opc quality codes
Quick Answer

What do opc quality codes 192, 0 and 64 mean in SCADA?

OPC quality codes are 8 bit flags sent with every OPC DA value: 192 (0xC0) means Good, 0 means Bad and 64 (0x40) means Uncertain. The top two bits give the quality, the next four give the substatus and the last two give the limit. For example, 24 means Bad with Comm Failure, so the server lost contact with the PLC.

What Are OPC Quality Codes?

OPC quality codes are status flags that an OPC server attaches to every value, telling the SCADA client whether the reading can be trusted. In OPC DA the flag is a quality word whose low byte encodes Good, Bad or Uncertain plus a reason, while OPC UA uses a 32 bit StatusCode for the same job.

Key Facts
  • 192 (0xC0) is Good, 64 (0x40) is Uncertain and 0 (0x00) is Bad in OPC DA.
  • The low byte layout is QQSSSSLL: quality, substatus and limit bits.
  • OPC UA puts severity in the top 2 bits of a 32 bit StatusCode.

Every value on an OPC connection travels with a timestamp and a quality. If you have read our note on how SCADA systems work, you know a tag on the HMI depends on the whole chain behind it, and OPC quality codes are how that chain reports its own health.

Do You Know?

OPC quality codes survived the move from DA to UA. The OPC Foundation Part 8 mapping table links Uncertain_SensorNotAccurate to the old SENSOR_CAL value and Bad_NoCommunication to COMM_FAILURE, so a migrated client can translate one into the other.

Advertisement

How Are OPC Quality Codes Structured Bit by Bit?

The quality byte is split into three fields: bits 7 and 6 hold the main quality, bits 5 to 2 hold the substatus and bits 1 and 0 hold the limit status. You read it as QQSSSSLL, so you can decode any value with three simple masks.

The Schneider Electric Geo SCADA knowledge base lists the masks as 0xC0 (192) for quality, 0xFC (252) for quality plus status and 0x03 (3) for the limit.

QQ bitsDecimal baseMeaningWhat the client should do
11192 (0xC0)GoodUse the value normally
0164 (0x40)UncertainUse with caution, flag on HMI
000 (0x00)BadDo not use for control or reports
10128 (0x80)Not used in DATreat as invalid

The limit bits tell you whether the value is pinned. 0 means not limited, 1 means low limited, 2 means high limited and 3 means constant, which a server uses when the value cannot move at all.

opc quality codes set at field device, PLC, OPC server and SCADA client
Diagram by Instrumentation Blog showing a field device, PLC, OPC server and SCADA client, with the Bad and Uncertain quality values that each stage normally produces.

The diagram shows where OPC quality codes come from. Sensor faults start in the field, Comm Failure on the PLC link, Config Error in the server and Out of Service at the client.

Quick Tip

When the HMI shows only a symbol, read the raw quality number in an OPC test client. Note it with the timestamp before anyone restarts the server.

OPC DA Quality Substatus Table With Decimal Values

The full value is simply the quality base plus four times the substatus number plus the limit bits. The table below lists the standard OPC quality codes with limit bits at zero, as defined in the OPC Data Access Custom Interface 3.0 and repeated in the MathWorks and Geo SCADA references.

ValueQuality and substatusTypical cause
0Bad, Non SpecificServer gives no reason
4Bad, Configuration ErrorItem address wrong or deleted
8Bad, Not ConnectedInput not wired or no value yet
12Bad, Device FailurePLC or device reports a fault
16Bad, Sensor FailureOpen circuit or failed sensor
20Bad, Last Known ValueComm lost, old value kept
24Bad, Comm FailureComm lost, no value at all
28Bad, Out of ServiceItem or group inactive
32Bad, Waiting for Initial DataFirst read not done yet
64Uncertain, Non SpecificNo reason given
68Uncertain, Last Usable ValueSource stopped updating
80Uncertain, Sensor Not AccuratePegged or out of calibration
84Uncertain, EU ExceededOutside engineering limits
88Uncertain, Sub NormalToo few good sources
192Good, Non SpecificHealthy value
216Good, Local OverrideValue forced by a person

For Last Known Value (20) and Last Usable Value (68), MathWorks advises checking the timestamp, because the value on screen may be hours old. Good, Local Override (216) also deserves attention, since someone has forced it by hand.

Advertisement

How to Decode OPC Quality Codes Step by Step

To decode a value, AND it with 192 for the quality, AND it with 60 and divide by 4 for the substatus, then AND it with 3 for the limit. Try it below on any number your SCADA shows, or follow the solved example for quality 85.

1
Take the low byte
For a 16 bit word, keep the remainder after dividing by 256.
2
Find the quality
AND with 192: 192 Good, 64 Uncertain, 0 Bad.
3
Find the substatus
AND with 60, divide by 4, then use the table.
4
Find the limit
AND with 3: none, low, high or constant.
Solved example: quality = 85 (0x55)
Quality: 85 AND 192 = 64 → Uncertain
Substatus: 85 AND 60 = 20
20 ÷ 4 = 5 → EU Exceeded
Limit: 85 AND 3 = 1 → Low Limited
Result: Uncertain, EU Exceeded, Low Limited
opc quality codes bit layout decoding quality value 85 as uncertain low limited
Diagram by Instrumentation Blog decoding quality value 85 into its quality, substatus and limit bit fields, with the three masks used and the Good, Uncertain and Bad base values.
OPC DA Quality Decoder
Decoded quality
85 (0x55) = Uncertain, Engineering Units Exceeded, Low Limited

With quality 85, the server is telling you the value is below its engineering range and it doubts the reading. On a 4 to 20 mA input, check whether the transmitter sits under 4 mA with the 4 to 20 mA signal conversion calculator before you go to the field.

What Are OPC UA Status Codes?

OPC UA status codes are 32 bit numbers where the top two bits give the severity: 00 for Good, 01 for Uncertain and 10 for Bad. The low 16 bits hold info bits, including the same limit flags used in DA.

So every Bad code starts with 0x8 and every Uncertain code with 0x4 in hex. Our article on OPC UA covers sessions, certificates and the address space, which is where many UA status errors come from.

OPC UA StatusCodeHexClosest DA value
Good0x00000000192 Good
UncertainLastUsableValue0x4090000068 Last Usable
UncertainEngineeringUnitsExceeded0x4094000084 EU Exceeded
BadConfigurationError0x808900004 Config Error
BadNotConnected0x808A00008 Not Connected
BadSensorFailure0x808C000016 Sensor Failure
BadNoCommunication0x8031000024 Comm Failure
BadOutOfService0x808D000028 Out of Service

UA adds codes with no DA twin, such as BadNodeIdUnknown (0x80340000) for a missing tag path and BadUserAccessDenied (0x801F0000). BadCommunicationError (0x80050000) is a session error, not a quality on one value.

Do You Know?

These hex values come from the open62541 status code list. If your client shows only a number like 2156527616, convert it to hex first, because that decimal value is 0x808A0000, BadNotConnected.

Myth: Bad quality always means the network is down.
Fact: Only 24 and 20 point to the link. Values 4 and 8 are configuration problems.
Myth: Uncertain values are safe to use like Good ones.
Fact: Uncertain means the server doubts the value, so never let it drive an automatic action unchecked.
Myth: A Good value is always a live value.
Fact: Local Override (216) is Good but forced by hand, so check it.
Advertisement

How to Fix Bad Quality in SCADA Tags

Start from the substatus in the OPC quality codes, since it tells you which part of the data path failed. Comm faults go to the cable and driver, config faults go to the item address, and Uncertain values go back to the instrument.

troubleshooting flowchart for SCADA tags with bad or uncertain opc quality codes
Diagram by Instrumentation Blog showing a troubleshooting flowchart that routes Bad or Uncertain tags by quality value to communication, configuration, activation or sensor checks.

For Comm Failure on a Modbus device, check slave ID, baud rate, parity and timeout before blaming the OPC server. Our Modbus RTU troubleshooting guide walks through each of these checks, and the wider list of SCADA communication problems covers Ethernet links and radios.

For Config Error or Not Connected, compare the item address in the server with the Modbus register map or the PLC tag list. A register offset of one, a renamed PLC tag or a deleted item after an online change are the usual reasons.

If OPC quality codes flip between Good and Bad, the link may be overloaded, so review SCADA polling rate optimization and your network switches. A protocol gateway can also hold the last value and report Good after the field link dies.

  • Read the raw quality number and timestamp before restarting anything.
  • Decode the substatus and limit bits with the calculator above.
  • Ping the device and check driver timeouts.
  • Compare the item address with the register map.
  • For Uncertain values, check the transmitter signal and range.
  • Recheck quality after the fix and note the cause in the log.
Quick Tip

On OPC DA systems, a client that cannot connect at all usually shows a DCOM error and not a quality value. Fix DCOM, user accounts and firewall rules first, then come back to quality codes.

Why Does OPC Quality Matter for Alarms, Historians and Control?

Quality decides whether a value can be trusted for alarms, trends and control logic, so ignoring it lets a frozen or failed signal look normal. Check OPC quality codes wherever a value is used, not only on the HMI.

In alarm handling, a Bad input should raise a bad quality or instrument fault alarm instead of a false process alarm, as discussed in our guide to SCADA alarm management. DCS engineers follow the same idea, which you can see in DCS bad PV signal quality handling.

Historians store quality with every sample, and the AVEVA PI Interface for OPC DA guide describes how OPC quality is stored as PI status. Our article on SCADA historian integration with PI explains the wider architecture.

Good habits with quality
  • Show Bad and Uncertain clearly on the HMI
  • Alarm on quality loss for critical tags
  • Hold control output when an input goes Bad
  • Store quality with every historian sample
Common mistakes
  • Using the value and ignoring quality in scripts
  • Treating Uncertain the same as Good
  • Gateways that hide device failure as Good
  • Restarting the server before noting the code
PDF
PI Interface for OPC DA User Guide
AVEVA (OSIsoft) manual covering OPC DA connections, timestamps and how OPC quality is stored in PI

The video shows a client connecting tags to an OPC UA server. Watch the tag status, since that is the StatusCode you decode on site.

OPC Quality Codes FAQ

What does OPC quality 192 mean on a SCADA tag value?

Quality 192 (0xC0) means Good with no special condition, so the value can be used normally. In binary it is 11000000, with quality bits 11 and zero substatus and limit.

A value of 216 is also Good, but it means Local Override, so someone has forced the value.

What is the difference between OPC DA quality and OPC UA StatusCode?

OPC DA uses a 16 bit quality word with the meaning in the low byte, such as 24 for Comm Failure. OPC UA uses a 32 bit StatusCode with severity in the top two bits.

For example, DA Comm Failure maps to BadNoCommunication, 0x80310000, in UA.

How to calculate OPC quality substatus from a decimal value?

AND the value with 60 and divide the result by 4 to get the substatus number. For quality 85, 85 AND 60 gives 20, and 20 divided by 4 gives 5.

Substatus 5 under Uncertain is Engineering Units Exceeded, and the limit bits 85 AND 3 give 1, Low Limited.

Why does my SCADA tag show Bad quality 24 comm failure?

Quality 24 means the OPC server cannot talk to the device and has no last value. Check device power, cable, IP address, slave ID and driver timeout.

If every tag on one channel shows 24, the problem is on that link and not in the tag configuration.

What is a common mistake when handling Uncertain OPC quality values?

The most common mistake is treating Uncertain like Good in scripts and control logic. Values such as 68 Last Usable or 84 EU Exceeded may be stale or outside range.

Flag them on the HMI, keep them out of automatic actions and check the timestamp before trusting them.

Which OPC quality codes point to a configuration problem and not wiring?

Bad 4 Configuration Error and Bad 8 Not Connected usually point to configuration. The item address may be wrong, deleted or not linked to an input.

Bad 28 Out of Service is also a setup issue, because the client group or scan class is inactive.

Advertisement

Related Articles

External References

What We Learn Today

  • OPC quality codes pack quality, substatus and limit into one byte, so 192 is Good, 64 is Uncertain and 0 is Bad in OPC DA.
  • You decode any value with three masks: AND 192 for quality, AND 60 then divide by 4 for substatus, and AND 3 for limit.
  • Bad 24 points to communication, Bad 4 and 8 to configuration, Bad 28 to inactive groups and Uncertain values back to the field instrument.
Advertisement
I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!
Sunayana Gadepatil, author at Instrumentation Blog
Author · instrumentationblog.in
Ms. Sunayana Gadepatil is an instrumentation professional, technical writer, and the author behind Instrumentation Blog. With a strong interest in industrial instrumentation, process measurement, and automation, she specializes in simplifying complex technical concepts into clear, practical, and easy to understand insights. Through her articles, Ms. Sunayana shares valuable knowledge on flow, pressure, level, temperature, control systems, and industrial automation for engineers, students, technicians, and industry professionals.
Technically reviewed on

Leave a Reply

Your email address will not be published. Required fields are marked *

Support free learning

Help keep every guide, calculator and tool 100% free

Hosting, software and hours of research go into every article. Even a small contribution helps us publish more in-depth guides for students, technicians and engineers.

  • No paywalls
  • No sign up
  • Free for everyone