IoT Monitoring Framework with Physics-Based Energy Loss Modeling for Smart Microgrids: Architecture and Benchmarks
Abstract
1. Introduction
- An end-to-end digital twin architecture comprising ten Docker services: simulator, MQTT broker, data-ingestion subscriber, API gateway, time-series database, in-memory cache, frontend dashboard, reverse proxy, and two supporting services deployable via a single ‘docker compose up -d’ command [21].
- A physics-based microgrid simulator implementing nine distinct energy loss mechanisms applied sequentially at 5 s resolution: PV soiling (Kimber linear model [22]), module mismatch, DC cable I2R losses, CEC inverter efficiency curves [15], AC distribution cable losses, transformer iron-copper losses, battery self-discharge, BMS parasitic draw, and wind mechanical losses, each published as itemized MQTT telemetry per simulation step.
- A hierarchical MQTT topic architecture with QoS 1 at-least-once delivery, six topic patterns carrying per-asset measurements including full loss breakdowns, and a dual-write ingestion pipeline that routes messages simultaneously to TimescaleDB hypertables for historical storage and to Valkey pub/sub channels for sub-second WebSocket delivery to the dashboard.
- Reproducible performance benchmarks from a one-hour automated test demonstrating a P50 publisher-to-subscriber latency of 27.2 ms, P99 of 48.3 ms, 100% message delivery reliability across 5840 messages, and a per-topic latency analysis revealing the serialization-order effect inherent in sequential MQTT publishing, the first such benchmark for a microgrid digital twin framework since Kondoro et al. [19] in 2021.
2. Materials and Methods
2.1. System Architecture Overview
2.2. Physics-Based Microgrid Simulator
2.2.1. Simulation Pipeline Overview
2.2.2. Photovoltaic Model with Energy Loss Chain
2.2.3. Battery Energy Storage Model
2.2.4. Grid Power Balance
2.3. MQTT Communication Architecture
2.4. Data Ingestion and Storage Pipeline
2.5. Real-Time Visualization Dashboard
2.6. Containerized Deployment
3. Results
3.1. Experimental Setup
3.2. Publisher-to-Subscriber MQTT Latency Analysis
3.3. Throughput Analysis
3.4. Reliability Analysis
3.5. Energy Loss Model Verification
3.6. Platform Comparison
4. Discussion
4.1. Key Findings and Implications
4.2. Industry 5.0 Alignment
4.3. Limitations and Threats to Validity
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
| Abbreviation | Full Form |
| AC | Alternating Current |
| API | Application Programming Interface |
| BESS | Battery Energy Storage System |
| BMS | Battery Management System |
| CDF | Cumulative Distribution Function |
| CEC | California Energy Commission |
| DC | Direct Current |
| DER | Distributed Energy Resource |
| DT | Digital Twin |
| IoT | Internet of Things |
| MQTT | Message Queuing Telemetry Transport |
| NOCT | Nominal Operating Cell Temperature |
| PCC | Point of Common Coupling |
| PF | Power Factor |
| PV | Photovoltaic |
| QoS | Quality of Service |
| REST | Representational State Transfer |
| SOC | State of Charge |
| SOH | State of Health |
| STC | Standard Test Conditions |
| TLS | Transport Layer Security |
| WS | WebSocket |
References
- Bonavolontà, F.; Liccardo, A.; Mottola, F.; Proto, D. Real-Time Monitoring of Energy Contributions in Renewable Energy Communities Through an IoT Measurement System. Sensors 2025, 25, 1402. [Google Scholar] [CrossRef] [PubMed]
- Al-Shetwi, A.Q.; Atawi, I.E.; El-Hameed, M.A.; Abuelrub, A. Digital Twin Technology for Renewable Energy, Smart Grids, Energy Storage and Vehicle-to-Grid Integration: Advancements, Applications, Key Players, Challenges and Future Perspectives in Modernising Sustainable Grids. IET Smart Grid 2025, 8, e70026. [Google Scholar] [CrossRef]
- Sahoo, B.; Panda, S.; Rout, P.K.; Bajaj, M.; Blazek, V. Digital Twin Enabled Smart Microgrid System for Complete Automation: An Overview. Results Eng. 2025, 25, 104010. [Google Scholar] [CrossRef]
- Mchirgui, N.; Quadar, N.; Kraiem, H.; Lakhssassi, A. The Applications and Challenges of Digital Twin Technology in Smart Grids: A Comprehensive Review. Appl. Sci. 2024, 14, 10933. [Google Scholar] [CrossRef]
- Aghazadeh Ardebili, A.; Zappatore, M.; Ramadan, A.I.H.A.; Longo, A.; Ficarella, A. Digital Twins of Smart Energy Systems: A Systematic Literature Review on Enablers, Design, Management and Computational Challenges. Energy Inform. 2024, 7, 94. [Google Scholar] [CrossRef]
- Alharbey, R.; Shafiq, A.; Daud, A.; Dawood, H.; Bukhari, A.; Alshemaimri, B. Digital Twin Technology for Enhanced Smart Grid Performance: Integrating Sustainability, Security, and Efficiency. Front. Energy Res. 2024, 12, 1397748. [Google Scholar] [CrossRef]
- Sivaneasan, B.; Tan, K.T.; Zhang, W. Cognitive Digital Twins for the Microgrid: A Real-World Study for Intelligent Energy Management and Optimization. IEEE Internet Comput. 2025, 29, 39–47. [Google Scholar] [CrossRef]
- Sado, K.; Peskar, J.; Downey, A.; Khan, J.; Booth, K. A Digital Twin Based Forecasting Framework for Power Flow Management in DC Microgrids. Sci. Rep. 2025, 15, 6430. [Google Scholar] [CrossRef] [PubMed]
- OpenEMS Association. OpenEMS: Open Energy Management System. Available online: https://openems.github.io/ (accessed on 25 March 2026).
- VOLTTRON-Pacific Northwest National Laboratory. Available online: https://volttron.readthedocs.io/ (accessed on 25 March 2026).
- Eclipse Foundation. Eclipse Ditto: Digital Twin Framework. Available online: https://eclipse.dev/ditto/ (accessed on 25 March 2026).
- ThingsBoard Authors. ThingsBoard: Open-Source IoT Platform. Available online: https://thingsboard.io/ (accessed on 25 March 2026).
- Henri, G.; Levent, T.; Halev, A.; Alami, R.; Cordier, P. pymgrid: An Open-Source Python Microgrid Simulator for Applied Artificial Intelligence Research. In Proceedings of the NeurIPS 2020 Workshop on Tackling Climate Change with Machine Learning, Virtual, 11 December 2020. [Google Scholar] [CrossRef]
- Holmgren, W.F.; Hansen, C.W.; Mikofski, M.A. pvlib python: A Python Package for Modeling Solar Energy Systems. J. Open Source Softw. 2018, 3, 884. [Google Scholar] [CrossRef]
- King, D.L.; Gonzalez, S.; Galbraith, G.M.; Boyson, W.E. Performance Model for Grid-Connected Photovoltaic Inverters; SAND2007-5036; Sandia National Laboratories: Albuquerque, NM, USA, 2007. [CrossRef] [PubMed]
- Hamid, A.K.; Farag, M.M.; Hussein, M. Enhancing Photovoltaic System Efficiency Through a Digital Twin Framework: A Comprehensive Modeling Approach. Int. J. Thermofluids 2025, 26, 101078. [Google Scholar] [CrossRef]
- Izquierdo Monge, O.; Redondo Plaza, A.; Peña Carro, P.; Zorita Lamadrid, Á.; Alonso Gómez, V.; Hernández Callejo, L. Open Source Monitoring and Alarm System for Smart Microgrids Operation and Maintenance Management. Electronics 2023, 12, 2471. [Google Scholar] [CrossRef]
- Arbab Zavar, B.; Palacios Garcia, E.J.; Vasquez, J.C.; Guerrero, J.M. Message Queuing Telemetry Transport Communication Infrastructure for Grid-Connected AC Microgrids Management. Energies 2021, 14, 5610. [Google Scholar] [CrossRef]
- Kondoro, A.; Ben Dhaou, I.; Tenhunen, H.; Mvungi, N.H. Real Time Performance Analysis of Secure IoT Protocols for Microgrid Communication. Future Gener. Comput. Syst. 2021, 116, 1–12. [Google Scholar] [CrossRef]
- Boshnjaku, E.; Qehaja, B.; Hajrizi, E.; Guliashki, V.; Marinova, G. A Web-Based Hybrid Optimization Platform for Real-Time Microgrid Energy Management. In Proceedings of the 2025 International Conference on Software, Telecommunications and Computer Networks (SoftCOM), Split, Croatia, 18–20 September 2025; pp. 1–6. [Google Scholar] [CrossRef]
- Merkel, D. Docker: Lightweight Linux Containers for Consistent Development and Deployment. Linux J. 2014, 2014, 2. [Google Scholar]
- Kimber, A.; Mitchell, L.; Nogradi, S.; Wenger, H. The Effect of Soiling on Large Grid-Connected Photovoltaic Systems in California and the Southwest Region of the United States. In Proceedings of the 2006 IEEE 4th World Conference on Photovoltaic Energy Conversion, Waikoloa, HI, USA, 7–12 May 2006; pp. 2391–2395. [Google Scholar] [CrossRef]
- Light, R.A. Mosquitto: Server and Client Implementation of the MQTT Protocol. J. Open Source Softw. 2017, 2, 265. [Google Scholar] [CrossRef]
- Freedman, M.J.; Kulkarni, A. TimescaleDB: SQL Made Scalable for Time-Series Data; Technical White Paper; Timescale Inc.: New York, NY, USA, 2018; Available online: https://www.timescale.com/ (accessed on 25 March 2026).
- Ramírez, S. FastAPI. 2018. Available online: https://fastapi.tiangolo.com/ (accessed on 25 March 2026).
- Poimandres. Zustand: Bear Necessities for State Management in React. Available online: https://github.com/pmndrs/zustand (accessed on 25 March 2026).
- Zippenfenig, P. Open-Meteo.com Weather API, Version 1.4.0; Zenodo: Geneva, Switzerland, 2024. [CrossRef]
- IEEE Std 1547-2018; IEEE Standard for Interconnection and Interoperability of Distributed Energy Resources with Associated Electric Power Systems Interfaces. IEEE: New York, NY, USA, 2018. [CrossRef]
- Recharts Contributors. Recharts: A Composable Charting Library Built on React Components. Available online: https://github.com/recharts/recharts (accessed on 25 March 2026).
- IEC 61724-1:2021; Photovoltaic System Performance-Part 1: Monitoring, 2nd ed. International Electrotechnical Commission: Geneva, Switzerland, 2021.
- Linux Foundation. The Open Source Opportunity for Microgrids: Five Ways to Drive Innovation and Overcome Market Barriers for Energy Resilience; The Linux Foundation: San Francisco, CA, USA, 2023; Available online: https://www.linuxfoundation.org/research/open-source-opportunity-for-microgrids (accessed on 25 March 2026).
- Breque, M.; De Nul, L.; Petridis, A. Industry 5.0: Towards a Sustainable, Human-Centric and Resilient European Industry; European Commission, Directorate-General for Research and Innovation; Publications Office of the European Union: Luxembourg, 2021. [Google Scholar] [CrossRef] [PubMed]
- Khan, S.; Mazhar, T.; Shahzad, T.; Khan, M.A.; Rehman, A.U.; Hamam, H. Integration of Smart Grid with Industry 5.0: Applications, Challenges and Solutions. Meas. Energy 2024, 5, 100031. [Google Scholar] [CrossRef]
- Hu, J.-L.; Li, Y.; Chew, J.-C. Industry 5.0 and Human-Centered Energy System: A Comprehensive Review with Socio-Economic Viewpoints. Energies 2025, 18, 2345. [Google Scholar] [CrossRef]










| Layer | Technology | Version | License | Role |
|---|---|---|---|---|
| Simulator | Python 3.12 | 3.12+ | PSF | Physics engine |
| MQTT Broker | Eclipse Mosquitto | 2.0+ | EPL-2.0 | Message transport |
| Backend | FastAPI | 0.115+ | MIT | REST API + WebSocket |
| Time-Series DB | TimescaleDB (PG 16) | 2.17+ | Apache-2.0 | Measurement storage |
| Cache/Broker | Valkey | 8.0+ | BSD-3 | Pub/sub + state cache |
| Frontend | React 18 + TypeScript | 18.3+ | MIT | Dashboard UI |
| UI Components | shadcn/ui + Radix | latest | MIT | Accessible primitives |
| Charts | Recharts | 2.12+ | MIT | Data visualization |
| State Management | Zustand | 5+ | MIT | Client state |
| Containerization | Docker Compose | 27+ | Apache-2.0 | Orchestration |
| Monitoring | Prometheus + Grafana | latest | Apache/AGPL | Metrics + alerting |
| Reverse Proxy | Traefik | 3.2+ | MIT | Routing + TLS |
| # | Loss Mechanism | Model | Default Value | Configurable |
|---|---|---|---|---|
| 1 | PV Soiling | Kimber linear + rain reset [22] | 0.2%/day | Yes |
| 2 | PV Mismatch | Fixed factor | 1.5% | Yes |
| 3 | DC Cable | I2R at 600 V | R = 0.15 Ω | Yes |
| 4 | PV Inverter | CEC weighted [15] | 100 kW SMA ref. | Yes |
| 5 | AC Cable | I2R at 400 V, 3-phase | R = 0.08 Ω | Yes |
| 6 | Transformer | Iron + copper | 250 kVA, 0.75 + 3 kW | Yes |
| 7 | Battery Self-Discharge | Linear SOC drain | 2%/month | Yes |
| 8 | BMS Parasitic | Constant draw | 50 W | Yes |
| 9 | Wind Mechanical | Drivetrain + yaw | 5% + 2% | Yes |
| Topic Pattern | Key Payload Fields | QoS | Rate | Avg Size |
|---|---|---|---|---|
| ‘microgrid/{id}/energy/{type}’ | power_kw, energy_kwh, losses_kw, loss_breakdown, voltage_v, current_a, power_factor, frequency_hz, reactive_power_kvar | 1 | Per step | 374–604 B |
| ‘microgrid/{id}/battery/state’ | soc_percent, soh_percent, charging_power_kw, discharging_power_kw, inverter_loss_kw, bms_parasitic_kw, temperature_c, cycle_count | 1 | Per step | 523 B |
| ‘microgrid/{id}/losses/summary’ | total_loss_kw, total_loss_percent, generation_gross_kw, generation_net_kw, pv_losses{}, wind_losses{}, battery_losses{}, distribution_losses{} | 1 | Per step | 706 B |
| ‘microgrid/{id}/weather’ | temperature_c, humidity_percent, solar_irradiance_wm2, wind_speed_ms, cloud_cover_percent, is_raining | 1 | Per step | 397 B |
| ‘microgrid/{id}/control/command’ | command_type, parameters, target_asset_id | 1 | On demand | Variable |
| ‘microgrid/{id}/control/status’ | state, step_count, sim_time, messages_published | 0 | Every 10 steps | 247 B |
| Metric | Value |
|---|---|
| P50 (mean across polling intervals) | 27.2 ms |
| P50 (max across polling intervals) | 27.7 ms |
| P95 (mean across polling intervals) | 42.3 ms |
| P95 (max across polling intervals) | 46.4 ms |
| P99 (mean across polling intervals) | 48.3 ms |
| P99 (max across polling intervals) | 74.8 ms |
| Messages under 50 ms | 96.1% (5610/5840) |
| Messages under 100 ms | 100.0% (5840/5840) |
| Messages over 100 ms | 0 |
| Topic | Message Count | Rate (msg/min) | Avg. Latency (ms) | Avg Payload Size (B) |
|---|---|---|---|---|
| control/status | 75 | 1 | 1.01 | 247 |
| energy/solar_pv | 1474 | 24 | 15.09 | 604 |
| energy/wind_turbine | 737 | 12 | 21.65 | 485 |
| energy/critical_load | 737 | 12 | 25.83 | 374 |
| energy/grid_connection_point | 737 | 12 | 30.00 | 524 |
| battery/state | 737 | 12 | 30.73 | 523 |
| weather | 737 | 12 | 36.71 | 397 |
| losses/summary | 737 | 12 | 39.53 | 706 |
| Platform | Simulator | MQTT | Dashboard | Loss Model | Container | Benchmark |
|---|---|---|---|---|---|---|
| This Work | 12-step, 9 losses | Hierarchical | React + WS | Itemized, real-time | Docker × 10 | P50/P95/P99 |
| OpenEMS [9] | No | No | Partial | No | Partial | No |
| VOLTTRON [10] | No | No | No | No | No | No |
| Eclipse Ditto [11] | No | Generic | No | No | Yes | No |
| Cognitive DT [7] | Proprietary | Custom | Custom | Partial | Unknown | Cost only |
| pymgrid [13] | Basic | No | No | No | No | No |
| pvlib [14] | PV only | No | No | PV Only | No | No |
| ThingsBoard [12] | No | Yes | Generic | No | Yes | No |
| Hamid et al. [16] | MATLAB | No | No | PV only | No | No |
| Izquierdo et al. [17] | No | No | Partial | No | No | No |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Boshnjaku, E.; Marinova, G.; Hajrizi, E.; Qehaja, B. IoT Monitoring Framework with Physics-Based Energy Loss Modeling for Smart Microgrids: Architecture and Benchmarks. Telecom 2026, 7, 86. https://doi.org/10.3390/telecom7040086
Boshnjaku E, Marinova G, Hajrizi E, Qehaja B. IoT Monitoring Framework with Physics-Based Energy Loss Modeling for Smart Microgrids: Architecture and Benchmarks. Telecom. 2026; 7(4):86. https://doi.org/10.3390/telecom7040086
Chicago/Turabian StyleBoshnjaku, Elton, Galia Marinova, Edmond Hajrizi, and Besnik Qehaja. 2026. "IoT Monitoring Framework with Physics-Based Energy Loss Modeling for Smart Microgrids: Architecture and Benchmarks" Telecom 7, no. 4: 86. https://doi.org/10.3390/telecom7040086
APA StyleBoshnjaku, E., Marinova, G., Hajrizi, E., & Qehaja, B. (2026). IoT Monitoring Framework with Physics-Based Energy Loss Modeling for Smart Microgrids: Architecture and Benchmarks. Telecom, 7(4), 86. https://doi.org/10.3390/telecom7040086

