Bridging Natural Language and Microgrid Dynamics: A Context-Aware Simulator and Dataset
Authors: Tinko Sebastian Bartels, Ruixiang Wu, Xinyu Lu, Yikai Lu, Fanzeng Xia, Haoxiang Yang, Yue Chen, Tongxin Li
Organizations: School of Data Science, The Chinese University of Hong Kong-Shenzhen, Shenzhen, China. · Department of Mechanical and Automation Engineering, The Chinese University of Hong Kong, Hong Kong, China.
Addressing the critical need for intelligent, context-aware energy management in renewable systems, we introduce the OpenCEM Simulator and Dataset: the first open-source digital twin explicitly designed to integrate rich, unstructured contextual information with quantitative renewable energy dynamics. Traditional energy management relies heavily on numerical time series, thereby neglecting the significant predictive power embedded in human-generated context (e.g., event schedules, system logs, user intentions). OpenCEM bridges this gap by offering a unique platform comprising both a meticulously aligned, language-rich dataset from a real-world PV-and-battery microgrid installation and a modular simulator capable of natively processing this multi-modal context. The OpenCEM Simulator provides a high-fidelity environment for developing and validating novel control algorithms and prediction models, particularly those leveraging Large Language Models. We detail its component-based architecture, hybrid data-driven and physics-based modelling capabilities, and demonstrate its utility through practical examples, including context-aware load forecasting and the implementation of online optimal battery charging control strategies. By making this platform publicly available, OpenCEM aims to accelerate research into the next generation of intelligent, sustainable, and truly context-aware energy systems.
Figures & tables
Fig. 1: High-level Architecture of the OpenCEM Platform. The framework is divided into two domains: (Top) The Physical System Layer comprises two independent microgrid subsystems, where PV arrays and hybrid inverters with battery storage power distinct loads—a research workstation (GPU/CPU) and an HVAC unit. (Bottom) The Cyber Layer interfaces with the hardware via Modbus to log electrical measurements ( V : Voltage, I : Current, P : Power) and integrates this quantitative data with unstructured Natural Language Contexts in a central database to drive the Controller Simulator Engine.
Simulator
PV
Batt.
Inv.
Grid
Load
Ctx.
MATPOWER [ 10 ]
✗
✗
✗
✓
✓
✗
ANDES [ 11 ]
✗
✗
✗
✓
✓
✗
PS.Dynamics [ 12 ]
✗
✗
✓
✓
✓
✗
pvlib [ 13 ]
✓
✗
✓
✗
✗
✗
ACN-Sim [ 14 ]
✗
✗
✗
✓
✓
✗
EV2Gym [ 15 ]
✗
✗
✗
✓
✓
✗
TABLE I: Feature Comparison of Open Source Microgrid Simulators.
Fig. 2: Implementation of the OpenCEM Physical Layer. The system consists of (a) two distinct PV arrays on the facility roof and (b) the corresponding hybrid inverter control units.
Fig. 3: Power Load and Battery SOC over time with context annotations. Example Time Series with Electrical Measurements. Power drawn by load, and battery SOC for inverter 1, which powers two servers, and inverter 2, which powers an air conditioner.
Fig. 4: Representative Power Flows and Battery SOC over one day. Example Time Series with Electrical Measurements. Representative series (sampled on 2025.12.26) of power drawn from grid, power generation, battery SOC, and power demand of the load over five hours of usage for inverter 2, which powers an air conditioner.
Fig. 5: Examples of Events and Contexts. The dataset captures both high-level user intents (Source: Team) and low-level system events (Source: Log). (Note: Context text is reproduced verbatim from dataset records).
Fig. 6: System Component Topology. The architecture segregates the DC Domain (PV, Battery) from the AC Domain (Grid, Load). The central Hybrid Inverter manages bi-directional power conversion, guided by data streams from the Context and Clock modules.
Fig. 7: Load Time Series from dataset models with selection of applicable context (2025-07-28). The example highlights a scenario in which the load estimate changes as new context becomes available, e.g. the unexpected reboot event falls into the time frame of the planned numerical stress test and becomes only available later.
Fig. 8: Hierarchical Control Logic. The controller operates as a priority stack: (1) PV Generation is allocated first. (2) Battery Storage buffers any surplus or deficit. (3) Grid Import is used only as a last resort.
Fig. 9: Distribution of RMSE in Watts for various context-aware power demand prediction models trained on the dataset from 2025-10 to 2025-12.
Fig. 10: Joint Distribution of power demand and LLM-predicted effort for CPU task based on the dataset filtered for records in which a CPU-intensive task was run only on one of the machines and no concurrent GPU jobs where running.
Fig. 11: Validation Use Case : Context-Aware Control Loop. The figure illustrates the interaction between the OpenCEM Simulator and an example LLM-based Control Agent . Arrows represent data flow, with labels positioned alongside to ensure visibility.
Fig. 12: Running cost in control experiment for the day 2025-12-25 of the dataset, using the inverter default strategy (green), predictions based on prior consumption (orange), predictions based on LLM-processed context (blue) and perfect predictions as a benchmark (red). We find that using context-based yields near-optimal results. The default policy has lower initial cost but higher final cost because it fails to buy power during cheap hours to meet later demand.
Fig. 13: Running cost savings in the control experiment for the days 2025-11-25 to 2025-12-30 of the dataset, using the proposed strategy with predictions based on natural language context over the inverter default strategy. The color indicates the cumulative cost savings by hour of day. We find that using context-based yields near-optimal results. We find that the savings shown in Figure 12 are consistent across multiple days.