Skip to content

Commit

Permalink
Fix problematic calculation of capital_costs (PtH2/PtO2-related) and …
Browse files Browse the repository at this point in the history
…change carrier name of PtHeat- and PtO2-links
  • Loading branch information
lenzim97 committed Jan 15, 2025
1 parent 9222333 commit 685fa16
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
35 changes: 19 additions & 16 deletions src/egon/data/datasets/hydrogen_etrago/power_to_h2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from AC
* Fuel cells (carrier name: 'H2_to_power'): techonology to produce
power from H2
* Waste_heat usage (carrier name: 'power_to_Heat'): Components to use
* Waste_heat usage (carrier name: 'PtH2_waste_heat'): Components to use
waste heat as by-product from electrolysis
* Oxygen usage (carrier name: 'power_to_O2'): Components to use
* Oxygen usage (carrier name: 'PtH2_O2'): Components to use
oxygen as by-product from elctrolysis
Expand Down Expand Up @@ -282,7 +282,7 @@ def export_o2_buses_to_db(df):
conn.execute(
text(
f"""DELETE FROM {targets["links"]["schema"]}.{targets["links"]["table"]}
WHERE carrier IN ('power_to_H2', 'H2_to_power', 'power_to_O2', 'power_to_Heat')
WHERE carrier IN ('power_to_H2', 'H2_to_power', 'PtH2_waste_heat', 'PtH2_O2')
AND scn_name = '{SCENARIO_NAME}'
"""
)
Expand Down Expand Up @@ -393,7 +393,8 @@ def find_h2_grid_connection(df_AC, df_h2, buffer_h2, buffer_AC, sub_type):
intersection = buffered_AC.intersection(h2_row['buffer'])

if not intersection.is_empty:
distance = row['geom'].distance(h2_row['geom_link'])
distance_AC = row['geom'].distance(intersection.centroid)
distance_H2 = h2_row['geom_link'].distance(intersection.centroid)
distance_to_0 = row['geom'].distance(h2_row['geom_bus0'])
distance_to_1 = row['geom'].distance(h2_row['geom_bus1'])

Expand All @@ -404,14 +405,15 @@ def find_h2_grid_connection(df_AC, df_h2, buffer_h2, buffer_AC, sub_type):
bus_H2 = h2_row['bus1']
point_H2 = h2_row['geom_bus1']

if distance < nearest_distance:
nearest_distance = distance
if distance_H2 < nearest_distance:
nearest_distance = distance_H2
nearest_match = {
'bus_h2': bus_H2,
'bus_AC': row['id'],
'geom_h2': point_H2,
'geom_AC': row['geom'],
'distance_h2': distance,
'distance_h2': distance_H2,
'distance_ac': distance_AC,
'intersection': intersection,
'sub_type': sub_type,
}
Expand Down Expand Up @@ -700,7 +702,7 @@ def create_link_dataframes(links_h2, links_heat, links_O2):

####poower_to_H2
for idx, row in links_h2.iterrows():
capital_cost_H2 = H2_COST_PIPELINE + ELZ_CAPEX_STACK + ELZ_CAPEX_SYSTEM + ELZ_OPEX # [EUR/MW/YEAR]
capital_cost_H2 = H2_COST_PIPELINE * row['distance_h2']/1000 + ELZ_CAPEX_STACK + ELZ_CAPEX_SYSTEM + ELZ_OPEX # [EUR/MW/YEAR]
capital_cost_AC = AC_COST_CABLE * row['distance_ac']/1000 + AC_TRANS # [EUR/MW/YEAR]
capital_cost_PtH2 = capital_cost_AC + capital_cost_H2

Expand All @@ -725,7 +727,7 @@ def create_link_dataframes(links_h2, links_heat, links_O2):
power_to_H2 = pd.concat([power_to_H2, pd.DataFrame([power_to_H2_entry])], ignore_index=True)

####H2_to_power
capital_cost_H2 = H2_COST_PIPELINE + FUEL_CELL_COST # [EUR/MW/YEAR]
capital_cost_H2 = H2_COST_PIPELINE * row['distance_h2']/1000 + FUEL_CELL_COST # [EUR/MW/YEAR]
capital_cost_AC = AC_COST_CABLE * row['distance_ac']/1000 + AC_TRANS # [EUR/MW/YEAR]
capital_cost_H2tP = capital_cost_AC + capital_cost_H2
H2_to_power_entry = {
Expand Down Expand Up @@ -757,7 +759,7 @@ def create_link_dataframes(links_h2, links_heat, links_O2):
"link_id": next(next_max_link_id),
"bus0": row["bus_AC"],
"bus1": row["bus_heat"],
"carrier": "power_to_Heat",
"carrier": "PtH2_waste_heat",
"efficiency": 1,
"lifetime": 25,
"p_nom": 0,
Expand Down Expand Up @@ -799,7 +801,7 @@ def create_link_dataframes(links_h2, links_heat, links_O2):
"link_id": next(next_max_link_id),
"bus0": row["bus_AC"],
"bus1": row["bus_O2"],
"carrier": "power_to_O2",
"carrier": "PtH2_O2",
"efficiency": 1,
"lifetime": 25,
"p_nom": o2_ec_h,
Expand All @@ -813,7 +815,7 @@ def create_link_dataframes(links_h2, links_heat, links_O2):
}
power_to_O2 = pd.concat([power_to_O2, pd.DataFrame([power_to_o2_entry])], ignore_index=True)

return power_to_H2, power_to_Heat, power_to_O2
return power_to_H2, H2_to_power, power_to_Heat, power_to_O2



Expand Down Expand Up @@ -1002,7 +1004,7 @@ def delete_unconnected_o2_buses():
DELETE FROM {targets['buses']['schema']}.{targets['buses']['table']}
WHERE carrier = 'O2' AND scn_name = '{SCENARIO_NAME}'
AND bus_id NOT IN (SELECT bus1 FROM {targets['links']['schema']}.{targets['links']['table']}
WHERE carrier = 'power_to_O2')
WHERE carrier = 'PtH2_O2')
"""
)

Expand All @@ -1015,10 +1017,11 @@ def execute_PtH2_method():
o2_links_hvmv = find_o2_connections(dfs[WWTP], potential_locations[potential_locations.sub_type=='HVMV'], 'hvmv_id')
o2_links_ehv = find_o2_connections(dfs[WWTP], potential_locations[potential_locations.sub_type=='EHV'], 'ehv_id')
o2_links=pd.concat([o2_links_hvmv, o2_links_ehv], ignore_index=True)
power_to_H2, power_to_Heat, power_to_O2 = create_link_dataframes(potential_locations, heat_links, o2_links)
power_to_H2, H2_to_power, power_to_Heat, power_to_O2 = create_link_dataframes(potential_locations, heat_links, o2_links)
export_links_to_db(power_to_H2,'power_to_H2')
export_links_to_db(power_to_Heat, 'power_to_Heat')
export_links_to_db(power_to_O2, 'power_to_O2')
export_links_to_db(power_to_Heat, 'PtH2_waste_heat')
export_links_to_db(power_to_O2, 'PtH2_O2')
export_links_to_db(H2_to_power, 'H2_to_power')
o2_loads_df = insert_o2_load_points(power_to_O2)
o2_timeseries = insert_o2_load_timeseries(o2_loads_df)
insert_o2_generators(power_to_O2)
Expand Down
4 changes: 2 additions & 2 deletions src/egon/data/datasets/scenario_parameters/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ def gas(scenario):
"H2_to_CH4": read_costs(costs, "methanation", "efficiency"),
"OCGT": read_costs(costs, "OCGT", "efficiency"),
"power_to_Heat": 0.2, # source: project internal assumption Fraunhofer ISE
"power_to_O2": 0.04, # source: Sayed Sadat, Modeling Regional Utilization of the electrolysers Co-Products Oxygen and Heat in Germany, 2024
"power_to_O2": 0.015, # source: Sayed Sadat, Modeling Regional Utilization of the electrolysers Co-Products Oxygen and Heat in Germany, 2024
}

# Insert FOM in %
Expand Down Expand Up @@ -935,7 +935,7 @@ def gas(scenario):
parameters["O2_capital_cost"][diameter] = annualize_capital_costs(
parameters["O2_pipeline_costs"][diameter],
parameters["lifetime"]["O2_components"],
global_settings("eGon2035")["interest_rate"],
interest_rate,
)

parameters["marginal_cost"] = {
Expand Down

0 comments on commit 685fa16

Please sign in to comment.