Wildcards

It is easy to run PyPSA-RSA for multiple scenarios using the wildcards feature of snakemake. Wildcards allow to generalise a rule to produce all files that follow a regular expression pattern which e.g. defines one particular scenario. One can think of a wildcard as a parameter that shows up in the input/output file names of the Snakefile and thereby determines which rules to run, what data to retrieve and what files to produce.

Detailed explanations of how wildcards work in snakemake can be found in the relevant section of the documentation.

The {resarea} wildcard

The {resarea} wildcard specifies whether to contrain renewable generators to Renewable Energy Development Zones or strategic transmission corridors.

Trigger

Description

Definition

Status

redz

Restrict renewables expansion to Phase 1 and Phase 2 Renewable Energy Development Zones (REDZs)

In active use

corridors

Restrict renewables expansion to strategic transmission corridors

In active use

The {model_file} wildcard

The {model_file} wildcard specifies the technology cost assumptions to use from the input spreadsheet. Cost assumptions in model_file.xlsx

Trigger

Description

Definition

Status

za-original

cost assumption in PyPSA-ZA: Investment and operation co-optimization of integrating wind and solar in South Africa at high spatial and temporal detail

In active use

za-updated

cost assumption in PyPSA-ZA: Investment and operation co-optimization of integrating wind and solar in South Africa at high spatial and temporal detail

In active use

IRP-2019

https://www.energy.gov.za/irp/2019/IRP-2019.pdf

In active use

validation-1

https://researchspace.csir.co.za/dspace/handle/10204/11483

In active use

validation-2

https://researchspace.csir.co.za/dspace/handle/10204/11483

In active use

validation-3

https://researchspace.csir.co.za/dspace/handle/10204/11483

In active use

validation-4

https://researchspace.csir.co.za/dspace/handle/10204/11483

In active use

validation-5

https://researchspace.csir.co.za/dspace/handle/10204/11483

In active use

The {ll} wildcard

The {ll} wildcard specifies what limits on line expansion are set for the optimisation model. It is handled in the rule prepare_network.

The wildcard, in general, consists of two parts:

  1. The first part can be v (for setting a limit on line volume) or c (for setting a limit on line cost)

  2. The second part can be opt or a float bigger than one (e.g. 1.25).

    1. If opt is chosen line expansion is optimised according to its capital cost (where the choice v only considers overhead costs for HVDC transmission lines, while c uses more accurate costs distinguishing between overhead and underwater sections and including inverter pairs).

    2. v1.25 will limit the total volume of line expansion to 25 % of currently installed capacities weighted by individual line lengths; investment costs are neglected.

    3. c1.25 will allow to build a transmission network that costs no more than 25 % more than the current system.

The {opts} wildcard

The {opts} wildcard triggers optional constraints, which are activated in either prepare_network or the solve_network step. It may hold multiple triggers separated by -, i.e. Co2L-3H contains the Co2L trigger and the 3H switch. There are currently:

Trigger

Description

Definition

Status

nH; i.e. 2H-6H

Resample the time-resolution by averaging over every n snapshots

prepare_network: average_every_nhours() and its caller)

In active use

nSEG; e.g. 4380SEG

Apply time series segmentation with tsam package to n adjacent snapshots of varying lengths based on capacity factors of varying renewables, hydro inflow and load.

prepare_network: apply_time_segmentation()

In active use

Co2L

Add an overall absolute carbon-dioxide emissions limit configured in electricity: co2limit. If a float is appended an overall emission limit relative to the emission level given in electricity: co2base is added (e.g. Co2L0.05 limits emissisions to 5% of what is given in electricity: co2base)

prepare_network: add_co2limit() and its caller

In active use

Ep

Add cost for a carbon-dioxide price configured in costs: emission_prices: co2 to marginal_cost of generators (other emission types listed in network.carriers possible as well)

prepare_network: add_emission_prices() and its caller

In active use

CCL

Add minimum and maximum levels of generator nominal capacity per carrier for individual countries. These can be specified in the file linked at electricity: agg_p_nom_limits in the configuration. File defaults to data/agg_p_nom_minmax.csv.

solve_network

In active use

EQ

Require each country or node to on average produce a minimal share of its total consumption itself. Example: EQ0.5c demands each country to produce on average at least 50% of its consumption; EQ0.5 demands each node to produce on average at least 50% of its consumption.

solve_network

In active use

ATK

Require each node to be autarkic. Example: ATK removes all lines and links. ATKc removes all cross-border lines and links.

prepare_network

In active use

BAU

Add a per-carrier minimal overall capacity; i.e. at least 40GW of OCGT in Europe; configured in electricity: BAU_mincapacities

solve_network: add_opts_constraints()

Untested

SAFE

Add a capacity reserve margin of a certain fraction above the peak demand to which renewable generators and storage do not contribute. Ignores network.

solve_network add_opts_constraints()

Untested

carrier+{c|p|m}factor

Alter the capital cost (c), installable potential (p) or marginal costs (m) of a carrier by a factor. Example: solar+c0.5 reduces the capital cost of solar to 50% of original values.

prepare_network

In active use

CH4L

Add an overall absolute gas limit. If configured in electricity: gaslimit it is given in MWh thermal, if a float is appended, the overall gaslimit is assumed to be given in TWh thermal (e.g. CH4L200 limits gas dispatch to 200 TWh termal)

prepare_network: add_gaslimit()

In active use

The {regions} wildcard

The PyPSA-RSA models can be narrowed to various number of nodes using the {regions} wildcard.

If regions=27-supply, then the rule build_topology setups 27 nodes based on the shape files. If otherwise regions=RSA, regions=9-supply, regions=10-supply, then the network is narrowed to n number of buses for the South African network.

The {cutout} wildcard

The {cutout} wildcard facilitates running the rule build_cutout for all cutout configurations specified under atlite: cutouts:. These cutouts will be stored in a folder specified by {cutout}.

The {technology} wildcard

The {technology} wildcard specifies for which renewable energy technology to produce availability time series and potentials using the rule build_renewable_profiles. It can take the values onwind and solar but not hydro (since hydroelectric plant profiles are created by a different rule).

The wildcard can moreover be used to create technology specific figures and summaries. For instance {technology} can be used to plot regionally disaggregated potentials with the rule plot_p_nom_max.

The {attr} wildcard

The {attr} wildcard specifies which attribute is used for size representations of network components on a map plot produced by the rule plot_network. While it might be extended in the future, {attr} currently only supports plotting of p_nom.

The {ext} wildcard

The {ext} wildcard specifies the file type of the figures the rule plot_network produce. Typical examples are pdf and png. The list of supported file formats depends on the used backend. To query the supported file types on your system, issue:

import matplotlib.pyplot as plt
plt.gcf().canvas.get_supported_filetypes()