@@ -122,12 +122,12 @@ function _pwf2pm_transformer!(pm_data::Dict, pwf_data::Dict, branch::Dict; add_c
122
122
sub_data[" control_data" ][" constraint_type" ] = " setpoint"
123
123
shift_type = branch_dctr[circuit][" CONTROL TYPE" ]
124
124
sub_data[" control_data" ][" shift_control_variable" ] = shift_type == ' C' ? " current" : shift_type == ' P' ? " power" : " fixed"
125
- sub_data[" control_data" ][" shiftmin" ] = branch_dctr[circuit][" MINIMUM PHASE" ]
126
- sub_data[" control_data" ][" shiftmax" ] = branch_dctr[circuit][" MAXIMUM PHASE" ]
127
- sub_data[" control_data" ][" valsp" ] = branch_dctr[circuit][" SPECIFIED VALUE" ]
128
-
125
+ sub_data[" control_data" ][" shiftmin" ] = branch_dctr[circuit][" MINIMUM PHASE" ] / ( 180 / pi )
126
+ sub_data[" control_data" ][" shiftmax" ] = branch_dctr[circuit][" MAXIMUM PHASE" ] / ( 180 / pi )
127
+ sub_data[" control_data" ][" valsp" ] = branch_dctr[circuit][" SPECIFIED VALUE" ] / 100
128
+
129
129
sub_data[" control_data" ][" controlled_bus" ] = branch_dctr[circuit][" MEASUREMENT EXTREMITY" ]
130
-
130
+
131
131
else # fix
132
132
sub_data[" control_data" ][" control_type" ] = " fix"
133
133
sub_data[" control_data" ][" constraint_type" ] = nothing
@@ -137,41 +137,21 @@ function _pwf2pm_transformer!(pm_data::Dict, pwf_data::Dict, branch::Dict; add_c
137
137
sub_data[" control_data" ][" valsp" ] = nothing
138
138
end
139
139
140
- elseif constraint_type == " PHASE CONTROL" # phase control
141
- sub_data[" control_data" ][" control_type" ] = " shift_control"
142
- sub_data[" control_data" ][" constraint_type" ] = " setpoint"
143
- shift_type = branch_dctr[circuit][" CONTROL TYPE" ]
144
- sub_data[" control_data" ][" shift_control_variable" ] = shift_type == ' C' ? " current" : shift_type == ' P' ? " power" : " fixed"
145
- sub_data[" control_data" ][" shiftmin" ] = branch_dctr[circuit][" MINIMUM PHASE" ] / (180 / pi )
146
- sub_data[" control_data" ][" shiftmax" ] = branch_dctr[circuit][" MAXIMUM PHASE" ] / (180 / pi )
147
- sub_data[" control_data" ][" valsp" ] = branch_dctr[circuit][" SPECIFIED VALUE" ] / 100
148
-
149
- sub_data[" control_data" ][" controlled_bus" ] = branch_dctr[circuit][" MEASUREMENT EXTREMITY" ]
150
-
151
- else # fix
152
- sub_data[" control_data" ][" control_type" ] = " fix"
153
- sub_data[" control_data" ][" constraint_type" ] = nothing
154
- sub_data[" control_data" ][" shift_control_variable" ] = nothing
155
- sub_data[" control_data" ][" shiftmin" ] = nothing
156
- sub_data[" control_data" ][" shiftmax" ] = nothing
157
- sub_data[" control_data" ][" valsp" ] = nothing
158
- end
159
-
160
- ctrl_bus = pm_data[" bus" ][" $(sub_data[" control_data" ][" controlled_bus" ]) " ]
161
- sub_data[" control_data" ][" vmsp" ] = ctrl_bus[" vm" ]
162
- sub_data[" control_data" ][" vmmin" ] = ctrl_bus[" vmin" ]
163
- sub_data[" control_data" ][" vmmax" ] = ctrl_bus[" vmax" ]
164
- sub_data[" control_data" ][" control" ] = true
165
- if haskey (pwf_data, " DTPF CIRC" )
166
- for (k,v) in pwf_data[" DTPF CIRC" ]
167
- for i in 1 : 5
168
- if v[" FROM BUS $i " ] == sub_data[" f_bus" ] && v[" TO BUS $i " ] == sub_data[" t_bus" ] && v[" CIRCUIT $i " ] == branch[" CIRCUIT" ]
169
- sub_data[" control_data" ][" control" ] = false
140
+ ctrl_bus = pm_data[" bus" ][" $(sub_data[" control_data" ][" controlled_bus" ]) " ]
141
+ sub_data[" control_data" ][" vmsp" ] = ctrl_bus[" vm" ]
142
+ sub_data[" control_data" ][" vmmin" ] = ctrl_bus[" vmin" ]
143
+ sub_data[" control_data" ][" vmmax" ] = ctrl_bus[" vmax" ]
144
+ sub_data[" control_data" ][" control" ] = true
145
+ if haskey (pwf_data, " DTPF CIRC" )
146
+ for (k,v) in pwf_data[" DTPF CIRC" ]
147
+ for i in 1 : 5
148
+ if v[" FROM BUS $i " ] == sub_data[" f_bus" ] && v[" TO BUS $i " ] == sub_data[" t_bus" ] && v[" CIRCUIT $i " ] == branch[" CIRCUIT" ]
149
+ sub_data[" control_data" ][" control" ] = false
150
+ end
170
151
end
171
152
end
172
153
end
173
154
end
174
-
175
155
idx = string (sub_data[" index" ])
176
156
pm_data[" branch" ][idx] = sub_data
177
157
end
0 commit comments