Skip to content

Commit 04778f3

Browse files
committed
Add test
1 parent 8e1b6d7 commit 04778f3

File tree

3 files changed

+125
-1
lines changed

3 files changed

+125
-1
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PowerModels.jl Change Log
22
=========================
33

44
### Staged
5-
- nothing
5+
- Fix InexactError in `compute_ac_pf` (#939)
66

77
### v0.21.3
88
- Fix no-buses bug in `calc_connected_components` (#933)

test/data/json/issue_938.json

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"baseMVA": 1000,
3+
"per_unit": true,
4+
"shunt": {},
5+
"storage": {},
6+
"switch": {},
7+
"dcline": {},
8+
"load": {
9+
"1": {
10+
"load_bus": 1,
11+
"pd": 0.1,
12+
"qd": 0,
13+
"index": 1,
14+
"status": 1
15+
}
16+
},
17+
"gen": {
18+
"2": {
19+
"gen_bus": 2,
20+
"pg": 0.1,
21+
"qg": 0,
22+
"pmax": 1,
23+
"pmin": 0,
24+
"qmax": 9999,
25+
"qmin": -9999,
26+
"index": 2,
27+
"vg": 1,
28+
"gen_status": 1
29+
},
30+
"3": {
31+
"gen_bus": 3,
32+
"pg": 0,
33+
"qg": 0,
34+
"pmax": 9999,
35+
"pmin": 0,
36+
"qmax": 9999,
37+
"qmin": -9999,
38+
"index": 3,
39+
"vg": 1,
40+
"gen_status": 1
41+
}
42+
},
43+
"branch": {
44+
"5": {
45+
"index": 5,
46+
"f_bus": 1,
47+
"t_bus": 2,
48+
"br_r": 0.06815,
49+
"br_x": 1.096,
50+
"b_fr": 0.03092,
51+
"b_to": 0.03092,
52+
"br_status": 1,
53+
"base_kv": 220,
54+
"c_rating_a": 1.959,
55+
"angmin": -0.17453292519943295,
56+
"angmax": 0.17453292519943295,
57+
"transformer": false,
58+
"tap": 1,
59+
"shift": 0,
60+
"g_fr": 0,
61+
"g_to": 0
62+
},
63+
"6": {
64+
"index": 6,
65+
"f_bus": 2,
66+
"t_bus": 3,
67+
"br_r": 0.06744,
68+
"br_x": 1.084,
69+
"b_fr": 0.03059,
70+
"b_to": 0.03059,
71+
"br_status": 1,
72+
"base_kv": 220,
73+
"c_rating_a": 1.959,
74+
"angmin": -0.17453292519943295,
75+
"angmax": 0.17453292519943295,
76+
"transformer": false,
77+
"tap": 1,
78+
"shift": 0,
79+
"g_fr": 0,
80+
"g_to": 0
81+
}
82+
},
83+
"bus": {
84+
"1": {
85+
"bus_type": 1,
86+
"vm": 1,
87+
"va": 0,
88+
"vmin": 0.5,
89+
"vmax": 1.5,
90+
"index": 1,
91+
"gen_status": 1,
92+
"base_kv": 400.0,
93+
"bus_i": 1
94+
},
95+
"2": {
96+
"bus_type": 2,
97+
"vm": 1,
98+
"va": 0,
99+
"vmin": 0.5,
100+
"vmax": 1.5,
101+
"index": 2,
102+
"gen_status": 1,
103+
"base_kv": 400.0,
104+
"bus_i": 2
105+
},
106+
"3": {
107+
"bus_type": 3,
108+
"vm": 1,
109+
"va": 0,
110+
"vmin": 0.5,
111+
"vmax": 1.5,
112+
"index": 3,
113+
"gen_status": 1,
114+
"base_kv": 220.0,
115+
"bus_i": 3
116+
}
117+
}
118+
}

test/pf-native.jl

+6
Original file line numberDiff line numberDiff line change
@@ -501,5 +501,11 @@ end
501501
@test isapprox(data["gen"][i]["qg"], gen["qg"]; atol = 1e-6)
502502
end
503503
end
504+
@testset "test_issue_938" begin
505+
filename = joinpath(@__DIR__, "data/json/issue_938.json")
506+
data = PowerModels.parse_file(filename)
507+
native = PowerModels.compute_ac_pf(data)
508+
@test native["termination_status"]
509+
end
504510
end
505511

0 commit comments

Comments
 (0)