Class ContainerUtils

java.lang.Object
edu.ie3.datamodel.utils.ContainerUtils

public class ContainerUtils extends Object
Offers functionality useful for grouping different models together
  • Method Details

    • getDistanceTopologyGraph

      public static Optional<DistanceWeightedGraph> getDistanceTopologyGraph(GridContainer grid)
      Returns the topology of the provided grid container as a DistanceWeightedGraph if the provided grid container's RawGridElements 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 provided RawGridElements as a DistanceWeightedGraph, 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

      public static Optional<ImpedanceWeightedGraph> getImpedanceTopologyGraph(GridContainer grid)
      Returns the topology of the provided grid container as a ImpedanceWeightedGraph if the provided grid container's RawGridElements 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 provided RawGridElements as a ImpedanceWeightedGraph, 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

      public static RawGridElements filterForSubnet(RawGridElements input, int subnet)
      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 filter
      subnet - The filter criterion
      Returns:
      A RawGridElements filtered for the subnet
    • filterForSubnet

      public static SystemParticipants filterForSubnet(SystemParticipants input, int subnet)
      Filters all system participants for the provided subnet.
      Parameters:
      input - The model to filter
      subnet - The filter criterion
      Returns:
      A SystemParticipants filtered for the subnet
    • filterForSubnet

      public static GraphicElements filterForSubnet(GraphicElements input, int subnet)
      Filters all graphic elements for the provided subnet.
      Parameters:
      input - The model to filter
      subnet - The filter criterion
      Returns:
      A GraphicElements filtered for the subnet
    • determinePredominantVoltLvl

      public static VoltageLevel determinePredominantVoltLvl(RawGridElements rawGrid, int subnet)
      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 grid
      subnet - 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 grid
      rawGrid - Container model of raw grid elements
      systemParticipants - Container model of system participants
      graphics - 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 chain
      rawGridElements - Elements of the pure grid structure.
      Returns:
      The end node of the switch chain
    • combineToJointGrid

      public static JointGridContainer combineToJointGrid(Collection<SubGridContainer> subGridContainers)
      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

      public static SubGridContainer withTrafoNodeAsSlack(SubGridContainer subGridContainer)
      Returns a copy SubGridContainer 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
      • 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