From 6f8d3598e6b3777f45d0a8c1551a845e70d37fb6 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 20 十二月 2024 15:51:05 +0800 Subject: [PATCH] 导入修改 --- WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/PumpParallelAnalyDlg.cs | 115 +++++++++++++++++++++++++++++++++------------------------ 1 files changed, 66 insertions(+), 49 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/PumpParallelAnalyDlg.cs b/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/PumpParallelAnalyDlg.cs index 8949c90..6f1e05b 100644 --- a/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/PumpParallelAnalyDlg.cs +++ b/WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/PumpParallelAnalyDlg.cs @@ -1,5 +1,6 @@ 锘縰sing System.Data; using Yw.Geometry; +using Yw.WinFrmUI.Phart; namespace HStation.WinFrmUI.PhartRelation { @@ -8,8 +9,8 @@ public PumpParallelAnalyDlg() { InitializeComponent(); - this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; - this.pumpSerialParallelChart.LineVisible = true; + this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; + this.pumpSerialParallelChart.SetQeVisible(false); this.pumpParallelInfoCtrl1.SetEvent += (id, qh, qe, qp) => { var list = this.pumpParallelInfoCtrl1.GetRunList(); @@ -17,12 +18,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 +38,7 @@ SetParallel(list); }; - this.pumpSerialParallelChart.OnCalcQueryPoint += (id, pt) => + this.pumpSerialParallelChart.QueryPointChangedEvent += (id, pt) => { this.pumpParallelInfoCtrl1.SetQueryInfo(id, pt); }; @@ -46,6 +47,7 @@ var list = this.pumpParallelInfoCtrl1.GetRunList(); SetParallel(list); }; + this.pumpParallelInfoCtrl1.SaveEvent += () => { var run_list = this.pumpParallelInfoCtrl1.GetRunList(); @@ -74,7 +76,7 @@ private string _parallel_id = "parallel"; public event Func<List<XhsSingleResultViewModel>, bool> ReloadDataEvent; - + /// <summary> /// 璁剧疆 @@ -104,29 +106,67 @@ 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; + vm.CalcuH = x.CalcuH; vm.Color = GetRandomColor(i); vm.Calc(); vm_list.Add(vm); + if (!x.RunStatus) + continue; + + if (!x.CalcuQ.HasValue || !x.CalcuH.HasValue) + continue; + var calc_flow = x.CalcuQ.Value; + var calc_head = x.CalcuH.Value; + + var max_flow = vm.CurveQH.MaxX; + var max_flow_head = vm.CurveQH.GetPointY(max_flow); + + var min_flow = vm.CurveQH.MinX; + var min_flow_head = vm.CurveQH.GetPointY(min_flow); + + if (max_flow_head < calc_head && min_flow_head > calc_head) + continue; + + var extend_ratio = 1m; + var extend_success = false; + for (decimal num = 0.01m; num <= 5; num += 0.01m) + { + extend_ratio += num; + var ex_pt_list = qh_pt_list.GetExpandFitPointList((double)extend_ratio); + var ex_x_array = ex_pt_list.GetInterPointsX(calc_head); + if (ex_x_array != null && ex_x_array.Any()) + { + extend_success = true; + vm.ExtendRatio = Math.Round((double)extend_ratio * 100, 1); + vm.Calc(); + break; + } + } + if (!extend_success) + { + + } } + this.pumpParallelInfoCtrl1.SetBindingData(vm_list, null); var run_list = this.pumpParallelInfoCtrl1.GetRunList(); var msg = SetParallel(run_list); @@ -140,7 +180,7 @@ private string SetParallel(List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel> list) { var msg = "骞惰仈鎴愬姛"; - this.pumpSerialParallelChart.Delete(); + this.pumpSerialParallelChart.Clear(); if (list == null || !list.Any()) { msg = "鏃犳暟鎹�"; @@ -168,6 +208,7 @@ Set(list); this.barInfo.Caption = $"<b><color=red>{msg}</color></b>"; return msg; + } @@ -193,6 +234,8 @@ { return default; } + double total_flow = list.Sum(x => x.CalcuQ ?? 0); + double total_head = list.Average(x => x.CalcuH ?? 0); var qh = new Yw.Geometry.CubicSpline2d(calc_pt_qh_list); var qe = new Yw.Geometry.CubicSpline2d(calc_pt_qe_list); @@ -202,47 +245,21 @@ var vm_sp = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel(); vm_sp.Id = _parallel_id; vm_sp.Name = line_name; - vm_sp.Qh = qh; - vm_sp.Qe = qe; - vm_sp.Qp = qp; + vm_sp.CurveQH = qh; + vm_sp.CurveQE = qe; + vm_sp.CurveQP = qp; + + vm_sp.QhCalc = qh; + vm_sp.QeCalc = qe; + vm_sp.QpCalc = qp; + + vm_sp.CalcuH = total_head; + vm_sp.CalcuQ = total_flow; vm_sp.Color = Color.Black; vm_sp.IsBp = true; vm_sp.IsDefault = true; - - var total_flow = list.Sum(x => x.Qh.MaxX); - var parallel_flow = calc_pt_qh_list.Max(x => x.X); - double extend_ratio = 1; - if (total_flow > parallel_flow * 1.05) - { - extend_ratio = total_flow / parallel_flow; - extend_ratio = Math.Round(extend_ratio, 1); - if (qh != null) - { - var ex_pt_list = qh.GetPointList(); - var ex_qh = new Yw.Geometry.CubicSpline2d(ex_pt_list); - ex_qh.MaxX = ex_qh.MaxX * extend_ratio; - vm_sp.QhCalc = ex_qh; - } - - if (qe != null) - { - var ex_pt_list = qe.GetPointList(); - var ex_qe = new Yw.Geometry.CubicSpline2d(ex_pt_list); - ex_qe.MaxX = ex_qe.MaxX * extend_ratio; - vm_sp.QeCalc = ex_qe; - } - if (qp != null) - { - var ex_pt_list = qp.GetPointList(); - var ex_qp = new Yw.Geometry.CubicSpline2d(ex_pt_list); - ex_qp.MaxX = ex_qp.MaxX * extend_ratio; - vm_sp.QpCalc = ex_qp; - } - } - vm_sp.ExtendFlow = qh.MaxX; - vm_sp.ExtendRatio = extend_ratio; return vm_sp; } -- Gitblit v1.9.3