A Digital Twin (DT) is a dynamic virtual representation of a physical asset, process, or system. From smart factories and robotic assembly cells to intelligent buildings, Digital Twins promise to optimize operations, predict equipment failures, and simulate future scenarios.
However, building a functional Digital Twin for complex Internet of Things (IoT) ecosystems exposes a fundamental architectural dilemma: how do you combine rich structural knowledge with high-frequency streaming telemetry?
This thesis research was conducted at Ericsson Research (Department of IoT and Cyber-Physical Systems, Kista) as part of my double-degree Master's program: MSc in Systems, Control and Robotics at KTH Royal Institute of Technology and MSc in Telecommunication Engineering at Universidad Politécnica de Madrid (UPM). Supervised by Dr. Bin Xiao (Ericsson), Prof. Bo Wahlberg (KTH), and Prof. Pedro J. Zufiria (UPM), the thesis is titled: "Digital Twin Knowledge Graphs for IoT Platforms: Towards a Virtual Model for Real-Time Knowledge Representation in IoT Platforms".
The Semantic-Telemetry Divide
Modern IoT platforms deal with two very different kinds of data:
- Static / Contextual Semantics: What physical devices exist? How are they connected? What are their operational thresholds, spatial locations, dependencies, and maintenance rules? (e.g. "Temperature Sensor 4 is mounted on Robot Arm 2 in Zone B, which must not exceed 65°C").
- Dynamic Telemetry: High-throughput, streaming time-series metrics (temperatures, motor currents, vibrations, coordinate positions) sampled multiple times per second.
Relational and NoSQL time-series databases easily handle high ingestion rates, but they lack semantic reasoning capabilities — answering queries like "find all actuators downstream of overheating motors" requires complex, brittle application code. Conversely, Semantic Web Knowledge Graphs (RDF / OWL / SPARQL) and graph databases (such as GraphDB) provide expressive relationship modeling and reasoning, but historically choke when flooded with continuous high-frequency time-series writes.
An Event-Driven Knowledge Graph Digital Twin Architecture
To bridge this gap, we designed a decoupled, event-driven architecture that allows Knowledge Graphs to maintain an up-to-date semantic representation of the physical world without suffering from time-series ingestion bottlenecks (Figure 1).
The architecture centers around three cooperating layers:
- Semantic Ontology Model: Uses established standards (W3C SSN/SOSA, SAREF, Brick, and custom industrial extensions) to model the physical topology, device types, observation properties, and rules (Figure 2).
- Event-Driven Constraint Handler: A lightweight validation layer that listens to incoming telemetry events, queries the graph to resolve contextual relationships, and validates physical constraints in real time.
- Graph Synchronization Engine: Batches state updates and updates semantic graph triples only when meaningful state transitions or threshold violations occur, shielding the graph engine from raw high-frequency noise.
Real-Time Constraint Validation & Automated Interventions
A key contribution of the platform is the Constraint Handler pipeline (Figure 3). When incoming telemetry violates predefined safety rules or operational boundaries, the system executes targeted SPARQL queries to understand the broader context (e.g., finding the emergency shutdown switch for that specific machine cell) and automatically issues corrective actuation commands.
Industrial Testbeds & Empirical Benchmarks
We evaluated the platform across two realistic simulated deployment environments:
- Industrial Robot Pickup Workstation: An automated manufacturing cell with a 6-DoF robotic arm, proximity sensors, and conveyor belts, testing real-time spatial constraint checking and safety interlocks during rapid cycle times.
- Smart Building Air Quality & Safety Monitoring: A multi-room facility tracking CO₂, particulate matter (PM2.5), temperature, and humidity (Figure 4), triggering dynamic ventilation adjustments and evacuation protocols based on semantic room occupancy models.
Our benchmark experiments quantified the exact performance boundaries of the system:
- SPARQL Query Latency: Complex multi-hop semantic queries executed within sub-50ms thresholds for graphs containing up to tens of thousands of triples.
- Ingestion Throughput: The event-driven buffering and selective triple update strategy reduced GraphDB write load by over 85% compared to naive triplestore streaming, enabling real-time IoT responsiveness.
The project repository includes an interactive visualization suite so you can explore the system end to end. Figure 5 shows the Factory Floor Digital Twin viewer — the 3D representation of the robotic cell where every virtual element is linked to its semantic graph node.
Under the hood, Figure 6 shows the TypeDB Knowledge Graph concept map — the semantic backbone that lets the platform answer contextual queries like "which sensors feed this actuator?" in milliseconds.
The full thesis document is available via the KTH DiVA Portal, and the complete source code, ontology definitions, and simulation benchmarks are hosted on GitHub.
🧠 Dynamic Discovery & Local Semantic Embedding Matcher
A major real-world limitation of industrial digital twins is handling unanticipated devices: what happens when a sensor is swapped on the factory floor, or a new robotic arm is added to a workstation without updating the static schema beforehand?
To solve this, our integration pipeline implements a Dual-Metric Semantic Integration Hub (Figure 7). It combines Semantic Definition Format (SDF) text similarity with time-series pattern matching (the STUMPY / Matrix Profile algorithm) to automatically classify incoming MQTT streams into the TypeDB ontology:
- Device Replacement: Detects when a new sensor (e.g.
AirQualitySimplified) replaces an inactive one (AirQuality) with a 94.2% match. - Complementary Addition: Dynamically integrates secondary robots (e.g.
PickUpRobot-2) joining active assembly stations with a 98.8% match.
Future Work: Dense Embeddings via Local LLMs (Qwen3-Embedding-4B)
In our latest open-source extension, we pushed semantic discovery further by replacing string-level distance metrics with dense semantic vector embeddings computed entirely locally (Figure 8). Using Qwen3-Embedding-4B (2,560-dimensional vectors, 32k-token context) running locally on an RTX 4090 GPU via Ollama, the digital twin evaluates semantic proximity across device classes and manages autonomous failover:
Verified benchmark results from live inference demonstrate high-confidence semantic resolution:
| Scenario | New / Missing Device | Top Ontology Match | Similarity Score |
|---|---|---|---|
| Replacement | indoors_airqualitysimp |
AirQualitySimplified / AirQuality | 86.9% / 86.4% |
| Complementary | bodyconfig_pickuprob2 |
PickUpRobot | 84.0% |
| Disappearance | windowmilling_pickuprob |
→ windowmilling_pickuprob2 |
92.0% |
| Disappearance | indoors_airquality |
→ indoors_airqualitysimp |
97.0% |
| Disappearance | outdoors_windsensor |
→ outdoors_windsensor2 |
100.0% |
📊 Head-to-Head Empirical Benchmark: Thesis Baseline vs. Qwen3-Embedding-4B
To rigorously evaluate whether dense neural embeddings outperform the thesis’s string-level Levenshtein distance baseline (thefuzz),
we ran an empirical benchmark across 16 realistic industrial IoT integration scenarios covering manufacturer vocabulary mismatch,
industry synonyms (e.g., Anemometer → WindSensor, Articulated Handler → PickUpRobot), minimalist schemas, and multi-modal edge devices:
| Evaluation Metric | Thesis Baseline (thefuzz / Levenshtein) |
Neural Embeddings (Qwen3-Embedding-4B) | Relative Gain |
|---|---|---|---|
| Top-1 Accuracy | 25.0% | 75.0% | +300% (3× Precision) |
| Top-3 Accuracy | 50.0% | 93.8% | +87.6% |
| Mean Reciprocal Rank (MRR) | 0.374 | 0.849 | +127% |
| Avg Discriminative Margin | 2.5% | 6.2% | +148% (Wider Separation) |
Key Empirical Findings:
-
Vocabulary Invariance: String-distance token matching fails whenever third-party vendors use industry synonyms. For instance, an
UltrasonicAnemometerscored only 36% (ranked #14) with Levenshtein string distance, but achieved 89.6% (Rank #1) with Qwen3 semantic embeddings. - Wider Decision Margin: Dense neural embeddings generate an average 6.2% separation between the top candidate and the runner-up (vs. only 2.5% for string distance), creating a clear statistical decision boundary for automated schema insertion without false positives.
- Dual-Modality Synergy: Coupling dense semantic vector similarity with STUMPY time-series matrix profile matching provides both conceptual schema correctness and runtime behavioural verification.
October 2022 · MSc Thesis (KTH & UPM)GitHubKTH DiVA PDFEricsson ResearchKTH EECS
Alejandro Jarabo-Peñas · Supervised by Bin Xiao (Ericsson Research), Bo Wahlberg (KTH), Pedro J. Zufiria (UPM)