WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/00-core/µÈЧÏß/EqualParaCurveEListHelper.cs
@@ -1265,10 +1265,10 @@ //çæçæçº¿(ç论ç¸ä¼¼æ¢ç®è®¡ç®) public static List<CurveEqualEViewModel> CalcEqualParaCurveE( PumpCurveViewModel curveGroupExpress, PumpCurveViewModel curveGroupExpress, double maxValueD2, double minValueD2, double currentEta) @@ -1320,8 +1320,8 @@ { double simuValue2 = lastSplitValue - secondSplitSpace * j; simuCurveQH =(Yw.Pump.CurveQH) curveGroupExpress.CurveQH.ToNewByN(maxValueD2, simuValue2) ; simuCurveQE = (Yw.Pump.CurveQE)curveGroupExpress.CurveQE.ToNewByN(maxValueD2, simuValue2); simuCurveQH = (Yw.Pump.CurveQH)curveGroupExpress.CurveQH.ToNewByN(maxValueD2, simuValue2); simuCurveQE = (Yw.Pump.CurveQE)curveGroupExpress.CurveQE.ToNewByN(maxValueD2, simuValue2); var equalEffPoints2 = simuCurveQE.FeatCurve.GetPointsX(currentEta); if (equalEffPoints2 == null || equalEffPoints2.Count() == 0) {// @@ -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,15 +1402,34 @@ 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; } } //çæçæçº¿(ç°æçæçº¿æå¼è®¡ç®) public static CurveEqualEViewModel CalcEqualParaCurveE2( WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/01-pump/01-view/PumpChartViewCtrl.cs
@@ -9,13 +9,18 @@ private Yw.Vmo.PhartDiagramExGraphListVmo _vmo = null; 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) { _vmo= vmo; _vmo = vmo; if (vmo == null) { ClearBindingData(); @@ -31,7 +36,7 @@ if (vm_def == null) return; var vm_v_speed_list = vmo.GetVariableSpeedPumpCurveViewMdoelList(); var vm_v_speed_list = vmo.GetVariableSpeedPumpCurveViewMdoelList(); var vm_e_eff_list = vmo.GetCurveEqualEViewMdoelList(); var vm = new Yw.WinFrmUI.Phart.PumpCurveViewModel(); @@ -54,32 +59,29 @@ 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; eff_vm.IsClosed = item.IsClosed; vm.EqualEffList.Add(eff_vm); } } } } } //vm.VariableSpeedList = new List<Yw.WinFrmUI.Phart.PumpChartVariableSpeedViewModel>(); //vm.EqualPowerList = new List<Yw.WinFrmUI.Phart.PumpChartEqualPowerViewModel>(); //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; @@ -384,7 +383,7 @@ break; stratLineNoP--; } coordinate_paras.CoordSpaceP = coordSpaceP; coordinate_paras.EndLineNoP = endLineNoP; coordinate_paras.StartLineNoP = stratLineNoP; @@ -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
@@ -1,5 +1,5 @@ using DevExpress.Utils; using DevExpress.XtraCharts; using DevExpress.XtraCharts; namespace Yw.WinFrmUI.Phart { @@ -28,9 +28,8 @@ private ConstantLine _const_line_y; private TextAnnotation _const_txt_annotation; private PumpCoordinate _coordinate = null; private PumpCurveViewModel _vm = null; private PumpCoordinate _coordinate = null; private PumpCurveViewModel _vm = null; private bool _default_visible = false; private bool _power_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,7 +232,60 @@ } 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); } } } } #endregion @@ -245,7 +297,7 @@ /// </summary> public void ClearBindingData() { _vm = null; _vm = null; _default_visible = false; _split_panel = false; _eff_visible = false; @@ -263,7 +315,7 @@ /// </summary> public void SetBindingData(PumpCurveViewModel vm, bool default_visible = true, bool split_panel = false, bool eff_visible = false, bool power_visible = true) { _vm = vm; _vm = vm; _default_visible = default_visible; _split_panel = split_panel; _eff_visible = eff_visible; @@ -287,7 +339,7 @@ AddEquip(vm.Equip); AddVariableSpeedList(vm.VariableSpeedList); AddEqualEffList(vm.EqualEffList); AddEqualEffList(vm.EqualEffList); AddEqualPowerList(vm.EqualPowerList); if (vm.Coordinate == null) @@ -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; @@ -520,7 +571,7 @@ this.chartControl1.Series.Add(series); } private void AddAnnotation(string id, string caption, Color color, AxisYBase axis_y, XYDiagramPaneBase pane, Yw.Geometry.Point2d pt, double angle = -10) { if (pt == null) @@ -848,6 +899,7 @@ } _bottom_pane.Visibility = ChartElementVisibility.Hidden; } }