diff --git a/src/solution/solution.jl b/src/solution/solution.jl index 9e346bb..419fe40 100644 --- a/src/solution/solution.jl +++ b/src/solution/solution.jl @@ -51,7 +51,9 @@ function solution(model::JuMP.Model)::OrderedDict sol["Switch on"] = timeseries(model[:switch_on], instance.units) sol["Switch off"] = timeseries(model[:switch_off], 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)"] = timeseries(model[:net_injection], instance.buses) sol["Load curtail (MW)"] = timeseries(model[:curtail], instance.buses) diff --git a/src/validation/validate.jl b/src/validation/validate.jl index 269bab3..d55a460 100644 --- a/src/validation/validate.jl +++ b/src/validation/validate.jl @@ -324,7 +324,9 @@ function _validate_reserve_and_demand(instance, solution, tol = 0.01) # Verify spinning reserves reserve = 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 @error @sprintf( "Insufficient spinning reserves at time %d (%.2f + %.2f should be %.2f)",