Shuxia Ning
2024-12-24 ca413cba3484fd271344c3bfb3021c7e028d1fe3
泵曲线视图更改
已修改5个文件
151 ■■■■ 文件已修改
WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/00-core/等效线/EqualParaCurveEListHelper.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/01-pump/01-view/PumpChartViewCtrl.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Phart.Core/02-pump/00-core/01-coordinate/PumpCoordinate_Disp.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Phart.Core/02-pump/01-view/PumpViewChart.Designer.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/Yw.WinFrmUI.Phart.Core/02-pump/01-view/PumpViewChart.cs 104 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/00-core/µÈЧÏß/EqualParaCurveEListHelper.cs
@@ -1382,6 +1382,7 @@
                CurveEqualEViewModel equalCurve = new CurveEqualEViewModel();
                equalCurve.IsClosed = false;
                equalCurve.DefinePoints = curveSmall;
                equalCurve.Eff = currentEta;
                equalCurves.Add(equalCurve);
            }
            else
@@ -1391,6 +1392,7 @@
                    CurveEqualEViewModel equalCurve = new CurveEqualEViewModel();
                    equalCurve.IsClosed = false;
                    equalCurve.DefinePoints = curveSmall;
                    equalCurve.Eff = currentEta;
                    equalCurves.Add(equalCurve);
                }
                if (!isMergeCurve)
@@ -1400,14 +1402,33 @@
                        CurveEqualEViewModel equalCurve = new CurveEqualEViewModel();
                        equalCurve.IsClosed = false;
                        equalCurve.DefinePoints = curveLarge;
                        equalCurve.Eff = currentEta;
                        equalCurves.Add(equalCurve);
                    }
                }
            }
            return equalCurves;
        }
        //知道原始速度和改变后的速度,求原始效率originE对应改变后的效率
        public static double GetE(double originE, double originN, double changeN, bool correct)
        {
            //变速度公式(P65页)
            if (correct)
            {
                if (changeN >= originN)
                    return originE;//不能处理转速变大的情况,不然效率可能超过100
                double ratio = originN / changeN;
                double bilv = Math.Pow(ratio, 0.17);
                return originE * 100 / (originE + (100 - originE) * bilv);
       
            }
            else
            {
                return originE;
            }
        }
      
        //生成等效线(现有等效线插值计算)
WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/01-pump/01-view/PumpChartViewCtrl.cs
@@ -11,6 +11,11 @@
        private Yw.WinFrmUI.Phart.PumpCurveViewModel _vm = null;
  
        /// <summary>
        /// æ•°æ®å˜æ›´äº‹ä»¶
        /// </summary>
        public event Action<Yw.Vmo.PhartDiagramExGraphListVmo> DataChangedEvent;
        /// <summary>
        /// ç»‘定数据
        /// </summary>
        public void SetBindingData(Yw.Vmo.PhartDiagramExGraphListVmo vmo, double nr)
@@ -54,15 +59,16 @@
                if (curve_qe != null && curve_qe.IsValid())
                {
                    var max_eff = curve_qe.GetPointList().Max(x => x.Y);
                    var eff_list = EqualParaCurveEListHelper.CalcEqualParaCurveE(vm_def, 50, 30, max_eff);
                    var eff_list = EqualParaCurveEListHelper.CalcEqualParaCurveE(vm_def, 50, 30, max_eff - 1);
                    if (eff_list != null && eff_list.Any())
                    {
                        vm.EqualEffList = new List<Yw.WinFrmUI.Phart.PumpCurveEqualEffViewModel>();
                        foreach (var item in eff_list)
                        {
                            var def_pt_list = item.DefinePoints;
                            var eff_vm = new Yw.WinFrmUI.Phart.PumpCurveEqualEffViewModel();
                            eff_vm.Id = Guid.NewGuid().ToString();
                            eff_vm.CurveName = item.Eff.ToString();
                            eff_vm.CurveName = $"{item.Eff:N1}";
                            eff_vm.Color = Color.DarkGreen;
                            eff_vm.CurveEqualEff = item.DefinePoints;
                            eff_vm.Tension = item.Tension;
@@ -72,14 +78,10 @@
                    } 
                }
                 
            }
             
            //vm.VariableSpeedList = new List<Yw.WinFrmUI.Phart.PumpChartVariableSpeedViewModel>();
            //vm.EqualPowerList = new List<Yw.WinFrmUI.Phart.PumpChartEqualPowerViewModel>();
            //for (int eff = 30; eff < 90; eff += 1)
            //{
            //    var ve = new Yw.WinFrmUI.Phart.PumpChartEqualEffViewModel();
WinFrmUI/Yw.WinFrmUI.Phart.Core/02-pump/00-core/01-coordinate/PumpCoordinate_Disp.cs
@@ -376,7 +376,6 @@
            int stratLineNoP = endLineNoP;
            double max_p = disMaxP;
            //while (max_p > min_power * 0.98)
            while (max_p > min_power)
            {
                max_p -= coordSpaceP;
@@ -397,6 +396,13 @@
                coordinate_paras.StartLineNoP += diff_num;
            }
            //确认刻度在有效刻度内 nsx
            var diff_line = coordinate_paras.EndLineNoP - coordinate_paras.StartLineNoP;
            if (diff_line < spaceNum)
            {
                coordinate_paras.StartLineNoP -= spaceNum - diff_line;
            }
            coordinate_paras.CoordMinH = CoordinateHelper.GetByPlacesLength(disMaxH - coordinate_paras.EndLineNoH * coordinate_paras.CoordSpaceH, 3);
            coordinate_paras.CoordMinP = CoordinateHelper.GetByPlacesLength(disMaxP - coordinate_paras.EndLineNoP * coordinate_paras.CoordSpaceP, 3);
WinFrmUI/Yw.WinFrmUI.Phart.Core/02-pump/01-view/PumpViewChart.Designer.cs
@@ -167,12 +167,12 @@
            bar1.OptionsBar.UseWholeRow = true;
            bar1.Text = "Custom 2";
            // 
            // PumpPureChart
            // PumpViewChart
            // 
            AutoScaleDimensions = new SizeF(10F, 22F);
            AutoScaleMode = AutoScaleMode.Font;
            Controls.Add(chartControl1);
            Name = "PumpPureChart";
            Name = "PumpViewChart";
            Size = new Size(1023, 857);
            ((System.ComponentModel.ISupportInitialize)constantLine1).EndInit();
            ((System.ComponentModel.ISupportInitialize)constantLine2).EndInit();
WinFrmUI/Yw.WinFrmUI.Phart.Core/02-pump/01-view/PumpViewChart.cs
@@ -29,7 +29,6 @@
        private TextAnnotation _const_txt_annotation; 
   
        private PumpCoordinate _coordinate = null;
        private PumpCurveViewModel _vm = null;
        private bool _default_visible = false;
@@ -119,17 +118,17 @@
        ToolTipController toolTip = new ToolTipController();
        private void chartControl1_ObjectHotTracked(object sender, HotTrackEventArgs e)
        {
            if (!_initial_data)
                return;
            if (e.AdditionalObject is SeriesPoint series_pt)
            {
                var tip = string.Format("X:{0:N1} Y:{1:N1}", series_pt.Argument, series_pt.Values[0]);
                toolTip.ShowHint(tip);
            }
            else
            {
                toolTip.HideHint();
            }
            //if (!_initial_data)
            //    return;
            //if (e.AdditionalObject is SeriesPoint series_pt)
            //{
            //    var tip = string.Format("X:{0:N1} Y:{1:N1}", series_pt.Argument, series_pt.Values[0]);
            //    toolTip.ShowHint(tip);
            //}
            //else
            //{
            //    toolTip.HideHint();
            //}
        }
@@ -233,6 +232,59 @@
        }
        private void ChartControl1_CustomPaint(object sender, CustomPaintEventArgs e)
        {
            if (!_initial_data)
                return;
            if (_vm == null)
                return;
            if (e is not DXCustomPaintEventArgs dx_args)
                return;
            var cache = dx_args.Cache;
            cache.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            if (_vm.EqualEffList != null && _vm.EqualEffList.Any())
            {
                using Pen pen = new(Color.Green, 2);
                foreach (var eq_eff in _vm.EqualEffList)
                {
                    var eq_eff_pt_list = eq_eff.CurveEqualEff;
                    if (!eq_eff.IsValid())
                        continue;
                    var pic_eq_eff_pt_list = eq_eff_pt_list.Select(x =>
                    {
                        var pt = _diagram.DiagramToPoint(x.X, x.Y, _axis_x_flow, _axis_y_head).Point;
                        return pt;
                    }).ToList();
                    var pt_count = pic_eq_eff_pt_list.Count;
                    // ç»˜åˆ¶
                    if (pt_count > 2)
                    {
                        if (eq_eff.IsClosed)
                        {
                            var path = cache.CreatePath();
                            path.AddClosedCurve(pic_eq_eff_pt_list.ToArray(), (float)eq_eff.Tension);
                            cache.DrawPath(pen, path);
                        }
                        else
                        {
                            var path = cache.CreatePath();
                            path.AddCurve(pic_eq_eff_pt_list.ToArray(), (float)eq_eff.Tension);
                            cache.DrawPath(pen, path);
                        }
                    }
                    else if (pt_count == 2)
                    {
                        cache.DrawLine(pen, pic_eq_eff_pt_list[0], pic_eq_eff_pt_list[1]);
                    }
                    else if (pt_count == 1)
                    {
                        Rectangle rc = new Rectangle(pic_eq_eff_pt_list[0].X - 2, pic_eq_eff_pt_list[0].Y - 2, 4, 4);
                        using (Brush b = new SolidBrush(pen.Color))
                            cache.FillEllipse(b, rc);
                    }
                }
            }
 
        }
@@ -320,18 +372,18 @@
            XYDiagramPaneBase bottom_pane = _split_panel ? _bottom_pane : _default_pane;
            AddLineSeries(id, color_qh, _axis_x_flow, _axis_y_head, _default_pane, qh, DashStyle.Dash);
            AddLineSeries(id, color_qh, _axis_x_flow, _axis_y_head, _default_pane, qh, DevExpress.XtraCharts.DashStyle.Dash);
            if (!string.IsNullOrEmpty(caption_qh))
                AddAnnotation(id, caption_qh, color_qh, _axis_y_head, _default_pane, qh.Last());
            if (qe != null && qe.Any() && _eff_visible)
            {
                AddLineSeries(id, color_qe, _axis_x_flow, _axis_y_eff, _default_pane, qe, DashStyle.Dash);
                AddLineSeries(id, color_qe, _axis_x_flow, _axis_y_eff, _default_pane, qe, DevExpress.XtraCharts.DashStyle.Dash);
            }
            if (qp != null && qp.Any() && _power_visible)
            {
                AddLineSeries(id, color_qp, _axis_x_flow, _axis_y_power, bottom_pane, qp, DashStyle.Dash);
                AddLineSeries(id, color_qp, _axis_x_flow, _axis_y_power, bottom_pane, qp, DevExpress.XtraCharts.DashStyle.Dash);
                if (!string.IsNullOrEmpty(caption_qp))
                {
                    AddAnnotation(id, caption_qp, color_qp, _axis_y_power, bottom_pane, qp.Last());
@@ -350,7 +402,7 @@
            var equip = vm.CurveEquip;
            var equip_pt = new Yw.Geometry.Point2d(vm.PipeQ, vm.PipeH);
            AddLineSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equip, DashStyle.DashDotDot);
            AddLineSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equip, DevExpress.XtraCharts.DashStyle.DashDotDot);
            AddPointSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, new List<Geometry.Point2d>() { equip_pt });
            if (!string.IsNullOrEmpty(caption))
                AddAnnotation(id, caption, color, _axis_y_head, _default_pane, equip.Last());
@@ -411,17 +463,17 @@
                var color = vm.Color ?? Color.Green;
                var equif_eff = vm.CurveEqualEff;
                if (equif_eff.Count < 2)
                {
                    AddPointSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equif_eff);
                }
                else
                {
                    AddLineSeries(id, color, _axis_x_flow, _axis_y_head, _default_pane, equif_eff, DashStyle.Dash);
                }
                if (!string.IsNullOrEmpty(caption))
                {
                    if (equif_eff.Count > 2)
                    {
                        AddAnnotation(id, caption, color, _axis_y_head, _default_pane, equif_eff.First(), 60);
                    }
                    AddAnnotation(id, caption, color, _axis_y_head, _default_pane, equif_eff.Last(), 60);
            }
            }
        }
        private void AddEqualPowerList(List<PumpCurveEqualPowerViewModel> vm_list)
@@ -470,7 +522,6 @@
            view.EmptyPointOptions.Color = Color.Transparent;
            view.Pane = pane;
            var series_pt_list = pt_list.Select(x => x.ToSeriesPoint()).ToArray();
            var series = new DevExpress.XtraCharts.Series();
            series.Tag = id;
@@ -488,7 +539,7 @@
            this.chartControl1.Series.Add(series);
        }
        private void AddLineSeries(string id, Color color, AxisXBase axis_x, AxisYBase axis_y, XYDiagramPaneBase pane, List<Yw.Geometry.Point2d> pt_list, DashStyle dash = DashStyle.Solid)
        private void AddLineSeries(string id, Color color, AxisXBase axis_x, AxisYBase axis_y, XYDiagramPaneBase pane, List<Yw.Geometry.Point2d> pt_list, DevExpress.XtraCharts.DashStyle dash = DevExpress.XtraCharts.DashStyle.Solid)
        {
            if (pt_list == null || !pt_list.Any())
                return;
@@ -848,6 +899,7 @@
                }
                _bottom_pane.Visibility = ChartElementVisibility.Hidden;
            }
        }