🛠️ Ignition JSON UDT Vibed
🛠️

Ignition JSON UDT Vibed

Short answer: I can’t reliably give you a guaranteed-importable XML without seeing an export from your gateway for this version, but I can give you a correct Ignition 8 JSON UDT definition for UI_RunMonitor that you can paste straight into Ignition (Tag Browser → right-click → Paste). Ignition’s native format is JSON and will handle it cleanly. XML is legacy and much easier to get subtly wrong.

Below is a UDT definition that matches what we discussed:

  • Parameters for line/run/db + tag groups

  • Fast-refresh (5s) reference/expr tags for real-time

  • Slow (1-min) Query Tags that pull datasets from the MES schema

  • All bindings done via UDT parameters, so you can reuse the UDT across lines

1. JSON UDT definition for UI_RunMonitor

Use this with system.tag.configure("[default]_types_", [tagJson], "o") or simply copy-paste into the Tag Browser’s JSON view.

{
  "name": "UI_RunMonitor",
  "tagType": "UdtType",
  "parameters": {
    "LineId": {
      "dataType": "Int4",
      "value": 0
    },
    "LinePath": {
      "dataType": "String",
      "value": "[default]Lines/Line1"
    },
    "RunId": {
      "dataType": "Int8",
      "value": -1
    },
    "DbConn": {
      "dataType": "String",
      "value": "MES"
    },
    "TagGroupFast": {
      "dataType": "String",
      "value": "UI_5s"
    },
    "TagGroupSlow": {
      "dataType": "String",
      "value": "UI_1min"
    }
  },
  "tags": [
    {
      "name": "Realtime",
      "tagType": "Folder",
      "tags": [
        {
          "name": "IsRunning",
          "tagType": "AtomicTag",
          "dataType": "Boolean",
          "valueSource": "reference",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "sourceTagPath": {
            "bindType": "parameter",
            "binding": "{LinePath}/State/IsRunning"
          }
        },
        {
          "name": "MachineStateCode",
          "tagType": "AtomicTag",
          "dataType": "Int4",
          "valueSource": "reference",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "sourceTagPath": {
            "bindType": "parameter",
            "binding": "{LinePath}/State/Code"
          }
        },
        {
          "name": "MachineStateText",
          "tagType": "AtomicTag",
          "dataType": "String",
          "valueSource": "expr",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "expression": "lookup({[.]../Lookup/MachineStates}, \"code\", {[.]../MachineStateCode}, \"text\", \"Unknown\")"
        },
        {
          "name": "GoodCount",
          "tagType": "AtomicTag",
          "dataType": "Int8",
          "valueSource": "reference",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "sourceTagPath": {
            "bindType": "parameter",
            "binding": "{LinePath}/Counters/Good"
          }
        },
        {
          "name": "BadCount",
          "tagType": "AtomicTag",
          "dataType": "Int8",
          "valueSource": "reference",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "sourceTagPath": {
            "bindType": "parameter",
            "binding": "{LinePath}/Counters/Bad"
          }
        },
        {
          "name": "TotalCount",
          "tagType": "AtomicTag",
          "dataType": "Int8",
          "valueSource": "expr",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "expression": "{[.]GoodCount} + {[.]BadCount}"
        },
        {
          "name": "RunOEE_A",
          "tagType": "AtomicTag",
          "dataType": "Float8",
          "valueSource": "reference",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "sourceTagPath": {
            "bindType": "parameter",
            "binding": "{LinePath}/KPIs/OEE_A"
          }
        },
        {
          "name": "RunOEE_P",
          "tagType": "AtomicTag",
          "dataType": "Float8",
          "valueSource": "reference",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "sourceTagPath": {
            "bindType": "parameter",
            "binding": "{LinePath}/KPIs/OEE_P"
          }
        },
        {
          "name": "RunOEE_Q",
          "tagType": "AtomicTag",
          "dataType": "Float8",
          "valueSource": "reference",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "sourceTagPath": {
            "bindType": "parameter",
            "binding": "{LinePath}/KPIs/OEE_Q"
          }
        },
        {
          "name": "RunOEE",
          "tagType": "AtomicTag",
          "dataType": "Float8",
          "valueSource": "expr",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupFast}"
          },
          "expression": "{[.]RunOEE_A} * {[.]RunOEE_P} * {[.]RunOEE_Q}"
        }
      ]
    },

    {
      "name": "Datasets",
      "tagType": "Folder",
      "tags": [
        {
          "name": "RunHeader",
          "tagType": "AtomicTag",
          "dataType": "Dataset",
          "valueSource": "db",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupSlow}"
          },
          "datasource": {
            "bindType": "parameter",
            "binding": "{DbConn}"
          },
          "queryType": "Select",
          "query": "SELECT pr.id AS run_id, pr.scheduled_work_order_id, swo.work_order_id, wo.work_order_no, pl.name AS line_name, pr.status, pr.start_time, pr.end_time, pr.target_qty, pr.produced_qty, (pr.target_qty - pr.produced_qty) AS remaining_qty FROM production_run pr JOIN scheduled_work_order swo ON pr.scheduled_work_order_id = swo.id JOIN work_order wo ON swo.work_order_id = wo.id JOIN product_line pl ON swo.product_line_id = pl.id WHERE pr.id = {[.]../..:RunId}"
        },
        {
          "name": "RunDowntimeSummary",
          "tagType": "AtomicTag",
          "dataType": "Dataset",
          "valueSource": "db",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupSlow}"
          },
          "datasource": {
            "bindType": "parameter",
            "binding": "{DbConn}"
          },
          "queryType": "Select",
          "query": "SELECT dr.name AS reason_name, SUM(d.duration_sec) AS duration_sec FROM production_run_downtime d JOIN downtime_reason dr ON d.downtime_reason_id = dr.id WHERE d.production_run_id = {[.]../..:RunId} GROUP BY dr.name ORDER BY duration_sec DESC"
        },
        {
          "name": "RunWasteSummary",
          "tagType": "AtomicTag",
          "dataType": "Dataset",
          "valueSource": "db",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupSlow}"
          },
          "datasource": {
            "bindType": "parameter",
            "binding": "{DbConn}"
          },
          "queryType": "Select",
          "query": "SELECT wr.name AS reason_name, SUM(w.qty) AS waste_qty FROM production_run_waste w JOIN waste_reason wr ON w.waste_reason_id = wr.id WHERE w.production_run_id = {[.]../..:RunId} GROUP BY wr.name ORDER BY waste_qty DESC"
        }
      ]
    },

    {
      "name": "Lookup",
      "tagType": "Folder",
      "tags": [
        {
          "name": "MachineStates",
          "tagType": "AtomicTag",
          "dataType": "Dataset",
          "valueSource": "db",
          "tagGroup": {
            "bindType": "parameter",
            "binding": "{TagGroupSlow}"
          },
          "datasource": {
            "bindType": "parameter",
            "binding": "{DbConn}"
          },
          "queryType": "Select",
          "query": "SELECT code, name AS text FROM machine_state ORDER BY code"
        }
      ]
    }
  ]
}

Notes / assumptions

  • LinePath is a parameter that points at your existing line UDT instance root.

    • You’ll need to adjust the inner reference paths like State/IsRunning, Counters/Good, KPIs/OEE_A to match your real tag model.

  • RunId / DbConn are used by the Query Tags to hit the MES DB every 60s (via TagGroupSlow).

  • Refresh times are controlled by Tag Groups, not per-tag milliseconds.

    • Create tag groups in the Tag Group editor:

      • UI_5s → 5000 ms

      • UI_1min → 60000 ms

  • The SQL is written for a typical schema based on your Vertabelo export (work_order, scheduled_work_order, production_run, production_run_downtime, production_run_waste, downtime_reason, waste_reason, product_line). You can tweak column or table names to match your final DB.

2. About XML

Ignition 8 internally converts XML/CSV to JSON when importing tags, and the public docs only show JSON shape (not the full XML schema). (docs.inductiveautomation.com)

Because of that, if I fabricate XML directly, there’s a real risk it won’t match your gateway version’s expectations (especially around Query Tag properties, data type codes, and UDT parameter representation), and you’d spend more time debugging than just pasting JSON.

If you absolutely must have XML, the safest workflow is:

  1. In your Designer, create a tiny dummy UDT with:

    • 1 UdtType

    • 1 Query Tag (Dataset)

    • 1 Reference Tag

  2. Export that UDT to XML.

  3. Use that export as a template and clone/edit it in a text editor.

I can then mirror that exact XML pattern for UI_RunMonitor once you have it.

If you want, next step I can also give you the system.tag.configure call plus a small helper script that you can paste into Script Console to auto-create this UDT in [default]_types_.