Public Functions
Main Functions
SyntheticGrids.place_loads_from_zips!
— Function.place_loads_from_zips!(
grid::Grid;
latlim = (-Inf,Inf),
longlim = (-Inf,Inf),
datapath = CENSUSPATH,
loadfunc = linearload,
voltfunc = randvolt
)
Create load buses based on zipcode information.
Arguments
grid: The synthetic grid instance that will be altered.
latlim: Tuple of the form (minimum latitude, maximum latitude).
longlim: Tuple of the form (minimum longitude, maximum longitude).
datapath: Path to the text file containing census information.
loadfunc: Function for computing bus load based on some rule.
voltfunc: Function for computing bus voltage based on some rule.
REFERENCE: https://www.census.gov/geo/maps-data/data/gazetteer2010.html
place_loads_from_zips!(
grid::Grid,
geolim::Function;
datapath = CENSUSPATH,
loadfunc = linearload,
voltfunc = randvolt
)
Create load buses based on zipcode information.
Arguments
grid: The synthetic grid instance that will be altered.
geolim: Function that receives a latitude-longitude pair and returns
true
orfalse
.
Specifies the region of interest.
datapath: Path to the text file containing census information.
loadfunc: Function for computing bus load based on some rule.
voltfunc: Function for computing bus voltage based on some rule.
REFERENCE: https://www.census.gov/geo/maps-data/data/gazetteer2010.html
SyntheticGrids.place_gens_from_data!
— Function.place_gens_from_data!(
grid::Grid,
plants::Array,
pfactorfunc::Function = pfacwavg
)
Create generation buses based on power plant data.
Arguments:
grid: Grid instance which will be populated.
plants: Power plant information already parsed.
pfactorfunc: Function for computing bus power factor based on some rule.
place_gens_from_data!(
grid::Grid;
latlim::Tuple = (-Inf, Inf),
longlim::Tuple = (-Inf, Inf),
jsonpath = GENJSONPATH,
pfactorfunc::Function = pfacwavg,
)
Create generation buses based on power plant data.
Arguments:
grid: Grid instance which will be populated.
latlim: Tuple of the form (minimum latitude, maximum latitude).
longlim: Tuple of the form (minimum longitude, maximum longitude).
jsonpath: Path to the JSON file with the generator data.
pfactorfunc: Function for computing bus power factor based on some rule.
REFERENCE: https://www.eia.gov/electricity/data/eia860/index.html
place_gens_from_data!(
grid::Grid,
geolim::Function;
jsonpath = GENJSONPATH,
pfactorfunc::Function = pfacwavg,
)
Create generation buses based on power plant data.
Arguments:
grid: Grid instance which will be populated.
geolim: Function that receives a latitude-longitude pair and returns
true
orfalse
.
Specifies the region of interest.
jsonpath: Path to the JSON file with the generator data.
pfactorfunc: Function for computing bus power factor based on some rule.
REFERENCE: https://www.eia.gov/electricity/data/eia860/index.html
SyntheticGrids.connect!
— Function.connect!(grid::Grid; k=2.5, m=-1, a=1, b=3.2, g=2.5, t=2, N=10)
Connect buses in an electric grid.
Arguments:
k: weight of the spanning tree (see REFERENCE)
m: total number of connections (computed from the # of nodes if default)
a, b, g, t: paramaters of the model (see REFERENCE)
N: number of nearest neighbors in the average distance computation
REFERENCE: Soltan, Saleh, and Gil Zussman. "Generation of synthetic spatially embedded power grid networks." arXiv:1508.04447 [cs.SY], Aug. 2015.
SyntheticGrids.cluster!
— Function.cluster!(grid::Grid, nloads, nboth, ngens)
Cluster all nodes of a grid into 'nloads' load substations, 'ngens' generation substations and 'nboth' substations with both load and generation.
REFERENCE: Birchfield, Adam B., et al. "Grid Structural Characteristics as Validation Criteria for Synthetic Networks." IEEE Transactions on Power Systems (2016).
SyntheticGrids.create_lines!
— Function.create_lines!(grid::Grid; impedfunc = linear_imped, capfunc = volt_cap)
Create transmission lines for a synthetic grid. Line impedancies are determined by impedfunc and line capacities are calculated via capfunc. This function will only work after the grid has been connected through the connect!() function.
SyntheticGrids.add_load!
— Function.add_load!(grid::Grid, args...; reconnect = false)
Add LoadBus to grid
by calling the LoadBus(coords, load, volt, pop, connected_to = Set(), connections = Set())
method with args...
as arguments. If reconnect = true
, all connections will be remade.
SyntheticGrids.add_gen!
— Function.add_gen!(grid::Grid, args...; reconnect = false)
Add Genbus to grid
by calling the GenBus(coords, gen, volt, tech, connected_to = Set(), connections = Set(), pfactor = -1, summgen = -1, wintgen = -1, gens = [])
method with args...
as arguments. If reconnect = true
, all connections will be remade.
SyntheticGrids.add_substation!
— Function.add_substation!(grid::Grid, args...; reconnect = false)
Add Substation to grid
by calling the Substation(coords, volts, load, gen, pop, con = Set(), group = [])
method with args...
as arguments.
Export/Import Functions
SyntheticGrids.to_pandapower
— Function.to_pandapower(grid::Grid)
Export a 'grid' to pandapower format.
Important: Currently, grid voltages and line properties are ignored. This function places all loads at 100kV and all generation at 380kV. Transmission lines use standard values for 110kV and 380kV lines. Transformers are automatically placed between buses that operate at different voltage values.
to_pandapower(grid::Grid, filename::AbstractString)
Export a 'grid' to pandapower format and saves it as 'filename'. Pandapower requires 'filename' to be a '.p' file.
Important: Currently, grid voltages and line properties are ignored. This function places all loads at 100kV and all generation at 380kV. Transmission lines use standard values for 110kV and 380kV lines. Transformers are automatically placed between buses that operate at different voltage values.
SyntheticGrids.save
— Function.save(grid::Grid, outfile::AbstractString)
Save a grid
in a format that can be recovered later. The format adopted is a JSON file with a particular structure.
SyntheticGrids.load_grid
— Function.load_grid(filepath::AbstractString)
Load a synthetic grid from a file previously saved via save(grid::Grid)
. Due to conversions during the dumping and the reading of the file, floats may have some noise added. That should be within machine precision, but may affect operations such as ==
.
Checking Functions
SyntheticGrids.total_links
— Function.total_links(con_mat::AbstractMatrix{Bool})
Return the total number of links in a system with connectivity matrix con_mat
.
total_links(con_mat::AbstractMatrix{Integer})
Return the total number of links in a system with connectivity matrix con_mat
. The graph will be treated as a simple graph.
SyntheticGrids.mean_node_deg
— Function.mean_node_deg(con_mat::AbstractMatrix)
Return the average nodal degree of a system with connectivity matrix con_mat
.
SyntheticGrids.cluster_coeff
— Function.cluster_coeff(con_mat::AbstractMatrix)
Return the clustering coefficient of a system with connectivity matrix con_mat
.
SyntheticGrids.test_connectivity
— Function.test_connectivity(con_mat::AbstractMatrix{<:Integer}, verb=true)
Return true
if the system with connectivity matrix con_mat
is connected and false
otherwise. If verb=true
the result will be printed onscreen together with the Fiedler eigenvalue.
SyntheticGrids.mean_shortest_path
— Function.mean_shortest_path(conmat::AbstractMatrix{<:Real})
Compute the mean shortest distance between nodes for a network represented by conmat
. The conmat
matrix should specify the distance between each connected node and be equal to zero whenever two nodes are not connected. Using the adjacency matrix will return the mean shortest path in hops. conmat
is assumed to be symmetric. Floyd-Warshall's algorithm is used to compute the distances.
mean_shortest_path(conmat::AbstractMatrix{<:Integer}, distmat::AbstractMatrix{Float64})
Compute the mean shortest distance between nodes for a network with connectivity matrix conmat
and distances between nodes given by distmat
. Distances are computed using Floyd-Warshall's algorithm.
SyntheticGrids.robustness_line
— Function.robustness_line(con_mat::AbstractMatrix{<:Integer}, n=1000)
Return the average number of transmission lines that have to be randomly removed from a system with connectivity matrix con_mat
before it becomes disconnected. Average is computed over n iterations.
SyntheticGrids.robustness_node
— Function.robustness_node(con_mat::AbstractMatrix{<:Integer}, n=1000)
Return the average number of nodes that have to be randomly removed from a system with connectivity matrix con_mat
before it becomes disconnected. Average is computed over n iterations.