[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
52c6ce922c
commit
6b100d4b88
@ -3316,7 +3316,9 @@ def add_enhanced_geothermal(
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if len(spatial.geothermal_heat.nodes) > 1:
|
if len(spatial.geothermal_heat.nodes) > 1:
|
||||||
logger.warning("'add_enhanced_geothermal' not implemented for multiple geothermal nodes.")
|
logger.warning(
|
||||||
|
"'add_enhanced_geothermal' not implemented for multiple geothermal nodes."
|
||||||
|
)
|
||||||
|
|
||||||
config = snakemake.config
|
config = snakemake.config
|
||||||
|
|
||||||
@ -3335,21 +3337,20 @@ def add_enhanced_geothermal(
|
|||||||
# cost for ORC is subtracted, as it is already included in the geothermal cost.
|
# cost for ORC is subtracted, as it is already included in the geothermal cost.
|
||||||
# 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. + FOM))
|
(egs_annuity + FOM / (1.0 + FOM))
|
||||||
* (egs_potentials["CAPEX"] - costs.at["organice rankine cycle", "investment"])
|
* (egs_potentials["CAPEX"] - costs.at["organice rankine cycle", "investment"])
|
||||||
* Nyears
|
* Nyears
|
||||||
* 1000.
|
* 1000.0
|
||||||
)
|
)
|
||||||
assert (egs_potentials["capital_cost"] > 0).all(), "Error in EGS cost, negative values found."
|
assert (
|
||||||
|
egs_potentials["capital_cost"] > 0
|
||||||
|
).all(), "Error in EGS cost, negative values found."
|
||||||
|
|
||||||
plant_annuity = calculate_annuity(
|
plant_annuity = calculate_annuity(costs.at["organic rankine cycle", "lifetime"], dr)
|
||||||
costs.at["organic rankine cycle", "lifetime"],
|
|
||||||
dr
|
|
||||||
)
|
|
||||||
plant_capital_cost = (
|
plant_capital_cost = (
|
||||||
(plant_annuity + FOM / (1 + FOM)) *
|
(plant_annuity + FOM / (1 + FOM))
|
||||||
costs.at["organic rankine cycle", "investment"] *
|
* costs.at["organic rankine cycle", "investment"]
|
||||||
Nyears
|
* Nyears
|
||||||
)
|
)
|
||||||
|
|
||||||
efficiency_orc = costs.at["organic rankine cycle", "efficiency"]
|
efficiency_orc = costs.at["organic rankine cycle", "efficiency"]
|
||||||
@ -3381,16 +3382,14 @@ def add_enhanced_geothermal(
|
|||||||
|
|
||||||
if snakemake.params.sector["enhanced_geothermal_var_cf"]:
|
if snakemake.params.sector["enhanced_geothermal_var_cf"]:
|
||||||
efficiency = pd.read_csv(
|
efficiency = pd.read_csv(
|
||||||
snakemake.input.egs_capacity_factors,
|
snakemake.input.egs_capacity_factors, parse_dates=True, index_col=0
|
||||||
parse_dates=True,
|
)
|
||||||
index_col=0
|
|
||||||
)
|
|
||||||
logger.info("Adding Enhanced Geothermal with time-varying capacity factors.")
|
logger.info("Adding Enhanced Geothermal with time-varying capacity factors.")
|
||||||
else:
|
else:
|
||||||
efficiency = pd.Series(1, overlap.index)
|
efficiency = pd.Series(1, overlap.index)
|
||||||
|
|
||||||
# if urban central heat exists, adds geothermal as CHP
|
# if urban central heat exists, adds geothermal as CHP
|
||||||
as_chp = 'urban central heat' in n.buses.carrier
|
as_chp = "urban central heat" in n.buses.carrier
|
||||||
if as_chp:
|
if as_chp:
|
||||||
logger.info("Adding Enhanced Geothermal as Combined Heat and Power.")
|
logger.info("Adding Enhanced Geothermal as Combined Heat and Power.")
|
||||||
|
|
||||||
@ -3426,12 +3425,15 @@ def add_enhanced_geothermal(
|
|||||||
"Bus",
|
"Bus",
|
||||||
f"geothermal heat surface {bus}",
|
f"geothermal heat surface {bus}",
|
||||||
location=bus,
|
location=bus,
|
||||||
)
|
)
|
||||||
|
|
||||||
bus_eta = pd.concat((
|
bus_eta = pd.concat(
|
||||||
efficiency[bus].rename(idx)
|
(
|
||||||
for idx in f"{bus} enhanced geothermal" + appendix
|
efficiency[bus].rename(idx)
|
||||||
), axis=1)
|
for idx in f"{bus} enhanced geothermal" + appendix
|
||||||
|
),
|
||||||
|
axis=1,
|
||||||
|
)
|
||||||
|
|
||||||
n.madd(
|
n.madd(
|
||||||
"Link",
|
"Link",
|
||||||
@ -3448,29 +3450,30 @@ def add_enhanced_geothermal(
|
|||||||
|
|
||||||
n.add(
|
n.add(
|
||||||
"Link",
|
"Link",
|
||||||
bus + ' geothermal organic rankine cycle',
|
bus + " geothermal organic rankine cycle",
|
||||||
bus0=f"geothermal heat surface {bus}",
|
bus0=f"geothermal heat surface {bus}",
|
||||||
bus1=bus,
|
bus1=bus,
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
carrier="geothermal organic rankine cycle",
|
carrier="geothermal organic rankine cycle",
|
||||||
capital_cost=plant_capital_cost * efficiency_orc,
|
capital_cost=plant_capital_cost * efficiency_orc,
|
||||||
efficiency=efficiency_orc if not as_chp else efficiency_orc * 2.,
|
efficiency=efficiency_orc if not as_chp else efficiency_orc * 2.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
if as_chp and bus + " urban central heat" in n.buses.index:
|
if as_chp and bus + " urban central heat" in n.buses.index:
|
||||||
n.add(
|
n.add(
|
||||||
"Link",
|
"Link",
|
||||||
bus + ' geothermal heat district heat',
|
bus + " geothermal heat district heat",
|
||||||
bus0=f"geothermal heat surface {bus}",
|
bus0=f"geothermal heat surface {bus}",
|
||||||
bus1=bus + ' urban central heat',
|
bus1=bus + " urban central heat",
|
||||||
carrier="geothermal district heat",
|
carrier="geothermal district heat",
|
||||||
capital_cost=plant_capital_cost * efficiency_orc * costs.at["geothermal", "district heating cost"],
|
capital_cost=plant_capital_cost
|
||||||
efficiency=efficiency_dh * 2.,
|
* efficiency_orc
|
||||||
|
* costs.at["geothermal", "district heating cost"],
|
||||||
|
efficiency=efficiency_dh * 2.0,
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if "snakemake" not in globals():
|
if "snakemake" not in globals():
|
||||||
from _helpers import mock_snakemake
|
from _helpers import mock_snakemake
|
||||||
|
@ -763,13 +763,14 @@ def add_pipe_retrofit_constraint(n):
|
|||||||
|
|
||||||
|
|
||||||
def add_geothermal_chp_constraint(n):
|
def add_geothermal_chp_constraint(n):
|
||||||
elec_index = n.links.loc[n.links.carrier == 'geothermal organic rankine cycle'].index
|
elec_index = n.links.loc[
|
||||||
heat_index = n.links.loc[n.links.carrier == 'geothermal heat district heat'].index
|
n.links.carrier == "geothermal organic rankine cycle"
|
||||||
|
].index
|
||||||
|
heat_index = n.links.loc[n.links.carrier == "geothermal heat district heat"].index
|
||||||
|
|
||||||
p_nom_lhs = (
|
p_nom_lhs = (
|
||||||
n.model["Link-p_nom"].loc[heat_index]
|
n.model["Link-p_nom"].loc[heat_index] - n.model["Link-p_nom"].loc[elec_index]
|
||||||
- n.model["Link-p_nom"].loc[elec_index]
|
)
|
||||||
)
|
|
||||||
|
|
||||||
n.model.add_constraints(
|
n.model.add_constraints(
|
||||||
p_nom_lhs == 0,
|
p_nom_lhs == 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user