Skip to content
You Start with one site
Amounts in Start with one site
Control, Measurement & Energy · Course

OPC UA: Data With Meaning

Lesson 8 of 10 26 min read
Found this useful?

A new engineer joins a plant and must add the compressor meter to a second system. The register map is a scanned page in a folder that nobody can find, and the person who configured the first system has left. The meter answers every request correctly, but the answers are bare numbers: 2,403, 4,012, 840. The engineer spends two days finding out which number is a voltage and what one count is worth. This lesson shows how OPC UA sends the meaning together with the value, what that costs, and when a simpler protocol is the better choice. #OPCUA #InformationModel #IndustrialNetworks

Learning Objectives

By the end of this lesson, you will be able to:

  1. Describe an OPC UA address space in terms of nodes, node classes and references
  2. List what a client receives with the value of a Variable: data type, status code, timestamps, unit and range
  3. Configure in principle a subscription with a sampling interval, a publishing interval and a deadband
  4. Explain the security model: application certificates, message security and user identity
  5. Choose between Modbus, MQTT with Sparkplug B and OPC UA for each layer of a site

Real-World System Problem: Three systems that need the same meter



Meter A measures the compressor feeder of a factory. Three systems want its readings: the SCADA system in the control room, an energy logger, and from time to time the laptop of a commissioning engineer. With Modbus, each of the three needs the register map, and each person who types it in can make a different mistake. One system can show 24.15 kW while another shows 8.40 kW from the same meter.

OPC UA (Open Platform Communications Unified Architecture, published as IEC 62541) places the meaning in one place. A server holds the data in a structure that describes itself. Each client connects, looks through the structure and finds a variable named for what it is, with a data type, a unit, a status and a time.

This has a price. An OPC UA server is a much larger piece of software than a Modbus server, and its security needs certificates that somebody must manage. It is worth having only where what it gives is needed.

Meter AEngineerlaptopEnergyloggerSCADAclientOPC UAserver ingateway DOPC UAaddress space:names, types, units,status, timestampsRS-485, Modbus RTU
One server, several clients, one description

Fundamental Theory: An address space that describes itself



This lesson stays at the level of concepts. No bytes are shown.

Nodes and node classes

Everything a server offers is a node. The set of all its nodes is the address space. Each node belongs to one node class. Three classes describe the equipment:

  • An Object stands for a thing or a part of a thing: a meter, a drive, a motor.
  • A Variable holds a value: a voltage, a serial number.
  • A Method is an action that a client can call, such as resetting a counter.

The other classes describe the first three: ObjectType, VariableType, DataType and ReferenceType define what kinds of object, variable, data and reference exist, and a View marks out a part of the address space. A type is defined once. Every meter object of that type then has the same variables with the same names.

Every node has a set of attributes. All nodes have a NodeId, which identifies the node inside the server (a namespace index and an identifier), a BrowseName and a DisplayName. A Variable has more, described below.

References and browsing

Nodes are joined by references, and every reference has a type that says what the link means. Four are enough to read most address spaces:

ReferenceMeaning
OrganizesA folder contains this node.
HasComponentThis object or variable is made of that part.
HasPropertyThat variable describes this node (a unit, a range, a serial number).
HasTypeDefinitionThis object or variable is an instance of that type.

Every server has the same starting points, so a client that has never seen the server knows where to begin.

RootObjectsthe instances: your equipmentServerthe server describes itselfMeterATypesobject, variable, data andreference typesViewsoptional subsets
The top of every address space

Browsing is the service by which a client asks a node for its references and follows them: from the Objects folder to MeterA, then to the list of its variables, with no document from the maker. It is like opening folders on a computer whose files carry their own labels.

What a Variable tells the client

The Value attribute is the reading. Around it the Variable carries:

  • the DataType, for example Float, Double, Int32 or Boolean, so the client does not guess between signed and unsigned or between word orders,
  • the AccessLevel, which says whether the value can be read and whether it can be written.

When a client reads the value, the answer is a small package of four items:

ItemMeaning
ValueThe reading, already in engineering units.
Status codeThe quality: Good, Uncertain or Bad, with a detailed code for the reason.
Source timestampThe time the value was taken at its source, as far as the server knows it.
Server timestampThe time the server received or processed the value.

A Modbus response has none of the last three, so when a meter stops answering each Modbus client decides for itself what to show. An OPC UA server changes the status to Bad or Uncertain, and every client sees the same judgement.

Units and ranges as properties

For measured quantities the specification defines a variable type named AnalogItemType. A variable of this type has properties, each of which is itself a small Variable joined by HasProperty:

  • EngineeringUnits (optional): the unit, with a display name such as V or kW and a code from a standard list of units.
  • EURange: the low and high limits of the normal range of the value, in engineering units.

A client can therefore label an axis, scale a bar and reject an absurd value without a person typing anything.

Subscriptions against polling

A client can read a variable whenever it likes: that is polling, as in Modbus. For continuous monitoring the client instead creates a subscription and adds monitored items to it, one for each variable of interest. Four settings matter:

  • The sampling interval is how often the server looks at the value.
  • The deadband is a filter: a sample is reported only if it differs from the last reported value by more than the deadband. Without a filter, any change of value or status is reported.
  • The queue size is how many reported values the server keeps for the item between two publications. With a queue of 1, only the newest is kept.
  • The publishing interval is how often the server sends what has collected to the client.

The deadband test

is the new sample and is the last value that was reported. is the deadband. An absolute deadband is given directly in the unit of the value. A percent deadband is a percentage of the EURange, from to , so it can be used only on a variable that has an EURange.

time (s)0123456789101112131415samplereportedxxxxxxpublish2 val3 val1 val
Sampling interval 1 s, publishing interval 5 s

When nothing has changed, the server sends a short keep-alive message from time to time, so the client can tell a quiet process from a dead connection. The purpose is the same as report by exception with birth and death messages in Sparkplug B. One difference matters for remote sites: in the client and server form, the client opens the connection to the server, which listens on the site (4840 is the registered port for the OPC UA binary protocol). Since version 1.04 of the specification a server may instead open the connection outward to the client (reverse connect), so that no inbound port is opened on the site, but fewer products support it.

The security model

Security is part of OPC UA, not an addition. It has three layers.

  1. Application certificates. Every client and every server has its own certificate. Each side keeps a list of the certificates it trusts, and a connection from an unknown application is refused until an administrator accepts its certificate.
  2. Message security. The client and the server agree on a mode for the connection: None, Sign, or Sign and Encrypt. Signing proves who sent a message and that it was not changed. Encryption also hides the content.
  3. User identity. After the applications trust each other, a user is identified: anonymous, a user name and password, or a user certificate. The server decides from the identity what the user may read, write and call.

The mode None and the anonymous user exist for testing. A common fault is that both are still enabled when the plant goes into service.

A write to a variable or a call to a method can start a machine. Commands to plant are made only under the site’s permit and lock-out rules, and a client used for monitoring should have rights to read only. Fast control and every safety function stay in the local controller.

Companion specifications

OPC UA defines how to describe things. It does not say which variables a meter or a pump must have. Companion specifications fill that gap: a group of makers agrees on a shared model for one kind of equipment, and publishes it with the OPC Foundation. Two examples are OPC UA for Devices, which gives a common base for device identification such as maker and serial number, and OPC UA for Machinery. Before you design your own type, look for a companion specification that covers the equipment.

Client and server, and publish and subscribe

Everything above is the client and server form: a session between one client and one server, with browsing, reading, writing and subscriptions. A later part of the specification adds a publish and subscribe form (PubSub). A publisher sends data sets to a network or to a message broker, for example an MQTT broker, and any number of subscribers receive them without a session to the publisher. Fewer products support it than the client and server form, so check both ends.

What OPC UA costs

CostDetail
Memory and processorA server needs a TCP/IP stack, the address space in memory, and cryptography for certificates. The specification defines reduced profiles for small devices, but a Modbus RTU server fits in a few kilobytes of program memory and an OPC UA server does not.
ComplexityCertificates expire and must be renewed and trusted on both sides. Time must be right for certificates to be valid. Someone on site must understand this.
LicencesThe specification can be read without charge. Some software stacks are commercial products with a licence fee. Open-source stacks exist, for example open62541 in C, each with its own licence terms to check.
The model itselfSomebody must design the types and keep them correct.

For a small site, simpler tools are often better:

  • Modbus with a documented register map is right at the device layer when the equipment already speaks it, the map is kept under version control with word order and scaling written down, and one gateway is the only client.
  • MQTT with Sparkplug B is right on the uplink when the link is metered or unreliable, the site must open only outbound connections, and the host needs names, types, timestamps and a clear online state, which Sparkplug B already gives.
  • OPC UA earns its cost when several clients on a site network need the same described data, when a PLC (programmable logic controller, the industrial computer that runs a machine) or a machine already has a server built in, or when a customer’s standard requires it.

Application 1: Model meter A and compare it with the register map



Step 1: Draw the model

Click to reveal the tree
  1. One object for the meter. MeterA is an Object in the Objects folder. Its HasTypeDefinition reference points to EnergyMeterType. ✅

  2. One variable for each quantity. Each is joined to the object by HasComponent. Nine are Float. The energy is Double, because a 32-bit Float holds only about seven significant digits and 123,456.78 already needs eight. ✅

  3. Properties. Each variable has an EURange. All except the power factor, which has no unit, have EngineeringUnits. For the energy, the range ends where the uint32 register returns to zero:

    The model has 10 variables with 19 properties, which is 29 Variable nodes. ✅

ObjectsMeterAObject, EnergyMeterTypeVoltageL1NFloat240.3EngineeringUnitsVEURange0to300VoltageL2NFloat239.8VoltageL3NFloat241.1CurrentL1Float40.12CurrentL2Float39.87CurrentL3Float40.31ActivePowerFloat24.15PowerFactorFloat0.840FrequencyFloat50.02ActiveEnergyImportDouble123456.78
Meter A as an object with variables

Every variable has properties like those shown for the first.

Step 2: Compare with the Modbus register map

Click to reveal the read and the comparison
  1. A read of the variable. The client receives the value 240.3, the status Good, a source timestamp (the moment the gateway read the meter, for example 08:00:00.000 UTC) and a server timestamp a little later (08:00:00.120). ✅

  2. The same quantity on Modbus. The client receives the word 0x0963, which is 2,403. Only the maker’s table turns it into . ✅

  3. The comparison.

    ItemFrom the OPC UA serverFrom Modbus
    NameBrowseName and DisplayNameNot in the protocol. From the maker’s table.
    Data typeDataType attributeNot in the protocol. From the table.
    UnitEngineeringUnits propertyFrom the table.
    ScalingNot needed: the value is in engineering unitsThe client applies 0.1 V per count from the table.
    QualityA status code with every valueNone for a value. A timeout or an exception response says only that the read failed.
    TimestampSource and server timestampsNone. The client adds its own time of arrival.
    RangeEURange propertyFrom the table, if it is given.
    What existsFound by browsingFrom the table.

    Seven of the eight items are absent from the Modbus frame, and the eighth is work for the client. ✅

Step 3: The subscription

Click to reveal the reported samples
  1. Apply the deadband. The first sample, 240.3 at , is always reported. After that, each sample is compared with the last reported value:

    Time (s)Sample (V)Last reported (V)Difference (V)Reported
    3240.9240.30.6yes
    6240.2240.90.7yes
    7239.6240.20.6yes
    9240.3239.60.7yes
    10241.2240.30.9yes

    The other six samples differ by 0.3 V or less from the last reported value. Six of the twelve samples are reported. ✅

  2. Group them by publishing interval. The publication at 5 s carries 2 values (from and 3). The publication at 10 s carries 3 values (from , 7 and 9). The publication at 15 s carries 1 value (from ). ✅

  3. Compare with polling. A client that polls every second sends 12 requests and receives 12 answers in the same time. The subscription sends 3 messages, and each value still has its own source timestamp. ✅

  4. A percent deadband. A deadband of 1 % of the EURange is

    With it, only the first sample is reported, because the voltage never moves 3 V. A percent deadband on a wide range can hide everything of interest. ✅

  5. Check with the script. The Python script builds the same model as a nested structure, counts 29 Variable nodes, applies the deadband and prints the same six samples in groups of 2, 3 and 1. ✅

Check it before the gateway goes into service. Browse the server and compare each value with the meter’s own display at the same moment. Then remove the gateway’s RS-485 plug for one minute (on a working site, wait for a planned shutdown of the meter instead). The status of every variable of MeterA must change from Good to Bad or Uncertain within one poll time of the gateway. Some gateways keep the last value with the status Good. Such a server hides a dead meter behind a correct name and unit, and its status must not be trusted until the gateway is configured to report the failure.

Application 2: A protocol for each layer at three sites



Step 1: The device layer

Click to reveal the device layer choices
  1. The rule. At the device layer, use what the equipment already speaks. Replacing a working meter to gain a newer protocol is rarely justified. ✅

  2. Site 1. Modbus RTU, with the register map of each meter documented in the gateway’s configuration: address, type, word order and scaling. ✅

  3. Site 2. The PLC keeps the fieldbus it has for its drives and sensors (its own network to the equipment it controls). The four meters stay on Modbus RTU, read by the PLC or by a gateway. ✅

  4. Site 3. Modbus RTU for the meter. J1939 for the generator, with the gateway in listen-only mode, because a monitor must never transmit on an engine bus. ✅

Click to reveal the choices and the reasons
  1. Site 1. Nothing more is needed inside the site: the gateway is the only client. The uplink is MQTT over TLS, opened outward by the gateway, with Sparkplug B if the host application supports it. An OPC UA server would add certificates to manage on a site with no engineer, for a single consumer. ✅

  2. Site 2. Inside the site, OPC UA in the client and server form between the PLC and the SCADA system. Both ends already have it, the network is fixed, and several clients need the same described data. For the remote platform, an edge gateway reads the PLC as an OPC UA client with read rights only and publishes outward by MQTT over TLS, with Sparkplug B if the platform supports it. No inbound connection to the control network is opened. ✅

  3. Site 3. MQTT with Sparkplug B, with report by exception and a buffer in the gateway. The gateway opens the connection outward, which a mobile network without a fixed public address allows. The birth and death messages tell the host which of forty gateways is offline. A client and server connection into each site would need a fixed address or a private network for every site, or reverse connect in every gateway, which few support. ✅

  4. The volume for site 3.

    Report by exception saves about 1,084 MB in 30 days for the meters alone, on the stated assumptions. ✅

Step 3: The decision table and a check

Click to reveal the table
  1. The table.

    SiteDevice layerInside the siteUplink
    1. Cold store, five metersModbus RTU, documented mapNothing moreMQTT over TLS, Sparkplug B if the host supports it
    2. Factory, PLC and SCADAFieldbus of the PLC, Modbus RTU for metersOPC UA client and serverMQTT over TLS from a read-only edge gateway, Sparkplug B if the host supports it
    3. Forty remote sitesModbus RTU and J1939 (listen only)Nothing moreMQTT with Sparkplug B, report by exception, buffered

    ✅

  2. Check with the decision flow. Follow the flow below for each site. Site 1 answers no, yes, no. Site 2 answers yes, yes, no. Site 3 answers no, yes, yes. The results agree with the table. ✅

  3. Check with the script. The script holds the same rules as a short function and prints the same three rows. ✅

Verify It in Python



The script uses only the standard library. It builds the model of meter A as a nested data structure, prints the browse tree and the comparison table, applies the deadband of Application 1 and prints the choices of Application 2. It is a model for understanding, not an OPC UA server: it opens no network connection and produces no plot.

opcua_meter_model.py
"""A model of meter A as an OPC UA style address space. For understanding only:
this is a nested data structure, not an OPC UA server."""
# ---------- The model: nodes joined by named references ----------
def prop(name, value):
return ("HasProperty", {"class": "Variable", "name": name, "type": "PropertyType",
"value": value, "children": []})
def variable(name, data_type, value, unit, low, high):
children = [prop("EURange", f"{low:,.10g} to {high:,.10g}")]
if unit: # the unit property is optional
children.insert(0, prop("EngineeringUnits", unit))
return {"class": "Variable", "name": name, "type": "AnalogItemType",
"data_type": data_type, "value": value, "status": "Good",
"source_time": "2026-10-11T08:00:00.000Z",
"server_time": "2026-10-11T08:00:00.120Z",
"low": low, "high": high, "children": children}
meter = {"class": "Object", "name": "MeterA", "type": "EnergyMeterType", "children": [
("HasComponent", variable("VoltageL1N", "Float", 240.3, "V", 0, 300)),
("HasComponent", variable("VoltageL2N", "Float", 239.8, "V", 0, 300)),
("HasComponent", variable("VoltageL3N", "Float", 241.1, "V", 0, 300)),
("HasComponent", variable("CurrentL1", "Float", 40.12, "A", 0, 100)),
("HasComponent", variable("CurrentL2", "Float", 39.87, "A", 0, 100)),
("HasComponent", variable("CurrentL3", "Float", 40.31, "A", 0, 100)),
("HasComponent", variable("ActivePower", "Float", 24.15, "kW", 0, 60)),
("HasComponent", variable("PowerFactor", "Float", 0.840, None, -1, 1)),
("HasComponent", variable("Frequency", "Float", 50.02, "Hz", 45, 65)),
("HasComponent", variable("ActiveEnergyImport", "Double", 123456.78, "kWh", 0, 0xFFFFFFFF * 0.01)),
]}
objects = {"class": "Object", "name": "Objects", "type": "FolderType",
"children": [("Organizes", meter)]}
def browse(node, reference="", depth=0, limit=None):
"""Print a node and follow its references, as a client does when it browses."""
shown = f"{node['name']} [{node['class']}, {node['type']}]"
if node["class"] == "Variable" and "data_type" in node:
shown += f" {node['data_type']} = {node['value']}"
elif node["class"] == "Variable":
shown += f" = {node['value']}"
print(" " * depth + (f"{reference} -> " if reference else "") + shown)
for count, (ref, child) in enumerate(node["children"]):
if limit is not None and depth == 1 and count >= limit:
print(" " * (depth + 1) + f"... {len(node['children']) - limit} more variables")
break
browse(child, ref, depth + 1, limit)
def find(node, name):
if node["name"] == name:
return node
for _, child in node["children"]:
hit = find(child, name)
if hit:
return hit
return None
def count(node, node_class):
return (node["class"] == node_class) + sum(count(c, node_class) for _, c in node["children"])
print("Browse from the Objects folder (first two variables in full):")
browse(objects, limit=2)
components = len(meter["children"])
print(f"MeterA has {components} variables; the model holds {count(objects, 'Variable')} "
f"Variable nodes with their properties")
v = find(objects, "VoltageL1N")
print("Read of the Value attribute of VoltageL1N:")
for key in ("value", "status", "source_time", "server_time"):
print(f" {key:<12} {v[key]}")
# ---------- What a client learns: OPC UA against the Modbus register map ----------
rows = [
("Name", "BrowseName, DisplayName", "none; maker's table"),
("Data type", "DataType attribute", "none; maker's table"),
("Unit", "EngineeringUnits property", "none; maker's table"),
("Scaling", "not needed, value is scaled", "client applies 0.1 V"),
("Quality", "status code with each value", "none per value"),
("Timestamp", "source and server time", "none; client adds its own"),
("Range", "EURange property", "none; maker's table"),
("What exists", "browse the address space", "none; maker's table"),
]
absent = sum(1 for _, _, modbus in rows if modbus.startswith("none"))
print(f"{'Item':<12} {'From the OPC UA server':<28} From Modbus on the wire")
for item, ua, modbus in rows:
print(f"{item:<12} {ua:<28} {modbus}")
print(f"{absent} of {len(rows)} items are absent from the Modbus frame; the raw word "
f"0x0963 = {0x0963} becomes {0x0963 * 0.1:.1f} V only with the table")
# ---------- Monitored item: sampling, deadband and publishing ----------
SAMPLING, PUBLISHING = 1, 5 # seconds
samples = [240.3, 240.4, 240.1, 240.9, 241.0, 240.6,
240.2, 239.6, 239.9, 240.3, 241.2, 241.1]
percent = 1.0
percent_band = percent / 100 * (v["high"] - v["low"])
ABSOLUTE = 0.5 # V
def notifications(values, deadband):
"""The first sample is always reported; later ones only past the deadband."""
kept, last = [], None
for k, value in enumerate(values):
if last is None or abs(value - last) > deadband:
kept.append((k * SAMPLING, value))
last = value
return kept
kept = notifications(samples, ABSOLUTE)
print(f"Percent deadband of {percent:g} % on 0 to 300 V = {percent_band:g} V; "
f"notifications with it: {len(notifications(samples, percent_band))}")
print(f"Absolute deadband {ABSOLUTE} V: {len(kept)} notifications from {len(samples)} samples")
print(" " + ", ".join(f"t={t} s: {value}" for t, value in kept))
span = len(samples) * SAMPLING
for start in range(0, span, PUBLISHING):
inside = [value for t, value in kept if start <= t < start + PUBLISHING]
print(f" publish at {start + PUBLISHING:>2} s carries {len(inside)} values: {inside}")
print(f" polling every {SAMPLING} s would need {len(samples)} reads for the same {span} s")
# ---------- Application 2: a protocol for each layer ----------
sites = [
{"name": "Cold store, five meters", "mobile": False, "scada": False, "plc": False,
"engine": False},
{"name": "Factory, PLC line and SCADA", "mobile": False, "scada": True, "plc": True,
"engine": False},
{"name": "Forty remote sites", "mobile": True, "scada": False, "plc": False,
"engine": True},
]
def choose(site):
"""The rules of the decision flow: keep what the equipment speaks, add meaning
where several consumers need it, and send outward what the link can carry."""
device = "Modbus RTU and a documented register map"
local = "none needed"
uplink = "MQTT with TLS, Sparkplug B if the host supports it"
if site["plc"]:
device = "the fieldbus the PLC has; Modbus RTU for the meters"
if site["engine"]:
device = "Modbus RTU for the meter; J1939, listen only, for the engine"
if site["scada"]:
local = "OPC UA client and server, PLC to SCADA"
uplink += ", from a read-only edge gateway"
if site["mobile"]:
uplink = "MQTT with Sparkplug B, report by exception, buffered"
return device, local, uplink
for site in sites:
device, local, uplink = choose(site)
print(site["name"])
print(f" device layer: {device}")
print(f" on site: {local}")
print(f" uplink: {uplink}")
JSON_MB, RBE_MB = 60.9, 33.8 # MB in 30 days for one meter (estimates)
print(f"Forty sites, one meter each, 30 days: {40 * JSON_MB:,.0f} MB as JSON every 10 s, "
f"{40 * RBE_MB:,.0f} MB with report by exception")

Expected output

Browse from the Objects folder (first two variables in full):
Objects [Object, FolderType]
Organizes -> MeterA [Object, EnergyMeterType]
HasComponent -> VoltageL1N [Variable, AnalogItemType] Float = 240.3
HasProperty -> EngineeringUnits [Variable, PropertyType] = V
HasProperty -> EURange [Variable, PropertyType] = 0 to 300
HasComponent -> VoltageL2N [Variable, AnalogItemType] Float = 239.8
HasProperty -> EngineeringUnits [Variable, PropertyType] = V
HasProperty -> EURange [Variable, PropertyType] = 0 to 300
... 8 more variables
MeterA has 10 variables; the model holds 29 Variable nodes with their properties
Read of the Value attribute of VoltageL1N:
value 240.3
status Good
source_time 2026-10-11T08:00:00.000Z
server_time 2026-10-11T08:00:00.120Z
Item From the OPC UA server From Modbus on the wire
Name BrowseName, DisplayName none; maker's table
Data type DataType attribute none; maker's table
Unit EngineeringUnits property none; maker's table
Scaling not needed, value is scaled client applies 0.1 V
Quality status code with each value none per value
Timestamp source and server time none; client adds its own
Range EURange property none; maker's table
What exists browse the address space none; maker's table
7 of 8 items are absent from the Modbus frame; the raw word 0x0963 = 2403 becomes 240.3 V only with the table
Percent deadband of 1 % on 0 to 300 V = 3 V; notifications with it: 1
Absolute deadband 0.5 V: 6 notifications from 12 samples
t=0 s: 240.3, t=3 s: 240.9, t=6 s: 240.2, t=7 s: 239.6, t=9 s: 240.3, t=10 s: 241.2
publish at 5 s carries 2 values: [240.3, 240.9]
publish at 10 s carries 3 values: [240.2, 239.6, 240.3]
publish at 15 s carries 1 values: [241.2]
polling every 1 s would need 12 reads for the same 12 s
Cold store, five meters
device layer: Modbus RTU and a documented register map
on site: none needed
uplink: MQTT with TLS, Sparkplug B if the host supports it
Factory, PLC line and SCADA
device layer: the fieldbus the PLC has; Modbus RTU for the meters
on site: OPC UA client and server, PLC to SCADA
uplink: MQTT with TLS, Sparkplug B if the host supports it, from a read-only edge gateway
Forty remote sites
device layer: Modbus RTU for the meter; J1939, listen only, for the engine
on site: none needed
uplink: MQTT with Sparkplug B, report by exception, buffered
Forty sites, one meter each, 30 days: 2,436 MB as JSON every 10 s, 1,352 MB with report by exception

Common Mistakes



  • Reading a status of Good as proof that the number is right. Good means the server obtained the value without a known fault. A wrong word order in the gateway still gives a wrong number.
  • Leaving the security mode None and the anonymous user enabled after commissioning.
  • Setting a sampling interval far shorter than the source can supply. If the gateway polls the meter every 10 s, sampling every 100 ms gives no new information.
  • Expecting every change with a queue size of 1. Only the newest value in each publishing interval is delivered.
  • Using a percent deadband without looking at the EURange. One percent of 0 to 300 V is 3 V.
  • Choosing OPC UA for one gateway and one consumer, where a documented register map and an MQTT uplink do the work with less to maintain.

Summary



  • An OPC UA server offers an address space of nodes joined by typed references. A client finds what exists by browsing from the Objects folder.
  • A Variable gives its value with a data type, a status code, a source timestamp and a server timestamp. Units and ranges are properties.
  • A subscription with monitored items replaces polling: the server samples, filters with a deadband and publishes at an interval.
  • Security has three layers: application certificates, signed or signed and encrypted messages, and user identity.
  • OPC UA costs memory, certificate management and modelling work. Modbus with a documented map at the device and MQTT with Sparkplug B on the uplink are often the better tools for a small or remote site.

Exercises



1. CurrentL1 has an EURange of 0 to 100 A. A monitored item uses a percent deadband of 2 %. The last reported value is 40.12 A and the next sample is 41.90 A. Is the sample reported?

Answer

. The change is , which is not more than 2 A, so the sample is not reported.

2. A monitored item has a sampling interval of 500 ms and its subscription has a publishing interval of 10 s. The value changes at every sample and there is no deadband. How many values does one publication carry with a queue size of 1, and what queue size delivers every sample?

Answer

There are samples in one publishing interval. With a queue size of 1 the publication carries 1 value, the newest. A queue size of 20 delivers all of them.

3. A monitored item on CurrentL1 has an absolute deadband of 0.2 A. The samples are 40.12, 40.20, 40.35, 40.31, 40.05, 39.87, 39.80, 40.10, 40.31, 40.33 A. Which samples are reported?

Answer

Compare each sample with the last reported value: 40.12 (first), 40.35 (0.23), 40.05 (0.30), 39.80 (0.25), 40.10 (0.30), 40.31 (0.21). Six of the ten samples are reported. The sample 39.87 is not, because it is only 0.18 A from 40.05.

4. In the model of Application 1, name the reference type that joins (a) MeterA to VoltageL1N, (b) VoltageL1N to its EURange, (c) the Objects folder to MeterA. Then say what a screen should show when a read returns the value 24.15 with the status Bad.

Answer

(a) HasComponent. (b) HasProperty. (c) Organizes. With a status of Bad, the screen must not show 24.15 kW as a present reading. It marks the value as invalid, with the status.

5. A water company has twelve pump stations on its own fibre network. Each station has a PLC with an OPC UA server built in. The central SCADA system is an OPC UA client, and two other departments want the same data. Choose the protocol between the stations and the centre, and give two reasons.

Answer

OPC UA in the client and server form, with security mode Sign and Encrypt and a named user for each client. Both ends already have it and the network is fixed and private, so the client can reach each server. Three consumers need the same names, units and status, which the servers describe once.

References



  • OPC Foundation, OPC 10000-1: OPC Unified Architecture, Part 1: Overview and Concepts.
  • OPC Foundation, OPC 10000-3: Address Space Model and OPC 10000-8: Data Access.
  • International Electrotechnical Commission, IEC 62541: OPC Unified Architecture (series).
  • W. Mahnke, S.-H. Leitner and M. Damm, OPC Unified Architecture, Springer, 2009.


© 2021-2026 SiliconWit®. All rights reserved.
SCADAclientEnergyloggerEngineerlaptopOPC UAOPC UA serverin gateway Daddress space:names, types, units,status, timestampsRS-485, Modbus RTUMeter A
One server, several clients, one description
Predict first

A client subscribes to a voltage. The server samples it every second, with a deadband of 0.5 V, and publishes every 5 s. The voltage wanders between 239.6 V and 241.2 V for 12 s. About how many messages reach the client?

See it: browse the address space of gateway D

Click a node to open it and to see what a client learns about it. The client needs no document from the maker: it starts at Objects, finds MeterA, and asks for its components. Each variable carries its data type, unit and range, and every read returns a status and two timestamps. The values are those of the lesson. The last button shows what OPC UA cannot fix: the server offers whatever its builder configured.

ModbusOPC UA 09 63 2,403 ? MeterA / VoltageL1N 240.3 V status: Good 08:00:00 UTC The register map now lives in one place: the server
See it: which samples a subscription reports, and when

Values reported
Messages to the client
Largest change not reported

The server samples the voltage once a second (the twelve samples of the lesson). A sample is reported only if it differs from the last reported value by more than the deadband: the shaded band follows that last value. Reported values wait in the queue of the item and leave together at the end of each publishing interval. A client that polls every second would send 12 requests in the same time.

Check yourself

Three questions. Each wrong choice is a mistake people really make, so read the note after you answer.

1. The client of the lesson changes VoltageL1N to a percent deadband of 0.2 %. The EURange of the variable is 0 to 300 V. With the same twelve samples, how many are reported?

2. The builder of gateway D joins the two registers of the energy counter in the wrong word order. The true value is 123,456.78 kWh. What does an OPC UA client see?

3. An energy logger must read data from the OPC UA server built into a PLC on the site network. How should its connection be set up?

Watch it build: what one Variable tells the client
VoltageL1N Value 240.3 DataType Float AccessLevel read Units: VEURange: 0 to 300 a read returns 240.3 src 08:00:00.000 srv 08:00:00.120 Good Good Bad: meter silent Modbus: 09 63, no more
  1. VoltageL1N is a Variable. Its Value attribute is the reading: 240.3.
  2. The DataType says Float, so the client does not guess the type or the word order.
  3. The AccessLevel says whether the value can be read or written. A monitoring client needs read only.
  4. A read returns four items: the value, the status Good, a source timestamp and a server timestamp.
  5. Modbus gives the word 09 63 and nothing else. When the meter stops, the server sets the status to Bad.
  6. As an AnalogItemType it has properties: EngineeringUnits V and EURange 0 to 300.
Found this useful?

Discussion

    Comments show your name. Be kind, stay on the topic.