|
|
@ -9,14 +9,17 @@ using Distributions
|
|
|
|
using Random
|
|
|
|
using Random
|
|
|
|
using UnitCommitment, Cbc, JuMP
|
|
|
|
using UnitCommitment, Cbc, JuMP
|
|
|
|
|
|
|
|
|
|
|
|
get_instance() = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
|
|
|
function get_scenario()
|
|
|
|
|
|
|
|
return UnitCommitment.read_benchmark(
|
|
|
|
|
|
|
|
"matpower/case118/2017-02-01",
|
|
|
|
|
|
|
|
).scenarios[1]
|
|
|
|
|
|
|
|
end
|
|
|
|
system_load(sc) = sum(b.load for b in sc.buses)
|
|
|
|
system_load(sc) = sum(b.load for b in sc.buses)
|
|
|
|
test_approx(x, y) = @test isapprox(x, y, atol = 1e-3)
|
|
|
|
test_approx(x, y) = @test isapprox(x, y, atol = 1e-3)
|
|
|
|
|
|
|
|
|
|
|
|
@testset "XavQiuAhm2021" begin
|
|
|
|
@testset "XavQiuAhm2021" begin
|
|
|
|
@testset "cost and load share" begin
|
|
|
|
@testset "cost and load share" begin
|
|
|
|
instance = get_instance()
|
|
|
|
sc = get_scenario()
|
|
|
|
for sc in instance.scenarios
|
|
|
|
|
|
|
|
# Check original costs
|
|
|
|
# Check original costs
|
|
|
|
unit = sc.units[10]
|
|
|
|
unit = sc.units[10]
|
|
|
|
test_approx(unit.min_power_cost[1], 825.023)
|
|
|
|
test_approx(unit.min_power_cost[1], 825.023)
|
|
|
@ -46,40 +49,17 @@ test_approx(x, y) = @test isapprox(x, y, atol = 1e-3)
|
|
|
|
# System load should not change
|
|
|
|
# System load should not change
|
|
|
|
@test prev_system_load ≈ curr_system_load
|
|
|
|
@test prev_system_load ≈ curr_system_load
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@testset "load profile" begin
|
|
|
|
@testset "load profile" begin
|
|
|
|
instance = get_instance()
|
|
|
|
sc = get_scenario()
|
|
|
|
for sc in instance.scenarios
|
|
|
|
|
|
|
|
# Check original load profile
|
|
|
|
# Check original load profile
|
|
|
|
@test round.(system_load(sc), digits = 1)[1:8] ≈ [
|
|
|
|
@test round.(system_load(sc), digits = 1)[1:8] ≈
|
|
|
|
3059.5,
|
|
|
|
[3059.5, 2983.2, 2937.5, 2953.9, 3073.1, 3356.4, 4068.5, 4018.8]
|
|
|
|
2983.2,
|
|
|
|
|
|
|
|
2937.5,
|
|
|
|
|
|
|
|
2953.9,
|
|
|
|
|
|
|
|
3073.1,
|
|
|
|
|
|
|
|
3356.4,
|
|
|
|
|
|
|
|
4068.5,
|
|
|
|
|
|
|
|
4018.8,
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
randomize!(
|
|
|
|
randomize!(sc, XavQiuAhm2021.Randomization(); rng = MersenneTwister(42))
|
|
|
|
sc,
|
|
|
|
|
|
|
|
XavQiuAhm2021.Randomization();
|
|
|
|
|
|
|
|
rng = MersenneTwister(42),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check randomized load profile
|
|
|
|
# Check randomized load profile
|
|
|
|
@test round.(system_load(sc), digits = 1)[1:8] ≈ [
|
|
|
|
@test round.(system_load(sc), digits = 1)[1:8] ≈
|
|
|
|
4854.7,
|
|
|
|
[4854.7, 4849.2, 4732.7, 4848.2, 4948.4, 5231.1, 5874.8, 5934.8]
|
|
|
|
4849.2,
|
|
|
|
|
|
|
|
4732.7,
|
|
|
|
|
|
|
|
4848.2,
|
|
|
|
|
|
|
|
4948.4,
|
|
|
|
|
|
|
|
5231.1,
|
|
|
|
|
|
|
|
5874.8,
|
|
|
|
|
|
|
|
5934.8,
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|