Skip to content

Commit cf9b2c8

Browse files
committed
address pr review
1 parent 9e755ee commit cf9b2c8

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/parsers/power_models_data.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,11 +1238,9 @@ function get_branch_type_psse(
12381238
is_tap_controllable, is_alpha_controllable = _determine_control_modes(d, "COD1", "tap")
12391239
if d["group_number"] == WindingGroupNumber.UNDEFINED || is_alpha_controllable
12401240
return PhaseShiftingTransformer
1241-
# parse TapTransformer from PSSE regardless of is_tap_controllable to avoid parsing mixed transformer types in parallel
1242-
elseif d["group_number"] != WindingGroupNumber.UNDEFINED
1241+
# parse TapTransformer from PSSE regardless of is_tap_controllable to avoid parsing mixed transformer types in parallel
1242+
else
12431243
return TapTransformer
1244-
else
1245-
error("Couldn't infer the branch type for branch $d")
12461244
end
12471245
end
12481246

@@ -1812,13 +1810,13 @@ function _determine_control_modes(d::Dict, control_flag::String, tap_key::String
18121810
is_tap_controllable = true
18131811
is_alpha_controllable = true
18141812
elseif control_code == -99
1815-
@warn "Can't determine control objective for the transformer from the $(control_flag) field for $d"
1813+
@warn "Can't determine control objective for the transformer from the $(control_flag) field for $d \
1814+
Will attempt to infer control objective from shift and tap fields."
18161815
if d["shift"] != 0.0
18171816
is_alpha_controllable = true
1818-
elseif (tap != 0.0) || (tap != 1.0)
1817+
end
1818+
if (tap != 0.0) && (tap != 1.0)
18191819
is_tap_controllable = true
1820-
else
1821-
@warn "Can't determine control objective for the other fields. Will return a TapTransformer"
18221820
end
18231821
else
18241822
error(d)

test/test_parse_psse.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ end
7373
@info "Testing Three-Winding Transformer Parsing"
7474

7575
@test isnothing(get_component(Transformer3W, sys3, "1"))
76+
@test isempty(get_components(Transformer2W, sys3))
7677
@test haskey(
7778
get_ext(get_component(TapTransformer, sys3, "DALLAS 1 3-DALLAS 1 0-i_1")),
7879
"psse_name",
@@ -313,6 +314,7 @@ end
313314
file_dir = joinpath(base_dir, "test_data", "modified_14bus_system.raw")
314315
sys = System(file_dir)
315316

317+
@test isempty(get_components(Transformer2W, sys))
316318
tr2w_1 = get_component(TapTransformer, sys, "BUS 110-BUS 109-i_1")
317319
suppl_attr_tr2w_1 = only(get_supplemental_attributes(tr2w_1))
318320
@test get_table_number(suppl_attr_tr2w_1) == 3

0 commit comments

Comments
 (0)