namespace HStation.WinFrmUI.PhartRelation
{
public partial class PumpPerform2dMultiViewDlg : XtraForm
{
public PumpPerform2dMultiViewDlg()
{
InitializeComponent();
}
///
///
///
/// id,名称,转速比,颜色,...
///
///
public void SetBindingData(List> list, bool only_line, bool is_parallel = true)
{
if (list == null || !list.Any())
{
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.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)
{
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 pt_qh_list;
List pt_qe_list;
List 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 list, bool only_line, bool is_parallel = true)
{
if (list == null || !list.Any())
{
return;
}
var helper = new Yw.WinFrmUI.Phart.PumpParallelConnectionHelper();
foreach (var item in list)
{
var id = item.Id;
var name = item.Name;
var hz = item.SpeedRatio * 50;
var point_list_qh = item.PointsQH;
var point_list_qe = item.PointsQE;
var point_list_qp = item.PointsQP;
List 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();
pt_qe_list = point_list_qe?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
pt_qp_list = point_list_qp?.Select(x => new Yw.Geometry.Point2d(x.X, x.Y)).ToList();
Yw.Geometry.CubicSpline2d cubic_spline_qh = null, cubic_spline_qe = null, cubic_spline_qp = null;
cubic_spline_qh = new Yw.Geometry.CubicSpline2d(pt_qh_list);
if (pt_qe_list != null)
cubic_spline_qe = new Yw.Geometry.CubicSpline2d(pt_qe_list);
if (pt_qp_list != null)
cubic_spline_qp = new Yw.Geometry.CubicSpline2d(pt_qp_list);
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);
}
helper.Add(cubic_spline_qh, cubic_spline_qp);
}
var calc_bol = false;
var line_name = "";
List calc_pt_qh_list;
List calc_pt_qe_list;
List calc_pt_qp_list;
if (is_parallel)
{
line_name = "并联曲线";
calc_bol = helper.CalculateParallel(out calc_pt_qh_list, out calc_pt_qe_list, out calc_pt_qp_list);
}
else
{
line_name = "串联曲线";
calc_bol = helper.CalculateSeries(out calc_pt_qh_list, out calc_pt_qe_list, out calc_pt_qp_list);
}
if (!calc_bol)
return;
this.xtrPerform2dMultiChart1.Add("-1", line_name, System.Drawing.Color.Black, calc_pt_qh_list, calc_pt_qe_list, calc_pt_qp_list);
}
}
}