Added comments on formulations, added start/stop constraints into MorLatRam and GenMorRam, added ability to add shortfall penalty.
parent
7a1b6f0f55
commit
483c679c4e
@ -0,0 +1,86 @@
|
||||
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
|
||||
"""
|
||||
_add_startup_shutdown_limit_eqs!(model::JuMP.Model, g::Unit)::Nothing
|
||||
|
||||
Startup and shutdown limits from Gentile et al. (2017).
|
||||
Eqns. (20), (23a), and (23b) in Kneuven et al. (2020).
|
||||
|
||||
Variables
|
||||
---
|
||||
* :is_on
|
||||
* :prod_above
|
||||
* :reserve
|
||||
* :switch_on
|
||||
* :switch_off
|
||||
|
||||
Constraints
|
||||
---
|
||||
* :eq_startstop_limit
|
||||
* :eq_startup_limit
|
||||
* :eq_shutdown_limit
|
||||
"""
|
||||
function _add_startup_shutdown_limit_eqs!(model::JuMP.Model, g::Unit)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
RESERVES_WHEN_RAMP_UP = true
|
||||
RESERVES_WHEN_RAMP_DOWN = true
|
||||
RESERVES_WHEN_SHUT_DOWN = true
|
||||
|
||||
eq_startstop_limit = _init(model, :eq_startstop_limit)
|
||||
eq_shutdown_limit = _init(model, :eq_shutdown_limit)
|
||||
eq_startup_limit = _init(model, :eq_startup_limit)
|
||||
|
||||
is_on = model[:is_on]
|
||||
prod_above = model[:prod_above]
|
||||
reserve = model[:reserve]
|
||||
switch_off = model[:switch_off]
|
||||
switch_on = model[:switch_on]
|
||||
|
||||
T = model[:instance].time
|
||||
gi = g.name
|
||||
|
||||
if g.initial_power > g.shutdown_limit
|
||||
#eqs.shutdown_limit[gi, 0] = @constraint(mip, vars.switch_off[gi, 1] <= 0)
|
||||
fix(switch_off[gi, 1], 0.; force = true)
|
||||
end
|
||||
|
||||
for t = 1:T
|
||||
## 2020-10-09 amk: added eqn (20) and check of g.min_uptime
|
||||
# Not present in (23) in Kneueven et al.
|
||||
if g.min_uptime > 1
|
||||
# Equation (20) in Kneuven et al. (2020)
|
||||
eqs.startstop_limit[gi,t] =
|
||||
@constraint(model,
|
||||
prod_above[gi, t] + reserve[gi, t]
|
||||
<= (g.max_power[t] - g.min_power[t]) * is_on[gi, t]
|
||||
- max(0, g.max_power[t] - g.startup_limit) * switch_on[gi, t]
|
||||
- (t < T ? max(0, g.max_power[t] - g.shutdown_limit) * switch_off[gi, t+1] : 0.)
|
||||
)
|
||||
else
|
||||
## Startup limits
|
||||
# Equation (23a) in Kneuven et al. (2020)
|
||||
eqs.startup_limit[gi, t] =
|
||||
@constraint(model,
|
||||
prod_above[gi, t] + reserve[gi, t]
|
||||
<= (g.max_power[t] - g.min_power[t]) * is_on[gi, t]
|
||||
- max(0, g.max_power[t] - g.startup_limit) * switch_on[gi, t]
|
||||
- (t < T ? max(0, g.startup_limit - g.shutdown_limit) * switch_off[gi, t+1] : 0.)
|
||||
)
|
||||
|
||||
## Shutdown limits
|
||||
if t < T
|
||||
# Equation (23b) in Kneuven et al. (2020)
|
||||
eqs.shutdown_limit[gi, t] =
|
||||
@constraint(model,
|
||||
prod_above[gi, t] + reserve[gi, t]
|
||||
<= (g.max_power[t] - g.min_power[t]) * xis_on[gi, t]
|
||||
- (t < T ? max(0, g.max_power[t] - g.shutdown_limit) * switch_off[gi, t+1] : 0.)
|
||||
- max(0, g.shutdown_limit - g.startup_limit) * switch_on[gi, t])
|
||||
end
|
||||
end # check if g.min_uptime > 1
|
||||
end # loop over time
|
||||
end # _add_startup_shutdown_limit_eqs!
|
@ -0,0 +1,86 @@
|
||||
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
|
||||
"""
|
||||
_add_startup_shutdown_limit_eqs!(model::JuMP.Model, g::Unit)::Nothing
|
||||
|
||||
Startup and shutdown limits from Morales-España et al. (2013a).
|
||||
Eqns. (20), (21a), and (21b) in Kneuven et al. (2020).
|
||||
|
||||
Variables
|
||||
---
|
||||
* :is_on
|
||||
* :prod_above
|
||||
* :reserve
|
||||
* :switch_on
|
||||
* :switch_off
|
||||
|
||||
Constraints
|
||||
---
|
||||
* :eq_startstop_limit
|
||||
* :eq_startup_limit
|
||||
* :eq_shutdown_limit
|
||||
"""
|
||||
function _add_startup_shutdown_limit_eqs!(model::JuMP.Model, g::Unit)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
RESERVES_WHEN_RAMP_UP = true
|
||||
RESERVES_WHEN_RAMP_DOWN = true
|
||||
RESERVES_WHEN_SHUT_DOWN = true
|
||||
|
||||
eq_startstop_limit = _init(model, :eq_startstop_limit)
|
||||
eq_shutdown_limit = _init(model, :eq_shutdown_limit)
|
||||
eq_startup_limit = _init(model, :eq_startup_limit)
|
||||
|
||||
is_on = model[:is_on]
|
||||
prod_above = model[:prod_above]
|
||||
reserve = model[:reserve]
|
||||
switch_off = model[:switch_off]
|
||||
switch_on = model[:switch_on]
|
||||
|
||||
T = model[:instance].time
|
||||
gi = g.name
|
||||
for t = 1:T
|
||||
## 2020-10-09 amk: added eqn (20) and check of g.min_uptime
|
||||
if g.min_uptime > 1 && t < T
|
||||
# Equation (20) in Kneuven et al. (2020)
|
||||
# UT > 1 required, to guarantee that vars.switch_on[gi, t] and vars.switch_off[gi, t+1] are not both = 1 at the same time
|
||||
eq_startstop_limit[gi,t] =
|
||||
@constraint(model,
|
||||
prod_above[gi, t] + reserve[gi, t]
|
||||
<= (g.max_power[t] - g.min_power[t]) * is_on[gi, t]
|
||||
- max(0, g.max_power[t] - g.startup_limit) * switch_on[gi, t]
|
||||
- max(0, g.max_power[t] - g.shutdown_limit) * switch_off[gi, t+1])
|
||||
else
|
||||
## Startup limits
|
||||
# Equation (21a) in Kneuven et al. (2020)
|
||||
# Proposed by Morales-España et al. (2013a)
|
||||
eqs_startup_limit[gi, t] =
|
||||
@constraint(model,
|
||||
prod_above[gi, t] + reserve[gi, t]
|
||||
<= (g.max_power[t] - g.min_power[t]) * is_on[gi, t]
|
||||
- max(0, g.max_power[t] - g.startup_limit) * switch_on[gi, t])
|
||||
|
||||
## Shutdown limits
|
||||
if t < T
|
||||
# Equation (21b) in Kneuven et al. (2020)
|
||||
# TODO different from what was in previous model, due to reserve variable
|
||||
# ax: ideally should have reserve_up and reserve_down variables
|
||||
# i.e., the generator should be able to increase/decrease production as specified
|
||||
# (this is a heuristic for a "robust" solution,
|
||||
# in case there is an outage or a surge, and flow has to be redirected)
|
||||
# amk: if shutdown_limit is the max prod of generator in time period before shutting down,
|
||||
# then it makes sense to count reserves, because otherwise, if reserves ≠ 0,
|
||||
# then the generator will actually produce more than the limit
|
||||
eqs.shutdown_limit[gi, t] =
|
||||
@constraint(model,
|
||||
prod_above[gi, t]
|
||||
+ (RESERVES_WHEN_SHUT_DOWN ? reserve[gi, t] : 0.) # amk added
|
||||
<= (g.max_power[t] - g.min_power[t]) * is_on[gi, t]
|
||||
- max(0, g.max_power[t] - g.shutdown_limit) * switch_off[gi, t+1])
|
||||
end
|
||||
end # check if g.min_uptime > 1
|
||||
end # loop over time
|
||||
end # _add_startup_shutdown_limit_eqs!
|
@ -0,0 +1,20 @@
|
||||
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
"""
|
||||
_add_startup_cost_eqs!
|
||||
|
||||
Based on Nowak and Römisch, 2000.
|
||||
Introduces auxiliary startup cost variable, c_g^SU(t) for each time period,
|
||||
and uses startup status variable, u_g(t);
|
||||
there are exponentially many facets in this space,
|
||||
but there is a linear-time separation algorithm (Brandenburg et al., 2017).
|
||||
"""
|
||||
function _add_startup_cost_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::MorLatRam2013.StartupCosts,
|
||||
)::Nothing
|
||||
error("Not implemented.")
|
||||
end
|
@ -0,0 +1,83 @@
|
||||
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
"""
|
||||
_add_ramp_eqs!
|
||||
|
||||
Ensure constraints on ramping are met.
|
||||
Based on Ostrowski, Anjos, Vannelli (2012).
|
||||
Eqn (37) in Kneuven et al. (2020).
|
||||
|
||||
Variables
|
||||
---
|
||||
* :is_on
|
||||
* :prod_above
|
||||
* :reserve
|
||||
|
||||
Constraints
|
||||
---
|
||||
* :eq_str_prod_limit
|
||||
"""
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation_prod_vars::Gar1962.ProdVars,
|
||||
formulation_ramping::MorLatRam2013.Ramping,
|
||||
formulation_status_vars::Gar1962.StatusVars,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
RESERVES_WHEN_RAMP_UP = true
|
||||
RESERVES_WHEN_RAMP_DOWN = true
|
||||
RESERVES_WHEN_SHUT_DOWN = true
|
||||
is_initially_on = _is_initially_on(g)
|
||||
|
||||
gn = g.name
|
||||
eq_str_prod_limit = _init(model, :eq_str_prod_limit)
|
||||
|
||||
# Variables that we need
|
||||
reserve = model[:reserve]
|
||||
|
||||
# Gar1962.ProdVars
|
||||
prod_above = model[:prod_above]
|
||||
|
||||
# Gar1962.StatusVars
|
||||
is_on = model[:is_on]
|
||||
switch_off = model[:switch_off]
|
||||
|
||||
# The following are the same for generator g across all time periods
|
||||
UT = g.min_uptime
|
||||
|
||||
SU = g.startup_limit # startup rate
|
||||
SD = g.shutdown_limit # shutdown rate
|
||||
RU = g.ramp_up_limit # ramp up rate
|
||||
RD = g.ramp_down_limit # ramp down rate
|
||||
|
||||
# TODO check initial conditions, but maybe okay as long as (35) and (36) are also used
|
||||
for t in 1:model[:instance].time
|
||||
Pbar = g.max_power[t]
|
||||
|
||||
#TRD = floor((Pbar - SU)/RD)
|
||||
# TODO check amk changed TRD wrt Kneuven et al.
|
||||
TRD = ceil((Pbar - SD) / RD) # ramp down time
|
||||
|
||||
if Pbar < 1e-7
|
||||
# Skip this time period if max power = 0
|
||||
continue
|
||||
end
|
||||
|
||||
if UT >= 1
|
||||
# Equation (37) in Kneuven et al. (2020)
|
||||
KSD = min( TRD, UT-1, T-t-1 )
|
||||
eq_str_prod_limit[gn, t] =
|
||||
@constraint(model,
|
||||
prod_above[gn, t] + g.min_power[t] * is_on[gn, t]
|
||||
+ (RESERVES_WHEN_RAMP_DOWN ? reserve[gn, t] : 0.) # amk added; TODO: should this be RESERVES_WHEN_RAMP_DOWN or RESERVES_WHEN_SHUT_DOWN?
|
||||
<= Pbar * is_on[gi, t]
|
||||
- sum((Pbar - (SD + i * RD)) * switch_off[gi, t+1+i]
|
||||
for i in 0:KSD)
|
||||
)
|
||||
end # check UT >= 1
|
||||
end # loop over time
|
||||
end
|
Loading…
Reference in new issue