Skip to content

Commit

Permalink
Merge branch 'main' into bug_fix_investment_costs
Browse files Browse the repository at this point in the history
  • Loading branch information
lindnemi committed Sep 6, 2024
2 parents 502923a + d79ae3d commit 5ca354d
Show file tree
Hide file tree
Showing 18 changed files with 12,733 additions and 70 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Changelog
- added Italy with 3 additional nodes
- adapted spatial distribution of district heating demand in Germany according to data from eGo^N project
- add retrofit of gas turbines to H2, and H2 turbines
- unravel gas bus and turn off gas network
Expand Down
1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/optimist/costs_2020.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/optimist/costs_2025.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/optimist/costs_2030.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/optimist/costs_2035.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/optimist/costs_2040.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/optimist/costs_2045.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/pessimist/costs_2020.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/pessimist/costs_2025.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/pessimist/costs_2030.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/pessimist/costs_2035.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/pessimist/costs_2040.csv

Large diffs are not rendered by default.

1,055 changes: 1,055 additions & 0 deletions ariadne-data/costs/pessimist/costs_2045.csv

Large diffs are not rendered by default.

74 changes: 38 additions & 36 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#run
run:
prefix: 20240904FixOvernightCosts
prefix: 20240905additaly
name:
# - CurrentPolicies
- KN2045_Bal_v4
Expand Down Expand Up @@ -62,7 +62,7 @@ scenario:
ll:
- vopt
clusters:
- 22 #current options: 22, 44
- 27 #current options: 27, 49
opts:
- ''
sector_opts:
Expand All @@ -82,7 +82,7 @@ existing_capacities:

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#countries
# Germany plus 12 "Stromnachbarn"
countries: ['AT', 'BE', 'CH', 'CZ', 'DE', 'DK', 'FR', 'GB', 'LU', 'NL', 'NO', 'PL', 'SE', 'ES']
countries: ['AT', 'BE', 'CH', 'CZ', 'DE', 'DK', 'FR', 'GB', 'LU', 'NL', 'NO', 'PL', 'SE', 'ES', 'IT']

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#snapshots
snapshots:
Expand Down Expand Up @@ -138,37 +138,39 @@ clustering:
# fw["ES"] = 1
# print(fw.div(fw.sum()).subtract(5e-5).round(4).to_dict().__repr__().replace(",","\n"))
focus_weights:
# 23 nodes: 8 for Germany, 1 for Spain, 2 each for Denmark and UK, 1 per each of other 10 "Stromnachbarn"
'DE': 0.3478
'AT': 0.0434
'BE': 0.0434
'CH': 0.0434
'CZ': 0.0434
'DK': 0.0869
'FR': 0.0434
'GB': 0.0869
'LU': 0.0434
'NL': 0.0434
'NO': 0.0434
'PL': 0.0434
'SE': 0.0434
'ES': 0.0434
# high spatial resolution: change clusters to 45
# 45 nodes: 30 for Germany, 1 for Spain, 2 each for Denmark and UK, 1 per each of other 10 "Stromnachbarn"
# 'DE': 0.6666
# 'AT': 0.0222
# 'BE': 0.0222
# 'CH': 0.0222
# 'CZ': 0.0222
# 'DK': 0.0444
# 'FR': 0.0222
# 'GB': 0.0444
# 'LU': 0.0222
# 'NL': 0.0222
# 'NO': 0.0222
# 'PL': 0.0222
# 'SE': 0.0222
# 'ES': 0.0222
# 27 nodes: 8 for Germany, 3 for Italy, 2 each for Denmark, UK and Spain, 1 per each of other 10 "Stromnachbarn"
'DE': 0.2966
'AT': 0.0370
'BE': 0.0370
'CH': 0.0370
'CZ': 0.0370
'DK': 0.0741
'FR': 0.0370
'GB': 0.0741
'LU': 0.0370
'NL': 0.0370
'NO': 0.0370
'PL': 0.0370
'SE': 0.0370
'ES': 0.0741
'IT': 0.1111
# high spatial resolution: change clusters to 46
# 49 nodes: 30 for Germany, 3 for Italy, 2 each for Denmark, UK and Spain, 1 per each of other 10 "Stromnachbarn"
# 'DE': 0.6124
# 'AT': 0.0204
# 'BE': 0.0204
# 'CH': 0.0204
# 'CZ': 0.0204
# 'DK': 0.0408
# 'FR': 0.0204
# 'GB': 0.0408
# 'LU': 0.0204
# 'NL': 0.0204
# 'NO': 0.0204
# 'PL': 0.0204
# 'SE': 0.0204
# 'ES': 0.0408
# 'IT': 0.0612
temporal:
resolution_sector: 365H

Expand Down Expand Up @@ -552,7 +554,7 @@ co2_price_add_on_fossils:
2020: 25
2025: 60

must_run_biomass:
must_run_biogas:
enable: false
p_min_pu: 0.7
p_min_pu: 0.6
regions: ['DE']
2 changes: 1 addition & 1 deletion workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ rule modify_prenetwork:
"sector", "H2_retrofit_capacity_per_CH4"
),
transmission_costs=config_provider("costs", "transmission"),
biomass_must_run=config_provider("must_run_biomass"),
biogas_must_run=config_provider("must_run_biogas"),
clustering=config_provider("clustering", "temporal", "resolution_sector"),
H2_plants=config_provider("electricity", "H2_plants_DE"),
land_transport_electric_share=config_provider(
Expand Down
47 changes: 24 additions & 23 deletions workflow/scripts/export_ariadne_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,31 +481,26 @@ def _get_capacities(n, region, cap_func, cap_string="Capacity|", costs=None):
# capacities_electricity = \
# capacities_electricity.multiply(MW2GW)

capacities_biomass = capacities_electricity.filter(like="biomass")
var[cap_string + "Electricity|Biomass|w/ CCS"] = capacities_electricity.get(
"urban central solid biomass CHP CC ", 0
)

var[cap_string + "Electricity|Biomass|w/ CCS"] = capacities_biomass.filter(
like="CC"
var[cap_string + "Electricity|Biomass|w/o CCS"] = capacities_electricity.reindex(
["urban central solid biomass CHP", "solid biomass", "biogas"]
).sum()

var[cap_string + "Electricity|Biomass|w/o CCS"] = capacities_biomass.reindex(
["urban central solid biomass CHP", "solid biomass"]
var[cap_string + "Electricity|Biomass|Solids"] = capacities_electricity.filter(
like="solid biomass"
).sum()

var[cap_string + "Electricity|Biomass|Solids"] = var[
[
cap_string + "Electricity|Biomass|w/ CCS",
cap_string + "Electricity|Biomass|w/o CCS",
]
].sum()

# Ariadne does no checks, so we implement our own?
assert isclose(
var[cap_string + "Electricity|Biomass|Solids"], capacities_biomass.sum()
var[cap_string + "Electricity|Biomass|Gases and Liquids"] = (
capacities_electricity.get("biogas", 0)
)

var[cap_string + "Electricity|Biomass"] = var[
cap_string + "Electricity|Biomass|Solids"
]
var[cap_string + "Electricity|Biomass"] = (
var[cap_string + "Electricity|Biomass|Solids"]
+ var[cap_string + "Electricity|Biomass|Gases and Liquids"]
)

var[cap_string + "Electricity|Non-Renewable Waste"] = capacities_electricity.filter(
like="waste CHP"
Expand Down Expand Up @@ -1208,8 +1203,8 @@ def get_primary_energy(n, region):
~biomass_usage.index.str.contains("CC")
].sum()

var["Primary Energy|Biomass|Electricity"] = biomass_CHP_E_usage + biomass_usage.get(
"solid biomass", 0
var["Primary Energy|Biomass|Electricity"] = (
biomass_CHP_E_usage + biomass_usage.reindex(["solid biomass", "biogas"]).sum()
)
var["Primary Energy|Biomass|Heat"] = biomass_CHP_H_usage + biomass_usage.get(
"urban central solid biomass boiler", 0
Expand Down Expand Up @@ -1355,12 +1350,18 @@ def get_secondary_energy(n, region, _industry_demand):
+ var["Secondary Energy|Electricity|Coal"]
)

var["Secondary Energy|Electricity|Biomass|w/o CCS"] = electricity_supply.get(
"urban central solid biomass CHP", 0
) + electricity_supply.get("solid biomass", 0)
var["Secondary Energy|Electricity|Biomass|w/o CCS"] = electricity_supply.reindex(
["urban central solid biomass CHP", "solid biomass", "biogas"]
).sum()
var["Secondary Energy|Electricity|Biomass|w/ CCS"] = electricity_supply.get(
"urban central solid biomass CHP CC", 0
)
var["Secondary Energy|Electricity|Biomass|Solid"] = electricity_supply.filter(
like="solid biomass"
).sum()
var["Secondary Energy|Electricity|Biomass|Gaseous and Liquid"] = (
electricity_supply.get("biogas")
)
var["Secondary Energy|Electricity|Biomass"] = (
var["Secondary Energy|Electricity|Biomass|w/o CCS"]
+ var["Secondary Energy|Electricity|Biomass|w/ CCS"]
Expand Down
17 changes: 8 additions & 9 deletions workflow/scripts/modify_prenetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,16 +588,15 @@ def transmission_costs_from_modified_cost_data(
n.links.loc[dc_b, "overnight_cost"] = overnight_cost


def must_run_biomass(n, p_min_pu, regions):
def must_run_biogas(n, p_min_pu, regions):
"""
Set p_min_pu for biomass generators to the specified value.
Set p_min_pu for biogas generators to the specified value.
"""
logger.info(
f"Must-run condition enabled: Setting p_min_pu = {p_min_pu} for biomass generators."
f"Must-run condition enabled: Setting p_min_pu = {p_min_pu} for biogas generators."
)
links_i = n.links[
(n.links.carrier == "solid biomass")
& (n.links.bus0.str.startswith(tuple(regions)))
(n.links.carrier == "biogas") & (n.links.bus0.str.startswith(tuple(regions)))
].index
n.links.loc[links_i, "p_min_pu"] = p_min_pu

Expand Down Expand Up @@ -863,11 +862,11 @@ def force_retrofit(n, params):
snakemake.params.length_factor,
)

if snakemake.params.biomass_must_run["enable"]:
must_run_biomass(
if snakemake.params.biogas_must_run["enable"]:
must_run_biogas(
n,
snakemake.params.biomass_must_run["p_min_pu"],
snakemake.params.biomass_must_run["regions"],
snakemake.params.biogas_must_run["p_min_pu"],
snakemake.params.biogas_must_run["regions"],
)

if snakemake.params.H2_plants["enable"]:
Expand Down

0 comments on commit 5ca354d

Please sign in to comment.