From 91445949b710065604700890ffefaa9a1bfb89b5 Mon Sep 17 00:00:00 2001 From: cloudflight <cloudflight@126.com> Date: 星期四, 07 十一月 2024 05:57:34 +0800 Subject: [PATCH] 修复计算时,未设置局部阻力的管线报错问题 --- Hydro/Yw.EPAnet.Calcu.Core/04-Inp/InpInteropHelper.cs | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Hydro/Yw.EPAnet.Calcu.Core/04-Inp/InpInteropHelper.cs b/Hydro/Yw.EPAnet.Calcu.Core/04-Inp/InpInteropHelper.cs index e065e2a..5337be8 100644 --- a/Hydro/Yw.EPAnet.Calcu.Core/04-Inp/InpInteropHelper.cs +++ b/Hydro/Yw.EPAnet.Calcu.Core/04-Inp/InpInteropHelper.cs @@ -113,7 +113,11 @@ if (o.Roughness == 0) o.Roughness = 110; string statusString = o.LinkStatus == PipeStatus.Closed ? "CLOSED" : ""; double MinorLoss = o.MinorLoss; - if (minorResult!=null) MinorLoss+= minorResult.LinkDict[o.Id].MinorlossCoff; + + if (minorResult!=null && minorResult.LinkDict.TryGetValue(o.Id,out ICalcuLink minorlossCalc)) + { + MinorLoss += minorlossCalc.MinorlossCoff; + } pipeStringBuilder.AppendLine($"{o.Id}\t{o.StartNode.Id}\t{o.EndNode.Id}\t{o.Length}\t{o.Diameter}\t{o.Roughness}\t{MinorLoss}\t{statusString}\t;\t");// + $"{p.Level}"); if (o.LinkStatus != PipeStatus.Open) -- Gitblit v1.9.3