Ejemplo n.º 1
0
        private HashSet<TopologicalNode.DynamicTopologicalNode> makeDynamicTopologicalNodes
            (TopologicalNode.VoltageLevel parentNode, DateTime timeIndex)
        {
            var dynaNodes = new HashSet<TopologicalNode.DynamicTopologicalNode>();
            foreach(KeyValuePair<string,ConnectivityNode> connNode in parentNode.Nodes.ConnectivityNodes)
            {
                if (connNode.Value.DynamicTopoNode == null)
                {
                    var dynaNode = new TopologicalNode.DynamicTopologicalNode(connNode.Value, parentNode, timeIndex);
                    connNode.Value.DynamicTopoNode = dynaNode;
                    dynaNodes.Add(dynaNode);
                    traverseClosedSwitches(dynaNode, connNode.Value);
                }
                if(connNode.Value.DynamicTopoNode.TimeIndex != timeIndex)
                {
                    if(!parentNode.DynamicNodes.ContainsKey(timeIndex))
                    {
                        parentNode.DynamicNodes[timeIndex] = new HashSet<TopologicalNode.DynamicTopologicalNode>();
                    }
                    var dynaNode = new TopologicalNode.DynamicTopologicalNode(connNode.Value,parentNode,timeIndex);
                    connNode.Value.DynamicTopoNode = dynaNode;
                    parentNode.DynamicNodes[timeIndex].Add(dynaNode);
                    traverseClosedSwitches(dynaNode, connNode.Value);
                    dynaNodes.Add(dynaNode);     

                }
                
            }
            return dynaNodes;

        }
Ejemplo n.º 2
0
 private void traverseClosedSwitches(TopologicalNode.DynamicTopologicalNode dynaNode, ConnectivityNode connNode)
 {
     var switchNodes = new Stack<ConnectivityNode>();
     switchNodes.Push(connNode);
     while (switchNodes.Count != 0)
     {
         var currentNode = switchNodes.Pop();
         dynaNode.Nodes.ConnectivityNodes[currentNode.Name] = currentNode;
         currentNode.DynamicTopoNode = dynaNode;
         foreach (ConnectivityNode nextConnNode in currentNode.AdjacentSwitchNodes(false)
             .Where(x => !ReferenceEquals(x,currentNode)))
         {
             switchNodes.Push(nextConnNode);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// performs a traversal of all nodes connected to each other by switches
 /// </summary>t
 /// <param name="topoNode"></param>
 /// <param name="connNode"></param>
 private void traverseSwitches(TopologicalNode.VoltageLevel topoNode, ConnectivityNode connNode)
 {
     if(topoNode.Nodes.ConnectivityNodes.ContainsKey(connNode.Name))
     { return;}
     topoNode.Nodes.ConnectivityNodes.Add(connNode.Name, connNode);
     connNode.StaticTopoNode = topoNode;
     foreach (ConnectivityNode adjacentNode in connNode.AdjacentSwitchNodes(true))
     {
         traverseSwitches(topoNode, adjacentNode);                    
     }
 }