pypsa

PyPSA: Python for Power System Analysis

https://github.com/pypsa/pypsa

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 15 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Committers with academic emails
    10 of 98 committers (10.2%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.9%) to scientific vocabulary

Keywords

capacity-expansion-planning clean-energy climate-change electrical-engineering electricity energy energy-system energy-system-model energy-system-modelling energy-systems loadflow optimal-power-flow optimisation power-flow power-systems power-systems-analysis powerflow python renewable-energy renewables

Keywords from Contributors

energy-data energy-model pypsa sector-coupling transmission-network power-grid europe energy-system-analysis capacity-expansion-model heat-pump
Last synced: 6 months ago · JSON representation ·

Repository

PyPSA: Python for Power System Analysis

Basic Info
  • Host: GitHub
  • Owner: PyPSA
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage: https://docs.pypsa.org
  • Size: 51.3 MB
Statistics
  • Stars: 1,626
  • Watchers: 72
  • Forks: 542
  • Open Issues: 127
  • Releases: 74
Topics
capacity-expansion-planning clean-energy climate-change electrical-engineering electricity energy energy-system energy-system-model energy-system-modelling energy-systems loadflow optimal-power-flow optimisation power-flow power-systems power-systems-analysis powerflow python renewable-energy renewables
Created about 10 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct Citation

README.md

PyPSA - Python for Power System Analysis

PyPI version Conda version Python Version from PEP 621 TOML Tests Documentation Status pre-commit.ci status Code coverage Ruff License Zenodo Discord Contributor Covenant

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

PyPSA is an open source toolbox for simulating and optimising modern power and energy 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 Department of Digital Transformation in Energy Systems at the Technical University of Berlin. Previous versions were developed by the Energy System Modelling group at the Institute for Automation and Applied Informatics at the Karlsruhe Institute of Technology funded by the Helmholtz Association, and 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.

Functionality

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 and investment periods 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 and links 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 (e.g. resistive Power-to-Heat (P2H), Power-to-Gas (P2G), battery electric vehicles (BEVs), Fischer-Tropsch, direct air capture (DAC))
  • basic components out of which more complicated assets can be built, such as Combined Heat and Power (CHP) units and heat pumps.

Documentation

Installation

pip:

pip install pypsa

conda/mamba:

conda install -c conda-forge pypsa

Additionally, install a solver (see here).

Usage

```py import pypsa

create a new network

n = pypsa.Network() n.add("Bus", "mybus") n.add("Load", "myload", bus="mybus", pset=100) n.add("Generator", "mygen", bus="mybus", pnom=100, marginal_cost=20)

load an example network

n = pypsa.examples.acdcmeshed()

run the optimisation

n.optimize()

plot results

n.generators_t.p.plot() n.plot()

get statistics

n.statistics() n.statistics.energy_balance() ```

There are more extensive examples available as Jupyter notebooks. They are also available as Python scripts in examples/notebooks/ directory.

Screenshots

PyPSA-Eur optimising capacities of generation, storage and transmission lines (9% line volume expansion allowed) for a 95% reduction in CO2 emissions in Europe compared to 1990 levels

image

SciGRID model simulating the German power system for 2015.

image

image

Dependencies

PyPSA is written and tested to be compatible with Python 3.10 and above. The last release supporting Python 2.7 was PyPSA 0.15.0.

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
  • networkx for some network calculations
  • matplotlib for static plotting
  • linopy for preparing optimisation problems (currently only linear and mixed integer linear optimisation)
  • cartopy for plotting the baselayer map
  • pytest for unit testing
  • logging for managing messages

Find the full list of dependencies in the dependency graph.

The optimisation uses interface libraries like linopy which are independent of the preferred solver. You can use e.g. one of the free solvers HiGHS, GLPK and CLP/CBC or the commercial solver Gurobi for which free academic licenses are available.

Contributing and Support

We strongly welcome anyone interested in contributing to this project. If you have any ideas, suggestions or encounter problems, feel invited to file issues or make pull requests on GitHub.

  • To discuss with other PyPSA users, organise projects, share news, and get in touch with the community you can use the Discord server.
  • For bugs and feature requests, please use the PyPSA Github Issues page.
  • For troubleshooting, please check the troubleshooting in the documentation.

Detailed guidelines can be found in the Contributing section of our documentation.

Code of Conduct

Please respect our code of conduct.

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. The release-specific DOIs can be found linked from the overall PyPSA Zenodo DOI for Version 0.17.1 and onwards:

image

or from the overall PyPSA Zenodo DOI for Versions up to 0.17.0:

image

Licence

Copyright 2015-2025 PyPSA Developers

PyPSA is licensed under the open source MIT License.

Owner

  • Name: PyPSA
  • Login: PyPSA
  • Kind: organization

Python for Power System Analysis

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this package, please cite the corresponding manuscript in Journal of Open Research Software."
title: "PyPSA: Python for Power System Analysis"
repository: https://github.com/pypsa/pypsa
version: 1.0.0rc1 # Don't touch, will be updated by the release script
license: MIT
journal: Journal of Open Research Software
doi: 10.5334/jors.188
authors:
  - family-names: Brown
    given-names: Tom
    orcid: https://orcid.org/0000-0001-5898-1911
  - family-names: Hörsch
    given-names: Jonas
    orcid: https://orcid.org/0000-0001-9438-767X
  - family-names: Hofmann
    given-names: Fabian
    orcid: https://orcid.org/0000-0002-6604-5450
  - family-names: Neumann
    given-names: Fabian
    orcid: https://orcid.org/0000-0001-8551-1480
  - family-names: Zeyen
    given-names: Lisa
    orcid: https://orcid.org/0000-0002-7262-3296
  - family-names: Syranidis
    given-names: Chloe
  - family-names: Frysztacki
    given-names: Martha
    orcid: https://orcid.org/0000-0002-0788-1328
  - family-names: Schlachtberger
    given-names: David
    orcid: https://orcid.org/0000-0002-8167-8213
  - family-names: Glaum
    given-names: Philipp
  - family-names: Parzen
    given-names: Max

GitHub Events

Total
  • Create event: 96
  • Release event: 10
  • Issues event: 91
  • Watch event: 337
  • Delete event: 280
  • Issue comment event: 222
  • Push event: 616
  • Pull request review comment event: 148
  • Pull request review event: 226
  • Pull request event: 308
  • Fork event: 97
Last Year
  • Create event: 96
  • Release event: 10
  • Issues event: 91
  • Watch event: 337
  • Delete event: 280
  • Issue comment event: 222
  • Push event: 616
  • Pull request review comment event: 148
  • Pull request review event: 226
  • Pull request event: 308
  • Fork event: 97

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 2,341
  • Total Committers: 98
  • Avg Commits per committer: 23.888
  • Development Distribution Score (DDS): 0.814
Past Year
  • Commits: 213
  • Committers: 29
  • Avg Commits per committer: 7.345
  • Development Distribution Score (DDS): 0.446
Top Committers
Name Email Commits
Fabian f****f@g****e 436
Tom Brown b****n@f****e 412
Fabian Neumann f****n@o****e 366
pre-commit-ci[bot] 6****] 235
Jonas Hoersch j****s@c****t 225
Lukas Trippe l****p@p****e 161
Philipp Glaum p****m@t****e 69
Max Parzen m****n@e****k 49
lisazeyen l****n@w****e 34
martacki m****i@k****u 27
Koen van Greevenbroek k****k@u****o 21
energyls l****m@o****e 19
Russell Smith r****h@e****m 18
euronion 4****n 14
JulianGeis J****s@g****t 13
Matthew Dumlao d****4@k****p 12
Irieo i****n@g****m 12
Enrico Giglio 1****o@g****m 12
Nis Martensen n****n@w****e 10
Ben Elliston b****e@a****u 9
gailin-p g****e@g****m 9
Jess 1****n 7
Heinz-Alexander Fuetterer 3****r 7
ekatef e****a@g****m 7
Russell Smith r****h@c****h 6
David Schlachtberger s****r@f****e 6
Alex-Neve 1****e 6
Francesco Witte g****b@w****h 6
PeterKlein11 8****1 6
ksyranid k****d@g****m 6
and 68 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 412
  • Total pull requests: 1,154
  • Average time to close issues: 6 months
  • Average time to close pull requests: 17 days
  • Total issue authors: 161
  • Total pull request authors: 104
  • Average comments per issue: 1.67
  • Average comments per pull request: 1.33
  • Merged pull requests: 934
  • Bot issues: 0
  • Bot pull requests: 118
Past Year
  • Issues: 72
  • Pull requests: 374
  • Average time to close issues: 26 days
  • Average time to close pull requests: 6 days
  • Issue authors: 36
  • Pull request authors: 33
  • Average comments per issue: 0.65
  • Average comments per pull request: 0.67
  • Merged pull requests: 274
  • Bot issues: 0
  • Bot pull requests: 32
Top Authors
Issue Authors
  • fneum (63)
  • FabianHofmann (41)
  • nworbmot (14)
  • Cellophil (12)
  • lisazeyen (12)
  • fhg-isi (12)
  • lkstrp (10)
  • pz-max (9)
  • loongmxbt (8)
  • PeterKlein11 (7)
  • coroa (7)
  • jankaeh (5)
  • davide-f (5)
  • matteodefelice (5)
  • euronion (5)
Pull Request Authors
  • lkstrp (257)
  • FabianHofmann (202)
  • fneum (187)
  • pre-commit-ci[bot] (97)
  • p-glaum (40)
  • coroa (25)
  • lisazeyen (25)
  • koen-vg (20)
  • Irieo (18)
  • pz-max (15)
  • gincrement (14)
  • martacki (14)
  • afuetterer (12)
  • nworbmot (12)
  • dependabot[bot] (10)
Top Labels
Issue Labels
bug (138) enhancement (103) needs triage (30) help wanted (21) wontfix (12) needs discussion (8) feature (7) question (6) high-priority (6) discussion (5) good first issue (5) high priority (4) beginner-friendly (2) documentation (2) low-priority (1) needs info (1) usage question (1)
Pull Request Labels
enhancement (15) dependencies (10) feature (8) new-opt (8) github_actions (5) bug (4) new-docs (2) high-priority (1) documentation (1)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 11,186 last-month
  • Total docker downloads: 204
  • Total dependent packages: 8
    (may contain duplicates)
  • Total dependent repositories: 46
    (may contain duplicates)
  • Total versions: 236
  • Total maintainers: 3
pypi.org: pypsa

Python for Power Systems Analysis

  • Versions: 74
  • Dependent Packages: 8
  • Dependent Repositories: 32
  • Downloads: 11,186 Last month
  • Docker Downloads: 204
Rankings
Dependent packages count: 1.3%
Stargazers count: 2.1%
Dependent repos count: 2.6%
Forks count: 2.7%
Average: 2.8%
Docker downloads count: 3.1%
Downloads: 4.7%
Maintainers (3)
Last synced: 6 months ago
proxy.golang.org: github.com/pypsa/pypsa
  • Versions: 73
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 1.6%
Average: 4.1%
Dependent packages count: 6.5%
Last synced: 6 months ago
proxy.golang.org: github.com/PyPSA/PyPSA
  • Versions: 73
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 7.0%
Average: 8.2%
Dependent repos count: 9.3%
Last synced: 6 months ago
conda-forge.org: pypsa

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.

  • Homepage: https://pypsa.org/
  • License: MIT
  • Latest release: 0.21.1
    published over 3 years ago
  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 14
Rankings
Forks count: 9.3%
Dependent repos count: 9.3%
Stargazers count: 14.1%
Average: 21.1%
Dependent packages count: 51.5%
Last synced: 6 months ago

Dependencies

setup.py pypi
  • deprecation *
  • matplotlib *
  • netcdf4 *
  • networkx >=1.10
  • numpy *
  • pandas >=0.24.0
  • pyomo >=5.7
  • scipy *
  • tables *
  • xarray *
.github/workflows/CI.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • crazy-max/ghaction-chocolatey v1 composite
.github/workflows/deploy.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish master composite
.github/workflows/CI-micromamba.yml actions
  • actions/checkout v3 composite
  • codecov/codecov-action v3 composite
  • mamba-org/setup-micromamba v1 composite
environment.yaml conda
  • cartopy >=0.16
  • deprecation
  • glpk
  • libnetcdf
  • linopy >=0.2
  • matplotlib
  • netcdf4
  • networkx >=1.10
  • numexpr <=2.8.4
  • numpy
  • pandas >=0.24.0,<2.1
  • pyomo >=5.7.0,<6.6.2
  • pytables
  • python >=3.9
  • scipy
  • validators
  • xarray
binder/environment.yml pypi
  • vresutils *
pyproject.toml pypi