Using power system modelling outputs to identify weather-induced extreme events in highly renewable systems
This repository contains the code necessary to reproduce the results of the paper "Using power system modelling outputs to identify weather-induced extreme events in highly renewable systems". Additional data accompanying the paper can be found at DOI:10.5281/zenodo.8328689.
This repository contains a simple Snakemake-based workflow to organise the computations. The "snakefile" specifying the workflow is found at workflow/Snakefile
. Broadly speaking, the workflow follows just a few steps:
- A modified version of PyPSA-Eur is used to build a model for the European power system. We build 40 model instances ("networks") corresponding to the 40 weather years 1980-2020 (summer to summer); these instances are identical apart from differing time series for capacity-factors, hydro inflows and temperature-dependent load. The modelling framework PyPSA-Eur is itself organised as a Snakemake workflow; this workflow is included as a snakemake module in the present workflow.
- Each network is solved to optimality in capacity-expansion mode in the
compute_optimum
rule. - Shadow prices of the networks are used to extract a set of system-defining events in the
difficult_periods
rule. - For validation we also operate each solved network over all weather years with fixed capacities (the
solve_operations
rule) in order to obtain load shedding data to compare with shadow prices.
-
Clone this git repository with the
--recurse-submodules
option in order to also pull in PyPSA-Eur:git clone --recurse-submodules git@github.com:koen-vg/stressful-weather.git
-
Obtain the ERA5 historical weather data needed to build the model instances. Download the data for the desired weather years at DOI: 10.11582/2022.00034, and place each file (of the form
europe-era5_yyyy
whereyyyy
is the year) inworkflow/modules/pypsa-eur/cutouts
. -
Install Snakemake 7.0.1 or higher. The recommended way is using mamba to install snakemake into its own conda environment as follows:
mamba create -c conda-forge -c bioconda -n snakemake 'snakemake>=7.0.1'
Now activate the environment with
conda activate snakemake
and runsnakemake --version
to check that you have the correct version installed.See https://snakemake.readthedocs.io/en/stable/getting_started/installation.html for more detailed instructions.
-
Run the whole workflow with the following command:
snakemake --configfile config/config-stressful-weather.yaml --use-conda -j all -- all_difficult_periods
Adjust the
-j
flag to change how many CPU cores to use. For the first time, consider using the testing configuration instead (config/config-testing.yaml
), which runs the workflow with a much smaller model and fewer years (but which does require the same ERA5 cutouts as the main config). -
Use the
operate_all_networks
rule to run the operations of each network over every weather year.
Readily build unsolved and solved networks as well as the difficult periods computed from them can be found at DOI:10.5281/zenodo.8328689. They are presented in the same format that would be generated by running the present workflow.
The workflow presented here uses fixed software environments (workflow/envs/stressful-weather.fixed.yaml
and workflow/modules/pypsa-eur/envs/environment.fixed.yaml
) as well as a fixed (modified) version of PyPSA-Eur (the commit at which PyPSA-Eur is included as a git submodule in the present repository) meaning that the results should be reproducible.
However, we see no immediate barriers to using newer software versions.
While upstream PyPSA-Eur at the time of writing doesn't support multiple weather years, we expect that once this is supported, the present workflow could be made to work with an unmodified, upstream verion of PyPSA-Eur without much effort.
This project was developed jointly by Koen van Greevenbroek, Aleksander Grochowicz and Hannah Bloomfield.
PyPSA-Eur, included here as a git submodule, is distributed under the MIT licences; see the PyPSA-Eur homepage for more information.
All other code included in this repository is licensed under the GPL-3.0.