Skip to content

Commit

Permalink
Change config structure.
Browse files Browse the repository at this point in the history
Enable a default config and specific configs overwriting the defaults. See idea from PyPSA/pypsa-eur#292 .
  • Loading branch information
euronion committed Dec 1, 2021
1 parent 128cac9 commit 4f04e80
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 159 deletions.
12 changes: 11 additions & 1 deletion Snakefile
Expand Up @@ -2,9 +2,19 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

from pathlib import Path
from snakemake.utils import update_config
from snakemake.io import load_configfile

configfile: "config.yaml"
# Specify config file
configfile: "config/config.initial_paper.yaml"

# Default configs - do not change
default_configfile: "config/config.default.yaml"

# Load default config and overwrite with specific config
config = load_configfile(default_configfile)
update_config(config, load_configfile(configfile))

wildcard_constraints:
year="\d+",
Expand Down
160 changes: 160 additions & 0 deletions config/config.default.yaml
@@ -0,0 +1,160 @@
# SPDX-FileCopyrightText: 2020-2021 Johannes Hampp
#
# SPDX-License-Identifier: GPL-3.0-or-later

logging:
level: INFO

regions:
TRACES:
"AU": "Australia"
"AR": "Argentina"
"DE": "Germany"
"DK": "Denmark"
"EG": "Egypt"
"ES": "Spain"
"MA": "Morocco"
"SA": "Saudi Arabia"
"RU": "Russia"
"UA": "Ukraine"
"KZ": "Kazakhstan"
Australia:
"AU": "Australia"
Argentina:
"AR": "Argentina"
Germany:
"DE": "Germany"
Denmark:
"DK": "Denmark"
Egypt:
"EG": "Egypt"
Spain:
"ES": "Spain"
Morocco:
"MA": "Morocco"
SaudiArabia:
"SA": "Saudi Arabia"
Russia:
"RU": "Russia"
Ukraine:
"UA": "Ukraine"
Kazakhstan:
"KZ": "Kazakhstan"

detour_factors:
transmission_line: 1.2
pipeline: 1.4
shipping: 1.

GlobalEnergyGIS:
# Download GEGIS data files and set home dir for workflow
init_gegis: False
base_dir: "resources/GEGIS/"

synthetic_demand:
# SSP scenario and radiative forcing target to base prediction upon
ssp_scenario: "ssp2-34"
# Year to predict demand for
ssp_year: 2050
solar:
options:
"plant_area": 1.2
"pvroof_area": 0. # no rooftop PV
"pv_density": 1.4523729 # Correspondes to 1.7 MW/km^2 *.854337 (correction factor from PyPSA-EUR)
"csp_density": 0. # no CSP
"distance_elec_access": 400
"classB_threshold": 0.001
"downsample_masks": 2
classes:
min: [ 0. , 0.005, 0.01 , 0.015, 0.02 , 0.025, 0.03 , 0.035, 0.04 ,
0.045, 0.05 , 0.055, 0.06 , 0.065, 0.07 , 0.075, 0.08 , 0.085,
0.09 , 0.095, 0.1 , 0.105, 0.11 , 0.115, 0.12 , 0.125, 0.13 ,
0.135, 0.14 , 0.145, 0.15 , 0.155, 0.16 , 0.165, 0.17 , 0.175,
0.18 , 0.185, 0.19 , 0.195, 0.2 , 0.205, 0.21 , 0.215, 0.22 ,
0.225, 0.23 , 0.235, 0.24 , 0.245, 0.25 , 0.255, 0.26 , 0.265,
0.27 , 0.275, 0.28 , 0.285, 0.29 , 0.295, 0.3 , 0.305, 0.31 ,
0.315, 0.32 , 0.325, 0.33 , 0.335, 0.34 , 0.345, 0.35 , 0.355,
0.36 , 0.365, 0.37 , 0.375, 0.38 , 0.385, 0.39 , 0.395, 0.4 ,
0.405, 0.41 , 0.415, 0.42 , 0.425, 0.43 , 0.435, 0.44 , 0.445,
0.45 , 0.455, 0.46 , 0.465, 0.47 , 0.475, 0.48 , 0.485, 0.49 ,
0.495]
max: [ 0.005, 0.01 , 0.015, 0.02 , 0.025, 0.03 , 0.035, 0.04 , 0.045,
0.05 , 0.055, 0.06 , 0.065, 0.07 , 0.075, 0.08 , 0.085, 0.09 ,
0.095, 0.1 , 0.105, 0.11 , 0.115, 0.12 , 0.125, 0.13 , 0.135,
0.14 , 0.145, 0.15 , 0.155, 0.16 , 0.165, 0.17 , 0.175, 0.18 ,
0.185, 0.19 , 0.195, 0.2 , 0.205, 0.21 , 0.215, 0.22 , 0.225,
0.23 , 0.235, 0.24 , 0.245, 0.25 , 0.255, 0.26 , 0.265, 0.27 ,
0.275, 0.28 , 0.285, 0.29 , 0.295, 0.3 , 0.305, 0.31 , 0.315,
0.32 , 0.325, 0.33 , 0.335, 0.34 , 0.345, 0.35 , 0.355, 0.36 ,
0.365, 0.37 , 0.375, 0.38 , 0.385, 0.39 , 0.395, 0.4 , 0.405,
0.41 , 0.415, 0.42 , 0.425, 0.43 , 0.435, 0.44 , 0.445, 0.45 ,
0.455, 0.46 , 0.465, 0.47 , 0.475, 0.48 , 0.485, 0.49 , 0.495,
1. ]
wind:
options:
"area_onshore": 1.2
"area_offshore": 1.2
"onshore_density": 3.
"offshore_density": 3.
"distance_elec_access": 400
"classB_threshold": 0.001
classes:
min: [ 0. , 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3. ,
3.3, 3.6, 3.9, 4.2, 4.5, 4.8, 5.1, 5.4, 5.7, 6. , 6.3,
6.6, 6.9, 7.2, 7.5, 7.8, 8.1, 8.4, 8.7, 9. , 9.3, 9.6,
9.9, 10.2, 10.5, 10.8, 11.1, 11.4, 11.7, 12. , 12.3, 12.6, 12.9,
13.2, 13.5, 13.8, 14.1, 14.4, 14.7, 15. , 15.3, 15.6, 15.9, 16.2,
16.5, 16.8, 17.1, 17.4, 17.7, 18. , 18.3, 18.6, 18.9, 19.2, 19.5,
19.8, 20.1, 20.4, 20.7, 21. , 21.3, 21.6, 21.9, 22.2, 22.5, 22.8,
23.1, 23.4, 23.7, 24. , 24.3, 24.6, 24.9, 25.2, 25.5, 25.8, 26.1,
26.4, 26.7, 27. , 27.3, 27.6, 27.9, 28.2, 28.5, 28.8, 29.1, 29.4,
29.7]
max: [ 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3. , 3.3,
3.6, 3.9, 4.2, 4.5, 4.8, 5.1, 5.4, 5.7, 6. , 6.3, 6.6,
6.9, 7.2, 7.5, 7.8, 8.1, 8.4, 8.7, 9. , 9.3, 9.6, 9.9,
10.2, 10.5, 10.8, 11.1, 11.4, 11.7, 12. , 12.3, 12.6, 12.9, 13.2,
13.5, 13.8, 14.1, 14.4, 14.7, 15. , 15.3, 15.6, 15.9, 16.2, 16.5,
16.8, 17.1, 17.4, 17.7, 18. , 18.3, 18.6, 18.9, 19.2, 19.5, 19.8,
20.1, 20.4, 20.7, 21. , 21.3, 21.6, 21.9, 22.2, 22.5, 22.8, 23.1,
23.4, 23.7, 24. , 24.3, 24.6, 24.9, 25.2, 25.5, 25.8, 26.1, 26.4,
26.7, 27. , 27.3, 27.6, 27.9, 28.2, 28.5, 28.8, 29.1, 29.4, 29.7,
99. ]

solver:
default:
name: gurobi
Presolve: 1 # Conservative presolving; Aggressive consumes too much memory
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
PreDual: 2 # form primal and dual during presolve, heuristically choose
method: 2 # barrier
crossover: 0 # do not use crossover
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
threads: 8
seed: 10 # Consistent seed for all plattforms
numeric-focus:
name: gurobi
Presolve: 1 # 2=Aggressive presolving
PreDual: 0 # form primal and dual during presolve, heuristically choose
AggFill: 0
NumericFocus: 3 # Favour numeric stability over speed
method: 2 # barrier
crossover: 0 # do not use crossover
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
ScaleFlag: 3
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
ObjScale: 100
seed: 10 # Consistent seed for all plattforms
fallback:
# Use gurobi defaults
name: gurobi
crossover: 0
method: 2 # barrier
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
seed: 10 # Consistent seed for all plattforms
158 changes: 0 additions & 158 deletions config.yaml → config/config.initial_paper.yaml
Expand Up @@ -2,9 +2,6 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

logging:
level: INFO

# Change scenario here or by using the --config scenario=... command line flag
scenarios:
low-elec-cost:
Expand Down Expand Up @@ -223,158 +220,3 @@ scenarios:
CAPEX_electrolysis: 1 # CAPEX of electrolysis
CAPEX_MeOHSynthesis: 1 # CAPEX related to methanol synthesis
CAPEX_pipeline: 1 # CAPEX of pipeline and related technologies (H2 and CH4, submarine and onland, pipeline and pipeline compressors)


regions:
TRACES:
"AU": "Australia"
"AR": "Argentina"
"DE": "Germany"
"DK": "Denmark"
"EG": "Egypt"
"ES": "Spain"
"MA": "Morocco"
"SA": "Saudi Arabia"
"RU": "Russia"
"UA": "Ukraine"
"KZ": "Kazakhstan"
Australia:
"AU": "Australia"
Argentina:
"AR": "Argentina"
Germany:
"DE": "Germany"
Denmark:
"DK": "Denmark"
Egypt:
"EG": "Egypt"
Spain:
"ES": "Spain"
Morocco:
"MA": "Morocco"
SaudiArabia:
"SA": "Saudi Arabia"
Russia:
"RU": "Russia"
Ukraine:
"UA": "Ukraine"
Kazakhstan:
"KZ": "Kazakhstan"

detour_factors:
transmission_line: 1.2
pipeline: 1.4
shipping: 1.

GlobalEnergyGIS:
# Download GEGIS data files and set home dir for workflow
init_gegis: False
base_dir: "resources/GEGIS/"

synthetic_demand:
# SSP scenario and radiative forcing target to base prediction upon
ssp_scenario: "ssp2-34"
# Year to predict demand for
ssp_year: 2050
solar:
options:
"plant_area": 1.2
"pvroof_area": 0. # no rooftop PV
"pv_density": 1.4523729 # Correspondes to 1.7 MW/km^2 *.854337 (correction factor from PyPSA-EUR)
"csp_density": 0. # no CSP
"distance_elec_access": 400
"classB_threshold": 0.001
"downsample_masks": 2
classes:
min: [ 0. , 0.005, 0.01 , 0.015, 0.02 , 0.025, 0.03 , 0.035, 0.04 ,
0.045, 0.05 , 0.055, 0.06 , 0.065, 0.07 , 0.075, 0.08 , 0.085,
0.09 , 0.095, 0.1 , 0.105, 0.11 , 0.115, 0.12 , 0.125, 0.13 ,
0.135, 0.14 , 0.145, 0.15 , 0.155, 0.16 , 0.165, 0.17 , 0.175,
0.18 , 0.185, 0.19 , 0.195, 0.2 , 0.205, 0.21 , 0.215, 0.22 ,
0.225, 0.23 , 0.235, 0.24 , 0.245, 0.25 , 0.255, 0.26 , 0.265,
0.27 , 0.275, 0.28 , 0.285, 0.29 , 0.295, 0.3 , 0.305, 0.31 ,
0.315, 0.32 , 0.325, 0.33 , 0.335, 0.34 , 0.345, 0.35 , 0.355,
0.36 , 0.365, 0.37 , 0.375, 0.38 , 0.385, 0.39 , 0.395, 0.4 ,
0.405, 0.41 , 0.415, 0.42 , 0.425, 0.43 , 0.435, 0.44 , 0.445,
0.45 , 0.455, 0.46 , 0.465, 0.47 , 0.475, 0.48 , 0.485, 0.49 ,
0.495]
max: [ 0.005, 0.01 , 0.015, 0.02 , 0.025, 0.03 , 0.035, 0.04 , 0.045,
0.05 , 0.055, 0.06 , 0.065, 0.07 , 0.075, 0.08 , 0.085, 0.09 ,
0.095, 0.1 , 0.105, 0.11 , 0.115, 0.12 , 0.125, 0.13 , 0.135,
0.14 , 0.145, 0.15 , 0.155, 0.16 , 0.165, 0.17 , 0.175, 0.18 ,
0.185, 0.19 , 0.195, 0.2 , 0.205, 0.21 , 0.215, 0.22 , 0.225,
0.23 , 0.235, 0.24 , 0.245, 0.25 , 0.255, 0.26 , 0.265, 0.27 ,
0.275, 0.28 , 0.285, 0.29 , 0.295, 0.3 , 0.305, 0.31 , 0.315,
0.32 , 0.325, 0.33 , 0.335, 0.34 , 0.345, 0.35 , 0.355, 0.36 ,
0.365, 0.37 , 0.375, 0.38 , 0.385, 0.39 , 0.395, 0.4 , 0.405,
0.41 , 0.415, 0.42 , 0.425, 0.43 , 0.435, 0.44 , 0.445, 0.45 ,
0.455, 0.46 , 0.465, 0.47 , 0.475, 0.48 , 0.485, 0.49 , 0.495,
1. ]
wind:
options:
"area_onshore": 1.2
"area_offshore": 1.2
"onshore_density": 3.
"offshore_density": 3.
"distance_elec_access": 400
"classB_threshold": 0.001
classes:
min: [ 0. , 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3. ,
3.3, 3.6, 3.9, 4.2, 4.5, 4.8, 5.1, 5.4, 5.7, 6. , 6.3,
6.6, 6.9, 7.2, 7.5, 7.8, 8.1, 8.4, 8.7, 9. , 9.3, 9.6,
9.9, 10.2, 10.5, 10.8, 11.1, 11.4, 11.7, 12. , 12.3, 12.6, 12.9,
13.2, 13.5, 13.8, 14.1, 14.4, 14.7, 15. , 15.3, 15.6, 15.9, 16.2,
16.5, 16.8, 17.1, 17.4, 17.7, 18. , 18.3, 18.6, 18.9, 19.2, 19.5,
19.8, 20.1, 20.4, 20.7, 21. , 21.3, 21.6, 21.9, 22.2, 22.5, 22.8,
23.1, 23.4, 23.7, 24. , 24.3, 24.6, 24.9, 25.2, 25.5, 25.8, 26.1,
26.4, 26.7, 27. , 27.3, 27.6, 27.9, 28.2, 28.5, 28.8, 29.1, 29.4,
29.7]
max: [ 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3. , 3.3,
3.6, 3.9, 4.2, 4.5, 4.8, 5.1, 5.4, 5.7, 6. , 6.3, 6.6,
6.9, 7.2, 7.5, 7.8, 8.1, 8.4, 8.7, 9. , 9.3, 9.6, 9.9,
10.2, 10.5, 10.8, 11.1, 11.4, 11.7, 12. , 12.3, 12.6, 12.9, 13.2,
13.5, 13.8, 14.1, 14.4, 14.7, 15. , 15.3, 15.6, 15.9, 16.2, 16.5,
16.8, 17.1, 17.4, 17.7, 18. , 18.3, 18.6, 18.9, 19.2, 19.5, 19.8,
20.1, 20.4, 20.7, 21. , 21.3, 21.6, 21.9, 22.2, 22.5, 22.8, 23.1,
23.4, 23.7, 24. , 24.3, 24.6, 24.9, 25.2, 25.5, 25.8, 26.1, 26.4,
26.7, 27. , 27.3, 27.6, 27.9, 28.2, 28.5, 28.8, 29.1, 29.4, 29.7,
99. ]

solver:
default:
name: gurobi
Presolve: 1 # Conservative presolving; Aggressive consumes too much memory
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
PreDual: 2 # form primal and dual during presolve, heuristically choose
method: 2 # barrier
crossover: 0 # do not use crossover
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
threads: 8
seed: 10 # Consistent seed for all plattforms
numeric-focus:
name: gurobi
Presolve: 1 # 2=Aggressive presolving
PreDual: 0 # form primal and dual during presolve, heuristically choose
AggFill: 0
NumericFocus: 3 # Favour numeric stability over speed
method: 2 # barrier
crossover: 0 # do not use crossover
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
ScaleFlag: 3
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
ObjScale: 100
seed: 10 # Consistent seed for all plattforms
fallback:
# Use gurobi defaults
name: gurobi
crossover: 0
method: 2 # barrier
BarHomogeneous: 1 # Use homogeneous barrier if standard does not converge
BarConvTol: 1.e-5
FeasibilityTol: 1.e-5
OptimalityTol: 1.e-5
seed: 10 # Consistent seed for all plattforms

0 comments on commit 4f04e80

Please sign in to comment.