PGM DS Logo


Introduction

A potential client pointed me to Empowering the Energy Transition Through Fast and Flexible Network Simulation. The article describes an Open Source project, Power Grid Model DS (pgm-ds), where the DS is Data Science.

The pgm-ds project extends the Power Grid Model. From their docs, “power-grid-model is a library for steady-state distribution power system analysis.” Its model includes components for:

  • Node
  • Branch
  • Appliance
  • Sensor
  • Fault
  • Regulator

-and more. It’s used to model power flow, state estimation, and short circuits.

The Power Grid Model DS builds on top of this to provide a clean and easy-to-use API to model and simulate the behaviour of the grid. “This is aimed at building data science software applications related to or using the power-grid-model project, such as network analyses and simulations. It defines a Grid dataclass which manages the consistency of the complete network and allows for extensions of the Power Grid Model datastructure.”


Running the Demo

The mechanics were straightforward; the meaning took effort.

The pgm-ds is easy to use. It was relatively trivial to take their Jupyter notebook-style docs and create a script to run the demo. Understanding what I was looking at took more work.

The package includes a visualization of the grid using a Flask WSGI frontend that you can easily view with your web browser. The graphics use Dash Cytoscape, a slick and powerful graph visualization engine that’s perfect for this sort of visualization.

While the picture was pretty, the informative data was presented on the console in the form of tables. Here are some examples:

Nodes

id u_rated node_type feeder_branch_id feeder_node_id u x_coor y_coor
1 10500.0 0 64 61 0.0 125.848.. 245.522..
2 10500.0 0 65 61 0.0 385.322.. 175.70..
61 10500.0 1 -2147483648 -2147483648 0.0 134.732.. 145.515..

Lines

id from_node to_node from_status to_status feeder_branch_id feeder_node_id is_feeder r1 x1 c1 tan1 i_n i_from
63 61 12 1 1 63 61 True 0.411.. 0.023.. 0.0 0.0 110.013.. 0.0
74 20 8 1 1 63 61 False 0.585.. 0.000.. 0.0 0.0 227.694.. 0.0
125 96 94 1 1 63 61 False 0.036.. 0.04.. 0.0 0.0 362.904.. 0.0

## Transformers

id from_node to_node from_status to_status feeder_branch_id feeder_node_id is_feeder u1 u2 sn tap_size uk pk i0 p0 winding_from winding_to clock tap_side tap_pos tap_min tap_max tap_nom
123 5 95 1 1 64 61 False 10500.0 3000.0 30000000.0 0.0 0.203 100000.0 0.0 0.0 0 0 12 0 0 0 0 0
124 12 96 1 1 63 61 False 10500.0 3000.0 30000000.0 0.0 0.203 100000.0 0.0 0.0 0 0 12 0 0 0 0 0

Understanding the Data

Setting up and running the code was trivial. Understanding the output and the implications of what the software does was not. My background is as a Linux Systems Admin and Python Programmer; I don’t have a background in electrical engineering.

I started by drilling into the data structures, functions, looking at the clear and concise API, and doing research.

I had always pictured the grid as a complicated but largely static circuit. What became clear is that it’s better understood as a dynamic physical system, where electrical properties like reactance and reactive power materially influence behavior in ways that aren’t immediately intuitive. The grid is similar to a living, breathing entity.

Right away, there was a value in the demo, reactance per kilometer, which also shows up as an attribute of the lines, x1. Reactance was probably the hardest part to wrap my mind around. I did end up watching some YouTube videos and talking it through with ChatGPT. Reactive power is central to understanding why the grid is so difficult to manage. A full explanation is beyond the scope of this post, but it’s an essential concept for appreciating the system’s behavior.

I didn’t drill into every attribute of the system; I was just trying to get a sense of what this package did and achieve an overview of how it mapped into the real world.


Modeling the Grid

When I realized how complicated and intricate the grid actually was, the scale of it jumped a couple of orders of magnitude in my mind. As I mentioned earlier, my background includes Linux, and I’ve worked in Ops teams at places like CIBC, Merrill Lynch, Moneris Solutions, and SiGe Semiconductor. I’ve seen those big dashboards full of technical detail that provide the Ops Teams with a dashboard. Then I googled for a Hydro One (Ontario’s power producer) ops dashboard.

Hydro One Ops

While this is only a slice of the system, it illustrates the density and complexity operators deal with in practice.

The pgm-ds software allows you to dynamically modify the grid, add and remove components and then it reports on faults and failures. It allows you to re-route power through redundant links and more. You can model changes and then try to forecast future demand and the effects of change.

With a system this complex, simulation becomes a natural foundation for machine learning. Tools like pgm-ds make it possible to generate structured scenarios for forecasting, anomaly detection, and decision support.

Extending and managing the grid is not only non-trivial, it’s also a slow moving project. Building a power plant, a dam, a data center, a factory, or a neighborhood all take time.


Conclusion

This field is both technically fascinating and materially important. Tools like this don’t just model infrastructure—they help shape how it evolves. That makes the work both intellectually engaging and meaningful.


Links

Companies and Organizations

Power Grid Model DS

API Docs

GitHub Repos

Core Concepts