using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TProduct.Common { //小数点数 public class RoundHelper { public static double GetDispValueFlow(double flow) { if (flow < 1) return Math.Round(flow, 4); else if (flow < 5) return Math.Round(flow, 3); else if (flow < 15) return Math.Round(flow, 2); else return Math.Round(flow, 1); } public static double GetDispValueHead(double head) { if (head < 1) return Math.Round(head, 4); else if (head < 5) return Math.Round(head, 3); else if (head < 15) return Math.Round(head, 2); else return Math.Round(head, 1); } public static double GetDispValuePress(double head) { if (head < 2) return Math.Round(head, 4); else if (head < 5) return Math.Round(head, 3); else if (head < 15) return Math.Round(head, 2); else return Math.Round(head, 1); } public static double GetDispValuePower(double power) { if (power < 1) return Math.Round(power, 4); else if (power < 5) return Math.Round(power, 3); else if (power < 15) return Math.Round(power, 2); else return Math.Round(power, 1); } public static double GetDispValueEta(double eta) { if (eta < 30) return Math.Round(eta, 2); else return Math.Round(eta, 1); } public static int NpshRoundNumber_Large5 = 1; public static int NpshRoundNumber_small5 = 2; public static double GetDispValueNPSH(double npsh) { if (npsh < 5) return Math.Round(npsh, NpshRoundNumber_small5); else return Math.Round(npsh, NpshRoundNumber_Large5); } public static void Round_HEP(ref Eventech.Model.GroupPoint pt) { if (pt == null) return; pt.H = GetDispValueHead(pt.H); pt.E = Math.Round(pt.E,1); pt.P = GetDispValuePower(pt.P); pt.NPSH = GetDispValueNPSH(pt.NPSH); } } }