uns-sim — Machine Simulator

A configurable CNC machine simulator that publishes realistic data to MQTT.

LanguageNode.js
TypeMQTT publisher
Scaffolded withfnkit node-mqtt
Depends onMQTT broker

What It Does

Simulates 4 CNC machines across 2 production areas, each publishing status, program, and tool data every 3 seconds.

Topics Published

v1.0/enterprise/site1/area1/cnc-01/status  ...program  ...tool
v1.0/enterprise/site1/area1/cnc-02/status  ...program  ...tool
v1.0/enterprise/site1/area2/cnc-03/status  ...program  ...tool
v1.0/enterprise/site1/area2/cnc-04/status  ...program  ...tool

12 topics total — 4 machines x 3 data tags.

Machine States

StateDescription
ACTIVERunning a program, spindle on
IDLEPowered on, no program
WAITINGWaiting for operator/material
ALARMFault condition
SETUPTool change / program loading
OFFLINEMachine powered down

Simulated Machines

MachineNameArea
cnc-01Haas VF-2 Millarea1
cnc-02DMG Mori NLX 2500area1
cnc-03Mazak Integrex i-200area2
cnc-04Okuma LB3000 EX IIarea2

Quick Start

cd uns-sim && cp .env.example .env
docker compose up -d && docker logs -f uns-sim

Replacing with Real Machines

In production, replace with OPC UA gateway, Sparkplug B, or a custom edge agent. The rest of the pipeline works identically.