From 31a8e93cf1cc708b68456b88aa5b0031a41eb47a Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期二, 10 十二月 2024 16:36:45 +0800
Subject: [PATCH] 能耗分析

---
 Service/HStation.Service.Xhs.Core/00-core/Flags.cs                                                           |    5 +
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/04-working/SimulationPumpSingleWorkingChartCtrl.cs |   81 +++++++++++++++++++-
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationMultiWorkingEnergyDlg.cs               |    6 +
 WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/01-set/SetHydroMonitorListCtrl.cs                                 |    2 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs              |    2 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs             |   22 ++++-
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs              |   16 +++-
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/10-analy/SimulationSingleWorkingAnalyCtrl.cs               |    2 
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyDlg.cs              |   10 ++
 WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroFlagsHelper.cs                                        |   45 +++++++++++
 10 files changed, 171 insertions(+), 20 deletions(-)

diff --git a/Service/HStation.Service.Xhs.Core/00-core/Flags.cs b/Service/HStation.Service.Xhs.Core/00-core/Flags.cs
index 635e73a..cf93951 100644
--- a/Service/HStation.Service.Xhs.Core/00-core/Flags.cs
+++ b/Service/HStation.Service.Xhs.Core/00-core/Flags.cs
@@ -11,6 +11,11 @@
         public const string 榛樿 = "榛樿";
 
         /// <summary>
+        /// 鎬荤
+        /// </summary>
+        public const string 鎬荤 = "鎬荤";
+
+        /// <summary>
         /// 杩涘彛
         /// </summary>
         public const string 杩涘彛 = "杩涘彛";
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
index 5907903..139521b 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -1540,6 +1540,13 @@
             return _monitorHelper;
         }
 
+        //鑾峰彇鐩戞祴鐐瑰垪琛�
+        private async Task<List<HydroMonitorVmo>> GetMonitorList()
+        {
+            var helper = GetMonitorHelper();
+            return await helper.Get();
+        }
+
         //璁剧疆鐩戞祴鐐瑰垪琛�
         private async void SetMonitorList(HydroVisualInfo visual)
         {
@@ -2263,7 +2270,7 @@
                 return;
             }
             SimulationWordReport word = new SimulationWordReport();
-            word.Create(fileName);
+            //word.Create(fileName);
         }
 
         #endregion
@@ -2458,8 +2465,9 @@
         }
 
         //鑳芥晥鍒嗘瀽
-        private void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        private async void barBtnWorkingPower_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
+            var allMonitorList = await GetMonitorList();
             var workingCheckedListHelper = GetWorkingCheckedListHelper();
             var allCheckedWorkingList = workingCheckedListHelper.GetCheckedWorkingList();
             if (allCheckedWorkingList == null || allCheckedWorkingList.Count < 1)
@@ -2471,14 +2479,14 @@
                     return;
                 }
                 var dlg = new SimulationSingleWorkingEnergyDlg();
-                dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult);
+                dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, allMonitorList, workingHelper.CalcuResult);
                 dlg.ShowDialog();
             }
             else
             {
 
                 var dlg = new SimulationMultiWorkingEnergyDlg();
-                dlg.SetBindingData(_hydroInfo, allCheckedWorkingList);
+                dlg.SetBindingData(_hydroInfo, allMonitorList, allCheckedWorkingList);
                 dlg.ShowDialog();
             }
         }
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
index 3da1ec5..50c8947 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/08-working/XhsProjectSimulationWorkingPage.cs
@@ -1663,7 +1663,7 @@
                 return;
             }
             var dlg = new SimulationSingleWorkingEnergyDlg();
-            dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult);
+            //dlg.SetBindingData(workingHelper.Working, workingHelper.HydroInfo, workingHelper.CalcuResult);
             dlg.ShowDialog();
         }
 
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationMultiWorkingEnergyDlg.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationMultiWorkingEnergyDlg.cs
index 49bcf03..fa0c101 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationMultiWorkingEnergyDlg.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationMultiWorkingEnergyDlg.cs
@@ -19,11 +19,12 @@
 
 
         private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅
+        private List<HydroMonitorVmo> _allMonitorList = null;
 
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroWorkingVmo> allWorkingList)
+        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroMonitorVmo> allMonitorList, List<HydroWorkingVmo> allWorkingList)
         {
             if (hydroInfo == null)
             {
@@ -34,6 +35,7 @@
                 return;
             }
             _hydroInfo = hydroInfo;
+            _allMonitorList = allMonitorList;
             this.hydroWorkingListViewCtrl1.SetBindingData(allWorkingList);
             if (allWorkingList.Count < 2)
             {
@@ -66,7 +68,7 @@
             var hydroInfo = _hydroInfo.Adapt<Yw.Model.HydroModelInfo>();
             hydroInfo.UpdateWorkingInfo(working.WorkingInfo);
             var calcuResult = hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss);
-            this.simulationSingleWorkingEnergyCtrl1.SetBindingData(working, hydroInfo, calcuResult);
+            this.simulationSingleWorkingEnergyCtrl1.SetBindingData(working, hydroInfo, _allMonitorList, calcuResult);
         }
 
 
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs
index a453f9e..0c4cdaa 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyCtrl.cs
@@ -27,21 +27,34 @@
 
         private HydroWorkingVmo _working = null;//宸ュ喌
         private Yw.Model.HydroModelInfo _hydroInfo = null;//姘村姏淇℃伅
+        private List<HydroMonitorVmo> _allMonitorList = null;//鐩戞祴鍒楄〃 
         private Dictionary<string, HydroCalcuVisualResult> _allCalcuResultVisualDict = null;//鎵�鏈夎绠楃粨鏋滃彲瑙佸瓧鍏�
 
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public void SetBindingData(HydroWorkingVmo working, Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult)
+        public void SetBindingData
+            (
+                HydroWorkingVmo working,
+                Yw.Model.HydroModelInfo hydroInfo,
+                 List<HydroMonitorVmo> allMonitorList,
+                HydroCalcuResult calcuResult
+            )
         {
             var allCalcuResultVisualDict = calcuResult?.GetVisualDict();
-            SetBindingData(working, hydroInfo, allCalcuResultVisualDict);
+            SetBindingData(working, hydroInfo, allMonitorList, allCalcuResultVisualDict);
         }
 
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public void SetBindingData(HydroWorkingVmo working, Yw.Model.HydroModelInfo hydroInfo, Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict)
+        public void SetBindingData
+            (
+                HydroWorkingVmo working,
+                Yw.Model.HydroModelInfo hydroInfo,
+                List<HydroMonitorVmo> allMonitorList,
+                Dictionary<string, HydroCalcuVisualResult> allCalcuResultVisualDict
+            )
         {
             if (working == null)
             {
@@ -57,9 +70,10 @@
             }
             _working = working;
             _hydroInfo = hydroInfo;
+            _allMonitorList = allMonitorList;
             _allCalcuResultVisualDict = allCalcuResultVisualDict;
             this.hydroEnergyTotalHorizViewCtrl1.SetBindingData(_hydroInfo, _allCalcuResultVisualDict);
-            this.simulationSingleWorkingPumpCtrl1.SetBindingData(_working, _hydroInfo, null, _allCalcuResultVisualDict);
+            this.simulationSingleWorkingPumpCtrl1.SetBindingData(_working, _hydroInfo, _allMonitorList, _allCalcuResultVisualDict);
         }
 
 
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyDlg.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyDlg.cs
index fae3d25..d4c77dd 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyDlg.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/09-energy/SimulationSingleWorkingEnergyDlg.cs
@@ -13,9 +13,15 @@
         /// <summary>
         /// 缁戝畾鏁版嵁
         /// </summary>
-        public void SetBindingData(HydroWorkingVmo working, Yw.Model.HydroModelInfo hydroInfo, HydroCalcuResult calcuResult)
+        public void SetBindingData
+            (
+                HydroWorkingVmo working,
+                Yw.Model.HydroModelInfo hydroInfo,
+                List<HydroMonitorVmo> allMonitorList,
+                HydroCalcuResult calcuResult
+            )
         {
-            this.simulationSingleWorkingEnergyCtrl1.SetBindingData(working, hydroInfo, calcuResult);
+            this.simulationSingleWorkingEnergyCtrl1.SetBindingData(working, hydroInfo, allMonitorList, calcuResult);
         }
 
 
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/10-analy/SimulationSingleWorkingAnalyCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/10-analy/SimulationSingleWorkingAnalyCtrl.cs
index a88a142..dd75e9c 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/10-analy/SimulationSingleWorkingAnalyCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/10-analy/SimulationSingleWorkingAnalyCtrl.cs
@@ -32,7 +32,7 @@
             )
         {
             this.hydroSingleWorkingEvaluationCtrl1.SetBindingData(hydroInfo, allMonitorList, working, calcuResult);
-            this.simulationSingleWorkingEnergyCtrl1.SetBindingData(working, hydroInfo, calcuResult);
+            this.simulationSingleWorkingEnergyCtrl1.SetBindingData(working, hydroInfo, allMonitorList, calcuResult);
             this.hydroSingleWorkingLossCurveCtrl1.SetBindingData(hydroInfo, calcuResult, visual);
             this.hydroSingleWorkingLossStatisticsCtrl1.SetBindingData(hydroInfo, calcuResult);
         }
diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/04-working/SimulationPumpSingleWorkingChartCtrl.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/04-working/SimulationPumpSingleWorkingChartCtrl.cs
index c2679be..cceae08 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/04-working/SimulationPumpSingleWorkingChartCtrl.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/04-working/SimulationPumpSingleWorkingChartCtrl.cs
@@ -100,12 +100,86 @@
             var startSourceMonitor = _allMonitorList?
                 .Matching(HydroVisualCalcuProp.CalcuHead, new List<string>()
                 { HStation.Xhs.Flags.姘存簮,HStation.Xhs.Flags.濮嬬,HStation.Xhs.Flags.榛樿});
+            if (startSourceMonitor == null)
+            {
+                startSourceMonitor = _allMonitorList?
+                .Matching(HydroVisualCalcuProp.CalcuHead, new List<string>()
+                { HStation.Xhs.Flags.姘存簮,HStation.Xhs.Flags.濮嬬});
+            }
+            if (startSourceMonitor != null)
+            {
+                var startSourceCalcuResult = _allCalcuResultVisualDict?.GetValue(startSourceMonitor.Relation);
+                if (startSourceCalcuResult != null)
+                {
+                    var startHead = startSourceCalcuResult.GetCalcuValue(startSourceMonitor.PropName);
+                    if (startHead.HasValue)
+                    {
+                        var endSourceMonitor = _allMonitorList?
+                                    .Matching(HydroVisualCalcuProp.CalcuHead, new List<string>()
+                                    { HStation.Xhs.Flags.姘存簮,HStation.Xhs.Flags.鏈,HStation.Xhs.Flags.榛樿});
+                        if (endSourceMonitor == null)
+                        {
+                            endSourceMonitor = _allMonitorList?
+                                        .Matching(HydroVisualCalcuProp.CalcuHead, new List<string>()
+                                        { HStation.Xhs.Flags.姘存簮,HStation.Xhs.Flags.鏈});
+                        }
+                        if (endSourceMonitor != null)
+                        {
+                            var endSouceCalcuResult = _allCalcuResultVisualDict?.GetValue(endSourceMonitor.Relation);
+                            if (endSouceCalcuResult != null)
+                            {
+                                var endHead = endSouceCalcuResult.GetCalcuValue(endSourceMonitor.PropName);
+                                if (endHead.HasValue)
+                                {
+                                    vm.StartH = Math.Round(endHead.Value - startHead.Value, 2);
+                                }
+                            }
+                        }
+                    }
 
+                }
+            }
 
+            var outPipeFlowMonitor = _allMonitorList?.Matching(HydroVisualCalcuProp.CalcuFlow, new List<string>()
+                            { HStation.Xhs.Flags.鎬荤,HStation.Xhs.Flags.鍑哄彛,HStation.Xhs.Flags.榛樿});
+            if (outPipeFlowMonitor == null)
+            {
+                outPipeFlowMonitor = _allMonitorList?.Matching(HydroVisualCalcuProp.CalcuFlow, new List<string>()
+                        { HStation.Xhs.Flags.鎬荤,HStation.Xhs.Flags.鍑哄彛});
+            }
+            if (outPipeFlowMonitor != null)
+            {
+                var outPipeFlowCalcuResult = _allCalcuResultVisualDict?.GetValue(outPipeFlowMonitor.Relation);
+                if (outPipeFlowCalcuResult != null)
+                {
+                    var outPipeFlow = outPipeFlowCalcuResult.GetCalcuValue(outPipeFlowMonitor.PropName);
+                    if (outPipeFlow.HasValue)
+                    {
+                        vm.PipeQ = Math.Round(outPipeFlow.Value, 1);
+                    }
+                }
+            }
 
+            var outPipeHeadMonitor = _allMonitorList?.Matching(HydroVisualCalcuProp.CalcuHead, new List<string>()
+                            { HStation.Xhs.Flags.鎬荤,HStation.Xhs.Flags.鍑哄彛,HStation.Xhs.Flags.榛樿});
+            if (outPipeHeadMonitor == null)
+            {
+                outPipeHeadMonitor = _allMonitorList?.Matching(HydroVisualCalcuProp.CalcuHead, new List<string>()
+                            { HStation.Xhs.Flags.鎬荤,HStation.Xhs.Flags.鍑哄彛});
+            }
 
-
-            vm.StartH = 2;
+            if (outPipeHeadMonitor != null)
+            {
+                var outPipeHeadCalcuResult = _allCalcuResultVisualDict?.GetValue(outPipeHeadMonitor.Relation);
+                if (outPipeHeadCalcuResult != null)
+                {
+                    var outPipeHead = outPipeHeadCalcuResult.GetCalcuValue(outPipeHeadMonitor.PropName);
+                    if (outPipeHead.HasValue)
+                    {
+                        vm.PipeH = Math.Round(outPipeHead.Value, 2);
+                    }
+                }
+            }
 
             if (_hydroInfo.Pumps != null && _hydroInfo.Pumps.Count > 0)
             {
@@ -167,9 +241,6 @@
                         }
 
                     }
-
-                    vm.PipeQ = vm.Items.Sum(t => t.Q);
-                    vm.PipeH = vm.Items.Max(t => t.H);
                 }
             }
 
diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroFlagsHelper.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroFlagsHelper.cs
new file mode 100644
index 0000000..4f2e842
--- /dev/null
+++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/03-helper/HydroFlagsHelper.cs
@@ -0,0 +1,45 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Yw.WinFrmUI
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class HydroFlagsHelper
+    {
+        //
+        // 鎽樿:
+        //     鍒嗛殧绗�
+        public const string Separator = ",";
+
+        //
+        // 鎽樿:
+        //     杞寲涓哄瓧绗︿覆
+        public static string ToString(List<string> list)
+        {
+            if (list == null || !list.Any())
+            {
+                return string.Empty;
+            }
+            list = list.Select(x => x.Trim()).ToList();
+            return string.Join(",", list);
+        }
+
+        //
+        // 鎽樿:
+        //     杞寲涓哄垪琛�
+        public static List<string> ToList(string str)
+        {
+            if (string.IsNullOrEmpty(str))
+            {
+                return new List<string>();
+            }
+            var list = str.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
+            return list?.Select(x => x.Trim()).ToList();
+        }
+    }
+}
diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/01-set/SetHydroMonitorListCtrl.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/01-set/SetHydroMonitorListCtrl.cs
index a93fcee..ccf08cb 100644
--- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/01-set/SetHydroMonitorListCtrl.cs
+++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/12-monitor/01-set/SetHydroMonitorListCtrl.cs
@@ -85,7 +85,7 @@
             var list = _allBindingList?.Where(x => x.Checked).ToList();
             list?.ForEach(x =>
             {
-                x.Vmo.Flags = Yw.Untity.FlagsHelper.ToList(x.Flags);
+                x.Vmo.Flags = HydroFlagsHelper.ToList(x.Flags);
                 x.Vmo.Description = x.Description;
             });
             return list?.Select(x => x.Vmo).ToList();

--
Gitblit v1.9.3