using DevExpress.XtraEditors; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace TProduct.WinFrmUI.TPump { internal partial class CalcNpshTestDataByEDlg : CalcNpshTestBaseDlg { public CalcNpshTestDataByEDlg() { InitializeComponent(); this.btnCorrect.SetCalcButtonColor(); this.btnOK.SetConfirmButtonColor(); this.btnCancel.SetCancelButtonColor(); //设置默认温度 _jzTemplate = 20; txtTemperature.Value = 20; RefreshWaterProperty(20); this.gridViewMain.OptionsDetail.ShowDetailTabs = false;//不显示TAB名 this.gridViewMain.OptionsView.ShowGroupPanel = false;//隐藏最上面的GroupPanel this.gridViewMain.OptionsSelection.MultiSelect = false;//单选 //this.gridViewMain.OptionsBehavior.Editable = false;//只读 this.gridViewMain.BestFitColumns(); this.gridViewMain.IndicatorWidth = 2; this.gridViewMain.RowHeight = 25; //this.gridViewMain.CustomDrawGroupRow += new DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventHandler(this.GridViewMain_CustomDrawGroupRow); this.gridViewMain.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(this.GridViewMain_CellValueChanged); power_unit = TProduct.UserSetting.Setting.PumpTest.UnitPower; flow_unit = TProduct.UserSetting.Setting.PumpTest.UnitFlow; head_unit = TProduct.UserSetting.Setting.PumpTest.UnitHead; press_unit = TProduct.UserSetting.Setting.PumpTest.UnitPress; lblCorrectQ.Text = string.Format("修正流量({0})", Eventech.Common.UnitQHelper.GetEnUnitName(flow_unit)); lblTestQ.Text = string.Format("测量流量({0})", Eventech.Common.UnitQHelper.GetEnUnitName(flow_unit)); lblCorrectH.Text = string.Format("修正扬程({0})", Eventech.Common.UnitHHelper.GetEnUnitName(head_unit)); lblTestH.Text = string.Format("测量扬程({0})", Eventech.Common.UnitHHelper.GetEnUnitName(head_unit)); //lblCorrectP.Text = string.Format("修正功率({0})", Eventech.Common.UnitPHelper.GetEnUnitName(power_unit)); //lblTestP.Text = string.Format("测量功率({0})", Eventech.Common.UnitPHelper.GetEnUnitName(power_unit)); } private void CalcNpshTestDataDlg_Load(object sender, EventArgs e) { } public class CurrentViewModel { public CurrentViewModel() { } public TProduct.Model.WorkBenchMonitorPoint Entity { get; set; } public long ID { get; set; } public string MonitorName { get; set; } public string UnitName { get; set; }//单位 public double? DispValue { get; set; }//单位换算后的 public DateTime Time { get; set; } } private long _jzTemperatureMonitorID = 0; private List _bindingData = null; public override void InitialMonitorInfo( List allMonitorList) { this._allMonitorList = allMonitorList; this._bindingData = new List(); foreach (var monitor in allMonitorList) { CurrentViewModel v = new CurrentViewModel(); v.Entity = monitor; v.ID = monitor.ID; v.MonitorName = monitor.Name; v.UnitName = GetUnitName(monitor); v.DispValue = null; if (monitor.MonitorType == Model.eMonitorType.介质温度) { this._jzTemperatureMonitorID = monitor.ID; } if (monitor.MonitorType == Model.eMonitorType.转速) { if (monitor.SourceType == Model.eMonitorPointSourceType.额定参数) { v.DispValue = this._ratedN; } } if (monitor.MonitorType == Model.eMonitorType.电机效率) { v.DispValue = _motorRatedEta; } _bindingData.Add(v); } } // private TProduct.Model.PumpNpshTestRecordViewModel _currentRecord = null; public override void NewTestRecord( List valueList, bool isAutoCalc) { txtCorrectQ.Text = ""; txtCorrectH.Text = ""; txtCorrectNPSH.Text = ""; txtTestQ.Text = ""; txtTestH.Text = ""; txtTestNPSH.Text = ""; if (_bindingData == null) return; if (valueList == null || valueList.Count() == 0) { foreach (var bd in _bindingData) { if (bd.Entity.SourceType == TProduct.Model.eMonitorPointSourceType.计算量) continue; if (bd.Entity.SourceType == TProduct.Model.eMonitorPointSourceType.额定参数) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.阀门开度) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.电机效率) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.介质温度) continue; bd.DispValue = null; } } else { foreach (var bd in _bindingData) { var f = valueList.Find(x => x.ID == bd.ID); if (f == null || f.Value == null) { if (bd.Entity.SourceType == TProduct.Model.eMonitorPointSourceType.计算量) continue; if (bd.Entity.SourceType == TProduct.Model.eMonitorPointSourceType.额定参数) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.阀门开度) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.电机效率) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.介质温度) continue; bd.DispValue = null; continue; } double rMeasureValue = f.Value.Value; if (bd.Entity.MonitorType == Model.eMonitorType.功率) { rMeasureValue = Eventech.Common.UnitPHelper.fromKW( power_unit, rMeasureValue); } else if (bd.Entity.MonitorType == Model.eMonitorType.流量) { rMeasureValue = Math.Round(Eventech.Common.UnitQHelper.fromM3H( flow_unit, rMeasureValue), 4); } else if (bd.Entity.MonitorType == Model.eMonitorType.压力) { rMeasureValue = Eventech.Common.UnitHHelper.fromMPa( press_unit, rMeasureValue); } bd.DispValue = rMeasureValue; bd.Time = f.Time; } } //介质温度没有值 就用默认 var jz_item = _bindingData.Find(x => x.Entity.MonitorType == Model.eMonitorType.介质温度); if (jz_item != null) { if (jz_item.DispValue == null) { jz_item.DispValue = this._jzTemplate; txtTemperature.Value = Convert.ToDecimal(this._jzTemplate); this.RefreshWaterProperty(_jzTemplate); } } if (this._jzTemperatureMonitorID > 0 && valueList != null) { var vTemperature = valueList.Find(x => x.ID == this._jzTemperatureMonitorID); if (vTemperature != null && vTemperature.Value.HasValue) { this._jzTemplate = vTemperature.Value.Value; this.txtTemperature.Text = vTemperature.Value.Value.ToString(); this.RefreshWaterProperty(vTemperature.Value.Value); } } bindingSource1.DataSource = _bindingData; bindingSource1.ResetBindings(false); btnOK.Enabled = false; _currentRecord = new Model.PumpNpshTestRecordViewModel(); _currentRecord.TestItemID = this._testItemID; _currentRecord.Time = DateTime.Now; _currentRecord.RecordType = this._recordType; } public override void EditTestRecord(TProduct.Model.PumpNpshTestRecordViewModel record) { if (record == null) return; foreach (var bd in _bindingData) { var f = record.MonitorRecordList.Find(x => x.ID == bd.ID); if (f == null || string.IsNullOrEmpty(f.Value)) { if (bd.Entity.SourceType == TProduct.Model.eMonitorPointSourceType.计算量) continue; if (bd.Entity.SourceType == TProduct.Model.eMonitorPointSourceType.额定参数) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.阀门开度) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.电机效率) continue; if (bd.Entity.MonitorType == TProduct.Model.eMonitorType.介质温度) continue; bd.DispValue = null; } else { double rMeasureValue = Convert.ToDouble(f.Value); if (bd.Entity.MonitorType == Model.eMonitorType.功率) { rMeasureValue = Eventech.Common.UnitPHelper.fromKW( power_unit, rMeasureValue); } else if (bd.Entity.MonitorType == Model.eMonitorType.流量) { rMeasureValue = Eventech.Common.UnitQHelper.fromM3H( flow_unit, rMeasureValue); } else if (bd.Entity.MonitorType == Model.eMonitorType.压力) { rMeasureValue = Eventech.Common.UnitHHelper.fromMPa( press_unit, rMeasureValue); } else if (bd.Entity.MonitorType == Model.eMonitorType.介质温度) { _jzTemplate = rMeasureValue; this.txtTemperature.Text = rMeasureValue.ToString(); this.RefreshWaterProperty(_jzTemplate); } bd.DispValue = rMeasureValue; bd.Time = record.Time; } } this._currentRecord = record; txtTestQ.Text = TProduct.Common.RoundHelper.GetDispValueFlow( Eventech.Common.UnitQHelper.fromM3H(flow_unit, record.TestPtQ)).ToString(); txtTestE.Text = TProduct.Common.RoundHelper.GetDispValueHead( Eventech.Common.UnitHHelper.fromM(head_unit, record.TestPtAccord)).ToString(); txtTestNPSH.Text = TProduct.Common.RoundHelper.GetDispValueEta(record.TestPtNpsh).ToString(); txtCorrectQ.Text = TProduct.Common.RoundHelper.GetDispValueFlow( Eventech.Common.UnitQHelper.fromM3H(flow_unit, record.CorrectPtQ)).ToString(); txtCorrectE.Text = TProduct.Common.RoundHelper.GetDispValueHead( Eventech.Common.UnitHHelper.fromM(head_unit, record.CorrectPtAccord)).ToString(); txtCorrectNPSH.Text = TProduct.Common.RoundHelper.GetDispValueEta(record.CorrectPtNpsh).ToString(); bindingSource1.DataSource = _bindingData; bindingSource1.ResetBindings(false); btnOK.Enabled = false; } //参数 private double _testQ, _testH, _testE, _testP, _testNpsh;//测量值(都是标准单位) private double _correctQ, _correctH, _correctE, _correctP, _correctNpsh;//修正值(都是标准单位) private double _rMeasureSpeed; //计算 private void btnCorrect_Click(object sender, EventArgs e) { btnOK.Enabled = false; try { if (!CalcMeasurePara()) return; if (_testH < 0) { MessageBox.Show("进出口压力测点是否搞反了"); return; } txtTestQ.Text = TProduct.Common.RoundHelper.GetDispValueFlow( Eventech.Common.UnitQHelper.fromM3H(flow_unit, _testQ)).ToString(); txtTestH.Text = TProduct.Common.RoundHelper.GetDispValueHead( Eventech.Common.UnitHHelper.fromM(head_unit, _testH)).ToString(); txtTestE.Text = TProduct.Common.RoundHelper.GetDispValueEta(_testE).ToString(); txtTestNPSH.Text = TProduct.Common.RoundHelper.GetDispValueHead(_testNpsh).ToString(); txtCorrectE.Text = TProduct.Common.RoundHelper.GetDispValueEta(_correctE).ToString(); txtCorrectQ.Text = TProduct.Common.RoundHelper.GetDispValueFlow( Eventech.Common.UnitQHelper.fromM3H(flow_unit, _correctQ)).ToString(); txtCorrectH.Text = TProduct.Common.RoundHelper.GetDispValueHead( Eventech.Common.UnitHHelper.fromM(head_unit, _correctH)).ToString(); txtCorrectNPSH.Text = TProduct.Common.RoundHelper.GetDispValueHead(_correctNpsh).ToString(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error:169"); return; } btnOK.Enabled = true; } #region 计算 /// /// /// /// private bool CalcMeasurePara() { if (_ratedParas == null) { XtraMessageBox.Show("未设置泵额定参数?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } #region 转速,流量 //测量转速 var moinitor_speed = this._bindingData.Find(x => x.Entity.MonitorType == Model.eMonitorType.转速); if (moinitor_speed == null || moinitor_speed.DispValue == null) { XtraMessageBox.Show("请输入电机转速?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } this._rMeasureSpeed = moinitor_speed.DispValue.Value; //测量流量 double total_flow_m3h = 0; var moinitor_flows = this._bindingData.Where(x => x.Entity.MonitorType == Model.eMonitorType.流量); if (moinitor_flows == null || moinitor_flows.Count() == 0) { XtraMessageBox.Show("请输入流量?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } else if (moinitor_flows.Count() == 1) { var moinitor_flow = moinitor_flows.First(); if (moinitor_flow == null || moinitor_flow.DispValue == null) { XtraMessageBox.Show("请输入流量?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } total_flow_m3h = Eventech.Common.UnitQHelper.toM3H(flow_unit, moinitor_flow.DispValue.Value); } else {//多个流量计 total_flow_m3h = 0; foreach (var moinitor_flow in moinitor_flows) { if (moinitor_flow == null || moinitor_flow.DispValue == null) { continue; } total_flow_m3h = total_flow_m3h + moinitor_flow.DispValue.Value * moinitor_flow.Entity.SumCalcCoeff; } total_flow_m3h = Eventech.Common.UnitQHelper.toM3H(flow_unit, total_flow_m3h); } #endregion #region 计算扬程 double OtherPressCoeff = 4 * 1000 / Math.PI / 3.6; double rPipeInV = 0; double p1m = 0; CurrentViewModel moinitor_press_inlet = this._bindingData.Find(x => x.Entity.MonitorType == Model.eMonitorType.压力 && x.Entity.Property == TProduct.Model.MonitorTypeProperty.进口); //if (moinitor_press_inlet != null && // moinitor_press_inlet.Entity != null && // moinitor_press_inlet.Entity.PipeDia != null && // moinitor_press_inlet.Entity.PipeDia > 10) //{ // double mm_inlet_dia = moinitor_press_inlet.Entity.PipeDia.Value; // rPipeInV = OtherPressCoeff * total_flow_m3h / mm_inlet_dia / mm_inlet_dia; //} if (_ratedParas.IsInletPress) {//可能测点有,配有标高 if (moinitor_press_inlet == null || moinitor_press_inlet.DispValue == null) { XtraMessageBox.Show("请输入进口压力?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } p1m = Eventech.Common.UnitHHelper.toMPa(press_unit, moinitor_press_inlet.DispValue.Value); } var moinitor_press_outlet = this._bindingData.Find(x => x.Entity.MonitorType == Model.eMonitorType.压力 && x.Entity.Property == TProduct.Model.MonitorTypeProperty.出口); if (moinitor_press_outlet == null || moinitor_press_outlet.DispValue == null) { XtraMessageBox.Show("请输入出口压力?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } double p2m = Eventech.Common.UnitHHelper.toMPa(press_unit, moinitor_press_outlet.DispValue.Value); double rPipeOutV = 0; //if (moinitor_press_outlet.Entity.PipeDia != null && moinitor_press_outlet.Entity.PipeDia > 10) //{ // double mm_outlet_dia = moinitor_press_outlet.Entity.PipeDia.Value; // rPipeOutV = OtherPressCoeff * total_flow_m3h / mm_outlet_dia / mm_outlet_dia; //} //高差 double gc = 0; //if (moinitor_press_outlet.Entity.Elevation != null) //{ // gc += moinitor_press_outlet.Entity.Elevation.Value; //} //if (moinitor_press_inlet != null && // moinitor_press_inlet.Entity != null && // moinitor_press_inlet.Entity.Elevation != null) //{ // gc -= moinitor_press_inlet.Entity.Elevation.Value; //} double rVDif = (rPipeOutV * rPipeOutV - rPipeInV * rPipeInV) / (TProduct.ConstantParas.g * 2.0); double total_head = Math.Round(UnitConvert_MPa2M(p2m - p1m) + rVDif + gc, 2); #endregion #region 功率/扭矩 double total_axis_power = 0; if (_powerTestMethod == TProduct.Model.ePowerTestMethod.扭矩) { var moinitor_扭矩 = this._bindingData.Find(x => x.Entity.MonitorType == TProduct.Model.eMonitorType.扭矩); if (moinitor_扭矩 == null || moinitor_扭矩.DispValue == null) { XtraMessageBox.Show("请输入扭矩值?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } total_axis_power = Math.Round(moinitor_扭矩.DispValue.Value * _rMeasureSpeed / 9550, 3); } else {//电机功率 var moinitor_power = this._bindingData.Find(x => x.Entity.MonitorType == TProduct.Model.eMonitorType.功率 && (string.IsNullOrEmpty(x.Entity.Property) || x.Entity.Property == TProduct.Model.MonitorTypeProperty.总)); if (moinitor_power == null || moinitor_power.DispValue == null) { XtraMessageBox.Show("请输入电机功率?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } double rMotorPower = Eventech.Common.UnitPHelper.toKW(power_unit, moinitor_power.DispValue.Value); if (rMotorPower <= 0.0001) { XtraMessageBox.Show("请输入电机功率?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } total_axis_power = rMotorPower * _motorRatedEta / 100.0;//乘以电机效率 } #endregion this._testQ = TProduct.Common.RoundHelper.GetDispValueFlow(total_flow_m3h); this._testH = TProduct.Common.RoundHelper.GetDispValueHead(total_head); this._testP = TProduct.Common.RoundHelper.GetDispValuePower(total_axis_power); this._testE = CalculateE(_testQ, _testH, _testP); if (TProduct.UserSetting.Setting.PumpTest.IsCheckErrorEta100 && this._testE > 99) { XtraMessageBox.Show("效率已超过100%,请确认数据是否正常??", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } //依照设计手册P220页 //NPSH = Pa/pg+ Ps/pg + Vs^2/2g - Pv/pg + Zd; // Pa = 大气压 Ps 进口表压 Pv气化压力 Vs 流速 Zd 泵进口基准面与NPSH基准面的高差 // pg 密度和重力加速度 _testNpsh = UnitConvert_KPa2M(this._atmospherePressure)//大气压(Kp) - UnitConvert_KPa2M(this._qiHuaYaLi)//汽化压力(Kp) + UnitConvert_MPa2M(p1m) + this._ratedParas.NpshGaoChaZd//Zd 泵进口基准面与NPSH基准面的高差 + rPipeInV * rPipeInV / TProduct.ConstantParas.g / 2.0 ;//计算水泵汽蚀 //计算测试修正值 if (!CalculeCorrectPara()) { return false; } //温度换算 if (!CalculeByTemperature()) { return false; } return true; } //根据测试参数,计算测试修正值(输入进来的单位都是标准单位) public bool CalculeCorrectPara() { _correctQ = _correctH = _correctE = _correctP = _correctNpsh = 0; //测量转速 if (_rMeasureSpeed <= 20) { XtraMessageBox.Show("请输入转速?", "问题确认", MessageBoxButtons.OK, MessageBoxIcon.Question); return false; } try { bool isZeroQ = false; if (this._ratedParas == null) { if (this._testQ < 0.1) { this._testQ = 0; isZeroQ = true; } } else { if (this._testQ < this._ratedParas.Q / 50) { this._testQ = 0; isZeroQ = true; } } double rTestSpeed = this._rMeasureSpeed; //得到相似换算值 double xshsFlow = _testQ * this._ratedN / _rMeasureSpeed; double xshsHead = _testH * this._ratedN * this._ratedN / _rMeasureSpeed / _rMeasureSpeed; //效率进行修正 double xshsEffice = GetSpeedE(this._testE, rTestSpeed, this._ratedN); //功率 double xshsPower = 0; if (isZeroQ) {//零流量点的功率 xshsPower = this._testP * this._ratedN * this._ratedN * this._ratedN / rTestSpeed / rTestSpeed / rTestSpeed; } else {//一般点的功率用效率计算 xshsPower = CalculateP(xshsFlow, xshsHead, xshsEffice); } //汽蚀 根据手册P79页为速度的平方 double xshsNPSH = _testNpsh * this._ratedN * this._ratedN / _rMeasureSpeed / _rMeasureSpeed; _correctQ = TProduct.Common.RoundHelper.GetDispValueFlow(xshsFlow); _correctH = TProduct.Common.RoundHelper.GetDispValueHead(xshsHead); _correctE = TProduct.Common.RoundHelper.GetDispValueEta(xshsEffice); _correctP = TProduct.Common.RoundHelper.GetDispValuePower(xshsPower); _correctNpsh = Math.Round(xshsNPSH, 2); } catch (Exception ex) { XtraMessageBox.Show(ex.ToString()); return false; } return true; } /// /// 温度换算 /// /// private bool CalculeByTemperature() { //温度换算 if (this._isTemperatureTrn && _correctQ > 0.1) { double origin_eta = _correctE;//模型效率 double origin_wendu = 20;//模型温度 if (this._jzTemplate > -10) { _correctE = Math.Round((origin_eta * 100 / (origin_eta * 1 + (100 - origin_eta) * Math.Pow((origin_wendu / _jzTemplate), -0.07))), 2); _correctP = CalculateP(_correctH, _correctQ, _correctE); } } return true; } #endregion // private void btnOK_Click(object sender, EventArgs e) { if (_bindingData == null) return; if (this._ratedParas == null) { XtraMessageBox.Show("未设置泵的额定参数"); return; } if (this._testNpsh < 0) { XtraMessageBox.Show("汽蚀为负数,请确认"); return; } if (this._testH < 0.1) { XtraMessageBox.Show("扬程数据不正常?"); return; } if (this._currentRecord == null) return; try { _currentRecord.Time = DateTime.Now; _currentRecord.Speed = this._rMeasureSpeed; //_testQ , _correctQ已经是标准单位了 _currentRecord.TestPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(this._testQ); _currentRecord.TestPtAccord = TProduct.Common.RoundHelper.GetDispValueHead(this._testE); _currentRecord.TestPtNpsh = TProduct.Common.RoundHelper.GetDispValueHead(this._testNpsh); _currentRecord.CorrectPtQ = TProduct.Common.RoundHelper.GetDispValueFlow(this._correctQ); _currentRecord.CorrectPtAccord = TProduct.Common.RoundHelper.GetDispValueHead(this._correctE); _currentRecord.CorrectPtNpsh = TProduct.Common.RoundHelper.GetDispValueHead(this._correctNpsh); TProduct.Model.MonitorRecord4DsList monitorRecord4Ds = new TProduct.Model.MonitorRecord4DsList(); foreach (var bd in _bindingData) { if (bd.DispValue != null) { double rMeasureValue = bd.DispValue.Value; if (bd.Entity.MonitorType == Model.eMonitorType.功率) { rMeasureValue = Eventech.Common.UnitPHelper.toKW( power_unit, rMeasureValue); } else if (bd.Entity.MonitorType == Model.eMonitorType.流量) { rMeasureValue = Eventech.Common.UnitQHelper.toM3H( flow_unit, rMeasureValue); } else if (bd.Entity.MonitorType == Model.eMonitorType.压力) { rMeasureValue = Eventech.Common.UnitHHelper.toMPa( press_unit, rMeasureValue); } monitorRecord4Ds.Add(new TProduct.Model.MonitorRecord4Ds(bd.ID, rMeasureValue.ToString())); } } _currentRecord.MonitorRecordList = monitorRecord4Ds; _currentRecord.MonitorRecords = monitorRecord4Ds.ToDsString(); if (this.OnSaveRecord == null) return; var bll = new BLL.PumpNpshTestRecord(); // operateType表示操作类型 1 表示添加 2 表示更新 3表示删除 if (_currentRecord.ID == 0) { _currentRecord.ID = bll.Add(this._testItem, _currentRecord); OnSaveRecord(_currentRecord, 1); } else { bll.Update(this._testItem, _currentRecord); OnSaveRecord(_currentRecord, 2); } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error:184"); return; } if (isAutoClose) { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else {//注意:此对话框不会关闭,只是隐藏,如果要关闭需要外部关闭 txtCorrectQ.Text = ""; txtCorrectH.Text = ""; txtCorrectNPSH.Text = ""; txtTestQ.Text = ""; txtTestH.Text = ""; txtTestNPSH.Text = ""; this.Hide();//不要关闭可能要再次打开 } } // private void btnCancel_Click(object sender, EventArgs e) { if (isAutoClose) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); } else {//注意:此对话框不会关闭,只是隐藏,如果要关闭需要外部关闭 this.Hide(); } } // private double _motorRatedEta = 100; public override void SetMotorInfo(double ratedEta, Eventech.Model.CurveExpress eatCurve) { if (ratedEta > 1) { if (_bindingData != null) { var f = this._bindingData.Find(x => x.Entity.MonitorType == Model.eMonitorType.电机效率); if (f != null) { f.Time = DateTime.Now; f.DispValue = ratedEta; bindingSource1.DataSource = _bindingData; bindingSource1.ResetBindings(false); } } _motorRatedEta = ratedEta; } } private void GridViewMain_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { var rec = gridViewMain.GetRow(e.RowHandle) as CurrentViewModel; if (rec == null) return; if (rec.Entity.MonitorType == Model.eMonitorType.介质温度 && rec.DispValue != null) { this._jzTemplate = rec.DispValue.Value; this.txtTemperature.Text = this._jzTemplate.ToString(); this.RefreshWaterProperty(rec.DispValue.Value); } } //根据温度计算汽化压力 double _qiHuaYaLi = 2.334;// (Kp) private void RefreshWaterProperty(double temperature) { TProduct.Model.WaterProperty prop = TProduct.Common.WaterPropertyHelper.GetByTemperature(temperature); if (prop == null) return; this._qiHuaYaLi = prop.BHZQYkpa; text密度.Text = prop.MD.ToString(); text重度.Text = prop.ZD.ToString(); text运动粘度.Text = prop.YDND.ToString(); text饱和蒸汽压kgf.Text = prop.BHZQYkgf.ToString(); text饱和蒸汽压kpa.Text = prop.BHZQYkpa.ToString(); } private void btnHelpNpshCalc_Click(object sender, EventArgs e) { //new TPump.WinFrmUI.CalcNpshHelplDlg().Show(); } } }