Skip to content

Commit

Permalink
PS: display number PVs converted to PQs in import (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
frapac authored Feb 18, 2022
1 parent 4c8adb3 commit 187ca0d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PowerSystem/power_network.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ get(pf::PowerNetwork, ::NumberOfSlackBuses) = length(pf.ref)
## Voltage
function voltage(pf::PowerNetwork)
genbus = pf.gen2bus
v0 = pf.vbus
v0 = pf.vbus
vg = view(pf.generators, :, 6)
vcb = ones(length(v0))
vcb[pf.pq] .= 0
Expand Down
8 changes: 6 additions & 2 deletions src/PowerSystem/topology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,19 @@ function bustypeindex(bus, gen, bus_to_indexes)

bustype = convert.(Int, bus[:, BUS_TYPE])

npv2pq = 0
npq2pv = 0
for i in 1:size(bus, 1)
if (bustype[i] == PV_BUS_TYPE) && (gencon[i] == 0)
bustype[i] = PQ_BUS_TYPE
println("[dataset] Convert PV bus $(i) to PQ bus.")
npv2pq += 1
elseif (bustype[i] == PQ_BUS_TYPE) && (gencon[i] > 0)
bustype[i] = PV_BUS_TYPE
println("[dataset] Convert PQ bus $(i) to PV bus.")
npq2pv += 1
end
end
(npv2pq > 0) && println("[PS] $(npv2pq) PV buses converted to PQ")
(npq2pv > 0) && println("[PS] $(npq2pv) PQ buses converted to PV")

# form vectors
ref = findall(x -> x==REF_BUS_TYPE, bustype)::Vector{Int}
Expand Down

0 comments on commit 187ca0d

Please sign in to comment.