Exemple #1
0
        /// <summary>
        /// 底噪电平
        /// </summary>
        /// <param name="name">物理量类型</param>
        /// <returns></returns>
        public static int NoiseLevel(QuantityName name)
        {
            switch (name)
            {
            case QuantityName.Capacitance: return(-13);

            case QuantityName.CentigradeTemperature: return(-1);

            case QuantityName.Charge: return(-3);

            case QuantityName.Current: return(-12);

            case QuantityName.Frequency: return(-3);

            case QuantityName.Length: return(-3);

            case QuantityName.Power: return(-3);

            case QuantityName.Resistance: return(-7);

            case QuantityName.Temperature: return(-1);

            case QuantityName.Time: return(-12);

            case QuantityName.Voltage: return(-7);

            default: return(-8);
            }
        }
Exemple #2
0
        /// <summary>
        /// 有效长度
        /// </summary>
        /// <param name="name">物理量类型</param>
        /// <returns></returns>
        public static int EffectiveLength(QuantityName name)
        {
            switch (name)
            {
            case QuantityName.Capacitance: return(4);

            case QuantityName.CentigradeTemperature: return(3);

            case QuantityName.Charge: return(3);

            case QuantityName.Current: return(4);

            case QuantityName.Frequency: return(3);

            case QuantityName.Length: return(3);

            case QuantityName.Power: return(3);

            case QuantityName.Resistance: return(3);

            case QuantityName.Temperature: return(3);

            case QuantityName.Time: return(5);

            case QuantityName.Voltage: return(4);

            default: return(8);
            }
        }
Exemple #3
0
        /// <summary>
        /// 底噪电平
        /// </summary>
        /// <param name="name">物理量类型</param>
        /// <returns></returns>
        public static int NoiseLevel(QuantityName name)
        {
            switch (name)
            {
            case QuantityName.Admittance: return(-1);

            case QuantityName.ApparentPower: return(-4);

            case QuantityName.Capacitance: return(-15);

            case QuantityName.CentigradeTemperature: return(-1);

            case QuantityName.Charge: return(-15);

            case QuantityName.Current: return(-8);

            case QuantityName.Frequency: return(-4);

            case QuantityName.Inductor: return(-8);

            case QuantityName.Length: return(0);

            case QuantityName.Power: return(-4);

            case QuantityName.ReactivePower: return(-4);

            case QuantityName.Resistance: return(1);

            case QuantityName.Temperature: return(-1);

            case QuantityName.Time: return(-2);

            case QuantityName.Voltage: return(-1);

            default: return(-8);
            }
        }
Exemple #4
0
        /// <summary>
        /// 将数值转换自动转换为SI词头的有效位数表示方式
        /// </summary>
        /// <param name="value">需要转换的数值</param>
        /// <param name="effectiveLength">有效位数长度(必须是正整数)</param>
        /// <param name="noiseLevel">物理量底噪电平</param>
        /// <param name="prefix">数值预设词头</param>
        /// <param name="quantity">物理量类型</param>
        /// <param name="percentage">百分号显示</param>
        /// <param name="positiveSign">正值显示+号</param>
        /// <returns>带有SI词头的有效位数表示方式文本</returns>
        public static string Value2Text(double value, int effectiveLength, int noiseLevel, string prefix, QuantityName quantity, bool percentage = false, bool positiveSign = false, bool usePrefix = true)
        {
            switch (quantity)
            {
            case QuantityName.Admittance:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "S", percentage, positiveSign, usePrefix));

            case QuantityName.ApparentPower:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "VA", percentage, positiveSign, usePrefix));

            case QuantityName.Capacitance:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "F", percentage, positiveSign, usePrefix));

            case QuantityName.CentigradeTemperature:
                return(Value2Text(value + 272.15, effectiveLength, noiseLevel, prefix, "°", percentage, positiveSign, usePrefix));

            case QuantityName.Charge:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "C", percentage, positiveSign, usePrefix));

            case QuantityName.Current:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "A", percentage, positiveSign, usePrefix));

            case QuantityName.Frequency:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "Hz", percentage, positiveSign, usePrefix));

            case QuantityName.Inductor:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "H", percentage, positiveSign, usePrefix));

            case QuantityName.Length:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "m", percentage, positiveSign, usePrefix));

            case QuantityName.Power:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "W", percentage, positiveSign, usePrefix));

            case QuantityName.ReactivePower:

            case QuantityName.Resistance:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "Ω", percentage, positiveSign, usePrefix));

            case QuantityName.Temperature:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "K", percentage, positiveSign, usePrefix));

            case QuantityName.Time:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "s", percentage, positiveSign, usePrefix));

            case QuantityName.Voltage:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "V", percentage, positiveSign, usePrefix));

            default:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "", percentage, positiveSign, usePrefix));
            }
        }
Exemple #5
0
        /// <summary>
        /// 将数值转换自动转换为SI词头的有效位数表示方式
        /// </summary>
        /// <param name="value">需要转换的数值</param>
        /// <param name="effectiveLength">有效位数长度(必须是正整数)</param>
        /// <param name="noiseLevel">物理量底噪电平</param>
        /// <param name="prefix">数值预设词头</param>
        /// <param name="quantity">物理量类型</param>
        /// <param name="percentage">百分号显示</param>
        /// <param name="positiveSign">正值显示+号</param>
        /// <returns>带有SI词头的有效位数表示方式文本</returns>
        public static string Value2Text(double value, int effectiveLength, int noiseLevel, string prefix, QuantityName quantity, bool percentage = false, bool positiveSign = false)
        {
            switch (quantity)
            {
            case QuantityName.Capacitance:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "F", percentage, positiveSign));

            case QuantityName.Charge:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "C", percentage, positiveSign));

            case QuantityName.Current:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "A", percentage, positiveSign));

            case QuantityName.Frequency:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "Hz", percentage, positiveSign));

            case QuantityName.Power:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "W", percentage, positiveSign));

            case QuantityName.Resistance:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "Ω", percentage, positiveSign));

            case QuantityName.Temperature:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "K", percentage, positiveSign));

            case QuantityName.Time:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "s", percentage, positiveSign));

            case QuantityName.Voltage:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "V", percentage, positiveSign));

            default:
                return(Value2Text(value, effectiveLength, noiseLevel, prefix, "", percentage, positiveSign));
            }
        }