PowerModelsAnalytics.jl Library

PowerModelsAnalytics.InfrastructureGraphType
InfrastructureGraph{T<:LightGraphs.AbstractGraph}

A structure containing a graph of a PowerModels or PowerModelsDistribution network in the format of a LightGraphs.AbstractGraph and corresponding metadata necessary for analysis / plotting.

source
PowerModelsAnalytics.apply_plot_network_metadata!Method
`apply_plot_network_metadata!(graph; kwargs...)`

Builds metadata properties, i.e. color/size of nodes/edges, for plotting based on graph metadata

Arguments:

`graph::InfrastructureGraph`: Graph of power network
`colors::Dict{String,<:Colors.Colorant}`: Dictionary of colors to be changed from `default_colors`
`load_color_range::Vector{<:Colors.Colorant}`: Range of colors for load statuses
`node_size_limitss::Vector{<:Real}`: Min/Max values for the size of nodes
`edge_width_limits::Vector{<:Real}`: Min/Max values for the width of edges
source
PowerModelsAnalytics.build_network_graphMethod
`graph = build_power_network_graph(case::Dict{String,<:Any}; kwargs...)`

Builds a `InfrastructureGraph` from a power network `case`.

Arguments:

`case::Dict{String,<:Any}`: Network case
`edge_types::Vector{<:String}`: Component types that are edges
`block_connector_types::Vector{<:String}`: Types of edges that connect blocks (only used when `block_graph==true`)
`node_objects::Dict{String,<:Dict{String,<:String}}`: Other non-bus components to include in the graph
`block_graph::Bool`: If `true`, return block graph
`aggregate_node_objects::Bool`: If `true`, if multiple node objects present at a bus, aggregate into a single vertex
`exclusions::Vector{Any}`: Pattern for exclusion from graph

Returns:

`graph`: InfrastructureGraph
source
PowerModelsAnalytics.is_activeMethod
`ans = is_active`

Determines if block is "active", e.g. energized, based on criteria in `sources`

Arguements:

`case::Dict{String,<:Any}`: Network case
`block::Set{<:Any}`: block of node ids
`sources::Dict{String,<:Dict{String,<:Any}}`: sources with settings that define criteria for active

Returns:

`ans::Bool`
source
PowerModelsAnalytics.layout_graph!Method
`layout_graph!(graph::InfrastructureGraph, layout_engine::Function; kwargs...)`

A routine to assign positions to all nodes of a `graph` for plotting using `layout_engine`.
Positions are assigned to the metadata of each node at `:x` and `:y`.

Arguments:

`graph::InfrastructureGraph`: Network graph
`layout_engine`: Layout Function to use. Applies only when not using `use_coordinates`
`use_coordinates::Bool`: If `true`, `spring_layout` will be used instead of `layout_engine`
`apply_spring_layout::Bool`: If `true`, `spring_layout` will be applied after `layout_engine` to ensure separation of overlapping nodes
`spring_constant::Real`: Spring constant to be used by `spring_layout`
`kwargs`: Keyword arguments to be used in `layout_engine`
source
PowerModelsAnalytics.plot_graphMethod
`spec = plot_graph(graph::InfrastructureGraph; kwargs...)`

Builds a figure sepcification. Returns `Vega.VGSpec`.

Arguments:

`graph::InfrastructureGraph{<:LightGraphs.AbstractGraph}`: Network graph
`label_nodes::Bool`: Plot labels on nodes
`label_edges::Bool`: Plot labels on edges
`fontsize::Real`: Fontsize of labels
`fontfamily::String`: Font Family of labels
`fontcolor::Union{Symbol,<:Colors.Colorant}`: Color of the labels
`textalign::Symbol`: Alignment of text: "left", "center", "right"
`plot_size::Tuple{Int,Int}`: Size of the plot in pixels
`plot_dpi::Int`: Dots-per-inch of the plot

Returns:

`spec<:Vega.VGSpec`: Vega.jl figure specification
source
PowerModelsAnalytics.plot_load_summaryMethod
`plot_load_summary(file, result, case; kwargs...)`

Plots total generation, total load served, and total forecasted load for a given `case` and `result`, saving to `file`

Arguments:

`file::String`: file path to saved figure
`result::Dict{String,Any}`: multinetwork solution data (contains load statuses)
`case::Dict{String,Any}`: Original case file (without calcuated loads) for forecasted loads
`log::Bool`: If `true`, plots y-axis on log scale
`intermediate::Bool`: If `true`, plots intermediate steps of plot (for animations).
`legend_position::Symbol`: Position of legend, accepts the following symbols: `:right`, `:left`, `:top`, `:bottom`, `:inside`, `:best`, `:legend`, `:topright`, `:topleft`, `:bottomleft`, `:bottomright`
source
PowerModelsAnalytics.plot_network!Method
`graph = plot_network(case::Dict{String,<:Any}; kwargs...)`

Plots a whole network `case` at the bus-level. Returns `InfrastructureGraph` and `Plots.AbstractPlot`.
This function will build the graph from the `case`. Additional `kwargs` are passed to
`plot_network(graph; kwargs...)`.

Arguments:

`case::Dict{String,Any}`: Network case data structure
`positions::Union{Dict{Int,<:Any},InfrastructureGraph}`: Pre-set positions of graph vertices

Returns:

`fig`
source
PowerModelsAnalytics.plot_network!Method
`plot_network(graph; kwargs...)`

Plots a network `graph`. Returns `InfrastructureGraph` and `Plots.AbstractPlot`.

Arguments:

`graph::InfrastructureGraph{<:LightGraphs.AbstractGraph}`: Network graph
`filename::String`: File to output the plot to, will use user-set Plots.jl backend
`label_nodes::Bool`: Plot labels on nodes
`label_edges::Bool`: Plot labels on edges
`colors::Dict{String,<:Colors.Colorant}`: Changes to default colors, see `default_colors` for available components
`load_color_range::Vector{<:Colors.Colorant}}`: Range of colors for load statuses
`node_size_limits::Vector{<:Real}`: Min/Max values for the size of nodes
`edge_width_limits::Vector{<:Real}`: Min/Max values for the width of edges
`positions::Union{Dict{Int,<:Real}, InfrastructureGraph}`: Used to specify node locations of graph (avoids running layout algorithm every time)
`use_coordinates::Bool`: Use buscoord field on buses for node positions
`spring_constant::Real`: Only used if buscoords=true. Spring constant to be used to force-direct-layout buses with no buscoord field
`apply_spring_layout::Bool`: Apply spring layout after initial layout
`fontsize::Real`: Fontsize of labels
`fontfamily::String`: Font Family of labels
`fontcolor::Union{Symbol,<:Colors.Colorant}`: Color of the labels
`textalign::Symbol`: Alignment of text
`plot_size::Tuple{Int,Int}`: Size of the plot in pixels
`plot_dpi::Int`: Dots-per-inch of the plot

Returns:

`fig`
source
PowerModelsAnalytics.plot_networkMethod
`graph = plot_network(case::Dict{String,<:Any}; kwargs...)`

Plots a whole network `case` at the bus-level. Returns `InfrastructureGraph` and `Plots.AbstractPlot`.
This function will build the graph from the `case`. Additional `kwargs` are passed to
`plot_network(graph; kwargs...)`.

Arguments:

`case::Dict{String,Any}`: Network case data structure
`positions::Union{Dict{Int,<:Any},InfrastructureGraph}`: Pre-set positions of graph vertices

Returns:

`graph::InfrastructureGraph`: InfrastructureGraph of the network
source
PowerModelsAnalytics.plot_networkMethod
`plot_network(graph; kwargs...)`

Plots a network `graph`. Returns `InfrastructureGraph` and `Plots.AbstractPlot`.

Arguments:

`graph::InfrastructureGraph{<:LightGraphs.AbstractGraph}`: Network graph
`filename::String`: File to output the plot to, will use user-set Plots.jl backend
`label_nodes::Bool`: Plot labels on nodes
`label_edges::Bool`: Plot labels on edges
`colors::Dict{String,<:Colors.Colorant}`: Changes to default colors, see `default_colors` for available components
`load_color_range::Vector{<:Colors.Colorant}}`: Range of colors for load statuses
`node_size_limits::Vector{<:Real}`: Min/Max values for the size of nodes
`edge_width_limits::Vector{<:Real}`: Min/Max values for the width of edges
`positions::Union{Dict{Int,<:Real}, InfrastructureGraph}`: Used to specify node locations of graph (avoids running layout algorithm every time)
`use_coordinates::Bool`: Use buscoord field on buses for node positions
`spring_constant::Real`: Only used if buscoords=true. Spring constant to be used to force-direct-layout buses with no buscoord field
`apply_spring_layout::Bool`: Apply spring layout after initial layout
`fontsize::Real`: Fontsize of labels
`fontfamily::String`: Font Family of labels
`fontcolor::Union{Symbol,<:Colors.Colorant}`: Color of the labels
`textalign::Symbol`: Alignment of text
`plot_size::Tuple{Int,Int}`: Size of the plot in pixels
`plot_dpi::Int`: Dots-per-inch of the plot

Returns:

`graph::InfrastructureGraph`: InfrastructureGraph of the network
source
PowerModelsAnalytics.plot_source_demand_summaryMethod
`plot_source_demand_summary(file::String, mn_case::Dict{String,<:Any}; kwargs...)`

Plots the total delivery from sources (generation) and total receipts by demands (load)

Arguments:

`fileout::String`: path to file where plot will be saved
`mn_case::Dict{String,<:Any}`: a multinetwork case
`yscale::Symbol`: To set log scale, `:log10`, else `:identity`
`save_intermediate_frames::Bool`: if `true`, each frame of the multinetwork will be saved separately
`legend_position::Symbol`: Position of legend, accepts the following symbols: `:right`, `:left`, `:top`, `:bottom`, `:inside`, `:best`, `:legend`, `:topright`, `:topleft`, `:bottomleft`, `:bottomright`
`sources::Dict{String,<:Any}`: information about sources (e.g. generators)
`demands::Dict{String,<:Any}`: information about demands (e.g. loads)
`totals::Symbol`: Choose `:real`, `:imaginary`, `:complex`
source