Skip to content

Commit c06c323

Browse files
author
cpschau
committed
convert chps to eops if no urban central heat bus is available
1 parent d319574 commit c06c323

File tree

1 file changed

+11
-34
lines changed

1 file changed

+11
-34
lines changed

scripts/add_existing_baseyear.py

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -663,38 +663,6 @@ def add_chp_plants(n, grouping_years, costs, baseyear):
663663
)
664664

665665
# CHPs that are not from MaStR
666-
667-
if options["heat_vent"]["urban central"]:
668-
uch_buses = n.buses.index[n.buses.carrier == "urban central heat"]
669-
missing_uch_buses = pd.Series(
670-
{
671-
bus + " urban central heat": bus
672-
for bus in set(chp.bus.unique())
673-
if bus + " urban central heat" not in uch_buses
674-
}
675-
)
676-
if not missing_uch_buses.empty:
677-
logger.info(f"add buses {missing_uch_buses}")
678-
679-
n.add(
680-
"Bus",
681-
missing_uch_buses.index,
682-
carrier="urban central heat",
683-
location=missing_uch_buses,
684-
)
685-
# Attach heat vent to these buses
686-
n.add(
687-
"Generator",
688-
missing_uch_buses.index,
689-
suffix=" vent",
690-
bus=missing_uch_buses.index,
691-
carrier="urban central heat vent",
692-
p_nom_extendable=True,
693-
p_max_pu=0,
694-
p_min_pu=-1,
695-
unit="MWh_th",
696-
)
697-
698666
chp_nodal_p_nom = chp.pivot_table(
699667
index=["grouping_year", "Fueltype"],
700668
columns="bus",
@@ -719,6 +687,15 @@ def add_chp_plants(n, grouping_years, costs, baseyear):
719687
n.links.loc[bus + suffix, "p_nom"] = p_nom.loc[bus]
720688
continue
721689

690+
# CHPs are represented as EOP if no urban central heat bus is available
691+
if f"{bus} urban central heat" in n.buses.index:
692+
bus2 = bus + " urban central heat"
693+
else:
694+
logger.warning(
695+
f"Bus {bus} urban central heat not found. CHP is represented as EOP."
696+
)
697+
bus2 = ""
698+
722699
if generator != "urban central solid biomass CHP":
723700
# lignite CHPs are not in DEA database - use coal CHP parameters
724701
key = keys[generator]
@@ -732,7 +709,7 @@ def add_chp_plants(n, grouping_years, costs, baseyear):
732709
suffix=f" urban central {generator} CHP-{grouping_year}",
733710
bus0=bus0,
734711
bus1=bus,
735-
bus2=bus + " urban central heat",
712+
bus2=bus2,
736713
bus3="co2 atmosphere",
737714
carrier=f"urban central {generator} CHP",
738715
p_nom=p_nom[bus] / costs.at[key, "efficiency"],
@@ -755,7 +732,7 @@ def add_chp_plants(n, grouping_years, costs, baseyear):
755732
suffix=f" urban {key}-{grouping_year}",
756733
bus0=spatial.biomass.df.loc[p_nom.index]["nodes"],
757734
bus1=bus,
758-
bus2=bus + " urban central heat",
735+
bus2=bus2,
759736
carrier=generator,
760737
p_nom=p_nom[bus] / costs.at[key, "efficiency"],
761738
capital_cost=costs.at[key, "capital_cost"]

0 commit comments

Comments
 (0)