Skip to content

Commit fd0e046

Browse files
Fix a bug with fuel unavailability when calculating fuel costs related to dispatch with the fuel markets module.
1 parent 889f47f commit fd0e046

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

switch_model/energy_sources/fuel_costs/markets.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,10 @@ def Enforce_Fuel_Consumption_rule(m, rfm, p):
347347
)
348348

349349
def GenFuelCosts_rule(m, g, t, f):
350-
rfm = m.zone_rfm[m.gen_load_zone[g], f]
350+
try:
351+
rfm = m.zone_rfm[m.gen_load_zone[g], f]
352+
except KeyError: # Fuel is unavailable
353+
return 0.0
351354
p = m.tp_period[t]
352355
return m.GenFuelUseRate[g, t, f] * m.AverageFuelCosts[rfm, p]
353356
mod.GenFuelCosts = Expression(

0 commit comments

Comments
 (0)