DOI: 10.5281/zenodo.13843934
title: [Supplementary Data] PowerModel-AI: A First On-the-fly Machine-Learning Predictor for AC Power Flow Solutions.

description: Abstract

The real-time creation of machine-learning models via active or on-the-fly learning has attracted considerable interest across various scientific and engineering disciplines.  These algorithms enable machines to autonomously build models while remaining operational. Through a series of query strategies, the machine can evaluate whether newly encountered data fall outside the scope of the existing training set. In this study, we introduce PowerModel-AI, an end-to-end machine learning software designed to accurately predict AC power flow solutions. We present detailed justifications for our model design choices and demonstrate that selecting the right input features effectively captures the load flow decoupling inherent in power flow equations. Our approach incorporates on-the-fly learning, where power flow calculations are initiated only when the machine detects a need to improve the dataset in regions where the model's performance is sub-optimal, based on specific criteria. Otherwise, the existing model is used for power flow predictions. This study includes analyses of five Texas A&M synthetic power grid cases, encompassing the 14-, 30-, 37-, 200-, and 500-bus systems.  The training and test datasets were generated using PowerModel.jl, an open-source power flow solver/optimizer developed at Los Alamos National Laboratory, NM, USA.



Overview

This dataset, provided as supplementary material for the above-referenced study, includes a comprehensive collection of images (plots) from the study’s analyses, along with Jupyter notebooks containing Python scripts used for the training, validation, and testing phases of PowerModel-AI. Additionally, it includes all training and external test data used in this work, generated via LANL-based open-source power flow solver, PowerModels.jl.

The primary objective of this dataset is to ensure full reproducibility of the study’s analyses and facilitate critical examination by the scientific community, thereby maximizing the overall impact of the work.

Directory Structure

The hierarchy of folders and file organization of the dataset is illustrated in the chart below. The directory contains a README.md file which contains the information provided here and a requirements.txt that contains all libraries necessary to run the python scripts or Jupyter notebooks in this directory.  A brief description of the folders and what they contain are provided below:    


 .

├── Models/

│   ├── _PM_AI_Models/

│   │    ├── Type1/

│   │    ├── Type2/

│   │    └── Type3/

│   │

│   ├── _PM_AI_Module/

│   │    ├── __init__.py

│   │    └── PM_Methods.py

│   │

│   ├── _PM_JL_Data/

│   ├── C1_Model/

│   ├── C2_Model/

│   ├── C3_Model/

│   ├── M1_Model/

│   ├── M2_Model/  

│   └── M3_Model/

│

├── NodeSensitivityAnalysis/

│   ├── Sensitivity_Plots/

│   ├── Sensitivity_PM_JL_Data/

│   ├── get_sensitivity_PMJL_data.py

│   └── NodeSensitivityAnalysis.ipynb

│

├── PlotsForOnTheFlyAnalysis/

│   ├── BaseModel_A/

│   ├── BaseModel_B/  

│   └── BaseModel_C/

│  

├── README.md

└── requirements.txt

 

Files Description 

1.      Models/

_PM_AI_Models/ contains the ML models discussed in the manuscript. Type1, Type2, and Type3 refers to the C and M models with numbers "1", "2," and "3". Each Type folder contains individual subfolders for the synthetic grids discussed.

 _PM_AI_Module/ contains a python script that has all the functions used in model training and analysis. It is imported in the Jupyter notebooks in the C and M subfolders in this directory.

_PM_JL_Data/ contains the following subfolders:

a)   _GeneratePowerModelData/ has a python script (get_PowerModelJLData.py) that is used to parse PowerModels.jl to compute AC power flow solutions for different power demand configurations. It also contains a subfolder, BusData_MATLAB/, that has all the synthetic grids used in the study and in MATLAB format.

b)   It also contains other subfolders (not shown in the chart above) that contains AC power flow solutions generated using LANL’s PowerModels.jl, for each synthetic grids and other grid-related data.

The folders starting with C and M are the control and candidate models (more details in manuscript). Each folder contains Jupyter notebooks (for each power grid) that has python algorithms used in model training and testing, as well as functions to analyze and plot the prediction performance of the models. It accesses (if already trained) or stores (if newly trained) the models in the _PM_AI_Models/ directory. Additionally, they contain 2 subfolders (not shown in the chart above): AbsoluteErrorPlots/ and PredictionPlots/ were the results (plots) from the analyses are stored. Some of these results are shown in the manuscript (Figures 4, 5, 6, and 7).

2.      NodeSensitivityAnalysis/

This folder contains the tools used for the node dependency analysis in Section 3.1.1 of the manuscript.

It contains a python script called get_sensitivity_PMJL_data.py, which has similar operation like the get_PowerModelJLData.py script but only compute changes for one bus at a time (see details in manuscript). There is also a Jupyter notebook called NodeSensitivityAnalysis.ipynb that analyzes the bus node dependencies and produces the plots that are shown in Figure 3 in the manuscript. It contains 2 additional sub-folders:

a)       Sensitivity_PM_JL_Data/ where PowerModels.jl generated AC power flow solution data are stored, and

b)       Sensitivity_Plots/ where the results from NodeSensitivityAnalysis.ipynb are stored.

3.      PlotsForOnTheFlyAnalysis/

This directory contains only the results for the discussion in Section 3.2 in the manuscript, which is the on-the-fly implementation of PowerModel-AI. The on-the-fly algorithm will be provided and distributed separately in the PowerModel-AI package, which will be publicly available through LANL’s The Advanced Network Science Initiative (Github). It contains 3 subfolders with similar names but ends with "A", "B," and "C" which correspond to the designations shown and discussed in Figure 8 of the manuscript.

Summary

 Models/

1. _PM_AI_Models/:  

Contains the machine learning models discussed in the manuscript. The Type1, Type2, and Type3 folders refer to C and M models labeled "1", "2," and "3". Each type folder includes subfolders for the corresponding synthetic grids analyzed.

2. _PM_AI_Module/:  

Contains Python scripts for model training and analysis.  PM_Methods.py is the script that defines functions for model training and analysis, which are imported in the Jupyter notebooks in the C and M subfolders.  

   

3. _PM_JL_Data/:  

-_GeneratePowerModelData/: Contains a Python script (get_PowerModelJLData.py) used to parse PowerModels.jl and compute AC power flow solutions for various power demand configurations. This folder also includes BusData_MATLAB/, which holds the synthetic grid data in MATLAB format.  

- Other Subfolders: Contain PowerModels.jl AC power flow solutions for each synthetic grid, as well as related data.

   

4. C1_Model/, C2_Model/, C3_Model/, M1_Model/, M2_Model/, M3_Model/:  

These folders contain the control and candidate models (refer to manuscript details). Each folder includes pre-run Jupyter notebooks for model training and analysis, as well as two subfolders:  

   - AbsoluteErrorPlots/: Contains saved analysis results for each grid.

   - PredictionPlots/: Stores model prediction results.  

Some results are shown in Figures 4, 5, 6, and 7 of the manuscript and can be reproduced using the notebooks.

NodeSensitivityAnalysis/

1. Node Dependency Analysis Tools:  

   This folder contains scripts and data used for the node dependency analysis in Section 3.1.1 of the manuscript.

   

2. Scripts:  

   - get_sensitivity_PMJL_data.py: Computes power flow changes for individual buses (refer to the manuscript for details).  

   - NodeSensitivityAnalysis.ipynb: Analyzes dependencies and generates plots for Figure 3 in the manuscript.  

   

3. Subfolders:  

   - Sensitivity_PM_JL_Data/: Stores PowerModels.jl data for sensitivity analysis.  

   - Sensitivity_Plots/: Contains the generated results from the Jupyter notebook.

PlotsForOnTheFlyAnalysis/

On-the-Fly Learning Results:  Contains the results for the on-the-fly learning analysis discussed in Section 3.2 of the manuscript.  The subfolders BaseModel_A/, BaseModel_B/, and BaseModel_C/ correspond to the designations in Figure 8 of the manuscript. These subfolders contain plots generated during analysis.

Additional Files

- README.md: This file.

- requirements.txt: Contains a list of necessary Python libraries required to run the scripts and Jupyter notebooks.

Notes:

- The PowerModel-AI code is publicly available on GitHub.

- The supplementary materials include additional Jupyter notebooks and results for each power grid analysis.  

- The generated results and predictions in this repository are consistent with those discussed in the manuscript.