Power Flow Analysis

Summary

Power Flow Analysis helps plan where and how to upgrade electricity infrastructure. Engineers use power flow analysis to check whether current or proposed designs of electricity infrastructure can handle different patterns of energy use. This article presents a runnable report created by Miguel Angel Gordián of DevLabs México for computing power flow in your own electricity network, using functions from PyPSA - Python for Power System Analysis.

Introduction to Power Flow Analysis using PyPSA

Power Flow Analysis estimates the amount of electricity moving through an electrical network and is useful for determining safe operating levels for the network and helps in planning where and how to upgrade the electrical infrastructure. Electrical wire is graded according to the maximum amount of electricity it can safely carry. If the loads in a network draw too much current above a wire’s maximum capacity, the wire can overheat, melt its insulation and combust, starting a fire. This problem is particularly relevant to regions where energy use has increased far greater than what had been planned in a settlement’s last infrastructure upgrade.

pip install pypsa

PyPSA is an open source package with various functions for computing power flow. The package was developed by the Renewable Energy Group at the Frankfurt Institute for Advanced Studies and is maintained by the Energy System Modelling Group at the Institute for Automation and Applied Informatics at the Karlsruhe Institute of Technology.

# Adapted from https://pypsa.readthedocs.io/en/latest/quick_start.html
import pypsa
import numpy as np

network = pypsa.Network()

bus_count = 3
for i in range(bus_count):
    network.add(
        'Bus', f'Bus {i}', v_nom=20.)
for i in range(bus_count):
    network.add(
        'Line', f'Line {i}', bus0=f'Bus {i}', bus1=f'Bus {(i + 1) % 3}',
        x=0.1, r=0.01)

network.add(
    'Generator', 'Generator 0', bus='Bus 0', p_set=100, control='PQ')
network.add(
    'Load', 'Load 0', bus='Bus 1', p_set=100)

network.loads.q_set = 100.
network.pf()
print(network.lines_t.p0)

The above example constructs a simple circuit with three lines connected at three buses, with a generator that produces electricity at the first bus and a load that consumes electricity at the second bus. A bus is strip of metal that is electrically conductive, which means that anything connected to the bus is also connected to each other. The example then sets the amount of power demanded by the load and computes the Newton-Raphson power flow.

Runnable Report for Power Flow Analysis

From January 2021 to February 2021, Miguel Angel Gordián of DevLabs México created a runnable report that computes a power flow analysis of an electricity network. The report also generates a Python script that builds the network using PyPSA. The report is compatible with electricity-network datasets from the web-based APPA Asset Tracker and the CrossCompute Platform electricity-network-view.

The intended audience are infrastructure planning analysts who want to quickly spot check the feasibility of a proposed microgrid or grid extension.

The report is available on the Latest CrossCompute Platform. To use it, sign in, start a project and select Analyze Power Flow from the available tools/reports. The report can also be installed on your dedicated instance of the CrossCompute Platform.

Notes from the Creator: Miguel Angel Gordián

Caveats

  • Storage and Capacitors are ignored at this moment because PyPSA requires modelling these elements in a different way from other elements.
  • Please check that the reactance and capacitance in the outputted PyPSA script match with the provided assets.

Future Directions

  • Improve error messages in case buses aren’t provided.
  • Improve error messages when it is not possible
    to calculate the power flow based on the given assets.
  • Split PyPSA script generation from power flow analysis.

Development Timeline

In January 2019, CrossCompute began collaborating with Professor Trevor David Rhone at Rensselaer Polytechnic Institute to understand the capabilities of PyPSA and its suitability as a package for power flow analysis, thanks to a separate project with the American Public Power Association and the U.S. Department of Energy. Professor Rhone explained much of the physics behind electricity networks and power flow.

In January 2021, CrossCompute asked Miguel Angel Gordián of DevLabs México if it would be possible to create a tool that computes power flow on electricity networks modelled using the new web-based electricity-network-view and APPA Asset Tracker.

In February 2021, Miguel Angel Gordián of DevLabs México completed the first iteration of the Analyze Power Flow tool.