@@ -204,6 +204,10 @@ def define_components(mod):
204204 become non-linear.
205205
206206 """
207+ # When this variable is True we only allow positive fuel costs
208+ # This simplifies the model since we can set some of our constraints
209+ # as greater than instead of equals.
210+ ONLY_POSITIVE_RFM_COSTS = False
207211
208212 mod .REGIONAL_FUEL_MARKETS = Set (dimen = 1 )
209213 mod .rfm_fuel = Param (mod .REGIONAL_FUEL_MARKETS , within = mod .FUELS )
@@ -234,7 +238,8 @@ def zone_rfm_init(m, load_zone, fuel):
234238 dimen = 3 , validate = lambda m , r , p , st : (
235239 r in m .REGIONAL_FUEL_MARKETS and p in m .PERIODS ))
236240 mod .rfm_supply_tier_cost = Param (
237- mod .RFM_SUPPLY_TIERS , within = Reals )
241+ mod .RFM_SUPPLY_TIERS ,
242+ within = PositiveReals if ONLY_POSITIVE_RFM_COSTS else Reals )
238243 mod .rfm_supply_tier_limit = Param (
239244 mod .RFM_SUPPLY_TIERS , within = NonNegativeReals , default = float ('inf' ))
240245 mod .min_data_check (
@@ -333,12 +338,16 @@ def GENS_FOR_RFM_PERIOD_rule(m, rfm, p):
333338 enforce_fuel_consumption_scaling_factor = 1e-2
334339
335340 def Enforce_Fuel_Consumption_rule (m , rfm , p ):
336- return m .FuelConsumptionInMarket [rfm , p ] * enforce_fuel_consumption_scaling_factor \
337- == enforce_fuel_consumption_scaling_factor * sum (
338- m .GenFuelUseRate [g , t , m .rfm_fuel [rfm ]] * m .tp_weight_in_year [t ]
339- for g in m .GENS_FOR_RFM_PERIOD [rfm , p ]
340- for t in m .TPS_IN_PERIOD [p ]
341- )
341+ lhs = m .FuelConsumptionInMarket [rfm , p ] * enforce_fuel_consumption_scaling_factor
342+ rhs = enforce_fuel_consumption_scaling_factor * sum (
343+ m .GenFuelUseRate [g , t , m .rfm_fuel [rfm ]] * m .tp_weight_in_year [t ] for g in m .GENS_FOR_RFM_PERIOD [rfm , p ] for
344+ t in m .TPS_IN_PERIOD [p ])
345+ # If we have only positive costs, FuelConsumptionInMarket will automatically
346+ # try to be minimized in which case we can use a one-sided constraint
347+ if ONLY_POSITIVE_RFM_COSTS :
348+ return lhs >= rhs
349+ else :
350+ return lhs == rhs
342351 mod .Enforce_Fuel_Consumption = Constraint (
343352 mod .REGIONAL_FUEL_MARKETS , mod .PERIODS ,
344353 rule = Enforce_Fuel_Consumption_rule )
0 commit comments