Package: pypsa
PyPSA - Python for Power System AnalysisPyPSA 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 theDepartment of Digital Transformation in
Energy Systemsat theTechnical University of
Berlin. Previous versions were developed by the Energy
System Modelling group at theInstitute for Automation and Applied
Informaticsat theKarlsruhe
Institute of Technologyfunded by theHelmholtz Association, and by theRenewable
Energy
GroupatFIASto carry out simulations for theCoNDyNet project, financed by theGerman Federal
Ministry for Education and Research (BMBF)as part of theStromnetze Research
Initiative.FunctionalityPyPSA 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 flowtotal 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 networksstandard types for lines and transformers following the implementation inpandapowerconventional dispatchable generators and links with unit commitmentgenerators with time-varying power availability, such as wind and solar
generatorsstorage units with efficiency lossessimple hydroelectricity with inflow and spillagecoupling 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.DocumentationDocumentationQuick startExamplesKnown users of
PyPSAInstallationpip:pip install pypsaconda/mamba:conda install -c conda-forge pypsaAdditionally, install a solver.Usageimportpypsa# create a new networkn=pypsa.Network()n.add("Bus","mybus")n.add("Load","myload",bus="mybus",p_set=100)n.add("Generator","mygen",bus="mybus",p_nom=100,marginal_cost=20)# load an example networkn=pypsa.examples.ac_dc_meshed()# run the optimisationn.optimize()# plot resultsn.generators_t.p.plot()n.plot()# get statisticsn.statistics()n.statistics.energy_balance()There aremore extensive
examplesavailable
asJupyter notebooks. They are also described in thedoc/examples.rstand are available as Python scripts inexamples/.ScreenshotsPyPSA-Europtimising capacities of
generation, storage and transmission lines (9% line volume expansion allowed)
for a 95% reduction in CO2 emissions in Europe compared to 1990 levelsSciGRID modelsimulating the German power system
for 2015.DependenciesPyPSA is written and tested to be compatible with Python 3.7 and above.
The last release supporting Python 2.7 was PyPSA 0.15.0.It leans heavily on the following Python packages:pandasfor storing data about
components and time seriesnumpyandscipyfor
calculations, such as linear algebra and sparse matrix calculationsnetworkxfor some network
calculationsmatplotlibfor static plottinglinpyfor preparing optimisation problems
(currently only linear and mixed integer linear optimisation)cartopyfor plotting the
baselayer mappytestfor unit testingloggingfor
managing messagesThe optimisation uses interface libraries likelinopywhich are
independent of the preferred solver. You can use e.g. one of the free
solversGLPKandCLP/CBCor the commercial solverGurobifor which free academic licenses are
available.DocumentationPlease check thedocumentation.Contributing and SupportWe 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.In case of code-relatedquestions, please post onstack overflow.For non-programming related and more general questions please refer to themailing list.Todiscusswith other PyPSA users, organise projects, share news, and get in touch with the community you can use thediscord server.Forbugs and feature requests, please use thePyPSA Github Issues page.Fortroubleshooting, please check thetroubleshootingin the documentation.Code of ConductPlease respect ourcode of conduct.Citing PyPSAIf you use PyPSA for your research, we would appreciate it if you would
cite the following paper:T. Brown, J. Hörsch, D. Schlachtberger,PyPSA: Python for Power
System Analysis, 2018,Journal
of Open Research
Software, 6(1),arXiv:1707.09913,DOI:10.5334/jors.188Please 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 onZenodowith 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:or from the overall PyPSA Zenodo DOI for Versions up to 0.17.0:LicenceCopyright 2015-2024PyPSA
DevelopersPyPSA is licensed under the open sourceMIT
License.