tx
2025-04-10 2538101febc78f525945da72c7cdcb2589f9e6ea
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
using System;
using System.Collections.Generic;
using System.Linq;
using TProduct.Model;
 
namespace TProduct.WinFrmUI.TPump
{
    internal class FeatTestHelper
    {
        //
        private List<TProduct.Model.WorkBenchMonitorPoint> _allMonitorList = null;
 
        protected long _testItemID = 0;
        protected TProduct.Model.TestProjectItemView _testItem = null;
        protected TProduct.Model.TestProjectParas _testParas = null;
        protected bool _isTemperatureTrn = false; //是否温度换算
        protected double _atmospherePressure = 101.3;//大气压
        protected double _elevation = 100;//海拔高度
        protected eRecordType _recordType = eRecordType.Instrument;
        protected TProduct.Model.ePowerTestMethod _powerTestMethod = Model.ePowerTestMethod.功率;
        protected bool _isInlet清水池 = false;
 
        internal void SetTestInfo(
            TProduct.Model.WorkBenchBase bench,
            TProduct.Model.TestProjectItemView testItem,
            List<TProduct.Model.WorkBenchMonitorPoint> allMonitorList)
        {
            if (bench == null || testItem == null)
                return;
            this._testItemID = testItem.ItemID;
            this._testItem = testItem;
            this._allMonitorList = allMonitorList;
 
            this._testParas = testItem.ProjectParas;
            if (this._testParas != null)
            {
                this._isTemperatureTrn = this._testParas.IsTemperatureTrn;
            }
 
            var method = new Model.WorkBenchMethod4Pump(bench.TestMethod);
            if (method.Power != null)
            {
                _powerTestMethod = method.Power.Value;
                _isInlet清水池 = method.InletIsUseWaterLevel == 1 ? true : false;
            }
 
            var bench_setting = new WorkBenchSetting4Pump(bench.TestSetting);
            this._elevation = bench_setting.Elevation;
            this._atmospherePressure = bench_setting.AtmosphericPressure;
        }
 
        private double _motorRatedEta = 100;
        private Eventech.Model.CurveExpress _motorEatCurve = null;
        public void SetMotorInfo(double eta, Eventech.Model.CurveExpress eatCurve)
        {
            if (eta <= 1)
                return;
 
            this._motorRatedEta = eta;
            this._motorEatCurve = eatCurve;
        }
 
        protected double _pumpRatedN = 2900;
        protected TProduct.Model.RatedParas4Pump _pumpRatedParas = null;
        protected TProduct.Model.eSpeedSimuMethod _speedSimuMethod = eSpeedSimuMethod.转速换算;//是否转速换算到额定转速
 
        public void SetPumpInfo(TProduct.Model.ProductSeries series, TProduct.Model.ProductMainExPump pump)
        //public void SetPumpInfo(double ratedN, TProduct.Model.RatedParas4Pump ratedParas)
        {
            if (pump == null || pump.Ratedn == null)
            {
                _speedSimuMethod = eSpeedSimuMethod.不换算; return;
            }
            if (string.IsNullOrEmpty(pump.RatedParas))
            {
                _speedSimuMethod = eSpeedSimuMethod.不换算; return;
            }
            this._pumpRatedN = pump.Ratedn.Value;
            this._pumpRatedParas = TProduct.Model.RatedParas4Pump.ToModel(pump.RatedParas);
 
            if (series != null && series.Paras != null)
            {
                _speedSimuMethod = series.Paras.SpeedSimuMethod;
            }
            //_ratedN = ratedN;
            //_ratedParas = ratedParas;
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="valueList"></param>
        /// <param name="degree"></param>
        /// <param name="error_info"></param>
        /// <returns></returns>
        public Model.PumpFeatTestRecordViewModel NewTestRecord(
            List<TProduct.Model.MonitorPointValuePure> valueList,
            double degree,
            out string error_info)
        {
            error_info = null;
            if (_allMonitorList == null || valueList == null)
            {
                error_info = "请输入测点监控值";
                return null;
            }
 
 
            #region 泵性能
            //测量转速 (最先获取,因为轴功率可能用到)
            var moinitor_speed = this._allMonitorList.Find(x => x.MonitorType == Model.eMonitorType.转速);
            if (moinitor_speed == null)
            {
                error_info = "请输入电机转速测点?";
                return null;
            }
 
            double rMeasureSpeed = this._pumpRatedN;
            var moinitor_speed_value = valueList.Find(x => x.ID == moinitor_speed.ID);
            if (moinitor_speed_value == null || moinitor_speed_value.Value == null)
            {
                if (moinitor_speed.SourceType != eMonitorPointSourceType.额定参数)
                {
                    error_info = "请输入电机转速?";
                    return null;
                }
            }
            else
            {
                rMeasureSpeed = moinitor_speed_value.Value.Value;
            }
 
 
            //测量流量
            var moinitor_flows = this._allMonitorList.Where(x => x.MonitorType == Model.eMonitorType.流量);
            if (moinitor_flows == null || moinitor_flows.Count() == 0)
            {
                error_info = "请输入流量测点?";
                return null;
            }
 
            double total_flow_m3h = 0;
            if (moinitor_flows.Count() == 1)
            {
                var moinitor_flow = moinitor_flows.First();
                var moinitor_flow_value = valueList.Find(x => x.ID == moinitor_flow.ID);
                if (moinitor_flow_value == null || moinitor_flow_value.Value == null)
                {
                    error_info = "请输入流量仪器值?";
                    return null;
                }
 
                total_flow_m3h = moinitor_flow_value.Value.Value;
            }
            else
            {//多个 数据需要合并
                total_flow_m3h = 0;
                foreach (var moinitor_flow in moinitor_flows)
                {
                    var moinitor_flow_value = valueList.Find(x => x.ID == moinitor_flow.ID);
                    if (moinitor_flow_value == null || moinitor_flow_value.Value == null)
                    {
                        continue;
                    }
                    total_flow_m3h = total_flow_m3h + moinitor_flow_value.Value.Value * moinitor_flow.SumCalcCoeff;
                }
            }
 
 
 
 
            bool isZeroQ = false;
            if (this._pumpRatedParas == null)
            {
                if (total_flow_m3h < 0.1)
                {
                    total_flow_m3h = 0;
                    isZeroQ = true;
                }
            }
            else
            {
                if (total_flow_m3h < this._pumpRatedParas.Q / 50)
                {
                    total_flow_m3h = 0;
                    isZeroQ = true;
                }
            }
 
 
            //电机功率
            double total_axis_power = 0;
            if (_powerTestMethod == ePowerTestMethod.扭矩)
            {
                var moinitor_扭矩 = this._allMonitorList.Find(x => x.MonitorType == eMonitorType.扭矩);
                if (moinitor_扭矩 == null)
                {
                    error_info = "请输入扭矩测点?";
                    return null;
                }
                var moinitor_扭矩_value = valueList.Find(x => x.ID == moinitor_扭矩.ID);
                if (moinitor_扭矩_value == null || moinitor_扭矩_value.Value == null)
                {
                    error_info = "请输入扭矩?";
                    return null;
                }
                double r扭矩 = moinitor_扭矩_value.Value.Value;
                if (r扭矩 <= 0.001)
                {
                    error_info = "请输入扭矩?";
                    return null;
                }
                total_axis_power = Math.Round(r扭矩 * rMeasureSpeed / 9550, 3);
            }
            else
            {
                var moinitor_power = this._allMonitorList.Find(x =>
                x.MonitorType == eMonitorType.功率
                && (string.IsNullOrEmpty(x.Property) ||
                x.Property == TProduct.Model.MonitorTypeProperty.总));
                if (moinitor_power == null)
                {
                    error_info = "请输入电机功率测点?";
                    return null;
                }
                var moinitor_power_value = valueList.Find(x => x.ID == moinitor_power.ID);
                if (moinitor_power_value == null || moinitor_power_value.Value == null)
                {
                    error_info = "请输入电机功率?";
                    return null;
                }
                double rMeasurePower = moinitor_power_value.Value.Value;
                if (rMeasurePower <= 0.0001)
                {
                    error_info = "请输入电机功率?";
                    return null;
                }
 
                if(_motorRatedEta > 1)
                {
                    total_axis_power = rMeasurePower * _motorRatedEta / 100.0;//乘以电机效率
                }
                else
                {
                    total_axis_power = rMeasurePower;
                }
            }
 
            #endregion
 
 
 
            #region 计算扬程
            double p1m = 0;
            double height_inlet = 0;
            double OtherPressCoeff = 4 * 1000 / Math.PI / 3.6;
            double rPipeInV = 0;
            if (_isInlet清水池)
            {
                TProduct.Model.WorkBenchMonitorPoint moinitor_press_inlet = this._allMonitorList.Find(
                    x => x.MonitorType == Model.eMonitorType.水位
                    && x.Property == TProduct.Model.MonitorTypeProperty.进口);
 
 
                if (moinitor_press_inlet != null &&
                    moinitor_press_inlet.PipeDia != null &&
                    moinitor_press_inlet.PipeDia > 10)
                {
                    double mm_inlet_dia = moinitor_press_inlet.PipeDia.Value;
                    rPipeInV = OtherPressCoeff * total_flow_m3h / mm_inlet_dia / mm_inlet_dia;
                }
 
                if (moinitor_press_inlet != null &&
                    moinitor_press_inlet.Elevation != null)
                {
                    height_inlet = moinitor_press_inlet.Elevation.Value;
                }
 
                if (_pumpRatedParas.IsInletPress)
                {
                    if (moinitor_press_inlet == null)
                    {
                        error_info = "请输入进口清水池测点?";
                        return null;
                    }
                    var moinitor_press_inlet_value = valueList.Find(x => x.ID == moinitor_press_inlet.ID);
                    if (moinitor_press_inlet_value == null || moinitor_press_inlet_value.Value == null)
                    {
                        error_info = "请输入清水池水位?";
                        return null;
                    }
                    p1m = moinitor_press_inlet_value.Value.Value;//m
                }
            }
            else
            {
                TProduct.Model.WorkBenchMonitorPoint moinitor_press_inlet = this._allMonitorList.Find(
                    x => x.MonitorType == Model.eMonitorType.压力
                    && x.Property == TProduct.Model.MonitorTypeProperty.进口);
 
 
                if (moinitor_press_inlet != null &&
                    moinitor_press_inlet.PipeDia != null &&
                    moinitor_press_inlet.PipeDia > 10)
                {
                    double mm_inlet_dia = moinitor_press_inlet.PipeDia.Value;
                    rPipeInV = OtherPressCoeff * total_flow_m3h / mm_inlet_dia / mm_inlet_dia;
                }
                if (moinitor_press_inlet != null &&
                    moinitor_press_inlet.Elevation != null)
                {
                    height_inlet = moinitor_press_inlet.Elevation.Value;
                }
 
                if (_pumpRatedParas.IsInletPress)
                {
                    if (moinitor_press_inlet == null)
                    {
                        error_info = "请输入进口压力测点?";
                        return null;
                    }
                    var moinitor_press_inlet_value = valueList.Find(x => x.ID == moinitor_press_inlet.ID);
                    if (moinitor_press_inlet_value == null || moinitor_press_inlet_value.Value == null)
                    {
                        error_info = "请输入进口压力?";
                        return null;
                    }
                    double p1mpa = moinitor_press_inlet_value.Value.Value;
                    p1m = UnitConvert_MPa2M(p1mpa);
                }
            }
 
            var moinitor_press_outlet = this._allMonitorList.Find(x => x.MonitorType == Model.eMonitorType.压力 && x.Property == TProduct.Model.MonitorTypeProperty.出口);
            if (moinitor_press_outlet == null)
            {
                error_info = "请输入出口压力测点?";
                return null;
            }
 
            var moinitor_press_outlet_value = valueList.Find(x => x.ID == moinitor_press_outlet.ID);
            if (moinitor_press_outlet_value == null || moinitor_press_outlet_value.Value == null)
            {
                error_info = "请输入出口压力?";
                return null;
            }
 
            double p2mpa = moinitor_press_outlet_value.Value.Value;
            double p2m = UnitConvert_MPa2M(p2mpa);
            double rPipeOutV = 0;
            double height_oulet = 0;
            if (moinitor_press_outlet.PipeDia != null && moinitor_press_outlet.PipeDia > 10)
            {
                double mm_outlet_dia = moinitor_press_outlet.PipeDia.Value;
                rPipeOutV = OtherPressCoeff * total_flow_m3h / mm_outlet_dia / mm_outlet_dia;
            }
            if (moinitor_press_outlet.Elevation != null)
            {
                height_oulet = moinitor_press_outlet.Elevation.Value;
            }
 
 
            double gc = height_oulet - height_inlet;//高差
            double rVDif = (rPipeOutV * rPipeOutV - rPipeInV * rPipeInV) / (TProduct.ConstantParas.g * 2.0);
            double total_head = Math.Round(p2m - p1m + rVDif + gc, 2);
 
            #endregion
 
            var testQ = total_flow_m3h;
            var testH = total_head;
            var testP = total_axis_power;
            var testE = CalculateE(total_flow_m3h, total_head, total_axis_power);
 
            if (TProduct.UserSetting.Setting.PumpTest.IsCheckErrorEta100 && testE > 99)
            {
                error_info = "效率已超过100%,请确认数据是否正常?";
                return null;
            }
            //计算测试修正值
            double correctQ, correctH, correctE, correctP;//修正值
            if (_speedSimuMethod == eSpeedSimuMethod.转速换算 ||
                    _speedSimuMethod == Model.eSpeedSimuMethod.频率换算)
            {
                if (Math.Abs(rMeasureSpeed - this._pumpRatedN) < 3)
                {
                    correctQ = testQ;
                    correctH = testH;
                    correctE = testE;
                    correctP = testP;
                }
                else
                {
                    //得到相似换算值
                    double xshsFlow = testQ * this._pumpRatedN / rMeasureSpeed;
                    double xshsHead = testH * this._pumpRatedN * this._pumpRatedN / rMeasureSpeed / rMeasureSpeed;
 
                    //效率进行修正
                    double xshsEffice = GetSpeedE(testE, rMeasureSpeed, this._pumpRatedN);
 
                    //功率
                    double xshsPower = 0;
                    if (isZeroQ)
                    {//零流量点的功率
                        xshsPower = testP * this._pumpRatedN * this._pumpRatedN * this._pumpRatedN / rMeasureSpeed / rMeasureSpeed / rMeasureSpeed;
                    }
                    else
                    {//一般点的功率用效率计算
                        xshsPower = CalculateP(xshsFlow, xshsHead, xshsEffice);
                    }
 
                    correctQ = xshsFlow;
                    correctH = xshsHead;
                    correctE = xshsEffice;
                    correctP = xshsPower;
                }
 
            }
            else
            {
                correctQ = testQ;
                correctH = testH;
                correctE = testE;
                correctP = testP;
            }
 
 
 
            //温度换算 
            double jzTemplate = 20;
            if (this._isTemperatureTrn && correctQ > 10)
            {
                if (_testParas != null)
                {
                    jzTemplate = _testParas.JzWenDu;
                }
 
                double m1 = correctE;//模型效率
                double nm = 20;//模型温度
                var moinitor_jiezhi_wendu = this._allMonitorList.Find(x => x.MonitorType
                    == eMonitorType.介质温度);
                if (moinitor_jiezhi_wendu != null)
                {
                    var moinitor_jiezhi_wendu_value = valueList.Find(x => x.ID == moinitor_jiezhi_wendu.ID);
                    if (moinitor_jiezhi_wendu_value != null && moinitor_jiezhi_wendu_value.Value != null)
                    {
                        jzTemplate = moinitor_jiezhi_wendu_value.Value.Value;
                    }
                }
 
                if (jzTemplate > -10)
                {
                    correctE = Math.Round((m1 * 100 / (m1 * 1 + (100 - m1) * Math.Pow((nm / jzTemplate), -0.07))), 2);
 
                    correctP = CalculateP(correctH, correctQ, correctE);
                }
            }
 
            var currentRecord = new Model.PumpFeatTestRecordViewModel();
            currentRecord.TestItemID = this._testItemID;
            currentRecord.Time = DateTime.Now;
            currentRecord.RecordType = this._recordType;
            currentRecord.Speed = rMeasureSpeed;
            currentRecord.TestPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(testQ);
            currentRecord.TestPtH = TProduct.Common.RoundHelper.GetDispValueHead(testH);
            currentRecord.TestPtE = TProduct.Common.RoundHelper.GetDispValueEta(testE);
            currentRecord.TestPtP = TProduct.Common.RoundHelper.GetDispValuePower(testP);
            currentRecord.CorrectPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(correctQ);
            currentRecord.CorrectPtH = TProduct.Common.RoundHelper.GetDispValueHead(correctH);
            currentRecord.CorrectPtE = TProduct.Common.RoundHelper.GetDispValueEta(correctE);
            currentRecord.CorrectPtP = TProduct.Common.RoundHelper.GetDispValuePower(correctP);
 
            TProduct.Model.MonitorRecord4DsList monitorRecord4Ds = new TProduct.Model.MonitorRecord4DsList();
            foreach (var m in _allMonitorList)
            {
                var db = valueList.Find(x => x.ID == m.ID);
                if (db != null && db.Value != null)
                {
                    monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, db.Value.ToString()));
                }
                else
                {
                    if (m.MonitorType == eMonitorType.介质温度)
                    {
                        monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, jzTemplate));
                    }
                    else if (m.MonitorType == eMonitorType.电机效率)
                    {
                        monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, this._motorRatedEta));
                    }
                    else if (m.MonitorType == eMonitorType.阀门开度)
                    {
                        if (m.Property == TProduct.Model.MonitorTypeProperty.出口)
                            monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, valve出口阀门开度));
                        else if (m.Property == TProduct.Model.MonitorTypeProperty.进口)
                            monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, valve进口阀门开度));
                        else
                            monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, valve出口阀门开度));
                    }
                    else if (m.MonitorType == eMonitorType.转速)
                    {
                        monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, this._pumpRatedN));
                    }
                    else
                    {
                        monitorRecord4Ds.Add(new MonitorRecord4Ds(db.ID, ""));
                    }
                }
            }
 
            currentRecord.MonitorRecordList = monitorRecord4Ds;
            currentRecord.MonitorRecords = monitorRecord4Ds.ToDsString();
 
 
            var bll = new BLL.PumpFeatTestRecord();
            currentRecord.ID = bll.Add(this._testItem, currentRecord);
 
            return currentRecord;
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parappleInfo"></param>
        internal void SetParallelInfo(List<Model.ParallelPumpInfoEx> parappleInfo)
        {
 
        }
 
        private double? valve进口阀门开度 = null;
        private double? valve出口阀门开度 = null;
        /// <summary>
        /// 设置阀门开度
        /// </summary>
        /// <param name="prop"></param>
        /// <param name="paras"></param>
        /// <returns></returns>
        public virtual void SetValveDegree(string prop, double paras)
        {
            if (prop == TProduct.Model.MonitorTypeProperty.出口)
            {
                valve出口阀门开度 = paras;
            }
            if (prop == TProduct.Model.MonitorTypeProperty.进口)
            {
                valve进口阀门开度 = paras;
            }
        }
 
        public static double CalculateE(double Q, double H, double P)
        {
            double midu = TProduct.ConstantParas.WaterDensity;
            double gavity = TProduct.ConstantParas.g;
            P = P * 1000;//此处 1000 是 kw换成w 
            Q = Q / 3600;//此处 3600 是 小时换成秒
            double E = 0;
            if (P < 0.0001)
                E = 0;
            else
                E = midu * gavity * Q * H / P;
            return Math.Round(E * 100, 2);//效率用百分数
        }
 
        //计算功率:Q用m^3/t  H为m ,P为kw,density密度为kg/m^3,gavity用重力加速度m/s^2,效率用百分数
        public static double CalculateP(double Q, double H, double E)
        {
            double midu = TProduct.ConstantParas.WaterDensity;
            double gavity = TProduct.ConstantParas.g;
            E = E / 100;//效率用百分数
            Q = Q / 3600;//此处 3600 是 小时换成秒
            double P = 0;
            if (E < 0.01)
                P = 0;
            else
                P = midu * gavity * Q * H / E;
            return TProduct.Common.RoundHelper.GetDispValuePower(P / 1000);//此处 1000 是 kw换成w 
        }
 
        //知道原始速度和改变后的速度,求原始效率originE对应改变后的效率
        public static double GetSpeedE(double originE, double originN, double changeN)//转速
        {//变速度公式(P65页)
            if (originN < 0.1 || changeN < 0.1)
                return originE;
            double ratio = originN / changeN;
            double bilv = Math.Pow(ratio, 0.17);
            return originE * 100 / (originE + (100 - originE) * bilv);
        }
 
        /// <summary>
        /// Mpa=>m
        /// </summary>
        public static double UnitConvert_MPa2M(double mpa)
        {
            return mpa * 1000 / TProduct.ConstantParas.g;
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pump"></param>
        /// <param name="allRecords"></param>
        /// <param name="curveExpressQH"></param>
        /// <param name="curveExpressQE"></param>
        /// <param name="curveExpressQP"></param>
        public static void GetCurveExpressByRecord(
            TProduct.Model.ProductMainExPump pump,
            List<TProduct.Model.PumpFeatTestRecordViewModel> allRecords,
            out Eventech.Model.CurveExpress curveExpressQH,
            out Eventech.Model.CurveExpress curveExpressQE,
            out Eventech.Model.CurveExpress curveExpressQP)
        {
            List<Eventech.Model.FeatPoint> PointInfoQH = new List<Eventech.Model.FeatPoint>();
            List<Eventech.Model.FeatPoint> PointInfoQE = new List<Eventech.Model.FeatPoint>();
            List<Eventech.Model.FeatPoint> PointInfoQP = new List<Eventech.Model.FeatPoint>();
 
            foreach (var pt in allRecords)
            {
                PointInfoQH.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtH));
                if (pt.CorrectPtE.HasValue)
                    PointInfoQE.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtE.Value));
                if (pt.CorrectPtP.HasValue)
                    PointInfoQP.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtP.Value));
            }
            curveExpressQH = null;
 
            if(pump == null)
            {
                if (PointInfoQH.Count >= 4)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, Eventech.Model.eCurveFitType.CubicCurve, false);
                }
            }
            else if (pump.CurveFitTypeQH == Eventech.Model.eCurveFitType.FourM)
            {
                if (PointInfoQH.Count >= 5)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, pump.CurveFitTypeQH, false);
                }
            }
            else if (pump.CurveFitTypeQH == Eventech.Model.eCurveFitType.CubicCurve)
            {
                if (PointInfoQH.Count >= 4)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, pump.CurveFitTypeQH, false);
                }
            }
            else
            {
                if (PointInfoQH.Count >= 3)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, pump.CurveFitTypeQH, true);
                }
            }
 
            curveExpressQE = null;
            if (pump == null)
            {
                if (PointInfoQE.Count >= 4)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, Eventech.Model.eCurveFitType.CubicCurve, false);
                }
            }
            else if (pump.CurveFitTypeQE == Eventech.Model.eCurveFitType.FourM)
            {
                if (PointInfoQE.Count >= 5)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, pump.CurveFitTypeQE, false);
                }
            }
            else if (pump.CurveFitTypeQE == Eventech.Model.eCurveFitType.CubicCurve)
            {
                if (PointInfoQE.Count >= 4)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, pump.CurveFitTypeQE, false);
                }
            }
            else
            {
                if (PointInfoQE.Count >= 3)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, pump.CurveFitTypeQE, true);
                }
            }
 
            curveExpressQP = null;
            if (pump == null)
            {
                if (PointInfoQP.Count >= 4)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, Eventech.Model.eCurveFitType.CubicCurve, false);
                }
            }
            else if (pump.CurveFitTypeQP == Eventech.Model.eCurveFitType.FourM)
            {
                if (PointInfoQP.Count >= 5)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, pump.CurveFitTypeQP, false);
                }
            }
            else if (pump.CurveFitTypeQP == Eventech.Model.eCurveFitType.CubicCurve)
            {
                if (PointInfoQP.Count >= 4)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, pump.CurveFitTypeQP, false);
                }
            }
            else
            {
                if (PointInfoQP.Count >= 3)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, pump.CurveFitTypeQP, true);
                }
            }
 
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pump"></param>
        /// <param name="allRecords"></param>
        /// <param name="curveExpressQH"></param>
        /// <param name="curveExpressQE"></param>
        /// <param name="curveExpressQP"></param>
        public static void GetCurveExpressByRecord(
            TProduct.Model.ProductMainExPumpPart pump,
            List<TProduct.Model.PumpFeatTestRecord> allRecords,
            out Eventech.Model.CurveExpress curveExpressQH,
            out Eventech.Model.CurveExpress curveExpressQE,
            out Eventech.Model.CurveExpress curveExpressQP)
        {
            List<Eventech.Model.FeatPoint> PointInfoQH = new List<Eventech.Model.FeatPoint>();
            List<Eventech.Model.FeatPoint> PointInfoQE = new List<Eventech.Model.FeatPoint>();
            List<Eventech.Model.FeatPoint> PointInfoQP = new List<Eventech.Model.FeatPoint>();
 
            foreach (var pt in allRecords)
            {
                PointInfoQH.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtH));
                if (pt.CorrectPtE.HasValue)
                    PointInfoQE.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtE.Value));
                if (pt.CorrectPtP.HasValue)
                    PointInfoQP.Add(new Eventech.Model.FeatPoint(pt.CorrectPtQ, pt.CorrectPtP.Value));
            }
            curveExpressQH = null;
 
            if (pump == null)
            {
                if (PointInfoQH.Count >= 4)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, Eventech.Model.eCurveFitType.CubicCurve, false);
                }
            }
            else if (pump.CurveFitTypeQH == Eventech.Model.eCurveFitType.FourM)
            {
                if (PointInfoQH.Count >= 5)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, pump.CurveFitTypeQH, false);
                }
            }
            else if (pump.CurveFitTypeQH == Eventech.Model.eCurveFitType.CubicCurve)
            {
                if (PointInfoQH.Count >= 4)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, pump.CurveFitTypeQH, false);
                }
            }
            else
            {
                if (PointInfoQH.Count >= 3)
                {
                    curveExpressQH = new Eventech.Model.CurveExpress(PointInfoQH, pump.CurveFitTypeQH, true);
                }
            }
 
            curveExpressQE = null;
            if (pump == null)
            {
                if (PointInfoQE.Count >= 4)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, Eventech.Model.eCurveFitType.CubicCurve, false);
                }
            }
            else if (pump.CurveFitTypeQE == Eventech.Model.eCurveFitType.FourM)
            {
                if (PointInfoQE.Count >= 5)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, pump.CurveFitTypeQE, false);
                }
            }
            else if (pump.CurveFitTypeQE == Eventech.Model.eCurveFitType.CubicCurve)
            {
                if (PointInfoQE.Count >= 4)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, pump.CurveFitTypeQE, false);
                }
            }
            else
            {
                if (PointInfoQE.Count >= 3)
                {
                    curveExpressQE = new Eventech.Model.CurveExpress(PointInfoQE, pump.CurveFitTypeQE, true);
                }
            }
 
            curveExpressQP = null;
            if (pump == null)
            {
                if (PointInfoQP.Count >= 4)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, Eventech.Model.eCurveFitType.CubicCurve, false);
                }
            }
            else if (pump.CurveFitTypeQP == Eventech.Model.eCurveFitType.FourM)
            {
                if (PointInfoQP.Count >= 5)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, pump.CurveFitTypeQP, false);
                }
            }
            else if (pump.CurveFitTypeQP == Eventech.Model.eCurveFitType.CubicCurve)
            {
                if (PointInfoQP.Count >= 4)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, pump.CurveFitTypeQP, false);
                }
            }
            else
            {
                if (PointInfoQP.Count >= 3)
                {
                    curveExpressQP = new Eventech.Model.CurveExpress(PointInfoQP, pump.CurveFitTypeQP, true);
                }
            }
 
        }
    }
}