Power Grid¶
as Geographic Graph¶
Class for grid in planar graph format.
-
class
mgrid.grid.geographic.
GeoGrid
(dg=None)[source]¶ Bases:
mgrid.graph.geographic.GeoGraph
Model multilayer graph in plane by contracting inter-edges.
Note
There are two kinds of nodes, inter-nodes and planar nodes. If an inter-node is isolated in some layer, it cannot be recognised directly.
It is assumed that every conversion element has a unique name.
-
inter_nodes
¶ information on inter-nodes.
name
dtype
definition
name (index)
object
name in planar graph
upper
int64
connected upper layer
lower
int64
connected lower layer
element
object
transformer model
- Type
DataFrame
-
layers
¶ integer indices of all the layers.
- Type
Set[int]
-
conversions
¶ information on conversion elements.
name
dtype
definition
name (index)
object
name of conversion elements.
node
object
nodes to which elements are attached.
element
object
element models.
layer
int64
layers to which elements belong.
- Type
DataFrame
-
df_layers
¶ information on layers.
name
dtype
definition
idx (index)
int
integer indices of layers
name
object
layer names
voltage
float64
voltage levels
- Type
DataFrame
-
nodelist
¶ sorted nodelist containing layer information.
name
dtype
definition
node (index)
object
node name
idx
int64
layer to which node belongs
name
object
layer name
voltage
float64
voltage levels
- Type
DataFrame
-
__init__
(dg=None)[source]¶ Init an empty directed graph or from existing directed graph.
Note
All the edges are intra-edges, so they must be associated with some layer.
It is essential to have the option for empty graph, or some built-in
networkx
function will not work. Don’t know why.Most inter-nodes can be detected. However, when one terminal of some inter-edge is isolated in that layer, the corresponding inter-node cannot be detected.
- Parameters
dg (
Optional
[DiGraph
]) – an existing directed graph. Default to be None.
-
add_conversion
(name, node, element, layer=None)[source]¶ Add a conversion element to the grid.
Note
Any conversion element is associated with a layer. If it is attached to a intra-node, then it inherent the node’s layer. If to a inter-node,
layer
should be specified.- Parameters
name (
str
) – name of the conversion element.node (
str
) – name of the node to which the element is attached.element (
Ejection
) – model for the element.layer (
Optional
[str
]) – layer to which the element belongs. Ifnode
is an intra-node, it is not necessary to specify it. Whennode
is an inter-node and it is not specified, a warning will be echoed.
-
add_inter_node
(name, element, upper=True)[source]¶ Specify a planar node as an inter-node with an adjacent layer.
Sometimes, one terminal of an inter-edge is an isolated node in some layer, then it will not be recognised as an inter-node. It must be specified manually.
Warning
Upper layer has a smaller integer index.
- Parameters
name (
str
) – name of the inter-node.element (
Union
[Transformer
,TransformerStd
]) – the transformer model.upper (
Optional
[bool
]) – whether the other terminal of the corresponding inter-edge is on upper layer.
as Supra Graph¶
Class for power grid as multilayer network in supra-graph format.
Any node in a supra graph is a bus, which is an imaginary concept to enforce Kirchhoff’s law. It can a conjunction of two cables or an entire nation. There is no power loss within any bus. When aggregating some area (like an entire country) as a bus, the loss within that area can be represented by a conversion element. However, it is impossible to derive the loss correctly.
Usually, in the literature, three types of buses, PQ, PV, and slack, are considered, but it is not necessary. Those features are resulted from attached conversion elements. There is only one type of node here.
-
class
mgrid.grid.supra.
SupraGrid
(dg=None)[source]¶ Bases:
mgrid.graph.supra.SupraGraph
Power grid modelled as supra-graph.
Warning
Modification is impossible for now.
-
conversions
¶ name
dtype
definition
name (index)
object
name of the element.
bus
object
buses to which the element is attached
element
object
model
- Type
DataFrame
-
types
¶ standard element types, keyed by type names.
- Type
dict
-
buses
¶ sorted list of buses.
name
dtype
definition
node (index)
object
node name
idx
int64
layer to which node belongs
layer_name
object
name of the layer
original
object
original node name
- Type
DataFrame
-