| | |
| | | using System.Windows.Forms; |
| | | using Yw.Geometry; |
| | | using Yw.Pump; |
| | | using Yw.Vmo; |
| | | using Yw.WinFrmUI.Phart; |
| | | |
| | | namespace HStation.WinFrmUI |
| | |
| | | |
| | | private Yw.Model.HydroModelInfo _hydroInfo = null; |
| | | private Yw.Model.HydroPumpInfo _pumpInfo = null; |
| | | private HydroCalcuResult _calcuResult = null; |
| | | private double _head = 0;// |
| | | |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, Yw.Model.HydroPumpInfo pumpInfo) |
| | | public void SetBindingData |
| | | ( |
| | | Yw.Model.HydroModelInfo hydroInfo, |
| | | Yw.Model.HydroPumpInfo pumpInfo, |
| | | HydroCalcuResult calcuResult |
| | | ) |
| | | { |
| | | if (hydroInfo == null) |
| | | { |
| | |
| | | } |
| | | _hydroInfo = hydroInfo; |
| | | _pumpInfo = pumpInfo; |
| | | _calcuResult = calcuResult; |
| | | _head = _hydroInfo.GetHead(); |
| | | this.hydroSinglePumpListExtendGridCtrl1.SetBindingData(pumpInfo); |
| | | var allStateList = this.hydroSinglePumpListExtendGridCtrl1.GetStateList(); |
| | | var vm = CreateViewModel(allStateList); |
| | | this.pumpOperationChart1.SetBindingData(vm); |
| | | if (calcuResult != null) |
| | | { |
| | | var allCalcuVisualDict = calcuResult.GetVisualDict(); |
| | | var calcuVisualResult = allCalcuVisualDict?.GetValue(pumpInfo.Code) as HydroCalcuPumpResult; |
| | | if (calcuVisualResult != null) |
| | | { |
| | | if (calcuVisualResult.CalcuQ.HasValue) |
| | | { |
| | | this.txtDesignQ.EditValue = Math.Round(calcuVisualResult.CalcuQ.Value, 1); |
| | | } |
| | | if (calcuVisualResult.CalcuH.HasValue) |
| | | { |
| | | this.txtDesignH.EditValue = Math.Round(calcuVisualResult.CalcuH.Value, 2); |
| | | } |
| | | if (calcuVisualResult.CalcuQ.HasValue && calcuVisualResult.CalcuH.HasValue) |
| | | { |
| | | Design(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //状态改变事件 |
| | |
| | | var vm = new PumpOperationViewModel(); |
| | | vm.Id = _pumpInfo.Code; |
| | | vm.Name = _pumpInfo.Name; |
| | | vm.RatedQ = _pumpInfo.RatedQ.HasValue ? _pumpInfo.RatedQ.Value : 0; |
| | | vm.RatedH = _pumpInfo.RatedH.HasValue ? _pumpInfo.RatedH.Value : 0; |
| | | vm.RatedQ = _pumpInfo.RatedQ; |
| | | vm.RatedH = _pumpInfo.RatedH; |
| | | vm.RatedP = _pumpInfo.RatedP; |
| | | vm.RatedN = rated.N; |
| | | vm.RatedHz = rated.Hz; |
| | | vm.RatedN = _pumpInfo.RatedN; |
| | | vm.RatedHz = _pumpInfo.RatedHz; |
| | | vm.CurrentHz = current.Hz; |
| | | vm.CurrentN = current.N; |
| | | vm.CurrentStatus = _pumpInfo.LinkStatus == Yw.Hydro.PumpStatus.Open; |
| | |
| | | //设计点 |
| | | private void btnDesign_Click(object sender, EventArgs e) |
| | | { |
| | | Design(); |
| | | } |
| | | |
| | | //设计 |
| | | private void Design() |
| | | { |
| | | var qtext = this.txtDesignQ.Text.Trim(); |
| | | if (string.IsNullOrEmpty(qtext)) |
| | | { |
| | |
| | | } |
| | | var q = double.Parse(qtext); |
| | | var h = double.Parse(htext); |
| | | this.pumpOperationChart1.SetDesignPoint(q, h); |
| | | this.pumpOperationChart1.SetDesignPoint(q, h, _head); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | if (this.hydroSinglePumpListExtendGridCtrl1.HasChanged) |
| | | { |
| | | this.hydroSinglePumpListExtendGridCtrl1.HasChanged = false; |
| | | var result = XtraMessageBox.Show("是否使用现有状态更新模型?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes; |
| | | if (!result) |
| | | { |
| | |
| | | LinkStatus = _pumpInfo.LinkStatus, |
| | | CurrentHz = allStateList[1].Hz |
| | | }; |
| | | |
| | | this.SaveEvent?.Invoke(working); |
| | | } |
| | | } |