| | |
| | | using DevExpress.CodeParser; |
| | | using DevExpress.Spreadsheet; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using System; |
| | | using Yw.WinFrmUI.Phart; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | | public partial class PumpFullInfoCtrl : DevExpress.XtraEditors.XtraUserControl |
| | | public partial class PumpFullInfoCtrl : DocumentPage |
| | | { |
| | | #region 构造函数和加载函数 |
| | | |
| | |
| | | } |
| | | |
| | | private PumpMatchingViewModel _pump_mathing_vm = null; |
| | | |
| | | public void SetBindingData(PumpMatchingViewModel pumpMatchingViewModel) |
| | | { |
| | | _pump_mathing_vm = pumpMatchingViewModel; |
| | | pumpPropViewCtrl1.SetBindingData(pumpMatchingViewModel.DbId); |
| | | |
| | | if (long.TryParse(_pump_mathing_vm.DbId,out long pump_mian_id)) |
| | | { |
| | | Init(pump_mian_id); |
| | | } |
| | | if (long.TryParse(_pump_mathing_vm.DbId, out long pump_mian_id)) |
| | | { |
| | | InitData(pump_mian_id, null); |
| | | } |
| | | } |
| | | |
| | | private Yw.Geometry.CubicSpline2d _qh, _qe, _qp; |
| | | private Yw.Geometry.Point2d _work_pt; |
| | | private double _rated_speed; |
| | | |
| | | private async void Init(long pump_main_id) |
| | | private async void InitData(long pump_main_id, Yw.Geometry.Point2d work_pt) |
| | | { |
| | | var pump_main = await new BLL.AssetsPumpMain().GetByID(pump_main_id); |
| | | if (pump_main == null) |
| | |
| | | return; |
| | | } |
| | | var phart = phart_list.OrderBy(x => x.Importance).First(); |
| | | |
| | | |
| | | var diagram = phart.Diagram; |
| | | if (diagram == null) |
| | | { |
| | |
| | | var graph_qh = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQH); |
| | | var graph_qe = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQE); |
| | | var graph_qp = graph_list.Find(x => x.GraphType == HStation.PhartRelation.eGraphType.PumpQP); |
| | | |
| | | if (graph_qh == null) |
| | | { |
| | | return; |
| | |
| | | if (graph_qp != null) |
| | | points_qp = PhartPerformCurveHelper.GetFeatPointList(graph_qp.GraphType, graph_qp.GeometryInfo, 12, null); |
| | | |
| | | var cubic_spline_qh = new Yw.Geometry.CubicSpline2d(points_qh); |
| | | var cubic_spline_qe = new Yw.Geometry.CubicSpline2d(points_qe); |
| | | var cubic_spline_qp = new Yw.Geometry.CubicSpline2d(points_qp); |
| | | |
| | | var qh = new Yw.Geometry.CubicSpline2d(points_qh); |
| | | var qe = new Yw.Geometry.CubicSpline2d(points_qe); |
| | | var qp = new Yw.Geometry.CubicSpline2d(points_qp); |
| | | |
| | | var design_pt = new Yw.Geometry.Point2d(); |
| | | design_pt.X = Math.Round(cubic_spline_qh.MaxX / 2); |
| | | design_pt.Y = Math.Round(cubic_spline_qh.GetPointY(design_pt.X), 1); |
| | | |
| | | |
| | | var disp_paras = diagram.DispParas; |
| | | var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras); |
| | | this.pumpPerformChart1.SetBindingData(cubic_spline_qh, cubic_spline_qe, cubic_spline_qp, disp_paras, is_calc_disp_paras); |
| | | this.pumpPerformInfoCtrl1.SetDesignPoint(design_pt); |
| | | |
| | | var vm_vs = new Yw.WinFrmUI.Phart.PumpVariableSpeedViewModel(); |
| | | vm_vs.Id = phart.ID.ToString(); |
| | | vm_vs.Name = $"{pump_main.RatedSpeed}"; |
| | | //vm.IsBp = pump_mian.; |
| | | vm_vs.RatedSpeed = pump_main.RatedSpeed; |
| | | vm_vs.CurrentSpeed = pump_main.RatedSpeed; |
| | | vm_vs.CurrentHz = 50; |
| | | vm_vs.Qh = cubic_spline_qh; |
| | | vm_vs.Qe = cubic_spline_qe; |
| | | vm_vs.Qp = cubic_spline_qp; |
| | | |
| | | var vm_vs_info = new Yw.WinFrmUI.Phart.PumpVariableSpeedInfoViewModel(vm_vs); |
| | | vm_vs_info.Color = Color.Black; |
| | | vm_vs_info.IsDefault = true; |
| | | this.pumpVariableSpeedInfoCtrl1.SetBindingData(vm_vs_info, design_pt); |
| | | this.pumpVariableSpeedChart1.Add(vm_vs_info, design_pt); |
| | | |
| | | |
| | | var vm_sp = new Yw.WinFrmUI.Phart.PumpSerialParallelViewModel(); |
| | | vm_sp.Id = phart.ID.ToString(); |
| | | vm_sp.Name = $"{pump_main.RatedSpeed}"; |
| | | //vm.IsBp = pump_mian.; |
| | | vm_sp.RatedSpeed = pump_main.RatedSpeed; |
| | | vm_sp.CurrentSpeed = pump_main.RatedSpeed; |
| | | vm_sp.CurrentHz = 50; |
| | | vm_sp.Qh = cubic_spline_qh; |
| | | vm_sp.Qe = cubic_spline_qe; |
| | | vm_sp.Qp = cubic_spline_qp; |
| | | |
| | | var vm_sp_info = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel(vm_sp); |
| | | vm_sp_info.Color = GetRandomColor(0); |
| | | this.pumpSingleSerialParallelInfoCtrl1.SetBindingData(vm_sp_info, design_pt); |
| | | this.pumpSerialParallelChart1.Add(vm_sp_info, design_pt); |
| | | InitChart(qh, qe, qp, work_pt, pump_main.RatedSpeed); |
| | | } |
| | | |
| | | |
| | | |
| | | private void OnFrmLoad(object sender, EventArgs e) |
| | | public void InitChart( |
| | | Yw.Geometry.CubicSpline2d qh, |
| | | Yw.Geometry.CubicSpline2d qe, |
| | | Yw.Geometry.CubicSpline2d qp, |
| | | Yw.Geometry.Point2d work_pt, |
| | | double rated_speed) |
| | | { |
| | | // |
| | | InitialPropPanelWidth(); |
| | | _qh = qh; |
| | | _qe = qe; |
| | | _qp = qp; |
| | | _work_pt = work_pt; |
| | | _rated_speed = rated_speed; |
| | | |
| | | this.splitContainerControl1.SplitterPositionChanged += new System.EventHandler(this.splitContainerControl1_SplitterPositionChanged); |
| | | |
| | | // |
| | | SetCtrlStyle(); |
| | | |
| | | //detailInfoTreeTab2Ctrl1.Initial(); |
| | | |
| | | this.xtraTabCtrlMain.SelectedTabPageIndex = 0; |
| | | this.xtraTabCtrlMain.SelectedTabPage = this._tabPage性能曲线图1; |
| | | |
| | | CalcBarHeight(); |
| | | |
| | | //if (this._m3dDispCtrlType == Model.e3dDispCtrlType.BIM_EvTreeJs) |
| | | //{ |
| | | // if (this._bimWebBrowerContainter != null) |
| | | // { |
| | | // //this.xtraTabCtrlMain.SelectedTabPage = this._tabPage三维模型; |
| | | // this._bimWebBrowerContainter.Dock = DockStyle.Fill; |
| | | // this._bimWebBrowerContainter.IsActiveBrower(); |
| | | // this._tabPage三维模型.Controls.Add(_bimWebBrowerContainter); |
| | | // } |
| | | //} |
| | | //else if (this._m3dDispCtrlType == Model.e3dDispCtrlType.CAD_3DShowShow) |
| | | //{ |
| | | //} |
| | | //else if (this._m3dDispCtrlType == Model.e3dDispCtrlType.CAD_51JM) |
| | | //{ |
| | | //} |
| | | InitChart(); |
| | | } |
| | | |
| | | private void SetChart(PumpMatchingViewModel vm) |
| | | { |
| | | if (vm == null) |
| | | this.pumpPerformCompareChart1.SetBindingData(_qh, _qe, _qp); |
| | | if (work_pt != null) |
| | | { |
| | | return; |
| | | } |
| | | var calc_speed = PumpCalcHelper.GetSimuValue(qh, work_pt, rated_speed); |
| | | var calc_hz = calc_speed / rated_speed * 50; |
| | | calc_hz = Math.Round(calc_hz, 1); |
| | | this.pumpPerformCompareInfoCtrl1.SetDesignPoint(work_pt, calc_hz); |
| | | } |
| | | |
| | | var vm_vs = new Yw.WinFrmUI.Phart.PumpVariableSpeedInfoViewModel(); |
| | | vm_vs.Id = Guid.NewGuid().ToString(); |
| | | vm_vs.Name = rated_speed.ToString(); |
| | | vm_vs.RatedSpeed = rated_speed; |
| | | vm_vs.CurrentSpeed = rated_speed; |
| | | vm_vs.CurrentHz = 50; |
| | | vm_vs.Qh = _qh; |
| | | vm_vs.Qe = _qe; |
| | | vm_vs.Qp = _qp; |
| | | vm_vs.Color = Color.Black; |
| | | vm_vs.IsDefault = true; |
| | | vm_vs.Calc(); |
| | | |
| | | this.pumpVariableSpeedInfoCtrl1.SetBindingData(vm_vs, work_pt); |
| | | this.pumpVariableSpeedChart1.Add(vm_vs, work_pt); |
| | | } |
| | | |
| | | private void InitChart() |
| | | private void SetChart() |
| | | { |
| | | #region 曲线 |
| | | |
| | | this.pumpPerformInfoCtrl1.SetDesignPointEvent += (q, h) => |
| | | this.pumpPerformCompareInfoCtrl1.SetDesignPointEvent += (q, h) => |
| | | { |
| | | this.pumpPerformChart1.CalcDesignPointByQ(q, h); |
| | | _work_pt = new Yw.Geometry.Point2d(q, h); |
| | | var calc_speed = PumpCalcHelper.GetSimuValue(_qh, _work_pt, _rated_speed); |
| | | var calc_hz = calc_speed / _rated_speed * 50; |
| | | calc_hz = Math.Round(calc_hz, 1); |
| | | |
| | | var qh_wk = PumpCalcHelper.CalculateSimilarQH(_qh, 50, calc_hz); |
| | | var qe_wk = PumpCalcHelper.CalculateSimilarQE(_qe, 50, calc_hz); |
| | | var qp_wk = PumpCalcHelper.CalculateSimilarQP(_qp, 50, calc_hz); |
| | | this.pumpPerformCompareChart1.SetWkData(qh_wk, qe_wk, qp_wk); |
| | | this.pumpPerformCompareChart1.CalcDesignPointByQ(q, h); |
| | | |
| | | return calc_hz; |
| | | }; |
| | | this.pumpPerformChart1.OnCalcQueryPoint += (gropu_pt) => |
| | | |
| | | this.pumpPerformCompareInfoCtrl1.SetHzEvent += (hz) => |
| | | { |
| | | var qh_wk = PumpCalcHelper.CalculateSimilarQH(_qh, 50, hz); |
| | | var qe_wk = PumpCalcHelper.CalculateSimilarQE(_qe, 50, hz); |
| | | var qp_wk = PumpCalcHelper.CalculateSimilarQP(_qp, 50, hz); |
| | | this.pumpPerformCompareChart1.SetWkData(qh_wk, qe_wk, qp_wk); |
| | | if (_work_pt != null) |
| | | { |
| | | this.pumpPerformCompareChart1.CalcDesignPointByQ(_work_pt.X, _work_pt.Y); |
| | | } |
| | | }; |
| | | |
| | | this.pumpPerformCompareChart1.OnCalcQueryPoint += (gropu_pt) => |
| | | { |
| | | var vm_list = new List<Yw.WinFrmUI.Phart.PumpPointItmeViewModel>(); |
| | | vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel() |
| | |
| | | Value = $"{gropu_pt.Q:N1}", |
| | | Unit = "m³/h" |
| | | }); |
| | | |
| | | vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel() |
| | | { |
| | | Group = "查询点", |
| | |
| | | Value = $"{gropu_pt.H:N1}", |
| | | Unit = "m" |
| | | }); |
| | | |
| | | vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel() |
| | | { |
| | | Group = "查询点", |
| | |
| | | Value = $"{gropu_pt.E:N1}", |
| | | Unit = "%" |
| | | }); |
| | | |
| | | vm_list.Add(new Yw.WinFrmUI.Phart.PumpPointItmeViewModel() |
| | | { |
| | | Group = "查询点", |
| | |
| | | Value = $"{gropu_pt.P:N1}", |
| | | Unit = "kW" |
| | | }); |
| | | |
| | | this.pumpPerformInfoCtrl1.SetBindingData(vm_list); |
| | | this.pumpPerformCompareInfoCtrl1.SetBindingData(vm_list); |
| | | }; |
| | | |
| | | #endregion |
| | | #endregion 曲线 |
| | | |
| | | #region 变速曲线 |
| | | |
| | |
| | | this.pumpVariableSpeedInfoCtrl1.SetQueryInfo(id, pt); |
| | | }; |
| | | |
| | | |
| | | void ResetSectPointGrid() |
| | | { |
| | | var vm_list = this.pumpVariableSpeedChart1.GetList(); |
| | |
| | | |
| | | void AddBySpeed() |
| | | { |
| | | |
| | | var list = this.pumpVariableSpeedInfoCtrl1.GetList(); |
| | | if (list == null || list.Count < 1) |
| | | { |
| | |
| | | return true; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | |
| | | } |
| | | |
| | | void AddByHz() |
| | | { |
| | | |
| | | var list = this.pumpVariableSpeedInfoCtrl1.GetList(); |
| | | if (list == null || list.Count < 1) |
| | | { |
| | |
| | | dlg.ShowDialog(); |
| | | } |
| | | |
| | | #endregion 变速曲线 |
| | | } |
| | | |
| | | #endregion |
| | | private void OnFrmLoad(object sender, EventArgs e) |
| | | { |
| | | // |
| | | InitialPropPanelWidth(); |
| | | |
| | | #region 串并联曲线 |
| | | this.splitContainerControl1.SplitterPositionChanged += new System.EventHandler(this.splitContainerControl1_SplitterPositionChanged); |
| | | |
| | | string _serial_parallel_id = "serial_parallel"; |
| | | // |
| | | SetCtrlStyle(); |
| | | |
| | | this.pumpSingleSerialParallelInfoCtrl1.SetEvent += (id, design_pt, is_parallel, qh, qe, qp) => |
| | | { |
| | | this.pumpSerialParallelChart1.Set(id, qh, qe, qp); |
| | | var list = this.pumpSingleSerialParallelInfoCtrl1.GetList(); |
| | | SetSerialParallel(list, design_pt, is_parallel); |
| | | }; |
| | | //detailInfoTreeTab2Ctrl1.Initial(); |
| | | |
| | | this.pumpSingleSerialParallelInfoCtrl1.SetInfoEvent += (id, name, color) => |
| | | { |
| | | this.pumpSerialParallelChart1.SetInfo(id, name, color); |
| | | }; |
| | | this.xtraTabCtrlMain.SelectedTabPageIndex = 0; |
| | | this.xtraTabCtrlMain.SelectedTabPage = this._tabPage性能曲线图1; |
| | | |
| | | this.pumpSingleSerialParallelInfoCtrl1.SetDesignPointEvent += (q, h) => |
| | | { |
| | | this.pumpSerialParallelChart1.SetDesignPt(new Yw.Geometry.Point2d(q, h)); |
| | | }; |
| | | this.pumpSingleSerialParallelInfoCtrl1.ResetEvent += (type, count) => |
| | | { |
| | | if (count<1) |
| | | { |
| | | return; |
| | | } |
| | | var is_parallel = type == 0; |
| | | var list = this.pumpSingleSerialParallelInfoCtrl1.GetList(); |
| | | var first = list.First(); |
| | | var new_list = new List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel>(); |
| | | for (int i = 0; i <count; i++) |
| | | { |
| | | var vm = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel(first); |
| | | vm.Id = Guid.NewGuid().ToString(); |
| | | vm.Color = GetRandomColor(i); |
| | | vm.CurrentSpeed = vm.RatedSpeed; |
| | | vm.CurrentHz = 50; |
| | | vm.Calc(); |
| | | new_list.Add(vm); |
| | | } |
| | | var design_pt = this.pumpSingleSerialParallelInfoCtrl1.GetDesignPoint(); |
| | | this.pumpSingleSerialParallelInfoCtrl1.SetBindingData(new_list,design_pt); |
| | | this.pumpSerialParallelChart1.Add(new_list, design_pt); |
| | | SetSerialParallel(new_list, design_pt, is_parallel); |
| | | }; |
| | | CalcBarHeight(); |
| | | |
| | | this.pumpSerialParallelChart1.OnCalcQueryPoint += (id, pt) => |
| | | { |
| | | this.pumpSingleSerialParallelInfoCtrl1.SetQueryInfo(id, pt); |
| | | }; |
| | | |
| | | string SetSerialParallel(List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel> list, Yw.Geometry.Point2d design_pt, bool is_parallel) |
| | | { |
| | | this.pumpSerialParallelChart1.Delete(_serial_parallel_id); |
| | | if (list == null || !list.Any()) |
| | | { |
| | | return "无数据!"; |
| | | } |
| | | if (list.Count<2) |
| | | { |
| | | return "数据过少!"; |
| | | } |
| | | var vm_serial_parallel = CalcSerialParallel(list, is_parallel); |
| | | if (vm_serial_parallel == null) |
| | | { |
| | | return "无法计算串并联曲线!"; |
| | | } |
| | | |
| | | var qh = vm_serial_parallel.Qh; |
| | | var min_h = qh.GetPointY(qh.MinX); |
| | | var max_h = qh.GetPointY(qh.MaxX); |
| | | //if (design_pt != null) |
| | | //{ |
| | | // //if (design_pt.X > qh.MaxX || design_pt.X < qh.MinX) |
| | | // //{ |
| | | // // return "设计流量无效!"; |
| | | // //} |
| | | |
| | | // //if (design_pt.Y > max_h * 2 || design_pt.Y < min_h * 0.5) |
| | | // //{ |
| | | // // return "设计扬程无效!"; |
| | | // //} |
| | | //} |
| | | //else |
| | | //{ |
| | | // var design_q = qh.MaxX / 2; |
| | | // var design_h = qh.GetPointY(design_q); |
| | | // design_q = Math.Round(design_q, 1); |
| | | // design_h = Math.Round(design_h, 1); |
| | | // design_pt = new Yw.Geometry.Point2d(design_q, design_h); |
| | | // this.pumpSingleSerialParallelInfoCtrl1.SetDesignPoint(design_pt); |
| | | //} |
| | | |
| | | this.pumpSerialParallelChart1.Add(vm_serial_parallel, design_pt); |
| | | return string.Empty; |
| | | } |
| | | |
| | | Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel CalcSerialParallel(List<Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel> list, bool is_parallel) |
| | | { |
| | | if (list == null || !list.Any()) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var calc_bol = false; |
| | | var line_name = ""; |
| | | List<Yw.Geometry.Point2d> calc_pt_qh_list; |
| | | List<Yw.Geometry.Point2d> calc_pt_qe_list; |
| | | List<Yw.Geometry.Point2d> calc_pt_qp_list; |
| | | |
| | | var helper = new Yw.WinFrmUI.Phart.PumpParallelConnectionHelper(); |
| | | list.ForEach(x => helper.Add(x.QhCalc, x.QpCalc)); |
| | | if (is_parallel) |
| | | { |
| | | line_name = "并联曲线"; |
| | | calc_bol = helper.CalculateParallel(out calc_pt_qh_list, out calc_pt_qe_list, out calc_pt_qp_list); |
| | | } |
| | | else |
| | | { |
| | | line_name = "串联曲线"; |
| | | calc_bol = helper.CalculateSeries(out calc_pt_qh_list, out calc_pt_qe_list, out calc_pt_qp_list); |
| | | } |
| | | |
| | | if (!calc_bol) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var vm_sp = new Yw.WinFrmUI.Phart.PumpSerialParallelInfoViewModel(); |
| | | vm_sp.Id = _serial_parallel_id; |
| | | vm_sp.Name = line_name; |
| | | vm_sp.Qh = new Yw.Geometry.CubicSpline2d(calc_pt_qh_list); |
| | | vm_sp.Qe = new Yw.Geometry.CubicSpline2d(calc_pt_qe_list); |
| | | vm_sp.Qp = new Yw.Geometry.CubicSpline2d(calc_pt_qp_list); |
| | | vm_sp.QhCalc = vm_sp.Qh; |
| | | vm_sp.QeCalc = vm_sp.Qe; |
| | | vm_sp.QpCalc = vm_sp.Qp; |
| | | vm_sp.Color = Color.Black; |
| | | vm_sp.IsBp = true; |
| | | vm_sp.IsDefault = true; |
| | | return vm_sp; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //if (this._m3dDispCtrlType == Model.e3dDispCtrlType.BIM_EvTreeJs) |
| | | //{ |
| | | // if (this._bimWebBrowerContainter != null) |
| | | // { |
| | | // //this.xtraTabCtrlMain.SelectedTabPage = this._tabPage三维模型; |
| | | // this._bimWebBrowerContainter.Dock = DockStyle.Fill; |
| | | // this._bimWebBrowerContainter.IsActiveBrower(); |
| | | // this._tabPage三维模型.Controls.Add(_bimWebBrowerContainter); |
| | | // } |
| | | //} |
| | | //else if (this._m3dDispCtrlType == Model.e3dDispCtrlType.CAD_3DShowShow) |
| | | //{ |
| | | //} |
| | | //else if (this._m3dDispCtrlType == Model.e3dDispCtrlType.CAD_51JM) |
| | | //{ |
| | | //} |
| | | SetChart(); |
| | | } |
| | | |
| | | #region Color |
| | |
| | | return Color.FromArgb(r, g, b); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion Color |
| | | |
| | | #region 走马灯提示 |
| | | |
| | |
| | | |
| | | #endregion 走马灯提示 |
| | | |
| | | |
| | | |
| | | public void CloseFrm() |
| | | { |
| | | if (tRollTipText != null) |
| | |
| | | /// <param name="e"></param> |
| | | private void xtraTabCtrlMain_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) |
| | | { |
| | | this._tabPage串并联曲线参数.PageVisible = false; |
| | | |
| | | // |
| | | if (e.Page == this._tabPage三维模型) |
| | | { |
| | |
| | | { |
| | | this.xtraTabControlRight.SelectedTabPage = this._tabPage多速度曲线参数; |
| | | } |
| | | if (e.Page == this._tabPage串并联曲线) |
| | | { |
| | | this._tabPage串并联曲线参数.PageVisible = true; |
| | | this.xtraTabControlRight.SelectedTabPage = this._tabPage串并联曲线参数; |
| | | } |
| | | |
| | | if (e.Page == this._tabPage性能曲线图1) |
| | | { |
| | | this.xtraTabControlRight.SelectedTabPage = this.tabPage基本参数; |