| | |
| | | |
| | | private bool _initial_data = false; |
| | | |
| | | private PumpOperationViewModel _operation_vm = null; |
| | | private PumpOperationViewModel _vm = null; |
| | | |
| | | #endregion |
| | | |
| | |
| | | { |
| | | if (e is not DXCustomPaintEventArgs dxArgs) |
| | | return; |
| | | if (_operation_vm == null) |
| | | if (_vm == null) |
| | | return; |
| | | |
| | | if (_equip_line != null && _equip_sect_pt != null && _equip_visible) |
| | |
| | | using Pen pen = new(Color.Black, 2); |
| | | pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; |
| | | |
| | | DrawEquipPoint(dxArgs.Cache, pen, _equip_sect_pt, _operation_vm.CurveQE, _operation_vm.CurveQP); |
| | | DrawEquipPoint(dxArgs.Cache, pen, _equip_sect_pt, _vm.CurveQE, _vm.CurveQP); |
| | | if (_current_equip_sect_pt != null) |
| | | DrawEquipPoint(dxArgs.Cache, pen, _current_equip_sect_pt, _operation_vm.CurrentCurveQE, _operation_vm.CurrentCurveQP); |
| | | DrawEquipPoint(dxArgs.Cache, pen, _current_equip_sect_pt, _vm.CurrentCurveQE, _vm.CurrentCurveQP); |
| | | DrawEquipLine(dxArgs.Cache, pen, _equip_line); |
| | | } |
| | | |
| | |
| | | } |
| | | if (qp != null && _qp_visible) |
| | | { |
| | | var qp_y = qe.GetPointY(qh_x); |
| | | var qp_y = qp.GetPointY(qh_x); |
| | | var qp_pt = _diagram.DiagramToPoint(qh_x, qp_y, _axis_x_flow, _axis_y_power); |
| | | var qp_pt_x = qp_pt.Point.X; |
| | | var qp_pt_y = qp_pt.Point.Y; |
| | |
| | | /// </summary> |
| | | public void SetBindingData(PumpOperationViewModel vm) |
| | | { |
| | | _operation_vm = vm; |
| | | _vm = vm; |
| | | _initial_data = vm != null; |
| | | UpdateChart(true); |
| | | } |
| | |
| | | _equip_line = null; |
| | | _equip_sect_pt = null; |
| | | _current_equip_sect_pt = null; |
| | | if (_operation_vm == null) |
| | | if (_vm == null) |
| | | { |
| | | this.DesignPointChangedEvent?.Invoke(null); |
| | | return; |
| | | } |
| | | |
| | | start_head ??= _coordinate.DispMinH(); |
| | | var equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_operation_vm.CurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d sect_pt); |
| | | var equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_vm.CurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d sect_pt); |
| | | if (equip_line == null || sect_pt == null) |
| | | return; |
| | | |
| | |
| | | double flow = 0, head = 0; |
| | | double? eff = null, power = null; |
| | | flow = sect_pt.X; |
| | | head = _operation_vm.CurveQH.GetPointY(flow); |
| | | if (_operation_vm.CurveQP != null) |
| | | head = _vm.CurveQH.GetPointY(flow); |
| | | if (_vm.CurveQP != null) |
| | | { |
| | | power = _operation_vm.CurveQP.GetPointY(flow); |
| | | power = _vm.CurveQP.GetPointY(flow); |
| | | eff = PumpCalcHelper.CalculateE(flow, head, power.Value); |
| | | } |
| | | else if (_operation_vm.CurveQE != null) |
| | | else if (_vm.CurveQE != null) |
| | | { |
| | | eff = _operation_vm.CurveQE.GetPointY(flow); |
| | | eff = _vm.CurveQE.GetPointY(flow); |
| | | power = PumpCalcHelper.CalculateP(flow, head, eff.Value); |
| | | } |
| | | |
| | | var design_pt_list = new List<PumpDesignPointViewModel> |
| | | { |
| | | new() { |
| | | Id = _operation_vm.Id + "额定", |
| | | Name = _operation_vm.Name + "(额定)", |
| | | Id = _vm.Id + "额定", |
| | | Name = _vm.Name + "(额定)", |
| | | Q = flow, |
| | | H = head, |
| | | E = eff, |
| | | P = power, |
| | | Hz = _operation_vm.RatedHz, |
| | | N = _operation_vm.RatedN |
| | | Hz = _vm.RatedHz, |
| | | N = _vm.RatedN |
| | | } |
| | | }; |
| | | |
| | | if (_operation_vm.CurrentStatus) |
| | | if (_vm.CurrentStatus) |
| | | { |
| | | var current_equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_operation_vm.CurrentCurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d current_sect_pt); |
| | | var current_equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(_vm.CurrentCurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d current_sect_pt); |
| | | if ( current_sect_pt == null) |
| | | return; |
| | | double current_flow = 0, current_head = 0; |
| | | double? current_eff = null, current_power = null; |
| | | current_flow = current_sect_pt.X; |
| | | current_head = _operation_vm.CurrentCurveQH.GetPointY(current_flow); |
| | | if (_operation_vm.CurrentCurveQP != null) |
| | | current_head = _vm.CurrentCurveQH.GetPointY(current_flow); |
| | | if (_vm.CurrentCurveQP != null) |
| | | { |
| | | current_power = _operation_vm.CurrentCurveQP.GetPointY(current_flow); |
| | | current_power = _vm.CurrentCurveQP.GetPointY(current_flow); |
| | | current_eff = PumpCalcHelper.CalculateE(current_flow, current_head, current_power.Value); |
| | | } |
| | | else if (_operation_vm.CurrentCurveQE != null) |
| | | else if (_vm.CurrentCurveQE != null) |
| | | { |
| | | current_eff = _operation_vm.CurrentCurveQE.GetPointY(current_flow); |
| | | current_eff = _vm.CurrentCurveQE.GetPointY(current_flow); |
| | | current_power = PumpCalcHelper.CalculateP(current_flow, current_head, current_eff.Value); |
| | | } |
| | | |
| | | design_pt_list.Add(new() |
| | | { |
| | | Id = _operation_vm.Id, |
| | | Name = _operation_vm.Name, |
| | | Id = _vm.Id, |
| | | Name = _vm.Name, |
| | | Q = current_flow, |
| | | H = current_head, |
| | | E = current_eff, |
| | | P = current_power, |
| | | Hz = _operation_vm.CurrentHz, |
| | | N = _operation_vm.CurrentN |
| | | Hz = _vm.CurrentHz, |
| | | N = _vm.CurrentN |
| | | }); |
| | | |
| | | } |
| | |
| | | { |
| | | if (vm == null) |
| | | return; |
| | | _operation_vm = vm; |
| | | _vm = vm; |
| | | _initial_data = true; |
| | | UpdateChart(true); |
| | | } |
| | |
| | | /// </summary> |
| | | public void Delete() |
| | | { |
| | | _operation_vm = null; |
| | | _vm = null; |
| | | UpdateChart(true); |
| | | _initial_data = false; |
| | | } |
| | |
| | | /// </summary> |
| | | private void CalcCoordinate() |
| | | { |
| | | if (_operation_vm == null ) |
| | | if (_vm == null ) |
| | | { |
| | | //设置成白板坐标 |
| | | _coordinate = new PumpCoordinate(); |
| | |
| | | |
| | | double _scaleMinH = 1, _scaleMaxH = 1; |
| | | { |
| | | var qh_pt_list = _operation_vm.CurveQH.GetPointList(); |
| | | if (_operation_vm.CurrentStatus) |
| | | var qh_pt_list = _vm.CurveQH.GetPointList(); |
| | | if (_vm.CurrentStatus) |
| | | { |
| | | qh_pt_list.AddRange(_operation_vm.CurrentCurveQH.GetPointList()); |
| | | qh_pt_list.AddRange(_vm.CurrentCurveQH.GetPointList()); |
| | | } |
| | | |
| | | var xxx = qh_pt_list.Select(x => x.X); |
| | |
| | | } |
| | | |
| | | |
| | | if (_operation_vm.CurveQE != null) |
| | | if (_vm.CurveQE != null) |
| | | { |
| | | var yyy = _operation_vm.CurveQE.GetPointList().Select(x => x.Y).ToList(); |
| | | if (_operation_vm.CurrentStatus) |
| | | var yyy = _vm.CurveQE.GetPointList().Select(x => x.Y).ToList(); |
| | | if (_vm.CurrentStatus) |
| | | { |
| | | yyy.AddRange(_operation_vm.CurrentCurveQE.GetPointList().Select(x => x.Y)); |
| | | yyy.AddRange(_vm.CurrentCurveQE.GetPointList().Select(x => x.Y)); |
| | | } |
| | | _min_eff = Math.Min(_min_eff, yyy.Min()); |
| | | _max_eff = Math.Max(_max_eff, yyy.Max()); |
| | | } |
| | | |
| | | |
| | | if (_operation_vm.CurveQP != null) |
| | | if (_vm.CurveQP != null) |
| | | { |
| | | var yyy = _operation_vm.CurveQP.GetPointList().Select(x => x.Y).ToList(); |
| | | if (_operation_vm.CurrentStatus) |
| | | var yyy = _vm.CurveQP.GetPointList().Select(x => x.Y).ToList(); |
| | | if (_vm.CurrentStatus) |
| | | { |
| | | yyy.AddRange(_operation_vm.CurrentCurveQP.GetPointList().Select(x => x.Y)); |
| | | yyy.AddRange(_vm.CurrentCurveQP.GetPointList().Select(x => x.Y)); |
| | | } |
| | | _min_power = Math.Min(_min_power, yyy.Min()); |
| | | _max_power = Math.Max(_max_power, yyy.Max()); |
| | |
| | | |
| | | this.chartControl1.Legend.CustomItems.Clear(); |
| | | |
| | | if (_operation_vm!=null) |
| | | if (_vm!=null) |
| | | { |
| | | CreateLineSeries(_operation_vm); |
| | | if (_operation_vm.CurrentStatus) |
| | | CreateLineSeries(_vm); |
| | | if (_vm.CurrentStatus) |
| | | { |
| | | CreateCurrentLineSeries(_operation_vm); |
| | | CreateCurrentLineSeries(_vm); |
| | | } |
| | | } |
| | | |
| | |
| | | _anno_txt_query_info.Visible = true; |
| | | } |
| | | |
| | | if (_operation_vm == null) |
| | | if (_vm == null) |
| | | return; |
| | | |
| | | if (_operation_vm.CurrentStatus) |
| | | if (_vm.CurrentStatus) |
| | | { |
| | | x_flow ??= _operation_vm.CurrentCurveQH.MaxX * 0.8; |
| | | if (x_flow < _operation_vm.CurrentCurveQH.MinX || x_flow > _operation_vm.CurrentCurveQH.MaxX) |
| | | x_flow ??= _vm.CurrentCurveQH.MaxX * 0.8; |
| | | if (x_flow < _vm.CurrentCurveQH.MinX || x_flow > _vm.CurrentCurveQH.MaxX) |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | x_flow ??= _operation_vm.CurveQH.MaxX * 0.8; |
| | | if (x_flow < _operation_vm.CurveQH.MinX || x_flow > _operation_vm.CurveQH.MaxX) |
| | | x_flow ??= _vm.CurveQH.MaxX * 0.8; |
| | | if (x_flow < _vm.CurveQH.MinX || x_flow > _vm.CurveQH.MaxX) |
| | | return; |
| | | } |
| | | |
| | |
| | | double? eff = null, power = null; |
| | | |
| | | flow = x_flow.Value; |
| | | head = _operation_vm.CurveQH.GetPointY(flow); |
| | | if (_operation_vm.CurveQP != null) |
| | | head = _vm.CurveQH.GetPointY(flow); |
| | | if (_vm.CurveQP != null) |
| | | { |
| | | power = _operation_vm.CurveQP.GetPointY(flow); |
| | | power = _vm.CurveQP.GetPointY(flow); |
| | | eff = PumpCalcHelper.CalculateE(flow, head, power.Value); |
| | | } |
| | | else if (_operation_vm.CurveQE != null) |
| | | else if (_vm.CurveQE != null) |
| | | { |
| | | eff = _operation_vm.CurveQE.GetPointY(flow); |
| | | eff = _vm.CurveQE.GetPointY(flow); |
| | | power = PumpCalcHelper.CalculateP(flow, head, eff.Value); |
| | | } |
| | | |
| | | query_pt_list.Add(new PumpQueryPointViewModel |
| | | { |
| | | Id = _operation_vm.Id, |
| | | Name = _operation_vm.Name + "额定", |
| | | Id = _vm.Id, |
| | | Name = _vm.Name + "额定", |
| | | Q = flow, |
| | | H = head, |
| | | E = eff, |
| | | P = power, |
| | | Hz = _operation_vm.RatedHz, |
| | | N = _operation_vm.RatedN |
| | | Hz = _vm.RatedHz, |
| | | N = _vm.RatedN |
| | | }); |
| | | |
| | | if (_operation_vm.CurrentStatus) |
| | | if (_vm.CurrentStatus) |
| | | { |
| | | flow = x_flow.Value; |
| | | head = _operation_vm.CurrentCurveQH.GetPointY(flow); |
| | | if (_operation_vm.CurrentCurveQP != null) |
| | | head = _vm.CurrentCurveQH.GetPointY(flow); |
| | | if (_vm.CurrentCurveQP != null) |
| | | { |
| | | power = _operation_vm.CurrentCurveQP.GetPointY(flow); |
| | | power = _vm.CurrentCurveQP.GetPointY(flow); |
| | | eff = PumpCalcHelper.CalculateE(flow, head, power.Value); |
| | | } |
| | | else if (_operation_vm.CurrentCurveQE != null) |
| | | else if (_vm.CurrentCurveQE != null) |
| | | { |
| | | eff = _operation_vm.CurrentCurveQE.GetPointY(flow); |
| | | eff = _vm.CurrentCurveQE.GetPointY(flow); |
| | | power = PumpCalcHelper.CalculateP(flow, head, eff.Value); |
| | | } |
| | | query_pt_list.Add(new PumpQueryPointViewModel() |
| | | { |
| | | Id = _operation_vm.Id, |
| | | Name = _operation_vm.Name, |
| | | Id = _vm.Id, |
| | | Name = _vm.Name, |
| | | Q = flow, |
| | | H = head, |
| | | E = eff, |
| | | P = power, |
| | | Hz = _operation_vm.CurrentHz, |
| | | N = _operation_vm.CurrentN |
| | | Hz = _vm.CurrentHz, |
| | | N = _vm.CurrentN |
| | | }); |
| | | } |
| | | |
| | |
| | | #region Event |
| | | private void barBtnSetAxisQValue_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_operation_vm == null) |
| | | if (_vm == null) |
| | | return; |
| | | var dlg = new PumpAxisValueDlg(); |
| | | dlg.SetBindingData(); |