|Jeroen Peters 97985e3c52 Fix by changing po.Constraint.Skip into pypsa.opt.Constraint.Skip||4 weeks ago|
|data||4 weeks ago|
|img||10 months ago|
|resources||8 months ago|
|results||1 year ago|
|scripts||4 weeks ago|
|.gitattributes||1 year ago|
|.gitignore||11 months ago|
|LICENSE.txt||11 months ago|
|README.md||1 month ago|
|Snakefile||4 months ago|
|borg-it||1 year ago|
|cluster.yaml||5 months ago|
|config.yaml||4 weeks ago|
|environment.fixedversions.yaml||4 months ago|
|environment.yaml||1 month ago|
|matplotlibrc||10 months ago|
PyPSA-Eur is an open model dataset of the European power system at the transmission network level that covers the full ENTSO-E area.
The model is described and partially validated in the paper PyPSA-Eur: An Open Optimisation Model of the European Transmission System, 2018, arXiv:1806.01613.
This repository contains the scripts and some of the data required to automatically build the dataset from openly-available sources.
Already-built versions of the model can be found in the accompanying Zenodo repository.
The model is designed to be imported into the open toolbox PyPSA for operational studies as well as generation and transmission expansion planning studies.
The dataset consists of:
Building the model with the scripts in this repository uses up to 20GB of memory. Computing optimal investment and operation scenarios requires a strong interior-point solver compatible with the modelling library PYOMO like Gurobi or CPLEX with up to 100GB of memory (for the 356-bus approximation).
This project is maintained by the Energy System Modelling group at the Institute for Automation and Applied Informatics at the Karlsruhe Institute of Technology. It is currently funded by the Helmholtz Association. Previous versions were developed 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.
The steps are demonstrated as shell commands, where the path before the
% sign denotes the
directory in which the commands following the
% should be entered.
Clone the repository using
git (to a directory without any spaces in the path)
/some/other/path % cd /some/path/without/spaces /some/path/without/spaces % git clone https://github.com/PyPSA/pypsa-eur.git
The python package requirements are curated in the conda environment.yaml file. The environment can be installed and activated using
.../pypsa-eur % conda env create -f environment.yaml .../pypsa-eur % conda activate pypsa-eur # or source activate pypsa-eur on older linux installations
Note that activation is local to the currently open shell! After opening a new terminal window, one needs to reissue the second command!
Not all data dependencies are shipped with the git repository (since git is not suited for handling large changing files). Instead we provide two separate data bundles:
datasubdirectory (so that all files are in the
shell .../pypsa-eur/data % curl -OL "https://vfs.fias.science/d/0a0ca1e2fb/files/?dl=1&p=/pypsa-eur-data-bundle.tar.xz" .../pypsa-eur/data % tar xJf pypsa-eur-data-bundle.tar.xz
pypsa-eur-cutouts.tar.xz are spatiotemporal subsets of the European weather data from the ECMWF ERA5 reanalysis dataset and the CMSAF SARAH-2 solar surface radiation dataset for the year 2013. They have been prepared by and are for use with the atlite tool. You can either generate them yourself using the
build_cutouts snakemake rule or extract them directly in the
pypsa-eur directory (extracting the bundle is recommended, since procuring the source weather data files for atlite is not properly documented at the moment):
.../pypsa-eur % curl -OL "https://vfs.fias.science/d/0a0ca1e2fb/files/?dl=1&p=/pypsa-eur-cutouts.tar.xz" .../pypsa-eur % tar xJf pypsa-eur-cutouts.tar.xz
Optionally, you can download a rasterized version of the NATURA dataset natura.tiff and put it into the
resources sub-directory. If you don’t, it will be generated automatically, which takes several hours.
.../pypsa-eur % curl -L "https://vfs.fias.science/d/0a0ca1e2fb/files/?p=/natura.tiff&dl=1" -o "resources/natura.tiff"
pypsa-eur-cutouts.tar.xzonce extracting the bundles is complete. E.g.
.../pypsa-eur % rm -rf data/pypsa-eur-data-bundle.tar.xz pypsa-eur-cutouts.tar.xz
The model has several configuration options collected in the config.yaml file located in the root directory.
The generation of the model is controlled by the workflow management system
Snakemake. In a nutshell, one declares in the
Snakefile for each python script in the
scripts directory a rule which
describes which files the scripts consume and produce.
snakemake then runs the
scripts in the correct order and is able to track, what parts of the workflow
have to be regenerated, when a data file or script is updated. For instance,
with the Snakefile of pypsa-eur, an invocation to
In detail this means it has to run the independent scripts,
build_shapesto generate GeoJSON files with country, exclusive economic zones and nuts3 shapes
build_cutoutto prepare smaller weather data portions from ERA5 for cutout
europe-2013-era5and SARAH for cutout
With these and the externally extracted
ENTSO-E online map topology, it can build the PyPSA basis model
links, and in
build_bus_regionsdetermine the Voronoi cell of each substation.
Then it hands these over to the scripts for generating renewable and hydro feedin data,
build_hydro_profilefor the hourly hydro energy availability,
build_renewable_potentialsfor the landuse/natura2000 constrained installation potentials for PV and wind,
build_renewable_profilesfor the PV and wind hourly capacity factors in each Voronoi cell.
build_powerplantsuses powerplantmatching to determine today’s thermal power plant capacities and then locates the closest substation for each powerplant.
The central rule
add_electricity then ties all the different data inputs together to a detailed PyPSA model stored in
It further adds extendable
storage_units with zero capacity for
OCGTis listed in
The additional rules prepare approximations of the full model, in which generation, storage and transmission capacities can be co-optimized
simplify_networktransforms the transmission grid to a 380 kV-only equivalent network, while
cluster_networkuses a kmeans based clustering technique to partition the network into a certain number of zones and then reduce the network to a representation with one bus per zone.
The simplification and clustering steps are described in detail in the paper The role of spatial scale in joint optimisations of generation and transmission for European highly renewable scenarios, 2017, arXiv:1705.07617, doi:10.1109/EEM.2017.7982024.
After generating the network it can be solved by using ‘solve_all_elec_networks’. This runs the following rules:
The following rule can be used to summarize the results in seperate .csv files:
snakemake results/summaries/elec_s_all_lall_Co2L-3H_all ^ clusters ^ line volume or cost cap ^- options ^- all countries
the line volume/cost cap field can be set to one of the following:
lv1.25for a particular line volume extension by 25%
lc1.25for a line cost extension by 25 %
lallfor all evalutated caps
lvallfor all line volume caps
lcallfor all line cost caps
Replacing ‘/summaries/’ with ‘/plots/’ creates nice colored maps of the results.
Default choice for the solver is Gurobi (freely available under academic license) or CPLEX. If you want to go fully opensource the CBC solver (https://projects.coin-or.org/Cbc) can be used. To install CBC run ‘conda install -c conda-forge coincbc’.
For the use of
snakemake, it makes sense to familiarize oneself quickly with its basic tutorial and then read carefully through the section Executing Snakemake, noting the arguments
-r, but also
The dependency graph shown above was generated using
snakemake --dag networks/elec_s_128.nc | dot -Tpng > dependency-graph-elec_s_128.png