/// <summary> /// 将数值转换自动转换为SI词头的有效位数表示方式 /// </summary> /// <param name="value">需要转换的物理量</param> /// <returns>带有SI词头的有效位数表示方式文本</returns> /// <param name="percentage">百分号显示</param> /// <param name="positiveSign">正值显示+号</param> /// <returns>带有SI词头的有效位数表示方式文本</returns> public static string Value2Text(PhysicalVariable value, bool percentage = false, bool positiveSign = false, bool usePrefix = true) { if (value.EffectiveLength > 0) { return(Value2Text(value, (int)value.EffectiveLength, DefaultConstant.NoiseLevel(value.PhysicalVariableType), percentage, positiveSign, usePrefix)); } else { return(Value2Text(value, DefaultConstant.EffectiveLength(value.PhysicalVariableType), DefaultConstant.NoiseLevel(value.PhysicalVariableType), percentage, positiveSign, usePrefix)); } }
/// <summary> /// 将数值转换自动转换为SI词头的有效位数表示方式 /// </summary> /// <param name="value">需要转换的物理量</param> /// <param name="effectiveLength">有效位数长度(必须是正整数)</param> /// <param name="percentage">百分号显示</param> /// <param name="positiveSign">正值显示+号</param> /// <returns>带有SI词头的有效位数表示方式文本</returns> public static string Value2Text(PhysicalVariable value, int effectiveLength, bool percentage = false, bool positiveSign = false) { return(Value2Text(value, effectiveLength, DefaultConstant.NoiseLevel(value.PhysicalVariableType), percentage, positiveSign)); }