forked from lanl-ansi/PowerModels.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opf.jl
117 lines (88 loc) · 3.79 KB
/
opf.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@testset "test ac opf" begin
@testset "3-bus case" begin
result = run_ac_opf("../test/data/case3.m", ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 5812; atol = 1e0)
end
@testset "5-bus asymmetric case" begin
result = run_ac_opf("../test/data/case5_asym.m", ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 17551; atol = 1e0)
end
@testset "24-bus rts case" begin
result = run_opf("../test/data/case24.m", ACPPowerModel, ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 79804; atol = 1e0)
end
end
@testset "test dc opf" begin
@testset "3-bus case" begin
result = run_dc_opf("../test/data/case3.m", ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 5695; atol = 1e0)
end
@testset "5-bus asymmetric case" begin
result = run_dc_opf("../test/data/case5_asym.m", ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 17479; atol = 1e0)
end
# TODO verify this is really infeasible
#@testset "24-bus rts case" begin
# result = run_opf("../test/data/case24.m", DCPPowerModel, ipopt_solver)
# @test result["status"] == :LocalOptimal
# @test isapprox(result["objective"], 79804; atol = 1e0)
#end
end
@testset "test soc opf" begin
@testset "3-bus case" begin
result = run_opf("../test/data/case3.m", SOCWRPowerModel, ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 5735.9; atol = 1e0)
end
@testset "5-bus asymmetric case" begin
result = run_opf("../test/data/case5_asym.m", SOCWRPowerModel, ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 14999; atol = 1e0)
end
@testset "24-bus rts case" begin
result = run_opf("../test/data/case24.m", SOCWRPowerModel, ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 70831.9; atol = 1e0)
end
end
@testset "test qc opf" begin
@testset "3-bus case" begin
result = run_opf("../test/data/case3.m", QCWRPowerModel, ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 5742.0; atol = 1e0)
end
@testset "5-bus asymmetric case" begin
result = run_opf("../test/data/case5_asym.m", QCWRPowerModel, ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 15921; atol = 1e0)
end
@testset "24-bus rts case" begin
result = run_opf("../test/data/case24.m", QCWRPowerModel, ipopt_solver)
@test result["status"] == :LocalOptimal
@test isapprox(result["objective"], 76934.8; atol = 1e0)
end
end
@testset "test sdp opf" begin
@testset "3-bus case" begin
result = run_opf("../test/data/case3.m", SDPWRMPowerModel, scs_solver)
@test result["status"] == :Optimal
@test isapprox(result["objective"], 5788.7; atol = 1e0)
end
# TODO see if convergence time can be improved
#@testset "5-bus asymmetric case" begin
# result = run_opf("../test/data/case5_asym.m", SDPWRMPowerModel, scs_solver)
# @test result["status"] == :Optimal
# @test isapprox(result["objective"], 16664; atol = 1e0)
#end
# TODO replace this with smaller case, way too slow for unit testing
#@testset "24-bus rts case" begin
# result = run_opf("../test/data/case24.m", SDPWRMPowerModel, scs_solver)
# @test result["status"] == :Optimal
# @test isapprox(result["objective"], 75153; atol = 1e0)
#end
end