eess.SYApr 11, 2026

Agentic Application in Power Grid Static Analysis: Automatic Code Generation and Error Correction

Authors: Qinjuan Wang, Shan Yang, Yongli Zhu

Organizations: Sun Yat-sen University, Guangzhou, China

Abstract

This paper introduces an LLM agent that automates power grid static analysis by converting natural language into MATPOWER scripts. The framework utilizes DeepSeek-OCR to build an enhanced vector database from MATPOWER manuals. To ensure reliability, it devises a three-tier error-correction system: a static pre-check, a dynamic feedback loop, and a semantic validator. Operating via the Model Context Protocol, the tool enables asynchronous execution and automatically debugging in MATLAB. Experimental results demonstrate that the system achieves a 82.38% accuracy regarding the code fidelity, effectively eliminating hallucinations even in complex analysis tasks.

Figures & tables

Explore similar work

CardsList
  1. Knowledge boundary probing and demand-guided intervention for LLM-based power system code generation

    May 29, 2026Hui Wu, Xiaoyang Wang, Zhong FanAutomated Program RepairCode Generation

  2. LLMs and Agentic AI Systems for Smart Grids: A Tutorial on Architectures and Applications

    Jul 20, 2026Daniela Rojas, Abdulwahab Albassam, Aidan G. Leung +11LLM Agent OrchestrationLLM Agent Evaluation

  3. RestoreBench: Can AI Agents Restore Power Flow Convergence?

    Aug 31, 2026Riccardo Mansutti, Andrea Pomarico, Robert Jakob +3Multi-Agent LLM SystemsLLM Agent Evaluation