bug: add_electricity only add carriers in powerplant dataset for country subset

This commit is contained in:
Fabian Neumann 2024-05-25 21:13:47 +02:00
parent a60e6fca55
commit 7ad930ee2e

View File

@ -448,8 +448,6 @@ def attach_conventional_generators(
fuel_price=None, fuel_price=None,
): ):
carriers = list(set(conventional_carriers) | set(extendable_carriers["Generator"])) carriers = list(set(conventional_carriers) | set(extendable_carriers["Generator"]))
add_missing_carriers(n, carriers)
add_co2_emissions(n, costs, carriers)
# Replace carrier "natural gas" with the respective technology (OCGT or # Replace carrier "natural gas" with the respective technology (OCGT or
# CCGT) to align with PyPSA names of "carriers" and avoid filtering "natural # CCGT) to align with PyPSA names of "carriers" and avoid filtering "natural
@ -465,6 +463,11 @@ def attach_conventional_generators(
) )
ppl["efficiency"] = ppl.efficiency.fillna(ppl.efficiency_r) ppl["efficiency"] = ppl.efficiency.fillna(ppl.efficiency_r)
# reduce carriers to those in power plant dataset
carriers = list(set(carriers) & set(ppl.carrier.unique()))
add_missing_carriers(n, carriers)
add_co2_emissions(n, costs, carriers)
if unit_commitment is not None: if unit_commitment is not None:
committable_attrs = ppl.carrier.isin(unit_commitment).to_frame("committable") committable_attrs = ppl.carrier.isin(unit_commitment).to_frame("committable")
for attr in unit_commitment.index: for attr in unit_commitment.index: