Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pypsa-meets-earth/pypsa-earth

PyPSA-Earth: A flexible Python-based open optimisation model to study energy system futures around the world.
https://github.com/pypsa-meets-earth/pypsa-earth

energy-system-model energy-system-planning investment-optimization operational-optimization power-system-model power-system-planning pypsa-africa pypsa-earth python scenario-analysis

Last synced: about 2 months ago
JSON representation

PyPSA-Earth: A flexible Python-based open optimisation model to study energy system futures around the world.

Awesome Lists containing this project

README

        

# PyPSA-Earth. A Flexible Python-based Open Optimisation Model to Study Energy System Futures around the World.


by



## Development Status: **Stable and Active**

[![Status Linux](https://github.com/pypsa-meets-earth/pypsa-earth/actions/workflows/ci-linux.yaml/badge.svg?branch=main&event=push)](https://github.com/pypsa-meets-earth/pypsa-earth/actions/workflows/ci-linux.yaml)
[![Status Mac](https://github.com/pypsa-meets-earth/pypsa-earth/actions/workflows/ci-mac.yaml/badge.svg?branch=main&event=push)](https://github.com/pypsa-meets-earth/pypsa-earth/actions/workflows/ci-mac.yaml)
[![Status Windows](https://github.com/pypsa-meets-earth/pypsa-earth/actions/workflows/ci-windows.yaml/badge.svg?branch=main&event=push)](https://github.com/pypsa-meets-earth/pypsa-earth/actions/workflows/ci-windows.yaml)
[![Documentation Status](https://readthedocs.org/projects/pypsa-earth/badge/?version=latest)](https://pypsa-earth.readthedocs.io/en/latest/?badge=latest)
![Size](https://img.shields.io/github/repo-size/pypsa-meets-earth/pypsa-earth)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPLv3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![REUSE status](https://api.reuse.software/badge/github.com/pypsa-meets-earth/pypsa-earth)](https://api.reuse.software/info/github.com/pypsa-meets-earth/pypsa-earth)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pypsa-meets-earth/pypsa-earth/main.svg)](https://results.pre-commit.ci/latest/github/pypsa-meets-earth/pypsa-earth/main)
[![Discord](https://img.shields.io/discord/911692131440148490?logo=discord)](https://discord.gg/AnuJBk23FU)
[![Google Drive](https://img.shields.io/badge/Google%20Drive-4285F4?style=flat&logo=googledrive&logoColor=white)](https://drive.google.com/drive/folders/1U7fgktbxlaGzWxT2C0-Xv-_ffWCxAKZz)

**PyPSA-Earth: A Global Sector-Coupled Open-Source Multi-Energy System Model**

PyPSA-Earth is the first open-source global cross-sectoral energy system model with high spatial and temporal resolution. Originally it was derived from the European [PyPSA-Eur](https://pypsa-eur.readthedocs.io/en/latest/) model using new data and functions which provide capabilities for modelling the world energy system or any subset of it, enabling large-scale collaboration and transparent analysis for a sustainable energy future. It is suitable for operational studies, as well as expansion studies on combined generation, storage and transmission accounting for cross-sectoral interactions. The model provides two main features: (1) customizable data extraction and preparation scripts with global coverage for power and cross-sectoral modelling and (2) a [PyPSA](https://pypsa.readthedocs.io/en/latest/) energy modelling framework integration. In particular, the data includes energy demand, generation and medium to high-voltage networks from open sources, yet additional data can be further integrated. A broad range of clustering and grid meshing strategies help adapt the model to computational and practical needs.

With the recent integration of PyPSA-Earth and the sector-coupled PyPSA-Earth model, all functionality is now combined into a single, comprehensive tool. This unified model allows for detailed optimization of multi-energy systems, covering electricity, heating, transport, and more. It is designed to adapt to the specific needs of any country or region, offering customizable data extraction, preparation scripts with global coverage, and a broad range of clustering and grid meshing strategies to meet computational and practical requirements.

PyPSA-Earth is capable to provide the modelling evidence needed to translate implications behind energy scenarios into the regional actions. By making this tool openly available, we aim to foster collaboration, innovation, and informed decision-making that leads to sustainable and efficient energy solutions worldwide.

For more details, the model is described in the Applied Energy article "PyPSA-Earth: A new global open energy system optimization model demonstrated in Africa," 2023. The preprint describing the sector-coupled functionalities is also available [here](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4743242). Additional information can be found in the [documentation](https://pypsa-earth.readthedocs.io/en/latest/index.html).

**PyPSA meets Earth is a free and open source software initiative aiming to develop a powerful energy system model for Earth.** We work on open data, open source modelling, open source solver support and open communities. Stay tuned and join our mission - We look for users, co-developers and leaders! Check out our [website for results and our projects](https://pypsa-meets-earth.github.io/projects.html). Happy coding!





Figure: Example power systems build with PyPSA-Earth. See images of ~193 more countries at https://zenodo.org/records/10080766

The diagram below depicts one representative clustered node for the sector-coupled model with its generation, storage and conversion technologies.

![alt text](doc/SCPE_v0.2.png)

## Livetracker. Most popular global models:




## Get involved

There are multiple ways to get involved and learn more about our work. That's how we organise ourselves:

- [**Discord NEW! (Open)**](https://discord.gg/AnuJBk23FU)
- chat with the community, team up on features, exchange with developers, code in voice channels
- registration and usage is for free






- **General initiative meeting (Open)**
- every forth Thursday each month Thursday 16-17:00 (UK time)

`download .ics`

- join for project news and high-level code updates
- meeting hosted on Discord
- [open agenda](https://docs.google.com/document/d/1r6wm2RBe0DWFngmItpFfSFHA-CnUmVcVTkIKmthdW3g/edit?usp=sharing). See what we will discuss. Invited members have edit rights.
- **Buddy talk (Open)**
- book a 30min meeting with Max to discuss anything you like
- booking link: [calendly.com/pypsa-meets-earth](https://calendly.com/max-parzen/pypsa-meets-earth-exchange-30min)
- **Specific code meeting (Open)**
- meeting hosted on Discord
- join updates, demos, Q&A's, discussions and the coordination of each work package
1. Demand creation and prediction meeting, on demand
2. AI asset detection meeting, on demand
3. Sector coupling meeting, every Thursday 09:00 (UK time), `download .ics`
4. PyPSA-Earth meeting, every Thursday 16:00 (UK time), `download .ics`
- **Outreach meeting (Open)**
- every second week, Tuesday 17:00 (UK time)
- planning, discussing events, workshops, communication, community activities
- [**Google Drive**](https://drive.google.com/drive/folders/13Z8Y9zgsh5IZaDNkkRyo1wkoMgbdUxT5?usp=sharing)
- access to minutes, presentations, lists, documents (access to minutes)

## Installation

1. Open your terminal at a location where you want to install pypsa-earth. Type the following in your terminal to download the package from GitHub:

```bash
.../some/path/without/spaces % git clone https://github.com/pypsa-meets-earth/pypsa-earth.git
```
2. The python package requirements are curated in the `envs/environment.yaml` file.
The environment can be installed using:

```bash
.../pypsa-earth % conda env create -f envs/environment.yaml
```

If the above takes longer than 30min, you might want to try mamba for faster installation:

```bash
(base) conda install -c conda-forge mamba

.../pypsa-earth % mamba env create -f envs/environment.yaml
```

3. For running the optimization one has to install the solver. We can recommend the open source HiGHs solver which installation manual is given [here](https://github.com/PyPSA/PyPSA/blob/633669d3f940ea256fb0a2313c7a499cbe0122a5/pypsa/linopt.py#L608-L632).
4. To use jupyter lab (new jupyter notebooks) **continue** with the [ipython kernel installation](http://echrislynch.com/2019/02/01/adding-an-environment-to-jupyter-notebooks/) and test if your jupyter lab works:

```bash
.../pypsa-earth % ipython kernel install --user --name=pypsa-earth
.../pypsa-earth % jupyter lab
```
5. Verify or install a java redistribution from the [official website](https://www.oracle.com/java/technologies/downloads/) or equivalent.
To verify the successful installation the following code can be tested from bash:

```bash
.../pypsa-earth % java -version
```

The expected output should resemble the following:

```bash
java version "1.8.0_341"
Java(TM) SE Runtime Environment (build 1.8.0_341-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)
```

## Running the model in previous versions

The model can be run in previous versions by checking out the respective tag. For instance, to run the model in version 0.4.1, which is the last version before the repo `pypsa-earth-sec` was merged, the following command can be used:

```bash
git checkout v0.4.1
```
After checking out the tag, the model can be run as usual. Please make sure to install the required packages for the respective version.

## Test run on tutorial

- In the folder open a terminal/command window to be located at this path `~/pypsa-earth/`
- Activate the environment `conda activate pypsa-earth`
- Rename config.tutorial.yaml to config.yaml. For instance in Linux:
```bash
mv config.tutorial.yaml config.yaml
```
- Run a dryrun of the Snakemake workflow by typing simply in the terminal:
```bash
snakemake -j 1 solve_all_networks -n
```

Remove the -n to do a real run. Follow the tutorial of PyPSA-Eur 1 and 2 on [YouTube](https://www.youtube.com/watch?v=ty47YU1_eeQ) to continue with an analysis.

## Training

- We recently updated some [hackathon material](https://github.com/pypsa-meets-earth/documentation) for PyPSA-Earth. The hackathon contains jupyter notebooks with exercises. After going through the 1 day theoretical and practical material you should have a suitable coding setup and feel confident about contributing.
- The get a general feeling about the PyPSA functionality, we further recommend going through the [PyPSA](https://github.com/PyPSA/PyPSA/tree/master/examples) and [Atlite](https://github.com/PyPSA/atlite/tree/master/examples) examples.

## Questions and Issues

- We are happy to answer questions and help with issues **if they are public**. Through being public the wider community can benefit from the raised points. Some tips. **Bugs** and **feature requests** should be raised in the [**GitHub Issues**](https://github.com/pypsa-meets-earth/pypsa-earth/issues/new/choose). **General workflow** or **user questions** as well as discussion points should be posted at the [**GitHub Discussions**](https://github.com/pypsa-meets-earth/pypsa-earth/discussions/categories/q-a) tab. Happy coding.

## Documentation

The documentation is available here: [documentation](https://pypsa-earth.readthedocs.io/en/latest/index.html).

## Collaborators



FabianHofmann


Fabian Hofmann




fneum


Fabian Neumann




ekatef


Ekaterina




euronion


Euronion




Justus-coded


Justus Ilemobayo




mnm-matin


Mnm-matin



martacki


Martha Frysztacki




LukasFrankenQ


Lukas Franken




pz-max


Max Parzen




davide-f


Davide-f




koen-vg


Koen Van Greevenbroek




hazemakhalek


Hazem



energyLS


EnergyLS




AnasAlgarei


AnasAlgarei




yerbol-akhmetov


Yerbol Akhmetov




DeniseGiub


DeniseGiub




GbotemiB


Emmanuel Bolarinwa




Tomkourou


Thomas Kouroughli



GridGrapher


GridGrapher




Emre-Yorat89


Emre_Yorat




virio-andreyana


Null




giacfalk


Giacomo Falchetta




Ekaterina-Vo


Ekaterina-Vo




finozzifa


Finozzifa



cpschau


Cschau




Tooblippe


Tobias




doneachh


Anton Achhammer




asolavi


Null




carlosfv92


Carlos Fernandez




stephenjlee


Stephen J Lee



rsparks3


Ryan




ollie-bell


Null




juli-a-ko


Juli-a-ko




squoilin


Sylvain Quoilin




siddharth-krishna


Siddharth Krishna




pitmonticone


Pietro Monticone



Netotse


Null




kma33


Katherine M. Antonio




jessLryan


Jess




jarry7


Jarrad Wright




HanaElattar


HanaElattar




EmreYorat


EmreYorat



AndreCNF


André Cristóvão Neves Ferreira




AlexanderMeisinger


Null