ResourcesInstrumenting a press with no OPC UA
Field note · Energy monitoring17 min read
Instrumenting a press that will not talk to you
The press we needed to meter was commissioned long before anyone expected it to be asked a question. No OPC UA server, no MQTT client, no data port worth the name. This is what we attached to it, what we measured, the checks that caught what the documentation did not, and where the approach runs out of road.
Written 10 September 2026. An account of our own commissioning work, not a set of instructions for yours. Every figure was read from a live meter on a working machine, not taken from a datasheet. Where something is inferred rather than measured, it says so. Where a check caught something the documentation had wrong, that is in here too.
The problem, stated honestly
A press has a works order on it. The works order will eventually carry a cost. Somewhere between the two sits a number nobody can produce: what this part cost to make, in energy, on this machine, on this shift.
The standard answers are all bad. The site’s incoming supply meter tells you what the building drew, which is a number you can already read off a bill. A sub-meter on a distribution board tells you what six machines and a compressor drew between them. And the machine’s own controller, which knows exactly what it did, is a sealed unit from a vendor whose integration offer starts at a control system replacement.
So we metered the machine directly. The idea is not new. What follows is the part nobody writes down: the fortnight between having the idea and having a number we were willing to defend.
1. Choosing the instrument, and what MID actually means
The device is a three-phase panel meter with a Modbus TCP interface — in this case a Siemens SENTRON PAC3220. It measures per-phase voltage, current, active, reactive and apparent power, power factor, total harmonic distortion and frequency, and it accumulates energy internally.
That last property gets the least attention and is the most misunderstood, including by us early on. A meter that accumulates kWh in its own firmware gives you a total that survives a dropped connection: read the counter again afterwards and the difference still holds. That is genuinely useful, and it is not what we report from.
Every energy figure the product actually publishes is integrated from the stored power stream, not read off the meter's counter — trapezoidally, through one implementation that idle events, per-part cost, tariff banding and peak load all share. The reason is the counter's one weakness: it resets on a device reboot and on a counter reset, and a reset mid-window turns a subtraction into a negative or absurd number with nothing to flag it. Integrating the power stream is immune to that, and it is also what makes the sampling rate load-bearing rather than a matter of taste — which is the subject of the other half of this work.
Two earlier devices were tried and dropped before this one, on reliability grounds. That is worth saying because write-ups never include it, and the instrument you end up with is usually the second or third choice rather than the first.
MID certification did not come into it, and it is worth saying why, because it surfaces in every procurement conversation. MID is a property of the meter, not of the company installing it, and it governs whether a reading is admissible for billing a third party. This meter monitors machines for the site’s own decisions, so it was never relevant here. It would be if anyone were re-billing a tenant off the back of it. What it never means is that a service is certified — that is a misreading of the certificate, and we have heard it made.
2. Verifying the register map instead of trusting it
The meter answers Modbus function 3. The vendor publishes a register map. The temptation is to type the map into a config file and start logging.
Two things stopped that being enough.
First, reads succeed only on odd start addresses. An even start returns Modbus exception 2. This is not a fault: every measured value is an IEEE-754 float spread across two consecutive registers, and the device refuses to hand back half of one. Discovering that by address-space scan takes twenty minutes. Discovering it in production, as intermittent decode failures, takes considerably longer.
Second, and more important, the map was checked arithmetically before it was believed. Read the three per-phase active power registers and the total in the same breath:
L1 212.65 W + L2 252.99 W + L3 306.75 W = 772.39 W
register 65 (total active power) = 772.39 W
The identity holds exactly. Frequency reads 50.09 Hz where the grid is nominally 50. A map that lines up in two independent ways is a map you can build on. A map that merely came out of a PDF is a hypothesis.
This matters because the failure mode of a wrong register map is not an error message. It is a plausible number. Everything downstream — the chart, the cost, the report to the board — will be internally consistent and wrong, and nothing in the system will object.
This is where checking the arithmetic earned its keep. Five 64-bit energy counters were read and named from the family layout. The totals did not reconcile, and working the manual through against them showed four of the five names were wrong — what had been logged as apparent energy was reactive energy import, and the register called active energy export was a second import tariff. The evidence had been sitting in the data for three days: one counter was reading well below the active energy counter, which is impossible for apparent energy over the same period and entirely ordinary for reactive. The anomaly nobody could explain was the anomaly telling us the labels were wrong.
Two transcription faults in the vendor’s own manual are worth knowing about before anyone re-reads it. Across that block the unit column is shifted by a row — it prints varh against active export and Wh against reactive import. The names are self-consistent and the units are not, so we took the names and applied the units from physics.
3. What the benchmark changed
Before deciding how the software would work, the meter was benchmarked from the gateway that would be polling it — same VLAN, 1.9 ms away:
sustained poll, one persistent connection: 790.6 reads/sec over 15 s
latency: p50 1.17 ms p95 1.86 ms max 10.81 ms
concurrent Modbus connections accepted: 3 (the fourth is reset)
fresh socket per poll: 384/sec, 0 failures
Both numbers changed the design.
790 reads a second means a 25 ms poll needs forty reads a second, so it is affordable roughly twenty times over. The received wisdom — carried into an early draft of our own plan — is that Modbus polling cannot time a press stroke. The benchmark settles it: that conclusion only holds if you assume a one-to-five second poll of the kind a cloud service would drive. The protocol was never the limit. The placement of the loop was the limit — a poll running at the edge, on the same VLAN, emitting upward only when something changes, is event-driven everywhere it counts, even though every read is a poll.
Worth stating plainly, because it is a common hope: the device cannot push. Modbus is request/response by specification and has no unsolicited message. Nor does this unit offer any of the alternatives its family sometimes carries — the port scan found IEC 61850 MMS closed, SNMP closed, PROFINET closed. Only Modbus and a web server answer. There is nothing to subscribe to, so event-driven here means the gateway detects the change and raises the event, never the meter tells us.
Three concurrent connections is a hard ceiling, and it is the more consequential finding. It means no connection pooling, ever. It means a second monitoring process pointed at the same meter is a support incident, not a redundancy strategy. And it means the connection budget has to be written down deliberately: the gateway takes one, and the remaining two belong to an engineer standing at the panel with the vendor’s configuration tool. Take all three and you have built a system that locks out the person who has to maintain it.
It also changed a standing default of ours. Our Modbus poller had always opened a fresh socket per cycle, on sound reasoning — a meter on a factory floor gets power-cycled and re-addressed, and a cached connection buys a class of half-open-socket bugs for the price of a handshake. True at a slow poll. Unworkable at 25 ms against a three-connection device. So this meter gets one persistent connection with reconnect-on-error, and the other meter type keeps the old behaviour unchanged. Connection strategy is a property of the device, not a global preference.
4. Three ways to know a press has cycled, and why you want two of them
Energy alone gives you kWh. To get kWh per part you need to know how many parts. There are three routes to that, and they fail differently.
A — the meter’s own counter. These meters carry a configurable universal counter that increments in firmware on a digital-input transition or a limit violation. You poll the register, take the delta, and you know exactly how many cycles happened. It is immune to your poll rate entirely: poll once a minute and the count is still exact, because the counting happened in the device. It survives a gateway restart, because the total lives in the meter. What it does not give you is when each cycle started — you learn how many cycles happened in the last thirty seconds, not where each one fell inside it.
B — the power signature. No wiring at all. The machine’s idle draw is measured, a threshold is set above it with hysteresis, and a stroke is the excursion above it. On the press in question the idle baseline was remarkably stable — 763.5 W mean over ninety seconds, a 39 W spread, five per cent — which makes threshold-setting straightforward. The exit threshold can be set from idle data alone. The enter threshold cannot, and anyone who writes one in before observing a real stroke is guessing. This route detects that the machine is working, and counts strokes only if they are slower than the poll.
C — the digital input, polled fast at the edge. Read the DI register every 20–50 ms on that one persistent connection, debounce it, and you get real start and end timestamps. Against strokes of eight to thirty seconds that is well under a per cent. This is the route that gives you a distribution of stroke durations rather than an average, and it is the one that can flag a stalled stroke while it is still happening.
We built A and C together. They are the same wire and the same poll — C times the strokes, A guarantees the count. And their disagreement is the integrity check. If the counter advanced by eleven and the edge detector saw nine, the system knows it missed two and can say so, instead of reporting nine with a straight face. That failure mode — a plausible wrong number, reported confidently — is the one that destroys trust in a monitoring system, and here it costs one extra register in a read plan you were already issuing.
B runs alongside as a third opinion. It needs no wiring, so it could be commissioned on day one, and it cross-checks the other two for nothing.
The part that is not a software problem
The universal counter, when first read, was zero. Not unchanged — zero. The counter is monotonic, so one that had ever registered an event would hold a non-zero total no matter what the machine was doing that week. Zero means the digital input is not wired to the press, or the counter is not configured to count it, or both.
No amount of software makes a counter that is not counting produce cycle times. That wiring is a physical job on someone else’s machine, needing someone else’s electrician and someone else’s downtime window, and it is dramatically easier while the machine is already stripped for maintenance than when it is back in production.
The scheduling rule this produces: find out whether that input is wired before planning any of the software around it, and get the wiring into a maintenance window that is happening anyway. Here the answer arrived after the software plan rather than before it, which is precisely the case the power-signature route is carried to cover — it kept commissioning moving without waiting on an electrician.
5. The reading we refused to trust
The first full snapshot showed a power factor of 0.21. That is a phase angle around 78 degrees — 3,491 var of reactive power against 772 W of real. The device is self-consistent about it (772.4 / 3595.8 = 0.2148, exactly what it reports), so it is not a decoding error.
There are two explanations. One is that the machine was stopped and being worked on, and an unloaded induction motor sits at 0.1–0.3 power factor as a matter of routine. The other is that the current transformers are on the wrong phases, or clamped the wrong way round. From a single idle snapshot these look identical, and only one of them is harmless.
The wrong response is to go hunting for a CT fault on that evidence. The right response is to write down the observation that settles it, and then wait: when the press runs, power factor should climb to roughly 0.7–0.9. If it stays near 0.2 under load, the CTs are wrong and every power and energy figure being logged is wrong with them.
Worth knowing: this is not a CT ratio problem. A wrong primary ratio scales current, power and energy together and leaves power factor untouched — which means a ratio error is invisible in exactly the diagnostic that catches a phase error. Different fault, different test.
That check is a gate on trusting the data, not a gate on writing the code. The distinction is the useful one. Build the pipeline while the machine is down; withhold the conclusions until the machine has run.
6. Forty values, four columns
The meter publishes roughly forty distinct measurements. The obvious storage schema holds four: power, voltage, current, energy total.
Writing this meter into those four columns would discard per-phase detail, two of the three power kinds, power factor, harmonic distortion, frequency, and every energy counter except the first — and per-phase detail is precisely what diagnoses the power-factor question above. The instrument’s most useful output would have been thrown away at the first hop, silently, and nobody would have known to look for it.
The resolution was not to widen the existing table. That table is read by every dashboard query in the system, and adding thirty mostly-null columns to it for the benefit of one device type makes every unrelated page slower. Instead the full per-phase picture goes to its own table, one row per poll, and the four headline values keep flowing where they always did, so every existing chart, export and query continues to work untouched.
The rule we took out of it: when a new device publishes an order of magnitude more than the schema expects, it gets its own table rather than making the busiest table carry its ambitions.
Two practical decisions fell out of this. We aggregate before sending — batching a window of samples into one message every ten to thirty seconds costs no fidelity, because samples are timestamped at capture, and cuts tunnel traffic by an order of magnitude. And the two streams got different loss policies, and the line between them matters more than it looks. The per-phase power-quality detail — the unbalance, the harmonics, the per-phase power factor — is diagnostic, so a gap in it is a gap in a chart and can be dropped under pressure. The headline power stream cannot: it is what energy is integrated from, so a hole in it is a hole in a kWh figure. Where one happens anyway, the integrator carries the last value across the gap and marks the result estimated rather than quietly reporting it as measured. A dropped cycle count permanently under-reports production, so counts are never silently lost. When the link comes back we reconcile on the counter’s absolute total rather than replaying a sum of deltas — that is what survives a long outage. There is more on the storage side of this in sampling and retention for machine data.
7. What this method cannot measure
A field note that only describes what worked is a brochure. Here is the boundary.
It cannot tell you what the machine is doing internally. A clamp on a supply tells you what that supply drew. It does not know about pressure, temperature, position or tool state. Anything you infer about those is inference, and should be labelled as such on the screen that shows it.
It cannot separate the machine from its ancillaries unless they are on separate supplies. Chillers, dryers, conveyors and compressed air are frequently fed from elsewhere and frequently duty-cycle independently of the machine they serve. Deciding what counts as that machine’s energy is a judgement that has to be made explicitly, written down and kept consistent — otherwise the number moves when the person changes.
It cannot do motor current signature analysis. Spectral MCSA finds bearing and rotor faults months ahead by analysing the current waveform’s frequency content, and it needs raw current sampled at ten thousand samples a second or more. This meter publishes RMS aggregates computed on its own internal measuring cycle. No polling rate reaches waveform data the instrument never exposes. It is the wrong instrument class for that job, and it should be named as such rather than quietly hoped past.
It cannot tell you anything about an idle machine. All of the above depends on the machine drawing current in a pattern. A stopped press draws a standing load and little else, and a standing load says nothing about the state of the machine holding it.
And it cannot, on its own, tell you what a part cost. Energy per cycle requires cycles. Energy per part requires knowing which part was being made, which is a works-order question, not a metering question. If the shift declaration is wrong, or the job was never booked on, the meter will produce a beautifully precise kWh figure attached to the wrong thing. The quality of the energy data is capped by the quality of the production data it is joined to, and no instrument fixes that from the electrical side. It is also why an honest kWh per kilogram figure is harder than it looks — see Climate Change Agreements in plain English.
8. Where this was worth doing, and where we would not repeat it
Metering this machine earned its keep because it is a significant share of the site’s load, its duty cycle varies, and there was a decision waiting on the answer. Take any one of those three away and we would have argued against it.
We would not do this to answer a question about a building’s half-hourly demand profile — that is a supply-side question and the incoming meter already answers it. We would not do it where nobody has agreed what would change as a result of the number. And we would not do it on a machine that runs one product at one setting continuously, where a week of monitoring and a calculator settle the matter permanently.
The honest accounting is that the instrument was cheap and the installation was a few hours of an electrician’s time. Everything downstream cost more: the network route, the storage decisions, the sample-rate argument, and the join to production data. That is where the fortnight went, and it is the part we would budget differently next time.