Troubleshooting
Why REAL writes stall at the output in an OPC UA SCADA tag
Short answer
The typed value is local until the tag's output branch is bound to an active consumer and reports Good; only then does the OPC UA write leave the runtime. If Good still leaves the PLC REAL unchanged, compare the imported node's DataType with the SCADA tag type, then look for PLC logic rewriting the variable every scan.
On this page
A REAL typed into a SCADA tag in debug mode lands in the tag's output branch and stops there: no request leaves the runtime, so neither the OPC UA server nor the PLC ever sees it. The value stays local until that branch is connected to an active consumer — a project variable or a value-entry control — and its status reads Good. In the installation behind this article, a CODESYS 3.5 controller kept reading fine and accepted BOOL and INT writes while every REAL stalled at the branch. When Good still leaves the PLC variable unchanged, the fault moves to the node's DataType or to PLC logic that rewrites the variable every scan. The sections below take the path in that order and commit to a fix at each stop point.
The write path and where it stops #
A write from an operator entry to a PLC variable crosses five segments, and each has one pass condition:
- Value source — the entry control or project variable is connected to the tag's output branch.
- Output branch — the branch reports
Good; expand the tag and read the status. - Client session — the configured endpoint stays connected.
- Server node — writable, with a declared DataType that matches the payload the client sends.
- PLC application — no logic replaces the value on the following scan.
A healthy read proves the session and the physical path and nothing else: not the binding, not write permission, not the type. Reads flowed in the reported case while the REAL stopped at the output branch, so the first fix is on the SCADA side, before anyone touches the controller.
Bind the output branch and read its status #
A value sitting in the output branch is not proof that a request left the runtime. In SCADA runtimes that model each tag as an input, a main value and an output branch, the branch participates in the runtime dataflow only once something consumes it.
- Expand the affected REAL tag in the engineering tree and read the output branch status.
- Connect the branch to an active consumer: a project variable the runtime executes, or a value-entry control on a screen.
- Run the project; an entry typed into a stopped or debug-only runtime does not execute the binding.
- Enter a value and confirm the branch both changes and reports
Good.
Displaying the input, output and main value together on a screen proves nothing by itself: a display is not a binding, and the entry control has to be wired into the output path. Use a test variable that commands nothing on the machine, because a debug write is a live write.
REAL, LREAL and the node's DataType #
IEC 61131-3 defines REAL as the 32-bit single format (1 sign, 8 exponent, 23 fraction bits) and LREAL as the 64-bit double format (1 sign, 11 exponent, 52 fraction bits); OPC UA calls the same two formats Float and Double. Some current SCADA runtimes create floating-point tags as LREAL by default to gain display precision. Switching the tag's type changes precision, not the write path, and in the reported case it changed nothing.
An OPC UA write carries a typed value. Under OPC UA Part 8, the Write service returns a status for every node it touches, and a server that receives a payload whose type does not match the node's declared DataType answers that node with Bad_TypeMismatch instead of converting. The same boundary rejects integer writes sent with the wrong payload, as when an OPC UA Int16 write fails because the payload is a string. Record the DataType the client imported for the node and compare it with the tag type before trusting a quiet log.
Worked example, so you know what a good write looks like — type 123.456789 rpm:
- As REAL: 24 significand bits, 2^24 = 16,777,216, about 7 decimal digits, and the step at this magnitude is 2^-17 = 0.0000076 rpm. The entry is stored as 123.456789 × 2^17 ≈ 16,181,728.25, rounded to 16,181,728, so the PLC holds 16,181,728 / 2^17 = 123.456787109375 rpm, about 0.0000019 rpm from the typed value. That is a good write, not a fault, and the step doubles every time the value doubles.
- As LREAL: 53 significand bits, about 16 decimal digits, a step of 2^-46 = 0.0000000000000142 rpm at the same magnitude, and the entry survives to its last typed digit.
Decision: keep the PLC declaration the application was built around and convert at exactly one controlled boundary — the client tag, or a PLC-side LREAL command variable that logic maps to REAL. Do not widen PLC REALs to LREAL only for display precision.
When Good does not reach the PLC #
If the branch reads Good and the online variable still never moves, the request has left the territory the binding explains. On a CODESYS controller the OPC UA server publishes only the variables exposed in the project, and client access is configured in the configuration file CODESYSControl.cfg; a declared variable that nothing references can also carry a compiler warning, and the three REALs in the reported case did. Reference the variable in the application and confirm it sits in the exposed list.
Monitor the online variable during one write:
- It never changes — the node is not writable or not exposed: server side. Compare it with a node that is known to accept writes.
- It changes and returns within a scan or two — the write arrived and logic owns the variable. Find the cyclic assignment: initializations, I/O mappings, function-block outputs, calculations. Split the command from the value the logic owns, the same separation that keeps Modbus writes to PLC output registers safe.
- It changes and holds — the path works, and the earlier failure was the binding.
A write that leaves the runtime yet never moves the PLC's floating-point value is the silent case traced in why a SCADA write to a PLC real address fails silently, where the checks begin at the server's write permission.
Decide from what you observe #
| Observation | Where it stops | Decision |
|---|---|---|
Output branch not Good |
SCADA dataflow | Bind the branch to an active consumer and run the project |
Good, no request in the client diagnostics |
Client conversion or tag configuration | Record the imported DataType and test with a second client |
Request answered Bad_TypeMismatch |
Node DataType | Send the node's declared type or convert at one boundary |
| PLC value changes, then returns | Application logic | Find the cyclic assignment and split command from feedback |
| PLC value never moves; a second client fails too | Server node or exposure | Check the exposed list and write access in CODESYSControl.cfg |
| Value lands on another server but not the PLC | Controller side | Compare node type, access and exposure between the two |
For the A/B test, point the same tag at a known-writable OPC UA server or an emulator. If the value lands and holds there, the binding, the conversion and the client session are proven, and the remaining fault is at the controller.
The pass test #
Take one REAL node with no competing writers, enter a value, and watch the online variable. Pass only when the new value appears and holds through the following scans, and the readback sits within one REAL step of the entry — for the entry above, within 0.0000076 rpm. Anything less matches a row of the table, and the table says where to go next.
Questions asked
Why did BOOL and INT writes work while the REAL writes stalled?
The usual reason is that the integer and Boolean tags already fed live screens, so their output branches were bound and reported Good without anyone arranging it. The REAL tags lived only in the debug tree, where a typed value has no consumer. Type is not what stops a value at that stage: a value that never leaves the runtime cannot be rejected for its type, so the stall and the REAL declaration are two separate facts.
Will the OPC UA server convert a Double payload sent to a Float node?
No. The server compares the payload with the node's declared DataType and answers a mismatch with Bad_TypeMismatch for that node; conversion is the client's job. A client that converts silently shows no error at all, which is why a quiet log does not clear the type boundary. Record the imported DataType and compare it with the tag before trusting the absence of diagnostics.
Why does a successful REAL write read back with different last digits?
A REAL carries about 7 decimal digits, so the runtime rounds the entry to the nearest representable value and only the leading digits hold. Near 123 rpm the step is 0.0000076 rpm, so an entry of 123.456789 rpm reads back as 123.456787109375 rpm. Expect that rounding on every good REAL write, and chase the write path only when the value does not move at all.
Should the PLC variable be widened from REAL to LREAL to match the SCADA tag?
No. The node's DataType belongs to the application, and widening a working REAL to match a SCADA default changes the interface for every other client and for the logic, without fixing the write in the reported case. Keep the declaration the machine was built around and convert at one controlled boundary. After any declaration change, refresh the imported node metadata so the client sees the new type.