Passed
Pull Request — dev (#1181)
by
unknown
05:34
created

data.datasets.scenario_parameters.parameters   B

Complexity

Total Complexity 41

Size/Duplication

Total Lines 1317
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 41
eloc 816
dl 0
loc 1317
rs 8.904
c 0
b 0
f 0

8 Functions

Rating   Name   Duplication   Size   Complexity  
A read_costs() 0 14 3
A annualize_capital_costs() 0 23 1
A read_csv() 0 6 1
C heat() 0 255 7
C mobility() 0 115 6
D electricity() 0 533 9
C gas() 0 219 8
C global_settings() 0 129 6

How to fix   Complexity   

Complexity

Complex classes like data.datasets.scenario_parameters.parameters often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
"""The module containing all parameters for the scenario table
2
"""
3
4
import pandas as pd
5
6
import egon.data.config
7
8
9
def read_csv(year):
10
    source = egon.data.config.datasets()["pypsa-technology-data"]["targets"][
11
        "data_dir"
12
    ]
13
14
    return pd.read_csv(f"{source}costs_{year}.csv")
15
16
17
def read_costs(df, technology, parameter, value_only=True):
18
    result = df.loc[
19
        (df.technology == technology) & (df.parameter == parameter)
20
    ].squeeze()
21
22
    # Rescale costs to EUR/MW
23
    if "EUR/kW" in result.unit:
24
        result.value *= 1e3
25
        result.unit = result.unit.replace("kW", "MW")
26
27
    if value_only:
28
        return result.value
29
    else:
30
        return result
31
32
33
def annualize_capital_costs(overnight_costs, lifetime, p):
34
    """
35
36
    Parameters
37
    ----------
38
    overnight_costs : float
39
        Overnight investment costs in EUR/MW or EUR/MW/km
40
    lifetime : int
41
        Number of years in which payments will be made
42
    p : float
43
        Interest rate in p.u.
44
45
    Returns
46
    -------
47
    float
48
        Annualized capital costs in EUR/MW/a or EUR/MW/km/a
49
50
    """
51
52
    # Calculate present value of an annuity (PVA)
53
    PVA = (1 / p) - (1 / (p * (1 + p) ** lifetime))
54
55
    return overnight_costs / PVA
56
57
58
def global_settings(scenario):
59
    """Returns global paramaters for the selected scenario.
60
61
    Parameters
62
    ----------
63
    scenario : str
64
        Name of the scenario.
65
66
    Returns
67
    -------
68
    parameters : dict
69
        List of global parameters
70
71
    """
72
73
    if scenario == "eGon2035":
74
        parameters = {
75
            "weather_year": 2011,
76
            "population_year": 2035,
77
            "fuel_costs": {  # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 39, table 6
78
                "oil": 73.8,  # [EUR/MWh]
79
                "gas": 25.6,  # [EUR/MWh]
80
                "coal": 20.2,  # [EUR/MWh]
81
                "lignite": 4.0,  # [EUR/MWh]
82
                "nuclear": 1.7,  # [EUR/MWh]
83
                "biomass": 40,  # Dummyvalue, ToDo: Find a suitable source
84
            },
85
            "co2_costs": 76.5,  # [EUR/t_CO2]
86
            "co2_emissions": {  # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8
87
                "waste": 0.165,  # [t_CO2/MW_th]
88
                "lignite": 0.393,  # [t_CO2/MW_th]
89
                "gas": 0.201,  # [t_CO2/MW_th]
90
                "nuclear": 0.0,  # [t_CO2/MW_th]
91
                "oil": 0.288,  # [t_CO2/MW_th]
92
                "coal": 0.335,  # [t_CO2/MW_th]
93
                "other_non_renewable": 0.268,  # [t_CO2/MW_th]
94
            },
95
            "interest_rate": 0.05,  # [p.u.]
96
        }
97
98
    elif scenario == "eGon100RE":
99
        parameters = {
100
            "weather_year": 2011,
101
            "population_year": 2050,
102
            "fuel_costs": {  # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 39, table 6
103
                "oil": 73.8,  # [EUR/MWh]
104
                "gas": 25.6,  # [EUR/MWh]
105
                "coal": 20.2,  # [EUR/MWh]
106
                "lignite": 4.0,  # [EUR/MWh]
107
                "nuclear": 1.7,  # [EUR/MWh]
108
            },
109
            "co2_costs": 76.5,  # [EUR/t_CO2]
110
            "co2_emissions": {  # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8
111
                "waste": 0.165,  # [t_CO2/MW_th]
112
                "lignite": 0.393,  # [t_CO2/MW_th]
113
                "gas": 0.201,  # [t_CO2/MW_th]
114
                "nuclear": 0.0,  # [t_CO2/MW_th]
115
                "oil": 0.288,  # [t_CO2/MW_th]
116
                "coal": 0.335,  # [t_CO2/MW_th]
117
                "other_non_renewable": 0.268,  # [t_CO2/MW_th]
118
            },
119
            "interest_rate": 0.05,  # [p.u.]
120
        }
121
122
    elif scenario == "eGon2021":
123
        parameters = {
124
            "weather_year": 2011,
125
            "population_year": 2021,
126
        }
127
128
    elif scenario == "status2023":
129
        parameters = {
130
            "weather_year": 2023,
131
            "population_year": 2019,  # TODO: check if possible for 2023
132
            "fuel_costs": {
133
                # TYNDP 2020, data for 2023 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/)
134
                "oil": 16.4 * 3.6,  # [EUR/MWh]
135
                "gas": 6.1 * 3.6,  # [EUR/MWh]
136
                "coal": 3.4 * 3.6,  # [EUR/MWh]
137
                "lignite": 1.1 * 3.6,  # [EUR/MWh]
138
                "nuclear": 0.47 * 3.6,  # [EUR/MWh]
139
                "biomass": read_costs(read_csv(2020), "biomass", "fuel"),
140
            },
141
            "co2_costs": 83.66,  # [EUR/t_CO2], source:
142
            # https://www.iwr.de/news/co2-emissionshandel-deutschland-erzielt-2023-rekordeinnahmen-von-ueber-18-mrd-euro-news38528
143
            "co2_emissions": {
144
                # Netzentwicklungsplan Strom 2037, Genehmigtr Scenariorahmen, p. 66, table 21
145
                # https://www.netzentwicklungsplan.de/sites/default/files/2023-01/Szenariorahmen_2037_Genehmigung.pdf
146
                "waste": 0.165,  # [t_CO2/MW_th]
147
                "lignite": 0.393,  # [t_CO2/MW_th]
148
                "gas": 0.201,  # [t_CO2/MW_th]
149
                "nuclear": 0.0,  # [t_CO2/MW_th]
150
                "oil": 0.288,  # [t_CO2/MW_th]
151
                "coal": 0.337,  # [t_CO2/MW_th]
152
                "other_non_renewable": 0.268,  # [t_CO2/MW_th]
153
            },
154
            "interest_rate": 0.05,  # [p.u.]
155
        }
156
157
    elif scenario == "status2019":
158
        parameters = {
159
            "weather_year": 2011,
160
            "population_year": 2019,
161
            "fuel_costs": {  # TYNDP 2020, data for 2020 (https://2020.entsos-tyndp-scenarios.eu/fuel-commodities-and-carbon-prices/)
162
                "oil": 12.9*3.6,  # [EUR/MWh]
163
                "gas": 5.6*3.6,  # [EUR/MWh]
164
                "coal": 3.0*3.6,  # [EUR/MWh]
165
                "lignite": 1.1*3.6,  # [EUR/MWh]
166
                "nuclear": 0.47*3.6,  # [EUR/MWh]
167
                "biomass": read_costs(read_csv(2020), "biomass", "fuel"),
168
            },
169
            "co2_costs": 24.7,  # [EUR/t_CO2], source:
170
                #https://de.statista.com/statistik/daten/studie/1304069/umfrage/preisentwicklung-von-co2-emissionsrechten-in-eu/
171
            "co2_emissions": {  # Netzentwicklungsplan Strom 2035, Version 2021, 1. Entwurf, p. 40, table 8
172
                "waste": 0.165,  # [t_CO2/MW_th]
173
                "lignite": 0.393,  # [t_CO2/MW_th]
174
                "gas": 0.201,  # [t_CO2/MW_th]
175
                "nuclear": 0.0,  # [t_CO2/MW_th]
176
                "oil": 0.288,  # [t_CO2/MW_th]
177
                "coal": 0.335,  # [t_CO2/MW_th]
178
                "other_non_renewable": 0.268,  # [t_CO2/MW_th]
179
            },
180
            "interest_rate": 0.05,  # [p.u.]
181
        }
182
183
    else:
184
        print(f"Scenario name {scenario} is not valid.")
185
186
    return parameters
0 ignored issues
show
introduced by
The variable parameters does not seem to be defined for all execution paths.
Loading history...
187
188
189
def electricity(scenario):
190
    """Returns paramaters of the electricity sector for the selected scenario.
191
192
    Parameters
193
    ----------
194
    scenario : str
195
        Name of the scenario.
196
197
    Returns
198
    -------
199
    parameters : dict
200
        List of parameters of electricity sector
201
202
    """
203
204
    if scenario == "eGon2035":
205
        costs = read_csv(2035)
206
207
        parameters = {"grid_topology": "Status Quo"}
208
        # Insert effciencies in p.u.
209
        parameters["efficiency"] = {
210
            "oil": read_costs(costs, "oil", "efficiency"),
211
            "battery": {
212
                "store": read_costs(costs, "battery inverter", "efficiency")
213
                ** 0.5,
214
                "dispatch": read_costs(costs, "battery inverter", "efficiency")
215
                ** 0.5,
216
                "standing_loss": 0,
217
                "max_hours": 6,
218
                "cyclic_state_of_charge": True,
219
            },
220
            "pumped_hydro": {
221
                "store": read_costs(costs, "PHS", "efficiency") ** 0.5,
222
                "dispatch": read_costs(costs, "PHS", "efficiency") ** 0.5,
223
                "standing_loss": 0,
224
                "max_hours": 6,
225
                "cyclic_state_of_charge": True,
226
            },
227
        }
228
        # Warning: Electrical parameters are set in osmTGmod, editing these values will not change the data!
229
        parameters["electrical_parameters"] = {
230
            "ac_line_110kV": {
231
                "s_nom": 260,  # [MVA]
232
                "R": 0.109,  # [Ohm/km]
233
                "L": 1.2,  # [mH/km]
234
            },
235
            "ac_cable_110kV": {
236
                "s_nom": 280,  # [MVA]
237
                "R": 0.0177,  # [Ohm/km]
238
                "L": 0.3,  # [mH/km]
239
            },
240
            "ac_line_220kV": {
241
                "s_nom": 520,  # [MVA]
242
                "R": 0.109,  # [Ohm/km]
243
                "L": 1.0,  # [mH/km]
244
            },
245
            "ac_cable_220kV": {
246
                "s_nom": 550,  # [MVA]
247
                "R": 0.0176,  # [Ohm/km]
248
                "L": 0.3,  # [mH/km]
249
            },
250
            "ac_line_380kV": {
251
                "s_nom": 1790,  # [MVA]
252
                "R": 0.028,  # [Ohm/km]
253
                "L": 0.8,  # [mH/km]
254
            },
255
            "ac_cable_380kV": {
256
                "s_nom": 925,  # [MVA]
257
                "R": 0.0175,  # [Ohm/km]
258
                "L": 0.3,  # [mH/km]
259
            },
260
        }
261
262
        # Insert overnight investment costs
263
        # Source for eHV grid costs: Netzentwicklungsplan Strom 2035, Version 2021, 2. Entwurf
264
        # Source for HV lines and cables: Dena Verteilnetzstudie 2021, p. 146
265
        parameters["overnight_cost"] = {
266
            "ac_ehv_overhead_line": 2.5e6
267
            / (
268
                2
269
                * parameters["electrical_parameters"]["ac_line_380kV"]["s_nom"]
270
            ),  # [EUR/km/MW]
271
            "ac_ehv_cable": 11.5e6
272
            / (
273
                2
274
                * parameters["electrical_parameters"]["ac_cable_380kV"][
275
                    "s_nom"
276
                ]
277
            ),  # [EUR/km/MW]
278
            "ac_hv_overhead_line": 0.06e6
279
            / parameters["electrical_parameters"]["ac_line_110kV"][
280
                "s_nom"
281
            ],  # [EUR/km/MW]
282
            "ac_hv_cable": 0.8e6
283
            / parameters["electrical_parameters"]["ac_cable_110kV"][
284
                "s_nom"
285
            ],  # [EUR/km/MW]
286
            "dc_overhead_line": 0.5e3,  # [EUR/km/MW]
287
            "dc_cable": 3.25e3,  # [EUR/km/MW]
288
            "dc_inverter": 0.3e6,  # [EUR/MW]
289
            "transformer_380_110": 17.33e3,  # [EUR/MVA]
290
            "transformer_380_220": 13.33e3,  # [EUR/MVA]
291
            "transformer_220_110": 17.5e3,  # [EUR/MVA]
292
            "battery inverter": read_costs(
293
                costs, "battery inverter", "investment"
294
            ),
295
            "battery storage": read_costs(
296
                costs, "battery storage", "investment"
297
            ),
298
        }
299
300
        parameters["lifetime"] = {
301
            "ac_ehv_overhead_line": read_costs(
302
                costs, "HVAC overhead", "lifetime"
303
            ),
304
            "ac_ehv_cable": read_costs(costs, "HVAC overhead", "lifetime"),
305
            "ac_hv_overhead_line": read_costs(
306
                costs, "HVAC overhead", "lifetime"
307
            ),
308
            "ac_hv_cable": read_costs(costs, "HVAC overhead", "lifetime"),
309
            "dc_overhead_line": read_costs(costs, "HVDC overhead", "lifetime"),
310
            "dc_cable": read_costs(costs, "HVDC overhead", "lifetime"),
311
            "dc_inverter": read_costs(costs, "HVDC inverter pair", "lifetime"),
312
            "transformer_380_110": read_costs(
313
                costs, "HVAC overhead", "lifetime"
314
            ),
315
            "transformer_380_220": read_costs(
316
                costs, "HVAC overhead", "lifetime"
317
            ),
318
            "transformer_220_110": read_costs(
319
                costs, "HVAC overhead", "lifetime"
320
            ),
321
            "battery inverter": read_costs(
322
                costs, "battery inverter", "lifetime"
323
            ),
324
            "battery storage": read_costs(
325
                costs, "battery storage", "lifetime"
326
            ),
327
        }
328
        # Insert annualized capital costs
329
        # lines in EUR/km/MW/a
330
        # transfermer, inverter, battery in EUR/MW/a
331
        parameters["capital_cost"] = {}
332
333
        for comp in parameters["overnight_cost"].keys():
334
            parameters["capital_cost"][comp] = annualize_capital_costs(
335
                parameters["overnight_cost"][comp],
336
                parameters["lifetime"][comp],
337
                global_settings("eGon2035")["interest_rate"],
338
            )
339
340
        parameters["capital_cost"]["battery"] = (
341
            parameters["capital_cost"]["battery inverter"]
342
            + parameters["efficiency"]["battery"]["max_hours"]
343
            * parameters["capital_cost"]["battery storage"]
344
        )
345
346
        # Insert marginal_costs in EUR/MWh
347
        # marginal cost can include fuel, C02 and operation and maintenance costs
348
        parameters["marginal_cost"] = {
349
            "oil": global_settings(scenario)["fuel_costs"]["oil"]
350
            / read_costs(costs, "oil", "efficiency")
351
            + read_costs(costs, "oil", "VOM")
352
            + global_settings(scenario)["co2_costs"]
353
            * global_settings(scenario)["co2_emissions"]["oil"]
354
            / read_costs(costs, "oil", "efficiency"),
355
            "other_non_renewable": global_settings(scenario)["fuel_costs"][
356
                "gas"
357
            ] / read_costs(costs, "OCGT", "efficiency")
358
            + global_settings(scenario)["co2_costs"]
359
            * global_settings(scenario)["co2_emissions"][
360
                "other_non_renewable"
361
            ] / read_costs(costs, "OCGT", "efficiency"),
362
            "lignite": global_settings(scenario)["fuel_costs"]["lignite"]
363
            / read_costs(costs, "lignite", "efficiency")
364
            + read_costs(costs, "lignite", "VOM")
365
            + global_settings(scenario)["co2_costs"]
366
            * global_settings(scenario)["co2_emissions"]["lignite"]
367
            / read_costs(costs, "lignite", "efficiency"),
368
            "coal": global_settings(scenario)["fuel_costs"]["coal"]
369
            / read_costs(costs, "coal", "efficiency")
370
            + read_costs(costs, "coal", "VOM")
371
            + global_settings(scenario)["co2_costs"]
372
            * global_settings(scenario)["co2_emissions"]["coal"]
373
            / read_costs(costs, "coal", "efficiency"),
374
            "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"]
375
            / read_costs(costs, "nuclear", "efficiency")
376
            + read_costs(costs, "nuclear", "VOM"),
377
            "biomass": global_settings(scenario)["fuel_costs"]["biomass"]
378
            / read_costs(costs, "biomass", "efficiency")
379
            + read_costs(costs, "biomass CHP", "VOM"),
380
            "wind_offshore": read_costs(costs, "offwind", "VOM"),
381
            "wind_onshore": read_costs(costs, "onwind", "VOM"),
382
            "solar": read_costs(costs, "solar", "VOM"),
383
        }
384
385
    elif scenario == "eGon100RE":
386
        costs = read_csv(2050)
387
388
        parameters = {"grid_topology": "Status Quo"}
389
390
        # Insert effciencies in p.u.
391
        parameters["efficiency"] = {
392
            "battery": {
393
                "store": read_costs(costs, "battery inverter", "efficiency")
394
                ** 0.5,
395
                "dispatch": read_costs(costs, "battery inverter", "efficiency")
396
                ** 0.5,
397
                "standing_loss": 0,
398
                "max_hours": 6,
399
                "cyclic_state_of_charge": True,
400
            },
401
            "pumped_hydro": {
402
                "store": read_costs(costs, "PHS", "efficiency") ** 0.5,
403
                "dispatch": read_costs(costs, "PHS", "efficiency") ** 0.5,
404
                "standing_loss": 0,
405
                "max_hours": 6,
406
                "cyclic_state_of_charge": True,
407
            },
408
        }
409
        # Warning: Electrical parameters are set in osmTGmod, editing these values will not change the data!
410
        parameters["electrical_parameters"] = {
411
            "ac_line_110kV": {
412
                "s_nom": 260,  # [MVA]
413
                "R": 0.109,  # [Ohm/km]
414
                "L": 1.2,  # [mH/km]
415
            },
416
            "ac_cable_110kV": {
417
                "s_nom": 280,  # [MVA]
418
                "R": 0.0177,  # [Ohm/km]
419
                "L": 0.3,  # [mH/km]
420
            },
421
            "ac_line_220kV": {
422
                "s_nom": 520,  # [MVA]
423
                "R": 0.109,  # [Ohm/km]
424
                "L": 1.0,  # [mH/km]
425
            },
426
            "ac_cable_220kV": {
427
                "s_nom": 550,  # [MVA]
428
                "R": 0.0176,  # [Ohm/km]
429
                "L": 0.3,  # [mH/km]
430
            },
431
            "ac_line_380kV": {
432
                "s_nom": 1790,  # [MVA]
433
                "R": 0.028,  # [Ohm/km]
434
                "L": 0.8,  # [mH/km]
435
            },
436
            "ac_cable_380kV": {
437
                "s_nom": 925,  # [MVA]
438
                "R": 0.0175,  # [Ohm/km]
439
                "L": 0.3,  # [mH/km]
440
            },
441
        }
442
443
        # Insert overnight investment costs
444
        # Source for transformer costs: Netzentwicklungsplan Strom 2035, Version 2021, 2. Entwurf
445
        # Source for HV lines and cables: Dena Verteilnetzstudie 2021, p. 146
446
        parameters["overnight_cost"] = {
447
            "ac_ehv_overhead_line": read_costs(
448
                costs, "HVAC overhead", "investment"
449
            ),  # [EUR/km/MW]
450
            "ac_hv_overhead_line": 0.06e6
451
            / parameters["electrical_parameters"]["ac_line_110kV"][
452
                "s_nom"
453
            ],  # [EUR/km/MW]
454
            "ac_hv_cable": 0.8e6
455
            / parameters["electrical_parameters"]["ac_cable_110kV"][
456
                "s_nom"
457
            ],  # [EUR/km/MW]
458
            "dc_overhead_line": read_costs(
459
                costs, "HVDC overhead", "investment"
460
            ),
461
            "dc_cable": read_costs(costs, "HVDC overhead", "investment"),
462
            "dc_inverter": read_costs(
463
                costs, "HVDC inverter pair", "investment"
464
            ),
465
            "transformer_380_110": 17.33e3,  # [EUR/MVA]
466
            "transformer_380_220": 13.33e3,  # [EUR/MVA]
467
            "transformer_220_110": 17.5e3,  # [EUR/MVA]
468
            "battery inverter": read_costs(
469
                costs, "battery inverter", "investment"
470
            ),
471
            "battery storage": read_costs(
472
                costs, "battery storage", "investment"
473
            ),
474
        }
475
476
        parameters["lifetime"] = {
477
            "ac_ehv_overhead_line": read_costs(
478
                costs, "HVAC overhead", "lifetime"
479
            ),
480
            "ac_ehv_cable": read_costs(costs, "HVAC overhead", "lifetime"),
481
            "ac_hv_overhead_line": read_costs(
482
                costs, "HVAC overhead", "lifetime"
483
            ),
484
            "ac_hv_cable": read_costs(costs, "HVAC overhead", "lifetime"),
485
            "dc_overhead_line": read_costs(costs, "HVDC overhead", "lifetime"),
486
            "dc_cable": read_costs(costs, "HVDC overhead", "lifetime"),
487
            "dc_inverter": read_costs(costs, "HVDC inverter pair", "lifetime"),
488
            "transformer_380_110": read_costs(
489
                costs, "HVAC overhead", "lifetime"
490
            ),
491
            "transformer_380_220": read_costs(
492
                costs, "HVAC overhead", "lifetime"
493
            ),
494
            "transformer_220_110": read_costs(
495
                costs, "HVAC overhead", "lifetime"
496
            ),
497
            "battery inverter": read_costs(
498
                costs, "battery inverter", "lifetime"
499
            ),
500
            "battery storage": read_costs(
501
                costs, "battery storage", "lifetime"
502
            ),
503
        }
504
        # Insert annualized capital costs
505
        # lines in EUR/km/MW/a
506
        # transfermer, inverter, battery in EUR/MW/a
507
        parameters["capital_cost"] = {}
508
509
        for comp in parameters["overnight_cost"].keys():
510
            parameters["capital_cost"][comp] = annualize_capital_costs(
511
                parameters["overnight_cost"][comp],
512
                parameters["lifetime"][comp],
513
                global_settings("eGon2035")["interest_rate"],
514
            )
515
516
        parameters["capital_cost"]["battery"] = (
517
            parameters["capital_cost"]["battery inverter"]
518
            + parameters["efficiency"]["battery"]["max_hours"]
519
            * parameters["capital_cost"]["battery storage"]
520
        )
521
522
        # Insert marginal_costs in EUR/MWh
523
        # marginal cost can include fuel, C02 and operation and maintenance costs
524
        parameters["marginal_cost"] = {
525
            "wind_offshore": read_costs(costs, "offwind", "VOM"),
526
            "wind_onshore": read_costs(costs, "onwind", "VOM"),
527
            "solar": read_costs(costs, "solar", "VOM"),
528
        }
529
530
    elif scenario == "eGon2021":
531
        parameters = {}
532
533
    elif (scenario == "status2019") or (scenario == "status2023"):
534
        costs = read_csv(2020)
535
536
        parameters = {"grid_topology": "Status Quo"}
537
        # Insert effciencies in p.u.
538
        parameters["efficiency"] = {
539
            "oil": read_costs(costs, "oil", "efficiency"),
540
            "battery": {
541
                "store": read_costs(costs, "battery inverter", "efficiency")
542
                ** 0.5,
543
                "dispatch": read_costs(costs, "battery inverter", "efficiency")
544
                ** 0.5,
545
                "standing_loss": 0,
546
                "max_hours": 6,
547
                "cyclic_state_of_charge": True,
548
            },
549
            "pumped_hydro": {
550
                "store": read_costs(costs, "PHS", "efficiency") ** 0.5,
551
                "dispatch": read_costs(costs, "PHS", "efficiency") ** 0.5,
552
                "standing_loss": 0,
553
                "max_hours": 6,
554
                "cyclic_state_of_charge": True,
555
            },
556
        }
557
        # Warning: Electrical parameters are set in osmTGmod, editing these values will not change the data!
558
        parameters["electrical_parameters"] = {
559
            "ac_line_110kV": {
560
                "s_nom": 260,  # [MVA]
561
                "R": 0.109,  # [Ohm/km]
562
                "L": 1.2,  # [mH/km]
563
            },
564
            "ac_cable_110kV": {
565
                "s_nom": 280,  # [MVA]
566
                "R": 0.0177,  # [Ohm/km]
567
                "L": 0.3,  # [mH/km]
568
            },
569
            "ac_line_220kV": {
570
                "s_nom": 520,  # [MVA]
571
                "R": 0.109,  # [Ohm/km]
572
                "L": 1.0,  # [mH/km]
573
            },
574
            "ac_cable_220kV": {
575
                "s_nom": 550,  # [MVA]
576
                "R": 0.0176,  # [Ohm/km]
577
                "L": 0.3,  # [mH/km]
578
            },
579
            "ac_line_380kV": {
580
                "s_nom": 1790,  # [MVA]
581
                "R": 0.028,  # [Ohm/km]
582
                "L": 0.8,  # [mH/km]
583
            },
584
            "ac_cable_380kV": {
585
                "s_nom": 925,  # [MVA]
586
                "R": 0.0175,  # [Ohm/km]
587
                "L": 0.3,  # [mH/km]
588
            },
589
        }
590
591
        # Insert overnight investment costs
592
        # Source for eHV grid costs: Netzentwicklungsplan Strom 2035, Version 2021, 2. Entwurf
593
        # Source for HV lines and cables: Dena Verteilnetzstudie 2021, p. 146
594
        parameters["overnight_cost"] = {
595
            "ac_ehv_overhead_line": 2.5e6
596
            / (
597
                2
598
                * parameters["electrical_parameters"]["ac_line_380kV"]["s_nom"]
599
            ),  # [EUR/km/MW]
600
            "ac_ehv_cable": 11.5e6
601
            / (
602
                2
603
                * parameters["electrical_parameters"]["ac_cable_380kV"][
604
                    "s_nom"
605
                ]
606
            ),  # [EUR/km/MW]
607
            "ac_hv_overhead_line": 0.06e6
608
            / parameters["electrical_parameters"]["ac_line_110kV"][
609
                "s_nom"
610
            ],  # [EUR/km/MW]
611
            "ac_hv_cable": 0.8e6
612
            / parameters["electrical_parameters"]["ac_cable_110kV"][
613
                "s_nom"
614
            ],  # [EUR/km/MW]
615
            "dc_overhead_line": 0.5e3,  # [EUR/km/MW]
616
            "dc_cable": 3.25e3,  # [EUR/km/MW]
617
            "dc_inverter": 0.3e6,  # [EUR/MW]
618
            "transformer_380_110": 17.33e3,  # [EUR/MVA]
619
            "transformer_380_220": 13.33e3,  # [EUR/MVA]
620
            "transformer_220_110": 17.5e3,  # [EUR/MVA]
621
            "battery inverter": read_costs(
622
                costs, "battery inverter", "investment"
623
            ),
624
            "battery storage": read_costs(
625
                costs, "battery storage", "investment"
626
            ),
627
        }
628
629
        parameters["lifetime"] = {
630
            "ac_ehv_overhead_line": read_costs(
631
                costs, "HVAC overhead", "lifetime"
632
            ),
633
            "ac_ehv_cable": read_costs(costs, "HVAC overhead", "lifetime"),
634
            "ac_hv_overhead_line": read_costs(
635
                costs, "HVAC overhead", "lifetime"
636
            ),
637
            "ac_hv_cable": read_costs(costs, "HVAC overhead", "lifetime"),
638
            "dc_overhead_line": read_costs(costs, "HVDC overhead", "lifetime"),
639
            "dc_cable": read_costs(costs, "HVDC overhead", "lifetime"),
640
            "dc_inverter": read_costs(costs, "HVDC inverter pair", "lifetime"),
641
            "transformer_380_110": read_costs(
642
                costs, "HVAC overhead", "lifetime"
643
            ),
644
            "transformer_380_220": read_costs(
645
                costs, "HVAC overhead", "lifetime"
646
            ),
647
            "transformer_220_110": read_costs(
648
                costs, "HVAC overhead", "lifetime"
649
            ),
650
            "battery inverter": read_costs(
651
                costs, "battery inverter", "lifetime"
652
            ),
653
            "battery storage": read_costs(
654
                costs, "battery storage", "lifetime"
655
            ),
656
        }
657
        # Insert annualized capital costs
658
        # lines in EUR/km/MW/a
659
        # transfermer, inverter, battery in EUR/MW/a
660
        parameters["capital_cost"] = {}
661
662
        for comp in parameters["overnight_cost"].keys():
663
            parameters["capital_cost"][comp] = annualize_capital_costs(
664
                parameters["overnight_cost"][comp],
665
                parameters["lifetime"][comp],
666
                global_settings("status2019")["interest_rate"],
667
            )
668
669
        parameters["capital_cost"]["battery"] = (
670
            parameters["capital_cost"]["battery inverter"]
671
            + parameters["efficiency"]["battery"]["max_hours"]
672
            * parameters["capital_cost"]["battery storage"]
673
        )
674
675
        parameters["marginal_cost"] = {
676
            "oil": global_settings(scenario)["fuel_costs"]["oil"]
677
            / read_costs(costs, "oil", "efficiency")
678
            + read_costs(costs, "oil", "VOM")
679
            + global_settings(scenario)["co2_costs"]
680
            * global_settings(scenario)["co2_emissions"]["oil"]
681
            / read_costs(costs, "oil", "efficiency"),
682
            "other_non_renewable": global_settings(scenario)["fuel_costs"][
683
                "gas"
684
            ] / read_costs(costs, "OCGT", "efficiency")
685
            + global_settings(scenario)["co2_costs"]
686
            * global_settings(scenario)["co2_emissions"][
687
                "other_non_renewable"
688
            ] / read_costs(costs, "OCGT", "efficiency"),
689
            "lignite": global_settings(scenario)["fuel_costs"]["lignite"]
690
            / read_costs(costs, "lignite", "efficiency")
691
            + read_costs(costs, "lignite", "VOM")
692
            + global_settings(scenario)["co2_costs"]
693
            * global_settings(scenario)["co2_emissions"]["lignite"]
694
            / read_costs(costs, "lignite", "efficiency"),
695
            "coal": global_settings(scenario)["fuel_costs"]["coal"]
696
            / read_costs(costs, "coal", "efficiency")
697
            + read_costs(costs, "coal", "VOM")
698
            + global_settings(scenario)["co2_costs"]
699
            * global_settings(scenario)["co2_emissions"]["coal"]
700
            / read_costs(costs, "coal", "efficiency"),
701
            "OCGT": global_settings(scenario)["fuel_costs"]["gas"]
702
            / read_costs(costs, "OCGT", "efficiency")
703
            + read_costs(costs, "OCGT", "VOM")
704
            + global_settings(scenario)["co2_costs"]
705
            * global_settings(scenario)["co2_emissions"]["gas"]
706
            / read_costs(costs, "OCGT", "efficiency"),
707
            "nuclear": global_settings(scenario)["fuel_costs"]["nuclear"]
708
            / read_costs(costs, "nuclear", "efficiency")
709
            + read_costs(costs, "nuclear", "VOM"),
710
            "biomass": global_settings(scenario)["fuel_costs"]["biomass"]
711
            / read_costs(costs, "biomass CHP", "efficiency")
712
            + read_costs(costs, "biomass CHP", "VOM"),
713
            "wind_offshore": read_costs(costs, "offwind", "VOM"),
714
            "wind_onshore": read_costs(costs, "onwind", "VOM"),
715
            "solar": read_costs(costs, "solar", "VOM"),
716
        }
717
718
    else:
719
        print(f"Scenario name {scenario} is not valid.")
720
721
    return parameters
0 ignored issues
show
introduced by
The variable parameters does not seem to be defined for all execution paths.
Loading history...
722
723
724
def gas(scenario):
725
    """Returns paramaters of the gas sector for the selected scenario.
726
727
    Parameters
728
    ----------
729
    scenario : str
730
        Name of the scenario.
731
732
    Returns
733
    -------
734
    parameters : dict
735
        List of parameters of gas sector
736
737
    """
738
739
    if scenario == "eGon2035":
740
        costs = read_csv(2035)
741
742
        parameters = {
743
            "main_gas_carrier": "CH4",
744
            "H2_feedin_volumetric_fraction": 0.15,
745
        }
746
        # Insert effciencies in p.u.
747
        parameters["efficiency"] = {
748
            "power_to_H2": read_costs(costs, "electrolysis", "efficiency"),
749
            "H2_to_power": read_costs(costs, "fuel cell", "efficiency"),
750
            "CH4_to_H2": read_costs(costs, "SMR", "efficiency"),
751
            "H2_feedin": 1,
752
            "H2_to_CH4": read_costs(costs, "methanation", "efficiency"),
753
            "OCGT": read_costs(costs, "OCGT", "efficiency"),
754
        }
755
        # Insert overnight investment costs
756
        parameters["overnight_cost"] = {
757
            "power_to_H2": read_costs(costs, "electrolysis", "investment"),
758
            "H2_to_power": read_costs(costs, "fuel cell", "investment"),
759
            "CH4_to_H2": read_costs(costs, "SMR", "investment"),
760
            "H2_to_CH4": read_costs(costs, "methanation", "investment"),
761
            "H2_feedin": 0,
762
            "H2_underground": read_costs(
763
                costs, "hydrogen storage underground", "investment"
764
            ),
765
            "H2_overground": read_costs(
766
                costs, "hydrogen storage tank incl. compressor", "investment"
767
            ),
768
            "H2_pipeline": read_costs(
769
                costs, "H2 (g) pipeline", "investment"
770
            ),  # [EUR/MW/km]
771
        }
772
773
        # Insert lifetime
774
        parameters["lifetime"] = {
775
            "power_to_H2": read_costs(costs, "electrolysis", "lifetime"),
776
            "H2_to_power": read_costs(costs, "fuel cell", "lifetime"),
777
            "CH4_to_H2": read_costs(costs, "SMR", "lifetime"),
778
            "H2_to_CH4": read_costs(costs, "methanation", "lifetime"),
779
            "H2_underground": read_costs(
780
                costs, "hydrogen storage underground", "lifetime"
781
            ),
782
            "H2_overground": read_costs(
783
                costs, "hydrogen storage tank incl. compressor", "lifetime"
784
            ),
785
            "H2_pipeline": read_costs(costs, "H2 (g) pipeline", "lifetime"),
786
            "H2_feedin": read_costs(costs, "CH4 (g) pipeline", "lifetime"),
787
        }
788
789
        # Insert annualized capital costs
790
        parameters["capital_cost"] = {}
791
792
        for comp in parameters["overnight_cost"].keys():
793
            parameters["capital_cost"][comp] = annualize_capital_costs(
794
                parameters["overnight_cost"][comp],
795
                parameters["lifetime"][comp],
796
                global_settings("eGon2035")["interest_rate"],
797
            )
798
799
        parameters["marginal_cost"] = {
800
            "CH4": global_settings(scenario)["fuel_costs"]["gas"]
801
            + global_settings(scenario)["co2_costs"]
802
            * global_settings(scenario)["co2_emissions"]["gas"],
803
            "OCGT": read_costs(costs, "OCGT", "VOM"),
804
            "biogas": global_settings(scenario)["fuel_costs"]["gas"],
805
            "chp_gas": read_costs(costs, "central gas CHP", "VOM"),
806
        }
807
808
        # Insert max gas production (generator) over the year
809
        parameters["max_gas_generation_overtheyear"] = {
810
            "CH4": 36000000,  # [MWh] Netzentwicklungsplan Gas 2020–2030
811
            "biogas": 10000000,  # [MWh] Netzentwicklungsplan Gas 2020–2030
812
        }
813
814
    elif scenario == "eGon100RE":
815
        costs = read_csv(2050)
816
        interest_rate = 0.07  # [p.u.]
817
818
        parameters = {
819
            "main_gas_carrier": "H2",
820
            "retrofitted_CH4pipeline-to-H2pipeline_share": 0.23,
821
            # p-e-s result, this value is overwritten if p-e-s is run
822
        }
823
        # Insert effciencies in p.u.
824
        parameters["efficiency"] = {
825
            "power_to_H2": read_costs(costs, "electrolysis", "efficiency"),
826
            "H2_to_power": read_costs(costs, "fuel cell", "efficiency"),
827
            "CH4_to_H2": read_costs(costs, "SMR", "efficiency"),
828
            "H2_to_CH4": read_costs(costs, "methanation", "efficiency"),
829
            "OCGT": read_costs(costs, "OCGT", "efficiency"),
830
        }
831
832
        # Insert FOM in %
833
        parameters["FOM"] = {
834
            "H2_underground": read_costs(
835
                costs, "hydrogen storage underground", "FOM"
836
            ),
837
            "H2_overground": read_costs(
838
                costs, "hydrogen storage tank incl. compressor", "FOM"
839
            ),
840
            "power_to_H2": read_costs(costs, "electrolysis", "FOM"),
841
            "H2_to_power": read_costs(costs, "fuel cell", "FOM"),
842
            "CH4_to_H2": read_costs(costs, "SMR", "FOM"),
843
            "H2_to_CH4": read_costs(costs, "methanation", "FOM"),
844
            "H2_pipeline": read_costs(costs, "H2 (g) pipeline", "FOM"),
845
            "H2_pipeline_retrofit": read_costs(
846
                costs, "H2 (g) pipeline repurposed", "FOM"
847
            ),
848
        }
849
850
        # Insert overnight investment costs
851
        parameters["overnight_cost"] = {
852
            "power_to_H2": read_costs(costs, "electrolysis", "investment"),
853
            "H2_to_power": read_costs(costs, "fuel cell", "investment"),
854
            "CH4_to_H2": read_costs(costs, "SMR", "investment"),
855
            "H2_to_CH4": read_costs(costs, "methanation", "investment"),
856
            "H2_underground": read_costs(
857
                costs, "hydrogen storage underground", "investment"
858
            ),
859
            "H2_overground": read_costs(
860
                costs, "hydrogen storage tank incl. compressor", "investment"
861
            ),
862
            "H2_pipeline": read_costs(
863
                costs, "H2 (g) pipeline", "investment"
864
            ),  # [EUR/MW/km]
865
            "H2_pipeline_retrofit": read_costs(
866
                costs, "H2 (g) pipeline repurposed", "investment"
867
            ),  # [EUR/MW/km]
868
        }
869
870
        # Insert lifetime
871
        parameters["lifetime"] = {
872
            "power_to_H2": read_costs(costs, "electrolysis", "lifetime"),
873
            "H2_to_power": read_costs(costs, "fuel cell", "lifetime"),
874
            "CH4_to_H2": read_costs(costs, "SMR", "lifetime"),
875
            "H2_to_CH4": read_costs(costs, "methanation", "lifetime"),
876
            "H2_underground": read_costs(
877
                costs, "hydrogen storage underground", "lifetime"
878
            ),
879
            "H2_overground": read_costs(
880
                costs, "hydrogen storage tank incl. compressor", "lifetime"
881
            ),
882
            "H2_pipeline": read_costs(costs, "H2 (g) pipeline", "lifetime"),
883
            "H2_pipeline_retrofit": read_costs(
884
                costs, "H2 (g) pipeline repurposed", "lifetime"
885
            ),
886
        }
887
888
        # Insert costs
889
        parameters["capital_cost"] = {}
890
891
        for comp in parameters["overnight_cost"].keys():
892
            parameters["capital_cost"][comp] = annualize_capital_costs(
893
                parameters["overnight_cost"][comp],
894
                parameters["lifetime"][comp],
895
                interest_rate,
896
            ) + parameters["overnight_cost"][comp] * (
897
                parameters["FOM"][comp] / 100
898
            )
899
900
        for comp in ["H2_to_power", "H2_to_CH4"]:
901
            parameters["capital_cost"][comp] = (
902
                annualize_capital_costs(
903
                    parameters["overnight_cost"][comp],
904
                    parameters["lifetime"][comp],
905
                    interest_rate,
906
                )
907
                + parameters["overnight_cost"][comp]
908
                * (parameters["FOM"][comp] / 100)
909
            ) * parameters["efficiency"][comp]
910
911
        parameters["marginal_cost"] = {
912
            "OCGT": read_costs(costs, "OCGT", "VOM"),
913
            "biogas": read_costs(costs, "biogas", "fuel"),
914
            "chp_gas": read_costs(costs, "central gas CHP", "VOM"),
915
        }
916
917
    elif scenario == "eGon2021":
918
        parameters = {}
919
920
    elif scenario == "status2019":
921
        costs = read_csv(2020)
922
        parameters = {
923
            "main_gas_carrier": "CH4",
924
        }
925
926
        parameters["marginal_cost"] = {
927
            "CH4": global_settings(scenario)["fuel_costs"]["gas"]
928
            + global_settings(scenario)["co2_costs"]
929
            * global_settings(scenario)["co2_emissions"]["gas"],
930
            "OCGT": read_costs(costs, "OCGT", "VOM"),
931
            "biogas": global_settings(scenario)["fuel_costs"]["gas"],
932
            "chp_gas": read_costs(costs, "central gas CHP", "VOM"),
933
        }
934
        # Insert effciencies in p.u.
935
        parameters["efficiency"] = {
936
            "OCGT": read_costs(costs, "OCGT", "efficiency"),
937
        }
938
939
    else:
940
        print(f"Scenario name {scenario} is not valid.")
941
942
    return parameters
0 ignored issues
show
introduced by
The variable parameters does not seem to be defined for all execution paths.
Loading history...
943
944
945
def mobility(scenario):
946
    """Returns parameters of the mobility sector for the selected scenario.
947
948
    Parameters
949
    ----------
950
    scenario : str
951
        Name of the scenario.
952
953
    Returns
954
    -------
955
    parameters : dict
956
        List of parameters of mobility sector
957
958
    Notes
959
    -----
960
    For a detailed description of the parameters see module
961
    :mod:`egon.data.datasets.emobility.motorized_individual_travel`.
962
    """
963
964
    if scenario == "eGon2035":
965
        parameters = {
966
            "motorized_individual_travel": {
967
                "NEP C 2035": {
968
                    "ev_count": 15100000,
969
                    "bev_mini_share": 0.1589,
970
                    "bev_medium_share": 0.3533,
971
                    "bev_luxury_share": 0.1053,
972
                    "phev_mini_share": 0.0984,
973
                    "phev_medium_share": 0.2189,
974
                    "phev_luxury_share": 0.0652,
975
                    "model_parameters": {},
976
                }
977
            }
978
        }
979
980
    elif scenario == "eGon100RE":
981
        # eGon100RE has 3 Scenario variations
982
        #   * allocation will always be done for all scenarios
983
        #   * model data will be written to tables `egon_etrago_*` only
984
        #     for the variation as speciefied in `datasets.yml`
985
        parameters = {
986
            "motorized_individual_travel": {
987
                "Reference 2050": {
988
                    "ev_count": 25065000,
989
                    "bev_mini_share": 0.1589,
990
                    "bev_medium_share": 0.3533,
991
                    "bev_luxury_share": 0.1053,
992
                    "phev_mini_share": 0.0984,
993
                    "phev_medium_share": 0.2189,
994
                    "phev_luxury_share": 0.0652,
995
                    "model_parameters": {},
996
                },
997
                "Mobility Transition 2050": {
998
                    "ev_count": 37745000,
999
                    "bev_mini_share": 0.1589,
1000
                    "bev_medium_share": 0.3533,
1001
                    "bev_luxury_share": 0.1053,
1002
                    "phev_mini_share": 0.0984,
1003
                    "phev_medium_share": 0.2189,
1004
                    "phev_luxury_share": 0.0652,
1005
                    "model_parameters": {},
1006
                },
1007
                "Electrification 2050": {
1008
                    "ev_count": 47700000,
1009
                    "bev_mini_share": 0.1589,
1010
                    "bev_medium_share": 0.3533,
1011
                    "bev_luxury_share": 0.1053,
1012
                    "phev_mini_share": 0.0984,
1013
                    "phev_medium_share": 0.2189,
1014
                    "phev_luxury_share": 0.0652,
1015
                    "model_parameters": {},
1016
                },
1017
            }
1018
        }
1019
1020
    elif scenario == "eGon2021":
1021
        parameters = {}
1022
1023
    elif scenario == "status2019":
1024
        parameters = {
1025
            "motorized_individual_travel": {
1026
                "status2019": {
1027
                    "ev_count": 200000,
1028
                    "bev_mini_share": 0.1589,
1029
                    "bev_medium_share": 0.3533,
1030
                    "bev_luxury_share": 0.1053,
1031
                    "phev_mini_share": 0.0984,
1032
                    "phev_medium_share": 0.2189,
1033
                    "phev_luxury_share": 0.0652,
1034
                    "model_parameters": {},
1035
                }
1036
            }
1037
        }
1038
1039
    elif scenario == "status2023":
1040
        parameters = {
1041
            "motorized_individual_travel": {
1042
                "status2023": {
1043
                    "ev_count": 2577664,
1044
                    "bev_mini_share": 0.1535,
1045
                    "bev_medium_share": 0.3412,
1046
                    "bev_luxury_share": 0.1017,
1047
                    "phev_mini_share": 0.1038,
1048
                    "phev_medium_share": 0.2310,
1049
                    "phev_luxury_share": 0.0688,
1050
                    "model_parameters": {},
1051
                }
1052
            }
1053
        }
1054
1055
    else:
1056
        print(f"Scenario name {scenario} is not valid.")
1057
        parameters = dict()
1058
1059
    return parameters
1060
1061
1062
def heat(scenario):
1063
    """Returns paramaters of the heat sector for the selected scenario.
1064
1065
    Parameters
1066
    ----------
1067
    scenario : str
1068
        Name of the scenario.
1069
1070
    Returns
1071
    -------
1072
    parameters : dict
1073
        List of parameters of heat sector
1074
1075
    """
1076
1077
    if scenario == "eGon2035":
1078
        costs = read_csv(2035)
1079
1080
        parameters = {
1081
            "DE_demand_reduction_residential": 0.854314018923104,
1082
            "DE_demand_reduction_service": 0.498286864771128,
1083
            "DE_district_heating_share": 0.14,
1084
        }
1085
1086
        # Insert efficiency in p.u.
1087
        parameters["efficiency"] = {
1088
            "water_tank_charger": read_costs(
1089
                costs, "water tank charger", "efficiency"
1090
            ),
1091
            "water_tank_discharger": read_costs(
1092
                costs, "water tank discharger", "efficiency"
1093
            ),
1094
            "central_resistive_heater": read_costs(
1095
                costs, "central resistive heater", "efficiency"
1096
            ),
1097
            "central_gas_boiler": read_costs(
1098
                costs, "central gas boiler", "efficiency"
1099
            ),
1100
            "rural_resistive_heater": read_costs(
1101
                costs, "decentral resistive heater", "efficiency"
1102
            ),
1103
            "rural_gas_boiler": read_costs(
1104
                costs, "decentral gas boiler", "efficiency"
1105
            ),
1106
        }
1107
1108
        # Insert overnight investment costs, in EUR/MWh
1109
        parameters["overnight_cost"] = {
1110
            "central_water_tank": read_costs(
1111
                costs, "central water tank storage", "investment"
1112
            ),
1113
            "rural_water_tank": read_costs(
1114
                costs, "decentral water tank storage", "investment"
1115
            ),
1116
        }
1117
1118
        # Insert lifetime
1119
        parameters["lifetime"] = {
1120
            "central_water_tank": read_costs(
1121
                costs, "central water tank storage", "lifetime"
1122
            ),
1123
            "rural_water_tank": read_costs(
1124
                costs, "decentral water tank storage", "lifetime"
1125
            ),
1126
        }
1127
1128
        # Insert annualized capital costs
1129
        parameters["capital_cost"] = {}
1130
1131
        for comp in parameters["overnight_cost"].keys():
1132
            parameters["capital_cost"][comp] = annualize_capital_costs(
1133
                parameters["overnight_cost"][comp],
1134
                parameters["lifetime"][comp],
1135
                global_settings("eGon2035")["interest_rate"],
1136
            )
1137
1138
        # Insert marginal_costs in EUR/MWh
1139
        # marginal cost can include fuel, C02 and operation and maintenance costs
1140
        parameters["marginal_cost"] = {
1141
            "central_heat_pump": read_costs(
1142
                costs, "central air-sourced heat pump", "VOM"
1143
            ),
1144
            "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"),
1145
            "central_gas_boiler": read_costs(
1146
                costs, "central gas boiler", "VOM"
1147
            ),
1148
            "central_resistive_heater": read_costs(
1149
                costs, "central resistive heater", "VOM"
1150
            ),
1151
            "geo_thermal": 2.9,  # Danish Energy Agency
1152
            "water_tank_charger": 0,  # Danish Energy Agency
1153
            "water_tank_discharger": 0,  # Danish Energy Agency
1154
            "rural_heat_pump": 0,  # Danish Energy Agency, Technology Data for Individual Heating Plants
1155
        }
1156
1157
    elif scenario == "eGon100RE":
1158
        costs = read_csv(2050)
1159
1160
        parameters = {
1161
            "DE_demand_reduction_residential": 0.640720648501849,
1162
            "DE_demand_reduction_service": 0.390895195300713,
1163
            "DE_district_heating_share": 0.19,
1164
        }
1165
1166
        parameters["marginal_cost"] = {
1167
            "central_heat_pump": read_costs(
1168
                costs, "central air-sourced heat pump", "VOM"
1169
            ),
1170
            "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"),
1171
            "central_gas_boiler": read_costs(
1172
                costs, "central gas boiler", "VOM"
1173
            ),
1174
            "central_resistive_heater": read_costs(
1175
                costs, "central resistive heater", "VOM"
1176
            ),
1177
            "geo_thermal": 2.9,  # Danish Energy Agency
1178
            "water_tank_charger": 0,  # Danish Energy Agency
1179
            "water_tank_discharger": 0,  # Danish Energy Agency
1180
            "rural_heat_pump": 0,  # Danish Energy Agency, Technology Data for Individual Heating Plants
1181
        }
1182
1183
        # Insert efficiency in p.u.
1184
        parameters["efficiency"] = {
1185
            "water_tank_charger": read_costs(
1186
                costs, "water tank charger", "efficiency"
1187
            ),
1188
            "water_tank_discharger": read_costs(
1189
                costs, "water tank discharger", "efficiency"
1190
            ),
1191
            "central_resistive_heater": read_costs(
1192
                costs, "central resistive heater", "efficiency"
1193
            ),
1194
            "central_gas_boiler": read_costs(
1195
                costs, "central gas boiler", "efficiency"
1196
            ),
1197
            "rural_resistive_heater": read_costs(
1198
                costs, "decentral resistive heater", "efficiency"
1199
            ),
1200
            "rural_gas_boiler": read_costs(
1201
                costs, "decentral gas boiler", "efficiency"
1202
            ),
1203
        }
1204
1205
        # Insert overnight investment costs, in EUR/MWh
1206
        parameters["overnight_cost"] = {
1207
            "central_water_tank": read_costs(
1208
                costs, "central water tank storage", "investment"
1209
            ),
1210
            "rural_water_tank": read_costs(
1211
                costs, "decentral water tank storage", "investment"
1212
            ),
1213
        }
1214
1215
        # Insert lifetime
1216
        parameters["lifetime"] = {
1217
            "central_water_tank": read_costs(
1218
                costs, "central water tank storage", "lifetime"
1219
            ),
1220
            "rural_water_tank": read_costs(
1221
                costs, "decentral water tank storage", "lifetime"
1222
            ),
1223
        }
1224
1225
        # Insert annualized capital costs
1226
        parameters["capital_cost"] = {}
1227
1228
        for comp in parameters["overnight_cost"].keys():
1229
            parameters["capital_cost"][comp] = annualize_capital_costs(
1230
                parameters["overnight_cost"][comp],
1231
                parameters["lifetime"][comp],
1232
                global_settings("eGon100RE")["interest_rate"],
1233
            )
1234
1235
    elif scenario == "eGon2021":
1236
        parameters = {}
1237
1238
    elif scenario == "status2019":
1239
        parameters = {
1240
            "DE_demand_residential_TJ": 1658400
1241
            + 383300,  # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf)
1242
            "DE_demand_service_TJ": 567300
1243
            + 71500,  # [TJ], space heating + hot water, source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2020/10/ageb_20v_v1.pdf)
1244
            "DE_district_heating_share": (189760 + 38248)
1245
            / (
1246
                1658400 + 383300 + 567300 + 71500
1247
            ),  # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx)
1248
        }
1249
1250
        costs = read_csv(2020)
1251
1252
        # Insert marginal_costs in EUR/MWh
1253
        # marginal cost can include fuel, C02 and operation and maintenance costs
1254
        parameters["marginal_cost"] = {
1255
            "central_heat_pump": read_costs(
1256
                costs, "central air-sourced heat pump", "VOM"
1257
            ),
1258
            "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"),
1259
            "central_gas_boiler": read_costs(
1260
                costs, "central gas boiler", "VOM"
1261
            ),
1262
            "central_resistive_heater": read_costs(
1263
                costs, "central resistive heater", "VOM"
1264
            ),
1265
            "rural_heat_pump": 0,  # Danish Energy Agency, Technology Data for Individual Heating Plants
1266
        }
1267
1268
        # Insert efficiency in p.u.
1269
        parameters["efficiency"] = {
1270
            "central_gas_boiler": read_costs(
1271
                costs, "central gas boiler", "efficiency"
1272
            ),
1273
        }
1274
1275
    # elif scenario == "status2023":
1276
    #     parameters = {
1277
    #         #  source: AG Energiebilanzen 2022  https://ag-energiebilanzen.de/wp-content/uploads/2023/01/AGEB_22p2_rev-1.pdf
1278
    #         "DE_demand_residential_TJ": 1754.2 * 1e3
1279
    #         + 407.5 * 1e3,  # [TJ], Endenergieverbrauch Haushalte 2.1 Raumwärme + Warmwasser
1280
    #         "DE_demand_service_TJ": 668.4 * 1e3
1281
    #         + 44.3 * 1e3 ,  # [TJ], Endenergieverbrauch GHD 3.1 Raumwärme + Warmwasser
1282
    #         "DE_district_heating_share": (189760 + 38248)
1283
    #         / (
1284
    #             1658400 + 383300 + 567300 + 71500
1285
    #         ),  # [TJ], source: AG Energiebilanzen 2019 (https://ag-energiebilanzen.de/wp-content/uploads/2021/11/bilanz19d.xlsx)
1286
    #     } # TODO status2023 needs update
1287
    #
1288
    #     costs = read_csv(2020)
1289
    #
1290
    #     # Insert marginal_costs in EUR/MWh
1291
    #     # marginal cost can include fuel, C02 and operation and maintenance costs
1292
    #     parameters["marginal_cost"] = {
1293
    #         "central_heat_pump": read_costs(
1294
    #             costs, "central air-sourced heat pump", "VOM"
1295
    #         ),
1296
    #         "central_gas_chp": read_costs(costs, "central gas CHP", "VOM"),
1297
    #         "central_gas_boiler": read_costs(
1298
    #             costs, "central gas boiler", "VOM"
1299
    #         ),
1300
    #         "central_resistive_heater": read_costs(
1301
    #             costs, "central resistive heater", "VOM"
1302
    #         ),
1303
    #         "rural_heat_pump": 0,  # Danish Energy Agency, Technology Data for Individual Heating Plants
1304
    #     }
1305
    #
1306
    #     # Insert efficiency in p.u.
1307
    #     parameters["efficiency"] = {
1308
    #         "central_gas_boiler": read_costs(
1309
    #             costs, "central gas boiler", "efficiency"
1310
    #         ),
1311
    #     }
1312
1313
    else:
1314
        print(f"Scenario name {scenario} is not valid.")
1315
1316
    return parameters
0 ignored issues
show
introduced by
The variable parameters does not seem to be defined for all execution paths.
Loading history...
1317