using System; namespace IStation.Common { public class RoundHelper { public static int NpshRoundNumber_Large5 = 1; public static int NpshRoundNumber_small5 = 2; public static double GetDispValueFlow(double flow) { if (flow < 1.0) { return Math.Round(flow, 4); } if (flow < 5.0) { return Math.Round(flow, 3); } if (flow < 15.0) { return Math.Round(flow, 2); } return Math.Round(flow, 1); } public static double GetDispValueHead(double head) { if (head < 1.0) { return Math.Round(head, 4); } if (head < 5.0) { return Math.Round(head, 3); } if (head < 15.0) { return Math.Round(head, 2); } return Math.Round(head, 1); } public static double GetDispValuePress(double head) { if (head < 2.0) { return Math.Round(head, 4); } if (head < 5.0) { return Math.Round(head, 3); } if (head < 15.0) { return Math.Round(head, 2); } return Math.Round(head, 1); } public static double GetDispValuePower(double power) { if (power < 1.0) { return Math.Round(power, 4); } if (power < 5.0) { return Math.Round(power, 3); } if (power < 15.0) { return Math.Round(power, 2); } return Math.Round(power, 1); } public static double GetDispValueEta(double eta) { if (eta < 30.0) { return Math.Round(eta, 2); } return Math.Round(eta, 1); } public static double GetDispValueNPSH(double npsh) { if (npsh < 5.0) { return Math.Round(npsh, NpshRoundNumber_small5); } return Math.Round(npsh, NpshRoundNumber_Large5); } public static void Round_HEP(ref Eventech.Model.GroupPoint pt) { if (pt != null) { pt.H = GetDispValueHead(pt.H); pt.E = Math.Round(pt.E, 1); pt.P = GetDispValuePower(pt.P); pt.NPSH = GetDispValueNPSH(pt.NPSH); } } } }