# PyPSA - Python for Power System Analysis

PyPSA is an open-source Python framework for optimizing modern power systems with renewable energy, storage, and multi-sector coupling. Perfect for researchers and energy planners.

Canonical URL: https://pypsa.org/

PyPSA stands for Python for Power System Analysis. Free. Open-Source. Batteries included.

- [Get Started](https://docs.pypsa.org/latest/examples/example-1/)
- [GitHub Repository](https://github.com/PyPSA/PyPSA)
- Event: [PyPSA User Meeting on 29 June 2026](https://pypsa.org/events/4th-user-meeting)

## PyPSA Framework

An open-source Python framework for optimising modern power systems with conventional generators, renewable energy, storage, and multi-sector coupling - designed for researchers and planners.

### Optimization

- **Economic Dispatch (ED)**: Model short-term market dispatch with unit commitment, renewables, storage, multi-carrier conversion, and more. ([docs](https://docs.pypsa.org/latest/examples/example-1/))
- **Linear Optimal Power Flow (LOPF)**: Optimize power flow in AC-DC networks using linearized KVL/KCL constraints with optional loss approximations. ([docs](https://docs.pypsa.org/latest/user-guide/linear-power-flow/))
- **Security-Constrained LOPF (SCLOPF)**: Ensure system reliability by accounting for line outage contingencies under N-1 conditions. ([docs](https://docs.pypsa.org/latest/examples/scigrid-sclopf/))
- **Capacity Expansion Planning (CEP)**: Plan long-term infrastructure investments for generation, storage, transmission, and conversion with continuous or discrete options. ([docs](https://docs.pypsa.org/latest/examples/capacity-expansion-planning-single-node/))
- **Pathway Planning**: Co-optimize multi-period investments to design energy transition pathways with perfect foresight planning. ([docs](https://docs.pypsa.org/latest/user-guide/optimization/pathway-planning/))
- **Rolling-Horizon Optimisation**: Solve large-scale problems sequentially with myopic foresight and dynamic updates across time horizons. ([docs](https://docs.pypsa.org/latest/examples/rolling-horizon/))
- **Stochastic Optimisation**: Two-stage stochastic programming for uncertainty handling with weighted scenarios and separate investment-dispatch decisions. ([docs](https://docs.pypsa.org/latest/user-guide/optimization/stochastic/))
- **Modelling-to-Generate-Alternatives (MGA)**: Explore alternative system designs with similar costs to understand trade-offs and decision flexibility. ([docs](https://docs.pypsa.org/latest/user-guide/optimization/modelling-to-generate-alternatives/))
- **Policy Constraints**: Built-in support for CO₂ limits, subsidies, resource limits, expansion limits, and growth constraints. ([docs](https://docs.pypsa.org/latest/user-guide/optimization/global-constraints/))
- **Custom Constraints**: Impose custom objectives, variables and constraints using Linopy for specialized requirements. ([docs](https://docs.pypsa.org/latest/user-guide/optimization/custom-constraints/))
- **Solver Flexibility**: Support for wide range of LP, MILP, and QP solvers from open-source to commercial solutions. ([docs](https://docs.pypsa.org/latest/home/installation/#solvers))

### Applications

- **Sector-Coupling**: Model integrated multi-carrier energy systems with heat pumps, electrolysers, EVs, and synthetic fuels. ([docs](https://docs.pypsa.org/latest/examples/sector-coupling-single-node/))
- **Standard Grid Components**: Includes standard types for lines and transformers from pandapower for realistic grid modeling. ([docs](https://docs.pypsa.org/latest/user-guide/design/#network-components))
- **Static Power Flow Analysis**: Compute non-linear and linearised load flows for AC-DC grids using Newton-Raphson method. ([docs](https://docs.pypsa.org/latest/examples/minimal-example-pf/?h=power+flow))
- **Diverse Applications**: Support strategic energy analyses from technology assessment to decarbonisation pathway planning. ([docs](https://docs.pypsa.org/latest/examples/examples/))

### Analysis

- **Shadow Prices**: Output dual values including nodal prices, storage values, scarcity and CO₂ pricing.
- **Statistics**: Built-in tools for energy balances, capacities, costs, market values, and component revenues. ([docs](https://docs.pypsa.org/latest/user-guide/statistics/))
- **Visualisations**: Plot statistics, time series, spatial distributions of line loadings and dispatch decisions. ([docs](https://docs.pypsa.org/latest/user-guide/plotting/charts/))
- **Documentation**: Comprehensive user guide, API reference, and plenty of examples are available.
- **Community Support**: Active community on GitHub and Discord for user support and development discussions. ([docs](https://docs.pypsa.org/latest/user-guide/support/))
- **MIT License**: Fully open-source and free for commercial and academic use with no restrictions. ([docs](https://docs.pypsa.org/latest/home/license/))

### Performance

- **Modular Design**: Clean separation between data and modeling code enables flexible scenario development.
- **Resolution Control**: Flexible control over temporal, spatial, and sectoral scope and detail for any analysis needs.
- **Spatial Clustering**: Reduce model size for large networks via spatial aggregation strategies and network simplification. ([docs](https://docs.pypsa.org/latest/user-guide/clustering/))
- **Data Backbone**: Uses pandas for data handling and linopy for optimization with efficient solver interfacing.
- **Performance**: Designed to scale with high-resolution networks, minimizing memory usage and solver overhead. ([docs](https://linopy.readthedocs.io/en/latest/benchmark.html))
- **Scalability**: Handle models from small prototypes to continent-scale systems on high-performance clusters.

## Framework and Tools

PyPSA and its complementary tools and initiatives.

- **Atlite**: A Lightweight Python Package for Calculating Renewable Power Potentials and Time Series. [GitHub](https://github.com/PyPSA/atlite) · [Docs](https://atlite.readthedocs.io/). Institutions: [TU Berlin](https://www.tu.berlin/en/ensys).
- **PyPSA**: Python for Power System Analysis - the core framework for simulating and optimising modern power systems. [GitHub](https://github.com/PyPSA/PyPSA) · [Docs](https://pypsa.readthedocs.io/). Institutions: [TU Berlin](https://www.tu.berlin/en/ensys).
- **Linopy**: Linear optimization interface for N-D labeled variables. [GitHub](https://github.com/PyPSA/linopy) · [Docs](https://linopy.readthedocs.io/). Institutions: [OET](https://openenergytransition.org/), [TU Berlin](https://www.tu.berlin/en/ensys).
- **Map Your Grid**: Community-driven initiative mapping the world's electrical grids to accelerate the energy transition worldwide. [GitHub](https://mapyourgrid.org/) · [Website](https://mapyourgrid.org/). Institutions: [OET](https://openenergytransition.org/).
- **Powerplantmatching**: A toolset for cleaning, standardizing and combining multiple power plant databases. [GitHub](https://github.com/PyPSA/powerplantmatching) · [Docs](https://powerplantmatching.readthedocs.io/). Institutions: [TU Berlin](https://www.tu.berlin/en/ensys).
- **Technology Data**: Compile assumptions on energy system technologies for various years. [GitHub](https://github.com/PyPSA/technology-data) · [Docs](https://technology-data.readthedocs.io/en/latest/). Institutions: [OET](https://openenergytransition.org/), [TU Berlin](https://www.tu.berlin/en/ensys).

## PyPSA Models

Open Energy System Models built with PyPSA.

- **PyPSA-Earth**: A flexible Python-based open optimisation model to study energy system futures around the world. [GitHub](https://github.com/pypsa-meets-earth/pypsa-earth) · [Docs](https://pypsa-earth.readthedocs.io/en/latest/). Institutions: [PyPSA meets Earth](https://pypsa-meets-earth.github.io/).
- **PyPSA-Eur**: A Sector-Coupled Open Optimisation Model of the European Energy System. [GitHub](https://github.com/PyPSA/pypsa-eur) · [Docs](https://pypsa-eur.readthedocs.io/) · [Explore](https://pypsa.org/explore/europe-light.html). Institutions: [TU Berlin](https://www.tu.berlin/en/ensys).
- **PyPSA-USA**: An Open-Source Energy System Optimization Model for the United States. [GitHub](https://github.com/PyPSA/pypsa-usa) · [Docs](https://pypsa-usa.readthedocs.io/en/latest/). Institutions: [Stanford University](https://ines.stanford.edu/).
- **PyPSA-DE**: High resolution, sector-coupled model of the German Energy System. [GitHub](https://github.com/PyPSA/pypsa-de). Institutions: [TU Berlin](https://www.tu.berlin/en/ensys).

## Community

The people who power PyPSA. 551 contributors are listed on the site; the most active are:

- [Fabian Neumann](https://github.com/fneum)
- [Fabian Hofmann](https://github.com/FabianHofmann)
- [Lukas Trippe](https://github.com/lkstrp)
- [Davide Fioriti](https://github.com/davide-f)
- [Max Parzen](https://github.com/pz-max)
- [Trevor Barnes](https://github.com/trevorb1)
- [Johannes HAMPP](https://github.com/euronion)
- [Ekaterina](https://github.com/ekatef)
- [Kamran Tehranchi](https://github.com/ktehranchi)
- [Michael Lindner](https://github.com/lindnemi)

Join the conversation on [Discord](https://discord.gg/AnuJBk23FU).

## Related Research

Numerous research publications are built on the PyPSA environment. Here we highlight some of them. For an extended list, have a look at the up-to-date [Google Scholar query](https://scholar.google.com/scholar?q=pypsa). The most cited publications:

- [PyPSA: Python for power system analysis](https://arxiv.org/abs/1707.09913) (2017, 895 citations): T Brown, J Hörsch, D Schlachtberger - arXiv preprint arXiv:1707.09913, 2017 - arxiv.org
- [Synergies of sector coupling and transmission reinforcement in a cost-optimised, highly renewable European energy system](https://www.sciencedirect.com/science/article/pii/S036054421831288X) (2018, 890 citations): T Brown, D Schlachtberger, A Kies, S Schramm… - Energy, 2018 - Elsevier
- [On the history and future of 100% renewable energy systems research](https://ieeexplore.ieee.org/abstract/document/9837910/) (2022, 568 citations): C Breyer, S Khalili, D Bogdanov, M Ram… - IEEe …, 2022 - ieeexplore.ieee.org
- [Classification and challenges of bottom-up energy system models-A review](https://www.sciencedirect.com/science/article/pii/S1364032120302082) (2020, 488 citations): MG Prina, G Manzolini, D Moser, B Nastasi… - … and Sustainable Energy …, 2020 - Elsevier
- [Trends in tools and approaches for modelling the energy transition](https://www.sciencedirect.com/science/article/pii/S0306261921002476) (2021, 429 citations): M Chang, JZ Thellufsen, B Zakeri, B Pickering… - Applied Energy, 2021 - Elsevier
- [PyPSA-Eur: An open optimisation model of the European transmission system](https://www.sciencedirect.com/science/article/pii/S2211467X18300804) (2018, 409 citations): J Hörsch, F Hofmann, D Schlachtberger, T Brown - Energy strategy reviews, 2018 - Elsevier
- [The Open Energy Modelling Framework (oemof)-A new approach to facilitate open science in energy system modelling](https://www.sciencedirect.com/science/article/pii/S2211467X18300609) (2018, 409 citations): S Hilpert, C Kaldemeyer, U Krien, S Günther… - Energy strategy …, 2018 - Elsevier
- [Opening the black box of energy modelling: Strategies and lessons learned](https://www.sciencedirect.com/science/article/pii/S2211467X17300809) (2018, 328 citations): S Pfenninger, L Hirth, I Schlecht, E Schmid… - Energy Strategy …, 2018 - Elsevier
- [The role of storage technologies throughout the decarbonisation of the sector-coupled European energy system](https://www.sciencedirect.com/science/article/pii/S0196890419309835) (2019, 285 citations): M Victoria, K Zhu, T Brown, GB Andresen… - Energy Conversion and …, 2019 - Elsevier
- [Modeling and optimization of multi-energy systems in mixed-use districts: A review of existing methods and approaches](https://www.sciencedirect.com/science/article/pii/S1364032120304950) (2021, 279 citations): C Klemm, P Vennemann - Renewable and Sustainable Energy Reviews, 2021 - Elsevier

## Frequently Asked Questions

### What is the difference between PyPSA and PyPSA-X?

[PyPSA](https://github.com/PyPSA/pypsa) is a framework for optimising and simulating modern power and energy systems. It is a toolbox that does not hold any data. Specific model implementations such as [PyPSA-Earth](https://github.com/pypsa-meets-earth/pypsa-earth), [PyPSA-Eur](https://github.com/PyPSA/pypsa-eur) and [PyPSA-USA](https://github.com/PyPSA/pypsa-usa) integrate datasets, processing and workflow management.

### Is using PyPSA for free?

PyPSA is licensed under the [MIT open-source licence](https://opensource.org/license/mit), which makes it fully open-source and free for both commercial and academic use. Similar licences are used for other listed projects.

### Where can I find learning materials?

PyPSA offers comprehensive learning resources in the [documentation](https://docs.pypsa.org/latest) including tutorials and examples. You can also find a list of video lectures, workshops, and training materials for PyPSA and Energy Systems Modelling in general on the dedicated [learning materials](https://docs.pypsa.org/latest/user-guide/learning-materials/) page. Additionally, the YouTube channels of [PyPSA](https://www.youtube.com/@pypsa-official) and [PyPSA meets Earth](https://www.youtube.com/@pypsameetsearth7475) offer video tutorials and collect community videos in their playlist sections.

### Do I need to buy a commercial solver?

No, you can use open-source solvers such as [HiGHS](https://highs.dev/). But it helps for very large problems with high spatial and temporal resolution, cross-sectoral scope, and multiple investment periods. [Gurobi](https://www.gurobi.com/solutions/gurobi-optimizer/) and [CPLEX](https://www.ibm.com/products/ilog-cplex-optimization-studio/cplex-optimizer) are recommended for better performance or allow finding any solutions at all.

### Can I get support for using PyPSA?

PyPSA has an active community of users and developers on Discord and elsewhere who can help you with questions and issues. Also, various consultancies offer paid support, such as [PyPSA Labs](https://pypsalabs.org), [OET](https://www.openenergytransition.org), [d-fine](https://www.d-fine.com/en/), [Energynautics](https://energynautics.com/en/), and [CLIMACT](https://www.climact.com/).

Still have questions? Check out the full [FAQ](https://docs.pypsa.org/latest/user-guide/faq).
