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);
|
}
|
}
|
|
}
|
}
|
}
|