Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/test-and-measurement/matlab-build-industrial-hmi

matlab-build-industrial-hmi

Verified

Build industrial-grade SCADA/HMI dashboards in MATLAB following industrial-HMI conventions (ISA-101-aligned): gray-field philosophy, alarms at source, write safeguards, fixed-range trends, drill-down layout. Produces a real App Designer app (.mlapp, or plain-text .m+.xml on R2026b+) by handing serialization to the matlab-build-app skill when available, and falls back to a programmatic .m app otherwise. Use when wrapping OPC UA / Modbus / MQTT / OSI PI / PI AF monitoring scripts into a live operator app, building plant overviews, designing operator dashboards, or any time a user asks for a "SCADA dashboard", "HMI", "plant dashboard", "operator screen", or "industrial monitoring app" in MATLAB. Trigger on: SCADA, HMI, industrial dashboard, plant overview, operator screen, uigauge, uilamp, alarm banner, gray-field, ISA-101, OPC UA dashboard, setpoint, write safeguards, alarm visualization, OSIsoft PI, AVEVA PI, PI Server, PI Data Archive, PI AF, PI Asset Framework, piclient, afclient.

references/known-schema-patterns.md

View on GitHub
# Known-Schema Patterns

Use this reference when the **node set is fixed at design time** — you have a list of OPC UA nodes (names, types, ranges, units) before the dashboard ever connects. The agent isn't browsing the server; it's wiring a known process to a known UI.

If instead the user asks to *explore* a server and pick nodes interactively, switch to `references/server-agnostic-discovery.md` — the dispatch shape there infers widgets from `class(value)` at runtime and uses per-widget subscriptions.

## When to use

- Customer hands you a node list (e.g., a Yokogawa export, a Siemens DB map, a documented OPC UA address space)
- You're building a screen for one specific station whose I/O is frozen
- The dashboard ships with a fixed list of gauges/lamps/trends, no "Add Node" UI

In these cases, hard-wiring node name → widget is fine and reads more clearly than a generic dispatcher. Node count is small (typically < 30 per screen), names rarely collide, and editing the file is the right way to add a node.

## Multi-node dispatch with a `switch` on node name

```matlab
% Build node list once at startup
nodeList = [findNodeByName(uaClient.Namespace, 'WeldRobot1_Temp', '-once'), ...
            findNodeByName(uaClient.Namespace, 'OvenTemp',         '-once'), ...
            findNodeByName(uaClient.Namespace, 'PressPressure',    '-once')];

sub = subscribe(uaClient, nodeList, @(src, evt) onDataChange(app, src, evt), ...
    PublishInterval = 0.5);
```

```matlab
function onDataChange(app, ~, evt)
    % evt is opc.ua.Notification (R2026a):
    %   evt.Node.Name       - originating node's display name
    %   evt.Data.Value      - current value
    %   evt.Data.Timestamp  - server/source timestamp (see "trend X" note below)
    name    = char(evt.Node.Name);
    val     = evt.Data.Value;
    elapsed = seconds(datetime('now') - app.StartTime);   % wall-clock; see note

    switch name
        case 'WeldRobot1_Temp'
            app.WeldRobot1Gauge.Value = val;
            addpoints(app.WeldRobot1Trace, elapsed, val);
            updateAlarmState(app, 'WeldRobot1', val);
        case 'OvenTemp'
            app.OvenGauge.Value = val;
            addpoints(app.OvenTrace, elapsed, val);
            updateAlarmState(app, 'Oven', val);
        case 'PressPressure'
            app.PressGauge.Value = val;
            addpoints(app.PressTrace, elapsed, val);
            updateAlarmState(app, 'Press', val);
    end
    drawnow limitrate;
end
```

For >10 nodes, replace the `switch` with a `dictionary` keyed on node name to a function handle, so the dispatch doesn't grow into a wall of cases:

```matlab
handlers = dictionary();
handlers('WeldRobot1_Temp') = @(app, t, v) updateWeldRobot1(app, t, v);
handlers('OvenTemp')        = @(app, t, v) updateOven(app, t, v);
handlers('PressPressure')   = @(app, t, v) updatePress(app, t, v);
% in callback:
if isKey(handlers, name)
    h = handlers(name);
    h(app, elapsed, val);   % MATLAB rejects chaining a call after parens-indexed dictionary fetch
end
```

## Why wall-clock for trend X

Pattern 4 in SKILL.md plots elapsed seconds on the X axis. The intuitive source is `evt.Data.Timestamp - app.StartTime`, but some servers (notably Python `asyncua`-based ones) return the **server-side** timestamp as the 1601 epoch when the publisher hasn't supplied a source timestamp. The trend then draws at `elapsed = -large_number` and the user sees an empty axis. `datetime('now')` on the client is robust against this.

If you need true source timing for your application, validate `evt.Data.Timestamp` first:

```matlab
ts = evt.Data.Timestamp;
if year(ts) < 1990
    elapsed = seconds(datetime('now') - app.StartTime);   % fallback
else
    elapsed = seconds(ts - app.StartTime);
end
```

## Subscribe once, never rebuild

For a fixed schema, build the node list once at startup, call `subscribe()` once, and store the resulting `opc.ua.Subscription` on the app. Don't resubscribe — there is no per-subscription cleanup API in R2026a, and rebuilding leaks channel listeners. See `app-designer-gotchas.md` "Repeated `subscribe()` calls leak channel listeners".

----

Copyright 2026 The MathWorks, Inc.

----
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall