/// <summary> /// 处理保证点性能参数测试结果的逻辑代码 /// </summary> /// <param name="_额定流量">保证点的X坐标</param> /// <param name="_额定扬程">保证点的Y坐标</param> private 交点坐标 f_计算保证点性能参数流量扬程点测试结果(double _额定流量, double _额定扬程, string 需要进行绘制的曲线ID) { 交点坐标 point = new 交点坐标(); for (int j = 0; j < this.xyGraph1.Graph.Plots.Count; j++) { if (this.xyGraph1.Graph.Plots[j].Tag.ToString().Equals(需要进行绘制的曲线ID)) { List <差值单元项> 统计差值集合 = new List <差值单元项>(); double[] xData = this.xyGraph1.Graph.Plots[j].GetXData(); double[] yData = this.xyGraph1.Graph.Plots[j].GetYData(); double 斜率 = _额定扬程 / _额定流量; // 根据HQ曲线的分割点数计算所有的Y值与直线Y值的差 for (int i = 0; i < this.xyGraph1.Graph.Plots[j].HistoryCount; i++) { 差值单元项 _差值集合 = new 差值单元项(); _差值集合.差值 = Math.Abs(xData[i] * 斜率 - yData[i]); _差值集合.序号 = i; 统计差值集合.Add(_差值集合); } // 找出差值最小的点,即两线交汇的误差最小点 double 最小差值 = 统计差值集合.Min(item => item.差值); 差值单元项 差值单元项 = 统计差值集合.Find(item => item.差值 == 最小差值); point.X = xData[差值单元项.序号]; point.Y = yData[差值单元项.序号]; return(point); } } return(point); }
void grid1_BtnReduceRowClick(object sender, EventArgs e) { DataRowView row = (DataRowView)grid1.ExportBandView.GetRow(grid1.ExportBandView.FocusedRowHandle); if (row == null) { return; } decimal id = System.Convert.ToDecimal(row["id"].ToString()); logic.RemoveRecord(id, "潜水泵性能试验"); if (logic.GetReportTable("潜水泵性能试验").Rows.Count == 0) { return; } f_绘制影子性能曲线(xyGraph1, "H-Q-S", grid1, "额定转速下_流量", "额定转速下_扬程"); f_绘制影子性能曲线(xyGraph1, "P-Q-S", grid1, "额定转速下_流量", "额定转速下_轴功率"); f_绘制影子性能曲线(xyGraph1, "EFFp-Q-S", grid1, "额定转速下_流量", "额定转速下_泵效率"); //f_绘制影子性能曲线(xyGraph1, "EFFgr-Q-S", grid1, "额定转速下_流量", "额定转速下_机组效率"); f_绘制性能曲线(xyGraph1, "H-Q", grid1, "额定转速下_流量", "额定转速下_扬程", 4, 10000); double[] const_P_Q = f_绘制性能曲线(xyGraph1, "P-Q", grid1, "额定转速下_流量", "额定转速下_轴功率", 4, 1000); double[] const_EFFp_Q = f_绘制性能曲线(xyGraph1, "EFFp-Q", grid1, "额定转速下_流量", "额定转速下_泵效率", 4, 1000); //f_绘制性能曲线(xyGraph1, "EFFgr-Q", grid1, "额定转速下_流量", "额定转速下_机组效率", 4); 交点坐标 交点坐标_流量扬程点 = f_计算保证点性能参数流量扬程点测试结果(全局缓存.当前试验组信息.水泵额定流量, 全局缓存.当前试验组信息.水泵额定扬程, "H-Q"); 交点坐标 交点坐标_轴功率流量点 = f_计算保证点性能参数测试结果(交点坐标_流量扬程点, const_P_Q); 交点坐标 交点坐标_泵效率流量点 = f_计算保证点性能参数测试结果(交点坐标_流量扬程点, const_EFFp_Q); f_显示保证点性能参数测试结果(交点坐标_流量扬程点.X, 交点坐标_流量扬程点.Y, 交点坐标_轴功率流量点.Y, 交点坐标_泵效率流量点.Y); SaveImage(this.xyGraph1.Graph, this.xyGraph1.曲线标签组, 700, 700); }
private 交点坐标 f_计算保证点性能参数测试结果(交点坐标 垂线坐标, double[] 方程常量组) { 交点坐标 交点坐标 = new 性能试验.交点坐标(); double[] d = 辅助库.CurveFitting.f_根据X计算Y(new double[] { 垂线坐标.X }, 方程常量组, 4); 交点坐标.X = 垂线坐标.X; 交点坐标.Y = d[0]; return(交点坐标); }
void grid1_BtnAddRowClick(object sender, EventArgs e) { logic.HandGather("潜水泵性能试验"); f_绘制影子性能曲线(xyGraph1, "H-Q-S", grid1, "额定转速下_流量", "额定转速下_扬程"); f_绘制影子性能曲线(xyGraph1, "P-Q-S", grid1, "额定转速下_流量", "额定转速下_轴功率"); f_绘制影子性能曲线(xyGraph1, "EFFp-Q-S", grid1, "额定转速下_流量", "额定转速下_泵效率"); //f_绘制影子性能曲线(xyGraph1, "EFFgr-Q-S", grid1, "额定转速下_流量", "额定转速下_机组效率"); f_绘制性能曲线(xyGraph1, "H-Q", grid1, "额定转速下_流量", "额定转速下_扬程", 4, 10000); double[] const_P_Q = f_绘制性能曲线(xyGraph1, "P-Q", grid1, "额定转速下_流量", "额定转速下_轴功率", 4, 1000); double[] const_EFFp_Q = f_绘制性能曲线(xyGraph1, "EFFp-Q", grid1, "额定转速下_流量", "额定转速下_泵效率", 4, 1000); //f_绘制性能曲线(xyGraph1, "EFFgr-Q", grid1, "额定转速下_流量", "额定转速下_机组效率", 4); 交点坐标 交点坐标_流量扬程点 = f_计算保证点性能参数流量扬程点测试结果(全局缓存.当前试验组信息.水泵额定流量, 全局缓存.当前试验组信息.水泵额定扬程, "H-Q"); 交点坐标 交点坐标_轴功率流量点 = f_计算保证点性能参数测试结果(交点坐标_流量扬程点, const_P_Q); 交点坐标 交点坐标_泵效率流量点 = f_计算保证点性能参数测试结果(交点坐标_流量扬程点, const_EFFp_Q); f_显示保证点性能参数测试结果(交点坐标_流量扬程点.X, 交点坐标_流量扬程点.Y, 交点坐标_轴功率流量点.Y, 交点坐标_泵效率流量点.Y); SaveImage(this.xyGraph1.Graph, this.xyGraph1.曲线标签组, 700, 700); }
private 交点坐标 f_计算保证点性能参数测试结果(交点坐标 垂线坐标, double[] 方程常量组) { 交点坐标 交点坐标 = new 性能试验.交点坐标(); double[] d = 辅助库.CurveFitting.f_根据X计算Y(new double[] { 垂线坐标.X }, 方程常量组, 4); 交点坐标.X = 垂线坐标.X; 交点坐标.Y = d[0]; return 交点坐标; }
/// <summary> /// 处理保证点性能参数测试结果的逻辑代码 /// </summary> /// <param name="_额定流量">保证点的X坐标</param> /// <param name="_额定扬程">保证点的Y坐标</param> private 交点坐标 f_计算保证点性能参数流量扬程点测试结果(double _额定流量, double _额定扬程, string 需要进行绘制的曲线ID) { 交点坐标 point = new 交点坐标(); for (int j = 0; j < this.xyGraph1.Graph.Plots.Count; j++) { if (this.xyGraph1.Graph.Plots[j].Tag.ToString().Equals(需要进行绘制的曲线ID)) { List<差值单元项> 统计差值集合 = new List<差值单元项>(); double[] xData = this.xyGraph1.Graph.Plots[j].GetXData(); double[] yData = this.xyGraph1.Graph.Plots[j].GetYData(); double 斜率 = _额定扬程 / _额定流量; // 根据HQ曲线的分割点数计算所有的Y值与直线Y值的差 for (int i = 0; i < this.xyGraph1.Graph.Plots[j].HistoryCount; i++) { 差值单元项 _差值集合 = new 差值单元项(); _差值集合.差值 = Math.Abs(xData[i] * 斜率 - yData[i]); _差值集合.序号 = i; 统计差值集合.Add(_差值集合); } // 找出差值最小的点,即两线交汇的误差最小点 double 最小差值 = 统计差值集合.Min(item=>item.差值); 差值单元项 差值单元项 = 统计差值集合.Find(item => item.差值 == 最小差值); point.X = xData[差值单元项.序号]; point.Y = yData[差值单元项.序号]; return point; } } return point; }