WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/03-analy/SimulationMultiWorkingPumpAnalyCtrl.Designer.cs
@@ -32,7 +32,7 @@ hydroWorkingCheckedListHorizCtrl1 = new HydroWorkingCheckedListHorizCtrl(); hydroPumpListViewCtrl1 = new HydroPumpListViewCtrl(); panelControl1 = new PanelControl(); pumpVariableSpeedViewChart1 = new Yw.WinFrmUI.Phart.PumpVariableSpeedViewChart(); pumpVariableSpeedViewChart1 = new Yw.WinFrmUI.Phart.PumpRunViewChart(); Root = new DevExpress.XtraLayout.LayoutControlGroup(); layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup(); layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); @@ -198,7 +198,7 @@ private HydroWorkingCheckedListHorizCtrl hydroWorkingCheckedListHorizCtrl1; private HydroPumpListViewCtrl hydroPumpListViewCtrl1; private PanelControl panelControl1; private Yw.WinFrmUI.Phart.PumpVariableSpeedViewChart pumpVariableSpeedViewChart1; private Yw.WinFrmUI.Phart.PumpRunViewChart pumpVariableSpeedViewChart1; private DevExpress.XtraLayout.LayoutControlGroup Root; private DevExpress.XtraLayout.LayoutControlGroup layoutControlGroup1; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem1; WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/03-analy/SimulationMultiWorkingPumpAnalyCtrl.cs
@@ -74,7 +74,7 @@ } //å建 private PumpVariableSpeedViewViewModel CreateViewModel() private PumpRunViewViewModel CreateViewModel() { if (_hydroInfo == null) { @@ -84,7 +84,7 @@ { return default; } var vm = new PumpVariableSpeedViewViewModel(); var vm = new PumpRunViewViewModel(); vm.Id = _pumpInfo.Code; vm.Name = _pumpInfo.Name; vm.CurveName = $"é¢å®æ²çº¿({_pumpInfo.RatedHz}hz)"; @@ -126,7 +126,7 @@ if (_workingList != null && _workingList.Count > 0) { vm.Items = new List<PumpVariableSpeedViewItemViewModel>(); vm.Items = new List<PumpRunViewItemViewModel>(); foreach (var working in _workingList) { var workingInfo = JsonHelper.Json2Object<HydroWorkingInfoViewModel>(working.WorkingInfo); @@ -135,7 +135,7 @@ var workingPumpInfo = workingInfo.Pumps.Find(x => x.Code == _pumpInfo.Code); if (workingPumpInfo != null) { var vmItem = new PumpVariableSpeedViewItemViewModel(); var vmItem = new PumpRunViewItemViewModel(); vm.Items.Add(vmItem); vmItem.Id = working.ID.ToString(); vmItem.Name = working.Name; WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/03-analy/SimulationSingleWorkingPumpAnalyCtrl.Designer.cs
@@ -36,7 +36,7 @@ layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); hydroPumpListStateViewCtrl1 = new HydroPumpListStateViewCtrl(); layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); pumpVariableSpeedViewChart1 = new Yw.WinFrmUI.Phart.PumpVariableSpeedViewChart(); pumpVariableSpeedViewChart1 = new Yw.WinFrmUI.Phart.PumpRunViewChart(); ((ISupportInitialize)layoutControl1).BeginInit(); layoutControl1.SuspendLayout(); ((ISupportInitialize)panelControl1).BeginInit(); @@ -164,6 +164,6 @@ private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3; private HydroPumpListStateViewCtrl hydroPumpListStateViewCtrl1; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2; private Yw.WinFrmUI.Phart.PumpVariableSpeedViewChart pumpVariableSpeedViewChart1; private Yw.WinFrmUI.Phart.PumpRunViewChart pumpVariableSpeedViewChart1; } } WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/11-pump/03-analy/SimulationSingleWorkingPumpAnalyCtrl.cs
@@ -53,17 +53,17 @@ return; } var vm = CreateViewModel(pump); this.pumpVariableSpeedViewChart1.SetBindingData(vm); this.pumpVariableSpeedViewChart1.SetBindingData(vm); } //å建 private PumpVariableSpeedViewViewModel CreateViewModel(Yw.Model.HydroPumpInfo pump) private PumpRunViewViewModel CreateViewModel(Yw.Model.HydroPumpInfo pump) { if (_hydroInfo == null) { return default; } var vm = new PumpVariableSpeedViewViewModel(); var vm = new PumpRunViewViewModel(); vm.Id = pump.Code; vm.Name = pump.Name; vm.CurveName = $"é¢å®æ²çº¿({pump.RatedHz}hz)"; @@ -105,8 +105,8 @@ if (pump.LinkStatus == Yw.Hydro.PumpStatus.Open) { vm.Items = new List<PumpVariableSpeedViewItemViewModel>(); var vmItem = new PumpVariableSpeedViewItemViewModel(); vm.Items = new List<PumpRunViewItemViewModel>(); var vmItem = new PumpRunViewItemViewModel(); vm.Items.Add(vmItem); vmItem.Id = string.Empty; vmItem.Name = "è¿è¡"; WinFrmUI/Yw.WinFrmUI.Phart.Core/00-core/RandomColorHelper.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,64 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Yw.WinFrmUI.Phart { /// <summary> /// éæºè²è¾ å©ç±» /// </summary> public class RandomColorHelper { private static readonly List<Color> _color_array = new List<Color>() { Color.Red, Color.Blue, Color.Green,Color.DodgerBlue, Color.Fuchsia, Color.MidnightBlue, Color.Maroon, Color.Aquamarine, Color.Bisque,Color.BurlyWood }; /// <summary> /// è·åéæºé¢è² /// </summary> /// <returns></returns> public static Color Get(int count) { if (count < _color_array.Count) { return _color_array[count]; } //var _random = new Random(); //int r = _random.Next(1, 256); //int g = _random.Next(1, 256); //int b = _random.Next(1, 256); //return Color.FromArgb(r, g, b); return GetRandomDarkColor(); } private static Color GetRandomDarkColor() { Random random = new Random(); int r, g, b; do { r = random.Next(256); g = random.Next(256); b = random.Next(256); } while (CalculateBrightness(r, g, b) > 128); // ç¡®ä¿é¢è²æ¯æ·±è² return Color.FromArgb(r, g, b); } private static int CalculateBrightness(int r, int g, int b) { // 计ç®é¢è²ç亮度ï¼äº®åº¦å¼è¶ä½ï¼é¢è²è¶æ·± return (r + g + b) / 3; } } } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/01-view/PumpViewChart.cs
@@ -279,13 +279,13 @@ } List<Yw.Geometry.Point2d> qh_pt_list, qe_pt_list = null, qp_pt_list = null; qh_pt_list = qh.GetPointList(12); qh_pt_list = qh.GetPointList(100); if (qe != null) qe_pt_list = qe.GetPointList(12); qe_pt_list = qe.GetPointList(100); if (qp != null) qp_pt_list = qp.GetPointList(12); qp_pt_list = qp.GetPointList(100); SetBindingData(qh, qe, qp, qh_pt_list, qe_pt_list, qp_pt_list, null, qe_pt_list, null, coordinate_paras, calc_coordinate); } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/02-operation/PumpOperationChart.cs
@@ -260,14 +260,14 @@ return; } start_head ??= _coordinate.DispMinH(); start_head ??= _coordinate.DispMinH(); 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; _equip_line = equip_line; _equip_sect_pt = sect_pt; double flow = 0, head = 0; double? eff = null, power = null; flow = sect_pt.X; @@ -282,12 +282,12 @@ eff = _vm.CurveQE.GetPointY(flow); power = PumpCalcHelper.CalculateP(flow, head, eff.Value); } var design_pt_list = new List<PumpDesignPointViewModel> { new() { Id = _vm.Id + "é¢å®", Name = _vm.Name + "(é¢å®)", Id = _vm.Id, Name = _vm.Name, Q = flow, H = head, E = eff, @@ -295,12 +295,12 @@ Hz = _vm.RatedHz, N = _vm.RatedN } }; }; if (_vm.CurrentStatus) { 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) if (current_sect_pt == null) return; double current_flow = 0, current_head = 0; double? current_eff = null, current_power = null; @@ -315,7 +315,7 @@ { current_eff = _vm.CurrentCurveQE.GetPointY(current_flow); current_power = PumpCalcHelper.CalculateP(current_flow, current_head, current_eff.Value); } } design_pt_list.Add(new() { @@ -329,7 +329,7 @@ N = _vm.CurrentN }); } } this.DesignPointChangedEvent?.Invoke(design_pt_list); UpdateChart(true); @@ -560,7 +560,7 @@ } //åç if (_max_power > _min_power) if (_max_power > _min_power && _qp_visible) { //计ç®å»åº¦ var labels = new List<CustomAxisLabel>(); @@ -782,7 +782,7 @@ series_qh.View = series_qh_view; series_qh.Visible = true; var pt_qh_list = vm.CurveQH.GetPointList(12); var pt_qh_list = vm.CurveQH.GetPointList(100); for (int i = 0; i < pt_qh_list.Count; i++) { series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y })); @@ -816,7 +816,7 @@ txt_qh.RuntimeMoving = true; txt_qh.RuntimeResizing = false; txt_qh.RuntimeRotation = false; txt_qh.Text = vm.Name; txt_qh.Text = $"{vm.RatedN}({vm.RatedHz}hz)"; txt_qh.TextColor = PumpChartDisplay.CurveColorQH; txt_qh.ShapePosition = position_qh; txt_qh.Visible = _line_name_visible; @@ -848,7 +848,7 @@ series_qe.Visible = _qe_visible; var pt_qe_list = vm.CurveQE.GetPointList(12); var pt_qe_list = vm.CurveQE.GetPointList(100); for (int i = 0; i < pt_qe_list.Count; i++) { series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y })); @@ -881,7 +881,7 @@ series_qp.View = series_qp_view; series_qp.Visible = _qp_visible; var pt_qp_list = vm.CurveQP.GetPointList(12); var pt_qp_list = vm.CurveQP.GetPointList(100); for (int i = 0; i < pt_qp_list.Count; i++) { series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y })); @@ -917,7 +917,7 @@ series_qh.View = series_qh_view; series_qh.Visible = true; var pt_qh_list = vm.CurrentCurveQH.GetPointList(12); var pt_qh_list = vm.CurrentCurveQH.GetPointList(100); for (int i = 0; i < pt_qh_list.Count; i++) { series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y })); @@ -951,7 +951,7 @@ txt_qh.RuntimeMoving = true; txt_qh.RuntimeResizing = false; txt_qh.RuntimeRotation = false; txt_qh.Text = vm.Name; txt_qh.Text = $"{vm.CurrentN}({vm.CurrentHz}hz)"; txt_qh.TextColor = PumpChartDisplay.CurveColorQH; txt_qh.ShapePosition = position_qh; txt_qh.Visible = _line_name_visible; @@ -981,7 +981,7 @@ series_qe.View = series_qe_view; series_qe.Visible = _qe_visible; var pt_qe_list = vm.CurrentCurveQE.GetPointList(12); var pt_qe_list = vm.CurrentCurveQE.GetPointList(100); for (int i = 0; i < pt_qe_list.Count; i++) { series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y })); @@ -1013,7 +1013,7 @@ series_qp.View = series_qp_view; series_qp.Visible = _qp_visible; var pt_qp_list = vm.CurrentCurveQP.GetPointList(12); var pt_qp_list = vm.CurrentCurveQP.GetPointList(100); for (int i = 0; i < pt_qp_list.Count; i++) { series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y })); WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/02-operation/PumpOperationViewModel.cs
@@ -9,7 +9,7 @@ public PumpOperationViewModel(PumpOperationViewModel rhs) { this.Id = rhs.Id; this.Name = rhs.Name; this.Name = rhs.Name; this.RatedQ = rhs.RatedQ; this.RatedH = rhs.RatedH; this.RatedP = rhs.RatedP; @@ -37,6 +37,7 @@ /// åç§° /// </summary> public string Name { get; set; } /// <summary> /// é¢å®æµé WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/03-variable-speed/PumpVariableSpeedChart.cs
@@ -1,8 +1,6 @@ using DevExpress.Utils; using DevExpress.Utils.Drawing; using DevExpress.XtraCharts; using System.Text; using Yw.Geometry; namespace Yw.WinFrmUI.Phart { @@ -514,7 +512,7 @@ } //åç if (_max_power > _min_power) if (_max_power > _min_power && _qp_visible) { //计ç®å»åº¦ var labels = new List<CustomAxisLabel>(); @@ -687,7 +685,7 @@ series_qh.View = series_qh_view; series_qh.Visible = true; var pt_qh_list = vm.CurrentCurveQH.GetPointList(12); var pt_qh_list = vm.CurrentCurveQH.GetPointList(100); for (int i = 0; i < pt_qh_list.Count; i++) { series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y })); @@ -751,7 +749,7 @@ series_qe.View = series_qe_view; series_qe.Visible = _qe_visible; var pt_qe_list = vm.CurrentCurveQE.GetPointList(12); var pt_qe_list = vm.CurrentCurveQE.GetPointList(100); for (int i = 0; i < pt_qe_list.Count; i++) { series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y })); @@ -783,7 +781,7 @@ series_qp.View = series_qp_view; series_qp.Visible = _qp_visible; var pt_qp_list = vm.CurrentCurveQP.GetPointList(12); var pt_qp_list = vm.CurrentCurveQP.GetPointList(100); for (int i = 0; i < pt_qp_list.Count; i++) { series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y })); WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/03-variable-speed/PumpVariableSpeedViewItemViewModel.cscopy from WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-variable-speed-view/PumpVariableSpeedViewItemViewModel.cs copy to WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/03-variable-speed/PumpVariableSpeedViewItemViewModel.cs
Îļþ´Ó WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-variable-speed-view/PumpVariableSpeedViewItemViewModel.cs ¸´ÖÆ @@ -3,18 +3,14 @@ /// <summary> /// æ³µåé Item ViewModel /// </summary> public class PumpVariableSpeedViewItemViewModel public class PumpVariableSpeedItemViewModel { public PumpVariableSpeedViewItemViewModel() { } public PumpVariableSpeedViewItemViewModel(PumpVariableSpeedViewItemViewModel rhs) public PumpVariableSpeedItemViewModel() { } public PumpVariableSpeedItemViewModel(PumpVariableSpeedItemViewModel rhs) { this.Id = rhs.Id; this.Name = rhs.Name; this.CurveName = rhs.CurveName; this.Q = rhs.Q; this.H = rhs.H; this.P = rhs.P; this.N = rhs.N; this.CurveName = rhs.CurveName; this.Hz = rhs.Hz; this.CurveQH = rhs.CurveQH; @@ -37,31 +33,7 @@ /// </summary> public string CurveName { get; set; } /// <summary> /// æµé /// </summary> public double Q { get; set; } /// <summary> /// æ¬ç¨ /// </summary> public double H { get; set; } /// <summary> /// åç /// </summary> public double? P { get; set; } /// <summary> /// æç /// </summary> public double? E { get; set; } /// <summary> /// 转é /// </summary> public double N { get; set; } /// <summary> /// é¢ç /// </summary> @@ -81,6 +53,11 @@ /// æµéåç线 /// </summary> public Yw.Geometry.CubicSpline2d CurveQP { get; set; } /// <summary> /// é¢è² /// </summary> public Color Color { get; set; } } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/03-variable-speed/PumpVariableSpeedViewModel.cs
@@ -10,23 +10,19 @@ { this.Id = rhs.Id; this.Name = rhs.Name; this.CurveName = rhs.CurveName; this.RatedQ = rhs.RatedQ; this.RatedH = rhs.RatedH; this.RatedP = rhs.RatedP; this.RatedN = rhs.RatedN; this.RatedHz = rhs.RatedHz; this.CurrentN = rhs.CurrentN; this.CurrentHz = rhs.CurrentHz; this.CurrentColor = rhs.CurrentColor; this.RatedHz = rhs.RatedHz; this.CurveQH = rhs.CurveQH; this.CurveQE = rhs.CurveQE; this.CurveQP = rhs.CurveQP; this.CurrentCurveQH= rhs.CurrentCurveQH; this.CurrentCurveQE= rhs.CurrentCurveQE; this.CurrentCurveQP = rhs.CurrentCurveQP; this.EquipPoint = rhs.EquipPoint; this.CurveQP = rhs.CurveQP; } /// <summary> /// æ è¯ @@ -37,7 +33,7 @@ /// åç§° /// </summary> public string Name { get; set; } /// <summary> /// åç§° /// </summary> @@ -68,20 +64,6 @@ /// </summary> public double RatedHz { get; set; } /// <summary> /// å½å转é /// </summary> public double CurrentN { get; set; } /// <summary> /// å½åé¢ç /// </summary> public double CurrentHz { get; set; } /// <summary> /// å½åé¢è² /// </summary> public Color CurrentColor { get; set; } /// <summary> /// æµéæ¬ç¨çº¿ @@ -97,27 +79,16 @@ /// æµéåç线 /// </summary> public Yw.Geometry.CubicSpline2d CurveQP { get; set; } /// <summary> /// åé项å表 /// </summary> public List<PumpVariableSpeedViewItemViewModel> Items { get; set; } /// <summary> /// å½åæµéæ¬ç¨çº¿ /// é¢è² /// </summary> public Yw.Geometry.CubicSpline2d CurrentCurveQH { get; set; } /// <summary> /// å½åæµéæç线 /// </summary> public Yw.Geometry.CubicSpline2d CurrentCurveQE { get; set; } /// <summary> /// å½åæµéåç线 /// </summary> public Yw.Geometry.CubicSpline2d CurrentCurveQP { get; set; } /// <summary> /// è£ ç½®ç¹ /// </summary> public Yw.Geometry.Point2d EquipPoint { get; set; } public Color Color { get; set; } } } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/03-variable-speed/PumpVariableSpeedViewModel1.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,123 @@ namespace Yw.WinFrmUI.Phart { /// <summary> /// æ³µåéViewModel /// </summary> public class PumpVariableSpeedViewModel { public PumpVariableSpeedViewModel() { } public PumpVariableSpeedViewModel(PumpVariableSpeedViewModel rhs) { this.Id = rhs.Id; this.Name = rhs.Name; this.RatedQ = rhs.RatedQ; this.RatedH = rhs.RatedH; this.RatedP = rhs.RatedP; this.RatedN = rhs.RatedN; this.RatedHz = rhs.RatedHz; this.CurrentN = rhs.CurrentN; this.CurrentHz = rhs.CurrentHz; this.CurrentColor = rhs.CurrentColor; this.CurveQH = rhs.CurveQH; this.CurveQE = rhs.CurveQE; this.CurveQP = rhs.CurveQP; this.CurrentCurveQH= rhs.CurrentCurveQH; this.CurrentCurveQE= rhs.CurrentCurveQE; this.CurrentCurveQP = rhs.CurrentCurveQP; this.EquipPoint = rhs.EquipPoint; } /// <summary> /// æ è¯ /// </summary> public string Id { get; set; } /// <summary> /// åç§° /// </summary> public string Name { get; set; } /// <summary> /// åç§° /// </summary> public string CurveName { get; set; } /// <summary> /// é¢å®æµé /// </summary> public double RatedQ { get; set; } /// <summary> /// é¢å®æ¬ç¨ /// </summary> public double RatedH { get; set; } /// <summary> /// é¢å®åç /// </summary> public double RatedP { get; set; } /// <summary> /// é¢å®è½¬é /// </summary> public double RatedN { get; set; } /// <summary> /// é¢å®é¢ç /// </summary> public double RatedHz { get; set; } /// <summary> /// å½å转é /// </summary> public double CurrentN { get; set; } /// <summary> /// å½åé¢ç /// </summary> public double CurrentHz { get; set; } /// <summary> /// å½åé¢è² /// </summary> public Color CurrentColor { get; set; } /// <summary> /// æµéæ¬ç¨çº¿ /// </summary> public Yw.Geometry.CubicSpline2d CurveQH { get; set; } /// <summary> /// æµéæç线 /// </summary> public Yw.Geometry.CubicSpline2d CurveQE { get; set; } /// <summary> /// æµéåç线 /// </summary> public Yw.Geometry.CubicSpline2d CurveQP { get; set; } /// <summary> /// å½åæµéæ¬ç¨çº¿ /// </summary> public Yw.Geometry.CubicSpline2d CurrentCurveQH { get; set; } /// <summary> /// å½åæµéæç线 /// </summary> public Yw.Geometry.CubicSpline2d CurrentCurveQE { get; set; } /// <summary> /// å½åæµéåç线 /// </summary> public Yw.Geometry.CubicSpline2d CurrentCurveQP { get; set; } /// <summary> /// è£ ç½®ç¹ /// </summary> public Yw.Geometry.Point2d EquipPoint { get; set; } } } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-run-view/PumpRunViewChart.Designer.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-variable-speed-view/PumpVariableSpeedViewChart.Designer.cs ÐÞ¸Ä @@ -1,6 +1,6 @@ namespace Yw.WinFrmUI.Phart { partial class PumpVariableSpeedViewChart partial class PumpRunViewChart { /// <summary> /// Requipuired designer variable. @@ -29,11 +29,7 @@ private void InitializeComponent() { components = new System.ComponentModel.Container(); DevExpress.XtraCharts.TextAnnotation textAnnotation1 = new DevExpress.XtraCharts.TextAnnotation(); DevExpress.XtraCharts.ChartAnchorPoint chartAnchorPoint1 = new DevExpress.XtraCharts.ChartAnchorPoint(); DevExpress.XtraCharts.RelativePosition relativePosition1 = new DevExpress.XtraCharts.RelativePosition(); DevExpress.XtraCharts.XYDiagram xyDiagram1 = new DevExpress.XtraCharts.XYDiagram(); DevExpress.XtraCharts.ConstantLine constantLine1 = new DevExpress.XtraCharts.ConstantLine(); DevExpress.XtraCharts.LayoutDefinition layoutDefinition1 = new DevExpress.XtraCharts.LayoutDefinition(); DevExpress.XtraCharts.LayoutDefinition layoutDefinition2 = new DevExpress.XtraCharts.LayoutDefinition(); DevExpress.XtraCharts.LayoutDefinition layoutDefinition3 = new DevExpress.XtraCharts.LayoutDefinition(); @@ -46,7 +42,7 @@ DevExpress.XtraCharts.SplineSeriesView splineSeriesView2 = new DevExpress.XtraCharts.SplineSeriesView(); DevExpress.XtraCharts.Series series3 = new DevExpress.XtraCharts.Series(); DevExpress.XtraCharts.SplineSeriesView splineSeriesView3 = new DevExpress.XtraCharts.SplineSeriesView(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PumpVariableSpeedViewChart)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PumpRunViewChart)); chartControl1 = new DevExpress.XtraCharts.ChartControl(); barBtnSetChartAxis = new DevExpress.XtraBars.BarButtonItem(); barCekCurveQEVisible = new DevExpress.XtraBars.BarCheckItem(); @@ -61,9 +57,7 @@ barDockControlRight = new DevExpress.XtraBars.BarDockControl(); bar1 = new DevExpress.XtraBars.Bar(); ((System.ComponentModel.ISupportInitialize)chartControl1).BeginInit(); ((System.ComponentModel.ISupportInitialize)textAnnotation1).BeginInit(); ((System.ComponentModel.ISupportInitialize)xyDiagram1).BeginInit(); ((System.ComponentModel.ISupportInitialize)constantLine1).BeginInit(); ((System.ComponentModel.ISupportInitialize)xyDiagramPane1).BeginInit(); ((System.ComponentModel.ISupportInitialize)secondaryAxisy1).BeginInit(); ((System.ComponentModel.ISupportInitialize)secondaryAxisy2).BeginInit(); @@ -78,31 +72,7 @@ // // chartControl1 // chartAnchorPoint1.X = 951; chartAnchorPoint1.Y = 30; textAnnotation1.AnchorPoint = chartAnchorPoint1; textAnnotation1.AnnotationID = 0; textAnnotation1.AutoHeight = true; textAnnotation1.AutoWidth = true; textAnnotation1.BackColor = Color.FromArgb(255, 255, 255); textAnnotation1.ConnectorStyle = DevExpress.XtraCharts.AnnotationConnectorStyle.None; textAnnotation1.Name = "TextAnnoWorkPoint"; relativePosition1.Angle = -131.51672853100234D; relativePosition1.ConnectorLength = 81.467785044151043D; textAnnotation1.ShapePosition = relativePosition1; textAnnotation1.Text = "å·¥ä½ç¹"; textAnnotation1.TextColor = Color.FromArgb(0, 0, 0); chartControl1.AnnotationRepository.AddRange(new DevExpress.XtraCharts.Annotation[] { textAnnotation1 }); chartControl1.BorderOptions.Visibility = DevExpress.Utils.DefaultBoolean.False; constantLine1.AxisValueSerializable = "1"; constantLine1.ConstantLineID = 0; constantLine1.LineStyle.LineJoin = System.Drawing.Drawing2D.LineJoin.Miter; constantLine1.LineStyle.Thickness = 2; constantLine1.Name = "WorkPointLine"; constantLine1.ShowInLegend = false; constantLine1.Title.DXFont = new DevExpress.Drawing.DXFont("Tahoma", 8F); constantLine1.Title.Text = "å·¥ä½ç¹"; xyDiagram1.AxisX.ConstantLines.AddRange(new DevExpress.XtraCharts.ConstantLine[] { constantLine1 }); xyDiagram1.AxisX.Title.Text = "æµé ï¼m³/hï¼"; xyDiagram1.AxisX.Title.Visibility = DevExpress.Utils.DefaultBoolean.Default; xyDiagram1.AxisX.VisibleInPanesSerializable = "-1"; @@ -213,7 +183,7 @@ // barCekCurveEQVisible // barCekCurveEQVisible.BindableChecked = true; barCekCurveEQVisible.Caption = "è£ ç½®çº¿"; barCekCurveEQVisible.Caption = "è¿è¡ç¹"; barCekCurveEQVisible.Checked = true; barCekCurveEQVisible.Id = 22; barCekCurveEQVisible.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("barCekCurveEQVisible.ImageOptions.SvgImage"); @@ -310,8 +280,6 @@ Controls.Add(barDockControlTop); Name = "PumpVariableSpeedViewChart"; Size = new Size(1023, 857); ((System.ComponentModel.ISupportInitialize)textAnnotation1).EndInit(); ((System.ComponentModel.ISupportInitialize)constantLine1).EndInit(); ((System.ComponentModel.ISupportInitialize)xyDiagramPane1).EndInit(); ((System.ComponentModel.ISupportInitialize)secondaryAxisy1).EndInit(); ((System.ComponentModel.ISupportInitialize)secondaryAxisy2).EndInit(); WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-run-view/PumpRunViewChart.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-variable-speed-view/PumpVariableSpeedViewChart.cs ÐÞ¸Ä @@ -5,11 +5,11 @@ namespace Yw.WinFrmUI.Phart { /// <summary> /// æ³µåéè§å¾å¾è¡¨ /// æ³µè¿è¡è§å¾å¾è¡¨ /// </summary> public partial class PumpVariableSpeedViewChart : DevExpress.XtraEditors.XtraUserControl public partial class PumpRunViewChart : DevExpress.XtraEditors.XtraUserControl { public PumpVariableSpeedViewChart() public PumpRunViewChart() { InitializeComponent(); InitialChart(); @@ -17,40 +17,36 @@ } #region Private Variable private readonly string _tag_qh = "QH", _tag_qe = "QE", _tag_qp = "QP"; private XYDiagram _diagram; private XYDiagramDefaultPane _default_pane; private XYDiagramDefaultPane _default_pane; private XYDiagramPane _bottom_pane; private AxisX _axis_x_flow; private AxisY _axis_y_head; private SecondaryAxisY _axis_y_eff, _axis_y_power; private SecondaryAxisY _axis_y_eff, _axis_y_power; private PumpCoordinate _coordinate; private bool _qe_visible = true; private bool _qp_visible = true; private bool _equip_visible = true; private Yw.Geometry.CubicSpline2d _equip_line = null; private Yw.Geometry.Point2d _equip_pt = null; private List<Tuple<string, Yw.Geometry.Point2d, Yw.Geometry.Point2d, Yw.Geometry.Point2d>> _equip_sect_pt_list; private bool _run_visible = true; private bool _initial_data = false; private PumpVariableSpeedViewViewModel _vm = null; private PumpRunViewViewModel _vm = null; #endregion #region Public Evnet /// <summary> /// åæ åæ¢äºä»¶ /// </summary> public event Action<PumpCoordinate> CoordinateChangedEvent = null; #endregion #region Initial @@ -64,11 +60,11 @@ this.chartControl1.Legend.Direction = DevExpress.XtraCharts.LegendDirection.TopToBottom; _diagram = (XYDiagram)this.chartControl1.Diagram; _default_pane = _diagram.DefaultPane; _default_pane = _diagram.DefaultPane; _bottom_pane = (XYDiagramPane)_diagram.FindPaneByName("BottomPanel"); _axis_x_flow = _diagram.AxisX; _axis_x_flow.SetAxisXQDisplay(); _axis_x_flow.SetAxisXQDisplay(); _axis_y_head = _diagram.AxisY; _axis_y_head.SetAxisYQHDisplay(); _axis_y_eff = _diagram.SecondaryAxesY.GetAxisByName("AxisYQE"); @@ -77,7 +73,7 @@ _axis_y_power = _diagram.SecondaryAxesY.GetAxisByName("AxisYQP"); _axis_y_power.SetSecondaryAxisYQPDisplay(); this.chartControl1.SetChartMonoColorDisplay(); _axis_x_flow.Visibility = DefaultBoolean.False; _axis_x_flow.GridLines.Visible = false; @@ -87,7 +83,7 @@ _axis_y_eff.GridLines.Visible = false; _axis_y_power.Visibility = DefaultBoolean.False; _axis_y_power.GridLines.Visible = false; this.chartControl1.CustomPaint += ChartControl1_CustomPaint; } @@ -99,68 +95,34 @@ if (_vm == null) return; if (_equip_line != null && _equip_sect_pt_list != null && _equip_sect_pt_list.Any() && _equip_visible) if (_vm.Items!=null&&_vm.Items.Any()&& _run_visible) { using Pen pen = new(Color.Black, 2); pen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; foreach (var tuple in _equip_sect_pt_list) foreach (var vm in _vm.Items) { DrawEquipPoint(dxArgs.Cache, pen, tuple.Item2, tuple.Item3, tuple.Item4); var color = vm.Color; var flow = vm.Q; var head = vm.H; var eff = vm.E; var power = vm.P; DrawWorkPoint(dxArgs.Cache, color, _axis_y_head, flow, head); if (eff.HasValue && _qe_visible) DrawWorkPoint(dxArgs.Cache, color, _axis_y_eff, flow, eff.Value); if (power.HasValue && _qp_visible) DrawWorkPoint(dxArgs.Cache, color, _axis_y_power, flow, power.Value); } DrawEquipLine(dxArgs.Cache, pen, _equip_line); } } private void DrawEquipLine(GraphicsCache cache, Pen pen, Yw.Geometry.CubicSpline2d qh) private void DrawWorkPoint(GraphicsCache cache, Color color, AxisYBase axis_y, double x, double y) { if (qh == null) return; var pt_list = qh.GetPointList().ToArray(); var pt_f_list = new List<PointF>(); foreach (var pt in pt_list) { var x = pt.X; var y = pt.Y; var c_pt = _diagram.DiagramToPoint(x, y, _axis_x_flow, _axis_y_head); pt_f_list.Add(new PointF(c_pt.Point.X, c_pt.Point.Y)); } using var path = new System.Drawing.Drawing2D.GraphicsPath(); path.AddCurve(pt_f_list.ToArray()); cache.DrawPath(pen, path); var dg_pt = _diagram.DiagramToPoint(x, y, _axis_x_flow, axis_y); cache.FillEllipse((int)(dg_pt.Point.X - 5), (int)(dg_pt.Point.Y - 5), 10, 10, color); } private void DrawEquipPoint(GraphicsCache cache, Pen pen, Yw.Geometry.Point2d qh_sect_pt, Yw.Geometry.Point2d qe_sect_pt, Yw.Geometry.Point2d qp_sect_pt) { if (qh_sect_pt == null) return; var offset_size = 10; var qh_x = qh_sect_pt.X; var qh_pt = _diagram.DiagramToPoint(qh_sect_pt.X, qh_sect_pt.Y, _axis_x_flow, _axis_y_head); var qh_pt_x = qh_pt.Point.X; var qh_pt_y = qh_pt.Point.Y; cache.DrawLine(pen, new Point(qh_pt_x, qh_pt_y - offset_size), new Point(qh_pt_x, qh_pt_y + offset_size)); if (qe_sect_pt != null && _qe_visible) { var qe_pt = _diagram.DiagramToPoint(qe_sect_pt.X, qe_sect_pt.Y, _axis_x_flow, _axis_y_eff); var qe_pt_x = qe_pt.Point.X; var qe_pt_y = qe_pt.Point.Y; cache.DrawLine(pen, new Point(qe_pt_x, qe_pt_y - offset_size), new Point(qe_pt_x, qe_pt_y + offset_size)); } if (qp_sect_pt != null && _qp_visible) { var qp_pt = _diagram.DiagramToPoint(qp_sect_pt.X, qp_sect_pt.Y, _axis_x_flow, _axis_y_power); var qp_pt_x = qp_pt.Point.X; var qp_pt_y = qp_pt.Point.Y; cache.DrawLine(pen, new Point(qp_pt_x, qp_pt_y - offset_size), new Point(qp_pt_x, qp_pt_y + offset_size)); } } /// <summary> /// åå§åå¾è¡¨æ°æ® /// </summary> @@ -179,83 +141,14 @@ /// <summary> /// ç»å®æ°æ® /// </summary> public void SetBindingData(PumpVariableSpeedViewViewModel vm) public void SetBindingData(PumpRunViewViewModel vm) { _vm = vm; _initial_data = vm != null; UpdateChart(true); } /// <summary> /// è®¾ç½®è®¾è®¡ç¹ /// </summary> public void SetDesignPoint(double x, double y, double? start_head = null) { _equip_pt = new Geometry.Point2d(x, y); _equip_line = null; _equip_sect_pt_list = null; if (_vm == null) { return; } start_head ??= _coordinate.DispMinH(); 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; _equip_line = equip_line; _equip_sect_pt_list = new List<Tuple<string, Geometry.Point2d, Geometry.Point2d, Geometry.Point2d>>(); Yw.Geometry.Point2d sect_pt_eff=null, sect_pt_power = null; if (_vm.CurveQE != null) { var eff = _vm.CurveQE.GetPointY(sect_pt.X); sect_pt_eff = new Geometry.Point2d(sect_pt.X, eff); } if (_vm.CurveQP != null) { var power = _vm.CurveQP.GetPointY(sect_pt.X); sect_pt_power = new Geometry.Point2d(sect_pt.X, power); } _equip_sect_pt_list.Add(new(_vm.Id, sect_pt,sect_pt_eff, sect_pt_power)); foreach (var vm in _vm.Items) { double flow = 0, head = 0; double? eff = null, power = null; var pump_equip_line = Yw.Geometry.EquipCurveHelper.CalcEquipCurve(vm.CurveQH, _equip_pt, start_head.Value, out Yw.Geometry.Point2d pump_sect_pt); if (pump_equip_line == null || pump_sect_pt == null) return; Yw.Geometry.Point2d pump_sect_pt_eff = null, pump_sect_pt_power = null; flow = pump_sect_pt.X; head = vm.CurveQH.GetPointYUnlimited(flow); if (vm.CurveQP != null) { power = vm.CurveQP.GetPointYUnlimited(flow); eff = PumpCalcHelper.CalculateE(flow, head, power.Value); pump_sect_pt_eff = new Geometry.Point2d(flow, eff.Value); pump_sect_pt_power = new Geometry.Point2d(flow, power.Value); } else if (vm.CurveQE != null) { eff = vm.CurveQE.GetPointYUnlimited(flow); power = PumpCalcHelper.CalculateP(flow, head, eff.Value); pump_sect_pt_eff = new Geometry.Point2d(flow, eff.Value); pump_sect_pt_power = new Geometry.Point2d(flow, power.Value); } _equip_sect_pt_list.Add(new(vm.Id, new Geometry.Point2d(flow, head), pump_sect_pt_eff, pump_sect_pt_power)); } UpdateChart(true); } /// <summary> /// æ¸ ç©ºæ²çº¿ /// </summary> @@ -279,7 +172,7 @@ CalcSeries(); CalcChartAxis(); CalcChartAxis(); } #endregion @@ -416,11 +309,9 @@ _axis_y_eff.GridLines.Visible = false; _axis_y_power.Visibility = DefaultBoolean.False; _axis_y_power.GridLines.Visible = false; _bottom_pane.Visibility = ChartElementVisibility.Hidden; _bottom_pane.Visibility = _qp_visible ? ChartElementVisibility.Visible : ChartElementVisibility.Hidden; //计ç®å»åº¦ Q @@ -471,7 +362,7 @@ } //åç if (_max_power > _min_power) if (_max_power > _min_power && _qp_visible) { //计ç®å»åº¦ var labels = new List<CustomAxisLabel>(); @@ -511,7 +402,7 @@ var grid_count_power = _coordinate.EndLineNoP - _coordinate.StartLineNoP; var min_axis_power = _coordinate.CoordMinP + _coordinate.StartLineNoP * _coordinate.CoordSpaceP; var max_axis_power = min_axis_power + grid_count_power * _coordinate.CoordSpaceP; _axis_y_power.SetAxisRange(min_axis_power, max_axis_power); _axis_y_power.SetAxisRange(min_axis_power, max_axis_power); } /// <summary> @@ -521,36 +412,174 @@ { this.chartControl1.BeginInit(); this.chartControl1.Series.Clear(); var annotation_count = this.chartControl1.AnnotationRepository.Count; for (int i = annotation_count - 1; i > 0; i--) { if (i == 0) break; this.chartControl1.AnnotationRepository.RemoveAt(i); } this.chartControl1.AnnotationRepository.Clear(); this.chartControl1.Legend.CustomItems.Clear(); if (_vm != null) { CreateLineSeries(_vm.Id, _vm.Name, _vm.CurveQH, _vm.CurveQE, _vm.CurveQP); if (_vm.Items != null && _vm.Items.Any()) if (_vm.Items == null || !_vm.Items.Any()) { foreach (var vm in _vm.Items) CreateLineSeries(_vm.Id, _vm.Color, _vm.Name, _vm.CurveQH, _vm.CurveQE, _vm.CurveQP); } else { if (_vm.Items != null && _vm.Items.Any()) { CreateLineSeries(vm.Id, vm.Name, vm.CurveQH, vm.CurveQE, vm.CurveQP); if (_vm.Items[0].Hz != 50) CreateLineSeries(_vm.Id, _vm.Color, _vm.Name, _vm.CurveQH, _vm.CurveQE, _vm.CurveQP); for (int i = 0; i < _vm.Items.Count; i++) { var vm = _vm.Items[i]; CreateCurrentLineSeries(vm.Id, vm.Color, vm.CurveName, vm.CurveQH, vm.CurveQE, vm.CurveQP); } } } } } this.chartControl1.EndInit(); } ã /// <summary> /// å建线系å /// </summary> private void CreateLineSeries(string id, string curve_name, Yw.Geometry.CubicSpline2d qh, Yw.Geometry.CubicSpline2d qe, Yw.Geometry.CubicSpline2d qp) private void CreateLineSeries(string id, Color color, string curve_name, Yw.Geometry.CubicSpline2d qh, Yw.Geometry.CubicSpline2d qe, Yw.Geometry.CubicSpline2d qp) { var series_qh = new DevExpress.XtraCharts.Series(); series_qh.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; series_qh.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series_qh.Name = _tag_qh + id; series_qh.ShowInLegend = false; series_qh.CrosshairEnabled = DefaultBoolean.False; series_qh.LegendTextPattern = curve_name; var series_qh_view = new DevExpress.XtraCharts.LineSeriesView(); series_qh_view.LineStyle.Thickness = 2; series_qh_view.LineStyle.DashStyle = DashStyle.Dash; series_qh_view.LineStyle.LineJoin = System.Drawing.Drawing2D.LineJoin.MiterClipped; series_qh_view.Color = color; series_qh_view.EnableAntialiasing = DefaultBoolean.True; series_qh.SeriesPointsSorting = SortingMode.None; series_qh.SeriesPointsSortingKey = SeriesPointKey.Value_1; series_qh.View = series_qh_view; series_qh.Visible = true; var pt_qh_list = qh.GetPointList(100); for (int i = 0; i < pt_qh_list.Count; i++) { series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y })); } var point_qh = pt_qh_list[pt_qh_list.Count - 1]; var anchor_qh_pt = new DevExpress.XtraCharts.PaneAnchorPoint(); anchor_qh_pt.Pane = _default_pane; anchor_qh_pt.AxisXCoordinate.AxisValue = point_qh.X.ToString(); anchor_qh_pt.AxisYCoordinate.AxisValue = point_qh.Y.ToString(); var position_qh = new DevExpress.XtraCharts.RelativePosition(); position_qh.Angle = -50; position_qh.ConnectorLength = 10; var txt_qh = new TextAnnotation(); txt_qh.Border.Visibility = DefaultBoolean.False; txt_qh.AnchorPoint = anchor_qh_pt; txt_qh.AutoHeight = true; txt_qh.AutoWidth = true; txt_qh.BackColor = System.Drawing.Color.Transparent; txt_qh.Border.Color = color; txt_qh.ConnectorStyle = DevExpress.XtraCharts.AnnotationConnectorStyle.Line; txt_qh.DXFont = PumpChartDisplay.AnnoFontQH; txt_qh.Name = _tag_qh + id; txt_qh.Padding.Bottom = 1; txt_qh.Padding.Left = 1; txt_qh.Padding.Right = 1; txt_qh.Padding.Top = 1; txt_qh.RuntimeAnchoring = false; txt_qh.RuntimeMoving = true; txt_qh.RuntimeResizing = false; txt_qh.RuntimeRotation = false; txt_qh.Text = curve_name; txt_qh.TextColor = color; txt_qh.ShapePosition = position_qh; txt_qh.Visible = true; this.chartControl1.AnnotationRepository.Add(txt_qh); this.chartControl1.Series.Add(series_qh); if (qe != null) { var series_qe = new DevExpress.XtraCharts.Series(); series_qe.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; series_qe.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series_qe.Name = _tag_qe + id; series_qe.ShowInLegend = false; series_qe.CrosshairEnabled = DefaultBoolean.False; series_qe.Tag = id; var series_qe_view = new DevExpress.XtraCharts.LineSeriesView(); series_qe_view.LineStyle.Thickness = 2; series_qe_view.LineStyle.DashStyle = DashStyle.Dash; series_qe_view.LineStyle.LineJoin = System.Drawing.Drawing2D.LineJoin.MiterClipped; series_qe_view.Color = color; series_qe_view.AxisY = _axis_y_eff; series_qe_view.Pane = _default_pane; series_qe_view.EnableAntialiasing = DefaultBoolean.True; series_qe.SeriesPointsSorting = SortingMode.None; series_qe.SeriesPointsSortingKey = SeriesPointKey.Value_1; series_qe.View = series_qe_view; series_qe.Visible = _qe_visible; var pt_qe_list = qe.GetPointList(100); for (int i = 0; i < pt_qe_list.Count; i++) { series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y })); } this.chartControl1.Series.Add(series_qe); } if (qp != null) { var series_qp = new DevExpress.XtraCharts.Series(); series_qp.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; series_qp.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; series_qp.Name = _tag_qp + id; series_qp.ShowInLegend = false; series_qp.CrosshairEnabled = DefaultBoolean.False; series_qp.Tag = id; var series_qp_view = new DevExpress.XtraCharts.LineSeriesView(); series_qp_view.LineStyle.Thickness = 2; series_qp_view.LineStyle.DashStyle = DashStyle.Dash; series_qp_view.LineStyle.LineJoin = System.Drawing.Drawing2D.LineJoin.MiterClipped; series_qp_view.Color = color; series_qp_view.AxisY = _axis_y_power; series_qp_view.Pane = _bottom_pane; series_qp_view.EnableAntialiasing = DefaultBoolean.True; series_qp.SeriesPointsSorting = SortingMode.None; series_qp.SeriesPointsSortingKey = SeriesPointKey.Value_1; series_qp.View = series_qp_view; series_qp.Visible = _qp_visible; var pt_qp_list = qp.GetPointList(100); for (int i = 0; i < pt_qp_list.Count; i++) { series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y })); } this.chartControl1.Series.Add(series_qp); } } /// <summary> /// å建线系å /// </summary> private void CreateCurrentLineSeries(string id, Color color, string curve_name, Yw.Geometry.CubicSpline2d qh, Yw.Geometry.CubicSpline2d qe, Yw.Geometry.CubicSpline2d qp) { var series_qh = new DevExpress.XtraCharts.Series(); series_qh.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical; @@ -563,7 +592,7 @@ var series_qh_view = new DevExpress.XtraCharts.SplineSeriesView(); series_qh_view.LineStyle.Thickness = 2; //series_qh_view.Color = vm.Color; series_qh_view.Color = color; series_qh_view.EnableAntialiasing = DefaultBoolean.True; series_qh_view.LineTensionPercent = 50; @@ -572,7 +601,7 @@ series_qh.View = series_qh_view; series_qh.Visible = true; var pt_qh_list = qh.GetPointList(12); var pt_qh_list = qh.GetPointList(100); for (int i = 0; i < pt_qh_list.Count; i++) { series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y })); @@ -594,7 +623,7 @@ txt_qh.AutoHeight = true; txt_qh.AutoWidth = true; txt_qh.BackColor = System.Drawing.Color.Transparent; //txt_qh.Border.Color = vm.Color; txt_qh.Border.Color = color; txt_qh.ConnectorStyle = DevExpress.XtraCharts.AnnotationConnectorStyle.Line; txt_qh.DXFont = PumpChartDisplay.AnnoFontQH; txt_qh.Name = _tag_qh + id; @@ -607,7 +636,7 @@ txt_qh.RuntimeResizing = false; txt_qh.RuntimeRotation = false; txt_qh.Text = curve_name; //txt_qh.TextColor = vm.Color; txt_qh.TextColor = color; txt_qh.ShapePosition = position_qh; txt_qh.Visible = true; this.chartControl1.AnnotationRepository.Add(txt_qh); @@ -625,7 +654,7 @@ var series_qe_view = new DevExpress.XtraCharts.SplineSeriesView(); series_qe_view.LineStyle.Thickness = 2; //series_qe_view.Color = vm.Color; series_qe_view.Color = color; series_qe_view.AxisY = _axis_y_eff; series_qe_view.Pane = _default_pane; series_qe_view.EnableAntialiasing = DefaultBoolean.True; @@ -636,7 +665,7 @@ series_qe.View = series_qe_view; series_qe.Visible = _qe_visible; var pt_qe_list = qe.GetPointList(12); var pt_qe_list = qe.GetPointList(100); for (int i = 0; i < pt_qe_list.Count; i++) { series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y })); @@ -657,7 +686,7 @@ var series_qp_view = new DevExpress.XtraCharts.SplineSeriesView(); series_qp_view.LineStyle.Thickness = 2; //series_qp_view.Color = vm.Color; series_qp_view.Color = color; series_qp_view.AxisY = _axis_y_power; series_qp_view.Pane = _bottom_pane; series_qp_view.EnableAntialiasing = DefaultBoolean.True; @@ -668,33 +697,32 @@ series_qp.View = series_qp_view; series_qp.Visible = _qp_visible; var pt_qp_list = qp.GetPointList(12); var pt_qp_list = qp.GetPointList(100); for (int i = 0; i < pt_qp_list.Count; i++) { series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y })); } this.chartControl1.Series.Add(series_qp); } } } #endregion #region Right Click Menu #region Event private void barBtnSetChartAxis_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetChartAxis(); } } private void barCekCurveQEVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _qe_visible = this.barCekCurveQEVisible.Checked; _qe_visible = this.barCekCurveQEVisible.Checked; UpdateChart(); } @@ -702,17 +730,17 @@ { _bottom_pane.Visibility = _bottom_pane.Visibility == ChartElementVisibility.Visible ? ChartElementVisibility.Hidden : ChartElementVisibility.Visible; _qp_visible = _bottom_pane.Visibility == ChartElementVisibility.Visible ? true : false; UpdateChart(); } private void barCekCurveEQVisible_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _equip_visible = this.barCekCurveEQVisible.Checked; _run_visible = this.barCekCurveEQVisible.Checked; } #endregion /// <summary> /// è®¾ç½®åæ è½´ /// </summary> @@ -731,8 +759,8 @@ #endregion } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-run-view/PumpRunViewChart.resx
WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-run-view/PumpRunViewItemViewModel.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-variable-speed-view/PumpVariableSpeedViewItemViewModel.cs ÐÞ¸Ä @@ -1,16 +1,17 @@ namespace Yw.WinFrmUI.Phart { /// <summary> /// æ³µåé Item ViewModel /// æ³µè¿è¡è§å¾ Item ViewModel /// </summary> public class PumpVariableSpeedViewItemViewModel public class PumpRunViewItemViewModel { public PumpVariableSpeedViewItemViewModel() { } public PumpVariableSpeedViewItemViewModel(PumpVariableSpeedViewItemViewModel rhs) public PumpRunViewItemViewModel() { } public PumpRunViewItemViewModel(PumpRunViewItemViewModel rhs) { this.Id = rhs.Id; this.Name = rhs.Name; this.CurveName = rhs.CurveName; this.Color = rhs.Color; this.Q = rhs.Q; this.H = rhs.H; this.P = rhs.P; @@ -19,7 +20,7 @@ this.CurveQH = rhs.CurveQH; this.CurveQE = rhs.CurveQE; this.CurveQP = rhs.CurveQP; this.CurveQP = rhs.CurveQP; } /// <summary> @@ -36,6 +37,11 @@ /// åç§° /// </summary> public string CurveName { get; set; } /// <summary> /// é¢è² /// </summary> public Color Color { get; set; } /// <summary> /// æµé @@ -81,6 +87,8 @@ /// æµéåç线 /// </summary> public Yw.Geometry.CubicSpline2d CurveQP { get; set; } } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-run-view/PumpRunViewViewModel.cs
ÎļþÃû´Ó WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/04-variable-speed-view/PumpVariableSpeedViewViewModel.cs ÐÞ¸Ä @@ -1,16 +1,17 @@ namespace Yw.WinFrmUI.Phart { /// <summary> /// æ³µåéViewModel /// æ³µè¿è¡è§å¾ViewModel /// </summary> public class PumpVariableSpeedViewViewModel public class PumpRunViewViewModel { public PumpVariableSpeedViewViewModel() { } public PumpVariableSpeedViewViewModel(PumpVariableSpeedViewViewModel rhs) public PumpRunViewViewModel() { } public PumpRunViewViewModel(PumpRunViewViewModel rhs) { this.Id = rhs.Id; this.Name = rhs.Name; this.CurveName = rhs.CurveName; this.Color= rhs.Color; this.RatedQ = rhs.RatedQ; this.RatedH = rhs.RatedH; this.RatedP = rhs.RatedP; @@ -38,6 +39,11 @@ /// åç§° /// </summary> public string CurveName { get; set; } /// <summary> /// é¢è² /// </summary> public Color Color { get; set; } /// <summary> /// é¢å®æµé @@ -83,8 +89,7 @@ /// <summary> /// åé项å表 /// </summary> public List<PumpVariableSpeedViewItemViewModel> Items { get; set; } public List<PumpRunViewItemViewModel> Items { get; set; } } } WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/09-edit/PumpEditChart.cs
@@ -172,13 +172,13 @@ List<Yw.Geometry.Point2d> qh_pt_list, qe_pt_list = null, qp_pt_list = null; qh_pt_list = qh.GetPointList(12); qh_pt_list = qh.GetPointList(100); if (qe != null) qe_pt_list = qe.GetPointList(12); qe_pt_list = qe.GetPointList(100); if (qp != null) qp_pt_list = qp.GetPointList(12); qp_pt_list = qp.GetPointList(100); SetBindingData(qh_pt_list, qe_pt_list, qp_pt_list, qh_pt_list, qe_pt_list, qp_pt_list, coordinate_paras, calc_coordinate); WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/01-single/09-edit/PumpEditChartCtrl.cs
@@ -52,13 +52,13 @@ return; List<Yw.Geometry.Point2d> qh_pt_list, qe_pt_list = null, qp_pt_list = null; qh_pt_list = qh.GetPointList(12); qh_pt_list = qh.GetPointList(100); if (qe != null) qe_pt_list = qe.GetPointList(12); qe_pt_list = qe.GetPointList(100); if (qp != null) qp_pt_list = qp.GetPointList(12); qp_pt_list = qp.GetPointList(100); SetBindingData(qh_pt_list, qe_pt_list, qp_pt_list, qh_pt_list, qe_pt_list, qp_pt_list); WinFrmUI/Yw.WinFrmUI.Phart.Core/01-pump/02-multi/01-parallel/PumpParallelChart.cs
@@ -198,7 +198,7 @@ private void DrawExpandLine(GraphicsCache cache, Pen pen, AxisYBase axis_y, Yw.Geometry.CubicSpline2d line, double x_max) { var pt_list = line.GetPointList(12).ToList(); var pt_list = line.GetPointList(100).ToList(); pt_list = pt_list?.Where(x => x.X > x_max).ToList(); if (pt_list == null || !pt_list.Any()) return; @@ -584,7 +584,7 @@ } //åç if (_max_power > _min_power) if (_max_power > _min_power && _qp_visible) { //计ç®å»åº¦ var labels = new List<CustomAxisLabel>(); @@ -851,7 +851,7 @@ series_qh.View = series_qh_view; series_qh.Visible = true; var pt_qh_list = vm.CurrentCurveQH.GetPointList(12); var pt_qh_list = vm.CurrentCurveQH.GetPointList(100); for (int i = 0; i < pt_qh_list.Count; i++) { series_qh.Points.Add(new SeriesPoint(pt_qh_list[i].X, new double[] { pt_qh_list[i].Y })); @@ -915,7 +915,7 @@ series_qe.View = series_qe_view; series_qe.Visible = _qe_visible; var pt_qe_list = vm.CurrentCurveQE.GetPointList(12); var pt_qe_list = vm.CurrentCurveQE.GetPointList(100); for (int i = 0; i < pt_qe_list.Count; i++) { series_qe.Points.Add(new SeriesPoint(pt_qe_list[i].X, new double[] { pt_qe_list[i].Y })); @@ -947,7 +947,7 @@ series_qp.View = series_qp_view; series_qp.Visible = _qp_visible; var pt_qp_list = vm.CurrentCurveQP.GetPointList(12); var pt_qp_list = vm.CurrentCurveQP.GetPointList(100); for (int i = 0; i < pt_qp_list.Count; i++) { series_qp.Points.Add(new SeriesPoint(pt_qp_list[i].X, new double[] { pt_qp_list[i].Y })); WinFrmUI/Yw.WinFrmUI.Phart.Core/02-valve/01-view/ValveViewChart.cs
@@ -169,7 +169,7 @@ return; } List<Yw.Geometry.Point2d> pt_ql_list; pt_ql_list = cubic_spline_ql.GetPointList(12); pt_ql_list = cubic_spline_ql.GetPointList(100); SetBindingData(cubic_spline_ql, pt_ql_list, null, coordinate_paras, calc_coordinate); } WinFrmUI/Yw.WinFrmUI.Phart.Core/02-valve/02-edit/ValveEditChart.cs
@@ -129,7 +129,7 @@ List<Yw.Geometry.Point2d> pt_ql_list; pt_ql_list = cubic_spline_ql.GetPointList(12); pt_ql_list = cubic_spline_ql.GetPointList(100); SetBindingData(pt_ql_list, pt_ql_list, coordinate_paras, calc_coordinate); } WinFrmUI/Yw.WinFrmUI.Phart.Core/02-valve/02-edit/ValveEditCtrl.cs
@@ -42,7 +42,7 @@ return; List<Yw.Geometry.Point2d> pt_ql_list; pt_ql_list = cubic_spline_ql.GetPointList(12); pt_ql_list = cubic_spline_ql.GetPointList(100); SetBindingData(pt_ql_list, pt_ql_list); } WinFrmUI/Yw.WinFrmUI.Phart.Core/Yw.WinFrmUI.Phart.Core.csproj
@@ -31,6 +31,8 @@ </ItemGroup> <ItemGroup> <Compile Remove="01-pump\01-single\03-variable-speed\PumpVariableSpeedViewItemViewModel.cs" /> <Compile Remove="01-pump\01-single\03-variable-speed\PumpVariableSpeedViewModel.cs" /> <Compile Remove="Title - å¤å¶.cs" /> </ItemGroup> WinFrmUI/Yw.WinFrmUI.Phart.Core/Yw.WinFrmUI.Phart.Core.csproj.user
@@ -44,7 +44,7 @@ <Compile Update="01-pump\01-single\02-operation\PumpOperationChart.cs"> <SubType>UserControl</SubType> </Compile> <Compile Update="01-pump\01-single\04-variable-speed-view\PumpVariableSpeedViewChart.cs"> <Compile Update="01-pump\01-single\04-run-view\PumpRunViewChart.cs"> <SubType>UserControl</SubType> </Compile> <Compile Update="01-pump\01-single\09-edit\InputXYDlg.cs">