From 0e0709e63ed50093d09fb88ac1ea4eb9b5a37afc Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 13 八月 2024 02:08:46 +0800
Subject: [PATCH] Yw.EPAnet修改

---
 Hydro/Yw.EPAnet.Calcu.Core/01-network/00-core/Network_Calc.cs |  206 +++++++++++++++++++++++++-------------------------
 1 files changed, 103 insertions(+), 103 deletions(-)

diff --git a/Hydro/Yw.EPAnet.Calcu.Core/01-network/00-core/Network_Calc.cs b/Hydro/Yw.EPAnet.Calcu.Core/01-network/00-core/Network_Calc.cs
index 2ad8cbc..80331a2 100644
--- a/Hydro/Yw.EPAnet.Calcu.Core/01-network/00-core/Network_Calc.cs
+++ b/Hydro/Yw.EPAnet.Calcu.Core/01-network/00-core/Network_Calc.cs
@@ -9,111 +9,111 @@
 {
     public partial class Network
     {
-        /// <summary>
-        /// 鏍规嵁Inp鏂囦欢璁$畻
-        /// </summary>
-        /// <returns></returns>
-        public virtual CalcuResult Calc()
-        {
-            EPAcore.Core.HydraulicCore epanet = new EPAcore.Core.HydraulicCore(true);
-            var cResult = new CalcuResult();
-            //鑾峰彇绯荤粺涓存椂鏂囦欢鐩綍锛屽苟涓斿垱寤轰竴涓复鏃舵枃浠�
-            string InpPath = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".inp";
-            string InpTxt=InpInteropHelper.ToInpString(this);
-            System.IO.File.WriteAllText(InpPath, InpTxt);
-            var err = epanet.open(InpPath, "", "");
-            
-            if (err != 0)
-            {
-                StringBuilder sbb=new StringBuilder();
-                epanet.geterror(err,sbb, 256);
-                cResult.Succeed = false;
-                cResult.FailedList.Add(new CalcuFailed()
-                {
-                    Code = err,
-                    Message =$"鍔犺浇绠$綉澶辫触锛寋sbb}"
-                });
-            }
-            var errCal = epanet.solveH();
-            if (errCal != 0)
-            {
-                StringBuilder sbb = new StringBuilder();
-                epanet.geterror(errCal, sbb, 256);
-                cResult.Succeed = false;
-                cResult.FailedList.Add(new CalcuFailed()
-                {
-                    Code = errCal,
-                    Message = $"璁$畻澶辫触锛寋sbb}"
-                });
-            }
-            int nodeCount = 0, linkCount = 0;
-            epanet.getcount((int)CountType.Node, ref nodeCount);
-            epanet.getcount((int)CountType.Link, ref linkCount);
-            const int MAXID = 31;
+        ///// <summary>
+        ///// 鏍规嵁Inp鏂囦欢璁$畻
+        ///// </summary>
+        ///// <returns></returns>
+        //public virtual CalcuResult Calc()
+        //{
+        //    EPAcore.Core.HydraulicCore epanet = new EPAcore.Core.HydraulicCore(true);
+        //    var cResult = new CalcuResult();
+        //    //鑾峰彇绯荤粺涓存椂鏂囦欢鐩綍锛屽苟涓斿垱寤轰竴涓复鏃舵枃浠�
+        //    string InpPath = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".inp";
+        //    string InpTxt = InpInteropHelper.ToInpString(this);
+        //    System.IO.File.WriteAllText(InpPath, InpTxt);
+        //    var err = epanet.open(InpPath, "", "");
 
-            var sb = new StringBuilder(MAXID);
+        //    if (err != 0)
+        //    {
+        //        StringBuilder sbb = new StringBuilder();
+        //        epanet.geterror(err, sbb, 256);
+        //        cResult.Succeed = false;
+        //        cResult.FailedList.Add(new CalcuFailed()
+        //        {
+        //            Code = err,
+        //            Message = $"鍔犺浇绠$綉澶辫触锛寋sbb}"
+        //        });
+        //    }
+        //    var errCal = epanet.solveH();
+        //    if (errCal != 0)
+        //    {
+        //        StringBuilder sbb = new StringBuilder();
+        //        epanet.geterror(errCal, sbb, 256);
+        //        cResult.Succeed = false;
+        //        cResult.FailedList.Add(new CalcuFailed()
+        //        {
+        //            Code = errCal,
+        //            Message = $"璁$畻澶辫触锛寋sbb}"
+        //        });
+        //    }
+        //    int nodeCount = 0, linkCount = 0;
+        //    epanet.GetCount((int)CountType.Node, ref nodeCount);
+        //    epanet.GetCount((int)CountType.Link, ref linkCount);
+        //    const int MAXID = 31;
 
-            for (int i = 1; i <= nodeCount; i++)
-            {
-                epanet.getnodeid(i, sb);
-                var arr = new string[] { "Press", "Head", "Demand" }; //System.Enum.GetValues(typeof(HydraulicModel.NodeValueType));
-                var arrnum = new int[] { 10, 11, 9 };
-                var result = new CalcuNode()
-                {
-                    Id = sb.ToString(),
-                };
-                for (var j = 0; j < arr.Length; j++)
-                {
-                    float v = 0;
-                    var t = (EPAcore.Core.NodeValueType)j;
-                    epanet.getnodevalue(i, arrnum[j], ref v);
-                    switch (arr[j])
-                    {
-                        case "Press":
-                            result.Press = v;
-                            break;
-                        case "Head":
-                            result.Head = v;
-                            break;
-                        case "Demand":
-                            result.Demand = v;
-                            break;
-                    }
-                }
-                cResult.NodeList.Add(result);
-            }
+        //    var sb = new StringBuilder(MAXID);
 
-            for (int i = 1; i <= linkCount; i++)
-            {
-                epanet.getlinkid(i, sb);
-                //var arr = System.Enum.GetValues(typeof(HydraulicModel.LinkValueType));
-                var arr = new string[] { "Flow", "Velocity", "Headloss" }; //System.Enum.GetValues(typeof(HydraulicModel.NodeValueType));
-                var arrnum = new int[] { 8, 9, 10 };
-                var result = new CalcuLink()
-                {
-                    Id = sb.ToString(),
-                };
-                for (var j = 0; j < arr.Length; j++)
-                {
-                    float v = 0;
-                    var t = (EPAcore.Core.NodeValueType)j;
-                    epanet.getnodevalue(i, arrnum[j], ref v);
-                    switch (arr[j])
-                    {
-                        case "Flow":
-                            result.Flow = v;
-                            break;
-                        case "Velocity":
-                            result.Velocity = v;
-                            break;
-                        case "Headloss":
-                            result.Headloss = v;
-                            break;
-                    }
-                }
-                cResult.LinkList.Add(result);
-            }
-            return cResult;
-        }
+        //    for (int i = 1; i <= nodeCount; i++)
+        //    {
+        //        epanet.getnodeid(i, sb);
+        //        var arr = new string[] { "Press", "Head", "Demand" }; //System.Enum.GetValues(typeof(HydraulicModel.NodeValueType));
+        //        var arrnum = new int[] { 10, 11, 9 };
+        //        var result = new CalcuNode()
+        //        {
+        //            Id = sb.ToString(),
+        //        };
+        //        for (var j = 0; j < arr.Length; j++)
+        //        {
+        //            float v = 0;
+        //            var t = (EPAcore.Core.NodeValueType)j;
+        //            epanet.getnodevalue(i, arrnum[j], ref v);
+        //            switch (arr[j])
+        //            {
+        //                case "Press":
+        //                    result.Press = v;
+        //                    break;
+        //                case "Head":
+        //                    result.Head = v;
+        //                    break;
+        //                case "Demand":
+        //                    result.Demand = v;
+        //                    break;
+        //            }
+        //        }
+        //        cResult.NodeList.Add(result);
+        //    }
+
+        //    for (int i = 1; i <= linkCount; i++)
+        //    {
+        //        epanet.getlinkid(i, sb);
+        //        //var arr = System.Enum.GetValues(typeof(HydraulicModel.LinkValueType));
+        //        var arr = new string[] { "Flow", "Velocity", "Headloss" }; //System.Enum.GetValues(typeof(HydraulicModel.NodeValueType));
+        //        var arrnum = new int[] { 8, 9, 10 };
+        //        var result = new CalcuLink()
+        //        {
+        //            Id = sb.ToString(),
+        //        };
+        //        for (var j = 0; j < arr.Length; j++)
+        //        {
+        //            float v = 0;
+        //            var t = (EPAcore.Core.NodeValueType)j;
+        //            epanet.getnodevalue(i, arrnum[j], ref v);
+        //            switch (arr[j])
+        //            {
+        //                case "Flow":
+        //                    result.Flow = v;
+        //                    break;
+        //                case "Velocity":
+        //                    result.Velocity = v;
+        //                    break;
+        //                case "Headloss":
+        //                    result.Headloss = v;
+        //                    break;
+        //            }
+        //        }
+        //        cResult.LinkList.Add(result);
+        //    }
+        //    return cResult;
+        //}
     }
 }

--
Gitblit v1.9.3