Skip to content
Snippets Groups Projects
Commit d708c97c authored by Julian Stürmer's avatar Julian Stürmer
Browse files

Add possibility to plot only inactive branches

parent 7fdd38c2
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ function _default_settings(func::Symbol)
"show" => true
),
"Load and generator" => Dict(
"marker" => "o",
"marker" => "s",
"size" => 30,
"color" => "darkorange",
"alpha" => 1,
......@@ -79,7 +79,7 @@ function _default_settings(func::Symbol)
),
### Settings for _draw_branches!
"Branches" => Dict(
"br_status" => "active", # plot only "active" or "all" branches
"br_status" => "active", # plot only "active", "inactive" or "all" branches
"br_coloring" => "equal", # how to color branches (can be set to "equal", "voltage", "MW-loading", "Mvar-loading" or "MVA-loading")
"br_color" => "k", # default color for "equal" coloring
"br_lw" => 2,
......@@ -343,6 +343,8 @@ function _draw_br_equal!(
### Get edges contained in the NDD
if br_settings["br_status"] == "active" # only plot active branches
edges = [(b["f_bus"],b["t_bus"]) for b in branches if b["br_status"]==1]
elseif br_settings["br_status"] == "inactive" # only plot active branches
edges = [(b["f_bus"],b["t_bus"]) for b in branches if b["br_status"]==0]
elseif br_settings["br_status"] == "all" # plot all branches
edges = [(b["f_bus"],b["t_bus"]) for b in branches]
else
......@@ -386,6 +388,9 @@ function _draw_br_branchloads!(
if br_status == "active" # only plot active branches
edges = [(b["f_bus"],b["t_bus"]) for b in branches if b["br_status"]==1]
branchloads = [b[br_coloring] for b in branches if b["br_status"]==1]
elseif br_settings["br_status"] == "inactive" # only plot inactive branches
edges = [(b["f_bus"],b["t_bus"]) for b in branches if b["br_status"]==0]
branchloads = [b[br_coloring] for b in branches if b["br_status"]==0]
elseif br_status == "all" # plot all branches
edges = [(b["f_bus"],b["t_bus"]) for b in branches]
branchloads = [b[br_coloring] for b in branches]
......@@ -448,6 +453,15 @@ function _draw_br_voltage!(
string(b["tl_voltage"]) for b in branches
if b["br_status"] == 1
]
elseif br_settings["br_status"] == "inactive" # only plot inactive branches
edges = [
(b["f_bus"],b["t_bus"]) for b in branches
if b["br_status"] == 0
]
voltages = [
string(b["tl_voltage"]) for b in branches
if b["br_status"] == 0
]
elseif br_settings["br_status"] == "all" # plot all branches
edges = [(b["f_bus"],b["t_bus"]) for b in branches]
voltages = [string(b["tl_voltage"]) for b in branches]
......@@ -468,7 +482,7 @@ function _draw_br_voltage!(
push!(br_markers, mlines.Line2D([], [], color=tableau[i], ls="-"))
push!(br_labels, string(v) * " kV")
end
### Draw edges
drawnedges = nx.draw_networkx_edges(
G, pos,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment