mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-07 08:48:51 -06:00
Rename formulation structs
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_ArrCon00,
|
||||
formulation::ArrCon00,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
|
||||
@@ -9,4 +9,4 @@ Formulation described in:
|
||||
to an electricity spot market. IEEE Transactions on power systems, 15(3),
|
||||
1098-1104.
|
||||
"""
|
||||
mutable struct _ArrCon00 <: _RampingFormulation end
|
||||
struct ArrCon00 <: RampingFormulation end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_DamKucRajAta16,
|
||||
formulation::DamKucRajAta16,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
@@ -31,15 +31,15 @@ function _add_ramp_eqs!(
|
||||
time_invariant =
|
||||
(t > 1) ? (abs(g.min_power[t] - g.min_power[t-1]) < 1e-7) : true
|
||||
|
||||
if t > 1 && !time_invariant
|
||||
warning(
|
||||
"Ramping according to Damcı-Kurt et al. (2016) requires " *
|
||||
"time-invariant minimum power. This does not hold for " *
|
||||
"generator $(gn): min_power[$t] = $(g.min_power[t]); " *
|
||||
"min_power[$(t-1)] = $(g.min_power[t-1]). Reverting to " *
|
||||
"Arroyo and Conejo (2000) formulation for this generator.",
|
||||
)
|
||||
end
|
||||
# if t > 1 && !time_invariant
|
||||
# @warn(
|
||||
# "Ramping according to Damcı-Kurt et al. (2016) requires " *
|
||||
# "time-invariant minimum power. This does not hold for " *
|
||||
# "generator $(gn): min_power[$t] = $(g.min_power[t]); " *
|
||||
# "min_power[$(t-1)] = $(g.min_power[t-1]). Reverting to " *
|
||||
# "Arroyo and Conejo (2000) formulation for this generator.",
|
||||
# )
|
||||
# end
|
||||
|
||||
max_prod_this_period =
|
||||
prod_above[gn, t] + (
|
||||
|
||||
@@ -8,4 +8,4 @@ Formulation described in:
|
||||
Damcı-Kurt, P., Küçükyavuz, S., Rajan, D., & Atamtürk, A. (2016). A polyhedral
|
||||
study of production ramping. Mathematical Programming, 158(1), 175-205.
|
||||
"""
|
||||
mutable struct _DamKucRajAta16 <: _RampingFormulation end
|
||||
struct DamKucRajAta16 <: RampingFormulation end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_MorLatRam13,
|
||||
formulation::MorLatRam13,
|
||||
)::Nothing
|
||||
# TODO: Move upper case constants to model[:instance]
|
||||
RESERVES_WHEN_START_UP = true
|
||||
|
||||
@@ -9,4 +9,4 @@ Formulation described in:
|
||||
MILP formulation for the thermal unit commitment problem. IEEE Transactions
|
||||
on Power Systems, 28(4), 4897-4908.
|
||||
"""
|
||||
mutable struct _MorLatRam13 <: _RampingFormulation end
|
||||
struct MorLatRam13 <: RampingFormulation end
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
function _add_transmission_line!(
|
||||
model::JuMP.Model,
|
||||
lm::TransmissionLine,
|
||||
f::_TransmissionFormulation,
|
||||
f::ShiftFactorsFormulation,
|
||||
)::Nothing
|
||||
overflow = _init(model, :overflow)
|
||||
for t in 1:model[:instance].time
|
||||
@@ -21,7 +21,7 @@ end
|
||||
|
||||
function _setup_transmission(
|
||||
model::JuMP.Model,
|
||||
formulation::_TransmissionFormulation,
|
||||
formulation::ShiftFactorsFormulation,
|
||||
)::Nothing
|
||||
instance = model[:instance]
|
||||
isf = formulation.precomputed_isf
|
||||
|
||||
@@ -2,21 +2,23 @@
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
abstract type _RampingFormulation end
|
||||
abstract type _TransmissionFormulation end
|
||||
abstract type TransmissionFormulation end
|
||||
abstract type RampingFormulation end
|
||||
|
||||
struct _GeneratorFormulation
|
||||
ramping::_RampingFormulation
|
||||
struct Formulation
|
||||
ramping::RampingFormulation
|
||||
transmission::TransmissionFormulation
|
||||
|
||||
function _GeneratorFormulation(
|
||||
ramping::_RampingFormulation = _MorLatRam13(),
|
||||
function Formulation(;
|
||||
ramping::RampingFormulation = MorLatRam13(),
|
||||
transmission::TransmissionFormulation = ShiftFactorsFormulation(),
|
||||
)
|
||||
return new(ramping)
|
||||
return new(ramping, transmission)
|
||||
end
|
||||
end
|
||||
|
||||
"""
|
||||
mutable struct _ShiftFactorsFormulation <: _TransmissionFormulation
|
||||
struct ShiftFactorsFormulation <: TransmissionFormulation
|
||||
isf_cutoff::Float64
|
||||
lodf_cutoff::Float64
|
||||
precomputed_isf::Union{Nothing,Matrix{Float64}}
|
||||
@@ -40,13 +42,13 @@ Arguments
|
||||
the cutoff that should be applied to the LODF matrix. Entries with magnitude
|
||||
smaller than this value will be set to zero.
|
||||
"""
|
||||
mutable struct _ShiftFactorsFormulation <: _TransmissionFormulation
|
||||
struct ShiftFactorsFormulation <: TransmissionFormulation
|
||||
isf_cutoff::Float64
|
||||
lodf_cutoff::Float64
|
||||
precomputed_isf::Union{Nothing,Matrix{Float64}}
|
||||
precomputed_lodf::Union{Nothing,Matrix{Float64}}
|
||||
|
||||
function _ShiftFactorsFormulation(;
|
||||
function ShiftFactorsFormulation(;
|
||||
isf_cutoff = 0.005,
|
||||
lodf_cutoff = 0.001,
|
||||
precomputed_isf = nothing,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
function _add_unit!(model::JuMP.Model, g::Unit, f::_GeneratorFormulation)
|
||||
function _add_unit!(model::JuMP.Model, g::Unit, f::Formulation)
|
||||
if !all(g.must_run) && any(g.must_run)
|
||||
error("Partially must-run units are not currently supported")
|
||||
end
|
||||
@@ -32,7 +32,7 @@ _is_initially_on(g::Unit)::Float64 = (g.initial_status > 0 ? 1.0 : 0.0)
|
||||
function _add_production_vars!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
prod_above = _init(model, :prod_above)
|
||||
segprod = _init(model, :segprod)
|
||||
@@ -48,7 +48,7 @@ end
|
||||
function _add_production_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
eq_prod_above_def = _init(model, :eq_prod_above_def)
|
||||
eq_prod_limit = _init(model, :eq_prod_limit)
|
||||
@@ -94,7 +94,7 @@ end
|
||||
function _add_reserve_vars!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
reserve = _init(model, :reserve)
|
||||
for t in 1:model[:instance].time
|
||||
@@ -110,7 +110,7 @@ end
|
||||
function _add_reserve_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
reserve = model[:reserve]
|
||||
for t in 1:model[:instance].time
|
||||
@@ -122,7 +122,7 @@ end
|
||||
function _add_startup_shutdown_vars!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
startup = _init(model, :startup)
|
||||
for t in 1:model[:instance].time
|
||||
@@ -136,7 +136,7 @@ end
|
||||
function _add_startup_shutdown_limit_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
eq_shutdown_limit = _init(model, :eq_shutdown_limit)
|
||||
eq_startup_limit = _init(model, :eq_startup_limit)
|
||||
@@ -175,7 +175,7 @@ end
|
||||
function _add_startup_shutdown_costs_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
eq_startup_choose = _init(model, :eq_startup_choose)
|
||||
eq_startup_restrict = _init(model, :eq_startup_restrict)
|
||||
@@ -222,7 +222,7 @@ end
|
||||
function _add_status_vars!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
is_on = _init(model, :is_on)
|
||||
switch_on = _init(model, :switch_on)
|
||||
@@ -244,7 +244,7 @@ end
|
||||
function _add_status_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
eq_binary_link = _init(model, :eq_binary_link)
|
||||
eq_switch_on_off = _init(model, :eq_switch_on_off)
|
||||
@@ -280,7 +280,7 @@ end
|
||||
function _add_ramp_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::RampingFormulation,
|
||||
)::Nothing
|
||||
prod_above = model[:prod_above]
|
||||
reserve = model[:reserve]
|
||||
@@ -326,7 +326,7 @@ end
|
||||
function _add_min_uptime_downtime_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
is_on = model[:is_on]
|
||||
switch_off = model[:switch_off]
|
||||
@@ -373,7 +373,7 @@ end
|
||||
function _add_net_injection_eqs!(
|
||||
model::JuMP.Model,
|
||||
g::Unit,
|
||||
formulation::_GeneratorFormulation,
|
||||
formulation::Formulation,
|
||||
)::Nothing
|
||||
expr_net_injection = model[:expr_net_injection]
|
||||
for t in 1:model[:instance].time
|
||||
|
||||
Reference in New Issue
Block a user