public static List <Substation> FindConnectedSubstationsAtVoltageLevel(Substation root, List <Substation> connectedSubstations, NetworkModel model, VoltageLevel baseKv) { foreach (TransmissionLine transmissionLine in model.TransmissionLines) { if (transmissionLine.FromNode.BaseKV.InternalID == baseKv.InternalID) { if (transmissionLine.FromSubstation == root) { if (!connectedSubstations.Contains(transmissionLine.ToSubstation)) { connectedSubstations.Add(transmissionLine.ToSubstation); List <Substation> subConnectedSubstations = ObservableIsland.FindConnectedSubstationsAtVoltageLevel(transmissionLine.ToSubstation, connectedSubstations, model, baseKv); } } else if (transmissionLine.ToSubstation == root) { if (!connectedSubstations.Contains(transmissionLine.FromSubstation)) { connectedSubstations.Add(transmissionLine.FromSubstation); List <Substation> subConnectedSubstations = ObservableIsland.FindConnectedSubstationsAtVoltageLevel(transmissionLine.FromSubstation, connectedSubstations, model, baseKv); } } } } return(connectedSubstations); }
public bool TryMerge(ObservableIsland island, NetworkModel model) { TransmissionLine connectingLine = ConnectingLineBetween(island, model); if (connectingLine != null) { m_substations.AddRange(island.Substations); return(true); } return(false); }
public TransmissionLine ConnectingLineBetween(ObservableIsland island, NetworkModel model) { foreach (TransmissionLine transmissionLine in model.TransmissionLines) { if (Substations.Contains(transmissionLine.FromSubstation) && island.Substations.Contains(transmissionLine.ToSubstation)) { return(transmissionLine); } else if (island.Substations.Contains(transmissionLine.ToSubstation) && Substations.Contains(transmissionLine.ToSubstation)) { return(transmissionLine); } } return(null); }
public static List <Substation> FindConnectedSubstations(Substation root, List <Substation> connectedSubstations, NetworkModel model) { foreach (TransmissionLine transmissionLine in model.TransmissionLines) { if (transmissionLine.FromSubstation == root) { if (!connectedSubstations.Contains(transmissionLine.ToSubstation)) { connectedSubstations.Add(transmissionLine.ToSubstation); List <Substation> subConnectedSubstations = ObservableIsland.FindConnectedSubstations(transmissionLine.ToSubstation, connectedSubstations, model); } } else if (transmissionLine.ToSubstation == root) { if (!connectedSubstations.Contains(transmissionLine.FromSubstation)) { connectedSubstations.Add(transmissionLine.FromSubstation); List <Substation> subConnectedSubstations = ObservableIsland.FindConnectedSubstations(transmissionLine.FromSubstation, connectedSubstations, model); } } } return(connectedSubstations); }