mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 00:08:52 -06:00
initcond: Apply to instance instead of scenario
This commit is contained in:
@@ -2,27 +2,32 @@
|
||||
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
||||
# Released under the modified BSD license. See COPYING.md for more details.
|
||||
|
||||
using UnitCommitment, Cbc, JuMP
|
||||
using UnitCommitment, HiGHS, JuMP
|
||||
|
||||
function transform_initcond_test()
|
||||
@testset "generate_initial_conditions!" begin
|
||||
# Load instance
|
||||
instance = UnitCommitment.read(fixture("case118-initcond.json.gz"))
|
||||
optimizer = optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0)
|
||||
sc = instance.scenarios[1]
|
||||
optimizer =
|
||||
optimizer_with_attributes(HiGHS.Optimizer, MOI.Silent() => true)
|
||||
|
||||
# All units should have unknown initial conditions
|
||||
for g in sc.thermal_units
|
||||
@test g.initial_power === nothing
|
||||
@test g.initial_status === nothing
|
||||
for sc in instance.scenarios
|
||||
for g in sc.thermal_units
|
||||
@test g.initial_power === nothing
|
||||
@test g.initial_status === nothing
|
||||
end
|
||||
end
|
||||
|
||||
# Generate initial conditions
|
||||
UnitCommitment.generate_initial_conditions!(sc, optimizer)
|
||||
UnitCommitment.generate_initial_conditions!(instance, optimizer)
|
||||
|
||||
# All units should now have known initial conditions
|
||||
for g in sc.thermal_units
|
||||
@test g.initial_power !== nothing
|
||||
@test g.initial_status !== nothing
|
||||
for sc in instance.scenarios
|
||||
for g in sc.thermal_units
|
||||
@test g.initial_power !== nothing
|
||||
@test g.initial_status !== nothing
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Check that initial conditions are feasible
|
||||
|
||||
Reference in New Issue
Block a user