| | |
| | | using DevExpress.XtraCharts; |
| | | using DevExpress.XtraEditors; |
| | | using System.Text; |
| | | using Yw.Geometry; |
| | | |
| | | namespace Yw.WinFrmUI.Phart |
| | | { |
| | |
| | | private ConstantLine _work_pt_line; |
| | | private ConstantLine _work_h_line; |
| | | |
| | | private Series _series_cubic_spline_qh, _series_cubic_spline_qe, _series_cubic_spline_qp; |
| | | private Series _series_cubic_spline_qh, _series_cubic_spline_qe, _series_cubic_spline_qp, _series_cubic_spline_eq; |
| | | private Series _series_pt_qh, _series_pt_qe, _series_pt_qp; |
| | | private List<Series> _series_custom_list; |
| | | |
| | |
| | | private List<Yw.Geometry.Point2d> _def_pt_qp_list; |
| | | |
| | | |
| | | private PumpPerformGroupPoint _action_spot = new(0, 0, 0, 0, 0); |
| | | private PumpPerformGroupPoint _work_point = new(0, 0, 0, 0, 0); |
| | | private PumpGroupPt _action_spot = new(0, 0, 0, 0, 0); |
| | | private PumpGroupPt _work_point = new(0, 0, 0, 0, 0); |
| | | |
| | | private PumpPerformCoordinate _coordinate_paras; |
| | | private PumpCoordinate _coordinate_paras; |
| | | private bool _initial_data = false; |
| | | |
| | | #endregion |
| | |
| | | |
| | | #region Public Evnet |
| | | |
| | | public event Action<PumpPerformCoordinate> OnCurveCoordinateChanged; |
| | | public event Action<PumpCoordinate> OnCurveCoordinateChanged; |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | _series_cubic_spline_qp = this.chartControl1.GetSeriesByName("SeriesCurveQP"); |
| | | _series_cubic_spline_qp.SetCurveQPDisplay(); |
| | | |
| | | _series_cubic_spline_eq = this.chartControl1.GetSeriesByName("SeriesEquipCurve"); |
| | | |
| | | _series_pt_qh = this.chartControl1.GetSeriesByName("SeriesPointQH"); |
| | | _series_pt_qh.SetPointQHDisplay(); |
| | |
| | | _def_pt_qp_list = null; |
| | | |
| | | _coordinate_paras = null; |
| | | _work_point = new PumpPerformGroupPoint(0, 0, 0, 0, 0); |
| | | _action_spot = new PumpPerformGroupPoint(0, 0, 0, 0, 0); |
| | | _work_point = new PumpGroupPt(0, 0, 0, 0, 0); |
| | | _action_spot = new PumpGroupPt(0, 0, 0, 0, 0); |
| | | |
| | | UpdateChart(false); |
| | | } |
| | |
| | | _def_pt_qe_list = def_pt_qe_list; |
| | | _def_pt_qp_list = def_pt_qp_list; |
| | | |
| | | _coordinate_paras = PumpPerformCoordinate.ToModel(coordinate_paras); |
| | | _coordinate_paras = PumpCoordinate.ToModel(coordinate_paras); |
| | | |
| | | UpdateChart(calc_coordinate); |
| | | } |
| | |
| | | if (_pt_qh_list == null || _pt_qh_list.Count < 4) |
| | | { |
| | | //设置成白板坐标 |
| | | _coordinate_paras = new PumpPerformCoordinate(); |
| | | _coordinate_paras = new PumpCoordinate(); |
| | | _coordinate_paras.GridNumberX = 30; |
| | | _coordinate_paras.GridNumberY = 16; |
| | | //显示的坐标线号 |
| | |
| | | return; |
| | | } |
| | | |
| | | _coordinate_paras = PumpPerformCoordinate.CalcCoordinate(_pt_qh_list, _pt_qe_list, _pt_qp_list); |
| | | _coordinate_paras = PumpCoordinate.CalcCoordinate(_pt_qh_list, _pt_qe_list, _pt_qp_list); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | _bottom_panel.Visibility = splitPanel ? ChartElementVisibility.Visible : ChartElementVisibility.Hidden; |
| | | var pointView = (PointSeriesView)_series_pt_qp.View; |
| | | var curveView = (SplineSeriesView)_series_cubic_spline_qp.View; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | var maxAxisP = minAxisP + gridNumP * _coordinate_paras.CoordSpaceP; |
| | | _axis_y_qp.SetAxisRange(minAxisP, maxAxisP); |
| | | |
| | | pointView.Pane = _bottom_panel; |
| | | curveView.Pane = _bottom_panel; |
| | | ((PointSeriesView)_series_pt_qp.View).Pane = _bottom_panel; |
| | | ((SplineSeriesView)_series_cubic_spline_qp.View).Pane = _bottom_panel; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | _axis_y_qe.SetAxisRange(_coordinate_paras.CoordMinE, _coordinate_paras.CoordMinE + _coordinate_paras.GridNumberY * _coordinate_paras.CoordSpaceE); |
| | | _axis_y_qp.SetAxisRange(_coordinate_paras.CoordMinP, _coordinate_paras.CoordMinP + _coordinate_paras.GridNumberY * _coordinate_paras.CoordSpaceP); |
| | | pointView.Pane = _main_chart_diagram.DefaultPane; |
| | | curveView.Pane = _main_chart_diagram.DefaultPane; |
| | | |
| | | |
| | | ((PointSeriesView)_series_pt_qp.View).Pane = _main_chart_diagram.DefaultPane; |
| | | ((SplineSeriesView)_series_cubic_spline_qp.View).Pane = _main_chart_diagram.DefaultPane; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | _series_cubic_spline_qh.Visible = true; |
| | | _series_cubic_spline_qh.Points.Clear(); |
| | | foreach (var curvePoint in _pt_qh_list) |
| | | foreach (var pt in _pt_qh_list) |
| | | { |
| | | var seriesPoint = new SeriesPoint(curvePoint.X, curvePoint.Y); |
| | | _series_cubic_spline_qh.Points.Add(seriesPoint); |
| | | var series_pt = new SeriesPoint(pt.X, pt.Y); |
| | | _series_cubic_spline_qh.Points.Add(series_pt); |
| | | } |
| | | } |
| | | else |
| | |
| | | _work_pt_line.Visible = false; |
| | | _work_h_line.Visible = false; |
| | | _work_pt_txt_annot.Visible = false; |
| | | |
| | | _series_cubic_spline_eq.Points.Clear(); |
| | | _series_cubic_spline_eq.Visible = false; |
| | | |
| | | } |
| | | |
| | | if (_pt_qe_list != null && _pt_qe_list.Count > 3) |
| | | { |
| | | _series_cubic_spline_qe.Visible = true; |
| | | _series_cubic_spline_qe.Points.Clear(); |
| | | foreach (var curvePoint in _pt_qe_list) |
| | | foreach (var pt in _pt_qe_list) |
| | | { |
| | | var seriesPoint = new SeriesPoint(curvePoint.X, curvePoint.Y); |
| | | _series_cubic_spline_qe.Points.Add(seriesPoint); |
| | | var series_pt = new SeriesPoint(pt.X, pt.Y); |
| | | _series_cubic_spline_qe.Points.Add(series_pt); |
| | | } |
| | | } |
| | | else |
| | |
| | | { |
| | | _series_cubic_spline_qp.Visible = true; |
| | | _series_cubic_spline_qp.Points.Clear(); |
| | | foreach (var curvePoint in _pt_qp_list) |
| | | foreach (var pt in _pt_qp_list) |
| | | { |
| | | var seriesPoint = new SeriesPoint(curvePoint.X, curvePoint.Y); |
| | | _series_cubic_spline_qp.Points.Add(seriesPoint); |
| | | var series_pt = new SeriesPoint(pt.X, pt.Y); |
| | | _series_cubic_spline_qp.Points.Add(series_pt); |
| | | } |
| | | } |
| | | else |
| | |
| | | if (_def_pt_qh_list != null && _def_pt_qh_list.Any()) |
| | | { |
| | | _series_pt_qh.Points.Clear(); |
| | | foreach (var definePoint in _def_pt_qh_list) |
| | | foreach (var define_pt in _def_pt_qh_list) |
| | | { |
| | | var seriesPoint = new SeriesPoint(definePoint.X, definePoint.Y); |
| | | _series_pt_qh.Points.Add(seriesPoint); |
| | | var series_pt = new SeriesPoint(define_pt.X, define_pt.Y); |
| | | _series_pt_qh.Points.Add(series_pt); |
| | | } |
| | | } |
| | | |
| | | if (_def_pt_qe_list != null && _def_pt_qe_list.Any()) |
| | | { |
| | | _series_pt_qe.Points.Clear(); |
| | | foreach (var definePoint in _def_pt_qe_list) |
| | | foreach (var define_pt in _def_pt_qe_list) |
| | | { |
| | | var seriesPoint = new SeriesPoint(definePoint.X, definePoint.Y); |
| | | _series_pt_qe.Points.Add(seriesPoint); |
| | | var series_pt = new SeriesPoint(define_pt.X, define_pt.Y); |
| | | _series_pt_qe.Points.Add(series_pt); |
| | | } |
| | | } |
| | | |
| | | if (_def_pt_qp_list != null && _def_pt_qp_list.Any()) |
| | | { |
| | | _series_pt_qp.Points.Clear(); |
| | | foreach (var definePoint in _def_pt_qp_list) |
| | | foreach (var define_pt in _def_pt_qp_list) |
| | | { |
| | | var seriesPoint = new SeriesPoint(definePoint.X, definePoint.Y); |
| | | _series_pt_qp.Points.Add(seriesPoint); |
| | | var series_pt = new SeriesPoint(define_pt.X, define_pt.Y); |
| | | _series_pt_qp.Points.Add(series_pt); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <param name="action_spot_q"></param> |
| | | public void CalcActionSpotByQ(double? action_spot_q = null) |
| | | { |
| | | _series_cubic_spline_eq.Visible = true; |
| | | _series_cubic_spline_eq.Points.Clear(); |
| | | if (_series_custom_list != null && _series_custom_list.Any()) |
| | | { |
| | | this.chartControl1.BeginInit(); |
| | |
| | | |
| | | _action_spot.Q = action_spot_q.Value; |
| | | _action_spot.H = _cubic_spline_qh.GetPointY(_action_spot.Q); |
| | | |
| | | |
| | | |
| | | _series_cubic_spline_eq.Visible = true; |
| | | var action_spot = new Yw.Geometry.Point2d(_action_spot.Q, _action_spot.H); |
| | | var eq_paras = EquipCurveHelper.CalcEquipCurve(_cubic_spline_qh, action_spot, out Yw.Geometry.Point2d sect_pt); |
| | | if (eq_paras != null && eq_paras.CurveExpress != null) |
| | | { |
| | | var eq_pt_list = eq_paras.CurveExpress.GetPointList(); |
| | | foreach (var pt in eq_pt_list) |
| | | { |
| | | var series_pt = new SeriesPoint(pt.X, pt.Y); |
| | | _series_cubic_spline_eq.Points.Add(series_pt); |
| | | } |
| | | } |
| | | |
| | | |
| | | var action_spot_qh = CreatePointSeries(Pump.eCurveType.QH, _action_spot.Q, _action_spot.H); |
| | |
| | | { |
| | | if (!_initial_data) |
| | | return; |
| | | if (e.AdditionalObject is SeriesPoint seriesPoint) |
| | | if (e.AdditionalObject is SeriesPoint series_pt) |
| | | { |
| | | var tip = string.Format("X:{0:N1} Y:{1:N1}", seriesPoint.Argument, seriesPoint.Values[0]); |
| | | var tip = string.Format("X:{0:N1} Y:{1:N1}", series_pt.Argument, series_pt.Values[0]); |
| | | toolTip.ShowHint(tip); |
| | | } |
| | | else |