Package edu.ie3.datamodel.utils
Class ContainerUtils
java.lang.Object
edu.ie3.datamodel.utils.ContainerUtils
Offers functionality useful for grouping different models together
-
Method Summary
Modifier and TypeMethodDescriptionstatic SubGridTopologyGraph
buildSubGridTopologyGraph
(String gridName, RawGridElements rawGrid, SystemParticipants systemParticipants, GraphicElements graphics) Disassembles this grid model into sub grid models and returns a topology of the sub grids as a directed, immutable graph.static JointGridContainer
combineToJointGrid
(Collection<SubGridContainer> subGridContainers) Combines a given collection of sub grid containers to a joint model.static VoltageLevel
determinePredominantVoltLvl
(RawGridElements rawGrid, int subnet) Determining the predominant voltage level in this grid by counting the occurrences of the different voltage levelsstatic GraphicElements
filterForSubnet
(GraphicElements input, int subnet) Filters all graphic elements for the provided subnet.static RawGridElements
filterForSubnet
(RawGridElements input, int subnet) Filters all raw grid elements for the provided subnet.static SystemParticipants
filterForSubnet
(SystemParticipants input, int subnet) Filters all system participants for the provided subnet.static Optional<DistanceWeightedGraph>
Returns the topology of the provided grid container as aDistanceWeightedGraph
if the provided grid container'sRawGridElements
allows the creation of a valid topology graph or an empty optional otherwise.static Optional<DistanceWeightedGraph>
getDistanceTopologyGraph
(RawGridElements rawGridElements) Returns the topology of the providedRawGridElements
as aDistanceWeightedGraph
, if they allow the creation of a valid topology graph or an empty optional otherwise.static Optional<ImpedanceWeightedGraph>
Returns the topology of the provided grid container as aImpedanceWeightedGraph
if the provided grid container'sRawGridElements
allows the creation of a valid topology graph or an empty optional otherwise.static Optional<ImpedanceWeightedGraph>
getImpedanceTopologyGraph
(RawGridElements rawGridElements) Returns the topology of the providedRawGridElements
as aImpedanceWeightedGraph
, if they allow the creation of a valid topology graph or an empty optional otherwise.static LinkedList<NodeInput>
traverseAlongSwitchChain
(NodeInput startNode, RawGridElements rawGridElements) Traversing along a chain of switches and return the traveled nodes.static SubGridContainer
withTrafoNodeAsSlack
(SubGridContainer subGridContainer) Returns a copySubGridContainer
based on the provided subgrid with a certain set of nodes marked as slack nodes.
-
Method Details
-
getDistanceTopologyGraph
Returns the topology of the provided grid container as aDistanceWeightedGraph
if the provided grid container'sRawGridElements
allows the creation of a valid topology graph or an empty optional otherwise.- Parameters:
grid
- the grid container that should be converted into topology graph- Returns:
- either an optional holding the distance topology graph instance or an empty optional
-
getDistanceTopologyGraph
public static Optional<DistanceWeightedGraph> getDistanceTopologyGraph(RawGridElements rawGridElements) Returns the topology of the providedRawGridElements
as aDistanceWeightedGraph
, if they allow the creation of a valid topology graph or an empty optional otherwise.- Parameters:
rawGridElements
- raw grids elements as base of the distance weighted topology graph- Returns:
- either an optional holding the distance topology graph instance or an empty optional
-
getImpedanceTopologyGraph
Returns the topology of the provided grid container as aImpedanceWeightedGraph
if the provided grid container'sRawGridElements
allows the creation of a valid topology graph or an empty optional otherwise.- Parameters:
grid
- the grid container that should be converted into topology graph- Returns:
- either an optional holding the impedance topology graph instance or an empty optional
-
getImpedanceTopologyGraph
public static Optional<ImpedanceWeightedGraph> getImpedanceTopologyGraph(RawGridElements rawGridElements) Returns the topology of the providedRawGridElements
as aImpedanceWeightedGraph
, if they allow the creation of a valid topology graph or an empty optional otherwise.- Parameters:
rawGridElements
- raw grids elements as base of the distance weighted topology graph- Returns:
- either an optional holding the impedance topology graph instance or an empty optional
-
filterForSubnet
Filters all raw grid elements for the provided subnet. For each transformer all nodes (and not only the the node of the grid the transformer is located in) are added as well. Two winding transformers are counted, if the low voltage node is in the queried subnet. Three winding transformers are counted, as long as any of the three nodes is in the queried subnet.- Parameters:
input
- The model to filtersubnet
- The filter criterion- Returns:
- A
RawGridElements
filtered for the subnet
-
filterForSubnet
Filters all system participants for the provided subnet.- Parameters:
input
- The model to filtersubnet
- The filter criterion- Returns:
- A
SystemParticipants
filtered for the subnet
-
filterForSubnet
Filters all graphic elements for the provided subnet.- Parameters:
input
- The model to filtersubnet
- The filter criterion- Returns:
- A
GraphicElements
filtered for the subnet
-
determinePredominantVoltLvl
Determining the predominant voltage level in this grid by counting the occurrences of the different voltage levels- Parameters:
rawGrid
- Raw grid elements of the specified sub gridsubnet
- Subnet number of the subnet- Returns:
- The predominant voltage level in this grid
- Throws:
InvalidGridException
- If not a single, predominant voltage level can be determined
-
buildSubGridTopologyGraph
public static SubGridTopologyGraph buildSubGridTopologyGraph(String gridName, RawGridElements rawGrid, SystemParticipants systemParticipants, GraphicElements graphics) Disassembles this grid model into sub grid models and returns a topology of the sub grids as a directed, immutable graph. The direction points from higher to lower voltage level.- Parameters:
gridName
- Name of the gridrawGrid
- Container model of raw grid elementssystemParticipants
- Container model of system participantsgraphics
- Container element of graphic elements- Returns:
- An immutable, directed graph of sub grid topologies.
-
traverseAlongSwitchChain
public static LinkedList<NodeInput> traverseAlongSwitchChain(NodeInput startNode, RawGridElements rawGridElements) Traversing along a chain of switches and return the traveled nodes. The end thereby is defined by a node, that either is a dead end or is connected to any other type of connector (e.g. lines, transformers) and therefore leads to other parts of a "real" grid. If the starting node is not part of any switch, the starting node is returned.- Parameters:
startNode
- Node that is meant to be the start of the switch chainrawGridElements
- Elements of the pure grid structure.- Returns:
- The end node of the switch chain
-
combineToJointGrid
Combines a given collection of sub grid containers to a joint model. If the single models do not fit together, exceptions are thrown.- Parameters:
subGridContainers
- Collections of already existing sub grid models- Returns:
- A joint model
-
withTrafoNodeAsSlack
Returns a copySubGridContainer
based on the provided subgrid with a certain set of nodes marked as slack nodes. In general, the grid is modified in a way that slack nodes are added at transformer nodes based on assumptions about the grid, as well as all other affect entities of the grid are accordingly.This step is necessary for power flow calculations, as by default, when the container is derived from
JointGridContainer
, only the original slack nodes are incorporated in the different sub containers. Thereby, most of the standard power flow calculations cannot be carried out right away.The following modifications are made:
- 2 winding transformer handling
- high voltage nodes are marked as slack nodes
- high voltage nodes in the
RawGridElements.getNodes()
set are replaced with the new slack marked high voltage nodes - high voltage nodes as part of
GraphicElements.getNodeGraphics()
are replaced with the new slack marked high voltage nodes
- 3 winding transformer handling
- if node a is located in this subgrid, no changes on 3 winding transformer nodes are made
- if node b or c is located in this grid, the transformers internal node is marked as slack node and if node a is marked as slack node, this node is unmarked as slack node
- if node a got unmarked as slack, the
RawGridElements.getNodes()
gets adapted accordingly - in any case the internal node of the transformer is added to the
RawGridElements.getNodes()
set
- Parameters:
subGridContainer
- the subgrid container to be altered- Returns:
- a copy of the given
SubGridContainer
with transformer nodes marked as slack
- 2 winding transformer handling
-