How to Convert Units and Clean Up Tags Between OPC UA Servers
Two OPC UA servers can speak the same protocol and still disagree about everything that matters. One reports pressure in Bar, the other expects PSI. One names a tag Temperature_Tank1, the other wants Plant1.Temp.Tank01. OPC UA moves the value. It does not fix the units or the names.
This post walks through the fix in OPC Data Wrangler: read from a source server, convert units, rename tags to a clean scheme, and write to a destination server. If you want the bigger picture first, start with the OPC UA ETL guide.
What you will build
A pipeline with three parts:
- An OPC Source node reading tags from the source server.
- One or more Unit Conversion nodes (with a Formula or Custom Python node for anything the built-in units don't cover).
- An OPC Sink node writing to the destination server under the tag names you choose.
The example uses three tags: a pressure in Bar, a temperature in Celsius, and a flow in L/h. The destination expects PSI, Fahrenheit, and GPM.
Step 1: Inventory the mismatches
Before touching the editor, write a short table. It takes five minutes and prevents the mistakes that cost real money.
| Source tag | Source unit | Destination tag | Destination unit |
|---|---|---|---|
Press_Line2_PT01 | Bar | Plant1.Line2.Pressure | PSI |
Temperature_Tank1 | °C | Plant1.Temp.Tank01 | °F |
FT_204_Flow | L/h | Plant1.Line2.Flow | GPM |
Check the engineering units on the source server, not the datasheet. Servers are sometimes configured differently from what the sensor can do, and a mislabeled unit is the most common reason a conversion looks right and still isn't.
Step 2: Read the source tags
Add an OPC Source node, select the saved connection for the source server, browse its address space, and select the three tags. Each selected tag becomes a slot on the node, named after the tag, so you will see those names again in the next nodes.
Step 3: Convert units
Add a Unit Conversion node and pick the from-unit and to-unit from the dropdowns for each value. One node can hold several conversion slots, or you can use one node per value if you prefer to keep them visually separate:
- Pressure tag: Bar to PSI
- Temperature tag: Celsius to Fahrenheit
- Flow tag: L/h to GPM
The node ships with 11 unit categories and validated conversion factors, so there is no factor to look up and no 14.5 versus 14.5038 debate. Connect each source slot to its conversion slot. If your flow is in L/min, which is not one of the built-in flow units, use a Formula node instead: flow * 0.264172 gives GPM.
Sanity check with a known value: 1 Bar should come out as about 14.5038 PSI, and 100 °C as 212 °F. The live values in the DAG let you confirm this before anything is written anywhere.
When the built-in units are not enough
Some conversions are not a plain unit swap. Two common cases:
Scaling or offsets. A transmitter reports a 4-20 mA signal that you need to scale to engineering units, or a tag is stored as an integer in tenths of a degree. Use a Formula node. Every name in the formula is an input variable, so each one must be a connected input. Using a literal range keeps it to one input (raw). For a 0-250 range:
(raw - 4) / 16 * 250
This assumes the range starts at 0. For a range starting at some other value, add that offset to the end.
Compensation. Actual gas flow corrected to a 20 °C reference, with flow and temperature (in °C) as the two connected inputs:
flow * 293.15 / (273.15 + temperature)
The Formula node keeps the math visible on the node, so the next person to open the pipeline can read it.
Messy values. If a source occasionally sends a sentinel like -9999 when a sensor drops out, a Custom Python node can clamp it instead of passing it downstream. A Python node must always return a value (bool, int, float or string), so this one holds a floor:
def transform(value):
if value <= -9999:
return 0.0
return value
If you need to tell downstream logic that a reading is invalid, have the node return a second boolean output, for example value > -9999, rather than trying to drop the reading. Keep this for real edge cases. The visual nodes cover the routine conversions, and fewer lines of code means fewer places for an error to hide.
Step 4: Clean up the tag names
Tag cleanup happens at the OPC Sink. Add the node, select the saved connection for the destination server, and choose the destination tag for each incoming slot. Input i is written to tag i, so order matters:
| Incoming slot | Destination tag |
|---|---|
pressure (PSI) | Plant1.Line2.Pressure |
temp (°F) | Plant1.Temp.Tank01 |
flow (GPM) | Plant1.Line2.Flow |
This is where you impose one naming scheme on data that arrived from several vendors. A few conventions that save trouble later:
- Pick one hierarchy and keep it. Site, area, equipment, measurement works well. Whatever you pick, apply it to every pipeline.
- Keep the unit out of the name unless the destination needs it. If the scheme says
Pressure, make the unit a documented property of the destination, not a surprise. - Avoid renaming in more than one place. Do all renaming at the sink so there is one list to audit.
- Match the destination's data type. If the destination tag is a Float, write a Float.
Then deploy.
Step 5: Verify before you trust it
Watch the live values flow through the DAG and compare each against the source server in a separate OPC client (OPC Telescope works for this too). Check three things:
- The converted number is what a calculator gives you for the raw number.
- The destination tag shows the value, with good quality, under the name you expect.
- The value keeps updating after a few minutes.
Save a screenshot of the DAG with the units visible. It doubles as documentation, and it is the first thing you will want if someone asks in six months why a tag reads what it reads.
Common mistakes
- Converting twice. The destination already does a conversion on its side, and now it is applied twice. Confirm what the destination expects.
- Temperature differences vs. temperatures. A change of 10 °C is a change of 18 °F, not 50 °F. A Unit Conversion node is for absolute readings. For deltas, use a Formula node with the scale factor only.
- Gauge vs. absolute pressure. Bar(g) and Bar(a) differ by about 1.013 Bar. Confirm which the source reports before converting.
- Trusting the tag name.
Temp_Fin a tag name is not proof of Fahrenheit.
Where this fits
Unit conversion and tag cleanup are the first two levels of OPC UA ETL work, and the part that most often ends up in a brittle script. For the full picture of extract, transform, and load for OPC UA, including formulas, Python, and the visual DAG, read the OPC UA ETL guide.
OPC Data Wrangler is being built by Thingamatronics. To follow along, join the waitlist (email only, no account).
Stop Hand-Writing Unit Conversions
Convert units and clean up tag names between OPC UA servers visually, with the math visible in the pipeline.
About the Author
Chris Laponsie founded Thingamatronics to build modern industrial data engineering tools. OPC Data Wrangler is a visual ETL tool for OPC UA: unit conversion, formulas, and Python transforms in a pipeline you can see.
More from the Blog
Introducing OPC Telescope: A Modern OPC Client for Remote Troubleshooting
A portable OPC client with themes, dashboard, and monitoring features designed for troubleshooting signals in remote industrial environments.
Read Article →The OPC UA ETL Problem Nobody Talks About
Why OPC UA ETL is about data transformation, not just data movement, and how visual DAGs with built-in unit conversions change everything.
Read Article →I Asked Agentic AI to Build My OPC Pipeline (And It Actually Worked)
From natural language description to production DAG in 30 seconds. See the AI copilot in action.
Read Article →