/// <summary> /// 测试该支路加正电压会不会短路 /// </summary> public bool hasShortCircuit() { AppProject pro = AppProject.GetInstance(); if (branch.Count != 0) { Dijkstra dist = pro.getDijkstra(branch[0]); List <TNode> negative = pro.GetSetTerminal(p => p.Type == NamesManage.Negative); foreach (TNode nd in negative) { if (dist.getRouteWeight(nd.index) == 0) { return(true); } } } return(false); }
/// <summary> /// 获得与总负相连接的支路(Dijkstra) /// </summary> public void GetGndBranches(List <TNode> sources, ref BranchNet net) { AppProject pro = AppProject.GetInstance(); IReadOnlyCollection <TNode> cfs = pro.CFNodes; foreach (var nd in sources) { Dijkstra dist = pro.getDijkstra(nd); foreach (var cf in cfs) { if (dist.getRouteWeight(cf.index) == 0) { List <int> paths = dist.getPath(cf.index); TestBranch cbranch = new TestBranch(); if (paths.Count > 0) { cbranch.TryAddNode(pro.Nodes[paths[paths.Count - 1]]); } net.Branches.Add(cbranch); } } } }