From 0f99d4d12f2eae29bbe343f4b3131f2faeccda5d Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期二, 14 一月 2025 17:31:20 +0800 Subject: [PATCH] 泵曲线修改 --- WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/05-extensions/HydroModelInfoExtensions.cs | 166 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 131 insertions(+), 35 deletions(-) diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/05-extensions/HydroModelInfoExtensions.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/05-extensions/HydroModelInfoExtensions.cs index c8b8851..8d5ffd0 100644 --- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/05-extensions/HydroModelInfoExtensions.cs +++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/05-extensions/HydroModelInfoExtensions.cs @@ -1,6 +1,4 @@ -锘縰sing DevExpress.Drawing.Internal.Interop; -using Yw.EPAnet; -using Yw.Hydro; +锘縰sing Yw.Hydro; using Yw.Model; namespace Yw.WinFrmUI @@ -13,17 +11,23 @@ #region 淇鍙傛暟 - private const double _pipe_diameter_default = 500;//绠¢亾榛樿鐩村緞 private const double _pipe_roughness_default = 110;//绠¢亾榛樿绮楃硻绯绘暟 - private const double _pipe_minorloss_default = 0.1;//绠¢亾榛樿绮楃硻绯绘暟 + private const double _translation_roughness_default = 120;//杩囨浮浠堕粯璁ょ矖绯欑郴鏁� + private const double _translation_minorloss_default = 0.3;//杩囨浮浠堕粯璁ゅ眬闃荤郴鏁� private const double _valve_minorloss_default = 0.3d; //闃�闂ㄩ粯璁ゅ眬闃荤郴鏁� private const double _resistance_minorloss_default = 9d;//闃讳欢榛樿灞�闃荤郴鏁� private const double _blunthead_minorloss_default = 0.1d;//闂峰ご灞�閮ㄩ樆鍔涚郴鏁� + private const double _cooling_coefficient_default = 100000d;//鍐峰嵈濉旀祦閲忕郴鏁� /// <summary> /// 淇鍙傛暟 /// </summary> - public static void RepairParas(this Yw.Model.HydroModelInfo hydroInfo, out string msg) + public static void RepairParas + ( + this Yw.Model.HydroModelInfo hydroInfo, + HydroPropStatusHelper propStatusHelper, + out string msg + ) { msg = string.Empty; if (hydroInfo == null) @@ -35,21 +39,14 @@ var allLinks = hydroInfo.GetAllLinks(); //绠¢亾 - if (hydroInfo.Pipes != null && hydroInfo.Pumps.Count > 0) + if (hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0) { foreach (var pipe in hydroInfo.Pipes) { - if (pipe.Diameter <= 0) - { - pipe.Diameter = _pipe_diameter_default; - } if (pipe.Roughness <= 0) { pipe.Roughness = _pipe_roughness_default; - } - if (pipe.MinorLoss <= 0) - { - pipe.MinorLoss = _pipe_minorloss_default; + propStatusHelper.UpdatePropStatus(pipe, nameof(pipe.Roughness), ePropStatus.Abnormal, "銆愮矖绯欑郴鏁般�戞暟鎹紓甯�"); } } } @@ -57,22 +54,6 @@ //杩囨浮浠� if (hydroInfo.Translations != null && hydroInfo.Translations.Count > 0) { - foreach (var translation in hydroInfo.Translations) - { - if (translation.Diameter <= 0) - { - translation.Diameter = _pipe_diameter_default; - } - if (translation.Roughness <= 0) - { - translation.Roughness = _pipe_roughness_default; - } - if (translation.MinorLoss <= 0) - { - translation.MinorLoss = _pipe_minorloss_default; - } - } - foreach (var translation in hydroInfo.Translations) { double? tempDiameter = null; @@ -284,6 +265,37 @@ #endregion + #region 鍐峰嵈濉� + + if (hydroInfo.Coolings != null && hydroInfo.Coolings.Count > 0) + { + foreach (var cooling in hydroInfo.Coolings) + { + if (cooling.Coefficient < 1) + { + cooling.Coefficient = _cooling_coefficient_default; + propStatusHelper.UpdatePropStatus(cooling.Code, nameof(cooling.Coefficient), ePropStatus.Abnormal, $"銆愭祦閲忕郴鏁般�戞暟鎹紓甯革紝浣跨敤榛樿鍊糩{_cooling_coefficient_default}]淇"); + } + if (cooling.Caliber < 1) + { + var link = allLinks.Find(x => x.StartCode == cooling.Code || x.EndCode == cooling.Code); + if (link != null) + { + if (link is HydroPipeInfo pipe) + { + if (pipe.Diameter > 0) + { + cooling.Caliber = pipe.Diameter; + propStatusHelper.UpdatePropStatus(cooling.Code, nameof(cooling.Caliber), ePropStatus.Abnormal, $"銆愬彛寰勩�戞暟鎹紓甯革紝浣跨敤鐩搁偦绠¢亾淇"); + } + } + } + } + } + } + + #endregion + } @@ -292,9 +304,9 @@ #region 瑁呯疆璁$畻 /// <summary> - /// 鑾峰彇鎵▼ + /// 鑾峰彇寮�濮嬪帇鍔�(m) /// </summary> - public static double GetHead(this Yw.Model.HydroModelInfo hydroInfo) + public static double GetStartHead(this Yw.Model.HydroModelInfo hydroInfo) { if (hydroInfo == null) { @@ -326,7 +338,18 @@ } } } + return startHeadValue; + } + /// <summary> + /// 鑾峰彇缁撴潫鍘嬪姏(m) + /// </summary> + public static double GetEndHead(this Yw.Model.HydroModelInfo hydroInfo) + { + if (hydroInfo == null) + { + return default; + } double endHeadValue = 0; var allNodeList = hydroInfo.GetAllNodes(); if (allNodeList != null && allNodeList.Count > 0) @@ -339,7 +362,7 @@ }); if (endSource == null) { - endSource = allSourceList.Matching(new List<string>() + endSource = allNodeList.Matching(new List<string>() { Yw.Hydro.Flags.姘存簮, Yw.Hydro.Flags.鏈 @@ -357,7 +380,20 @@ } } } + return endHeadValue; + } + /// <summary> + /// 鑾峰彇鎵▼ + /// </summary> + public static double GetHead(this Yw.Model.HydroModelInfo hydroInfo) + { + if (hydroInfo == null) + { + return default; + } + var startHeadValue = GetStartHead(hydroInfo); + var endHeadValue = GetEndHead(hydroInfo); return endHeadValue - startHeadValue; } @@ -420,6 +456,64 @@ } /// <summary> + /// 鑾峰彇鎬荤缁撴潫鍘嬪姏锛堢粷瀵瑰帇鍔涳級 + /// </summary> + public static double? GetPipeEndHead(this Yw.Model.HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuVisualDict) + { + if (hydroInfo == null) + { + return default; + } + if (allCalcuVisualDict == null || allCalcuVisualDict.Count < 1) + { + return default; + } + var allNodeList = hydroInfo.GetAllNodes(); + if (allNodeList == null || allNodeList.Count < 1) + { + return default; + } + var node = allNodeList.Matching(new List<string>() + { + Yw.Hydro.Flags.鎬荤, + Yw.Hydro.Flags.鍑哄彛, + Yw.Hydro.Flags.榛樿 + }); + if (node == null) + { + node = allNodeList.Matching(new List<string>() + { + Yw.Hydro.Flags.鎬荤, + Yw.Hydro.Flags.鍑哄彛 + }); + } + if (node == null) + { + return default; + } + + var calcuVisualResult = allCalcuVisualDict.GetValue(node.Code); + if (calcuVisualResult == null) + { + return default; + } + var calcuValue = calcuVisualResult.GetCalcuValue(Yw.Hydro.VisualCalcuProp.CalcuHead); + if (calcuValue == null) + { + return default; + } + return Math.Round(calcuValue.Value, 2); + } + + /// <summary> + /// 鑾峰彇鎬荤缁撴潫鍘嬪姏锛堢粷瀵瑰帇鍔涳級 + /// </summary> + public static double? GetPipeEndHead(this Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult) + { + return GetPipeEndHead(hydroInfo, calcuResult?.GetVisualDict()); + } + + /// <summary> /// 鑾峰彇鎬荤鍘嬪姏锛堢粷瀵瑰帇鍔涳級 /// </summary> public static double? GetPipeHead(this Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult) @@ -474,7 +568,9 @@ { return default; } - return Math.Round(calcuValue.Value, 2); + var endHeadValue = calcuValue.Value; + var startHeadValue = GetStartHead(hydroInfo); + return Math.Round(endHeadValue - startHeadValue, 2); } #endregion -- Gitblit v1.9.3