Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions src/parsers/power_models_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1238,13 +1238,9 @@ function get_branch_type_psse(
is_tap_controllable, is_alpha_controllable = _determine_control_modes(d, "COD1", "tap")
if d["group_number"] == WindingGroupNumber.UNDEFINED || is_alpha_controllable
return PhaseShiftingTransformer
elseif (is_tap_controllable || (tap != 1.0)) &&
d["group_number"] != WindingGroupNumber.UNDEFINED
# parse TapTransformer from PSSE regardless of is_tap_controllable to avoid parsing mixed transformer types in parallel
else
Comment thread
m-bossart marked this conversation as resolved.
return TapTransformer
Comment thread
m-bossart marked this conversation as resolved.
Comment thread
m-bossart marked this conversation as resolved.
Comment thread
m-bossart marked this conversation as resolved.
elseif !is_tap_controllable && d["group_number"] != WindingGroupNumber.UNDEFINED
return Transformer2W
else
error("Couldn't infer the branch type for branch $d")
end
end

Expand Down Expand Up @@ -1814,13 +1810,13 @@ function _determine_control_modes(d::Dict, control_flag::String, tap_key::String
is_tap_controllable = true
is_alpha_controllable = true
elseif control_code == -99
@warn "Can't determine control objective for the transformer from the $(control_flag) field for $d"
@warn "Can't determine control objective for the transformer from the $(control_flag) field for $d \
Will attempt to infer control objective from shift and tap fields."
Comment thread
m-bossart marked this conversation as resolved.
Outdated
if d["shift"] != 0.0
is_alpha_controllable = true
elseif (tap != 0.0) || (tap != 1.0)
end
Comment thread
m-bossart marked this conversation as resolved.
if (tap != 0.0) && (tap != 1.0)
is_tap_controllable = true
else
@warn "Can't determine control objective for the other fields. Will return a Transformer2W"
end
else
error(d)
Expand Down
10 changes: 6 additions & 4 deletions test/test_parse_psse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ end
@info "Testing Three-Winding Transformer Parsing"

@test isnothing(get_component(Transformer3W, sys3, "1"))
@test isempty(get_components(Transformer2W, sys3))
@test haskey(
get_ext(get_component(Transformer2W, sys3, "DALLAS 1 3-DALLAS 1 0-i_1")),
get_ext(get_component(TapTransformer, sys3, "DALLAS 1 3-DALLAS 1 0-i_1")),
"psse_name",
)
@test get_available(
Expand Down Expand Up @@ -313,7 +314,8 @@ end
file_dir = joinpath(base_dir, "test_data", "modified_14bus_system.raw")
sys = System(file_dir)

tr2w_1 = get_component(Transformer2W, sys, "BUS 110-BUS 109-i_1")
@test isempty(get_components(Transformer2W, sys))
Comment thread
m-bossart marked this conversation as resolved.
Outdated
tr2w_1 = get_component(TapTransformer, sys, "BUS 110-BUS 109-i_1")
suppl_attr_tr2w_1 = only(get_supplemental_attributes(tr2w_1))
@test get_table_number(suppl_attr_tr2w_1) == 3
@test get_points(get_impedance_correction_curve(suppl_attr_tr2w_1))[1] ==
Expand All @@ -324,7 +326,7 @@ end
@test get_transformer_control_mode(suppl_attr_tr2w_1) ==
ImpedanceCorrectionTransformerControlMode.PHASE_SHIFT_ANGLE

tr2w_2 = get_component(Transformer2W, sys, "BUS 109-BUS 104-i_1")
tr2w_2 = get_component(TapTransformer, sys, "BUS 109-BUS 104-i_1")
suppl_attr_tr2w_2 = only(get_supplemental_attributes(tr2w_2))
@test get_table_number(suppl_attr_tr2w_2) == 4
@test get_points(get_impedance_correction_curve(suppl_attr_tr2w_2))[1] ==
Expand All @@ -335,7 +337,7 @@ end
@test get_transformer_control_mode(suppl_attr_tr2w_2) ==
ImpedanceCorrectionTransformerControlMode.TAP_RATIO

tr2w_3 = get_component(Transformer2W, sys, "BUS 106-BUS 105-i_1")
tr2w_3 = get_component(TapTransformer, sys, "BUS 106-BUS 105-i_1")
suppl_attr_tr2w_3 = only(get_supplemental_attributes(tr2w_3))
@test get_table_number(suppl_attr_tr2w_3) == 7
@test get_points(get_impedance_correction_curve(suppl_attr_tr2w_3))[1] ==
Expand Down
Loading