Skip to content

Commit 40efe61

Browse files
author
Micha
authored
add option for UBA target, rename functions and variables (#93)
* add option for UBA target, rename functions and variables * fix 2030-50 budget trajectory * typo
1 parent ecca399 commit 40efe61

3 files changed

Lines changed: 49 additions & 34 deletions

File tree

config/scenarios.manual.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ CurrentPolicies:
2121
# TODO: wait for REMod v1.0 to upload a first Trend scenario
2222
reference_scenario: Trend # CurrentPolicies once it's renamed
2323

24+
co2_budget_DE_source: UBA
25+
2426
co2_budget:
2527
2020: 0.800 # 20% reduction by 2020
2628
2025: 0.600
@@ -123,6 +125,7 @@ KN2045_Bal_v4:
123125

124126
iiasa_database:
125127
reference_scenario: 8Gt_Bal_v3
128+
co2_budget_DE_source: KSG
126129

127130
costs:
128131
horizon: "mean"
@@ -181,6 +184,7 @@ KN2045_Elec_v4:
181184

182185
iiasa_database:
183186
reference_scenario: 8Gt_Elec_v3
187+
co2_budget_DE_source: KSG
184188

185189
costs:
186190
horizon: "mean"
@@ -238,6 +242,7 @@ KN2045_H2_v4:
238242

239243
iiasa_database:
240244
reference_scenario: 8Gt_H2_v3
245+
co2_budget_DE_source: KSG
241246

242247
costs:
243248
horizon: "mean"
@@ -298,6 +303,7 @@ KN2045plus_EasyRide:
298303
# Verlagerung der energieintensiven Grundstoffindustrie
299304
iiasa_database:
300305
reference_scenario: 8Gt_EasyRide_v3 # TODO: wait for database
306+
co2_budget_DE_source: KSG
301307

302308
costs:
303309
horizon: "optimist"
@@ -380,6 +386,7 @@ KN2045plus_LowDemand:
380386
# innerhalb Deutschlands und knappe Importe EE möglich
381387
iiasa_database:
382388
reference_scenario: 8Gt_LowDemand_v3 # TODO: wait for database
389+
co2_budget_DE_source: KSG
383390

384391
costs:
385392
horizon: "optimist"
@@ -466,6 +473,8 @@ KN2045minus_WorstCase:
466473
iiasa_database:
467474
reference_scenario: 8Gt_WorstCase_v3 # TODO: wait for database
468475

476+
co2_budget_DE_source: UBA
477+
469478
co2_budget:
470479
2020: 0.800 # 20% reduction by 2020
471480
2025: 0.600
@@ -561,6 +570,7 @@ KN2045minus_SupplyFocus:
561570
horizon: "pessimist"
562571
NEP: 2023
563572
transmission: "underground" # either overhead line ("overhead") or underground cable ("underground")
573+
co2_budget_DE_source: UBA
564574

565575
co2_budget:
566576
2020: 0.800 # 20% reduction by 2020

workflow/Snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ rule ariadne_all:
392392

393393
rule build_scenarios:
394394
params:
395-
scenario_name=config_provider("run", "name"),
395+
scenarios=config_provider("run", "name"),
396396
input:
397397
ariadne_database=resources("ariadne_database.csv"),
398398
scenario_yaml="config/scenarios.manual.yaml",

workflow/scripts/build_scenarios.py

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -77,55 +77,62 @@ def get_primary_steel_share(df, planning_horizons):
7777

7878
return primary_steel_share.set_index(pd.Index(["Primary_Steel_Share"]))
7979

80-
def get_ksg_targets(df):
80+
def get_co2_budget(df, source):
8181
# relative to the DE emissions in 1990 *including bunkers*; also
8282
# account for non-CO2 GHG and allow extra room for international
8383
# bunkers which are excluded from the national targets
8484

8585
# Baseline emission in DE in 1990 in Mt as understood by the KSG and by PyPSA
86-
baseline_ksg = 1251
86+
baseline_co2 = 1251
8787
baseline_pypsa = 1052
88+
if source == "KSG":
89+
## GHG targets according to KSG
90+
initial_years_co2 = pd.Series(
91+
index = [2020, 2025, 2030],
92+
data = [813, 643, 438],
93+
)
8894

89-
## GHG targets according to KSG
90-
initial_years_ksg = pd.Series(
91-
index = [2020, 2025, 2030],
92-
data = [813, 643, 438],
93-
)
94-
95-
later_years_ksg = pd.Series(
96-
index = [2035, 2040, 2045, 2050],
97-
data = [0.77, 0.88, 1.0, 1.0],
98-
)
99-
100-
targets_ksg = pd.concat(
101-
[initial_years_ksg, (1 - later_years_ksg) * baseline_ksg],
102-
)
95+
later_years_co2 = pd.Series(
96+
index = [2035, 2040, 2045, 2050],
97+
data = [0.77, 0.88, 1.0, 1.0],
98+
)
10399

100+
targets_co2 = pd.concat(
101+
[initial_years_co2, (1 - later_years_co2) * baseline_co2],
102+
)
103+
elif source == "UBA":
104+
## For Zielverfehlungsszenarien use UBA Projektionsbericht
105+
targets_co2 = pd.Series(
106+
index = [2020, 2025, 2030, 2035, 2040, 2045, 2050],
107+
data = [813, 655, 455, 309, 210, 169, 157],
108+
)
109+
else:
110+
raise ValueError("Invalid source for CO2 budget.")
104111
## Compute nonco2 from Ariadne-Leitmodell (REMIND)
105112

106-
co2_ksg = (
113+
co2 = (
107114
df.loc["Emissions|CO2 incl Bunkers","Mt CO2/yr"]
108115
- df.loc["Emissions|CO2|Land-Use Change","Mt CO2-equiv/yr"]
109116
- df.loc["Emissions|CO2|Energy|Demand|Bunkers","Mt CO2/yr"]
110117
)
111118

112-
ghg_ksg = (
119+
ghg = (
113120
df.loc["Emissions|Kyoto Gases","Mt CO2-equiv/yr"]
114121
- df.loc["Emissions|Kyoto Gases|Land-Use Change","Mt CO2-equiv/yr"]
115122
# No Kyoto Gas emissions for Bunkers recorded in Ariadne DB
116123
)
117124

118-
nonco2 = ghg_ksg - co2_ksg
125+
nonco2 = ghg - co2
119126

120127
## PyPSA disregards nonco2 GHG emissions, but includes bunkers
121128

122129
targets_pypsa = (
123-
targets_ksg - nonco2
130+
targets_co2 - nonco2
124131
+ df.loc["Emissions|CO2|Energy|Demand|Bunkers","Mt CO2/yr"]
125132
)
126133

127134
target_fractions_pypsa = (
128-
targets_pypsa.loc[targets_ksg.index] / baseline_pypsa
135+
targets_pypsa.loc[targets_co2.index] / baseline_pypsa
129136
)
130137

131138
return target_fractions_pypsa.round(3)
@@ -140,14 +147,13 @@ def write_to_scenario_yaml(
140147
for scenario in scenarios:
141148
reference_scenario = config[scenario]["iiasa_database"]["reference_scenario"]
142149
if scenario == "CurrentPolicies":
143-
ksg_target_fractions = get_ksg_targets(
144-
df.loc["REMIND-EU v1.1", "8Gt_Bal_v3"]
145-
)
146-
ksg_target_fractions[[2035, 2040, 2045]] = ksg_target_fractions[2030]
147-
else:
148-
ksg_target_fractions = get_ksg_targets(
149-
df.loc["REMIND-EU v1.1", reference_scenario]
150-
)
150+
reference_scenario = "8Gt_Bal_v3" # hotfix until DB is updated
151+
co2_budget_source = config[scenario]["co2_budget_DE_source"]
152+
153+
co2_budget_fractions = get_co2_budget(
154+
df.loc["REMIND-EU v1.1", "8Gt_Bal_v3"],
155+
co2_budget_source
156+
)
151157

152158
planning_horizons = [2020, 2025, 2030, 2035, 2040, 2045] # for 2050 we still need data
153159

@@ -192,10 +198,9 @@ def write_to_scenario_yaml(
192198
for year in st_primary_fraction.columns:
193199
config[scenario]["industry"]["St_primary_fraction"][year] = round(st_primary_fraction.loc["Primary_Steel_Share", year].item(), 4)
194200
config[scenario]["co2_budget_national"] = {}
195-
for year, target in ksg_target_fractions.items():
201+
for year, target in co2_budget_fractions.items():
196202
config[scenario]["co2_budget_national"][year] = {}
197-
target_value = float(ksg_target_fractions[2030]) if year > 2030 and scenario == "CurrentPolicies" else target
198-
config[scenario]["co2_budget_national"][year]["DE"] = target_value
203+
config[scenario]["co2_budget_national"][year]["DE"] = target
199204

200205
# write back to yaml file
201206
yaml.dump(config, Path(output))
@@ -225,7 +230,7 @@ def write_to_scenario_yaml(
225230
:,
226231
"Deutschland"]
227232

228-
scenarios = snakemake.params.scenario_name
233+
scenarios = snakemake.params.scenarios
229234

230235
input = snakemake.input.scenario_yaml
231236
output = snakemake.output.scenario_yaml

0 commit comments

Comments
 (0)