Skip to content

Commit 2df355a

Browse files
committed
Add shunt info in bus section
1 parent 373dc41 commit 2df355a

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

src/pwf2pm/bus.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ function _pwf2pm_bus!(pm_data::Dict, pwf_data::Dict, bus::Dict, dict_dgbt, dict_
100100
sub_data["control_data"]["vmmin"] = sub_data["vmin"]
101101
sub_data["control_data"]["vmmax"] = sub_data["vmax"]
102102
sub_data["control_data"]["tap_control"] = nothing
103-
sub_data["control_data"]["constraint_type"] = nothing
103+
sub_data["control_data"]["tap_constraint_type"] = nothing
104+
sub_data["control_data"]["shunt_control"] = nothing
105+
sub_data["control_data"]["shunt_section"] = nothing
104106
end
105107

106108
idx = string(sub_data["index"])

src/pwf2pm/shunt.jl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ function _pwf2pm_DBSH_shunt!(pm_data::Dict, pwf_data::Dict, shunt::Dict; add_con
6262
sub_data["control_data"]["bsmax"] = bs_bounds[2]
6363
@assert sub_data["control_data"]["bsmin"] <= sub_data["control_data"]["bsmax"]
6464
sub_data["control_data"]["inclination"] = nothing
65+
66+
controlled_bus = sub_data["control_data"]["controlled_bus"]
67+
if sub_data["control_data"]["shunt_control_type"] in [2,3]
68+
pm_data["bus"]["$controlled_bus"]["control_data"]["shunt_control"] = true
69+
shunt_section = pm_data["bus"]["$controlled_bus"]["control_data"]["shunt_section"]
70+
if isnothing(shunt_section)
71+
pm_data["bus"]["$controlled_bus"]["control_data"]["shunt_section"] = "DBSH"
72+
else
73+
# don't overwrite
74+
end
75+
end
6576
end
6677

6778
sub_data["source_id"] = ["switched shunt", sub_data["shunt_bus"], "0$(n+1)"]
@@ -115,6 +126,17 @@ function _pwf2pm_DCER_shunt!(pm_data::Dict, pwf_data::Dict, shunt::Dict; add_con
115126
sub_data["control_data"]["vmmax"] = ctrl_bus["vm"]
116127
sub_data["control_data"]["controlled_bus"] = shunt["CONTROLLED BUS"]
117128
sub_data["control_data"]["inclination"] = shunt["INCLINATION"]
129+
130+
controlled_bus = sub_data["control_data"]["controlled_bus"]
131+
if sub_data["control_data"]["shunt_control_type"] in [2,3]
132+
pm_data["bus"]["$controlled_bus"]["control_data"]["shunt_control"] = true
133+
shunt_section = pm_data["bus"]["$controlled_bus"]["control_data"]["shunt_section"]
134+
if isnothing(shunt_section)
135+
pm_data["bus"]["$controlled_bus"]["control_data"]["shunt_section"] = "DCER"
136+
else
137+
pm_data["bus"]["$controlled_bus"]["control_data"]["shunt_section"] = "DCER" # DCER always overwrites
138+
end
139+
end
118140
end
119141

120142
sub_data["source_id"] = ["switched shunt", sub_data["shunt_bus"], "0$(n+1)"]

src/pwf2pm/transformer.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,18 @@ function _pwf2pm_transformer!(pm_data::Dict, pwf_data::Dict, branch::Dict; add_c
110110
sub_data["control_data"]["valsp"] = branch_dctr[circuit]["SPECIFIED VALUE"]
111111
sub_data["control_data"]["controlled_bus"] = branch_dctr[circuit]["MEASUREMENT EXTREMITY"]
112112

113+
# Add tap control information in controlled bus
113114
pm_data["bus"]["$(sub_data["control_data"]["controlled_bus"])"]["control_data"]["control_type"] = "tap_control"
114115
if isnothing(pm_data["bus"]["$(sub_data["control_data"]["controlled_bus"])"]["control_data"]["constraint_type"]) # setpoint is more restrict than bounds
115-
pm_data["bus"]["$(sub_data["control_data"]["controlled_bus"])"]["control_data"]["constraint_type"] = "bounds"
116+
pm_data["bus"]["$(sub_data["control_data"]["controlled_bus"])"]["control_data"]["tap_constraint_type"] = "bounds"
116117
end
117118

118119
else
119120
pm_data["bus"]["$(sub_data["control_data"]["controlled_bus"])"]["control_data"]["control_type"] = "tap_control"
120121

121122
sub_data["control_data"]["constraint_type"] = "setpoint"
122123
sub_data["control_data"]["valsp"] = nothing
123-
pm_data["bus"]["$(sub_data["control_data"]["controlled_bus"])"]["control_data"]["constraint_type"] = "setpoint"
124+
pm_data["bus"]["$(sub_data["control_data"]["controlled_bus"])"]["control_data"]["tap_constraint_type"] = "setpoint"
124125
end
125126

126127
elseif constraint_type == "PHASE CONTROL" # phase control

0 commit comments

Comments
 (0)