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, sector coupling and mixed alternating and direct current networks. PyPSA is designed to scale well with large networks and long time series.
As of 2017 PyPSA is under heavy development and therefore it is recommended to use caution when using it in a production environment. Some APIs may change - the changes in each PyPSA version are listed in the :doc:`release_notes`.
PyPSA was initially 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.
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 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 and transmission)
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), etc.; each of these is demonstrated in the examples
Functionality that will definitely be added soon:
- Multi-year investment optimisation
- Simple RMS simulations with the swing equation
- Distributed active power slack
- Non-linear power flow solution using analytic continuation in the complex plane following GridCal
Functionality that may be added in the future:
- Short-circuit current calculations
- Dynamic RMS simulations
- Small signal stability analysis
- Interactive web-based GUI with SVG
- OPF with the full non-linear network equations
- Dynamic EMT simulations
- Unbalanced load flow
- Port to Julia
There are extensive examples
available as Jupyter notebooks. They are also described in the
:doc:`examples` and are available as Python scripts in examples/
.
Optimised capacities of generation and storage for a 95% reduction in CO2 emissions in Europe compare to 1990 levels:
PyPSA is intended for researchers, planners and utilities who need a fast, easy-to-use and transparent tool for power system analysis. PyPSA is free software and can be arbitrarily extended.
For a full list see :doc:`comparable_software`.
PyPSA is not as fully featured as other power system simulation tools such as the Matlab-based free software PSAT or the commercial package DIgSILENT PowerFactory.
However for power flow and optimal power flow over several time snapshots with variable renewable energy sources and/or storage and/or mixed AC-DC systems, it offers the flexibility of Python and the transparency of free software.
Another Python power system tool is PYPOWER, which is based on the Matlab-based MATPOWER. In contrast to PYPOWER, PyPSA has an easier-to-use data model (pandas DataFrames instead of numpy arrays), support for time-varying data inputs and support for multiply-connected networks using both AC and DC. PyPSA uses some of the sparse-matrix constructs from PYPOWER.
PyPSA is written and tested to be compatible with Python 2.7 and Python 3.5.
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.
PyPSA has a Google Group forum / mailing list.
If you use PyPSA for your research, we would appreciate it if you would cite the following preprint paper (which has been accepted to the Journal of Open Research Software):
- T. Brown, J. Hörsch, D. Schlachtberger, PyPSA: Python for Power System Analysis, 2017, preprint arXiv:1707.09913
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:
PyPSA is released under the GPLv3.