Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

PyPSA-Eur-MGA: Analysing the Near-Optimal of a Renewable Power System Model


Models for long-term investment planning of the power system typically return a single optimal solution per set of cost assumptions. However, typically there are many near-optimal alternatives that stand out due to other attractive properties like social acceptance. Understanding features that persist across many cost-efficient alternatives enhances policy advice and acknowledges structural model uncertainties. We apply the modeling-to-generate-alternatives (MGA) methodology to systematically explore the near-optimal feasible space of a completely renewable European electricity system model. While accounting for complex spatio-temporal patterns, we allow simultaneous capacity expansion of generation, storage and transmission infrastructure subject to linearized multi-period optimal power flow. Many similarly costly, but technologically diverse solutions exist. Already a cost deviation of 0.5% offers a large range of possible investments. However, either offshore or onshore wind energy along with some hydrogen storage and transmission network reinforcement are essential to keep costs within 10% of the optimum.

Installation and Usage

Clone the main repository and the PyPSA-Eur submodule

../ % git clone --recurse-submodules

Install and activate the conda environment with

conda env create -f environment.yaml
conda activate pypsa-eur-mga


TODO: workflow chart

  • solve_base: Solves the network to optimality using the regular cost-minimisation objective, which serves as reference value for the MGA iterations.
  • generate_list_of_alternatives: Generates a list of alternative objectives defining the power system component, its carrier filter, and the optimisation sense as <COMPONENT>+<CARRIER>+<SENSE>. Each experiment corresponds to one MGA iteration. This is a snakemake checkpoint.
  • generate_alternative: Solves the network to optimality with the original cost-minimisation objective as constraint with the cost minimum plus some slack {epsilon} as upper bound. The new objective is built from the {objective} wildcard (from generate_list_of_alternatives).
  • extract_results: Collects and exports results of all near-optimal solutions into several .csv files.
  • extract_curtailment: Extracts curtailment data into a separate .csv file.
  • extract_gini: Calculates and exports the Gini coefficient of different near-optimal solutions.


There is some plotting functionality provided in scripts/plotting which can be used for example in scripts/plotting.ipynb.


TODO: Data on zenodo.


Snakemake workflow for modelling-to-generate-alternatives with PyPSA-Eur






No packages published