From c3b1e8241a0456eed42c3278c9616d6500859272 Mon Sep 17 00:00:00 2001 From: cloudflight <cloudflight@126.com> Date: 星期六, 02 十二月 2023 18:51:59 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/Yw/Hydro.V1.0 --- Hydro.Inp/NetWork.cs | 17 ++++++++++++----- out/Hydro.Core.dll | 0 Test/Test.csproj | 2 +- out/HydraulicModel.dll | 0 out/CommonBase.dll | 0 out/Hydro.ConfigModel.dll | 0 out/Hydro.HydraulicOptimizer.dll | 0 Test/Program.cs | 4 ++-- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Hydro.Inp/NetWork.cs b/Hydro.Inp/NetWork.cs index 9dd99e2..2f4c527 100644 --- a/Hydro.Inp/NetWork.cs +++ b/Hydro.Inp/NetWork.cs @@ -2,6 +2,7 @@ //using Hydro.HydraulicModel; using System; using System.Collections.Generic; +using System.Data; using System.Drawing; using System.IO; using System.IO.Ports; @@ -465,7 +466,7 @@ #region 浼樺寲鏂规 int k1 = 0; int k2 = 0; - + Nodes.Sort((a, b) => string.Compare(a.ID, b.ID)); points.Sort((a, b) => string.Compare(a.ID, b.ID)); @@ -493,7 +494,7 @@ } #endregion - + //寤虹珛鐐圭嚎鍏崇郴閾捐〃StartNode锛屽厛灏嗙绾夸互Node1锛堣妭鐐�1鐨処D锛夋帓搴忥紝鍐嶅皢Nodes鎸塈D鎺掑簭锛屽缓绔嬩袱涓父鏍噆1銆乲2锛屾鍚戜竴娆″惊鐜紝寤虹珛閾捐〃鍏崇郴 //鏃堕棿澶嶆潅搴� O(n) @@ -564,7 +565,7 @@ } if (!File.Exists(tempPath)) { - throw new Exception("妯℃澘鏂囦欢涓嶅瓨鍦�"); + throw new Exception("妯℃澘鏂囦欢涓嶅瓨鍦�," + tempPath); } if (!File.Exists(InpPath)) File.Create(InpPath).Close(); @@ -954,9 +955,15 @@ HydraulicModel.Epanet epanet = new HydraulicModel.Epanet(); var result = new List<TimePoint>(); var err = epanet.open(InpPath, "d:\\5.log", ""); + if (err != 0) { - throw new Exception($"璁$畻澶辫触锛歿err}"); + throw new Exception($"鎵撳紑璁$畻鏂囦欢澶辫触锛歿err}"); + } + var errCal = epanet.solveH(); + if (errCal != 0) + { + throw new Exception($"璁$畻澶辫触锛歿errCal}"); } int nodeCount = 0, linkCount = 0; epanet.getcount((int)CountType.Node, ref nodeCount); @@ -1007,7 +1014,7 @@ /// <returns></returns> public virtual List<TimePoint> Calc() { - var inpPath = Path.Combine(Directory.GetCurrentDirectory(), @"data\inp\calc.inp"); + var inpPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"data\inp\calc.inp"); BuildToInp(inpPath); return Calc(inpPath); } diff --git a/Test/Program.cs b/Test/Program.cs index 286c73b..d8f56d8 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -138,7 +138,7 @@ static void Test3() { var nw = new NetWorkMapModel(); - var result = nw.Calc(); + var result = nw.Calc("d:\\revitinp.inp"); Console.WriteLine(result); Console.ReadLine(); } @@ -146,7 +146,7 @@ static void Test4() { var nw = new NetWork(); - var result = nw.Calc(inpPath); + var result = nw.Calc(); Console.WriteLine(JsonConvert.SerializeObject(result)); Console.ReadLine(); } diff --git a/Test/Test.csproj b/Test/Test.csproj index b885ac0..26e87cc 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -14,7 +14,7 @@ <Deterministic>true</Deterministic> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> + <PlatformTarget>x64</PlatformTarget> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> diff --git a/out/CommonBase.dll b/out/CommonBase.dll index effa5ea..60e129e 100644 --- a/out/CommonBase.dll +++ b/out/CommonBase.dll Binary files differ diff --git a/out/HydraulicModel.dll b/out/HydraulicModel.dll index 69534c7..2dccfd2 100644 --- a/out/HydraulicModel.dll +++ b/out/HydraulicModel.dll Binary files differ diff --git a/out/Hydro.ConfigModel.dll b/out/Hydro.ConfigModel.dll index da39fb0..47e2f31 100644 --- a/out/Hydro.ConfigModel.dll +++ b/out/Hydro.ConfigModel.dll Binary files differ diff --git a/out/Hydro.Core.dll b/out/Hydro.Core.dll index fa4df45..af3a86e 100644 --- a/out/Hydro.Core.dll +++ b/out/Hydro.Core.dll Binary files differ diff --git a/out/Hydro.HydraulicOptimizer.dll b/out/Hydro.HydraulicOptimizer.dll index c14bd82..4c676e8 100644 --- a/out/Hydro.HydraulicOptimizer.dll +++ b/out/Hydro.HydraulicOptimizer.dll Binary files differ -- Gitblit v1.9.3