Skip to content

Commit 2ccb92f

Browse files
authored
Merge branch 'main' into fix_docu
2 parents 5cce73f + daed4a4 commit 2ccb92f

27 files changed

+1960
-23224
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ __pycache__
1414

1515
/site/**
1616
!/resources/data/shapefiles/
17-
!/resources/**/*.csv
17+
# !/resources/**/*.csv
1818
/resources/**/*
1919
/resources/derived_data/
2020
/resources/data/province_shapes
2121
/resources/data/landuse_availability/World_EEZ/*eez*
2222
/workflow/scripts/*.pdf
23+
/workflow/notebooks/*.py
24+
/workflow/notebooks/*.ipynb
2325
/results
2426
!/results/.gitkeep
2527
/cutouts
28+
/workflow/scripts/*.pdf
2629
/logs
2730
/benchmarks
2831
/tests/derived_data/**

Remind-PyPSA-coupling

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 25d56dc033957a964661f5f70c856886c8e7f530

config/default_config.yaml

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# DO NOT FORGET TO LOOK AT THE TECHNOLOGY CONFIGURATION FILES
55

66
run:
7-
name: unamed_run
7+
name:
88
foresight: "overnight"
99

1010
paths:
@@ -35,6 +35,7 @@ scenario:
3535
- 2060
3636
heating_demand: ["positive"]
3737

38+
# emission reduction scenarios (can be selected with scenario.co2_pathway)
3839
co2_scenarios:
3940
exp175default:
4041
control: "reduction" # price | reduction | budget | None
@@ -47,15 +48,16 @@ co2_scenarios:
4748
'2045': 0.79092165
4849
'2050': 0.87480618
4950
'2055': 0.94359322
50-
'2060': 1.0
51+
'2060': 1
5152

52-
# TODO Need to test timezones and functionality of end_year_plus1
53+
# Time dimension
54+
# TODO Need to test functionality of end_year_plus1
5355
snapshots:
5456
start: "01-01 00:00"
5557
end: "12-31 23:00"
5658
bounds: 'both'
57-
freq: '5h'
58-
# test weighings -> to be improved
59+
freq: '5h' # down to 1h
60+
# for weighings -> to be improved
5961
frequency: 5.
6062
# in case snapshots cross the planning horizon year
6163
end_year_plus1: false
@@ -88,6 +90,8 @@ atlite:
8890
dy: 5
8991
weather_year: 2020
9092

93+
# renewable potentials and availabilities from Atlite.
94+
# !CARE cutout should match atlite.cutout_name above
9195
renewable:
9296
onwind:
9397
cutout: China-2020c
@@ -151,7 +155,9 @@ reporting:
151155
# This ensures consistent capacity reporting across the network
152156
adjust_link_capacities_by_efficiency: true
153157

154-
bus_suffix: [""," central heat"," decentral heat"," gas"," coal"]
158+
159+
# Network carriers and technologies
160+
bus_suffix: [""," central heat"," decentral heat"," gas"," coal"] #TODO check used
155161
bus_carrier: {
156162
"": "AC",
157163
" central heat": "heat",
@@ -161,12 +167,15 @@ bus_carrier: {
161167
}
162168

163169
Techs:
164-
## for add carriers and generators - but ugly to have nuclear and biomass and heatpupm in vre
170+
## tech selection
171+
#TODO: rework vre_techs to split with clean_techs. Merge vre with non_dispatchable
165172
vre_techs: [ "onwind","offwind","solar","solar thermal","hydroelectricity", "nuclear","biomass","beccs","heat pump","resistive heater","Sabatier","H2 CHP", "fuel cell"]
173+
non_dispatchable: ['Offshore Wind', 'Onshore Wind', 'Solar', 'Solar Residential', "Solar Thermal"]
166174
conv_techs: ["OCGT", "CCGT", "CHP gas", "gas boiler","coal boiler","coal power plant","CHP coal"]
167175
store_techs: ["H2","battery","water tanks","PHS"]
168-
coal_cc: true # currently myopic pathway only. CC = co2 cap
169-
hydrogen_lines: true # currently myopic pathway only
176+
non_dispatchable: ["onwind", "offwind", "solar", "solar thermal"]
177+
hydrogen_lines: true
178+
coal_ccs_retrofit: true # currently myopic pathway only. CC = co2 cap
170179

171180
## add components (overwrites vre tech choice)
172181
heat_coupling: false
@@ -205,6 +214,7 @@ solving:
205214
clip_p_max_pu: 0.01
206215
skip_iterations: false
207216
track_iterations: false
217+
export_duals: true # Single switch for dual functionality
208218

209219
solver:
210220
name: gurobi
@@ -276,6 +286,15 @@ solving:
276286

277287
mem: 80000 #memory in MB; 20 GB enough for 50+B+I+H2; 100 GB for 181+B+I+H2
278288

289+
# brownfield options
290+
existing_capacities:
291+
add: True # whether to add brownfield capacities
292+
grouping_years: [1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015, 2019, 2020, 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2060]
293+
collapse_years: False # Treat as a single unit when preparing & solving network
294+
threshold_capacity: 1 # TODO UNIT
295+
techs: ['coal','CHP coal', 'CHP gas', 'OCGT', 'CCGT', 'solar', 'onwind', 'offwind', 'nuclear']
296+
297+
# transmission options
279298
lines:
280299
line_length_factor: 1.25
281300
expansion:
@@ -285,17 +304,44 @@ lines:
285304
security:
286305
line_margin: 70 # max percent of line capacity
287306

288-
existing_capacities:
289-
add: True
290-
grouping_years: [1980,1985, 1990, 1995, 2000, 2005, 2010, 2015, 2019, 2020, 2025, 2030, 2035, 2040, 2045, 2050, 2055, 2060]
291-
threshold_capacity: 1 # TODO UNIT
292-
techs: ['coal','CHP coal', 'CHP gas', 'OCGT', 'CCGT', 'solar', 'solar thermal', 'onwind', 'offwind','coal boiler','ground heat pump','nuclear']
293-
294-
fetch_regions:
295-
simplify_tol: 0.5
307+
# contingencies (slower!) -> epsilon is fraction of vre gen or load for which reserves should exist
308+
operational_reserve:
309+
activate: false
310+
epsilon_load: 0.02
311+
epsilon_vres: 0.02
312+
contingency: 300000 # MW. Additional reserves on top of fractions
296313

314+
# TODO integrate in workflow: split_provinces is currently not supported by build_loads and reporting
315+
nodes:
316+
split_provinces: False # split (some) provinces (admin l1) using admin l2 (counties/prefectures)
317+
# exclude currently only applies if split_provinces is True, will be fixed with integrartion to workflow
318+
exclude_provinces: ["Macau", "HongKong"] # list of provinces to exclude from splitting
319+
splits:
320+
# adminl2 groups per adminl1. {adminl1: {custom_name: [adminl2_names],..}}
321+
InnerMongolia:
322+
West:
323+
- "Hulunbuir"
324+
- "Xing'an"
325+
- "Tongliao"
326+
- "Chifeng"
327+
- "Xilin Gol"
328+
East:
329+
- "Alxa"
330+
- "Baotou"
331+
- "Baynnur"
332+
- "Hohhot"
333+
- "Ordos"
334+
- "Ulaan Chab"
335+
- "Wuhai"
297336

337+
# compression of netcdf network objects
298338
io:
299339
nc_compression:
300340
level: 4
301-
zlib: True
341+
zlib: True
342+
343+
# simplification of shapes to save memory. If using GPS for plant node assignment a lower value is preferable.
344+
fetch_regions:
345+
simplify_tol:
346+
eez: 0.5
347+
land: 0.05

config/pik_hpc_profile/config.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ cluster-generic-cancel-cmd: scancel
4646

4747
# now define the resources
4848
default-resources:
49-
partition: standard
50-
qos: short
49+
partition: priority
50+
qos: priority
5151
mem_mb: 2000
5252
time : 10
5353
threads: 1
@@ -57,7 +57,7 @@ set-resources:
5757
mem_mb: 80000
5858
time: 80
5959
solve_networks:
60-
mem_mb: 60000
60+
mem_mb: 90000
6161
time : 80
6262
threads: 6
6363
build_cutout:
@@ -115,9 +115,10 @@ set-resources:
115115
# GROUPS
116116

117117
groups:
118-
plot_network: plot
119-
plot_statistics: plot
120-
plot_snapshots: plot
118+
# plot_network: plot
119+
# plot_statistics: plot
120+
# plot_snapshots: plot
121+
prep_capacities: prepare_baseyear_capacities
121122
build_load_profiles: build_load
122123
prepare_networks: prep_network
123124
add_existing_baseyear: prep_network2
@@ -127,4 +128,5 @@ group-components:
127128
build_load: 3
128129
prep_network: 3
129130
prep_network2: 3
130-
summary: 3
131+
summary: 3
132+
prep_capacities: 3

config/plot_config.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ plotting:
5858
costs_threshold: 2.e+6 # Eur
5959
energy_threshold: 5.e+6 # MWh
6060
capacity_threshold: 1.e+4 # MW
61-
61+
market_value:
62+
min_gen_share: 0.01
6263
loads: ['electricity', 'decentral heat', 'central heat']
6364
vre_techs: [ "onwind", "offwind", "solar"]
6465
conv_techs: [ "gas", "gas-heat", "gas-AC", "AC-gas", "coal", "coal-AC","solar thermal","AC-heat","AC-AC","stations-AC","uranium", "H2-AC", "H2-gas",]
@@ -139,12 +140,15 @@ plotting:
139140
Gas: '#e0986c'
140141
OCGT: '#e0986c'
141142
OCGT gas: '#e0986c'
143+
gas ocgt: '#e0986c'
142144
gas OCGT: '#e0986c'
145+
Open-Cycle Gas: '#e0986c'
143146
OCGT marginal: '#e0986c'
144147
OCGT-heat: '#e0986c'
145148
CCGT: '#a85522'
146-
CCGT gas: '#a85522'
149+
CCGT marginal: '#a85522'
147150
gas CCGT: '#a85522'
151+
CCGT gas: '#a85522'
148152
gas ccs: '#a85522'
149153
CCGT-CCS: '#76855B'
150154
gas CCGT-CCS: '#76855B'
@@ -161,9 +165,6 @@ plotting:
161165
fossil gas: '#e05b09'
162166
natural gas: '#e05b09'
163167
biogas to gas: '#e36311'
164-
CCGT: '#a85522'
165-
CCGT marginal: '#a85522'
166-
gas CCGT: '#a85522'
167168
allam: '#B98F76'
168169
gas for industry co2 to atmosphere: '#692e0a'
169170
gas for industry co2 to stored: '#8a3400'
@@ -172,8 +173,6 @@ plotting:
172173
gas pipeline: '#ebbca0'
173174
gas pipeline new: '#a87c62'
174175
gas-AC: "grey"
175-
176-
177176
# hot water storage
178177
water tanks: '#e69487'
179178
residential rural water tanks: '#f7b7a3'
@@ -226,8 +225,9 @@ plotting:
226225
CHP coal: '#8a5751'
227226
CHP coal generator: '#8a5751'
228227
coal heat: '#8a7f7d'
229-
urban central gas CHP: '#8f6e6a'
228+
gas CHP: '#8f6e6a'
230229
CHP gas: '#8f6e6a'
230+
central gas CHP: '#8f6e6a'
231231
CHP gas generator: '#8f6e6a'
232232
CHP gas boiler: '#8f6e6a'
233233
CHP CC: '#634643'
@@ -401,6 +401,7 @@ plotting:
401401
CHP: "Combined Heat and Power"
402402
OCGT: "Open-Cycle Gas"
403403
gas OCGT: "Open-Cycle Gas"
404+
Gas Ocgt: "Open-Cycle Gas"
404405
CCGT: "Combined-Cycle Gas"
405406
gas CCGT: "Combined-Cycle Gas"
406407
gas ccs: "Gas with Carbon Capture"
@@ -411,6 +412,7 @@ plotting:
411412
# generatord
412413
battery: "Battery Storage"
413414
battery discharger: "Battery Discharger"
415+
# coal: "Coal"
414416
coal: "Coal Power Plant"
415417
coal cc: "Coal with carbon capture"
416418
coal ccs: "Coal with carbon capture"
@@ -419,15 +421,10 @@ plotting:
419421
hydro: "Reservoir & Dam"
420422
H2 fuel cell: "H2 Fuel Cell"
421423
PHS: "Pumped Hydro Storage"
422-
offwind: "Offshore Wind"
423-
onwind: "Onshore Wind"
424-
solar: "Solar"
425424
# H2: "Hydrogen Power"
426425
ror: "Run of River"
427-
solar thermal: "Solar Thermal"
428426
uranium: "Nuclear"
429427
hydroelectricity: "Hydroelectricity"
430-
coal: "Coal"
431428
offwind: "Offshore Wind"
432429
onwind: "Onshore Wind"
433430
solar: "Solar"

workflow/Snakefile

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -436,33 +436,20 @@ rule dag:
436436
"""
437437

438438
onerror:
439-
log_out = expand(LOG_DIR + "/_latest_snakemake.log", **config["scenario"])[0]
440439
res_dir = expand(RESULTS_DIR, **config["scenario"])[0]
441440
if not os.path.exists(res_dir):
442441
os.makedirs(res_dir)
443-
if not os.path.exists(LOG_DIR):
444-
os.makedirs(LOG_DIR)
445-
# log path is available from snakemake as "log"
446442
try:
447-
shutil.copy(log, os.path.dirname(log_out))
448443
yaml.dump(config, open(res_dir + "/run_config.yaml", "w"))
449444
except FileNotFoundError as e:
450445
logging.warning(f"Could not copy log file: {e}")
451446
except TypeError as e:
452447
logging.warning(f"Could not copy config file: {e}")
453-
logging.warning(f"Copying log file to {str(log_out)} failed?")
454-
logging.warning(f"saving config file to {str(res_dir)}/run_config.yaml failed?")
455448

456449
onsuccess:
457-
log_out = expand(LOG_DIR + "/_latest_snakemake.log", **config["scenario"])[0]
458450
res_dir = expand(RESULTS_DIR, **config["scenario"])[0]
459451
try:
460-
shutil.copy(log, log_out)
461-
yaml.dump(config, open(res_dir + "/run_config.yaml", "w"))
462-
except FileNotFoundError as e:
463-
logging.warning(f"Could not copy log file: {e}")
452+
with open(res_dir + "/run_config.yaml", "w") as f:
453+
yaml.dump(config, f )
464454
except TypeError as e:
465455
logging.warning(f"Could not copy config file: {e}")
466-
logging.warning(f"Copying log file to {str(log_out)} (type {type(log_out)}) failed?")
467-
logging.info(f"source was {str(log)}")
468-
logging.warning(f"sav config file to {str(res_dir)}/run_config.yaml failed?")

workflow/envs/environment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ dependencies:
1010
- python>=3.12
1111
- pip
1212

13-
- pypsa=0.31
14-
- atlite>=0.2.6
13+
- pypsa=0.35.1
14+
- atlite>=0.4.0
1515
- dask
1616
- snakemake-storage-plugin-http
1717
# - pyasyncore
@@ -23,7 +23,7 @@ dependencies:
2323
- openpyxl
2424
- pycountry
2525
- seaborn
26-
- snakemake-minimal>=8.0
26+
- snakemake-minimal>=9.0
2727
- memory_profiler
2828
- yaml
2929
- pytables

0 commit comments

Comments
 (0)