Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.
64 changes: 32 additions & 32 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: 20241203-force-onwind-south
prefix: 20241211-kernnetz-cost
name:
# - CurrentPolicies
- KN2045_Bal_v4
Expand Down Expand Up @@ -61,7 +61,7 @@ scenario:
ll:
- vopt
clusters:
- 27 #current options: 27, 49
- 49 #current options: 27, 49
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert the config changes

opts:
- ''
sector_opts:
Expand Down Expand Up @@ -205,38 +205,38 @@ clustering:
# print(fw.div(fw.sum()).subtract(5e-5).round(4).to_dict().__repr__().replace(",","\n"))
focus_weights:
# 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
# '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 49
# 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
'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
20 changes: 18 additions & 2 deletions workflow/scripts/export_ariadne_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -5003,7 +5003,7 @@ def hack_AC_projects(n, s_nom_start, model_year, snakemake):
return n


def process_postnetworks(n, n_start, model_year, snakemake, costs):
def process_postnetworks(n, n_start, model_year, snakemake, costs, modelyears):
post_discretization = snakemake.params.post_discretization

# logger.info("Post-Discretizing H2 pipeline")
Expand All @@ -5022,6 +5022,20 @@ def process_postnetworks(n, n_start, model_year, snakemake, costs):
# # the same logic is applied to p_nom and p_nom_min
# n.links.loc[h2_links, attr] = n.links.loc[h2_links, attr].apply(_h2_lambda)

logger.info("Assing average Kernnetz cost to carrier H2 pipeline (Kernnetz)")
current_costs = costs[modelyears.index(str(model_year))]
h2_links_kern = n.links.query("carrier == 'H2 pipeline (Kernnetz))'").index
capital_costs = (
0.7 * current_costs.at["H2 (g) pipeline", "fixed"]
+ 0.3 * current_costs.at["H2 (g) pipeline repurposed", "fixed"]
) * n.links.loc[h2_links_kern, "length"]
overnight_costs = (
0.7 * current_costs.at["H2 (g) pipeline", "investment"]
+ 0.3 * current_costs.at["H2 (g) pipeline repurposed", "investment"]
) * n.links.loc[h2_links_kern, "length"]
n.links.loc[h2_links_kern, "capital_cost"] = capital_costs
n.links.loc[h2_links_kern, "overnight_cost"] = overnight_costs

logger.info("Post-Discretizing DC links")
_dc_lambda = lambda x: get_discretized_value(
x,
Expand Down Expand Up @@ -5266,7 +5280,9 @@ def get_data(
modelyears = [fn[-7:-3] for fn in snakemake.input.networks]
# Hack the transmission projects
networks = [
process_postnetworks(n.copy(), _networks[0], int(my), snakemake, costs)
process_postnetworks(
n.copy(), _networks[0], int(my), snakemake, costs, modelyears
)
for n, my in zip(_networks, modelyears)
]

Expand Down
39 changes: 26 additions & 13 deletions workflow/scripts/modify_prenetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,18 +206,31 @@ def add_wasserstoff_kernnetz(n, wkn, costs):

names = wkn_new.index + f"-kernnetz-{investment_year}"

capital_costs = np.where(
wkn_new.retrofitted == False,
costs.at["H2 (g) pipeline", "fixed"] * wkn_new.length.values,
costs.at["H2 (g) pipeline repurposed", "fixed"] * wkn_new.length.values,
)

overnight_costs = np.where(
wkn_new.retrofitted == False,
costs.at["H2 (g) pipeline", "investment"] * wkn_new.length.values,
costs.at["H2 (g) pipeline repurposed", "investment"]
* wkn_new.length.values,
)
# capital_costs = np.where(
# wkn_new.retrofitted == False,
# costs.at["H2 (g) pipeline", "fixed"] * wkn_new.length.values,
# costs.at["H2 (g) pipeline repurposed", "fixed"] * wkn_new.length.values,
# )

# overnight_costs = np.where(
# wkn_new.retrofitted == False,
# costs.at["H2 (g) pipeline", "investment"] * wkn_new.length.values,
# costs.at["H2 (g) pipeline repurposed", "investment"]
# * wkn_new.length.values,
# )

# fix: pipes from Kernnetz data in the model are over-proportinally many retrofitted projects as they are longer
# do not use own cost data for retrofitted and new build pipes as this would underestimate the investment cost
# reconstruct average Kernnetz invest (250€/MW*km) from our costs data

capital_costs = (
0.7 * costs.at["H2 (g) pipeline", "fixed"]
+ 0.3 * costs.at["H2 (g) pipeline repurposed", "fixed"]
) * wkn_new.length.values
overnight_costs = (
0.7 * costs.at["H2 (g) pipeline", "investment"]
+ 0.3 * costs.at["H2 (g) pipeline repurposed", "investment"]
) * wkn_new.length.values

lifetime = np.where(
wkn_new.retrofitted == False,
Expand Down Expand Up @@ -1283,7 +1296,7 @@ def scale_capacity(n, scaling):
snakemake = mock_snakemake(
"modify_prenetwork",
simpl="",
clusters=27,
clusters=49,
opts="",
ll="vopt",
sector_opts="none",
Expand Down
15 changes: 10 additions & 5 deletions workflow/scripts/plot_ariadne_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ def plot_elec_map_de(
):

m = network.copy()
m.mremove("Bus", m.buses[m.buses.x == 0].index)
m.remove("Bus", m.buses[m.buses.x == 0].index)
m.buses.drop(m.buses.index[m.buses.carrier != "AC"], inplace=True)

m_base = base_network.copy()
Expand Down Expand Up @@ -1345,11 +1345,14 @@ def plot_elec_map_de(
(m.links.index.str.startswith("DC") | m.links.index.str.startswith("TYNDP"))
& ~m.links.reversed
].index
tprojs_all = m.links.loc[
(m.links.index.str.startswith("DC") | m.links.index.str.startswith("TYNDP"))
].index
links_i = m.links.index[m.links.carrier == "DC"]
total_exp_linkw = (m.links.p_nom_opt - m_base.links.p_nom).loc[links_i]
total_exp_linkw = (m.links.p_nom_opt - m_base.links.p_nom_min).loc[links_i]
total_exp_linkw[tprojs] = m.links.p_nom_opt[tprojs]
total_exp_noStart_linkw = total_exp_linkw.copy()
total_exp_noStart_linkw.loc[tprojs] = 0
total_exp_noStart_linkw.loc[tprojs_all] = 0
startnetz_linkw = m.links.p_nom_opt[tprojs]

if expansion_case == "total-expansion":
Expand All @@ -1375,7 +1378,7 @@ def plot_elec_map_de(
bus_colors=tech_colors,
line_widths=line_widths,
line_colors=tech_colors["AC"],
link_widths=link_widths,
link_widths=link_widths.clip(0),
link_colors=tech_colors["DC"],
)

Expand Down Expand Up @@ -1506,7 +1509,9 @@ def plot_elec_map_de(

# Hack the transmission projects
networks = [
process_postnetworks(n.copy(), _networks[0], int(my), snakemake, costs)
process_postnetworks(
n.copy(), _networks[0], int(my), snakemake, costs, modelyears
)
for n, my in zip(_networks, modelyears)
]
del _networks
Expand Down
Loading