# OEE OPC UA Tag Mapping JSON Generator

> Source: https://netray.co/tools/oee-opc-ua-tag-mapping-json-generator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Define the machine tags that feed OEE and get a JSON mapping for your collector or gateway configuration.

## Category

mes-shop-floor

## Industry

Discrete Manufacturing

## Audience

- MES engineer
- Controls engineer
- Data engineer

## Tool

**Kind:** template

**Output:** code

**Language:** json

**Fields:**

#### Machine or line ID

**Key:** machine

**Type:** text

**Default:** LINE-03

#### OPC UA endpoint

**Key:** endpoint

**Type:** text

**Default:** opc.tcp://192.168.10.20:4840

#### Machine state node ID

**Key:** state_node

**Type:** text

**Default:** ns=2;s=Line03.MachineState

#### Total count node ID

**Key:** total_node

**Type:** text

**Default:** ns=2;s=Line03.TotalCount

#### Reject count node ID

**Key:** reject_node

**Type:** text

**Default:** ns=2;s=Line03.RejectCount

#### Cycle time node ID

**Key:** ct_node

**Type:** text

**Default:** ns=2;s=Line03.CycleTimeMs

#### Sampling interval in ms

**Key:** sample_ms

**Type:** number

**Default:** 1000

#### Minimum stop length in seconds

**Key:** min_stop_s

**Type:** number

**Default:** 30

**Blocks:**

#### Tag mapping

**Body:** {
  "machine": "{{machine}}",
  "endpoint": "{{endpoint}}",
  "sampleIntervalMs": {{sample_ms}},
  "tags": [
    { "name": "machine_state", "nodeId": "{{state_node}}", "type": "int", "purpose": "availability" },
    { "name": "total_count", "nodeId": "{{total_node}}", "type": "counter", "purpose": "performance and quality" },
    { "name": "reject_count", "nodeId": "{{reject_node}}", "type": "counter", "purpose": "quality" },
    { "name": "cycle_time", "nodeId": "{{ct_node}}", "type": "int", "unit": "ms", "purpose": "performance" }
  ],
  "stateMap": {
    "0": "stopped",
    "1": "running",
    "2": "fault",
    "3": "setup",
    "4": "idle"
  },
  "rules": {
    "minStopSeconds": {{min_stop_s}},
    "counterRollover": "treat decrease as reset",
    "goodCount": "total_count - reject_count"
  }
}

**Notes:** Node IDs, state values and tag names are examples. Replace them with the addresses and enumerations used in your PLC program, and check them with a browser tool before going live. This is a generic structure, not the config format of any specific gateway product.

## Content

**Intro:** OEE depends on four signals from the machine: its state, its total count, its reject count and its cycle time. This generator writes a clean JSON mapping that lists them, with the rules a collector needs.

**Sections:**

#### How to use it

**Body:** Get the node IDs from your controls engineer or from the PLC symbol table. Fill the form and copy the JSON into the configuration of your gateway, collector script or historian. Start with one machine, check the numbers against a manual count for a shift, and then repeat for the others.

**Bullets:**

- Agree a state enumeration with controls first
- Use counters, not rates
- Confirm time sync across devices

#### Why these four signals

**Body:** State gives run and stop time, which drives availability. Total count and cycle time give performance. Reject count gives quality. With those four signals and a planned time calendar, you can compute OEE without any manual entry. Downtime reasons can then be added by operators on top of the stops that the state tag found.

#### Handling real signals

**Body:** Counters reset on power cycles and roll over at their maximum, so treat a decrease as a reset and not as negative production. Short stops below your minimum length are usually small stops, and should be counted but not asked about. Sampling every second is enough for most discrete machines.

#### Common mistakes

**Body:** Teams map a fault bit but not the idle and blocked states, so every non running time looks like a breakdown. Others read the cycle time from the last cycle, not the ideal. Keep ideal cycle time in a master data table and use the measured one for diagnostics only.

**Cta:** If you want machine signals joined with ERP orders so OEE is tied to jobs and parts, we can help design the integration.

**Faq:**

#### Do I need OPC UA?

**Answer:** No. The same four signals can come from Modbus, MQTT, a historian or a PLC export. OPC UA is common because it is a standard with named nodes. Use whatever your equipment and plant network support securely.

#### How do I get node IDs?

**Answer:** Use an OPC UA client to browse the server, or ask the controls engineer for the exported tag list. Copy the full node ID including the namespace index, because that part is needed for the connection.

#### Should the collector write to the PLC?

**Answer:** No. Keep the integration read only. Reading machine data for reporting does not need write access, and a read only account lowers the safety and security risk on the plant network.

#### How do I tie counts to ERP orders?

**Answer:** Record the active work order or part number as another tag or as an event from the MES. Then join counts by time window to the order, so the ERP gets completed quantity and scrap by job.

## Search terms

opc ua oee tags, oee tag mapping, plc tags for oee, machine state tag oee, oee data collection json, iiot oee configuration

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
