using System; using System.Collections.Generic; using System.Linq; namespace HStation.RevitDev.RevitDataExport { public static class OnePointHelper { /// /// 获取流量扬程点列表 /// /// 额定流量 /// 额定扬程 /// 额定转速 public static List GetQhPtList(double flow, double head, double rpm) { var tuple = Get(flow, head, rpm); if (tuple == null) { return default; } var qh_pt_list = tuple.Item1; if (qh_pt_list == null || !qh_pt_list.Any()) { return default; } var pt_list = qh_pt_list.Select(x => new System.Drawing.PointF((float)x.X, (float)x.Y)).ToList(); return pt_list; } /// /// 获取 /// /// 额定流量 /// 额定扬程 /// 额定转速 /// 叶轮级数 /// 效率 /// 关死点 /// 延长流量比率 /// 是否是双吸泵 /// 泵类型 /// 单级单吸离心泵 = 1, /// 多级离心泵 = 2, /// 双吸离心泵 = 3, /// 化工泵 = 4, /// 渣浆泵 = 5, /// 长轴泵 = 6 /// /// private static Tuple, List, List> Get(double flow, double head, double rpm, int impeller = 1, double? eff = null, double? k0 = null, double? flow_max_ratio = null, bool is_sxb = false, int pump_type = 1) { if (flow < 1) { return default; } if (head < 0.1) { return default; } if (rpm < 10) { return default; } if (k0.HasValue && (k0 < 1.001 || k0 > 2.5)) { return default; } var ns = 0d; if (is_sxb) { ns = PumpCalculateHelper.CalculateNs(flow / 2, head / impeller, rpm); } else { ns = PumpCalculateHelper.CalculateNs(flow, head / impeller, rpm); } if (eff == null) { eff = PumpCalculateHelper.CalculateEByPumpType(flow, head, ns, pump_type); } if (eff == null || eff > 100) { return default; } var group_pt = new GroupPoint(); group_pt.Q = flow; group_pt.H = head; group_pt.E = eff.Value; group_pt.P = PumpCalculateHelper.CalculateP(flow, head, eff.Value); group_pt.NPSH = PumpCalculateHelper.CalculateNPSHrByPumpType(flow, head, ns, pump_type); List qh_pt_list = null, qe_pt_list = null, qp_pt_list = null, npsh_pt_list = null; var bol = DimensionlessCurvesHelper.CalcPoints(group_pt, ns, k0, ref qh_pt_list, ref qe_pt_list, ref qp_pt_list, ref npsh_pt_list, is_sxb, impeller); if (!bol) { return default; } //消除驼峰 if (k0 == null || k0 < 0.1) { //200为预估值 double space_head = head / 200; for (int i = qh_pt_list.Count - 2; i >= 0; i--) { if (qh_pt_list[i].Y < qh_pt_list[i + 1].Y) { qh_pt_list[i].Y = qh_pt_list[i + 1].Y + space_head; } } } var fit_type = eFitType.CubicCurve; if (flow_max_ratio.HasValue && flow_max_ratio > 1.01 && flow_max_ratio < 1.8) { var flow_ratio = flow * flow_max_ratio.Value / qh_pt_list.Last().X; if (flow_max_ratio > 1.35) { var qh_point_list_new = qh_pt_list.GetFitPointsByExtend(fit_type, flow_ratio); var max_eff = CurveLineHelper.GetInsertY(qe_pt_list[qe_pt_list.Count - 2].X, qe_pt_list[qe_pt_list.Count - 1].X, qe_pt_list[qe_pt_list.Count - 2].Y, qe_pt_list[qe_pt_list.Count - 1].Y, flow_max_ratio.Value * flow); qe_pt_list.Add(new CurvePoint(flow_max_ratio.Value * flow, max_eff)); qh_pt_list = qh_point_list_new; qe_pt_list = new FitHelper(qe_pt_list).GetFitPoints(20); var is_x_start_zero = true; if (qh_pt_list.First().X > 500 || qh_pt_list.First().X > qh_pt_list.Last().X * 0.2) is_x_start_zero = false; qp_pt_list = PumpCalculateHelper.CalculateP_AlignPointE(fit_type, fit_type, qh_pt_list, qe_pt_list, Constant.WaterDensity, -1, is_x_start_zero); } else { qh_pt_list = qh_pt_list.GetFitPointsByExtend(fit_type, flow_ratio); qe_pt_list = qe_pt_list.GetFitPointsByExtend(fit_type, flow_ratio); qp_pt_list = qp_pt_list.GetFitPointsByExtend(fit_type, flow_ratio); } } return new Tuple, List, List>(qh_pt_list, qe_pt_list, qp_pt_list); } } }