Simulators — /simulators

Configuring a shop floor integration usually hits a scheduling problem: the PLC is on the production line, the PI System belongs to another team, and nobody clears testing on equipment during production hours. The CMS solves this by bringing the servers inside itself.
It moved in the menu. Since September 2026 the Simulators live under Integration Tests, no longer under Integration (the group formerly called Integration Config, and before that Shop Floor). That is where an integration gets exercised, next to the Test Bench and the Test Plans — the simulator fakes the source, the Test Bench fires the stimulus, and testing a field Collection means using both together.
There are four, in separate tabs:
| Simulator | Imitates | Runs on |
|---|---|---|
| OPC UA Simulator | An OPC UA server (PLC, gateway) | Its own TCP port, 4841 by default |
| Modbus Simulator | A Modbus TCP slave | Its own TCP port, 5020 by default |
| PI Simulator | AVEVA PI System’s PI Web API | Inside the API itself, no new port |
| LoRaWAN Simulator | The LoRaWAN Network Server (ChirpStack v4, The Things Stack v3) | Its own MQTT broker, 1885 by default |
They are used to:
- validate a Collection or Delivery configuration before having access to the equipment;
- reproduce an error scenario in a test environment, as many times as needed;
- demonstrate the full flow without depending on the plant;
- train operators without the risk of writing to real equipment.
No simulator is enabled by default. All of them are QA and demonstration features — turn one on when you need it and off afterwards. A simulator left running in a production environment is one more open door.
What they all share
The External Connection appears on its own
Enabling a simulator makes the CMS create and maintain the matching External Connection — “OPC Simulator (internal)”, “Modbus Simulator (internal)”, “PI Simulator (internal)”. It shows up normally in External Connections and can be picked in an Application, a Collection or a Delivery like any other. There is no address to type, and no risk of typing it wrong.
Disabling the simulator does not delete the connection: it simply stops responding.
Profiles: saving whole scenarios
The simulators work with profiles — named snapshots of the tag set (of devices, in LoRaWAN). Instead of re-entering tags one by one for each test, you save “Press 3”, “North Plant”, “Failure scenario” and switch between them.
| Action | What it does |
|---|---|
| Save current configuration | Creates a profile with the tags currently in the simulator |
| Apply | Replaces all current tags with the profile’s |
| Overwrite | Updates the profile with the current tags |
| Delete | Removes the profile; the simulator’s active tags are untouched |
Apply and overwrite ask for confirmation, because both swap an entire tag set at once.
Profiles are part of the configuration import/export in the Danger Zone — each simulator with its own domain. That is how a scenario built on the implementer’s machine ends up in the demo environment.
Any change restarts the server
Saving a tag, applying a profile or changing the port rebuilds the server from scratch. That is deliberate: touching the address space “live” would be more complex and more prone to inconsistent state — and this is not a production path. Changes are grouped in a short window, so saving five tags in a row causes one restart, not five.
OPC UA Simulator

A full OPC UA server, served by cms-api itself. It exposes one variable per registered tag.
Configuration
| Field | Role |
|---|---|
| Enable | Starts/stops the server |
| Port | 4841 by default — the endpoint is opc.tcp://localhost:4841/opc-simulator |
| Namespace (ns) | Namespace index of the created tags. It goes into the NodeId |
The footer shows the real state: Running on port N or Stopped, and the error when the port is already taken.
The server listens on 127.0.0.1 only, inside cms-api: CMS’s own Collections and Deliveries reach
it, an outside client (UaExpert, another server on the network) does not. That is on purpose — the
simulator is anonymous and its tags are writable.
Test tags
Each tag has a name, a NodeId, a data type and a current value:
- Types —
BOOLEAN,INT16,INT32,FLOAT,DOUBLE,STRING. - NodeId — follows the
ns={ns};s=TagNameformat, suggested automatically from the name. - Current value — editable in the list itself, with a button that writes it immediately. On a
BOOLEANtag that button is called Trigger; on other types, Save.
That button is what makes the simulator genuinely useful: an OPC_UA_TRIGGER Collection subscribes
to the tag, and you fire it whenever you want, without waiting for a machine cycle.
The simulator also accepts writes. An OPC_UA_WRITE Delivery pointed at it writes to the tags, and
the list shows the new value — the most direct way to check whether the Write Tags mapping is
correct. See OPC UA.
Modbus Simulator

An embedded Modbus TCP slave. Unlike OPC UA, Modbus has no object model: the protocol operates over four raw register arrays, addressed by number.
| Field | Role |
|---|---|
| Enable | Starts/stops the server |
| Port | 5020 by default (avoids the privileged port 502) |
| Unit ID | Slave identifier, as on real equipment |
The four tables
| Table | Nature | Writable by the master |
|---|---|---|
| Coil | Bit | Yes |
| Discrete Input | Bit | No (read only) |
| Holding Register | 16 bits | Yes |
| Input Register | 16 bits | No (read only) |
A tag’s address is written as Table:Address — for example HOLDING_REGISTER:40.
Data types and word order
Since a Modbus register holds 16 bits, larger values take two consecutive registers. Tags declare:
- Type —
BOOLEAN,INT16,UINT16,INT32,UINT32,FLOAT32. - Word order —
BIG_ENDIANorLITTLE_ENDIAN, for the 32-bit types.
Wrong word order is the classic Modbus mistake: the value arrives, no error is raised, and it is
nonsense (a FLOAT32 of 25.3 showing up as 4.6e-41). The simulator is the cheap place to find out
which of the two your equipment uses.
The simulator’s tag layer is a convenience of the screen — name and type on top of the raw registers. What the master sees are the registers.
PI Simulator

An imitation of AVEVA PI System’s (formerly OSIsoft) PI Web API. It is the only one of the four
that does not open a new port: the PI Web API is REST, so the simulator is an endpoint inside the
CMS API itself, at /api/pi-sim/piwebapi. Only CMS itself reaches it: at the edge (nginx) the route
answers 404, because the simulator accepts reads and writes without authentication.
| Field | Role |
|---|---|
| Enable | Starts accepting requests on the simulated endpoint |
| Data Server | Name of the simulated PI server (PISIM01 by default) |
| Seed | Number that feeds WebId generation — see below |
Tags that vary on their own
This is the central difference from the other simulators. A PI System stores time series: asking “what is the value now” is less interesting than asking “how did it behave in the last hour”. So each tag has a behaviour, and the value is computed as a function of time:
| Behaviour | What it does |
|---|---|
| Sine | Oscillates smoothly between base ± amplitude, one cycle per period |
| Ramp | Rises linearly from (base − amplitude) to (base + amplitude) and restarts |
| Square wave | Alternates between the two extremes every half period |
| Noise | Smooth pseudo-random variation within the range — looks like a real process signal |
| Fixed | Keeps the last written value |
The parameters are base value, amplitude and period (s). Each tag also has a name,
description, unit and point type (Float32, Float64, Int32, Digital, String).
Fixed is the behaviour for testing Delivery. In the other options the value is a function of
time, so whatever a Delivery writes would immediately be overwritten by the generator. With
FIXED, what the Delivery writes is what the read returns.
Because the value is computed rather than stored, history queries work for any interval — including before the simulator existed. There is no series to populate.
Regenerate WebIds
In PI, every object is addressed by an opaque WebId, which the CMS resolves from the tag path and caches. When tags are recreated in PI, or the server is migrated, those WebIds stop being valid and the client has to re-resolve the paths on its own.
The Regenerate WebIds button causes exactly that: it invalidates every WebId already handed out. It proves the CMS recovers without anyone editing a single Collection — a scenario that on a real PI would be expensive and risky to reproduce.
Fidelity to the real product
The simulator reproduces the PI Web API REST contract, including details that usually catch integrators out:
- it requires the
X-Requested-Withheader, like the real PI, which returns 401 without it; - a query by
pathreturns the object directly, not a collection; - a stale WebId answers 404, not a generic error;
- history responses are capped at 5,000 samples.
What it does not reproduce is authentication: it accepts any credential, or none — like an open lab PI. See PI Web API.
LoRaWAN Simulator

Imitates the part of a LoRaWAN network the CMS actually sees: the Network Server. A LoRaWAN sensor does not speak IP — it transmits over radio to a gateway, the gateway forwards to the Network Server (ChirpStack, The Things Stack), and it is the Network Server that publishes the decrypted data to an MQTT broker. The simulator starts that broker inside the CMS and publishes to it, per registered device, exactly the JSON ChirpStack v4 or TTS v3 would publish. There is no radio or gateway to simulate, because the CMS never talks to them.
| Field | Role |
|---|---|
| Enable | Starts/stops the broker |
| Port | 1885 by default (not 1883, so it does not collide with a Mosquitto on the same machine) |
The broker listens only on 127.0.0.1, inside the engine, and requires a username and password:
cms-lorawan-sim and a password drawn the first time and stored, encrypted, in the “LoRaWAN
Simulator (interno)” External Connection. Use that Connection in the test Application’s MQTT Keep
Alive; its MQTT Collections and Deliveries inherit the broker.
Simulated devices
Each device has a name, a DevEUI (16 hexadecimal digits; empty generates one), the Network Server it imitates, a sensor, the Network Server application (the id that goes into the topic — not the CMS Application) and a send interval. The sensors cover the cases that usually cost time in the Transformer:
| Sensor | fPort | Bytes | Decoded |
|---|---|---|---|
| Temperature and humidity | 2 | int16 temp×10, uint8 humidity×2, uint16 battery | temperatura, umidade, bateria_mv |
| Pulse counter | 3 | uint32 counter, uint16 battery | contador, bateria_mv |
| GPS tracker | 4 | int32 lat×10⁶, int32 lon×10⁶, uint16 battery | latitude, longitude, bateria_mv |
| Door sensor | 5 | uint8 open, uint16 openings, uint16 battery | aberta, aberturas, bateria_mv |
Values change on their own on each uplink (drifting temperature, a counter that only grows, a
wandering position), and fCnt is persisted — restarting the CMS does not make the device look like
it rejoined. The Send uplink now button does not wait for the interval.
Network Server codec turns the decoded payload in the JSON on or off (object in ChirpStack,
decoded_payload in TTS). Off, only the base64 bytes come — which is how it arrives from a Network
Server without a codec, and the case for testing the Transformer decoding.
The topics
| ChirpStack v4 | The Things Stack v3 | |
|---|---|---|
| Uplink (the Collection subscribes) | application/{app}/device/{devEui}/event/up | v3/{app}@ttn/devices/eui-{devEui}/up |
| Downlink (the Delivery publishes) | application/{app}/device/{devEui}/command/down | v3/{app}@ttn/devices/eui-{devEui}/down/push |
| Downlink delivered | …/event/txack, and …/event/ack if confirmed | …/down/sent, and …/down/ack if confirmed |
Editing a device shows both of its topics, with a copy button. To subscribe to all at once, the
Collection uses a wildcard: application/+/device/+/event/up or v3/+/devices/+/up.
The two Network Servers write the same data under different names — fCnt/f_cnt,
data/frm_payload, object/decoded_payload — and TTS writes the DevEUI in upper case in
the JSON. A Transformer comparing DevEUIs from both needs to normalize the case.
Downlink: class A
The simulator listens on the downlink topics and rejects what a real Network Server would reject: a
body that is not JSON, without fPort, without data, or a topic that does not match the device — in
which case the event log says what the expected topic was.
Devices are class A: the downlink waits in the queue and only goes out on the next uplink,
which is when a real sensor opens its receive window. That is why the event log shows Downlink
queued and then Downlink sent — or Downlink acknowledged, when the downlink asked for
confirmation (confirmed: true). This is the difference that matters in a real integration: the
Delivery succeeds when the Network Server accepts the command, not when it reaches the sensor.
The simulated firmware understands one command: fPort 10, bytes 01 + interval in seconds
(uint16) changes the send interval. The object { "intervaloSegundos": 30 } in place of the bytes
does the same. Body examples, with a 30 s interval:
{ "fPort": 10, "confirmed": true, "data": "AQAe" }{ "downlinks": [{ "f_port": 10, "frm_payload": "AQAe", "confirmed": true }] }Differences from the other simulators
- The profile keeps the configuration, not the state. When a profile is applied, a device that
stays (same DevEUI) keeps its
fCnt— resetting it would make the simulated Network Server look like it saw a rejoin. A profile imported from a file has its items checked: invalid or repeated DevEUIs and unknown sensors are left out. - Editing a device does not restart the broker. A restart would drop the connected MQTT Collections; only enabling/disabling and changing the port restart it. Editing a device only rebuilds the send timers.
The repository ships a ready scenario for this simulator in scripts/seed-cenario-lorawan.mjs: four
devices (two per Network Server, half without a codec), the LORAWANSIM Application, Collections for
both formats with a Transformer that normalizes everything into a single contract, and downlink
Deliveries triggered through HTTP Inbound. See LoRaWAN.
Writing to equipment: the permission gate
Writing to an OPC UA tag or a Modbus register changes the state of real equipment. That is why
OPC_UA_WRITE and MODBUS_WRITE Deliveries accept a write permission tag on the equipment
itself: the CMS subscribes to that tag and only writes while it holds the expected value.
It is the PLC, not the CMS, that decides when to accept a write — the only correct order for that decision. Without the tag configured, the Delivery writes whenever it receives a message.
Configure the gate in production environments. Without it, a malformed payload coming from a corporate system reaches the equipment.
Failing without being able to ask
A Delivery with a gate configured whose tag subscription is not up answers no — never “there is no restriction”. The difference looks subtle and is not: until August 2026 the OPC UA gate answered by reading whether the session existed, and “gate configured, but I could not connect” arrived there looking exactly like “this Delivery has no gate”. The outcome was the worst possible one — failing to check whether the PLC could accept a write released the write to the PLC. Today both gates, OPC UA and Modbus, fail closed.
The gate connection also retries on its own, with a growing wait from 2s to 20s, and a drop fires
CONEXAO_OPCUA_PERDIDA or CONEXAO_MODBUS_PERDIDA. Before, a failure on the first attempt left the
Delivery without a gate until someone restarted the API.
A drop only becomes a log line and an alert after 10 seconds down, and it is one line per drop, not one per attempt. The built-in simulators open their port a few seconds after the gates try their first connection, in the same process: one ERROR per startup, over an outage that resolves itself, is precisely how an operator is taught to ignore gate errors.