The digital twin vs simulation question comes up early in almost every industrial project, because both start from a model of a physical thing and both often look alike on screen. This article explains the differences that actually matter: where the data comes from, how long the model lives, and whether results flow back to the real asset. By the end you will know which one your use case needs and how to connect live data with MQTT so a model becomes a twin.
For the full background on twins, start with the digital twin technology guide.
The Short Answer
A simulation is a model you run to answer a question about what could happen. You feed it assumptions, scenarios or historical inputs, run it, read the results, and usually close it.
A digital twin is a model bound to one specific physical asset that tracks what is happening, continuously, using live data from that asset. It lives as long as the asset does and is updated every time the asset changes.
Put simply, a simulation is an activity, while a digital twin is a persistent, connected representation. Many twins contain simulation models, which is where the confusion starts.
Digital Twin vs Simulation: Side-by-Side Comparison
| Dimension | Simulation | Digital twin |
|---|---|---|
| Data source | Assumptions, scenarios, historical data sets | Live telemetry from a specific asset, plus history |
| Subject | A design or a class of systems | One identifiable instance, such as pump P-104 |
| Lifespan | Runs for the duration of a study | Persists for the asset's lifetime |
| Time | Can run faster or slower than real time | Tracks real time, can branch into what-if runs |
| Feedback to the asset | None | Optional: insights or commands flow back |
| Typical owner | Engineering, R&D | Operations, maintenance, engineering together |
| Key infrastructure | Solver, compute | Connectivity, messaging, storage, visualization |
| Main question | "What happens if...?" | "What is happening now, and what should we do?" |
The rows on data source and subject do most of the work. If your model is not tied to a particular serial number and does not receive data from it, it is a simulation, however realistic it looks.
What Live Data Changes
Connecting a model to live data has consequences that go beyond a moving chart.
The model has to be identifiable. A twin needs an address: which line, which machine, which sensor. That is why industrial teams adopt hierarchical topic structures such as ISA-95 levels (enterprise, site, area, line, cell). A topic like acme/izmir/packaging/line2/filler/telemetry names exactly which filler the data belongs to.
The model must handle imperfect data. Simulations get clean inputs. Twins get late messages, sensor dropouts, reconnecting gateways and clock drift. Good twins track data quality and last-seen timestamps, and show "stale" rather than pretending a value is current.
The model drifts and must be recalibrated. Because real measurements keep arriving, you can compare predictions with reality. When the gap grows, either the asset has changed (wear, fouling, a new tool) or the model needs tuning. That comparison is one of the most valuable things a twin does, and a standalone simulation cannot do it.
State must be available instantly. When a dashboard opens, it needs the current state, not the next update in five minutes. MQTT retained messages handle this neatly: the broker stores the last message on a topic and delivers it to every new subscriber immediately.
How MQTT Keeps a Twin Synchronized
MQTT is the common choice for feeding twins because it is publish/subscribe, lightweight and event-driven. The asset or its gateway publishes once, and every consumer, from the 3D view to the historian to the simulation engine, subscribes to what it needs. If you are new to the pattern, read what an MQTT broker does.
You can see the mechanics in a minute with the free public MQTT broker at broker.connectmq.com. Use your own random prefix in place of dts-91x.
# Publish the current state of a pump as a retained message
mosquitto_pub -h broker.connectmq.com -p 1883 -i dts-91x-pump -r -q 1 \
-t "connectmq/demo/dts-91x/site1/utilities/pump104/state" \
-m '{"rpm":1480,"flow_m3h":42.1,"outlet_bar":3.2,"ts":"2026-10-16T09:00:00Z"}'
# Any twin component that subscribes later receives the current state at once
mosquitto_sub -h broker.connectmq.com -p 1883 -i dts-91x-twin \
-t "connectmq/demo/dts-91x/site1/#" -v
Using a Simulation Inside a Twin
The most effective setups combine both. The twin keeps a live picture of the asset; a simulation model embedded in it uses that live state as its starting point to answer forward-looking questions. The Python example below subscribes to the pump's state, runs a very simple what-if model (how outlet pressure would change if speed were reduced), and publishes the prediction alongside the measurement so a dashboard can plot both.
import json
import paho.mqtt.client as mqtt
BASE = "connectmq/demo/dts-91x/site1/utilities/pump104"
def predict_outlet_pressure(state, new_rpm):
# Affinity law: pressure scales with the square of speed
ratio = new_rpm / state["rpm"]
return round(state["outlet_bar"] * ratio ** 2, 2)
def on_connect(client, userdata, flags, reason_code, properties):
client.subscribe(f"{BASE}/state", qos=1)
def on_message(client, userdata, msg):
state = json.loads(msg.payload)
scenario = {
"scenario": "rpm_minus_10pct",
"rpm": round(state["rpm"] * 0.9),
"predicted_outlet_bar": predict_outlet_pressure(state, state["rpm"] * 0.9),
"based_on_ts": state["ts"],
}
client.publish(f"{BASE}/sim/what-if", json.dumps(scenario), qos=1)
print("Published", scenario)
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="dts-91x-sim")
client.on_connect = on_connect
client.on_message = on_message
client.connect("broker.connectmq.com", 1883)
client.loop_forever()
The physics here is deliberately simple, but the pattern scales: replace predict_outlet_pressure with a call to a proper solver or a trained model, and the twin now offers both "what is" and "what if" from the same data stream. Keep simulated outputs on their own subtopic (sim/...) so nobody confuses predictions with measurements.
When to Use a Simulation, a Twin, or Both
Choose a simulation when:
- The asset does not exist yet and you are evaluating designs or layouts.
- You need to test rare or dangerous scenarios that you would never induce on real equipment.
- The question is one-off, such as sizing a buffer or validating a control strategy before commissioning.
Choose a digital twin when:
- The asset is in operation and decisions depend on its current condition.
- You need remote visibility for people who cannot stand next to the machine.
- You want to detect drift, wear or anomalies by comparing expected and actual behavior.
Choose both when you want operational decisions backed by forward-looking analysis, for example deciding whether to slow a line to stretch the life of a worn component until the next planned stop.
A related distinction, between a model, a shadow and a full twin, depends on which direction data flows. The article on digital twin vs digital shadow covers it in detail, and types of digital twins explains how scope changes from a single component to a whole process.
Common Mistakes
- Calling a 3D animation a twin. If the model plays a scripted animation, it is a visualization. It becomes a twin when its state comes from the asset.
- Mixing predicted and measured data on one topic. Downstream tools cannot tell them apart. Separate them by topic and label units and sources.
- Ignoring staleness. A twin that shows a two-hour-old value as current is worse than no twin. Track timestamps and connection state.
- Starting with the solver. The hard part of most twin projects is reliable data plumbing, not the math. Get telemetry flowing first.
Infrastructure for the Live Side
Simulations need compute. Twins need reliable connectivity, and that means an MQTT broker that is always available, secured with TLS and authentication, and able to accept connections from gateways, viewers and analytics services at the same time. Running that yourself is possible, but a fully managed MQTT service removes patching, certificates and capacity planning from your list.
ConnectMQ supports MQTT 3.1.1 and 5.0 over TCP, TLS, WebSocket and Secure WebSocket, so the same broker serves Python simulation workers and browser-based 3D views. Its portal also detects ISA-95 style topics and shows devices by hierarchy level, which helps when you are mapping twins to real equipment.
Keep Your Twins in Sync with ConnectMQ
Whether you start with a simulation and add live data later, or build a twin from day one, the connectivity layer is the same. Create a broker on the ConnectMQ portal on the free Serverless plan, no credit card required, and point your publishers and models at it.
Frequently Asked Questions
Is a digital twin just a simulation with live data?
Partly. Live data from a specific asset is the defining feature, but a twin also persists for the asset's lifetime, tracks data quality and can feed insights or commands back. A simulation may be one component inside it.
Can a digital twin exist before the physical asset?
A model of a planned asset is often called a digital prototype or design twin. It becomes an operational twin once it is connected to the real asset's data.
Which protocol is best for feeding a digital twin?
MQTT is widely used because it is lightweight, event-driven and lets many consumers share one stream. OPC UA is common at the machine level, and gateways often bridge OPC UA data into MQTT topics.
Do I need real-time data for a twin?
You need data that is fresh enough for the decisions the twin supports. For monitoring that may be seconds; for maintenance planning, minutes can be fine.



