mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 08:18:51 -06:00
added profiled units in slice
This commit is contained in:
@@ -39,6 +39,11 @@ function slice(
|
|||||||
s.cost = s.cost[range]
|
s.cost = s.cost[range]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
for pu in sc.profiled_units
|
||||||
|
pu.max_power = pu.max_power[range]
|
||||||
|
pu.min_power = pu.min_power[range]
|
||||||
|
pu.cost = pu.cost[range]
|
||||||
|
end
|
||||||
for b in sc.buses
|
for b in sc.buses
|
||||||
b.load = b.load[range]
|
b.load = b.load[range]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,3 +44,23 @@ using UnitCommitment, LinearAlgebra, Cbc, JuMP, JSON, GZip
|
|||||||
variable_names = true,
|
variable_names = true,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@testset "slice profiled units" begin
|
||||||
|
instance = UnitCommitment.read("$FIXTURES/case14-profiled.json.gz")
|
||||||
|
modified = UnitCommitment.slice(instance, 1:2)
|
||||||
|
sc = modified.scenarios[1]
|
||||||
|
|
||||||
|
# Should update all time-dependent fields
|
||||||
|
for pu in sc.profiled_units
|
||||||
|
@test length(pu.max_power) == 2
|
||||||
|
@test length(pu.min_power) == 2
|
||||||
|
end
|
||||||
|
|
||||||
|
# Should be able to build model without errors
|
||||||
|
optimizer = optimizer_with_attributes(Cbc.Optimizer, "logLevel" => 0)
|
||||||
|
model = UnitCommitment.build_model(
|
||||||
|
instance = modified,
|
||||||
|
optimizer = optimizer,
|
||||||
|
variable_names = true,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user