Skip to content
Merged
Changes from all 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
29 changes: 25 additions & 4 deletions src/parsers/pm_io/psse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,19 @@ function _psse2pm_load!(pm_data::Dict, pti_data::Dict, import_all::Bool)
for load in pti_data["LOAD"]
sub_data = Dict{String, Any}()
sub_data["load_bus"] = pop!(load, "I")
sub_data["pd"] = pop!(load, "PL")
sub_data["qd"] = pop!(load, "QL")
dgenp = 0.0
dgenq = 0.0
dgenm = 0.0
if pm_data["source_version"] == "35"
dgenp = pop!(load, "DGENP", 0.0)
dgenq = pop!(load, "DGENQ", 0.0)
dgenm = pop!(load, "DGENM", 0.0)
end

# PSS(R)E models distributed generation as negative demand on the load record.
# Net active/reactive demand seen by PF should be gross load minus DGEN.
sub_data["pd"] = pop!(load, "PL") - dgenp
sub_data["qd"] = pop!(load, "QL") - dgenq
sub_data["pi"] = pop!(load, "IP")
sub_data["qi"] = pop!(load, "IQ")
sub_data["py"] = pop!(load, "YP")
Expand All @@ -601,6 +612,9 @@ function _psse2pm_load!(pm_data::Dict, pti_data::Dict, import_all::Bool)
sub_data["ext"]["LOADTYPE"] = ""
elseif pm_data["source_version"] == "35"
sub_data["ext"]["LOADTYPE"] = pop!(load, "LOADTYPE", "")
sub_data["ext"]["DGENP"] = dgenp
sub_data["ext"]["DGENQ"] = dgenq
sub_data["ext"]["DGENM"] = dgenm
else
error("Unsupported PSS(R)E source version: $(pm_data["source_version"])")
end
Expand Down Expand Up @@ -686,9 +700,9 @@ function _psse2pm_shunt!(pm_data::Dict, pti_data::Dict, import_all::Bool)
sort(collect(keys(step_numbers)); by = x -> parse(Int, x[2:end]))
sub_data["step_number"] = [step_numbers[k] for k in step_numbers_sorted]
sub_data["step_number"] = sub_data["step_number"][sub_data["step_number"] .!= 0]

modsw = switched_shunt["MODSW"]
sub_data["ext"] = Dict{String, Any}(
"MODSW" => switched_shunt["MODSW"],
"MODSW" => modsw,
"ADJM" => switched_shunt["ADJM"],
"RMPCT" => switched_shunt["RMPCT"],
"RMIDNT" => switched_shunt["RMIDNT"],
Expand Down Expand Up @@ -725,6 +739,13 @@ function _psse2pm_shunt!(pm_data::Dict, pti_data::Dict, import_all::Bool)
error("Unsupported PSS(R)E source version: $(pm_data["source_version"])")
end

if modsw ∈ (0, 1, 2)
# For fixed/discrete/continuous modes used for PF comparison,
# BINIT is treated as the total shunt admittance.
# Keep Y_increase but zero all initial states to avoid double counting.
sub_data["initial_status"] = zeros(Int, length(sub_data["y_increment"]))
end

sub_data["index"] = length(pm_data["switched_shunt"]) + 1
sub_data["source_id"] =
["switched shunt", sub_data["shunt_bus"], sub_data["index"]]
Expand Down
Loading