| | |
| | | namespace HStation.WinFrmUI.PhartRelation |
| | | using Yw.Geometry; |
| | | |
| | | namespace HStation.WinFrmUI.PhartRelation |
| | | { |
| | | public partial class PumpPerform2dMultiViewDlg : XtraForm |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="list">id,名称,转速比,颜色,...</param> |
| | | /// <param name="only_line"></param> |
| | | /// <param name="is_parallel"></param> |
| | | public void SetBindingData(List<Tuple<string, string, double, Color, Yw.Pump.CurveQH, Yw.Pump.CurveQE, Yw.Pump.CurveQP>> list, bool only_line, bool is_parallel = true) |
| | | |
| | | public string SetBindingData(List<Perform2dMultiViewModel> list, PerformPoint2dViewModel design_pt, bool only_line, bool is_parallel = true) |
| | | { |
| | | if (list == null || !list.Any()) |
| | | { |
| | | return; |
| | | return "数据为空!"; |
| | | } |
| | | var helper = new Yw.WinFrmUI.Phart.PumpParallelConnectionHelper(); |
| | | foreach (var item in list) |
| | | { |
| | | var id = item.Item1; |
| | | var name = item.Item2; |
| | | var hz = item.Item3 * 50; |
| | | var color = item.Item4; |
| | | var qh = item.Item5; |
| | | var qe = item.Item6; |
| | | var qp = item.Item7; |
| | | |
| | | Yw.Geometry.CubicSpline2d cubic_spline_qh = null, cubic_spline_qe = null, cubic_spline_qp = null; |
| | | cubic_spline_qh = new Yw.Geometry.CubicSpline2d(qh.FeatCurve.GetPointList()); |
| | | if (qe != null) |
| | | cubic_spline_qe = new Yw.Geometry.CubicSpline2d(qe.FeatCurve.GetPointList()); |
| | | if (qp != null) |
| | | cubic_spline_qp = new Yw.Geometry.CubicSpline2d(qp.FeatCurve.GetPointList()); |
| | | |
| | | cubic_spline_qh = Yw.WinFrmUI.Phart.PumpPerform2dCalcHelper.CalculateSimilarQH(cubic_spline_qh, 50, hz); |
| | | cubic_spline_qe = Yw.WinFrmUI.Phart.PumpPerform2dCalcHelper.CalculateSimilarQE(cubic_spline_qe, 50, hz); |
| | | cubic_spline_qp = Yw.WinFrmUI.Phart.PumpPerform2dCalcHelper.CalculateSimilarQP(cubic_spline_qp, 50, hz); |
| | | |
| | | if (!only_line) |
| | | { |
| | | this.xtrPerform2dMultiChart1.Add(id, name, color, cubic_spline_qh, cubic_spline_qe, cubic_spline_qp); |
| | | } |
| | | |
| | | helper.Add(cubic_spline_qh, cubic_spline_qp); |
| | | } |
| | | |
| | | var calc_bol = false; |
| | | var line_name = ""; |
| | | List<Yw.Geometry.Point2d> pt_qh_list; |
| | | List<Yw.Geometry.Point2d> pt_qe_list; |
| | | List<Yw.Geometry.Point2d> pt_qp_list; |
| | | if (is_parallel) |
| | | { |
| | | line_name = "并联曲线"; |
| | | calc_bol = helper.CalculateParallel(out pt_qh_list, out pt_qe_list, out pt_qp_list); |
| | | } |
| | | else |
| | | { |
| | | line_name = "串联曲线"; |
| | | calc_bol = helper.CalculateSeries(out pt_qh_list, out pt_qe_list, out pt_qp_list); |
| | | } |
| | | |
| | | if (!calc_bol) |
| | | return; |
| | | |
| | | this.xtrPerform2dMultiChart1.Add("-1", line_name, System.Drawing.Color.Black, pt_qh_list, pt_qe_list, pt_qp_list); |
| | | } |
| | | |
| | | |
| | | |
| | | public void SetBindingData(List<Perform2dMultiViewModel> list, bool only_line, bool is_parallel = true) |
| | | { |
| | | if (list == null || !list.Any()) |
| | | { |
| | | return; |
| | | } |
| | | var vm_list = new List<Yw.WinFrmUI.Phart.PumpSerialParallelViewModel>(); |
| | | var helper = new Yw.WinFrmUI.Phart.PumpParallelConnectionHelper(); |
| | | foreach (var item in list) |
| | | { |
| | |
| | | var point_list_qh = item.PointsQH; |
| | | var point_list_qe = item.PointsQE; |
| | | var point_list_qp = item.PointsQP; |
| | | |
| | | if (point_list_qh == null) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | List<Yw.Geometry.Point2d> pt_qh_list = null, pt_qe_list = null, pt_qp_list = null; |
| | | pt_qh_list = point_list_qh?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList(); |
| | |
| | | if (pt_qp_list != null) |
| | | cubic_spline_qp = new Yw.Geometry.CubicSpline2d(pt_qp_list); |
| | | |
| | | cubic_spline_qh = Yw.WinFrmUI.Phart.PumpPerform2dCalcHelper.CalculateSimilarQH(cubic_spline_qh, 50, hz); |
| | | cubic_spline_qe = Yw.WinFrmUI.Phart.PumpPerform2dCalcHelper.CalculateSimilarQE(cubic_spline_qe, 50, hz); |
| | | cubic_spline_qp = Yw.WinFrmUI.Phart.PumpPerform2dCalcHelper.CalculateSimilarQP(cubic_spline_qp, 50, hz); |
| | | cubic_spline_qh = Yw.WinFrmUI.Phart.PumpCalcHelper.CalculateSimilarQH(cubic_spline_qh, 50, hz); |
| | | cubic_spline_qe = Yw.WinFrmUI.Phart.PumpCalcHelper.CalculateSimilarQE(cubic_spline_qe, 50, hz); |
| | | cubic_spline_qp = Yw.WinFrmUI.Phart.PumpCalcHelper.CalculateSimilarQP(cubic_spline_qp, 50, hz); |
| | | |
| | | if (!only_line) |
| | | { |
| | | var color = ColorHelper.GetRandomColor(); |
| | | this.xtrPerform2dMultiChart1.Add(id, name, color, cubic_spline_qh, cubic_spline_qe, cubic_spline_qp); |
| | | var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel(); |
| | | vm.Id = id; |
| | | vm.Name = name; |
| | | vm.Qh = cubic_spline_qh; |
| | | vm.Qe = cubic_spline_qe; |
| | | vm.Qp = cubic_spline_qp; |
| | | vm_list.Add(vm); |
| | | } |
| | | |
| | | helper.Add(cubic_spline_qh, cubic_spline_qp); |
| | |
| | | } |
| | | |
| | | if (!calc_bol) |
| | | return; |
| | | { |
| | | return "无法计算串并联曲线!"; |
| | | } |
| | | var min_q = calc_pt_qh_list.Min(x => x.X); |
| | | var max_q = calc_pt_qh_list.Max(x => x.X); |
| | | |
| | | this.xtrPerform2dMultiChart1.Add("-1", line_name, System.Drawing.Color.Black, calc_pt_qh_list, calc_pt_qe_list, calc_pt_qp_list); |
| | | var min_h = calc_pt_qh_list.Min(x => x.Y); |
| | | var max_h = calc_pt_qh_list.Max(x => x.Y); |
| | | if (design_pt != null) |
| | | { |
| | | if (design_pt.X > max_q || design_pt.X < min_q) |
| | | { |
| | | return "设计流量无效!"; |
| | | } |
| | | |
| | | if (design_pt.Y > max_h || design_pt.Y < min_h) |
| | | { |
| | | return "设计扬程无效!"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var design_q = calc_pt_qh_list.Max(x => x.X) / 2; |
| | | var design_h = calc_pt_qh_list.GetInterPointsY(design_q).Last(); |
| | | design_pt = new PerformPoint2dViewModel(design_q, design_h); |
| | | } |
| | | |
| | | |
| | | var vm_sp = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel(); |
| | | vm_sp.Id = "-1"; |
| | | 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.IsBp = true; |
| | | vm_list.Add(vm_sp); |
| | | this.xtrPerform2dMultiChart1.Add(vm_sp, new Yw.Geometry.Point2d(design_pt.X, design_pt.Y)); |
| | | |
| | | return string.Empty; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |