Skip to main content
QUICK REVIEW

[Paper Review] pymgrid: An Open-Source Python Microgrid Simulator for Applied Artificial Intelligence Research

Gonzague Henri, Tanguy Levent|arXiv (Cornell University)|Nov 11, 2020
Microgrid Control and OptimizationEngineering10 references15 citations
TL;DR

pymgrid is an open-source Python simulator for generating and testing microgrids, designed specifically for reinforcement learning (RL) research. It enables scalable, reproducible benchmarking through two standardized microgrid lists (pymgrid10 and pymgrid25), offering diverse architectures and baseline algorithms, with results showing DT-augmented Q-learning outperforming rule-based control by ~44% in mean cost, though still falling short of model predictive control.

ABSTRACT

Microgrids, self contained electrical grids that are capable of disconnecting from the main grid, hold potential in both tackling climate change mitigation via reducing CO2 emissions and adaptation by increasing infrastructure resiliency. Due to their distributed nature, microgrids are often idiosyncratic; as a result, control of these systems is nontrivial. While microgrid simulators exist, many are limited in scope and in the variety of microgrids they can simulate. We propose pymgrid, an open-source Python package to generate and simulate a large number of microgrids, and the first open-source tool that can generate more than 600 different microgrids. pymgrid abstracts most of the domain expertise, allowing users to focus on control algorithms. In particular, pymgrid is built to be a reinforcement learning (RL) platform, and includes the ability to model microgrids as Markov decision processes. pymgrid also introduces two pre-computed list of microgrids, intended to allow for research reproducibility in the microgrid setting.

Motivation & Objective

  • To address the lack of open-source, scalable microgrid simulators for tertiary control in reinforcement learning research.
  • To establish standardized, pre-computed microgrid datasets (pymgrid10 and pymgrid25) to improve research reproducibility and algorithm benchmarking.
  • To provide a flexible, extensible simulation environment that abstracts domain complexity, allowing researchers to focus on control algorithm development.
  • To offer baseline control algorithms (rule-based, MPC, Q-learning, DT-augmented Q-learning) for fair comparison across studies.
  • To support future integration of real-time data, carbon accounting, and advanced RL algorithms for low-carbon grid operations.

Proposed method

  • pymgrid is built as a Python package with a MicrogridGenerator class to create diverse microgrids and a Microgrid simulator class to run time-series simulations.
  • It uses real-world load and PV production data from DOE OpenEI to seed microgrid configurations, ensuring realistic operational conditions.
  • Microgrids are modeled as Markov decision processes (MDPs), enabling direct integration with reinforcement learning frameworks.
  • The simulator supports multiple microgrid architectures, including grid-connected, off-grid, and weak grid configurations with gensets, batteries, and PV.
  • Two standardized benchmark sets—pymgrid10 (10 simple microgrids) and pymgrid25 (25 diverse microgrids)—are pre-computed for reproducible evaluation.
  • Baseline control algorithms (RBC, MPC, Q-learning, DT-augmented Q-learning) are implemented and evaluated on the pymgrid25 dataset to establish performance benchmarks.

Experimental results

Research questions

  • RQ1Can a standardized, open-source microgrid simulator improve reproducibility in applied reinforcement learning research for microgrid control?
  • RQ2How do different control algorithms—rule-based, model predictive control, and Q-learning variants—perform across diverse microgrid architectures?
  • RQ3To what extent can data-driven RL methods like DT-augmented Q-learning outperform traditional rule-based controllers in microgrid operation?
  • RQ4What is the performance gap between near-optimal MPC with perfect forecasts and practical RL-based controllers in real-world microgrid scenarios?
  • RQ5How can a unified simulation platform support the development and benchmarking of next-generation, scalable microgrid control algorithms?

Key findings

  • Model predictive control (MPC) with perfect forecasts achieves near-optimal performance, serving as a strong upper bound for controller performance.
  • Rule-based control (RBC) performs as a lower bound, with a mean cost 44% higher than DT-augmented Q-learning across the pymgrid25 dataset.
  • DT-augmented Q-learning outperforms RBC in most cases, particularly in handling complex edge cases, though it still underperforms compared to MPC.
  • In six microgrids—especially those with only a grid or a grid and genset—RBC outperforms the DT-augmented Q-learning, indicating limitations in discrete action space learning.
  • The performance gap between MPC and the best RL method (DT-augmented Q-learning) is substantial: a 13% difference in mean cost translates to $40 million in additional annual operating costs for megawatt-scale systems.
  • The results underscore the critical importance of improving RL-based controllers, as even small percentage gains in efficiency can yield massive cost and emissions reductions at scale.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.