pypowsybl Interface#

"PowSyBl (Power System Blocks) is an open source framework written in Java, dedicated to electrical grid modelling and simulation, licensed under the Mozilla Public License version 2.0. It is part of LF Energy, an open source foundation focused on the power systems sector, hosted within The Linux Foundation."

pypowsybl is the Python interface to PowSybl. For more information, please visit:

ANDES provides a simple interface to pypowsybl. The main goal is to leverage pypowsybl for drawing single-line diagrams and area diagrams for systems loaded in ANDES.


import andes
import pypowsybl as pp

from andes.interop.pypowsybl import to_pypowsybl
ss = andes.load(andes.get_case("ieee14/ieee14_linetrip.xlsx"))


Convert to a pypowsybl network:

n = to_pypowsybl(ss)

Run power flow in pypowsybl:

results = pp.loadflow.run_ac(n)


pypowsybl provides two functions to draw diagrams:

  • get_network_area_diagram(VOLTAGE_LEVEL_ID = None, DEPTH = 0)

  • get_single_line_diagram(CONTAINER_ID)

These function names are self explanatory. To draw the diagram for the whole network, do


To draw the SLD for bus 6, do


where VL6 is the voltage level container created for Bus 6. Voltage level container is named as VL + bus idx.

To find out how to work with pypowsybl, visit its documentation at