From 3af811d30c93995e2500bdd2f3795be77cc1a519 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期四, 19 十二月 2024 18:06:02 +0800
Subject: [PATCH] 水泵曲线修改

---
 WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/99-common/PumpParallelChartDlg.cs |   76 ++++++++++++++++++++++++-------------
 1 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/99-common/PumpParallelChartDlg.cs b/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/99-common/PumpParallelChartDlg.cs
index 38eaa63..42cf74d 100644
--- a/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/99-common/PumpParallelChartDlg.cs
+++ b/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/99-common/PumpParallelChartDlg.cs
@@ -7,9 +7,9 @@
         public PumpParallelChartDlg()
         {
             InitializeComponent();
-            this.Text = "骞惰仈鍒嗘瀽";
+            this.Text = "骞惰仈妯℃嫙";
             this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
-            this.pumpSerialParallelChart.LineVisible = true;
+
             this.pumpParallelInfoCtrl1.SetEvent += (id, qh, qe, qp) =>
             {
                 var list = this.pumpParallelInfoCtrl1.GetRunList();
@@ -17,12 +17,12 @@
             };
             this.pumpParallelInfoCtrl1.SetInfoEvent += (id, name, color) =>
             {
-                this.pumpSerialParallelChart.SetInfo(id, name, color);
+                this.pumpSerialParallelChart.Set(id, name, color);
             };
 
             this.pumpParallelInfoCtrl1.SetDesignPointEvent += (q, h) =>
             {
-                this.pumpSerialParallelChart.SetDesignPt(new Point2d(q, h));
+                this.pumpSerialParallelChart.SetDesignPoint(new Point2d(q, h));
             };
 
             this.pumpParallelInfoCtrl1.AddEvent += (vm) =>
@@ -37,7 +37,7 @@
                 SetParallel(list);
             };
 
-            this.pumpSerialParallelChart.OnCalcQueryPoint += (id, pt) =>
+            this.pumpSerialParallelChart.QueryPointChangedEvent += (id, pt) =>
             {
                 this.pumpParallelInfoCtrl1.SetQueryInfo(id, pt);
             };
@@ -72,7 +72,7 @@
             };
         }
 
-        private string _parallel_id = "parallel";  
+        private string _parallel_id = "parallel";
         public event Func<List<XhsSingleResultViewModel>, bool> ReloadDataEvent;
 
 
@@ -99,26 +99,26 @@
                 }
 
                 var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel();
-                vm.ID= x.ID;
+                vm.ID = x.ID;
                 vm.Id = x.ID.ToString();
                 vm.Name = x.Name;
                 vm.Code = x.Code;
                 vm.IsBp = x.IsBp;
-                vm.RatedSpeed = x.RatedSpeed;
-                vm.CurrentSpeed = x.CurrentSpeed;
+                vm.RatedN = x.RatedSpeed;
+                vm.CurrentN = x.CurrentSpeed;
                 vm.RunStatus = x.RunStatus;
                 vm.CurrentHz = x.CurrentHz;
                 var qh_pt_list = x.CurveQH.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
-                vm.Qh = new CubicSpline2d(qh_pt_list);
+                vm.CurveQH = new CubicSpline2d(qh_pt_list);
                 if (x.CurveQE != null && x.CurveQE.Any())
                 {
                     var qe_pt_list = x.CurveQE.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
-                    vm.Qe = new CubicSpline2d(qe_pt_list);
+                    vm.CurveQE = new CubicSpline2d(qe_pt_list);
                 }
                 if (x.CurveQP != null && x.CurveQP.Any())
                 {
                     var qp_pt_list = x.CurveQP.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
-                    vm.Qp = new CubicSpline2d(qp_pt_list);
+                    vm.CurveQP = new CubicSpline2d(qp_pt_list);
                 }
                 vm.CalcuQ = x.CalcuQ;
                 vm.CalcuH = x.CalcuH;
@@ -126,38 +126,42 @@
                 vm.Calc();
                 vm_list.Add(vm);
 
-            } 
+            }
             this.pumpParallelInfoCtrl1.SetBindingData(vm_list, null);
-            var run_list = this.pumpParallelInfoCtrl1.GetRunList();  
+            var run_list = this.pumpParallelInfoCtrl1.GetRunList();
             var msg = SetParallel(run_list);
             if (!string.IsNullOrEmpty(msg))
+            {
+                //TipFormHelper.ShowWarn(msg);
                 return msg;
+            }
             return string.Empty;
         }
-         
+
         private string SetParallel(List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel> list)
         {
-            this.pumpSerialParallelChart.Delete();
+            this.pumpSerialParallelChart.Clear();
             if (list == null || !list.Any())
             {
                 return "鏃犳暟鎹�!";
-            } 
+            }
             if (list.Count < 2)
             {
                 Set(list);
                 return "鏃犳硶璁$畻 骞惰仈鏇茬嚎!";
             }
+            var msg = string.Empty;
             var vm_parallel = CalcParallel(list);
             if (vm_parallel != null)
             {
                 list.Add(vm_parallel);
-                Set(list);   
-                return string.Empty;
             }
             else
             {
-                return "鏃犳硶璁$畻 骞惰仈鏇茬嚎!";
+                msg = "鏃犳硶璁$畻 骞惰仈鏇茬嚎!";
             }
+            Set(list);
+            return msg;
         }
 
 
@@ -184,20 +188,38 @@
                 return default;
             }
 
+            Yw.Geometry.CubicSpline2d qh = new Yw.Geometry.CubicSpline2d(calc_pt_qh_list);
+            Yw.Geometry.CubicSpline2d qe = new Yw.Geometry.CubicSpline2d(calc_pt_qe_list);
+            Yw.Geometry.CubicSpline2d qp = new Yw.Geometry.CubicSpline2d(calc_pt_qp_list);
+
+            var total_flow = list.Sum(x => x.CurveQH.MaxX);
+            var parallel_flow = calc_pt_qh_list.Max(x => x.X);
+            if (total_flow > parallel_flow * 1.05)
+            {
+                var ex_ratio = total_flow / parallel_flow;
+                if (qh != null)
+                    qh.MaxX = qh.MaxX * ex_ratio;
+                if (qe != null)
+                    qe.MaxX = qe.MaxX * ex_ratio;
+                if (qp != null)
+                    qp.MaxX = qp.MaxX * ex_ratio;
+            }
+
+
+
             var vm_sp = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel();
             vm_sp.Id = _parallel_id;
             vm_sp.Name = line_name;
-            vm_sp.Qh = new Yw.Geometry.CubicSpline2d(calc_pt_qh_list);
-            vm_sp.Qe = new Yw.Geometry.CubicSpline2d(calc_pt_qe_list);
-            vm_sp.Qp = new Yw.Geometry.CubicSpline2d(calc_pt_qp_list);
-            vm_sp.QhCalc = vm_sp.Qh;
-            vm_sp.QeCalc = vm_sp.Qe;
-            vm_sp.QpCalc = vm_sp.Qp;
+            vm_sp.CurveQH = qh;
+            vm_sp.CurveQE = qe;
+            vm_sp.CurveQP = qp;
+            vm_sp.QhCalc = vm_sp.CurveQH;
+            vm_sp.QeCalc = vm_sp.CurveQE;
+            vm_sp.QpCalc = vm_sp.CurveQP;
             vm_sp.Color = Color.Black;
             vm_sp.IsBp = true;
             vm_sp.IsDefault = true;
 
-            var pt_list = vm_sp.Qp.GetPointList(12);
             return vm_sp;
 
         }

--
Gitblit v1.9.3