fixed bug, first functional version

This commit is contained in:
LukasFrankenQ 2023-11-14 01:35:37 +00:00
parent 0205d3efbf
commit 928c73138f
3 changed files with 23 additions and 25 deletions

View File

@ -984,6 +984,7 @@ plotting:
other: '#000000' other: '#000000'
geothermal: '#ba91b1' geothermal: '#ba91b1'
geothermal heat: '#ba91b1' geothermal heat: '#ba91b1'
geothermal organic rankine cycle: '#ba91b1'
AC: "#70af1d" AC: "#70af1d"
AC-AC: "#70af1d" AC-AC: "#70af1d"
AC line: "#70af1d" AC line: "#70af1d"

View File

@ -224,8 +224,8 @@ rule build_solar_thermal_profiles:
output: output:
solar_thermal=RESOURCES + "solar_thermal_{scope}_elec_s{simpl}_{clusters}.nc", solar_thermal=RESOURCES + "solar_thermal_{scope}_elec_s{simpl}_{clusters}.nc",
resources: resources:
mem_mb=20000, mem_mb=2000,
threads: 16 threads: 1
log: log:
LOGS + "build_solar_thermal_profiles_{scope}_s{simpl}_{clusters}.log", LOGS + "build_solar_thermal_profiles_{scope}_s{simpl}_{clusters}.log",
benchmark: benchmark:

View File

@ -3338,9 +3338,8 @@ def add_enhanced_geothermal(
# The orc cost are attributed to a separate link representing the ORC. # The orc cost are attributed to a separate link representing the ORC.
egs_potentials["capital_cost"] = ( egs_potentials["capital_cost"] = (
(egs_annuity + FOM / (1.0 + FOM)) (egs_annuity + FOM / (1.0 + FOM))
* (egs_potentials["CAPEX"] - costs.at["organice rankine cycle", "investment"]) * (egs_potentials["CAPEX"] * 1000. - costs.at["organic rankine cycle", "investment"])
* Nyears * Nyears
* 1000.0
) )
assert ( assert (
egs_potentials["capital_cost"] > 0 egs_potentials["capital_cost"] > 0
@ -3372,7 +3371,7 @@ def add_enhanced_geothermal(
unit="MWh_th", unit="MWh_th",
) )
n.add( n.madd(
"Generator", "Generator",
spatial.geothermal_heat.nodes, spatial.geothermal_heat.nodes,
bus=spatial.geothermal_heat.nodes, bus=spatial.geothermal_heat.nodes,
@ -3412,46 +3411,44 @@ def add_enhanced_geothermal(
else: else:
appendix = " " + pd.Index(np.arange(len(bus_egs)).astype(str)) appendix = " " + pd.Index(np.arange(len(bus_egs)).astype(str))
bus_egs.index = np.arange(len(bus_egs)).astype(str)
p_nom_max = bus_egs["p_nom_max"]
p_nom_max.index = f"{bus} enhanced geothermal" + appendix
capital_cost = bus_egs["capital_cost"]
capital_cost.index = f"{bus} enhanced geothermal" + appendix
# add surface bus # add surface bus
n.add( n.add(
"Bus", "Bus",
f"geothermal heat surface {bus}", f"{bus} geothermal heat surface",
location=bus,
) )
bus_egs.index = np.arange(len(bus_egs)).astype(str)
well_name = f"{bus} enhanced geothermal" + appendix
bus_eta = pd.concat( bus_eta = pd.concat(
( (
efficiency[bus].rename(idx) efficiency[bus].rename(idx)
for idx in f"{bus} enhanced geothermal" + appendix for idx in well_name
), ),
axis=1, axis=1,
) )
p_nom_max = bus_egs["p_nom_max"]
capital_cost = bus_egs["capital_cost"]
bus1 = pd.Series(f"{bus} geothermal heat surface", well_name)
n.madd( n.madd(
"Link", "Link",
f"{bus} enhanced geothermal" + appendix, well_name,
location=bus, location=bus,
bus0=spatial.geothermal_heat.nodes, bus0=spatial.geothermal_heat.nodes,
bus1=f"geothermal heat surface {bus}", bus1=bus1,
carrier="geothermal heat", carrier="geothermal heat",
p_nom_extendable=True, p_nom_extendable=True,
p_nom_max=p_nom_max / efficiency, p_nom_max=p_nom_max.set_axis(well_name) / efficiency_orc,
capital_cost=capital_cost * efficiency, capital_cost=capital_cost.set_axis(well_name),
efficiency=bus_eta, efficiency=bus_eta,
) )
n.add( n.add(
"Link", "Link",
bus + " geothermal organic rankine cycle", bus + " geothermal organic rankine cycle",
bus0=f"geothermal heat surface {bus}", bus0=f"{bus} geothermal heat surface",
bus1=bus, bus1=bus,
p_nom_extendable=True, p_nom_extendable=True,
carrier="geothermal organic rankine cycle", carrier="geothermal organic rankine cycle",
@ -3463,7 +3460,7 @@ def add_enhanced_geothermal(
n.add( n.add(
"Link", "Link",
bus + " geothermal heat district heat", bus + " geothermal heat district heat",
bus0=f"geothermal heat surface {bus}", bus0=f"{bus} geothermal heat surface",
bus1=bus + " urban central heat", bus1=bus + " urban central heat",
carrier="geothermal district heat", carrier="geothermal district heat",
capital_cost=plant_capital_cost capital_cost=plant_capital_cost
@ -3472,13 +3469,13 @@ def add_enhanced_geothermal(
efficiency=efficiency_dh * 2.0, efficiency=efficiency_dh * 2.0,
p_nom_extendable=True, p_nom_extendable=True,
) )
else: elif as_chp and not bus + " urban central heat" in n.buses.index:
n.links.at[bus + " geothermal organic rankine cycle", "efficiency"] = efficiency_orc n.links.at[bus + " geothermal organic rankine cycle", "efficiency"] = efficiency_orc
if snakemake.params.sector["enhanced_geothermal_flexible"]: if snakemake.params.sector["enhanced_geothermal_flexible"]:
# this StorageUnit represents flexible operation using the geothermal reservoir. # this StorageUnit represents flexible operation using the geothermal reservoir.
# Hence, it is intuitively wrong to install it at the surface bus, # Hence, it is counter-intuitive to install it at the surface bus,
# this is however the more lean and computationally efficient solution. # this is however the more lean and computationally efficient solution.
max_hours = snakemake.params.sector["enhanced_geothermal_reservoir_max_hours"] max_hours = snakemake.params.sector["enhanced_geothermal_reservoir_max_hours"]
@ -3488,7 +3485,7 @@ def add_enhanced_geothermal(
n.add( n.add(
"StorageUnit", "StorageUnit",
bus + ' geothermal reservoir', bus + ' geothermal reservoir',
bus=f"geothermal heat surface {bus}", bus=f"{bus} geothermal heat surface",
carrier="geothermal heat", carrier="geothermal heat",
p_nom_extendable=True, p_nom_extendable=True,
p_min_pu=-1. - boost, p_min_pu=-1. - boost,