Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft modular config structure #1174

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2f555d0
Add a geometry config
ekatef Nov 6, 2024
f70a6b0
Add a heating config
ekatef Nov 6, 2024
7b3f4a4
Add monte-carlo config
ekatef Nov 6, 2024
792d4a8
Add a plotting config
ekatef Nov 6, 2024
770951e
Add a solving config
ekatef Nov 6, 2024
457c66a
Add a transport config
ekatef Nov 6, 2024
0e554c5
Add a weather config
ekatef Nov 6, 2024
a8ecb2c
Clean-up the default config
ekatef Nov 6, 2024
17b1345
Add an electricity config
ekatef Nov 6, 2024
2b46e5e
Move solar thermal to the weather config
ekatef Nov 6, 2024
f1a0c14
Add a hydrogen config
ekatef Nov 6, 2024
a38a287
Add a costs config
ekatef Nov 6, 2024
fcdef01
Rename a geometry config
ekatef Nov 11, 2024
a054730
Merge the config-related files
ekatef Nov 11, 2024
414a21c
Merge the solving-related files
ekatef Nov 11, 2024
829d978
Include the modular configs into the workflow
ekatef Nov 11, 2024
8b77535
Revert "Merge the config-related files"
ekatef Nov 11, 2024
ccd98ec
Consolidate the configs related to cross-sectoral modelling
ekatef Nov 11, 2024
a0139ff
Remove the default config
ekatef Nov 11, 2024
f8015a0
Merge branch 'main' into structure_config
ekatef Jan 2, 2025
aace26a
Move sector parameters to the sector config
ekatef Jan 2, 2025
b52adf1
Add the missed sector scenario
ekatef Jan 2, 2025
628807a
Add a missed shape parameter
ekatef Jan 2, 2025
41fe6d7
Comment-out the default configuration file
ekatef Jan 2, 2025
f3ab5c7
Draft the config output
ekatef Jan 2, 2025
bad96d8
Add main config
ekatef Jan 3, 2025
edd2ed9
Merge branch 'main' into structure_config
ekatef Jan 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ from _helpers import (
get_last_commit_message,
check_config_version,
copy_default_files,
write_config,
)
from build_demand_profiles import get_load_paths_gegis
from retrieve_databundle_light import datafiles_retrivedatabundle
Expand All @@ -27,13 +28,22 @@ HTTP = HTTPRemoteProvider()
copy_default_files()


configfile: "config.default.yaml"
# configfile: "config.default.yaml"
configfile: "configs/bundle_config.yaml"
configfile: "configs/powerplantmatching_config.yaml"
configfile: "configs/config.main.yaml"
configfile: "configs/config.spatial.yaml"
configfile: "configs/config.weather.yaml"
configfile: "configs/config.elec.yaml"
configfile: "configs/config.sector.yaml"
configfile: "configs/config.costs.yaml"
configfile: "configs/config.solve.yaml"
configfile: "configs/config.plot.yaml"
configfile: "config.yaml"


check_config_version(config=config)
write_config(config)
# check_config_version(config=config)

config.update({"git_commit": get_last_commit_message(".")})

Expand Down
999 changes: 0 additions & 999 deletions config.default.yaml

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions configs/config.costs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# SPDX-FileCopyrightText: PyPSA-Earth and PyPSA-Eur Authors
#
# SPDX-License-Identifier: CC0-1.0

version: 0.4.1

# TODO: Needs to be adjusted for Africa.
costs:
year: 2030
version: v0.6.2
discountrate: [0.071] #, 0.086, 0.111]
# [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html # noqa: E501
USD2013_to_EUR2013: 0.7532 # [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html
rooftop_share: 0.14 # based on the potentials, assuming (0.1 kW/m2 and 10 m2/person)
fill_values:
FOM: 0
VOM: 0
efficiency: 1
fuel: 0
investment: 0
lifetime: 25
CO2 intensity: 0
discount rate: 0.07
marginal_cost: # EUR/MWh
solar: 0.01
onwind: 0.015
offwind: 0.015
hydro: 0.
H2: 0.
electrolysis: 0.
fuel cell: 0.
battery: 0.
battery inverter: 0.
emission_prices: # in currency per tonne emission, only used with the option Ep
co2: 0.
# investment: # EUR/MW
# CCGT: 830000
# FOM: # %/year
# CCGT: 3.35
# VOM: # EUR/MWh
# CCGT: 4.2
# fuel: # EUR/MWh
# gas: 10.1
# lifetime: # years
# CCGT: 25.0
# efficiency: # per unit
# CCGT: 0.58
lines:
length_factor: 1.25 #to estimate offwind connection costs
99 changes: 99 additions & 0 deletions configs/config.elec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# SPDX-FileCopyrightText: PyPSA-Earth and PyPSA-Eur Authors
#
# SPDX-License-Identifier: CC0-1.0

version: 0.4.1

clean_osm_data_options: # osm = OpenStreetMap
names_by_shapes: true # Set the country name based on the extended country shapes
threshold_voltage: 51000 # [V] minimum voltage threshold to keep the asset (cable, line, generator, etc.) [V]
tag_substation: "transmission" # Filters only substations with 'transmission' tag, ('distribution' also available)
add_line_endings: true # When "True", then line endings are added to the dataset of the substations
generator_name_method: OSM # Methodology to specify the name to the generator. Options: OSM (name as by OSM dataset), closest_city (name by the closest city)
use_custom_lines: "OSM_only" # Use OSM (OSM_only), customized (custom_only), or both data sets (add_custom)
path_custom_lines: false # If exists, provide the specific absolute path of the custom file e.g. (...\data\custom_lines.geojson)
use_custom_substations: "OSM_only" # Use OSM (OSM_only), customized (custom_only), or both data sets (add_custom)
path_custom_substations: false # If exists, provide the specific absolute path of the custom file e.g. (...\data\custom_substations.geojson)
use_custom_cables: "OSM_only" # Use OSM (OSM_only), customized (custom_only), or both data sets (add_custom)
path_custom_cables: false # If exists, provide the specific absolute path of the custom file e.g. (...\data\custom_cables.geojson)

# download_osm_data_nprocesses: 10 # (optional) number of threads used to download osm data

build_osm_network: # Options of the build_osm_network script; osm = OpenStreetMap
group_close_buses: true # When "True", close buses are merged and guarantee the voltage matching among line endings
group_tolerance_buses: 5000 # [m] (default 5000) Tolerance in meters of the close buses to merge
split_overpassing_lines: true # When True, lines overpassing buses are splitted and connected to the bueses
overpassing_lines_tolerance: 1 # [m] (default 1) Tolerance to identify lines overpassing buses
force_ac: false # When true, it forces all components (lines and substation) to be AC-only. To be used if DC assets create problem.

base_network:
min_voltage_substation_offshore: 51000 # [V] minimum voltage of the offshore substations
min_voltage_rebase_voltage: 51000 # [V] minimum voltage in base network

electricity:
base_voltage: 380.
voltages: [132., 220., 300., 380., 500., 750.]
co2limit: 7.75e+7 # European default, 0.05 * 3.1e9*0.5, needs to be adjusted for Africa
co2base: 1.487e+9 # European default, adjustment to Africa necessary
agg_p_nom_limits: data/agg_p_nom_minmax.csv
hvdc_as_lines: false # should HVDC lines be modeled as `Line` or as `Link` component?
automatic_emission: false
automatic_emission_base_year: 1990 # 1990 is taken as default. Any year from 1970 to 2018 can be selected.

operational_reserve: # like https://genxproject.github.io/GenX/dev/core/#Reserves
activate: false
epsilon_load: 0.02 # share of total load
epsilon_vres: 0.02 # share of total renewable supply
contingency: 0 # fixed capacity in MW

max_hours:
battery: 6
H2: 168

extendable_carriers:
Generator: [solar, onwind, offwind-ac, offwind-dc, OCGT]
StorageUnit: [] # battery, H2
Store: [battery, H2]
Link: [] # H2 pipeline

powerplants_filter: (DateOut >= 2022 or DateOut != DateOut)
custom_powerplants: false # "false" use only powerplantmatching (ppm) data, "merge" combines ppm and custom powerplants, "replace" use only custom powerplants

conventional_carriers: [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass]
renewable_carriers: [solar, onwind, offwind-ac, offwind-dc, hydro]

estimate_renewable_capacities:
stats: "irena" # False, = greenfield expansion, 'irena' uses IRENA stats to add expansion limits
year: 2023 # Reference year, available years for IRENA stats are 2000 to 2023
p_nom_min: 1 # any float, scales the minimum expansion acquired from stats, i.e. 110% of <years>'s capacities => p_nom_min: 1.1
p_nom_max: false # sets the expansion constraint, False to deactivate this option and use estimated renewable potentials determine by the workflow, float scales the p_nom_min factor accordingly
technology_mapping:
# Wind is the Fueltype in ppm.data.Capacity_stats, onwind, offwind-{ac,dc} the carrier in PyPSA-Earth
Offshore: [offwind-ac, offwind-dc]
Onshore: [onwind]
PV: [solar]

lines:
ac_types:
132.: "243-AL1/39-ST1A 20.0"
220.: "Al/St 240/40 2-bundle 220.0"
300.: "Al/St 240/40 3-bundle 300.0"
380.: "Al/St 240/40 4-bundle 380.0"
500.: "Al/St 240/40 4-bundle 380.0"
750.: "Al/St 560/50 4-bundle 750.0"
dc_types:
500.: "HVDC XLPE 1000"
s_max_pu: 0.7
s_nom_max: .inf
length_factor: 1.25
under_construction: "zero" # 'zero': set capacity to zero, 'remove': remove, 'keep': with full capacity

links:
p_max_pu: 1.0
p_nom_max: .inf
under_construction: "zero" # 'zero': set capacity to zero, 'remove': remove, 'keep': with full capacity

transformers:
x: 0.1
s_nom: 2000.
type: ""
77 changes: 77 additions & 0 deletions configs/config.main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# SPDX-FileCopyrightText: PyPSA-Earth and PyPSA-Eur Authors
#
# SPDX-License-Identifier: CC0-1.0

version: 0.6.0
tutorial: false

logging:
level: INFO
format: "%(levelname)s:%(name)s:%(message)s"

results_dir: results/
summary_dir: results/
costs_dir: data/ # TODO change to the equivalent of technology data

foresight: overnight

# Can be replaced by country ["NG", "BJ"], continent ["Africa"] or user-specific region, see more at https://pypsa-earth.readthedocs.io/en/latest/configuration.html#top-level-configuration
countries: ["KZ"]

enable:
retrieve_databundle: true # Recommended 'true', for the first run. Otherwise data might be missing.
retrieve_databundle_sector: true
retrieve_cost_data: true # true: retrieves cost data from technology data and saves in resources/costs.csv, false: uses cost data in data/costs.csv
download_osm_data: true # If 'true', OpenStreetMap data will be downloaded for the above given countries
build_natura_raster: false # If True, then an exclusion raster will be build
build_cutout: false
# If "build_cutout" : true, then environmental data is extracted according to `snapshots` date range and `countries`
# requires cds API key https://cds.climate.copernicus.eu/api-how-to
# More information https://atlite.readthedocs.io/en/latest/introduction.html#datasets
progress_bar: true # show progress bar during downloading routines and other long-running tasks

custom_rules: [] # Default empty [] or link to custom rule file e.g. ["my_folder/my_rules.smk"] that add rules to Snakefile

run:
name: "" # use this to keep track of runs with different settings
sector_name: "" # use this to keep track of sector scenario runs
shared_cutouts: true # set to true to share the default cutout(s) across runs
# Note: value false requires build_cutout to be enabled
allow_scenario_failure: false # If True, the workflow will continue even if a scenario in run_scnenario fails

scenario:
simpl: [""]
ll: ["copt"]
clusters: [10]
opts: [Co2L-3H]
planning_horizons: # investment years for myopic and perfect; or costs year for overnight
- 2030
sopts:
- "144H"
demand:
- "AB"

snapshots:
start: "2013-01-01"
end: "2013-01-07"
inclusive: "left" # end is not inclusive

augmented_line_connection:
add_to_snakefile: false # If True, includes this rule to the workflow
connectivity_upgrade: 2 # Min. lines connection per node,
# https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.connectivity.edge_augmentation.k_edge_augmentation.html#networkx.algorithms.connectivity.edge_augmentation.k_edge_augmentation
new_line_type: ["HVAC"] # Expanded lines can be either ["HVAC"] or ["HVDC"] or both ["HVAC", "HVDC"]
min_expansion: 1 # [MW] New created line expands by float/int input
min_DC_length: 600 # [km] Minimum line length of DC line

load_options:
ssp: "ssp2-2.6" # shared socio-economic pathway (GDP and population growth) scenario to consider
prediction_year: 2030 # Load scenarios available with different prediction year (GDP, population)
scale: 1 # scales all load time-series, i.e. 2 = doubles load

# originates from sector part
demand_data:
update_data: true # if true, the workflow downloads the energy balances data saved in data/demand/unsd/data again. Turn on for the first run.
base_year: 2019
other_industries: false # Whether or not to include industries that are not specified. some countries have has exaggerated numbers, check carefully.
aluminium_year: 2019 # Year of the aluminium demand data specified in `data/AL_production.csv`
Loading
Loading