using System; using System.Collections.Generic; using System.Linq; namespace IStation.Common { public class PumpParaHelper { #region 计算推荐参数 public enum eCalcPumpType { 单级单吸离心泵 = 1, 多级离心泵 = 2, 双吸离心泵 = 3, 化工泵 = 4, 渣浆泵 = 5, 长轴泵 = 6 } //capacity static double[] effq = new double[33]{5,10,15,20,25,30,40,50,60,70,80,90,100,150,200,300,400, 500,600,700,800,900,1000,1500,2000,3000,4000,5000,6000,7000,8000,9000,10000}; //1 single stage seriesEntity eff static double[] singleeff = new double[33]{58.0,64.0,67.2,69.4,70.9,72.0,73.8,74.9,75.8,76.5, 77.0,77.6,78.0,79.8,80.8,82.0,83.0,83.7,84.2,84.7,85.0,85.3,85.7,86.6,87.2, 88.0,88.6,89.0,89.2,89.5,89.7,89.9,90.0}; //2 multi stage seriesEntity eff static double[] multieff = new double[26]{55.4,59.4,61.8,63.5,64.8,65.9,67.5,68.9,69.9,70.9, 71.5,72.3,72.9,75.3,76.9,79.2,80.6,81.5,82.2,82.8,83.1,83.5,83.9,84.8, 85.1,85.5}; //1 correct eff static double[] effcorrect1 = new double[19]{32,25.5,20.6,17.3,14.7,12.5,10.5,9.0,7.5,6.0, 5.0,4.0,3.2,2.5,2.0,1.5,1.0,0.5,0}; //2 correct eff static double[] effcorrect2 = new double[10] { 0, 0.3, 0.7, 1.0, 1.3, 1.7, 1.9, 2.2, 2.7, 3.0 }; static double[] effns1 = new double[19] { 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 110, 120 }; static double[] effns2 = new double[10] { 210, 220, 230, 240, 250, 260, 270, 280, 290, 300 }; //计算推荐效率 public static double GetRecommendEfficiency(double Q, double H, double n, int iPumpType) { double ns = CalculateNs(Q, H, n); double eff, qjs1, qjs2, qjs3, effjs1, effjs2, effjs3, correct = 1; int i = 0; double dltE = 0.0; double q0 = Q; double h0 = H; // double t = 1000; if (iPumpType == 1) t = 10000; if (iPumpType == 2) t = 300000; if (iPumpType == 3) t = 10000; if (iPumpType == 4) t = 10000; if (iPumpType == 5) t = 10000; if (iPumpType == 6) t = 10000; if (q0 > t) { i = IStation.Common.PumpParaHelper.effq.Length - 1; } else if (q0 >= 1.5 && q0 <= t) { i = 0; //while (effq[i] <= q0) //{ // i++; //} for (i = 0; IStation.Common.PumpParaHelper.effq[i] <= q0; i++) { } } else { return -1; } if (i >= effq.Length) i = effq.Length - 1; if (q0 >= 10) { qjs1 = effq[i]; qjs2 = effq[i - 1]; qjs3 = effq[i - 2]; switch (iPumpType) { case 1: if (i >= singleeff.Length) i = singleeff.Length - 1; effjs1 = singleeff[i]; effjs2 = singleeff[i - 1]; effjs3 = singleeff[i - 2]; break; case 2: if (i >= multieff.Length) i = multieff.Length - 1; effjs1 = multieff[i]; effjs2 = multieff[i - 1]; effjs3 = multieff[i - 2]; break; case 3: if (i >= singleeff.Length) i = singleeff.Length - 1; effjs1 = singleeff[i]; effjs2 = singleeff[i - 1]; effjs3 = singleeff[i - 2]; dltE = -2; break; case 4: if (i >= singleeff.Length) i = singleeff.Length - 1; effjs1 = singleeff[i]; effjs2 = singleeff[i - 1]; effjs3 = singleeff[i - 2]; dltE = 5; break; case 5: effjs1 = singleeff[i]; effjs2 = singleeff[i - 1]; effjs3 = singleeff[i - 2]; dltE = 8; break; default: effjs1 = singleeff[i]; effjs2 = singleeff[i - 1]; effjs3 = singleeff[i - 2]; dltE = 3.5; break; } } else { qjs1 = effq[2]; qjs2 = effq[1]; qjs3 = effq[0]; switch (iPumpType) { case 1: effjs1 = singleeff[2]; effjs2 = singleeff[1]; effjs3 = singleeff[0]; break; case 2: effjs1 = multieff[2]; effjs2 = multieff[1]; effjs3 = multieff[0]; break; case 3: effjs1 = singleeff[2]; effjs2 = singleeff[1]; effjs3 = singleeff[0]; dltE = -2; break; case 4: effjs1 = singleeff[2]; effjs2 = singleeff[1]; effjs3 = singleeff[0]; dltE = 5; break; case 5: effjs1 = singleeff[2]; effjs2 = singleeff[1]; effjs3 = singleeff[0]; dltE = 8; break; default: effjs1 = singleeff[2]; effjs2 = singleeff[1]; effjs3 = singleeff[0]; dltE = 3.5; break; } } eff = (q0 - qjs2) * (q0 - qjs3) * effjs1 / ((qjs1 - qjs2) * (qjs1 - qjs3)) + (q0 - qjs1) * (q0 - qjs3) * effjs2 / ((qjs2 - qjs1) * (qjs2 - qjs3)) + (q0 - qjs1) * (q0 - qjs2) * effjs3 / ((qjs3 - qjs1) * (qjs3 - qjs2)) - dltE; if ((ns < 120 && ns >= 20) || (ns < 300 && ns > 210)) { if (ns < 120 && ns >= 20) { for (i = 0; effns1[i] <= ns; i++) { } if (ns >= 25) { qjs1 = effns1[i]; qjs2 = effns1[i - 1]; qjs3 = effns1[i - 2]; effjs1 = effcorrect1[i]; effjs2 = effcorrect1[i - 1]; effjs3 = effcorrect1[i - 2]; } else { qjs1 = effns1[i + 1]; qjs2 = effns1[i]; qjs3 = effns1[i - 1]; effjs1 = effcorrect1[i + 1]; effjs2 = effcorrect1[i]; effjs3 = effcorrect1[i - 1]; } } if (ns < 300 && ns > 210) { for (i = 0; effns2[i] <= ns; i++) { } if (ns >= 220) { qjs1 = effns2[i]; qjs2 = effns2[i - 1]; qjs3 = effns2[i - 2]; effjs1 = effcorrect2[i]; effjs2 = effcorrect2[i - 1]; effjs3 = effcorrect2[i - 2]; } else { qjs1 = effns2[i + 1]; qjs2 = effns2[i]; qjs3 = effns2[i - 1]; effjs1 = effcorrect2[i + 1]; effjs2 = effcorrect2[i]; effjs3 = effcorrect2[i - 1]; } } correct = (ns - qjs2) * (ns - qjs3) * effjs1 / ((qjs1 - qjs2) * (qjs1 - qjs3)) + (ns - qjs1) * (ns - qjs3) * effjs2 / ((qjs2 - qjs1) * (qjs2 - qjs3)) + (ns - qjs1) * (ns - qjs2) * effjs3 / ((qjs3 - qjs1) * (qjs3 - qjs2)); } if (ns >= 300) correct = 3.0; if (ns < 20) correct = 32.0; if (ns >= 120 && ns <= 210) correct = 0; eff = eff - correct; return eff; } //计算推荐D2 public static double GetRecommendD2(double Q, double H, double n, int iPumpType) { double ns = CalculateNs(Q, H, n); double D_Q = 0;//nsK if (iPumpType == 3) D_Q = Q / 2; else D_Q = Q; double KD2 = 9.35 * Math.Pow(ns / 100, -0.5); double D2 = KD2 * Math.Pow(D_Q / 3600 / n, 0.333) * 1000; return D2; } //计算推荐NPSHr public static double GetRecommendNPSHr(double Q, double H, double n, int iPumpType) { double ns = CalculateNs(Q, H, n); double S_Q = 10; if (iPumpType == 3) S_Q = Q / 2; else S_Q = Q; double K = Math.Pow(ns, 1.3333) * 216 / 1000000; return K * H; } #endregion #region 计算比转速度 public static double CalculateNs(double Q, double H, double n) { return 3.65 * n * Math.Sqrt(Q / 3600) / Math.Pow(H, 0.75); } public static decimal CalculateNs(decimal Q, decimal H, decimal n) { return Convert.ToDecimal(3.65 * Convert.ToDouble(n) * Math.Sqrt(Convert.ToDouble(Q) / 3600) / Math.Pow(Convert.ToDouble(H), 0.75)); } //public static double CalculateNs(IStation.Model.RATE para, double n) //{ // return 3.65 * n * Math.Sqrt(para.Q / 3600) / Math.Pow(para.H, 0.75); //} #endregion #region 计算效率(效率用百分数):Q用m^3/h H为m ,P为kw,density密度为kg/m^3,gavity用重力加速度m/s^2 public static double CalculateE(double Q, double H, double P, double midu, double gavity) { P = P * 1000;//此处 1000 是 kw换成w Q = Q / 3600;//此处 3600 是 小时换成秒 double E = 0; if (P < 0.1) E = 0; else E = midu * gavity * Q * H / P; return Math.Round(E * 100, 2);//效率用百分数 } public static double CalculateE(double Q, double H, double P, double midu) { return CalculateE(Q, H, P, midu, IStation.Formula.ConstantParas.g); } public static double CalculateE(double Q, double H, double P) { return CalculateE(Q, H, P, IStation.Formula.ConstantParas.WaterDensity, IStation.Formula.ConstantParas.g); } #endregion #region 计算功率:Q用m^3/h H为m ,P为kw,density密度为kg/m^3,gavity用重力加速度m/s^2,效率用百分数 public static double CalculateP(double Q, double H, double E, double midu, double gavity) { E = E / 100;//效率用百分数 Q = Q / 3600;//此处 3600 是 m^3/s double P = 0; if (E < 0.01) P = 0; else P = midu * gavity * Q * H / E; if (P / 1000 < 2) { return Math.Round(P / 1000, 4);//此处 1000 是 kw换成w } else if (P / 1000 < 30) { return Math.Round(P / 1000, 3);//此处 1000 是 kw换成w } else if (P / 1000 < 100) { return Math.Round(P / 1000, 2);//此处 1000 是 kw换成w } else { return Math.Round(P / 1000, 1);//此处 1000 是 kw换成w } } public static double CalculateP(double Q, double H, double E, double midu) { return CalculateP(Q, H, E, midu, IStation.Formula.ConstantParas.g); } public static double CalculateP(double Q, double H, double E) { return CalculateP(Q, H, E, IStation.Formula.ConstantParas.WaterDensity, IStation.Formula.ConstantParas.g); } public static List CalculateP(List pointQH, List pointQE) { if (pointQH == null || pointQH.Count() <= 2) return null; bool isFromZero = true; if (pointQH.First().X > 500 || pointQH.First().X > pointQH.Last().X * 0.2) isFromZero = false; return CalculateP_RefZero(IStation.Model.eCurveFitType.CubicCurve, IStation.Model.eCurveFitType.CubicCurve, IStation.Model.eCurveFitType.CubicCurve, pointQH, pointQE, IStation.Formula.ConstantParas.WaterDensity, -1, isFromZero); } //有时 会把零流量点扬程传入 ref_zero_power public static List CalculateP_RefZero( IStation.Model.eCurveFitType CurveFitTypeQH, IStation.Model.eCurveFitType CurveFitTypeQE, IStation.Model.eCurveFitType CurveFitTypeQP, List pointQH, List pointQE, double midu, double ref_zero_power, bool isFromZero) { if (pointQH == null || pointQH.Count < 3) return null; if (pointQE == null || pointQE.Count < 3) return null; var expressQH = new IStation.Model.CurveExpress(pointQH, CurveFitTypeQH); var expressQE = new IStation.Model.CurveExpress(pointQE, CurveFitTypeQE); var expressQP = CalculateP_RefZero(CurveFitTypeQE, expressQH, expressQE, midu, ref_zero_power, isFromZero, false); return IStation.Model.FitCurveHelper.GetFitPoints(expressQP, pointQE.Count()); } public static IStation.Model.CurveExpress CalculateP_RefZero( IStation.Model.eCurveFitType CurveFitTypeQP, IStation.Model.CurveExpress expressQH, IStation.Model.CurveExpress expressQE, double midu, double ref_zero_power, bool isFromZero, bool isSavePointInExpress) { if (expressQH == null) return null; if (expressQE == null) return null; int point_num = 16;//点不能太多 var pointQH = IStation.Model.FitCurveHelper.GetFitPoints(expressQH, point_num); if (pointQH == null || pointQH.Count < 3) return null; var pointQE = IStation.Model.FitCurveHelper.GetFitPoints(expressQE, point_num); if (pointQE == null || pointQE.Count < 3) return null; List pointQP = new List(); //间距 double minQ = Math.Max(pointQH.First().X, pointQE.First().X); double maxQ = Math.Min(pointQH.Last().X, pointQE.Last().X); // double Q, H, E, P; double space = (maxQ - minQ) / (point_num - 1); IStation.Model.FitCurveHelper fitCurveQE = new IStation.Model.FitCurveHelper(expressQE); IStation.Model.FitCurveHelper fitCurveQH = new IStation.Model.FitCurveHelper(expressQH); if (isFromZero) { #region 保证从0开始: 保证Q=0时,P不是计算出来的; for (int i = 5; i < point_num; i++)//前面几个点不要 { Q = pointQE.First().X + space * i; E = fitCurveQE.GetFitPointY(Q); H = fitCurveQH.GetFitPointY(Q); if (H < 0.1 || E < 0.5) continue; P = IStation.Common.PumpParaHelper.CalculateP(Q, H, E, midu); if (P < 2) { P = Math.Round(P, 3); } else if (P < 30) { P = Math.Round(P, 2); } else if (P < 100) { P = Math.Round(P, 1); } else { P = Math.Round(P, 0); } pointQP.Add(new IStation.Model.CurvePoint(Q, P)); } pointQP = IStation.Model.FitCurveHelper.GetFitPoints(pointQP, CurveFitTypeQP, point_num); if (pointQP == null) return null; if (ref_zero_power > 0.1) { pointQP.Insert(0, new IStation.Model.CurvePoint(0, ref_zero_power)); } else { if (pointQP[0].Y >= pointQP[1].Y) { pointQP[0].Y = pointQP[1].Y * 0.95; } double startP = IStation.Model.CurveLineHelper.GetYbyX(pointQP[0].X, pointQP[0].Y, pointQP[1].X, pointQP[1].Y, 0); if (startP < 0.001) startP = pointQP[0].Y; if (startP < 2) { startP = Math.Round(startP, 3); } else if (startP < 30) { startP = Math.Round(startP, 2); } else if (startP < 100) { startP = Math.Round(startP, 1); } else { startP = Math.Round(startP, 0); } pointQP.Insert(0, new IStation.Model.CurvePoint(0, startP)); } return new Model.CurveExpress(pointQP, CurveFitTypeQP, isSavePointInExpress); #endregion } else { #region 保证从0开始: 保证Q=0时,P不是计算出来的; for (int i = 0; i < point_num; i++)//前面几个点不要 { Q = pointQE.First().X + space * i; E = fitCurveQE.GetFitPointY(Q); H = fitCurveQH.GetFitPointY(Q); if (H < 0.1 || E < 0.5) continue; P = IStation.Common.PumpParaHelper.CalculateP(Q, H, E, midu); if (P < 2) { P = Math.Round(P, 3); } else if (P < 30) { P = Math.Round(P, 2); } else if (P < 100) { P = Math.Round(P, 1); } else { P = Math.Round(P, 0); } pointQP.Add(new IStation.Model.CurvePoint(Q, P)); } pointQP = IStation.Model.FitCurveHelper.GetFitPoints(pointQP, CurveFitTypeQP, point_num); if (pointQP == null) return null; return new Model.CurveExpress(pointQP, CurveFitTypeQP, isSavePointInExpress); #endregion } } #endregion #region 计算效率(效率用百分数):Q用L/s H为MPa ,P为kw,density密度为kg/m^3,gavity用重力加速度m/s^2 public static double CalculateE2(double Q, double H, double P, double midu, double gavity) { P = P * 1000;//此处 1000 是 kw换成w H = H * 1000 / IStation.Formula.ConstantParas.g;//换成m Q = Q / 1000;//此处 1000 是 L/s double E = 0; if (P < 0.1) E = 0; else E = midu * gavity * Q * H / P; return Math.Round(E * 100, 2);//效率用百分数 } public static double CalculateE2(double Q, double H, double P, double midu) { return CalculateE2(Q, H, P, midu, IStation.Formula.ConstantParas.g); } public static double CalculateE2(double Q, double H, double P) { return CalculateE2(Q, H, P, IStation.Formula.ConstantParas.WaterDensity, IStation.Formula.ConstantParas.g); } #endregion #region 计算功率:Q用L/s H为MPa ,P为kw,density密度为kg/m^3,gavity用重力加速度m/s^2,效率用百分数 public static double CalculateP2(double Q, double H, double E, double midu, double gavity) { H = H * 1000 / gavity;//换成m E = E / 100;//效率用百分数 Q = Q / 1000;//此处 1000 是 L/s double P = 0; if (E < 0.01) P = 0; else P = midu * gavity * Q * H / E; // return Math.Round(P / 1000, 2);//此处 1000 是 kw换成w if (P / 1000 < 2) { return Math.Round(P / 1000, 4);//此处 1000 是 kw换成w } else if (P / 1000 < 30) { return Math.Round(P / 1000, 3);//此处 1000 是 kw换成w } else if (P / 1000 < 100) { return Math.Round(P / 1000, 2);//此处 1000 是 kw换成w } else { return Math.Round(P / 1000, 1);//此处 1000 是 kw换成w } } public static double CalculateP2(double Q, double H, double E, double midu) { return CalculateP2(Q, H, E, midu, IStation.Formula.ConstantParas.g); } public static double CalculateP2(double Q, double H, double E) { return CalculateP2(Q, H, E, IStation.Formula.ConstantParas.WaterDensity, IStation.Formula.ConstantParas.g); } #endregion #region 汽蚀比转速(根据最大叶轮直径时的最佳效率点计算) //国内汽蚀比转速Q:M3/H public static double CalculateNPSHcGB(double n, double Q, double NPSHr) { if (NPSHr < 0.0001) return 0; //流量转成m3/s return 5.62 * n * Math.Pow(Q / 3600, 0.5) / Math.Pow(NPSHr, 0.75); } //美国/日本的汽蚀比转速 public static double CalculateNPSHcAPI(double n, double Q, double NPSHr) { if (NPSHr < 0.0001) return 0; return n * Math.Pow(Q / 3600, 0.5) / Math.Pow(NPSHr, 0.75); } #endregion #region 知道原始速度和改变后的速度,求原始效率originE对应改变后的效率 public static double GetSpeedE(double originE, double originN, double changeN)//转速 {//变速度公式(P65页) if (originN < 0.1 || changeN < 0.1) return originE; double ratio = originN / changeN; double bilv = Math.Pow(ratio, 0.17); return originE * 100 / (originE + (100 - originE) * bilv); } public static double GetSpeedE2(double originE, double originF, double changeF)//频率 {//变速度公式(P65页) if (originF < 0.1 || changeF < 0.1) return originE; double ratio = originF / changeF; double bilv = Math.Pow(ratio, 0.17); return originE * 100 / (originE + (100 - originE) * bilv); } #endregion } }