Skip to content

Commit 155b9cb

Browse files
committed
Fix conflicts and test
1 parent d73a657 commit 155b9cb

File tree

2 files changed

+17
-37
lines changed

2 files changed

+17
-37
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ParserPWF"
22
uuid = "0f4c3beb-4231-4c4d-93e1-709cb40a89e6"
3-
version = "0.2.0"
3+
version = "1.0.0"
44

55
[deps]
66
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

src/pwf2pm/transformer.jl

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ function _pwf2pm_transformer!(pm_data::Dict, pwf_data::Dict, branch::Dict; add_c
122122
sub_data["control_data"]["constraint_type"] = "setpoint"
123123
shift_type = branch_dctr[circuit]["CONTROL TYPE"]
124124
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+
129129
sub_data["control_data"]["controlled_bus"] = branch_dctr[circuit]["MEASUREMENT EXTREMITY"]
130-
130+
131131
else # fix
132132
sub_data["control_data"]["control_type"] = "fix"
133133
sub_data["control_data"]["constraint_type"] = nothing
@@ -137,41 +137,21 @@ function _pwf2pm_transformer!(pm_data::Dict, pwf_data::Dict, branch::Dict; add_c
137137
sub_data["control_data"]["valsp"] = nothing
138138
end
139139

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
170151
end
171152
end
172153
end
173154
end
174-
175155
idx = string(sub_data["index"])
176156
pm_data["branch"][idx] = sub_data
177157
end

0 commit comments

Comments
 (0)