Skip to main content

Python for Power Systems Analysis

Project description

Build status on Linux PyPI version badge_license


1 Python for Power System Analysis

1.1 About

PyPSA stands for “Python for Power System Analysis”. It is pronounced “pipes-ah”.

PyPSA is a free software toolbox for simulating and optimising modern power systems that include features such as conventional generators with unit commitment, variable wind and solar generation, storage units, coupling to other energy sectors, and mixed alternating and direct current networks. PyPSA is designed to scale well with large networks and long time series.

This project is maintained by the Energy System Modelling group at the Institute for Automation and Applied Informatics at the Karlsruhe Institute of Technology. The group is funded by the Helmholtz Association until 2024. Previous versions were developed by the Renewable Energy Group at FIAS to carry out simulations for the CoNDyNet project, financed by the German Federal Ministry for Education and Research (BMBF) as part of the Stromnetze Research Initiative.

1.2 Documentation

Documentation as a website

Documentation as a PDF

Quick start

Examples

Documentation is in sphinx reStructuredText format in the doc sub-folder of the repository.

1.3 What PyPSA does and does not do (yet)

PyPSA can calculate:

  • static power flow (using both the full non-linear network equations and the linearised network equations)

  • linear optimal power flow (least-cost optimisation of power plant and storage dispatch within network constraints, using the linear network equations, over several snapshots)

  • security-constrained linear optimal power flow

  • total electricity/energy system least-cost investment optimisation (using linear network equations, over several snapshots simultaneously for optimisation of generation and storage dispatch and investment in the capacities of generation, storage, transmission and other infrastructure)

It has models for:

  • meshed multiply-connected AC and DC networks, with controllable converters between AC and DC networks

  • standard types for lines and transformers following the implementation in pandapower

  • conventional dispatchable generators with unit commitment

  • generators with time-varying power availability, such as wind and solar generators

  • storage units with efficiency losses

  • simple hydroelectricity with inflow and spillage

  • coupling with other energy carriers

  • basic components out of which more complicated assets can be built, such as Combined Heat and Power (CHP) units, heat pumps, resistive Power-to-Heat (P2H), Power-to-Gas (P2G), battery electric vehicles (BEVs), Fischer-Tropsch, direct air capture (DAC), etc.; each of these is demonstrated in the examples

Functionality that may be added in the future:

  • Multi-year investment optimisation

  • Distributed active power slack

  • Interactive web-based GUI with SVG

  • OPF with the full non-linear network equations

  • Port to Julia

Other complementary libraries:

  • pandapower for more detailed modelling of distribution grids, short-circuit calculations, unbalanced load flow and more

  • PowerDynamics.jl for dynamic modelling of power grids at time scales where differential equations are relevant

1.4 Example scripts as Jupyter notebooks

There are extensive examples available as Jupyter notebooks. They are also described in the doc/examples.rst and are available as Python scripts in examples/.

1.5 Screenshots

Results from a PyPSA simulation can be converted into an interactive online animation using PyPSA-animation, see the PyPSA-Eur-30 example.

Another showcase for PyPSA is the SciGRID example which demonstrates interactive plots generated with the plotly library.

http://www.pypsa.org/img/line-loading.png http://www.pypsa.org/img/lmp.png http://www.pypsa.org/img/reactive-power.png http://www.pypsa.org/img/stacked-gen.png http://www.pypsa.org/img/storage-scigrid.png http://www.pypsa.org/img/scigrid-curtailment.png http://www.pypsa.org/img/meshed-ac-dc.png

Optimised capacities of generation and storage for a 95% reduction in CO2 emissions in Europe compare to 1990 levels:

http://www.pypsa.org/img/euro-pie-pre-7-branch_limit-1-256.png http://www.pypsa.org/img/legend-flat.png

1.6 What PyPSA uses under the hood

PyPSA is written and tested to be compatible with both Python 2.7 and Python 3.6.

It leans heavily on the following Python packages:

  • pandas for storing data about components and time series

  • numpy and scipy for calculations, such as linear algebra and sparse matrix calculations

  • pyomo for preparing optimisation problems (currently only linear)

  • plotly for interactive plotting

  • matplotlib for static plotting

  • networkx for some network calculations

  • py.test for unit testing

  • logging for managing messages

The optimisation uses pyomo so that it is independent of the preferred solver (you can use e.g. the free software GLPK or the commercial software Gurobi).

The time-expensive calculations, such as solving sparse linear equations, are carried out using the scipy.sparse libraries.

1.7 Mailing list

PyPSA has a Google Group forum / mailing list.

1.8 Citing PyPSA

If you use PyPSA for your research, we would appreciate it if you would cite the following paper:

Please use the following BibTeX:

@article{PyPSA,
   author = {T. Brown and J. H\"orsch and D. Schlachtberger},
   title = {{PyPSA: Python for Power System Analysis}},
   journal = {Journal of Open Research Software},
   volume = {6},
   issue = {1},
   number = {4},
   year = {2018},
   eprint = {1707.09913},
   url = {https://doi.org/10.5334/jors.188},
   doi = {10.5334/jors.188}
}

If you want to cite a specific PyPSA version, each release of PyPSA is stored on Zenodo with a release-specific DOI. This can be found linked from the overall PyPSA Zenodo DOI:

https://zenodo.org/badge/DOI/10.5281/zenodo.786605.svg

1.9 Licence

Copyright 2015-2019 Tom Brown (KIT, FIAS), Jonas Hörsch (KIT, FIAS), David Schlachtberger (FIAS)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypsa-0.14.1.tar.gz (93.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page