From 00f75453f7c1d91e898beb830222f37db6058168 Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期一, 14 十月 2024 13:29:00 +0800
Subject: [PATCH] 1

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs |   47 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 35 insertions(+), 12 deletions(-)

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 1e4b136..454f765 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
@@ -1,7 +1,4 @@
 锘縢lobal using Yw.EPAnet;
-using DevExpress.XtraMap.Drawing;
-using NetTaste;
-using Org.BouncyCastle.Crypto.Engines;
 
 namespace HStation.WinFrmUI
 {
@@ -499,11 +496,13 @@
             {
                 return;
             }
+
             if (_parter == null)
             {
                 this.xhsProjectSimulationPropertyCtrl1.SelectParter(null);
                 return;
             }
+
             this.xhsProjectSimulationPropertyCtrl1.SelectParter(_parter.Code);
             if (_calcuResult != null)
             {
@@ -540,6 +539,7 @@
                     }
                 }
             }
+
         }
 
         #endregion
@@ -572,25 +572,48 @@
                 return;
             }
             var pumps = _hydroInfo.Pumps;
+            var curve_list = _hydroInfo.Curves;
+            if (curve_list == null || !curve_list.Any())
+            {
+                return;
+            }
             var vmList = new List<Yw.WinFrmUI.Phart.PumpSerialParallelViewModel>();
             foreach (var x in pumps)
             {
+                if (!x.RatedN.HasValue)
+                {
+                    continue;
+                }
+                var qh = curve_list.Find(t => t.Code == x.CurveQH)?.CurveData;
+                var qe = curve_list.Find(t => t.Code == x.CurveQE)?.CurveData;
+                var qp = curve_list.Find(t => t.Code == x.CurveQP)?.CurveData;
+
+                if (qh == null)
+                {
+                    continue;
+                }
+
+                var rated_speed = x.RatedN.Value;
+                var speed_ratio = x.SpeedRatio ?? 1;
+
+                var qh_pt_list = qh.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
+                var qe_pt_list = qe?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
+                var qp_pt_list = qp?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
+                 
                 var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel();
                 vm.Id = x.Code;
                 vm.Name = x.Code;
                 //vm.IsBp = ;
-                //vm.RatedSpeed = 590;
-                //vm.CurrentSpeed = 590;
-                //vm.CurrentHz = 50;
-                var PointsQH = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQH)?.CurveData?.Select(z => new Yw.Geometry.Point2d() { X = z.X, Y = z.Y }).ToList();
-                var PointsQP = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQP)?.CurveData?.Select(z => new Yw.Geometry.Point2d { X = z.X, Y = z.Y }).ToList();
-                var PointsQE = _hydroInfo.Curves?.Find(t => t.Code == x.CurveQE)?.CurveData?.Select(z => new Yw.Geometry.Point2d { X = z.X, Y = z.Y }).ToList();
+                vm.RatedSpeed = rated_speed;
+                vm.CurrentSpeed = Math.Round(rated_speed * speed_ratio);
+                vm.CurrentHz = Math.Round(vm.CurrentSpeed / vm.RatedSpeed * 50, 1);
 
-                vm.Qh = new Yw.Geometry.CubicSpline2d(PointsQH);
-                vm.Qe = new Yw.Geometry.CubicSpline2d(PointsQE);
-                vm.Qp = new Yw.Geometry.CubicSpline2d(PointsQP);
+                vm.Qh = new Yw.Geometry.CubicSpline2d(qh_pt_list);
+                vm.Qe = new Yw.Geometry.CubicSpline2d(qe_pt_list);
+                vm.Qp = new Yw.Geometry.CubicSpline2d(qp_pt_list);
                 vmList.Add(vm);
             }
+
             var dlg = new HStation.WinFrmUI.PhartRelation.PumpSerialParallelChartDlg();
             dlg.SetBindingData(vmList, null, true);
             dlg.ShowDialog();

--
Gitblit v1.9.3