mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 00:08:52 -06:00
Properly handle reserve_shortfall when variable not present.
This commit is contained in:
@@ -51,7 +51,9 @@ function solution(model::JuMP.Model)::OrderedDict
|
|||||||
sol["Switch on"] = timeseries(model[:switch_on], instance.units)
|
sol["Switch on"] = timeseries(model[:switch_on], instance.units)
|
||||||
sol["Switch off"] = timeseries(model[:switch_off], instance.units)
|
sol["Switch off"] = timeseries(model[:switch_off], instance.units)
|
||||||
sol["Reserve (MW)"] = timeseries(model[:reserve], instance.units)
|
sol["Reserve (MW)"] = timeseries(model[:reserve], instance.units)
|
||||||
sol["Reserve shortfall (MW)"] = model[:reserve_shortfall]
|
sol["Reserve shortfall (MW)"] = (model[:instance].shortfall_penalty[t] >= 0) ?
|
||||||
|
model[:reserve_shortfall] :
|
||||||
|
[0 for t in 1:T]
|
||||||
sol["Net injection (MW)"] =
|
sol["Net injection (MW)"] =
|
||||||
timeseries(model[:net_injection], instance.buses)
|
timeseries(model[:net_injection], instance.buses)
|
||||||
sol["Load curtail (MW)"] = timeseries(model[:curtail], instance.buses)
|
sol["Load curtail (MW)"] = timeseries(model[:curtail], instance.buses)
|
||||||
|
|||||||
@@ -324,7 +324,9 @@ function _validate_reserve_and_demand(instance, solution, tol = 0.01)
|
|||||||
# Verify spinning reserves
|
# Verify spinning reserves
|
||||||
reserve =
|
reserve =
|
||||||
sum(solution["Reserve (MW)"][g.name][t] for g in instance.units)
|
sum(solution["Reserve (MW)"][g.name][t] for g in instance.units)
|
||||||
reserve_shortfall = solution["Reserve shortfall (MW)"][t]
|
reserve_shortfall = (instance.shortfall_penalty[t] >= 0) ?
|
||||||
|
solution["Reserve shortfall (MW)"][t] : 0
|
||||||
|
|
||||||
if reserve + reserve_shortfall < instance.reserves.spinning[t] - tol
|
if reserve + reserve_shortfall < instance.reserves.spinning[t] - tol
|
||||||
@error @sprintf(
|
@error @sprintf(
|
||||||
"Insufficient spinning reserves at time %d (%.2f + %.2f should be %.2f)",
|
"Insufficient spinning reserves at time %d (%.2f + %.2f should be %.2f)",
|
||||||
|
|||||||
Reference in New Issue
Block a user