tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
using Eventech.Model;
using System;
using System.Linq;
using System.Windows.Forms;
 
 
namespace TProduct.WinFrmUI.TPump
{
    /// <summary>
    /// 性能测试
    /// </summary>
    public partial class FeatTestViewMainPage : DocumentPage
    {
        //图表控件
        private void IntialMainChart()
        {
            if (_chartMainCtrl == null)
            {
                //工具条
                this._chartBarCtrl = new TProduct.WinFrmUI.TPump.ChartFeatTestBarCtrl();
                this._chartBarCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
                this._chartBarCtrl.Location = new System.Drawing.Point(3, 3);
                this._chartBarCtrl.Name = "ChartFeatTestBarCtrl";
                this._chartBarCtrl.Size = new System.Drawing.Size(961, 25);
                this._chartBarCtrl.TabIndex = 0;
                this.tableLayoutPanel1.Controls.Add(this._chartBarCtrl, 0, 0);
 
 
                //图表
                this._chartMainCtrl = new ChartLxpFeatCurveCtrl();
                this._chartMainCtrl.Name = "ChartFeatTestMainCtrl";
                this._chartMainCtrl.Dock = DockStyle.Fill;
 
                this._chartMainCtrl.OnChangeCoordinate += (coord) =>
                {
                    if (this._featTestItem.CoordinateParas != coord.ToDsString() && this._featTestItem.TestType == Model.eTestType.FeatTest)
                    {
                        this._featTestItem.CoordinateParas = coord.ToDsString();
                        new BLL.TestProjectItem().UpdateCoordinateParas(this._featTestItem.ItemID, this._featTestItem.CoordinateParas);
                        if (this.OnChangeFeatTestInfo != null)
                        {
                            this.OnChangeFeatTestInfo(this._featTestItem);
                        }
                    }
                };
                this.tableLayoutPanel1.Controls.Add(this._chartMainCtrl, 0, 1);
                this._chartBarCtrl.cmbSetAction += (cmd, tag) =>
                {
                    if (cmd == "显示效率线")
                    {
                        this._chartMainCtrl.SetEtaDisp(Convert.ToBoolean(tag));
                    }
                    if (cmd == "显示功率线")
                    {
                        this._chartMainCtrl.SetPowerDisp(Convert.ToBoolean(tag));
                    }
                    if (cmd == "设置坐标")
                    {
                        this.SetCoordinateByDlg();
                    }
                    if (cmd == "显示判定点")
                    {
                        this._chartMainCtrl.SetJudgePointDisp(Convert.ToBoolean(tag));
                    }
                    if (cmd == "显示装置曲线")
                    {
                        var isDisp = Convert.ToBoolean(tag);
                        this._chartMainCtrl.SetEquipCurveDisp(isDisp);
                    }
                    if (cmd == "装置曲线参数")
                    {
                        Eventech.Model.EquipCurveParas  equipCurveParas = this._chartMainCtrl.EquipCurveParas;
 
                        TProduct.WinFrmUI.TPump.SetEquipmentCurveDlg theDlg = new TProduct.WinFrmUI.TPump.SetEquipmentCurveDlg();
                        if(equipCurveParas == null)
                        {
                            Eventech.Model.FeatPoint sectPoint = new FeatPoint(this._ratedParas.Q, this._ratedParas.H);
                            theDlg.SetOtherPoint(sectPoint);
                        }
                        else
                        {
                            theDlg.SetEquipmentCurve(equipCurveParas);
                        } 
                        if (theDlg.ShowDialog() == DialogResult.OK)
                        {
                            this._chartMainCtrl.SetEquipCurveDisp(true);
                            this._chartMainCtrl.SetEquipCurve(theDlg.GetEquipmentCurve());
                        } 
                    }
                    if (cmd == "查询参数")
                    {
                        this._chartMainCtrl.SetQueryLineDisp1(Convert.ToBoolean(tag));
                    }
                    if (cmd == "曲线方程")
                    {
                        this._chartMainCtrl.ShowCurveEquation();
                    }
                };
            }
            _chartMainCtrl.ClearCoordinate();
            _chartMainCtrl.SetRatedParas(this._currentPump, this._ratedParas, this._testJudgeItems);
            if (_npshTestResults != null && _npshTestResults.Count > 0)
            {
                this._chartMainCtrl.SetNpshPoints(_npshTestResults);
            }
 
            if (!string.IsNullOrEmpty(_featTestItem.CoordinateParas))
            {
                _chartMainCtrl.SetCoordinateParas(new Eventech.Model.LxpCoordinateParas(_featTestItem.CoordinateParas), true);
            }
 
 
            _chartMainCtrl.SetRecordPoint(this._allRecords);
            _chartMainCtrl.SetEtaDisp(TProduct.UserSetting.Setting.PumpTest.IsDispCurveQE);
            _chartMainCtrl.SetPowerDisp(TProduct.UserSetting.Setting.PumpTest.IsDispCurveQP);
 
 
            if (this._featTestItem.ItemParas != null &&
                this._featTestItem.ItemParas.IsEntendZeroH)
            {
                ExtendZeroH();
            }
        }
 
        private void bbi延长到零扬程_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ExtendZeroH();
        }
        private void ExtendZeroH()
        {
            if (_chartMainCtrl == null || _featTestItem == null)
            {
                return;
            }
            var curveExpressQH = _chartMainCtrl.CurveExpressQH;
            if (curveExpressQH == null)
                return;
 
            var ex_curveExpressQH = new Eventech.Model.CurveExpress(curveExpressQH);
            ex_curveExpressQH.RangeMax = ex_curveExpressQH.RangeMax * 2.5;
            var x_pts = Eventech.Common.FitCurveHelper.GetInterPointX(ex_curveExpressQH, 0);
            if (x_pts == null || x_pts.Count() == 0)
            {
                MessageBox.Show("曲线长度不够, 无法延长到零扬程处");
                return;
            }
            var zero_head_flow = x_pts.First().X;
            // ex_curveExpressQH.RangeMin = curveExpressQH.RangeMax;
            ex_curveExpressQH.RangeMax = zero_head_flow;
            var points = Eventech.Common.FitCurveHelper.GetFitPointsByRange(ex_curveExpressQH,
                curveExpressQH.RangeMax, zero_head_flow, 10);
            _chartMainCtrl.SetExtendCurveInfoQH(points);
 
            if (this._featTestItem.ItemParas == null)
            {
                this._featTestItem.ItemParas = new Model.TestProjectItemParas();
                this._featTestItem.ItemParas.IsEntendZeroH = true;
                this._featTestItem.ItemParas.FlowInZeroH = zero_head_flow;
                new BLL.TestProjectItem().UpdateItemParas(this._featTestItem.ItemID, this._featTestItem.ItemParas.ToDsString());
            }
            else if (!this._featTestItem.ItemParas.IsEntendZeroH)
            {
                this._featTestItem.ItemParas.IsEntendZeroH = true;
                this._featTestItem.ItemParas.FlowInZeroH = zero_head_flow;
                new BLL.TestProjectItem().UpdateItemParas(this._featTestItem.ItemID, this._featTestItem.ItemParas.ToDsString());
            }
            else if (Math.Abs(
                this._featTestItem.ItemParas.FlowInZeroH - zero_head_flow) > 0.01)
            {
                this._featTestItem.ItemParas.IsEntendZeroH = true;
                this._featTestItem.ItemParas.FlowInZeroH = zero_head_flow;
                new BLL.TestProjectItem().UpdateItemParas(this._featTestItem.ItemID, this._featTestItem.ItemParas.ToDsString());
 
            }
            //_chartMainCtrl.SetExtendCurveInfoText(string.Format("零扬程时流量:{0}",Math.Round(points.Last().X,2)));
            _chartMainCtrl.Invalidate();
        }
 
        private void SetCoordinateByDlg()
        {
            var _coordinateParas = _chartMainCtrl.GetCoordinateParas();
            SetLxpCoordinateDlg theSetDlg = new SetLxpCoordinateDlg();
            theSetDlg.IsHaveNpsh(_chartMainCtrl.IsHaveCurve());
            theSetDlg.SetCoordinate(_coordinateParas,
                this._chartMainCtrl.FlowUnit,
                this._chartMainCtrl.HeadUnit,
                this._chartMainCtrl.PowerUnit);
            theSetDlg.OnChangedCoord += ChangedCoordHandler;
            theSetDlg.ShowDialog();
        }
 
        private void ChangedCoordHandler(object sender, LxpCoordEventArgs e)
        {
            var coord = e.GetCoordParas();
            _chartMainCtrl.SetCoordinateParas(coord, true);
            _chartMainCtrl.UpdateChart(false);
            if (_chartMainCtrl.OnChangeCoordinate != null)
            {
                _chartMainCtrl.OnChangeCoordinate.Invoke(coord);
            }
        }
 
 
    }
}