How to Connect OPC UA Machine Data to Your ERP
how to connect OPC UA machine data to ERP
Also searched as
- OPC UA to ERP integration architecture
- PLC machine data to ERP production counts
- OPC UA subscription vs polling ERP
- send OPC UA data to MES and ERP securely
Short answer
Do not connect OPC UA servers straight to the ERP. Read machine tags through an edge gateway or MES, convert signals into business events (cycle complete, stop, state change, count), attach the work order context, and post summarised confirmations to the ERP through its supported API. The ERP wants quantities, times and reasons per order, not millions of raw tag values.
Applies to: OPC UA (IEC 62541) servers on PLCs, CNCs and gateways, integrated with Infor, SAP, NetSuite, Dynamics, Epicor or other ERPs via an MES, edge platform or custom middleware
How to connect OPC UA to ERP
- 1Inventory machines and their OPC UA support: native server on the controller, a vendor gateway, or a protocol converter for legacy PLC protocols.
- 2Define the tags you need: machine state, cycle counter or part count, program or recipe, alarm and stop code, and the work order or job identifier if the machine knows it.
- 3Deploy an edge gateway or MES connector inside the plant network that acts as the OPC UA client and uses subscriptions with a sampling interval and deadband, not tight polling.
- 4Convert signals to events: state transitions become start/stop events, counter deltas become production counts, with timestamps taken at the source.
- 5Add business context by joining each event with the active work order, operation and operator from the MES or a dispatch table.
- 6Buffer events locally (store and forward) so a network or ERP outage does not lose data.
- 7Post summarised confirmations to the ERP through its supported API, following your production reporting design, with a message ID for idempotency.
- 8Secure the path: OPC UA security policy with certificates, network segmentation, and an outbound-only connection from the plant zone to the integration layer.
Why not wire OPC UA to the ERP directly
OPC UA exposes machine data at high frequency and fine granularity: states, counters and alarms changing many times per second. An ERP expects transactions with business meaning, such as a posted quantity against an operation. Streaming raw tags into ERP tables overwhelms it, mixes concerns, and usually breaks on upgrade. The layer in between exists to filter, contextualise and decide what is worth a transaction.
That layer may be an MES, a historian, an IIoT platform or a small custom service. The choice is less important than having it own timestamps, buffering and state logic, so the ERP only sees clean, deduplicated events.
Subscriptions, sampling and counters
OPC UA clients create subscriptions with monitored items, each with a sampling interval, queue size and optional deadband. The server pushes changes, which is more efficient than polling and preserves the sequence of changes when the queue is sized properly. Choose intervals based on how fast the process changes, not the fastest the PLC can deliver.
Counters need care. A PLC counter may roll over, reset at power cycle or reset per program. Always compute production counts from deltas with rollover and reset detection, and cross-check against a cycle-complete signal where available. Persist the last seen value so a gateway restart does not create a spurious large delta.
Context and mapping to ERP transactions
A machine does not know the ERP work order unless someone tells it. Typical patterns: an operator scans or selects the job at the terminal, the MES dispatches the order to the machine, or the program name maps to an item and operation. Without that context, counts cannot be posted to an order and remain only machine statistics.
Once context is attached, map events to ERP concepts: counts to good and scrap quantity, run and stop intervals to labor and machine time, stop codes to downtime reasons, and program changes to setup. Then follow the same posting rules as any other MES feed.
// Pseudocode: counter delta with rollover and reset handling
delta = current - last
if (delta < 0) {
if (last > maxValue * 0.9) delta = (maxValue - last) + current; // rollover
else delta = current; // reset
}
publishCount(workOrder, operation, delta, timestampUtc, messageId);Security and air-gapped plants
Use OPC UA security: a security policy with signing and encryption, certificate trust lists managed deliberately, and user authentication on the server. Place the gateway in an industrial DMZ or a segmented zone, and prefer outbound connections initiated from the plant to the integration layer so you do not open inbound ports into the control network.
In defense and aerospace environments that are fully air-gapped, the integration layer, MES and ERP may all run on-prem, with data moved across any boundary by approved mechanisms. The same architecture applies, with local buffering and no cloud dependency.
Common pitfalls
- !Posting raw tag changes to the ERP instead of summarised business events.
- !Polling too aggressively, loading PLCs and the network for no analytical gain.
- !Ignoring counter rollover and reset, producing impossible production quantities.
- !No store and forward buffer, so outages create data gaps.
- !Attaching no work order context, leaving counts unpostable.
- !Leaving OPC UA security set to None for convenience.
How an ERP-grounded AI assistant handles this
Machine data is only useful if someone can ask about it in business terms. A private assistant grounded in your ERP and MES data, such as ERPray or DataRay on-prem, can answer questions like which orders ran with unexplained stops last week, with the query shown and ERP roles respected. It does not connect to PLCs and cannot control machines; it works on the summarised data your integration layer already stored.
Frequently asked questions
Does the ERP need an OPC UA client?
Generally no. Most ERPs are not designed to consume OPC UA directly. An edge gateway, MES or IIoT platform acts as the OPC UA client and sends business events to the ERP through its web service or API. This keeps the ERP stable and the machine logic outside it.
OPC UA or MQTT for shop floor data?
They solve different problems. OPC UA provides a rich information model and secure client-server access to machines; MQTT is a lightweight publish-subscribe transport often used to move data north. Many architectures use OPC UA at the machine and MQTT or a message queue between the plant and the integration layer.
How do I get machine counts to match ERP quantities?
Use cycle-complete signals and counter deltas with rollover handling, attach the active work order, and reconcile machine counts against the operator-reported good and scrap quantities. Differences usually trace to parts-per-cycle, rework, or counts during setup and first-article runs.
Can legacy machines without OPC UA be integrated?
Often yes, through a gateway that speaks the controller's native protocol and exposes OPC UA, or by adding sensors and I/O for counts and state. The effort rises for old controllers, so confirm which signals you truly need before investing.
Related
ISA-95 and B2MML: How to Integrate ERP with MES
ISA-95 defines the boundary between business systems (Level 4, the ERP) and manufacturing operations (Level 3, the MES) and the information that crosses it. B2MML is the XML implementation of those models. In practice you exchange a ProductionSchedule from ERP to MES, and ProductionPerformance, plus material and equipment information, back, mapping each element to your ERP's work order and confirmation APIs.
How-toHow to Calculate OEE from MES Data and ERP Standards
OEE equals Availability times Performance times Quality. Availability comes from MES run and stop events against planned production time, Performance compares actual output to the ideal cycle time (usually the routing standard from the ERP), and Quality is good units divided by total units. The numbers are only trustworthy if planned time, ideal cycle time and the good/scrap split are defined once and used consistently.
How-toHow to Send Production and Labor Reporting from MES to ERP
Treat the ERP work order as the system of record for cost and quantity, and the MES as the system of record for what physically happened. Send one confirmation message per operation (or per shift or lot) containing work order, operation sequence, good quantity, scrap quantity with reason, and labor start/stop per employee and work center, post it through the ERP's supported transaction API, and make the message idempotent so a retry never double-posts.
How-toHow to Design Scrap and Downtime Reason Codes for MES and ERP
Keep one governed list of reason codes with a small hierarchy, owned in a single system and synchronised to the other. Separate scrap reasons from downtime reasons, mark each downtime code planned or unplanned and each scrap code as process, material, design or operator related, and map codes to ERP accounts or cost categories where accounting needs them. Fewer, clearer codes beat long lists nobody uses correctly.
How-toHow to Sync an NCR From Your QMS to ERP Quarantine and MRB Disposition
The reliable pattern is two events: when the NCR opens, the ERP moves or flags the affected lot or serial into a non-nettable quarantine status; when the Material Review Board closes it, the disposition (use as is, rework, repair, scrap, return to vendor) triggers exactly one matching ERP transaction. The NCR number is the key that ties both sides together.
How-toHow to Link a CAPA to ERP Lots and Serial Numbers for Containment and Effectiveness
A CAPA is only as good as its containment scope, and the scope comes from ERP genealogy: forward trace from the suspect raw material lot or process to every job, serial and shipment that consumed it, and backward trace from the failed serial to its components. Store the CAPA number against those ERP records, then use ERP rejection and return data to verify effectiveness.
AI for ERPAI shop floor assistant for operators working inside your ERP
An on-prem AI copilot answers operator questions against your ERP work instructions, travelers, and routings in plain language, at the machine, without a screen full of menus.
AI for ERPAn Air-Gapped Private LLM for SyteLine, Built for Defense Suppliers
Deploy a private LLM on an air-gapped network alongside Infor SyteLine for defense suppliers: no internet egress, ITAR and CMMC-aware architecture.
Stuck on Shop floor to ERP?
Talk to engineers who work inside Shop floor to ERP every week, and who build private AI that answers these questions from your own ERP data.