using DevExpress.Utils;
|
using DevExpress.XtraCharts;
|
using Eventech.Model;
|
using System;
|
using System.Collections.Generic;
|
using System.Drawing;
|
using System.Drawing.Drawing2D;
|
using System.Linq;
|
using System.Text;
|
using System.Windows.Forms;
|
|
|
namespace TProduct.WinFrmUI.TPump
|
{
|
internal partial class ChartLxpFeatCurveCtrl : DevExpress.XtraEditors.XtraUserControl
|
{
|
#region 私有字段
|
private List<TProduct.Model.PumpFeatTestRecordViewModel> _allRecords = new List<TProduct.Model.PumpFeatTestRecordViewModel>();
|
private List<Eventech.Model.FeatPoint> _curveInfoQH = null;
|
private Eventech.Model.CurveExpress _curveExpressQH = null;
|
public Eventech.Model.CurveExpress CurveExpressQH
|
{
|
get { return _curveExpressQH; }
|
}
|
private List<Eventech.Model.FeatPoint> _curveInfoQE = null;
|
private Eventech.Model.CurveExpress _curveExpressQE = null;
|
private List<Eventech.Model.FeatPoint> _curveInfoQP = null;
|
private Eventech.Model.CurveExpress _curveExpressQP = null;
|
private TProduct.Model.ProductMainExPump _currentPump = null;
|
private TProduct.Model.RatedParas4Pump _ratedParas = null;
|
private Eventech.Model.PointToleranceParas _toleranceParas = null;
|
protected Eventech.Model.UnitP _coordinate_unitP = Eventech.Model.UnitP.KW;
|
protected Eventech.Model.UnitQ _coordinate_unitQ = Eventech.Model.UnitQ.M3H;
|
protected Eventech.Model.UnitH _coordinate_unitH = Eventech.Model.UnitH.M;
|
|
public Eventech.Model.UnitQ FlowUnit
|
{
|
get { return _coordinate_unitQ; }
|
}
|
public Eventech.Model.UnitH HeadUnit
|
{
|
get { return _coordinate_unitH; }
|
}
|
public Eventech.Model.UnitP PowerUnit
|
{
|
get { return _coordinate_unitP; }
|
}
|
//曲线延长部分
|
protected List<Eventech.Model.FeatPoint> _curveInfoQH_Extend = null;
|
public List<Eventech.Model.FeatPoint> GetExtendCurveInfoQH()
|
{
|
return _curveInfoQH_Extend;
|
}
|
|
public void SetExtendCurveInfoQH(List<Eventech.Model.FeatPoint> points)
|
{
|
_curveInfoQH_Extend = points;
|
if (points != null && points.Count > 0)
|
{
|
if (points.Last().Y < 0.1)
|
{
|
var qq = Math.Round(Eventech.Common.UnitQHelper.fromM3H(this._coordinate_unitQ, points.Last().X), 2);
|
SetExtendCurveInfoText(string.Format("零扬程时流量:{0} {1}", qq,
|
Eventech.Common.UnitQHelper.GetEnUnitName(_coordinate_unitQ)));
|
}
|
if (points.Last().X > _coordMaxQ)
|
{
|
CheckCoordinate();
|
UpdateCoordinate();
|
}
|
|
}
|
|
}
|
string _extendCurveInfoText_Entend = null;
|
public void SetExtendCurveInfoText(string info)
|
{
|
_extendCurveInfoText_Entend = info;
|
}
|
#endregion
|
|
#region CHART变量
|
//测试的原始点
|
private Series SeriesQHpoint = null;
|
private Series SeriesQEpoint = null;
|
private Series SeriesQPpoint = null;
|
private Series SeriesQNPSHpoint = null;
|
|
//拟合后的曲线上的点
|
private Series SeriesQHcurve = null;
|
private Series SeriesQEcurve = null;
|
private Series SeriesQPcurve = null;
|
private Series SeriesQNPSHcurve = null;
|
|
//额定点
|
private Series SeriesRatedMarkerH = null;
|
private Series SeriesRatedMarkerV = null;
|
//
|
private DevExpress.XtraCharts.XYDiagram mainChartDiagram;
|
private DevExpress.XtraCharts.XYDiagramPane bottomChartDiagram = null;
|
//
|
private AxisX AxisQ = null;
|
private AxisY QHAxisY = null;
|
private SecondaryAxisY QEAxisY = null;
|
private SecondaryAxisY QPAxisY = null;
|
private SecondaryAxisY NPSHAxisY = null;
|
#endregion
|
|
#region 构造函数和加载函数
|
public ChartLxpFeatCurveCtrl()
|
{
|
InitializeComponent();
|
|
_coordinate_unitP = TProduct.UserSetting.Setting.PumpTest.UnitPower;
|
_coordinate_unitQ = TProduct.UserSetting.Setting.PumpTest.UnitFlow;
|
_coordinate_unitH = TProduct.UserSetting.Setting.PumpTest.UnitHead;
|
|
_isDispQE = TProduct.UserSetting.Setting.PumpTest.IsDispCurveQE;
|
_isDispQP = TProduct.UserSetting.Setting.PumpTest.IsDispCurveQP;
|
|
_queryInfo_unitQ = _coordinate_unitQ;
|
_queryInfo_unitH = _coordinate_unitH;
|
|
|
|
#region 图标控件显示
|
|
mainChartDiagram = (XYDiagram)chartControl1.Diagram;
|
for (int i = 0; i < mainChartDiagram.Panes.Count; i++)
|
{
|
var panel = mainChartDiagram.Panes[i];
|
if (panel.Name == "PaneBottom")
|
{
|
bottomChartDiagram = panel;
|
}
|
}
|
// mainChartDiagram.DefaultPane.Weight = 2.9D;
|
// mainChartDiagram.PaneLayout.RowDefinitions[0].Weight = 2.9D;
|
//
|
SeriesQHpoint = chartControl1.Series["SeriesQHpoint"];
|
SeriesQEpoint = chartControl1.Series["SeriesQEpoint"];
|
SeriesQPpoint = chartControl1.Series["SeriesQPpoint"];
|
SeriesQNPSHpoint = chartControl1.Series["SeriesQNPSHpoint"];
|
|
SeriesQHcurve = chartControl1.Series["SeriesQHcurve"];
|
SeriesQEcurve = chartControl1.Series["SeriesQEcurve"];
|
SeriesQPcurve = chartControl1.Series["SeriesQPcurve"];
|
SeriesQNPSHcurve = chartControl1.Series["SeriesQNPSHcurve"];
|
|
|
SeriesQHpoint.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQHcurve.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
|
SeriesQEpoint.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQEcurve.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
|
SeriesQPpoint.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQPcurve.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
|
SeriesQNPSHpoint.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
SeriesQNPSHcurve.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
|
|
SeriesQHpoint.Visible = false;
|
SeriesQHcurve.Visible = false;
|
SeriesQEpoint.Visible = false;
|
SeriesQEcurve.Visible = false;
|
SeriesQPpoint.Visible = false;
|
SeriesQPcurve.Visible = false;
|
SeriesQNPSHpoint.Visible = false;
|
SeriesQNPSHcurve.Visible = false;
|
|
SeriesQHcurve.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQEcurve.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQPcurve.CrosshairEnabled = DefaultBoolean.False;
|
|
bottomChartDiagram.Visibility = ChartElementVisibility.Hidden;
|
|
SeriesQHpoint.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQEpoint.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQPpoint.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQNPSHpoint.CrosshairEnabled = DefaultBoolean.False;
|
SeriesQNPSHcurve.CrosshairEnabled = DefaultBoolean.False;
|
|
//
|
SeriesRatedMarkerH = chartControl1.Series["SeriesRatedMarkerH"];
|
SeriesRatedMarkerV = chartControl1.Series["SeriesRatedMarkerV"];
|
SeriesRatedMarkerH.Visible = false;
|
SeriesRatedMarkerV.Visible = false;
|
SeriesRatedMarkerH.CrosshairEnabled = DefaultBoolean.False;
|
SeriesRatedMarkerV.CrosshairEnabled = DefaultBoolean.False;
|
|
//
|
AxisQ = mainChartDiagram.AxisX;
|
QHAxisY = mainChartDiagram.AxisY;
|
QEAxisY = mainChartDiagram.SecondaryAxesY.GetAxisByName("QEAxisY");
|
QPAxisY = mainChartDiagram.SecondaryAxesY.GetAxisByName("QPAxisY");
|
NPSHAxisY = mainChartDiagram.SecondaryAxesY.GetAxisByName("NPSHAxisY");
|
|
AxisQ.Visibility = DefaultBoolean.False;
|
QHAxisY.Visibility = DefaultBoolean.False;
|
QHAxisY.VisualRange.Auto = false;
|
QHAxisY.NumericScaleOptions.AutoGrid = false;
|
|
QEAxisY.Visibility = DefaultBoolean.False;
|
QEAxisY.VisualRange.Auto = false;
|
QEAxisY.NumericScaleOptions.AutoGrid = false;
|
|
QPAxisY.Visibility = DefaultBoolean.False;
|
QPAxisY.VisualRange.Auto = false;
|
QPAxisY.NumericScaleOptions.AutoGrid = false;
|
|
NPSHAxisY.Visibility = DefaultBoolean.False;
|
NPSHAxisY.VisualRange.Auto = false;
|
NPSHAxisY.NumericScaleOptions.AutoGrid = false;
|
|
QueryLineVertical1 = (DevExpress.XtraCharts.ConstantLine)mainChartDiagram.AxisX.ConstantLines.GetElementByName("QueryLineVertical1");
|
QueryLineVertical1.Visible = false;
|
QueryLineVertical1.Title.Text = "请鼠标拖动";
|
|
QueryParaInfoText = chartControl1.AnnotationRepository[0] as DevExpress.XtraCharts.TextAnnotation;
|
QueryParaInfoText.Visible = false;
|
QueryParaInfoText.Text = "曲线点参数";
|
|
QueryLineHorizontal = chartControl1.Series["QueryLineHorizontal"];
|
QueryLineHorizontal.Visible = false;
|
QueryLineHorizontal.CrosshairHighlightPoints = DefaultBoolean.False;
|
QueryLineHorizontal.CrosshairEnabled = DefaultBoolean.False;
|
#endregion
|
|
//if (TPump.Localization.UICulture.IsEnglish)
|
//{//英语
|
// //资源文件
|
// System.ComponentModel.ComponentResourceManager resources
|
// = new System.ComponentModel.ComponentResourceManager(typeof(ChartFeatTestIngCtrl));
|
|
// TPump.Localization.SetResource.ContextMenuStrip(chartRightMenu, resources);
|
// IAxisY.Title.Text = "Head(m)";
|
// InPutPAxisY.Title.Text = "Eff(%)";
|
//}
|
//设置此属性
|
//this.chartControl1.RuntimeSelection = true;// 表示可以选择CHART上物体
|
this.chartControl1.SelectionMode = ElementSelectionMode.Single;
|
//this.chartControl1.RuntimeSeriesSelectionMode = SeriesSelectionMode.Point;//系列选择是选择其中的点而不是整个系列
|
//this.chartControl1.RuntimeSeriesSelectionMode = SeriesSelectionMode.Series;
|
this.chartControl1.SeriesSelectionMode = SeriesSelectionMode.Series;
|
|
this.chartControl1.CustomPaint += new DevExpress.XtraCharts.CustomPaintEventHandler(this.chartControl_CustomPaint);
|
this.chartControl1.ObjectHotTracked += new DevExpress.XtraCharts.HotTrackEventHandler(this.chartControl_ObjectHotTracked);
|
////this.chartControl1.MouseLeave += new System.EventHandler(this.chartControl1_MouseLeave);
|
this.chartControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chartControl_MouseMove);
|
this.chartControl1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.chartControl_MouseUp);
|
this.chartControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chartControl_MouseDown);
|
this.chartControl1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chartControl_MouseClick);
|
}
|
|
private void LoadWindow(object sender, EventArgs e)
|
{
|
SetChartDisplay();
|
}
|
|
|
//设置显示
|
private void SetChartDisplay()
|
{
|
AxisQ.GridLines.MinorVisible = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.IsDispMinorLineX;
|
QHAxisY.GridLines.MinorVisible = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.IsDispMinorLineY;
|
QEAxisY.GridLines.MinorVisible = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.IsDispMinorLineY;
|
|
AxisQ.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorQ;
|
AxisQ.Label.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorQ;
|
AxisQ.Title.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorQ;
|
AxisQ.MinorCount = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.MinorCountQ;
|
AxisQ.Label.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisLabelFontQ;
|
AxisQ.Title.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisTitleFontQ;
|
|
AxisQ.GridLines.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLinesColorX;
|
AxisQ.GridLines.MinorColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLinesColorX;
|
AxisQ.GridLines.MinorVisible = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.IsDispMinorLineX;
|
|
QHAxisY.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorH;
|
QHAxisY.Label.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorH;
|
QHAxisY.Title.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorH;
|
QHAxisY.MinorCount = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.MinorCountH;
|
QHAxisY.Label.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisLabelFontH;
|
QHAxisY.Title.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisTitleFontH;
|
QHAxisY.GridLines.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLinesColorY;
|
|
QEAxisY.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorE;
|
QEAxisY.Label.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorE;
|
QEAxisY.Title.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorE;
|
QEAxisY.MinorCount = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.MinorCountE;
|
QEAxisY.Label.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisLabelFontE;
|
QEAxisY.Title.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisTitleFontE;
|
QEAxisY.GridLines.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLinesColorY;
|
|
SeriesQHcurve.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CurveColorQH;
|
SeriesQEcurve.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CurveColorQE;
|
SeriesQPcurve.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CurveColorQP;
|
|
SeriesQHpoint.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointColorQH;
|
(SeriesQHpoint.View as DevExpress.XtraCharts.PointSeriesView).PointMarkerOptions.Size = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointSizeQH;
|
(SeriesQHpoint.View as DevExpress.XtraCharts.PointSeriesView).PointMarkerOptions.Kind = (MarkerKind)TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointKindQH;
|
|
SeriesQPpoint.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointColorQP;
|
(SeriesQPpoint.View as DevExpress.XtraCharts.PointSeriesView).PointMarkerOptions.Size = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointSizeQP;
|
(SeriesQPpoint.View as DevExpress.XtraCharts.PointSeriesView).PointMarkerOptions.Kind = (MarkerKind)TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointKindQP;
|
|
SeriesQEpoint.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointColorQE;
|
(SeriesQEpoint.View as DevExpress.XtraCharts.PointSeriesView).PointMarkerOptions.Size = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointSizeQE;
|
(SeriesQEpoint.View as DevExpress.XtraCharts.PointSeriesView).PointMarkerOptions.Kind = (MarkerKind)TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.PointKindQE;
|
|
|
|
AxisQ.GridLines.LineStyle.DashStyle = (DevExpress.XtraCharts.DashStyle)TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLineTypeX;
|
QHAxisY.GridLines.LineStyle.DashStyle = (DevExpress.XtraCharts.DashStyle)TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLineTypeY;
|
QEAxisY.GridLines.LineStyle.DashStyle = (DevExpress.XtraCharts.DashStyle)TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLineTypeY;
|
QPAxisY.GridLines.LineStyle.DashStyle = (DevExpress.XtraCharts.DashStyle)TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLineTypeY;
|
|
SeriesRatedMarkerH.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.RatedLineColor;
|
SeriesRatedMarkerV.View.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.RatedLineColor;
|
|
(SeriesRatedMarkerH.View as DevExpress.XtraCharts.LineSeriesView).LineStyle.Thickness = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.RatedLineWidth;
|
(SeriesRatedMarkerV.View as DevExpress.XtraCharts.LineSeriesView).LineStyle.Thickness = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.RatedLineWidth;
|
|
QPAxisY.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorP;
|
QPAxisY.Label.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorP;
|
QPAxisY.Title.TextColor = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.CoordColorP;
|
QPAxisY.MinorCount = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.MinorCountE;
|
QPAxisY.Label.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisLabelFontE;
|
QPAxisY.Title.Font = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.AxisTitleFontE;
|
QPAxisY.GridLines.Color = TProduct.WinFrmUI.TPump.ChartDisp.Settings.Default.GridLinesColorY;
|
}
|
#endregion
|
|
#region 设置
|
//
|
internal void EmptyRecordPoint()
|
{
|
if (_allRecords != null)
|
_allRecords.Clear();
|
_curveInfoQH = null;
|
_curveExpressQH = null;
|
_curveInfoQE = null;
|
_curveExpressQE = null;
|
_curveInfoQP = null;
|
_curveExpressQP = null;
|
ReCalcFitPoint();
|
}
|
|
|
internal void SetRecordPoint(List<TProduct.Model.PumpFeatTestRecordViewModel> pointInfos)
|
{
|
if (pointInfos == null || pointInfos.Count == 0)
|
return;
|
_allRecords = pointInfos;
|
ReCalcFitPoint();
|
}
|
|
//计算
|
private void ReCalcFitPoint()
|
{
|
if (_allRecords == null || _allRecords.Count < 1)
|
{
|
UpdateChart();
|
return;
|
}
|
|
|
FeatTestHelper.GetCurveExpressByRecord(
|
this._currentPump,
|
this._allRecords,
|
out this._curveExpressQH,
|
out this._curveExpressQE,
|
out this._curveExpressQP);
|
|
if (this._curveExpressQH != null)
|
this._curveInfoQH = Eventech.Common.FitCurveHelper.GetFitPoints(this._curveExpressQH, 12);
|
if (this._curveExpressQE != null)
|
this._curveInfoQE = Eventech.Common.FitCurveHelper.GetFitPoints(this._curveExpressQE, 12);
|
if (this._curveExpressQP != null)
|
this._curveInfoQP = Eventech.Common.FitCurveHelper.GetFitPoints(this._curveExpressQP, 12);
|
|
|
|
//重新更新图表
|
UpdateChart();
|
}
|
|
/// <summary>
|
/// 获取高效点
|
/// </summary>
|
/// <returns></returns>
|
public Eventech.Model.GroupPoint GetMaxEtaPt()
|
{
|
if (this._allRecords == null || this._allRecords.Count < 4)
|
return null;
|
|
var pt_e = Eventech.Common.FitCurveHelper.GetMaxPoint(this._curveInfoQE, 200);
|
|
Eventech.Model.GroupPoint grp_pt = new GroupPoint();
|
grp_pt.Q = TProduct.Common.RoundHelper.GetDispValueFlow(pt_e.X);
|
grp_pt.H = TProduct.Common.RoundHelper.GetDispValueHead(
|
Eventech.Common.FitCurveHelper.GetFitPointY(this._curveExpressQH, pt_e.X));
|
|
grp_pt.E = TProduct.Common.RoundHelper.GetDispValueFlow(pt_e.Y);
|
|
grp_pt.P = TProduct.Common.RoundHelper.GetDispValuePower(
|
Eventech.Common.PumpParaHelper.CalculateP(
|
grp_pt.Q, grp_pt.H, grp_pt.E));
|
return grp_pt;
|
}
|
public void ClearCoordinate()
|
{
|
_coordinateParas = null;
|
_coordMinQ = 0; _coordMaxQ = 0;//流量从0开始
|
_coordMinH = 10000; _coordMaxH = 0;
|
_coordMinP = 10000; _coordMaxP = 0;
|
_coordMaxE = 0;
|
_coordMinNPSH = 1000; _coordMaxNPSH = 0;
|
}
|
//
|
public void SetRatedParas(
|
TProduct.Model.ProductMainExPump pump,
|
TProduct.Model.RatedParas4Pump ratedParas,
|
List<Model.TestGradeJudgeItem> testJudgeItems)
|
{
|
this._currentPump = pump;
|
this._ratedParas = ratedParas;
|
if (ratedParas == null)
|
return;
|
|
RefreshJudgeItem(testJudgeItems);
|
|
if (QueryLineVertical1 != null)
|
QueryLineVertical1.AxisValue = ratedParas.Q;
|
}
|
|
public void RefreshRatedParas(
|
TProduct.Model.RatedParas4Pump ratedParas,
|
List<Model.TestGradeJudgeItem> testJudgeItems)
|
{
|
this._ratedParas = ratedParas;
|
if (ratedParas == null)
|
return;
|
|
RefreshJudgeItem(testJudgeItems);
|
|
UpdateRatedParas();
|
}
|
|
public void RefreshJudgeItem(List<Model.TestGradeJudgeItem> testJudgeItems)
|
{
|
if (this._ratedParas == null)
|
return;
|
|
_toleranceParas = new Eventech.Model.PointToleranceParas();
|
var flow_min = testJudgeItems.Find(x => x.TargeType == TProduct.Model.eTestJudgeTargetType.流量 && x.ThresholdType == TProduct.Model.TestGradeJudgeItem.eThresholdType.Min);
|
if (flow_min != null)
|
{
|
_toleranceParas.TolRatioMinQ = flow_min.ThresholdValue;
|
}
|
var flow_max = testJudgeItems.Find(x => x.TargeType == TProduct.Model.eTestJudgeTargetType.流量 && x.ThresholdType == TProduct.Model.TestGradeJudgeItem.eThresholdType.Max);
|
if (flow_max != null)
|
{
|
_toleranceParas.TolRatioMaxQ = flow_max.ThresholdValue;
|
}
|
|
var head_min = testJudgeItems.Find(x => x.TargeType == TProduct.Model.eTestJudgeTargetType.扬程 && x.ThresholdType == TProduct.Model.TestGradeJudgeItem.eThresholdType.Min);
|
if (head_min != null)
|
{
|
_toleranceParas.TolRatioMinH = head_min.ThresholdValue;
|
}
|
var head_max = testJudgeItems.Find(x => x.TargeType == TProduct.Model.eTestJudgeTargetType.扬程 && x.ThresholdType == TProduct.Model.TestGradeJudgeItem.eThresholdType.Max);
|
if (head_max != null)
|
{
|
_toleranceParas.TolRatioMaxH = head_max.ThresholdValue;
|
}
|
}
|
|
Eventech.Model.FeatPoint _judgePoint = null;
|
internal void SetJudgePointQH(Eventech.Model.FeatPoint judgePoint)
|
{
|
this._judgePoint = judgePoint;
|
}
|
bool _isDispJudgePoint = false;
|
public void SetJudgePointDisp(bool isDisp)
|
{
|
this._isDispJudgePoint = isDisp; this.Invalidate();
|
}
|
Eventech.Model.EquipCurveParas _equipCurveParas = null;
|
public Eventech.Model.EquipCurveParas EquipCurveParas { get { return _equipCurveParas; } }
|
internal void SetEquipCurve(Eventech.Model.EquipCurveParas equipCurve)
|
{
|
this._equipCurveParas = equipCurve;
|
}
|
bool _isDispEquipCurve = false;
|
public void SetEquipCurveDisp(bool isDisp)
|
{
|
this._isDispEquipCurve = isDisp;
|
this.Invalidate();
|
}
|
#endregion
|
|
#region 坐标
|
//坐标
|
private Eventech.Model.LxpCoordinateParas _coordinateParas = null;
|
private double _coordMinQ = 0, _coordMaxQ = 0;//流量从0开始
|
private double _coordMinH = 10000, _coordMaxH = 0;
|
private double _coordMinP = 10000, _coordMaxP = 0;
|
private double _coordMaxE = 0;
|
private double _coordMinNPSH = 1000, _coordMaxNPSH = 0;
|
//计算坐标
|
internal bool CheckCoordinate()
|
{
|
if (_allRecords == null || _allRecords.Count < 1)
|
{
|
return false;
|
}
|
|
bool isReUpdateCoordinate = false;
|
|
bool isFromExtendQ = false;
|
double maxQ = Math.Max(_coordMaxQ, this._ratedParas.Q);
|
if (_curveInfoQH_Extend != null)
|
{
|
isFromExtendQ = true;
|
maxQ = Math.Max(maxQ, _curveInfoQH_Extend.Last().X);
|
}
|
double maxH = Math.Max(_coordMaxH, this._ratedParas.H);
|
double minH = _coordMinH;
|
double maxE = _coordMaxE;
|
double maxP = _coordMaxP;
|
double minP = _coordMinP;
|
|
|
foreach (var pt in _allRecords)
|
{
|
maxQ = Math.Max(maxQ, pt.CorrectPtQ);
|
maxH = Math.Max(maxH, pt.CorrectPtH);
|
minH = Math.Min(minH, pt.CorrectPtH);
|
if (pt.CorrectPtE != null)
|
{
|
maxE = Math.Max(maxE, pt.CorrectPtE.Value);
|
}
|
if (pt.CorrectPtP != null)
|
{
|
minP = Math.Min(minP, pt.CorrectPtP.Value);
|
maxP = Math.Max(maxP, pt.CorrectPtP.Value);
|
}
|
}
|
|
|
if (maxQ > _coordMaxQ)
|
{
|
if (isFromExtendQ)
|
{
|
maxQ = maxQ * 1.02;
|
}
|
else
|
{
|
if (maxQ < 100)
|
maxQ = maxQ * 1.2;
|
else if (maxQ < 300)
|
maxQ = maxQ * 1.1;
|
else
|
maxQ = maxQ * 1.02;
|
}
|
|
|
isReUpdateCoordinate = true;
|
}
|
if (maxH > _coordMaxH || minH < _coordMinH)
|
{
|
minH = minH * 0.95;
|
maxH = maxH * 1.1;
|
isReUpdateCoordinate = true;
|
}
|
if (maxP > _coordMaxP || minP < _coordMinP)
|
{
|
minP = minP * 0.95;
|
maxP = maxP * 1.1;
|
isReUpdateCoordinate = true;
|
}
|
if (maxE > _coordMaxE)
|
{
|
isReUpdateCoordinate = true;
|
}
|
|
//检查是否需要重建坐标
|
if (_coordinateParas == null)
|
{
|
isReUpdateCoordinate = true;//原来没有,就必须重建坐标系
|
}
|
|
|
|
|
//不重建坐标就不用继续了
|
if (!isReUpdateCoordinate)
|
return false;
|
|
//流量从0开始
|
BuildCoord(0, maxQ, minH, maxH, minP, maxP, maxE);
|
|
if (isReUpdateCoordinate)
|
{
|
if (OnChangeCoordinate != null)
|
{
|
OnChangeCoordinate(_coordinateParas);
|
}
|
}
|
|
|
return isReUpdateCoordinate;
|
}
|
|
private void BuildCoord(
|
double minQ, double maxQ, double minH, double maxH,
|
double minP, double maxP, double maxE)
|
{
|
if (TProduct.CorpConfig.Instance.CorpFlag == Model.eCorpFlag.LIFU )
|
{
|
BuildCoord_LIFU(minQ, maxQ, minH, maxH, minP, maxP, maxE);
|
}
|
else
|
{
|
BuildCoord_General(minQ, maxQ, minH, maxH, minP, maxP, maxE);
|
}
|
|
|
CalcCoordNPSH();
|
}
|
private void BuildCoord_General(
|
double minQ, double maxQ, double minH, double maxH,
|
double minP, double maxP, double maxE)
|
{
|
//检查是否需要重建坐标
|
if (_coordinateParas == null)
|
{
|
_coordinateParas = new Eventech.Model.LxpCoordinateParas();
|
_coordinateParas.GridNumberX = 10;
|
_coordinateParas.GridNumberY = 12;
|
}
|
if (this._coordinate_unitQ == UnitQ.M3H)
|
{
|
_coordinateParas.CoordSpaceQ = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(minQ, maxQ,
|
10, out _coordMinQ, out _coordMaxQ);
|
_coordMinQ = Math.Max(0, _coordMinQ);//防止跑到负数去
|
}
|
else
|
{
|
_coordinateParas.CoordSpaceQ = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(
|
Eventech.Common.UnitQHelper.fromM3H(this._coordinate_unitQ, minQ),
|
Eventech.Common.UnitQHelper.fromM3H(this._coordinate_unitQ, maxQ),
|
10, out _coordMinQ, out _coordMaxQ);
|
_coordMinQ = Eventech.Common.UnitQHelper.toM3H(this._coordinate_unitQ, _coordMinQ);
|
_coordMaxQ = Eventech.Common.UnitQHelper.toM3H(this._coordinate_unitQ, _coordMaxQ);
|
_coordinateParas.CoordSpaceQ = Eventech.Common.UnitQHelper.toM3H(this._coordinate_unitQ, _coordinateParas.CoordSpaceQ);
|
_coordMinQ = Math.Max(0, _coordMinQ);//防止跑到负数去
|
}
|
|
_coordinateParas.CoordMinQ = _coordMinQ;
|
_coordMaxQ = _coordMinQ;
|
_coordinateParas.GridNumberX = 0;
|
while (_coordMaxQ < maxQ * 1.05)
|
{
|
_coordMaxQ = _coordMaxQ + _coordinateParas.CoordSpaceQ;
|
_coordinateParas.GridNumberX++;
|
}
|
|
//扬程(保证最大值显示)
|
_coordinateParas.StartLineNoH = 4;
|
_coordinateParas.EndLineNoH = 12;
|
_coordinateParas.CoordSpaceH = Eventech.Common.CoordinateHelper.GetOptimalSpaceMax(minH, maxH, 8,
|
out _coordMinH, out _coordMaxH);
|
_coordMinH = Math.Max(0, _coordMinH);//防止跑到负数去
|
if (_ratedParas != null)
|
{
|
double minSpaceH = Eventech.Common.CoordinateHelper.GetOptimalSpace(_ratedParas.H / 8);
|
_coordinateParas.CoordSpaceH = Math.Max(minSpaceH, Eventech.Common.CoordinateHelper.GetOptimalSpaceMax(minH, maxH, 10, out _coordMinH, out _coordMaxH));
|
}
|
//计算扬程有效刻度
|
double disH = _coordMaxH;
|
_coordinateParas.StartLineNoH = _coordinateParas.EndLineNoH;
|
while (disH > minH || (_coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH) < 5)
|
{
|
disH = disH - _coordinateParas.CoordSpaceH;
|
if (disH < 0)
|
break;
|
_coordinateParas.StartLineNoH--;
|
}
|
//
|
_coordinateParas.CoordMinH = _coordMaxH - _coordinateParas.EndLineNoH * _coordinateParas.CoordSpaceH;
|
|
//功率(保证最小值显示)
|
if (_coordinateParas.EndLineNoNPSH > 0)
|
{
|
_coordinateParas.StartLineNoP = _coordinateParas.EndLineNoNPSH - 1;
|
_coordinateParas.EndLineNoP = _coordinateParas.StartLineNoP + 5;
|
}
|
else
|
{
|
_coordinateParas.StartLineNoP = 0;
|
_coordinateParas.EndLineNoP = _coordinateParas.StartLineNoP + 5;
|
}
|
|
|
//计算间隔
|
_coordinateParas.CoordSpaceP = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(minP, maxP,
|
5, out _coordMinP, out _coordMaxP);
|
_coordinateParas.CoordMinP = _coordMaxP - _coordinateParas.EndLineNoP * _coordinateParas.CoordSpaceP;
|
for (int i = 0; i < 5; i++)
|
{
|
if (maxP * 1.05 > _coordinateParas.DispMaxP())
|
{
|
_coordinateParas.EndLineNoP++;
|
continue;
|
}
|
break;
|
}
|
|
//效率
|
if (maxE < 30)
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 6;
|
_coordinateParas.CoordSpaceE = 5;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 30;
|
}
|
else if (maxE < 50)
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 10;
|
_coordinateParas.CoordSpaceE = 5;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 50;
|
}
|
else if (maxE < 75)
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 10;
|
_coordinateParas.CoordSpaceE = 7.5;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 75;
|
}
|
else
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 10;
|
_coordinateParas.CoordSpaceE = 10;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 100;
|
}
|
|
|
}
|
|
private void BuildCoord_LIFU(
|
double minQ, double maxQ, double minH, double maxH,
|
double minP, double maxP, double maxE)
|
{
|
//检查是否需要重建坐标
|
if (_coordinateParas == null)
|
{
|
_coordinateParas = new Eventech.Model.LxpCoordinateParas();
|
_coordinateParas.GridNumberX = 10;
|
_coordinateParas.GridNumberY = 10;
|
}
|
#region Q
|
if (this._coordinate_unitQ == UnitQ.M3H)
|
{
|
_coordinateParas.CoordSpaceQ = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(minQ, maxQ,
|
10, out _coordMinQ, out _coordMaxQ);
|
}
|
else
|
{
|
_coordinateParas.CoordSpaceQ = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(
|
Eventech.Common.UnitQHelper.fromM3H(this._coordinate_unitQ, minQ),
|
Eventech.Common.UnitQHelper.fromM3H(this._coordinate_unitQ, maxQ),
|
10, out _coordMinQ, out _coordMaxQ);
|
_coordMinQ = Eventech.Common.UnitQHelper.toM3H(this._coordinate_unitQ, _coordMinQ);
|
_coordMaxQ = Eventech.Common.UnitQHelper.toM3H(this._coordinate_unitQ, _coordMaxQ);
|
_coordinateParas.CoordSpaceQ = Eventech.Common.UnitQHelper.toM3H(this._coordinate_unitQ, _coordinateParas.CoordSpaceQ);
|
}
|
_coordMinQ = Math.Max(0, _coordMinQ);//防止跑到负数去
|
_coordinateParas.CoordMinQ = _coordMinQ;
|
_coordMaxQ = _coordMinQ;
|
_coordinateParas.GridNumberX = 0;
|
while (_coordMaxQ < maxQ * 1.01)
|
{
|
_coordMaxQ = _coordMaxQ + _coordinateParas.CoordSpaceQ;
|
_coordinateParas.GridNumberX++;
|
}
|
#endregion
|
|
|
//扬程(保证最大值显示)
|
_coordinateParas.StartLineNoH = 0;
|
_coordinateParas.EndLineNoH = 10;
|
_coordinateParas.CoordSpaceH = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(0,
|
maxH, 10,
|
out _coordMinH, out _coordMaxH);
|
_coordMinH = Math.Max(0, _coordMinH);//防止跑到负数去
|
_coordinateParas.CoordMinH = 0;
|
|
#region 功率
|
//功率(保证最小值显示)
|
_coordinateParas.StartLineNoP = 0;
|
_coordinateParas.EndLineNoP = _coordinateParas.StartLineNoP + 5;
|
|
_coordinateParas.CoordSpaceP = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(minP, maxP,
|
5, out _coordMinP, out _coordMaxP);
|
_coordinateParas.CoordMinP = _coordMaxP - _coordinateParas.EndLineNoP * _coordinateParas.CoordSpaceP;
|
for (int i = 0; i < 5; i++)
|
{
|
if (maxP * 1.05 > _coordinateParas.DispMaxP())
|
{
|
_coordinateParas.EndLineNoP++;
|
continue;
|
}
|
break;
|
}
|
#endregion
|
|
#region 效率
|
if (maxE < 30)
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 8;
|
_coordinateParas.CoordSpaceE = 5;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 40;
|
}
|
else if (maxE < 50)
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 6;
|
_coordinateParas.CoordSpaceE = 10;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 60;
|
}
|
else if (maxE < 75)
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 8;
|
_coordinateParas.CoordSpaceE = 10;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 80;
|
}
|
else
|
{
|
_coordinateParas.StartLineNoE = 0;
|
_coordinateParas.EndLineNoE = 10;
|
_coordinateParas.CoordSpaceE = 10;
|
_coordinateParas.CoordMinE = 0;
|
_coordMaxE = 100;
|
}
|
|
#endregion
|
|
}
|
|
//
|
private void CalcCoordNPSH()
|
{
|
if (_coordinateParas == null)
|
_coordinateParas = new Eventech.Model.LxpCoordinateParas();
|
|
if (this._npshTestResults != null && this._npshTestResults.Count > 1)
|
{
|
double min_npsh, max_npsh;
|
if (_npshTestResults.Count() == 1)
|
{
|
min_npsh = _npshTestResults.First().NPSH * 0.5;
|
max_npsh = _npshTestResults.First().NPSH * 1.2;
|
}
|
else
|
{
|
var sss = from x in this._npshTestResults select x.NPSH;
|
min_npsh = sss.Min();
|
max_npsh = sss.Max();
|
}
|
bool isReCalc = false;
|
if (_coordinateParas.EndLineNoNPSH < 1)
|
{
|
isReCalc = true;
|
}
|
if (_coordinateParas.DispMaxNPSH() < max_npsh)
|
{
|
isReCalc = true;
|
}
|
if (_coordinateParas.CoordSpaceNPSH < 0.1)
|
{
|
isReCalc = true;
|
}
|
if (isReCalc)
|
{
|
//计算间隔
|
min_npsh = min_npsh / 2;
|
_coordinateParas.CoordSpaceNPSH = Eventech.Common.CoordinateHelper.GetOptimalSpaceMin(min_npsh, max_npsh,
|
3, out _coordMinNPSH, out _coordMaxNPSH);
|
_coordinateParas.CoordMinNPSH = _coordMinNPSH;
|
_coordinateParas.StartLineNoNPSH = 0;
|
_coordinateParas.EndLineNoNPSH = 3;
|
if (_coordinateParas.DispMaxNPSH() < max_npsh)
|
{
|
_coordinateParas.EndLineNoNPSH = 4;
|
}
|
}
|
|
// 坐标刻度
|
this.NPSHAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> NPSH_Label_List = new List<CustomAxisLabel>();
|
double disNPSH = _coordinateParas.CoordMinNPSH + _coordinateParas.CoordSpaceNPSH * _coordinateParas.StartLineNoNPSH;
|
for (int i = _coordinateParas.StartLineNoNPSH; i < _coordinateParas.EndLineNoNPSH + 1; i++)
|
{
|
NPSH_Label_List.Add(new CustomAxisLabel(disNPSH < 0 ? "" : disNPSH.ToString(), disNPSH));
|
disNPSH = disNPSH + _coordinateParas.CoordSpaceNPSH;
|
}
|
NPSHAxisY.CustomLabels.AddRange(NPSH_Label_List.ToArray());
|
//设置显示
|
TProduct.WinFrmUI.XtraChartHelper.SetAxisRange(NPSHAxisY,
|
_coordinateParas.CoordMinNPSH + _coordinateParas.StartLineNoNPSH * _coordinateParas.CoordSpaceNPSH,
|
_coordinateParas.CoordMinNPSH + _coordinateParas.EndLineNoNPSH * _coordinateParas.CoordSpaceNPSH);
|
|
this._coordMinNPSH = _coordinateParas.DispMinNPSH();
|
this._coordMaxNPSH = _coordinateParas.DispMaxNPSH();
|
}
|
else
|
{
|
_coordinateParas.StartLineNoNPSH = 0;
|
_coordinateParas.EndLineNoNPSH = 0;
|
}
|
}
|
//根据额定参数计算坐标
|
public void UpdateCoordByRatedParas()
|
{
|
if (this._ratedParas == null)
|
return;
|
|
if (TProduct.CorpConfig.Instance.CorpFlag == Model.eCorpFlag.LIFU )
|
{
|
double maxQ = Math.Round(this._ratedParas.Q * 2.5, 2);//流量从0开始
|
if (this._ratedParas.MaxQ.HasValue)
|
maxQ = Math.Max(Math.Round(this._ratedParas.MaxQ.Value * 1.2, 2), maxQ);
|
|
double maxH = Math.Round(this._ratedParas.H * 2.5, 2);
|
if (this._ratedParas.MaxH.HasValue)
|
maxH = Math.Max(Math.Round(this._ratedParas.MaxH.Value * 1.1, 2), maxH);
|
|
double minH = 0;
|
|
BuildCoord_LIFU(0, maxQ, minH, maxH, this._ratedParas.P * 0.5,
|
this._ratedParas.P * 1.2, this._ratedParas.E * 1.2);
|
}
|
else
|
{
|
double maxQ = Math.Round(this._ratedParas.Q * 1.3, 2);//流量从0开始
|
double maxH = Math.Round(this._ratedParas.H * 1.25, 2);
|
double minH = Math.Round(this._ratedParas.H * 0.5, 2);
|
|
BuildCoord_General(0, maxQ, minH, maxH, this._ratedParas.P * 0.5, this._ratedParas.P * 1.2, this._ratedParas.E * 1.2);
|
}
|
|
UpdateCoordinate();
|
|
UpdateRatedParas();
|
}
|
|
|
|
//更新图表坐标
|
internal void UpdateCoordinate()
|
{
|
//先设置为不显示
|
AxisQ.Visibility = DefaultBoolean.False;
|
QHAxisY.GridLines.Visible = false;
|
QHAxisY.Visibility = DefaultBoolean.False;
|
QEAxisY.GridLines.Visible = false;
|
QEAxisY.Visibility = DefaultBoolean.False;
|
|
if (_coordinateParas == null)
|
return;
|
|
//流量坐标刻度
|
List<CustomAxisLabel> q_Label_List = new List<CustomAxisLabel>();
|
AxisQ.CustomLabels.Clear();
|
double disQ = _coordinateParas.CoordMinQ;
|
for (int i = 0; i < _coordinateParas.GridNumberX + 1; i++)
|
{
|
q_Label_List.Add(new CustomAxisLabel(
|
TProduct.Common.RoundHelper.GetDispValueFlow(
|
Eventech.Common.UnitQHelper.fromM3H(_coordinate_unitQ,
|
disQ < 0 ? 0 : disQ)).ToString(), disQ));
|
disQ = disQ + _coordinateParas.CoordSpaceQ;
|
}
|
AxisQ.CustomLabels.AddRange(q_Label_List.ToArray());
|
this._coordMinQ = _coordinateParas.CoordMinQ;
|
this._coordMaxQ = _coordinateParas.DispMaxQ();
|
this.AxisQ.Title.Text = string.Format("流量({0})",
|
Eventech.Common.UnitQHelper.GetEnUnitName(_coordinate_unitQ));
|
//设置显示
|
TProduct.WinFrmUI.XtraChartHelper.SetAxisRange(AxisQ, _coordinateParas.CoordMinQ,
|
_coordinateParas.CoordMinQ + _coordinateParas.GridNumberX * _coordinateParas.CoordSpaceQ);
|
AxisQ.GridLines.Visible = true;
|
AxisQ.Visibility = DefaultBoolean.True;
|
|
|
//扬程坐标刻度
|
QHAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> h_Label_List = new List<CustomAxisLabel>();
|
double disH = _coordinateParas.CoordMinH + _coordinateParas.CoordSpaceH * _coordinateParas.StartLineNoH;
|
for (int i = _coordinateParas.StartLineNoH; i < _coordinateParas.EndLineNoH + 1; i++)
|
{
|
h_Label_List.Add(new CustomAxisLabel(
|
TProduct.Common.RoundHelper.GetDispValueHead(
|
Eventech.Common.UnitHHelper.fromM(_coordinate_unitH, disH < 0 ? 0 : disH)).ToString(), disH));
|
|
disH = disH + _coordinateParas.CoordSpaceH;
|
}
|
QHAxisY.CustomLabels.AddRange(h_Label_List.ToArray());
|
//设置显示
|
TProduct.WinFrmUI.XtraChartHelper.SetAxisRange(QHAxisY, _coordinateParas.CoordMinH,
|
_coordinateParas.CoordMinH + _coordinateParas.GridNumberY * _coordinateParas.CoordSpaceH);
|
QHAxisY.GridLines.Visible = true;
|
QHAxisY.Visibility = DefaultBoolean.True;
|
this._coordMinH = _coordinateParas.DispMinH();
|
this._coordMaxH = _coordinateParas.DispMaxH();
|
|
//功率坐标刻度
|
QPAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> P_Label_List = new List<CustomAxisLabel>();
|
double disP = _coordinateParas.CoordMinP + _coordinateParas.CoordSpaceP * _coordinateParas.StartLineNoP;
|
for (int i = _coordinateParas.StartLineNoP; i < _coordinateParas.EndLineNoP + 1; i++)
|
{
|
var text = disP < 0 ? "" :
|
TProduct.Common.RoundHelper.GetDispValuePower(
|
Eventech.Common.UnitPHelper.fromKW(_coordinate_unitP, disP)).ToString();
|
P_Label_List.Add(new CustomAxisLabel(text, disP));
|
disP = disP + _coordinateParas.CoordSpaceP;
|
}
|
QPAxisY.CustomLabels.AddRange(P_Label_List.ToArray());
|
//设置显示
|
TProduct.WinFrmUI.XtraChartHelper.SetAxisRange(QPAxisY,
|
_coordinateParas.CoordMinP + _coordinateParas.StartLineNoP * _coordinateParas.CoordSpaceP,
|
_coordinateParas.CoordMinP + _coordinateParas.EndLineNoP * _coordinateParas.CoordSpaceP);
|
this.QPAxisY.GridLines.Visible = _isDispQP;
|
this.QPAxisY.Visibility = _isDispQP ? DefaultBoolean.True : DefaultBoolean.False;
|
this._coordMinP = _coordinateParas.DispMinP();
|
this._coordMaxP = _coordinateParas.DispMaxP();
|
this.QPAxisY.Title.Text = string.Format("功率({0})",
|
Eventech.Common.UnitPHelper.GetEnUnitName(_coordinate_unitP));
|
|
//效率坐标刻度
|
QEAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> E_Label_List = new List<CustomAxisLabel>();
|
double disE = _coordinateParas.CoordMinE + _coordinateParas.CoordSpaceE * _coordinateParas.StartLineNoE;
|
for (int i = _coordinateParas.StartLineNoE; i < _coordinateParas.EndLineNoE + 1; i++)
|
{
|
E_Label_List.Add(new CustomAxisLabel(disE < 0 ? "" : disE.ToString(), disE));
|
disE = disE + _coordinateParas.CoordSpaceE;
|
}
|
QEAxisY.CustomLabels.AddRange(E_Label_List.ToArray());
|
//设置显示
|
TProduct.WinFrmUI.XtraChartHelper.SetAxisRange(QEAxisY, _coordinateParas.CoordMinE,
|
_coordinateParas.CoordMinE + _coordinateParas.GridNumberY * _coordinateParas.CoordSpaceE);
|
QEAxisY.GridLines.Visible = true;
|
this.QEAxisY.Visibility = _isDispQE ? DefaultBoolean.True : DefaultBoolean.False;
|
//this._coordMinE = _coordinateParas.DispMinE();
|
this._coordMaxE = _coordinateParas.DispMaxE();
|
|
|
//汽蚀
|
if (_coordMinNPSH < _coordMaxNPSH)
|
{
|
//坐标刻度
|
NPSHAxisY.CustomLabels.Clear();
|
List<CustomAxisLabel> NPSH_Label_List = new List<CustomAxisLabel>();
|
double dispNPSH = _coordinateParas.CoordMinNPSH + _coordinateParas.CoordSpaceNPSH * _coordinateParas.StartLineNoNPSH;
|
for (int i = _coordinateParas.StartLineNoNPSH; i < _coordinateParas.EndLineNoNPSH + 1; i++)
|
{
|
NPSH_Label_List.Add(new CustomAxisLabel(dispNPSH < 0 ? "" : dispNPSH.ToString(), dispNPSH));
|
dispNPSH = dispNPSH + _coordinateParas.CoordSpaceNPSH;
|
}
|
NPSHAxisY.CustomLabels.AddRange(NPSH_Label_List.ToArray());
|
}
|
}
|
|
public Eventech.Model.LxpCoordinateParas GetCoordinateParas()
|
{
|
return _coordinateParas;
|
}
|
public Action<Eventech.Model.LxpCoordinateParas> OnChangeCoordinate = null;
|
public void SetCoordinateParas(Eventech.Model.LxpCoordinateParas coordinateParas, bool isRefresh = false)
|
{
|
this._coordinateParas = coordinateParas;
|
if (coordinateParas == null)
|
return;
|
|
if (isRefresh)
|
UpdateCoordinate();
|
}
|
#endregion
|
|
#region 更新
|
|
//更新所有
|
internal void UpdateChart(bool isCalcCoord = true)
|
{
|
if (isCalcCoord || this._coordinateParas == null)
|
{
|
//判断是否要重建坐标系
|
bool isReUpdateCoordinate = CheckCoordinate();
|
if (isReUpdateCoordinate)
|
UpdateCoordinate();
|
}
|
|
InitialNpsh();
|
|
UpdateTestPoints();
|
|
UpdateRatedParas();
|
}
|
|
|
|
//更新所有点
|
public void UpdateTestPoints()
|
{
|
if (_allRecords == null)
|
{
|
SeriesQHpoint.Visible = false;
|
SeriesQHcurve.Visible = false;
|
|
SeriesQEpoint.Visible = false;
|
SeriesQEcurve.Visible = false;
|
|
SeriesQPpoint.Visible = false;
|
SeriesQPcurve.Visible = false;
|
return;
|
}
|
|
SeriesQHpoint.Visible = true;
|
SeriesQEpoint.Visible = this._isDispQE;
|
SeriesQPpoint.Visible = this._isDispQP;
|
|
SeriesQHpoint.Points.Clear();
|
SeriesQEpoint.Points.Clear();
|
SeriesQPpoint.Points.Clear();
|
|
int i;
|
for (i = 0; i < _allRecords.Count(); i++)
|
{
|
SeriesQHpoint.Points.Add(new SeriesPoint(_allRecords[i].CorrectPtQ, new double[] { _allRecords[i].CorrectPtH }));
|
|
if (_allRecords[i].CorrectPtP != null)
|
SeriesQPpoint.Points.Add(new SeriesPoint(_allRecords[i].CorrectPtQ, new double[] { _allRecords[i].CorrectPtP.Value }));
|
|
if (_allRecords[i].CorrectPtE != null)
|
SeriesQEpoint.Points.Add(new SeriesPoint(_allRecords[i].CorrectPtQ, new double[] { _allRecords[i].CorrectPtE.Value }));
|
}
|
|
if (_allRecords.Count < 4)
|
{
|
SeriesQHcurve.Visible = false;
|
SeriesQEcurve.Visible = false;
|
SeriesQPcurve.Visible = false;
|
return;
|
}
|
|
|
SeriesQHcurve.Visible = true;
|
SeriesQHcurve.Points.Clear();
|
|
SeriesQEcurve.Visible = this._isDispQE;
|
SeriesQEcurve.Points.Clear();
|
|
SeriesQPcurve.Visible = this._isDispQP;
|
SeriesQPcurve.Points.Clear();
|
|
if (_curveInfoQH != null && _curveInfoQH.Count > 3)
|
{
|
for (i = 0; i < _curveInfoQH.Count(); i++)
|
{
|
SeriesQHcurve.Points.Add(new SeriesPoint(_curveInfoQH[i].X, new double[] { _curveInfoQH[i].Y }));
|
}
|
}
|
|
if (_curveInfoQE != null && _curveInfoQE.Count > 3)
|
{
|
for (i = 0; i < _curveInfoQE.Count(); i++)
|
{
|
SeriesQEcurve.Points.Add(new SeriesPoint(_curveInfoQE[i].X, new double[] { _curveInfoQE[i].Y }));
|
}
|
}
|
|
if (_curveInfoQP != null && _curveInfoQP.Count > 3)
|
{
|
for (i = 0; i < _curveInfoQP.Count(); i++)
|
{
|
SeriesQPcurve.Points.Add(new SeriesPoint(_curveInfoQP[i].X, new double[] { _curveInfoQP[i].Y }));
|
}
|
}
|
|
|
}
|
|
|
|
//更新额定参数
|
public void UpdateRatedParas()
|
{
|
if (this._ratedParas == null || this._ratedParas.Q < 0.1)
|
return;
|
if (_toleranceParas == null)
|
return;
|
|
double maxQ = _toleranceParas.TolRatioMaxQ * this._ratedParas.Q;
|
double minQ = _toleranceParas.TolRatioMinQ * this._ratedParas.Q;
|
double maxH = _toleranceParas.TolRatioMaxH * this._ratedParas.H;
|
double minH = _toleranceParas.TolRatioMinH * this._ratedParas.H;
|
|
|
if (maxQ > minQ)
|
{
|
SeriesRatedMarkerH.Points.Clear();
|
SeriesRatedMarkerH.Points.Add(new SeriesPoint(minQ,
|
new double[] { _ratedParas.H }));
|
SeriesRatedMarkerH.Points.Add(new SeriesPoint(maxQ,
|
new double[] { _ratedParas.H }));
|
SeriesRatedMarkerH.Visible = true;
|
|
// ((LineSeriesView)SeriesRatedMarkerV.View).MarkerVisibility = DefaultBoolean.True;
|
}
|
else
|
{
|
SeriesRatedMarkerH.Visible = false;
|
}
|
|
if (maxH > minH)
|
{
|
SeriesRatedMarkerV.Points.Clear();
|
SeriesRatedMarkerV.Points.Add(new SeriesPoint(_ratedParas.Q,
|
new double[] { minH }));
|
SeriesRatedMarkerV.Points.Add(new SeriesPoint(_ratedParas.Q,
|
new double[] { maxH }));
|
SeriesRatedMarkerV.Visible = true;
|
|
// ((LineSeriesView)SeriesRatedMarkerH.View).MarkerVisibility = DefaultBoolean.True;
|
}
|
else
|
{
|
SeriesRatedMarkerV.Visible = false;
|
}
|
}
|
#endregion
|
|
#region 重绘
|
|
void chartControl_CustomPaint(object sender, CustomPaintEventArgs e)
|
{
|
//Graphics g = e.Graphics;
|
if (_coordinateParas == null)
|
return;
|
|
Graphics g = e.Graphics;
|
//g.SetClip(CalculateDiagramBounds());
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
|
if (_judgePoint != null && this._isDispJudgePoint)
|
{
|
using (Pen penCurve = new Pen(System.Drawing.Color.Red, 5f))
|
{
|
ControlCoordinates coor = mainChartDiagram.DiagramToPoint(_judgePoint.X,
|
_judgePoint.Y, AxisQ, QHAxisY);
|
g.DrawEllipse(penCurve, coor.Point.X - 4, coor.Point.Y - 4, 8, 8);
|
}
|
}
|
|
if (_equipCurveParas != null && this._isDispEquipCurve && _equipCurveParas.CurveInfo != null && _equipCurveParas.CurveInfo.Count > 3)
|
{
|
List<PointF> points = new List<PointF>();
|
foreach (var pt in _equipCurveParas.CurveInfo)
|
{
|
ControlCoordinates coor = mainChartDiagram.DiagramToPoint(pt.X,
|
pt.Y, AxisQ, QHAxisY);
|
points.Add(coor.Point);
|
}
|
using (Pen penCurve = new Pen(System.Drawing.Color.PaleVioletRed, 2f))
|
{
|
g.DrawCurve(penCurve, points.ToArray(), 0.5F);
|
}
|
}
|
|
if (_curveInfoQH_Extend != null && _curveInfoQH_Extend.Count > 3)
|
{
|
List<PointF> points = new List<PointF>();
|
foreach (var pt in _curveInfoQH_Extend)
|
{
|
ControlCoordinates coor = mainChartDiagram.DiagramToPoint(pt.X,
|
pt.Y, AxisQ, QHAxisY);
|
points.Add(coor.Point);
|
}
|
using (Font fontText = new Font("宋体", 9))
|
using (SolidBrush brushText = new SolidBrush(System.Drawing.Color.FromArgb(255, 0, 255)))
|
using (Pen penCurve = new Pen(System.Drawing.Color.FromArgb(255, 0, 255), 2f))
|
{
|
penCurve.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
|
g.DrawCurve(penCurve, points.ToArray(), 0.5F);
|
if (this._coordinateParas.DispMinH() < 0.1)
|
{
|
if (!string.IsNullOrEmpty(_extendCurveInfoText_Entend))
|
{
|
g.DrawString(_extendCurveInfoText_Entend, fontText, brushText, new PointF(points.Last().X - 15, points.Last().Y - 20));
|
}
|
}
|
else
|
{
|
if (!string.IsNullOrEmpty(_extendCurveInfoText_Entend))
|
{
|
g.DrawString(_extendCurveInfoText_Entend, fontText, brushText, new PointF(points.Last().X - 15, points.Last().Y + 10));
|
}
|
}
|
}
|
}
|
|
chartControl1.DrawCorpLogo(g);
|
}
|
|
private void DrawCurve(List<Point> points, Eventech.Model.CombineCurve equalCurve, Graphics g, Color curveColor)
|
{
|
//去掉重曲线复点
|
Point[] pointArray = points.Distinct().ToArray();
|
|
//写字
|
//using (SolidBrush brushTextQP = new SolidBrush(curveColor))
|
//using (Font fontTextQP = TProduct.WinFrmUI.CorpSkinStyleHelper.GetDefaultFont())
|
//{
|
// g.DrawString(equalCurve.CurvePara.ToString(), fontTextQP, brushTextQP,
|
// pointArray.First().X, pointArray.First().Y - 15);
|
//}
|
|
//绘制曲线
|
if (pointArray.Length > 2)
|
{
|
using (Pen penCurve = new Pen(curveColor, 3f))
|
{
|
if (equalCurve.IsClosed)
|
{
|
System.Drawing.Drawing2D.FillMode aFillMode = System.Drawing.Drawing2D.FillMode.Alternate;
|
g.DrawClosedCurve(penCurve, pointArray, equalCurve.DispTension, aFillMode);
|
}
|
else
|
{//DrawBeziers
|
g.DrawCurve(penCurve, pointArray, equalCurve.DispTension);
|
}
|
}
|
}
|
else if (pointArray.Length == 2)
|
{
|
using (Pen penCurve = new Pen(curveColor, 3f))
|
{
|
g.DrawLine(penCurve, pointArray[0], pointArray[1]);
|
}
|
}
|
else if (pointArray.Length == 1)
|
{
|
using (var brsh = new SolidBrush(curveColor))
|
{
|
Rectangle rc = new Rectangle(pointArray[0].X - 2, pointArray[0].Y - 2, 4, 4);
|
g.FillEllipse(brsh, rc);
|
}
|
}
|
}
|
|
#endregion
|
|
#region 图表事件
|
private Point _clickLocation;
|
private void chartControl_MouseDown(object sender, MouseEventArgs e)
|
{
|
_isMoveQueryLineQ1 = false;
|
_isMoveQueryLineH1 = false;
|
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
{
|
_clickLocation = e.Location;
|
ChartHitInfo hitInfo = chartControl1.CalcHitInfo(_clickLocation);
|
if (hitInfo.InConstantLine)
|
{
|
if (hitInfo.ConstantLine == QueryLineVertical1)
|
_isMoveQueryLineQ1 = true;
|
}
|
else
|
{
|
if (hitInfo.InSeries)
|
{
|
if (hitInfo.Series == QueryLineHorizontal)
|
{
|
_isMoveQueryLineH1 = true;
|
return;
|
}
|
}
|
|
|
}
|
}
|
|
//if (isRectSel)
|
//{//进行框选删除点
|
// Rectangle bounds = CalculateDiagramBounds();
|
// if (bounds.Contains(e.locationType))
|
// {
|
// selCornerFirstPt = selCornerLastPt = e.locationType;
|
// selRectangleIng = Rectangle.Empty;
|
// }
|
//}
|
}
|
|
private object _rightClickObj = null;
|
|
private void chartControl_MouseClick(object sender, MouseEventArgs e)
|
{
|
if (e.Button == System.Windows.Forms.MouseButtons.Right)
|
{
|
ChartHitInfo hitInfo = chartControl1.CalcHitInfo(e.Location);
|
if (hitInfo.InAnnotation)
|
{
|
_rightClickObj = hitInfo.Annotation;
|
//if (_rightClickObj == QueryParaInfoText)
|
//{
|
// MenuItem修改Anno名称.Visible = false;
|
// MenuItem设置查询值单位.Visible = true;
|
// MenuItem删除Anno.Visible = false;
|
//}
|
//else
|
//{
|
// MenuItem修改Anno名称.Visible = true;
|
// MenuItem设置查询值单位.Visible = false;
|
// MenuItem删除Anno.Visible = true;
|
//}
|
|
//annoRightMenu.Show(chartControl1, e.Location);
|
}
|
else if (hitInfo.InSeries)
|
{
|
_rightClickObj = hitInfo.Series;
|
if (_rightClickObj == QueryLineHorizontal)
|
{
|
lineMenuStrip.Show(chartControl1, e.Location);
|
}
|
else
|
{
|
chartRightMenu.Show(chartControl1, e.Location);
|
}
|
|
}
|
else if (hitInfo.InAxis)
|
{
|
_rightClickObj = hitInfo.Axis;
|
// axisRightMenu.Show(chartControl1, e.Location);
|
}
|
//else if (hitInfo.InChartTitle)
|
//{
|
// rightClickObj = hitInfo.AxisTitle;
|
// lineMenuStrip.Show(chartControl1, e.locationType);
|
//}
|
//else if(hitInfo.InSeriesLabel)
|
else if (hitInfo.InConstantLine)
|
{
|
_rightClickObj = hitInfo.ConstantLine;
|
lineMenuStrip.Show(chartControl1, e.Location);
|
}
|
else
|
{
|
_rightClickObj = null;
|
chartRightMenu.Show(chartControl1, e.Location);
|
}
|
}
|
}
|
|
|
//ToolTipController toolTipController1 = new ToolTipController();
|
private void chartControl_ObjectHotTracked(object sender, HotTrackEventArgs e)
|
{
|
//if (SeriesQHmax == e.Object)
|
//{
|
// toolTipController1.ShowHint("流量扬程曲线");
|
//}
|
//else if (SeriesQEmax == e.Object)
|
//{
|
// toolTipController1.ShowHint("流量效率曲线");
|
//}
|
//else if (SeriesQPmax == e.Object)
|
//{
|
// toolTipController1.ShowHint("流量功率曲线");
|
//}
|
//else if (RatedParasLine == e.Object)
|
//{
|
// if (ratedParas == null)
|
// return;
|
|
// toolTipController1.ShowHint(ratedParasAnno);
|
//}
|
//else if (e.AdditionalObject is SeriesPoint)
|
//{
|
// SeriesPoint spect = e.AdditionalObject as SeriesPoint;
|
// if (spect != null)
|
// {
|
// ChartHitInfo hitInfo = e.HitInfo;
|
// string s = string.Format("{0} , {1}", spect.Argument, spect.Values[0]);
|
// toolTipController1.ShowHint(s);
|
// }
|
//}
|
//else if (e.AdditionalObject is Series)
|
//{
|
// if (SeriesQHmax == e.AdditionalObject)
|
// {
|
// toolTipController1.ShowHint("流量扬程曲线");
|
// }
|
//}
|
//if (e.AdditionalObject == SeriesDesignPoint)
|
//{
|
// toolTipController1.ShowHint(string.Format("设计点:流量{0},扬程{1}", DesignPointList.First().X, DesignPointList.First().Y));
|
//}
|
//if (e.AdditionalObject is Series)
|
//{
|
//}
|
//else
|
//{
|
// toolTipController1.HideHint();
|
//}
|
}
|
|
private void chartControl_MouseMove(object sender, MouseEventArgs e)
|
{
|
if (_isMoveQueryLineQ1)
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refQ = coordPt.NumericalArgument;
|
CalcQueryPointParasByQ1(refQ);
|
BuildQueryParaInfo();
|
SetQueryLineParaHoriz();
|
}
|
|
else if (_isMoveQueryLineH1)
|
{
|
DiagramCoordinates coordPt = mainChartDiagram.PointToDiagram(e.Location);
|
double refH = coordPt.NumericalValue;
|
double refQ = 0;
|
if (CalcCurveParasByH(refH, ref refQ))
|
{
|
CalcQueryPointParasByQ1(refQ);
|
BuildQueryParaInfo();
|
SetQueryLineParaHoriz();
|
}
|
}
|
}
|
|
|
private void chartControl_MouseUp(object sender, MouseEventArgs e)
|
{
|
_isMoveQueryLineQ1 = false;
|
_isMoveQueryLineH1 = false;
|
}
|
#endregion
|
|
#region 汽蚀
|
List<TProduct.Model.NpshTestResult> _npshTestResults = null;
|
public bool IsHaveCurve()
|
{
|
if (_npshTestResults == null || _npshTestResults.Count() == 0)
|
return false;
|
else
|
return true;
|
}
|
internal void SetNpshPoints(List<TProduct.Model.NpshTestResult> npshTestResults)
|
{
|
this._npshTestResults = npshTestResults;
|
}
|
private bool _isHaveNPSH = false;
|
private void InitialNpsh()
|
{
|
NPSHAxisY.Visibility = DefaultBoolean.False;
|
NPSHAxisY.GridLines.Visible = false;
|
SeriesQNPSHpoint.Visible = false;
|
SeriesQNPSHcurve.Visible = false;
|
_isHaveNPSH = false;
|
if (this._npshTestResults == null || this._npshTestResults.Count == 0)
|
{
|
return;
|
}
|
_isHaveNPSH = true;
|
bottomChartDiagram.Visibility = ChartElementVisibility.Visible;
|
CalcCoordNPSH();
|
NPSHAxisY.Visibility = DefaultBoolean.True;
|
SeriesQNPSHpoint.Visible = true;
|
SeriesQNPSHpoint.Points.Clear();
|
if (_isDispQP)
|
NPSHAxisY.GridLines.Visible = false;
|
else
|
NPSHAxisY.GridLines.Visible = true;
|
for (int i = 0; i < _npshTestResults.Count(); i++)
|
{
|
SeriesQNPSHpoint.Points.Add(new SeriesPoint(_npshTestResults[i].Flow, new double[] { _npshTestResults[i].NPSH }));
|
}
|
|
if (_npshTestResults.Count() >= 3)
|
{
|
SeriesQNPSHcurve.Visible = true;
|
SeriesQNPSHcurve.Points.Clear();
|
|
for (int i = 0; i < _npshTestResults.Count(); i++)
|
{
|
SeriesQNPSHcurve.Points.Add(new SeriesPoint(_npshTestResults[i].Flow, new double[] { _npshTestResults[i].NPSH }));
|
}
|
}
|
}
|
#endregion
|
|
private bool _isDispCoodText = true;
|
public void SetAxisTitle(bool isDisp)
|
{
|
_isDispCoodText = isDisp;
|
QHAxisY.Title.Visibility = _isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
QEAxisY.Title.Visibility = _isDispCoodText ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
private bool _isDispQE = true;
|
public void SetEtaDisp(bool isDisp)
|
{
|
this._isDispQE = isDisp;
|
this.SeriesQEpoint.Visible = _isDispQE;
|
this.SeriesQEcurve.Visible = _isDispQE;
|
this.QEAxisY.Visibility = _isDispQE ? DefaultBoolean.True : DefaultBoolean.False;
|
}
|
|
private bool _isDispQP = false;
|
public void SetPowerDisp(bool isDisp)
|
{
|
if (isDisp || _isHaveNPSH)
|
{
|
bottomChartDiagram.Visibility = ChartElementVisibility.Visible;
|
}
|
else
|
{
|
bottomChartDiagram.Visibility = ChartElementVisibility.Hidden;
|
}
|
_isDispQP = isDisp;
|
SeriesQPpoint.Visible = _isDispQP;
|
SeriesQPcurve.Visible = _isDispQP;
|
QPAxisY.GridLines.Visible = _isDispQP;
|
this.QPAxisY.Visibility = _isDispQP ? DefaultBoolean.True : DefaultBoolean.False;
|
|
if (NPSHAxisY.Visibility == DefaultBoolean.True)
|
{
|
if (_isDispQP)
|
NPSHAxisY.GridLines.Visible = false;
|
else
|
NPSHAxisY.GridLines.Visible = true;
|
}
|
}
|
|
|
private bool isDispQlabel = false;
|
private void 显示流量值MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispQlabel = !isDispQlabel;
|
if (isDispQlabel)
|
{
|
显示流量值MenuItem.Text = "不显示流量值";
|
}
|
else
|
{
|
显示流量值MenuItem.Text = "显示流量值";
|
}
|
SetQHpointLabel();
|
}
|
|
private bool isDispHlabel = false;
|
private void 显示扬程值MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispHlabel = !isDispHlabel;
|
if (isDispHlabel)
|
{
|
显示扬程值MenuItem.Text = "不显示扬程值";
|
}
|
else
|
{
|
显示扬程值MenuItem.Text = "显示扬程值";
|
}
|
SetQHpointLabel();
|
}
|
|
private void SetQHpointLabel()
|
{
|
if (!isDispQlabel && !isDispHlabel)
|
{
|
//SeriesIPoint.Label.Visible = false;
|
SeriesQHpoint.LabelsVisibility = DefaultBoolean.False;
|
}
|
else
|
{
|
/// SeriesIPoint.Label.Visible = true;
|
SeriesQHpoint.LabelsVisibility = DefaultBoolean.True;
|
if (!isDispQlabel && isDispHlabel)
|
{
|
SeriesQHpoint.Label.TextPattern = "{V}";
|
//SeriesIPoint.Label.PointOptions.PointView = PointView.Values;
|
}
|
else if (isDispQlabel && !isDispHlabel)
|
{
|
SeriesQHpoint.Label.TextPattern = "{A}";
|
// SeriesIPoint.Label.PointOptions.PointView = PointView.Argument;
|
}
|
else
|
{
|
SeriesQHpoint.Label.TextPattern = "{A},{V}";
|
// SeriesIPoint.Label.PointOptions.PointView = PointView.ArgumentAndValues;
|
}
|
}
|
}
|
|
private bool isDispPlabel = false;
|
private void 显示功率值MenuItem_Click(object sender, EventArgs e)
|
{
|
isDispPlabel = !isDispPlabel;
|
if (isDispPlabel)
|
{
|
显示功率值MenuItem.Text = "不显示功率值";
|
//SeriesInputPpoint.Label.Visible = true;
|
SeriesQEpoint.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
|
}
|
else
|
{
|
显示功率值MenuItem.Text = "显示功率值";
|
//SeriesInputPpoint.Label.Visible = false;
|
SeriesQEpoint.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False;
|
}
|
}
|
//显示曲线方程
|
public void ShowCurveEquation()
|
{
|
if (_curveExpressQH == null)
|
{
|
return;
|
}
|
|
DispCurveEquationDlg frm = new DispCurveEquationDlg();
|
frm.SetCurveInfo(this._curveExpressQH, this._curveExpressQE, this._curveExpressQP);
|
frm.Show();
|
}
|
|
#region 面板风格: 暂无
|
|
protected TProduct.Model.eChartDiagramPanelStyle _chartPanelStyle = TProduct.Model.eChartDiagramPanelStyle.Whole;
|
|
public void SetChartPanelStyleParas(TProduct.Model.eChartDiagramPanelStyle style)
|
{
|
_chartPanelStyle = style;
|
SetChartPanelStyle();
|
}
|
|
//0 是一整块 1 上面扬程效率 下面功率汽蚀
|
public virtual void SetChartPanelStyle()
|
{
|
}
|
|
|
|
|
|
#endregion 面板风格
|
|
#region 鼠标样式
|
|
public void IsCrossCursor()
|
{
|
this.chartControl1.Cursor = System.Windows.Forms.Cursors.Cross;
|
}
|
|
public void IsHandCursor()
|
{
|
this.chartControl1.Cursor = System.Windows.Forms.Cursors.Hand;
|
}
|
|
#endregion 鼠标样式
|
|
|
#region 查询点
|
protected Eventech.Model.UnitQ _queryInfo_unitQ = Eventech.Model.UnitQ.M3H;
|
protected Eventech.Model.UnitH _queryInfo_unitH = Eventech.Model.UnitH.M;//图表查询用的单位
|
private Eventech.Model.GroupPoint _queryPt1 = new Eventech.Model.GroupPoint(0, 0, 0, 0, 0);
|
private DevExpress.XtraCharts.ConstantLine QueryLineVertical1 = null;
|
private DevExpress.XtraCharts.TextAnnotation QueryParaInfoText = null;
|
private DevExpress.XtraCharts.Series QueryLineHorizontal = null;
|
protected bool _isQueryCurvePara1 = false;
|
//修改了查询点位置
|
public Action<Eventech.Model.GroupPoint> OnChangeQueryCurvePoint = null;
|
|
public bool IsQueryCurvePara1
|
{
|
get
|
{
|
return _isQueryCurvePara1;
|
}
|
}
|
|
public void SetQueryPointQ1(double q)
|
{
|
_queryPt1.Q = q;
|
_queryPt1.NPSH = -1;
|
|
QueryLineVertical1.AxisValue = _queryPt1.Q;
|
|
if (_coordinateParas == null)
|
{
|
QueryLineHorizontal.Points.Clear();
|
}
|
else
|
{
|
CalcQueryPointParasByQ1(_queryPt1.Q);
|
|
SetQueryLineParaHoriz();
|
}
|
}
|
|
//是否可以查询曲线参数
|
public void SetQueryLineDisp1(bool isDisp)
|
{
|
_isQueryCurvePara1 = isDisp;
|
QueryLineVertical1.Visible = _isQueryCurvePara1;
|
QueryLineVertical1.Title.Visible = _isQueryCurvePara1;
|
QueryParaInfoText.Visible = _isQueryCurvePara1;
|
QueryLineHorizontal.Visible = _isQueryCurvePara1;
|
if (_queryPt1.Q > 0)
|
{
|
if (_queryPt1.H < 0.001)
|
{
|
CalcQueryPointParasByQ1(_queryPt1.Q);
|
SetQueryLineParaHoriz();
|
}
|
}
|
if (_isQueryCurvePara1)
|
this.IsHandCursor();
|
else
|
this.IsCrossCursor();
|
}
|
|
//计算查询点1
|
private void CalcQueryPointParasByQ1(double queryQ)
|
{
|
if (_curveExpressQH == null)
|
return;
|
if (queryQ < _curveExpressQH.RangeMin * 1.01 || queryQ > _curveExpressQH.RangeMax * 0.999)
|
{
|
CalcQueryPointParasExtendByQ1(queryQ);
|
return;
|
}
|
|
|
_queryPt1.Q = queryQ;
|
_queryPt1.NPSH = -1;
|
_queryPt1.E = -1;
|
_queryPt1.P = -1;
|
_queryPt1.H = Eventech.Common.FitCurveHelper.GetFitPointY(_curveExpressQH, queryQ);
|
|
|
if (_curveExpressQE != null)
|
{
|
_queryPt1.E = Eventech.Common.FitCurveHelper.GetFitPointY(_curveExpressQE, queryQ);
|
}
|
|
if (_curveExpressQP != null)
|
{
|
_queryPt1.P = Eventech.Common.FitCurveHelper.GetFitPointY(_curveExpressQP, queryQ);
|
}
|
|
//if (wrkCurve.FeatCurveNPSH != null)
|
//{
|
// if (queryQ > wrkCurve.FeatCurveNPSH.CurveExpress.RangeMin && queryQ < wrkCurve.FeatCurveNPSH.CurveExpress.RangeMax)
|
// {
|
// _queryPt1.NPSH = Eventech.Common.FitCurveHelper.GetFitPointY(wrkCurve.FeatCurveNPSH.CurveExpress, queryQ);
|
// }
|
//}
|
|
if (this._isQueryCurvePara1)
|
{
|
if (OnChangeQueryCurvePoint != null)
|
{
|
OnChangeQueryCurvePoint(_queryPt1);
|
}
|
}
|
}
|
//_curveInfoQH_Extend
|
private void CalcQueryPointParasExtendByQ1(double queryQ)
|
{
|
if (_curveInfoQH_Extend == null || _curveInfoQH_Extend.Count() < 3)
|
return;
|
if (queryQ < _curveInfoQH_Extend.First().X * 1.01 || queryQ > _curveInfoQH_Extend.Last().X * 0.999)
|
return;
|
|
_queryPt1.Q = queryQ;
|
_queryPt1.NPSH = -1;
|
_queryPt1.E = -1;
|
_queryPt1.P = -1;
|
_queryPt1.H = Eventech.Common.FitCurveHelper.GetFitPointY(_curveInfoQH_Extend, queryQ);
|
|
if (this._isQueryCurvePara1)
|
{
|
if (OnChangeQueryCurvePoint != null)
|
{
|
OnChangeQueryCurvePoint(_queryPt1);
|
}
|
}
|
}
|
|
//构建查询文字
|
private void BuildQueryParaInfo()
|
{
|
if (!this._isQueryCurvePara1)
|
return;
|
|
StringBuilder builder = new StringBuilder();
|
|
|
builder.AppendFormat(string.Format("---{0}---", "曲线点参数"));
|
//builder.AppendLine();
|
QueryLineVertical1.AxisValue = _queryPt1.Q;
|
|
|
var strInfob = string.Format("{0} {1}",
|
TProduct.Common.RoundHelper.GetDispValueFlow(
|
Eventech.Common.UnitQHelper.fromM3H(this._queryInfo_unitQ, _queryPt1.Q)),
|
Eventech.Common.UnitQHelper.GetEnUnitName(this._queryInfo_unitQ));
|
QueryLineVertical1.Title.Text = strInfob;
|
|
BuildQueryPtString(_queryPt1, ref builder);
|
QueryParaInfoText.Text = builder.ToString();
|
}
|
|
//
|
private string BuildQueryPtString(Eventech.Model.GroupPoint queryPt, ref StringBuilder builder)
|
{
|
builder.AppendLine("");
|
|
builder.AppendFormat(" {0}:{1} {2}", "流量",
|
TProduct.Common.RoundHelper.GetDispValueFlow(
|
Eventech.Common.UnitQHelper.fromM3H(this._queryInfo_unitQ, queryPt.Q)),
|
Eventech.Common.UnitQHelper.GetEnUnitName(this._queryInfo_unitQ));
|
|
|
|
builder.AppendLine("");
|
|
builder.AppendFormat(" {0}:{1} {2} ", "扬程",
|
TProduct.Common.RoundHelper.GetDispValueHead(queryPt.H),
|
Eventech.Common.UnitHHelper.GetEnUnitName(this._queryInfo_unitH));
|
|
|
if (queryPt.E > 0)
|
{
|
builder.AppendLine("");
|
builder.AppendFormat(" {0}:{1:N1}%", "效率", queryPt.E);
|
}
|
if (queryPt.P > 0)
|
{
|
builder.AppendLine("");
|
if (this._coordinate_unitP == UnitP.KW)
|
{
|
builder.AppendFormat(" {0}:{1}kW", "功率",
|
TProduct.Common.RoundHelper.GetDispValuePower(queryPt.P));
|
}
|
else
|
{
|
builder.AppendFormat(" {0}:{1} W", "功率",
|
TProduct.Common.RoundHelper.GetDispValuePower(queryPt.P * 1000));
|
}
|
}
|
|
|
|
|
|
//if (queryPt.NPSH > 0)
|
//{
|
// builder.AppendLine("");
|
// builder.AppendFormat(" {0}:{1}{2}",
|
// SPump.WinFrmUI.Localization.TranslateHelper.GetString("汽蚀"),
|
// CalcDispValueNPSH(queryPt.NPSH),
|
// Eventech.Common.UnitHHelper.GetEnUnitName(_coordinate_unitNPSH));
|
//}
|
|
return builder.ToString();
|
}
|
|
private bool CalcCurveParasByH(double wrkH, ref double wrkQ)
|
{
|
if (_curveExpressQH == null)
|
return false;
|
|
if (wrkH < this._coordinateParas.DispMinH() * 1.01 || wrkH > this._coordinateParas.DispMaxH() * 0.999)
|
return false;
|
|
List<Eventech.Model.FeatPoint> intrPts = Eventech.Common.FitCurveHelper.GetInterPointX(_curveExpressQH, wrkH);
|
if (intrPts == null || intrPts.Count == 0)
|
{
|
if (_curveInfoQH_Extend == null || _curveInfoQH_Extend.Count() < 3)
|
return false;
|
List<Eventech.Model.FeatPoint> intrPts2 = Eventech.Common.FitCurveHelper.GetInterPointX(_curveInfoQH_Extend, wrkH);
|
if (intrPts2 == null || intrPts2.Count == 0)
|
{
|
return false;
|
}
|
wrkQ = intrPts2.Last().X;
|
return true;
|
}
|
else
|
{
|
wrkQ = intrPts.Last().X;
|
return true;
|
}
|
}
|
|
private void MenuItemLine设置颜色_Click(object sender, EventArgs e)
|
{
|
if (_rightClickObj == QueryLineHorizontal)
|
{
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = QueryLineHorizontal.View.Color;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
QueryLineHorizontal.View.Color = colorDialog1.Color;
|
}
|
}
|
else if (_rightClickObj == QueryLineVertical1)
|
{
|
var refLine = _rightClickObj as DevExpress.XtraCharts.ConstantLine;
|
if (refLine == null)
|
return;
|
|
System.Windows.Forms.ColorDialog colorDialog1;
|
colorDialog1 = new System.Windows.Forms.ColorDialog();
|
|
colorDialog1.Color = refLine.Color;
|
if (colorDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
{
|
refLine.Color = colorDialog1.Color;
|
refLine.Title.TextColor = colorDialog1.Color;
|
}
|
}
|
}
|
|
private void MenuItemLine设置值_Click(object sender, EventArgs e)
|
{
|
if (_rightClickObj == QueryLineHorizontal)
|
{
|
SetRefLineValue1Dlg theDlg = new SetRefLineValue1Dlg();
|
theDlg.SetUnitName(Eventech.Common.UnitHHelper.GetEnUnitName(this._queryInfo_unitH));
|
theDlg.RefLineValue = Convert.ToDecimal(Math.Round(QueryLineHorizontal.Points[0].Values[0], 1));
|
|
if (theDlg.ShowDialog() == DialogResult.OK)
|
{
|
double refH = Convert.ToDouble(theDlg.RefLineValue);
|
double refQ = 0;
|
if (CalcCurveParasByH(refH, ref refQ))
|
{
|
CalcQueryPointParasByQ1(refQ);
|
BuildQueryParaInfo();
|
SetQueryLineParaHoriz();
|
}
|
}
|
}
|
else if (_rightClickObj == QueryLineVertical1)
|
{
|
if (this._queryInfo_unitQ == UnitQ.M3H)
|
{
|
SetRefLineValue2Dlg theDlg = new SetRefLineValue2Dlg();
|
theDlg.SetUnitName(Eventech.Common.UnitQHelper.GetEnUnitName(this._queryInfo_unitQ));
|
theDlg.SetValue(Math.Round(Convert.ToDouble(QueryLineVertical1.AxisValue), 2));
|
if (theDlg.ShowDialog() == DialogResult.OK)
|
{
|
CalcQueryPointParasByQ1(theDlg.GetValue().Value);
|
BuildQueryParaInfo();
|
SetQueryLineParaHoriz();
|
}
|
}
|
else
|
{
|
SetRefLineValue2Dlg theDlg = new SetRefLineValue2Dlg();
|
var vvv = Eventech.Common.UnitQHelper.fromM3H(this._queryInfo_unitQ,
|
Convert.ToDouble(QueryLineVertical1.AxisValue));
|
theDlg.SetUnitName(Eventech.Common.UnitQHelper.GetEnUnitName(this._queryInfo_unitQ));
|
theDlg.SetValue(Math.Round(vvv, 2));
|
if (theDlg.ShowDialog() == DialogResult.OK)
|
{
|
vvv = Eventech.Common.UnitQHelper.toM3H(this._queryInfo_unitQ, theDlg.GetValue().Value);
|
CalcQueryPointParasByQ1(vvv);
|
BuildQueryParaInfo();
|
SetQueryLineParaHoriz();
|
}
|
}
|
|
}
|
}
|
|
private void SetQueryLineParaHoriz()
|
{
|
QueryLineHorizontal.Points.Clear();
|
if (_coordinateParas != null)
|
QueryLineHorizontal.Points.Add(new SeriesPoint(_coordinateParas.CoordMinQ, _queryPt1.H));
|
else
|
QueryLineHorizontal.Points.Add(new SeriesPoint(0, _queryPt1.H));
|
QueryLineHorizontal.Points.Add(new SeriesPoint(_queryPt1.Q, _queryPt1.H));
|
}
|
|
|
private bool _isMoveQueryLineQ1 = false;
|
private bool _isMoveQueryLineH1 = false;
|
|
#endregion 查询点
|
|
|
}
|
}
|