|
|
@ -2,7 +2,7 @@
|
|
|
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
|
|
|
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
|
|
|
# Released under the modified BSD license. See COPYING.md for more details.
|
|
|
|
# Released under the modified BSD license. See COPYING.md for more details.
|
|
|
|
|
|
|
|
|
|
|
|
function _add_unit!(model::JuMP.Model, g::Unit, formulation::Formulation)
|
|
|
|
function _add_unit_first_stage!(model::JuMP.Model, g::Unit, formulation::Formulation)
|
|
|
|
if !all(g.must_run) && any(g.must_run)
|
|
|
|
if !all(g.must_run) && any(g.must_run)
|
|
|
|
error("Partially must-run units are not currently supported")
|
|
|
|
error("Partially must-run units are not currently supported")
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -11,22 +11,34 @@ function _add_unit!(model::JuMP.Model, g::Unit, formulation::Formulation)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Variables
|
|
|
|
# Variables
|
|
|
|
_add_production_vars!(model, g, formulation.prod_vars)
|
|
|
|
|
|
|
|
_add_spinning_reserve_vars!(model, g)
|
|
|
|
|
|
|
|
_add_flexiramp_reserve_vars!(model, g)
|
|
|
|
|
|
|
|
_add_startup_shutdown_vars!(model, g)
|
|
|
|
_add_startup_shutdown_vars!(model, g)
|
|
|
|
_add_status_vars!(model, g, formulation.status_vars)
|
|
|
|
_add_status_vars!(model, g, formulation.status_vars)
|
|
|
|
|
|
|
|
|
|
|
|
# Constraints and objective function
|
|
|
|
# Constraints and objective function
|
|
|
|
_add_min_uptime_downtime_eqs!(model, g)
|
|
|
|
_add_min_uptime_downtime_eqs!(model, g)
|
|
|
|
_add_net_injection_eqs!(model, g)
|
|
|
|
_add_startup_cost_eqs!(model, g, formulation.startup_costs)
|
|
|
|
_add_production_limit_eqs!(model, g, formulation.prod_vars)
|
|
|
|
_add_status_eqs!(model, g, formulation.status_vars)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _add_unit_second_stage!(model::JuMP.Model, g::Unit, formulation::Formulation,
|
|
|
|
|
|
|
|
scenario::UnitCommitmentScenario)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Variables
|
|
|
|
|
|
|
|
_add_production_vars!(model, g, formulation.prod_vars, scenario)
|
|
|
|
|
|
|
|
_add_spinning_reserve_vars!(model, g, scenario)
|
|
|
|
|
|
|
|
_add_flexiramp_reserve_vars!(model, g, scenario)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Constraints and objective function
|
|
|
|
|
|
|
|
_add_net_injection_eqs!(model, g, scenario)
|
|
|
|
|
|
|
|
_add_production_limit_eqs!(model, g, formulation.prod_vars, scenario)
|
|
|
|
_add_production_piecewise_linear_eqs!(
|
|
|
|
_add_production_piecewise_linear_eqs!(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
|
g,
|
|
|
|
g,
|
|
|
|
formulation.prod_vars,
|
|
|
|
formulation.prod_vars,
|
|
|
|
formulation.pwl_costs,
|
|
|
|
formulation.pwl_costs,
|
|
|
|
formulation.status_vars,
|
|
|
|
formulation.status_vars,
|
|
|
|
|
|
|
|
scenario
|
|
|
|
)
|
|
|
|
)
|
|
|
|
_add_ramp_eqs!(
|
|
|
|
_add_ramp_eqs!(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
@ -34,26 +46,64 @@ function _add_unit!(model::JuMP.Model, g::Unit, formulation::Formulation)
|
|
|
|
formulation.prod_vars,
|
|
|
|
formulation.prod_vars,
|
|
|
|
formulation.ramping,
|
|
|
|
formulation.ramping,
|
|
|
|
formulation.status_vars,
|
|
|
|
formulation.status_vars,
|
|
|
|
|
|
|
|
scenario
|
|
|
|
)
|
|
|
|
)
|
|
|
|
_add_startup_cost_eqs!(model, g, formulation.startup_costs)
|
|
|
|
_add_startup_shutdown_limit_eqs!(model, g, scenario)
|
|
|
|
_add_startup_shutdown_limit_eqs!(model, g)
|
|
|
|
|
|
|
|
_add_status_eqs!(model, g, formulation.status_vars)
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# function _add_unit!(model::JuMP.Model, g::Unit, formulation::Formulation)
|
|
|
|
|
|
|
|
# if !all(g.must_run) && any(g.must_run)
|
|
|
|
|
|
|
|
# error("Partially must-run units are not currently supported")
|
|
|
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
# if g.initial_power === nothing || g.initial_status === nothing
|
|
|
|
|
|
|
|
# error("Initial conditions for $(g.name) must be provided")
|
|
|
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# # Variables
|
|
|
|
|
|
|
|
# _add_production_vars!(model, g, formulation.prod_vars)
|
|
|
|
|
|
|
|
# _add_spinning_reserve_vars!(model, g)
|
|
|
|
|
|
|
|
# _add_flexiramp_reserve_vars!(model, g)
|
|
|
|
|
|
|
|
# _add_startup_shutdown_vars!(model, g)
|
|
|
|
|
|
|
|
# _add_status_vars!(model, g, formulation.status_vars)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# # Constraints and objective function
|
|
|
|
|
|
|
|
# _add_min_uptime_downtime_eqs!(model, g)
|
|
|
|
|
|
|
|
# _add_net_injection_eqs!(model, g)
|
|
|
|
|
|
|
|
# _add_production_limit_eqs!(model, g, formulation.prod_vars)
|
|
|
|
|
|
|
|
# _add_production_piecewise_linear_eqs!(
|
|
|
|
|
|
|
|
# model,
|
|
|
|
|
|
|
|
# g,
|
|
|
|
|
|
|
|
# formulation.prod_vars,
|
|
|
|
|
|
|
|
# formulation.pwl_costs,
|
|
|
|
|
|
|
|
# formulation.status_vars,
|
|
|
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
# _add_ramp_eqs!(
|
|
|
|
|
|
|
|
# model,
|
|
|
|
|
|
|
|
# g,
|
|
|
|
|
|
|
|
# formulation.prod_vars,
|
|
|
|
|
|
|
|
# formulation.ramping,
|
|
|
|
|
|
|
|
# formulation.status_vars,
|
|
|
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
# _add_startup_cost_eqs!(model, g, formulation.startup_costs)
|
|
|
|
|
|
|
|
# _add_startup_shutdown_limit_eqs!(model, g)
|
|
|
|
|
|
|
|
# _add_status_eqs!(model, g, formulation.status_vars)
|
|
|
|
|
|
|
|
# return
|
|
|
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
_is_initially_on(g::Unit)::Float64 = (g.initial_status > 0 ? 1.0 : 0.0)
|
|
|
|
_is_initially_on(g::Unit)::Float64 = (g.initial_status > 0 ? 1.0 : 0.0)
|
|
|
|
|
|
|
|
|
|
|
|
function _add_spinning_reserve_vars!(model::JuMP.Model, g::Unit)::Nothing
|
|
|
|
function _add_spinning_reserve_vars!(model::JuMP.Model, g::Unit, sc::UnitCommitmentScenario)::Nothing
|
|
|
|
reserve = _init(model, :reserve)
|
|
|
|
reserve = _init(model, :reserve)
|
|
|
|
reserve_shortfall = _init(model, :reserve_shortfall)
|
|
|
|
reserve_shortfall = _init(model, :reserve_shortfall)
|
|
|
|
for r in g.reserves
|
|
|
|
for r in g.reserves
|
|
|
|
r.type == "spinning" || continue
|
|
|
|
r.type == "spinning" || continue
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
reserve[r.name, g.name, t] = @variable(model, lower_bound = 0)
|
|
|
|
reserve[sc.name, r.name, g.name, t] = @variable(model, lower_bound = 0)
|
|
|
|
if (r.name, t) ∉ keys(reserve_shortfall)
|
|
|
|
if (sc.name, r.name, t) ∉ keys(reserve_shortfall)
|
|
|
|
reserve_shortfall[r.name, t] = @variable(model, lower_bound = 0)
|
|
|
|
reserve_shortfall[sc.name, r.name, t] = @variable(model, lower_bound = 0)
|
|
|
|
if r.shortfall_penalty < 0
|
|
|
|
if r.shortfall_penalty < 0
|
|
|
|
set_upper_bound(reserve_shortfall[r.name, t], 0.0)
|
|
|
|
set_upper_bound(reserve_shortfall[sc.name, r.name, t], 0.0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -61,27 +111,35 @@ function _add_spinning_reserve_vars!(model::JuMP.Model, g::Unit)::Nothing
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function _add_flexiramp_reserve_vars!(model::JuMP.Model, g::Unit)::Nothing
|
|
|
|
function _add_flexiramp_reserve_vars!(model::JuMP.Model, g::Unit, sc::UnitCommitmentScenario)::Nothing
|
|
|
|
upflexiramp = _init(model, :upflexiramp)
|
|
|
|
upflexiramp = _init(model, :upflexiramp)
|
|
|
|
upflexiramp_shortfall = _init(model, :upflexiramp_shortfall)
|
|
|
|
upflexiramp_shortfall = _init(model, :upflexiramp_shortfall)
|
|
|
|
mfg = _init(model, :mfg)
|
|
|
|
mfg = _init(model, :mfg)
|
|
|
|
dwflexiramp = _init(model, :dwflexiramp)
|
|
|
|
dwflexiramp = _init(model, :dwflexiramp)
|
|
|
|
dwflexiramp_shortfall = _init(model, :dwflexiramp_shortfall)
|
|
|
|
dwflexiramp_shortfall = _init(model, :dwflexiramp_shortfall)
|
|
|
|
for r in g.reserves
|
|
|
|
for r in g.reserves
|
|
|
|
r.type == "flexiramp" || continue
|
|
|
|
if r.type == "up-frp"
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
# maximum feasible generation, \bar{g_{its}} in Wang & Hobbs (2016)
|
|
|
|
# maximum feasible generation, \bar{g_{its}} in Wang & Hobbs (2016)
|
|
|
|
mfg[r.name, g.name, t] = @variable(model, lower_bound = 0)
|
|
|
|
mfg[sc.name, r.name, g.name, t] = @variable(model, lower_bound = 0)
|
|
|
|
upflexiramp[r.name, g.name, t] = @variable(model) # up-flexiramp, ur_{it} in Wang & Hobbs (2016)
|
|
|
|
upflexiramp[sc.name, r.name, g.name, t] = @variable(model) # up-flexiramp, ur_{it} in Wang & Hobbs (2016)
|
|
|
|
dwflexiramp[r.name, g.name, t] = @variable(model) # down-flexiramp, dr_{it} in Wang & Hobbs (2016)
|
|
|
|
if (sc.name, r.name, t) ∉ keys(upflexiramp_shortfall)
|
|
|
|
if (r.name, t) ∉ keys(upflexiramp_shortfall)
|
|
|
|
upflexiramp_shortfall[sc.name, r.name, t] =
|
|
|
|
upflexiramp_shortfall[r.name, t] =
|
|
|
|
@variable(model, lower_bound = 0)
|
|
|
|
@variable(model, lower_bound = 0)
|
|
|
|
if r.shortfall_penalty < 0
|
|
|
|
dwflexiramp_shortfall[r.name, t] =
|
|
|
|
set_upper_bound(upflexiramp_shortfall[sc.name, r.name, t], 0.0)
|
|
|
|
@variable(model, lower_bound = 0)
|
|
|
|
end
|
|
|
|
if r.shortfall_penalty < 0
|
|
|
|
end
|
|
|
|
set_upper_bound(upflexiramp_shortfall[r.name, t], 0.0)
|
|
|
|
end
|
|
|
|
set_upper_bound(dwflexiramp_shortfall[r.name, t], 0.0)
|
|
|
|
elseif r.type == "down-frp"
|
|
|
|
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
|
|
|
|
dwflexiramp[sc.name, r.name, g.name, t] = @variable(model) # down-flexiramp, dr_{it} in Wang & Hobbs (2016)
|
|
|
|
|
|
|
|
if (sc.name, r.name, t) ∉ keys(dwflexiramp_shortfall)
|
|
|
|
|
|
|
|
dwflexiramp_shortfall[sc.name, r.name, t] =
|
|
|
|
|
|
|
|
@variable(model, lower_bound = 0)
|
|
|
|
|
|
|
|
if r.shortfall_penalty < 0
|
|
|
|
|
|
|
|
set_upper_bound(dwflexiramp_shortfall[sc.name, r.name, t], 0.0)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -99,32 +157,32 @@ function _add_startup_shutdown_vars!(model::JuMP.Model, g::Unit)::Nothing
|
|
|
|
return
|
|
|
|
return
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function _add_startup_shutdown_limit_eqs!(model::JuMP.Model, g::Unit)::Nothing
|
|
|
|
function _add_startup_shutdown_limit_eqs!(model::JuMP.Model, g::Unit, sc::UnitCommitmentScenario)::Nothing
|
|
|
|
eq_shutdown_limit = _init(model, :eq_shutdown_limit)
|
|
|
|
eq_shutdown_limit = _init(model, :eq_shutdown_limit)
|
|
|
|
eq_startup_limit = _init(model, :eq_startup_limit)
|
|
|
|
eq_startup_limit = _init(model, :eq_startup_limit)
|
|
|
|
is_on = model[:is_on]
|
|
|
|
is_on = model[:is_on]
|
|
|
|
prod_above = model[:prod_above]
|
|
|
|
prod_above = model[:prod_above]
|
|
|
|
reserve = _total_reserves(model, g)
|
|
|
|
reserve = _total_reserves(model, g, sc)
|
|
|
|
switch_off = model[:switch_off]
|
|
|
|
switch_off = model[:switch_off]
|
|
|
|
switch_on = model[:switch_on]
|
|
|
|
switch_on = model[:switch_on]
|
|
|
|
T = model[:instance].time
|
|
|
|
T = model[:instance].time
|
|
|
|
for t in 1:T
|
|
|
|
for t in 1:T
|
|
|
|
# Startup limit
|
|
|
|
# Startup limit
|
|
|
|
eq_startup_limit[g.name, t] = @constraint(
|
|
|
|
eq_startup_limit[sc.name, g.name, t] = @constraint(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
|
prod_above[g.name, t] + reserve[t] <=
|
|
|
|
prod_above[sc.name, g.name, t] + reserve[t] <=
|
|
|
|
(g.max_power[t] - g.min_power[t]) * is_on[g.name, t] -
|
|
|
|
(g.max_power[t] - g.min_power[t]) * is_on[g.name, t] -
|
|
|
|
max(0, g.max_power[t] - g.startup_limit) * switch_on[g.name, t]
|
|
|
|
max(0, g.max_power[t] - g.startup_limit) * switch_on[g.name, t]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
# Shutdown limit
|
|
|
|
# Shutdown limit
|
|
|
|
if g.initial_power > g.shutdown_limit
|
|
|
|
if g.initial_power > g.shutdown_limit
|
|
|
|
eq_shutdown_limit[g.name, 0] =
|
|
|
|
eq_shutdown_limit[sc.name, g.name, 0] =
|
|
|
|
@constraint(model, switch_off[g.name, 1] <= 0)
|
|
|
|
@constraint(model, switch_off[g.name, 1] <= 0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if t < T
|
|
|
|
if t < T
|
|
|
|
eq_shutdown_limit[g.name, t] = @constraint(
|
|
|
|
eq_shutdown_limit[sc.name, g.name, t] = @constraint(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
|
prod_above[g.name, t] <=
|
|
|
|
prod_above[sc.name, g.name, t] <=
|
|
|
|
(g.max_power[t] - g.min_power[t]) * is_on[g.name, t] -
|
|
|
|
(g.max_power[t] - g.min_power[t]) * is_on[g.name, t] -
|
|
|
|
max(0, g.max_power[t] - g.shutdown_limit) *
|
|
|
|
max(0, g.max_power[t] - g.shutdown_limit) *
|
|
|
|
switch_off[g.name, t+1]
|
|
|
|
switch_off[g.name, t+1]
|
|
|
@ -138,43 +196,44 @@ function _add_ramp_eqs!(
|
|
|
|
model::JuMP.Model,
|
|
|
|
model::JuMP.Model,
|
|
|
|
g::Unit,
|
|
|
|
g::Unit,
|
|
|
|
formulation::RampingFormulation,
|
|
|
|
formulation::RampingFormulation,
|
|
|
|
|
|
|
|
sc::UnitCommitmentScenario
|
|
|
|
)::Nothing
|
|
|
|
)::Nothing
|
|
|
|
prod_above = model[:prod_above]
|
|
|
|
prod_above = model[:prod_above]
|
|
|
|
reserve = _total_reserves(model, g)
|
|
|
|
reserve = _total_reserves(model, g, sc)
|
|
|
|
eq_ramp_up = _init(model, :eq_ramp_up)
|
|
|
|
eq_ramp_up = _init(model, :eq_ramp_up)
|
|
|
|
eq_ramp_down = _init(model, :eq_ramp_down)
|
|
|
|
eq_ramp_down = _init(model, :eq_ramp_down)
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
# Ramp up limit
|
|
|
|
# Ramp up limit
|
|
|
|
if t == 1
|
|
|
|
if t == 1
|
|
|
|
if _is_initially_on(g) == 1
|
|
|
|
if _is_initially_on(g) == 1
|
|
|
|
eq_ramp_up[g.name, t] = @constraint(
|
|
|
|
eq_ramp_up[sc.name, g.name, t] = @constraint(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
|
prod_above[g.name, t] + reserve[t] <=
|
|
|
|
prod_above[sc.name, g.name, t] + reserve[t] <=
|
|
|
|
(g.initial_power - g.min_power[t]) + g.ramp_up_limit
|
|
|
|
(g.initial_power - g.min_power[t]) + g.ramp_up_limit
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
eq_ramp_up[g.name, t] = @constraint(
|
|
|
|
eq_ramp_up[sc.name, g.name, t] = @constraint(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
|
prod_above[g.name, t] + reserve[t] <=
|
|
|
|
prod_above[sc.name, g.name, t] + reserve[t] <=
|
|
|
|
prod_above[g.name, t-1] + g.ramp_up_limit
|
|
|
|
prod_above[sc.name, g.name, t-1] + g.ramp_up_limit
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Ramp down limit
|
|
|
|
# Ramp down limit
|
|
|
|
if t == 1
|
|
|
|
if t == 1
|
|
|
|
if _is_initially_on(g) == 1
|
|
|
|
if _is_initially_on(g) == 1
|
|
|
|
eq_ramp_down[g.name, t] = @constraint(
|
|
|
|
eq_ramp_down[sc.name, g.name, t] = @constraint(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
|
prod_above[g.name, t] >=
|
|
|
|
prod_above[sc.name, g.name, t] >=
|
|
|
|
(g.initial_power - g.min_power[t]) - g.ramp_down_limit
|
|
|
|
(g.initial_power - g.min_power[t]) - g.ramp_down_limit
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
eq_ramp_down[g.name, t] = @constraint(
|
|
|
|
eq_ramp_down[sc.name, g.name, t] = @constraint(
|
|
|
|
model,
|
|
|
|
model,
|
|
|
|
prod_above[g.name, t] >=
|
|
|
|
prod_above[sc.name, g.name, t] >=
|
|
|
|
prod_above[g.name, t-1] - g.ramp_down_limit
|
|
|
|
prod_above[sc.name, g.name, t-1] - g.ramp_down_limit
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -223,30 +282,30 @@ function _add_min_uptime_downtime_eqs!(model::JuMP.Model, g::Unit)::Nothing
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function _add_net_injection_eqs!(model::JuMP.Model, g::Unit)::Nothing
|
|
|
|
function _add_net_injection_eqs!(model::JuMP.Model, g::Unit, sc::UnitCommitmentScenario)::Nothing
|
|
|
|
expr_net_injection = model[:expr_net_injection]
|
|
|
|
expr_net_injection = model[:expr_net_injection]
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
for t in 1:model[:instance].time
|
|
|
|
# Add to net injection expression
|
|
|
|
# Add to net injection expression
|
|
|
|
add_to_expression!(
|
|
|
|
add_to_expression!(
|
|
|
|
expr_net_injection[g.bus.name, t],
|
|
|
|
expr_net_injection[sc.name, g.bus.name, t],
|
|
|
|
model[:prod_above][g.name, t],
|
|
|
|
model[:prod_above][sc.name, g.name, t],
|
|
|
|
1.0,
|
|
|
|
1.0,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
add_to_expression!(
|
|
|
|
add_to_expression!(
|
|
|
|
expr_net_injection[g.bus.name, t],
|
|
|
|
expr_net_injection[sc.name, g.bus.name, t],
|
|
|
|
model[:is_on][g.name, t],
|
|
|
|
model[:is_on][g.name, t],
|
|
|
|
g.min_power[t],
|
|
|
|
g.min_power[t],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function _total_reserves(model, g)::Vector
|
|
|
|
function _total_reserves(model, g, sc)::Vector
|
|
|
|
T = model[:instance].time
|
|
|
|
T = model[:instance].time
|
|
|
|
reserve = [0.0 for _ in 1:T]
|
|
|
|
reserve = [0.0 for _ in 1:T]
|
|
|
|
spinning_reserves = [r for r in g.reserves if r.type == "spinning"]
|
|
|
|
spinning_reserves = [r for r in g.reserves if r.type == "spinning"]
|
|
|
|
if !isempty(spinning_reserves)
|
|
|
|
if !isempty(spinning_reserves)
|
|
|
|
reserve += [
|
|
|
|
reserve += [
|
|
|
|
sum(model[:reserve][r.name, g.name, t] for r in spinning_reserves) for t in 1:model[:instance].time
|
|
|
|
sum(model[:reserve][sc.name, r.name, g.name, t] for r in spinning_reserves) for t in 1:model[:instance].time
|
|
|
|
]
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return reserve
|
|
|
|
return reserve
|
|
|
|