TwinCAT OPC UA Quality Mapping: Preserve PLC Status Across Server Setup Versions
A PLC can retain the last numeric measurement while marking its
source unavailable. If the OPC UA integration exposes only that number
and discards the associated quality, SCADA may display an old value as
healthy. In TwinCAT, first verify the server setup version’s
value/status mapping rather than assuming that a PLC field named Quality
automatically becomes OPC UA quality.
This article covers TwinCAT 3 Data Access with TMC symbol import. The
reference is Beckhoff’s TF6100 server manual version 1.6.0, dated 2
September 2026, which documents different implementations for server
setup versions 4.x and 5.x. Manual version and installed setup version
are separate identifiers. No PLC or SCADA test was executed.

Identify the
public node shape before migrating
The StatusCode
documentation describes setup 5.x using a PLC structure with a value
member and a DINT status member. The StructuredType and StatusAndValue
attributes enable the mapping, and the instance must also be exposed
through OPC UA. The public node is presented with the type of the value
member.
For setup 4.x, the documented attribute arrangement differs. The
public representation remains a structure, and the mapped StatusCode is
available at that structure variable. Its Value and Quality members
contain the payload and numeric status-code value.
A client configured to read a child Value node from an older layout
should therefore not be assumed to receive the root’s mapped quality.
Inspect exactly which node the SCADA tag reads and where the status is
attached. Likewise, a migration that changes the public shape needs a
client-mapping review even if the PLC structure still contains a
familiar numeric field.
Preserve the code’s bit
pattern
The OPC
Foundation status-code table, pinned to the UA-1.05.07-2026-04-15
tag, assigns BadCommunicationError the hexadecimal value
0x80050000. Beckhoff’s DINT example represents the same
32-bit pattern as decimal -2147155968; Good is zero.
Treat the conversion deliberately when a configuration tool, PLC
declaration or diagnostic export uses a signed decimal representation.
Do not reject every negative DINT as an invalid quality value, and do
not replace it with zero to satisfy a numeric field validator. That
would change the reported status rather than repair its
representation.
The example code is not a universal mapping for every acquisition
fault. Define which documented status represents each source condition
in the application. Preserve the reason for a transition from healthy to
unavailable instead of assigning one generic status to unrelated
failures.
Update
value and status under one application contract
The manual’s
StatusCode section, pages 86–89, explains the structure-based
mapping and runtime status changes. Its purpose does not remove the PLC
application’s responsibility to decide when a sample is valid.
For a hypothetical Modbus-fed measurement, the PLC may keep its
last-good payload internally for diagnostics while marking the
acquisition unavailable. That internal storage does not define the value
transmitted in an OPC UA DataValue. Do not silently convert a
communication failure into a fresh zero-valued measurement.
OPC UA
Part 4, version 1.05.07, sections 7.11.1 and 7.11.5 require the
server to supply null when the DataValue status indicates an error, and
the client to disregard that value. Clients must check status severity
before using a value. If SCADA separately retains a last-good sample,
label it as historical with its original acquisition time; do not
present it as the usable payload of the current Bad DataValue.
Keep recovery equally explicit. A successful connection alone need
not prove that a new measurement was obtained. The application should
restore healthy sample status only when its own acquisition-validity
condition is met. This is a proposed integration rule, not a claim about
a generic server’s automatic behavior.
Verify
the client receives quality, not just its numeric shadow
Use an isolated fixture to keep a known number in PLC-local storage,
change its mapped status to a documented Bad condition, then recover
after a new valid sample. Inspect the exact OPC UA node used by SCADA:
the Bad DataValue must have a null value, and the client must treat it
as unusable. Inspect the older structure root and its child nodes
separately rather than assuming they share status. Any separately cached
historical display must remain visibly distinct from a fresh valid
measurement.
Repeat this inspection across a setup-version migration, checking
node shape and client binding before comparing numbers. A separate
integer tag containing a status code is useful diagnostic data, but it
is not proof that the measurement’s OPC UA status was mapped
correctly.
The acceptance result is a client-visible measurement whose value,
status and version-specific representation agree with the intended PLC
contract. It prevents a successful numeric read from hiding a failed
data source.