lanl-ansi / PowerModelsAnalytics.jl

Tools for the analysis and visualization of PowerModels data and results
https://lanl-ansi.github.io/PowerModelsAnalytics.jl/stable/
Other
14 stars 3 forks source link

Issue with `identify_blocks` and active nodes #25

Closed noahrhodes closed 2 years ago

noahrhodes commented 2 years ago

If a non-default "disabled" key is used for nodes, identify blocks does not correctly preprocess disabled nodes.

using Pkg
Pkg.activate(".")
Pkg.add("PowerModelsAnalytics")
Pkg.add("PGLib")

using PowerModelsAnalytics
using PGLib

node_settings = Dict{String,Any}(
    "node" => "bus",
        "disabled" => "status" => 0,  # changed to status from bus_type
        "x" => "lon",
        "y" => "lat",
)

case = pglib("case14")
for (busid,bus) in case["bus"]  
    bus["status"] = 0 # set all nodes inactive
end

blocks = identify_blocks(case; node_settings)

# no active buses, should be no blocks
julia> println(blocks)
Dict{Int64, Set{Any}}(1 => Set(["4", "1", "12", "2", "6", "11", "13", "5", "14", "7", "8", "10", "9", "3"]))