KnuOstWat2018: Fix eq_segprod_limit when min_uptime=1

This commit is contained in:
2025-11-27 08:55:27 -06:00
parent 4ac9b2a8d5
commit 48094ded6b
4 changed files with 24 additions and 5 deletions

View File

@@ -67,21 +67,19 @@ function _add_production_piecewise_linear_eqs!(
(t < T ? Cw * switch_off[gn, t+1] : 0.0)
)
else
# Equation (47a)/(48a) in Kneuven et al. (2020)
# Equation (47a) in Kneuven et al. (2020)
eq_segprod_limit_b[sc.name, gn, t, k] = @constraint(
model,
segprod[sc.name, gn, t, k] <=
g.cost_segments[k].mw[t] * is_on[gn, t] -
Cv * switch_on[gn, t] -
(t < T ? max(0, Cv - Cw) * switch_off[gn, t+1] : 0.0)
Cv * switch_on[gn, t]
)
# Equation (47b)/(48b) in Kneuven et al. (2020)
# Equation (47b) in Kneuven et al. (2020)
eq_segprod_limit_c[sc.name, gn, t, k] = @constraint(
model,
segprod[sc.name, gn, t, k] <=
g.cost_segments[k].mw[t] * is_on[gn, t] -
max(0, Cw - Cv) * switch_on[gn, t] -
(t < T ? Cw * switch_off[gn, t+1] : 0.0)
)
end

BIN
test/fixtures/issue-0057.json.gz vendored Normal file

Binary file not shown.

View File

@@ -23,6 +23,7 @@ include("validation/repair_test.jl")
include("lmp/conventional_test.jl")
include("lmp/aelmp_test.jl")
include("market/market_test.jl")
include("regression.jl")
basedir = dirname(@__FILE__)
@@ -54,6 +55,7 @@ function runtests()
lmp_aelmp_test()
simple_market_test()
stochastic_market_test()
regression_test()
end
return
end

19
test/src/regression.jl Normal file
View File

@@ -0,0 +1,19 @@
# 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.
using UnitCommitment, HiGHS, JuMP
function regression_test()
@testset "GitHub Issue #57" begin
instance = UnitCommitment.read(fixture("issue-0057.json.gz"))
model = UnitCommitment.build_model(
instance = instance,
optimizer = HiGHS.Optimizer,
)
JuMP.set_silent(model)
UnitCommitment.optimize!(model)
solution = UnitCommitment.solution(model)
@test solution["Thermal production (MW)"]["gen_524d4c85"][1] == 90.0
end
end