Skip to content

Commit

Permalink
whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonpbarrows committed Sep 10, 2024
1 parent 07eb599 commit 7787c94
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
28 changes: 17 additions & 11 deletions src/plot_network.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const DEFAULT_LON = "-122.8230"
const DEFAULT_LAT = "37.8270"

function set_prop!(g::MetaGraph, field::Symbol, data)
for (ix,v) in enumerate(labels(g))
for (ix, v) in enumerate(labels(g))
g[v][field] = data[ix]
end
end
Expand Down Expand Up @@ -69,27 +69,33 @@ Accepted kwargs:
"""
function make_graph(sys::PowerSystems.System; kwargs...)
@info "creating graph from System"
g = MetaGraph(Graph(), label_type = String, vertex_data_type = Dict{Symbol, Any}, edge_data_type = Vector{<:Branch}, graph_data = "data")
g = MetaGraph(
Graph();
label_type = String,
vertex_data_type = Dict{Symbol, Any},
edge_data_type = Vector{<:Branch},
graph_data = "data",
)

for b in get_components(Bus,sys)
data =Dict(
for b in get_components(Bus, sys)
data = Dict(
:name => get_name(b),
:number => get_number(b),
:area => get_name(get_area(b)),
:fixed => false
)
:fixed => false,
)
if has_supplemental_attributes(GeographicInfo, b)
(lon, lat) = get_lonlat(b)
data[:initial_position] = PT(lon, lat)
data[:fixed] = true
(lon, lat) = get_lonlat(b)
data[:initial_position] = PT(lon, lat)
data[:fixed] = true
end
g[get_name(b)] = data

end
for a in get_components(Arc, sys)
fr = get_from(a)
to = get_to(a)
g[get_name.([fr, to])...] = collect(get_components(x -> get_arc(x) == a, Branch, sys))
g[get_name.([fr, to])...] =
collect(get_components(x -> get_arc(x) == a, Branch, sys))
end

# color nodes
Expand Down
7 changes: 6 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ function make_test_sys()
add_supplemental_attribute!(
sys,
bus,
GeographicInfo(geo_json = Dict("type" => "Point", "coordinates" =>[row.longitude, row.latitude]))
GeographicInfo(;
geo_json = Dict(
"type" => "Point",
"coordinates" => [row.longitude, row.latitude],
),
),
)
end
end
Expand Down

0 comments on commit 7787c94

Please sign in to comment.