Shuxia Ning
2024-11-11 1d22616b251b366b9c238aa5f00fd630a95b8d81
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
namespace HStation.WinFrmUI.PhartRelation
{
    public partial class PumpPerform2dMultiViewDlg : XtraForm
    {
        public PumpPerform2dMultiViewDlg()
        {
            InitializeComponent();
        }
 
 
        /// <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)
        {
            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<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 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<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();
                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<Yw.Geometry.Point2d> calc_pt_qh_list;
            List<Yw.Geometry.Point2d> calc_pt_qe_list;
            List<Yw.Geometry.Point2d> 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);
        }
 
        
 
    }
}