| | |
| | | using System.Data; |
| | | using Yw.Geometry; |
| | | using Yw.WinFrmUI.Phart; |
| | | |
| | | namespace HStation.WinFrmUI.PhartRelation |
| | | { |
| | |
| | | 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(); |
| | |
| | | |
| | | this.pumpParallelInfoCtrl1.SetDesignPointEvent += (q, h) => |
| | | { |
| | | this.pumpSerialParallelChart.SetDesignPt(new Point2d(q, h)); |
| | | this.pumpSerialParallelChart.SetEquipPt(new Point2d(q, h)); |
| | | }; |
| | | |
| | | this.pumpParallelInfoCtrl1.AddEvent += (vm) => |
| | |
| | | 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.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.Qh.MaxX; |
| | | var max_flow_head = vm.Qh.GetPointY(max_flow); |
| | | |
| | | var min_flow = vm.Qh.MinX; |
| | | var min_flow_head = vm.Qh.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); |
| | |
| | | Set(list); |
| | | this.barInfo.Caption = $"<b><color=red>{msg}</color></b>"; |
| | | return msg; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | 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); |
| | |
| | | vm_sp.Qe = qe; |
| | | vm_sp.Qp = 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; |
| | | |
| | | } |