duheng
2024-10-25 03503e387f4d0f4c47b061b4cc1eeb2482ebaf33
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-pump/PumpFullInfoCtrl.cs
@@ -18,22 +18,29 @@
        }
        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))
            if (long.TryParse(_pump_mathing_vm.DbId, out long pump_mian_id))
            {
                InitData(pump_mian_id,null);
            }
                InitData(pump_mian_id, null);
            }
        }
        //刷新属性值
        public void RefreshPropData()
        {
            this.pumpPropViewCtrl1.RefreshData();
        }
        private Yw.Geometry.CubicSpline2d _qh, _qe, _qp;
        private Yw.Geometry.Point2d _work_pt;
        private double _rated_speed;
        private double _rated_speed=50;
        private async void InitData(long pump_main_id, Yw.Geometry.Point2d work_pt)
        {
            var pump_main = await new BLL.AssetsPumpMain().GetByID(pump_main_id);
@@ -77,38 +84,50 @@
            var qh = new Yw.Geometry.CubicSpline2d(points_qh);
            var qe = new Yw.Geometry.CubicSpline2d(points_qe);
            var qp = new Yw.Geometry.CubicSpline2d(points_qp);
            InitChart(qh, qe, qp, work_pt, pump_main.RatedSpeed);
            InitChart(qh, qe, qp, work_pt, pump_main.RatedSpeed, pump_main.RatedSpeed, 50);
        }
        private void InitChart(
        /// <summary>
        ///
        /// </summary>
        /// <param name="qh">流量扬程线</param>
        /// <param name="qe">流量效率线</param>
        /// <param name="qp">流量功率线</param>
        /// <param name="work_pt">工作点</param>
        /// <param name="rated_spped">额定转速</param>
        /// <param name="current_speed">当前转速</param>
        /// <param name="current_hz">当前频率</param>
        public void InitChart(
            Yw.Geometry.CubicSpline2d qh,
            Yw.Geometry.CubicSpline2d qe,
            Yw.Geometry.CubicSpline2d qp,
            Yw.Geometry.Point2d work_pt,
            double rated_speed)
            double rated_spped,
            double current_speed,
            double current_hz)
        {
            _qh = qh;
            _qe = qe;
            _qp = qp;
            _work_pt = work_pt;
            _rated_speed = rated_speed;
            _rated_speed = rated_spped;
            this.pumpPerformCompareChart1.SetBindingData(_qh, _qe, _qp);
            if (work_pt != null)
            {
                var calc_speed = PumpCalcHelper.GetSimuValue(qh, work_pt, rated_speed);
                var calc_hz = calc_speed / rated_speed * 50;
                var calc_hz = PumpCalcHelper.GetSimuValue(qh, work_pt, _rated_speed);
                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.Name = current_hz.ToString();
            vm_vs.RatedSpeed = _rated_speed;
            vm_vs.CurrentSpeed = current_speed;
            vm_vs.CurrentHz = current_hz;
            vm_vs.Qh = _qh;
            vm_vs.Qe = _qe;
            vm_vs.Qp = _qp;
@@ -118,7 +137,6 @@
            this.pumpVariableSpeedInfoCtrl1.SetBindingData(vm_vs, work_pt);
            this.pumpVariableSpeedChart1.Add(vm_vs, work_pt);
        }
        private void SetChart()
@@ -127,7 +145,7 @@
            this.pumpPerformCompareInfoCtrl1.SetDesignPointEvent += (q, h) =>
            {
                _work_pt = new Yw.Geometry.Point2d(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);
@@ -147,9 +165,9 @@
                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)
                if (_work_pt != null)
                {
                    this.pumpPerformCompareChart1.CalcDesignPointByQ(_work_pt.X, _work_pt.Y);
                    this.pumpPerformCompareChart1.CalcDesignPointByQ(_work_pt.X, _work_pt.Y);
                }
            };
@@ -187,19 +205,18 @@
                this.pumpPerformCompareInfoCtrl1.SetBindingData(vm_list);
            };
            #endregion
            #endregion 曲线
            #region 变速曲线
            this.pumpVariableSpeedInfoCtrl1.SetEvent += (id, qh, qe, qp) =>
            this.pumpVariableSpeedInfoCtrl1.SetEvent += (id, hz, ex_ratio, qh, qe, qp) =>
            {
                this.pumpVariableSpeedChart1.Set(id, qh, qe, qp);
                this.pumpVariableSpeedChart1.Set(id, hz, ex_ratio, qh, qe, qp);
                ResetSectPointGrid();
            };
            this.pumpVariableSpeedInfoCtrl1.SetInfoEvent += (id, name, color) =>
            this.pumpVariableSpeedInfoCtrl1.SetInfoEvent += (id,   color) =>
            {
                this.pumpVariableSpeedChart1.SetInfo(id, name, color);
                this.pumpVariableSpeedChart1.SetInfo(id,   color);
                ResetSectPointGrid();
            };
@@ -223,7 +240,7 @@
            this.pumpVariableSpeedInfoCtrl1.SetDesignPointEvent += (q, h) =>
            {
                this.pumpVariableSpeedChart1.SetDesignPt(new Yw.Geometry.Point2d(q, h));
                this.pumpVariableSpeedChart1.SetDesignPt(q,h);
                ResetSectPointGrid();
            };
@@ -231,7 +248,6 @@
            {
                this.pumpVariableSpeedInfoCtrl1.SetQueryInfo(id, pt);
            };
            void ResetSectPointGrid()
            {
@@ -241,7 +257,6 @@
            void AddBySpeed()
            {
                var list = this.pumpVariableSpeedInfoCtrl1.GetList();
                if (list == null || list.Count < 1)
                {
@@ -273,12 +288,10 @@
                    return true;
                };
                dlg.ShowDialog();
            }
            void AddByHz()
            {
                var list = this.pumpVariableSpeedInfoCtrl1.GetList();
                if (list == null || list.Count < 1)
                {
@@ -348,12 +361,8 @@
                dlg.ShowDialog();
            }
            #endregion
            #endregion 变速曲线
        }
        private void OnFrmLoad(object sender, EventArgs e)
        {
@@ -391,8 +400,6 @@
            SetChart();
        }
        #region Color
        private List<Color> _color_array = new List<Color>()
@@ -420,7 +427,7 @@
            return Color.FromArgb(r, g, b);
        }
        #endregion
        #endregion Color
        #region 走马灯提示
@@ -504,8 +511,6 @@
        #endregion 走马灯提示
        public void CloseFrm()
        {
            if (tRollTipText != null)
@@ -546,14 +551,6 @@
        #endregion 构造函数和加载函数
        private void tabPage默认安装图2d_VisibleChanged(object sender, EventArgs e)
        {
        }
        private void tabPage系统安装图2d_VisibleChanged(object sender, EventArgs e)
        {
        }
        /// <summary>
        ///
        /// </summary>
@@ -573,7 +570,7 @@
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void xtraTabCtrlMain_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
        {
        {
            //
            if (e.Page == this._tabPage三维模型)
            {
@@ -590,7 +587,7 @@
            {
                this.xtraTabControlRight.SelectedTabPage = this._tabPage多速度曲线参数;
            }
            if (e.Page == this._tabPage性能曲线图1)
            {
                this.xtraTabControlRight.SelectedTabPage = this.tabPage基本参数;