using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Model.Monitor { /// /// 一元系数计算公式参数 /// public class OnceRatioCalculationFormulaParas : JsonModel { /// /// 测点标识 /// public long ObjectID { get; set; } /// /// 一元换算系数 /// public OnceRatioMatrix Ratio { get; set; } /// /// 计算 /// public bool Calculate(double fromValue, out double toValue) { toValue = fromValue; if (this.Ratio == null) return false; toValue = this.Ratio.Matrix(fromValue); return true; } /// /// 计算 /// public bool Calculate(string fromValue, out double toValue) { if (!double.TryParse(fromValue, out double value1)) { toValue = value1; return false; } if (!Calculate(value1, out double toValue1)) { toValue = toValue1; return false; } toValue = toValue1; return true; } } }