AutoB2G: A Large Language Model-Driven Agentic Framework For Automated Building-Grid Co-Simulation¶
🕒 Published (v1): 2026-03-27 01:44 UTC · Source: Arxiv · link
Ask a follow-up
Open an assistant pre-loaded with this paper's context.
💬 Ask ChatGPT✦ Ask Claude
TL;DR¶
AutoB2G is an LLM-driven agentic framework that translates natural-language task descriptions into fully executable building–grid co-simulation programs, requiring zero manual coding. It extends CityLearn V2 with Pandapower grid models and orchestrates code generation, execution, and iterative repair through a multi-agent harness (SOCIA) guided by a DAG-structured codebase.
Problem¶
Existing RL-based building simulation environments (CityLearn, Sinergym, GridLearn) focus only on building-side metrics and require heavy manual configuration and programming expertise. GridLearn, the closest predecessor, is incompatible with CityLearn V2, blocking access to EV integration, custom datasets, and LSTM-based thermal dynamics. There is no automated path from a natural-language experiment specification to a running, grid-aware co-simulation.
Method¶
AutoB2G composes two mechanisms around CityLearn V2 + Pandapower:
DAG-Based Agentic Retrieval. The simulation codebase \(\mathcal{F} = \{f_1, \ldots, f_n\}\) is organized as a DAG \(G = (V, E)\) where edges encode input–output dependencies between functional modules. An LLM agent maps a user task \(U\) to a candidate function set \(S = \Phi_\text{LLM}(U)\), then a DAG validator returns structured feedback \(\Delta_t\) on missing dependencies, driving iterative repair: $\(S_{t+1} = \Phi_\text{LLM}(U, S_t, \Delta_t)\)$ until no structural violations remain. Retrieved function source code becomes a template \(\Theta(S^*)\) for downstream code generation.
SOCIA Multi-Agent Framework with Textual Gradient Descent (TGD). Five role-specialized agents (Workflow Manager, Code Generator, Simulation Executor, Result Evaluator, Feedback Generator) implement a closed repair loop. The generated simulator \(x \in \mathcal{X}\) is treated as an optimization variable with a hinge-loss over constraint violations: $\(L(x) = \sum_i \max(0, c_i(x))\)$ The Feedback Generator computes a "textual gradient" \(g_t = \nabla_\text{LLM}(x_t, \{c_i(x_t)\})\)—structured natural-language repair directives—which the Code Generator applies as a patch \(\tilde{x}_{t+1} = \Psi_\text{TGD}(x_t, g_t)\), followed by a projection step \(x_{t+1} = \Pi_C(\tilde{x}_{t+1})\) (syntax check, recompile, interface correction) to restore feasibility.
Grid integration: at each simulation step, aggregated CityLearn building loads are mapped to Pandapower load buses; power-flow results (bus voltages, line flows) feed back into the agent observation space. Grid-side evaluation covers voltage admissibility (\(V_\min \le V_i \le V_\max\)), thermal loading (\(S_{\text{line},k} \le S_k^{\max}\)), N−1 resilience (contingency power-flow sweeps), and short-circuit current via Thévenin equivalent.
Key Contributions¶
- Extended CityLearn V2 with Pandapower to enable B2G co-simulation including EV, custom datasets, and LSTM thermal dynamics — fixing the GridLearn compatibility gap.
- DAG-structured codebase with iterative agentic retrieval that enforces topological correctness of module selection before code generation.
- Integration of SOCIA + TGD as the meta-harness layer: fully automated simulator construction, execution monitoring, violation detection, and targeted repair from a single natural-language input.
- Multi-metric grid evaluation system: voltage admissibility, thermal limits, N−1 resilience, and short-circuit current — none previously available in CityLearn.
Results¶
The paper describes evaluation on natural-language-driven simulation tasks at three complexity levels (simple, moderate, complex) but the text provided is truncated before the numerical results table. No specific pass-rate percentages, success counts, or comparative baseline numbers appear in the supplied text.
Limitations¶
- Evaluation is restricted to the IEEE 33-bus distribution network; generalizability to larger or meshed transmission networks is untested.
- The DAG codebase must be manually constructed and maintained; it does not self-update as CityLearn evolves.
- TGD convergence is not guaranteed; maximum repair rounds (\(T_\text{DAG}\), \(T_\text{SOCIA}\)) are fixed hyperparameters with no adaptive stopping criterion discussed.
- LLM-generated code may introduce subtle semantic errors that pass syntactic and interface checks but produce physically incorrect simulation behavior.
- Paper text is truncated before quantitative results, preventing assessment of success rates or comparison to manual baselines.
Relevance to Harnesses / Meta-Harnesses¶
AutoB2G is a domain-specific meta-harness: it wraps an existing simulation platform (CityLearn + Pandapower) with an LLM-driven orchestration layer that handles the full lifecycle—retrieval, code generation, execution, evaluation, and iterative repair—from a declarative natural-language spec. The SOCIA + TGD loop is a concrete instance of a self-repairing code-generation harness, analogous to meta-harnesses that treat generated artifacts as optimization variables and use structured feedback as the update signal. The DAG-structured codebase retrieval is a domain-constrained RAG mechanism that enforces pipeline correctness, a pattern transferable to any harness that must compose heterogeneous modules reliably. This work demonstrates how a meta-harness can specialize a general multi-agent framework (SOCIA) to a new vertical by encoding domain constraints in the retrieval layer rather than in the agent prompts.