Layouts

The default layout algorithm for powerplot() is the Kamada Kawai network layout algorithm. This algorithm generally creates very nice looking graphs with few line crossings, but requires minimining a non-linear function and does not scale well to very large networks.

NetworkLayout Time
IEEE 14 Bus0.003902 seconds
IEEE 118 Bus0.101225 seconds
pegase 135422.459203 seconds
RTE 1888 Bus46.854940 seconds

If using a large network, it may be beneficial to create a layout and add this to the data dictionary. This will assign coordinates xcoord_1,ycoord_1 for each component in the powermodels data dictionary.

case = layout_network(case)
println(case["bus"]["1"]["xcoord_1"])
0.0215938

Then, when plotting you can use the fixed arguments to use the component coordinates instead of creating a new layout.

powerplot(case, fixed=true)

Values for the coordinates can also be created manually, for example for geographic coordinates. The simply add a dictionary key for xcoord_1 and ycoord_1 to the powermodels data dictionary for the nodal components (such as buses and generators). Any nodal components that do not have a value will have a layout calculated, and values for edge components (such as branches) are identified from their endpoints.

Selecting layouts

Several layout algorithms are supported. The default is Kamada Kawai, but other algorithms have better performance on larger networks like the PEGASE 1354 bus network.

Layout AlgorithmLayout Time
kamada_kawai22.459203 seconds
Shell0.054517 seconds
SFDP1.099188 seconds
BuchheimN/A on meshed networks
Spring3.143862 seconds
SquareGrid0.051883 seconds
Spectral0.911582 seconds

A layout algorithm can be selected using a keyword argument.

layout_network(case; layout_algorithm=Spring)

The keyword arguments for each algorithm are vary. The kamada_kawai layout has no supported arguments. The following are layout algorithms from the package NetworkLayouts.jl. The arguments for these functions can be found in the documentation for NetworkLayouts.jl.

The layout algorithm arguments can be passed to the layout_network function.

case = layout_network(case; layout_algorithm=SFDP, C=0.1, K=0.9)

The layout algorithm arguments can be also passed in directly through powerplot.

powerplot(case; layout_algorithm=Spring, iterations=50)

When using fixed=true, a variation of the SFDP algorithm is used that does not update corrdinates with prior coordinates set. The same arguments arguments as the SFDP algorithm can be used to modify the layout.

The default weights for edge-type components (branches, dc lines, etc.) are 1.0. The default weight for connectors (links from e.g. generators to buses) is 0.5. They can be modified by passing the argument edge_weight or connector_weight to the layout function. If a component has a weight entry in its data dictionary, such as data["branch"]["1"]["weight"], this weight will be used instead.