예제 #1
0
        public void AmplitudeRatioToPowerRatio_75OhmImpedance(double dBmV, double expected)
        {
            AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV);

            double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(75)).DecibelMilliwatts, 2);

            Assert.Equal(expected, actual);
        }
        public void ConversionRoundTrip()
        {
            AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1);

            Assert.AreEqual(1, AmplitudeRatio.FromDecibelMicrovolts(decibelvolt.DecibelMicrovolts).DecibelVolts, DecibelMicrovoltsTolerance);
            Assert.AreEqual(1, AmplitudeRatio.FromDecibelMillivolts(decibelvolt.DecibelMillivolts).DecibelVolts, DecibelMillivoltsTolerance);
            Assert.AreEqual(1, AmplitudeRatio.FromDecibelVolts(decibelvolt.DecibelVolts).DecibelVolts, DecibelVoltsTolerance);
        }
예제 #3
0
        public void ConversionRoundTrip()
        {
            AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1);

            AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMicrovolts(decibelvolt.DecibelMicrovolts).DecibelVolts, DecibelMicrovoltsTolerance);
            AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMillivolts(decibelvolt.DecibelMillivolts).DecibelVolts, DecibelMillivoltsTolerance);
            AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelsUnloaded(decibelvolt.DecibelsUnloaded).DecibelVolts, DecibelsUnloadedTolerance);
            AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelVolts(decibelvolt.DecibelVolts).DecibelVolts, DecibelVoltsTolerance);
        }
 /// <inheritdoc cref="AmplitudeRatio.FromDecibelMillivolts(double?)"/>
 public static AmplitudeRatio?DecibelMillivolts(this double?value) => AmplitudeRatio.FromDecibelMillivolts(value);
 /// <inheritdoc cref="AmplitudeRatio.FromDecibelMillivolts(double)"/>
 public static AmplitudeRatio DecibelMillivolts(this long value) => AmplitudeRatio.FromDecibelMillivolts(value);
 /// <inheritdoc cref="AmplitudeRatio.FromDecibelMillivolts(double?)"/>
 public static AmplitudeRatio?DecibelMillivolts(this decimal?value) => AmplitudeRatio.FromDecibelMillivolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
 /// <inheritdoc cref="AmplitudeRatio.FromDecibelMillivolts(double)"/>
 public static AmplitudeRatio DecibelMillivolts(this decimal value) => AmplitudeRatio.FromDecibelMillivolts(Convert.ToDouble(value));
예제 #8
0
        public double AmplitudeRatioToPowerRatio_50OhmImpedance(double dBmV)
        {
            AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV);

            return(Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(50)).DecibelMilliwatts, 2));
        }
예제 #9
0
 public static AmplitudeRatio?DecibelMillivolts <T>(this T?value) where T : struct => AmplitudeRatio.FromDecibelMillivolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
예제 #10
0
 public static AmplitudeRatio DecibelMillivolts <T>(this T value) =>
 AmplitudeRatio.FromDecibelMillivolts(Convert.ToDecimal(value));
예제 #11
0
 public void NumberToDecibelMillivoltsTest() =>
 Assert.Equal(AmplitudeRatio.FromDecibelMillivolts(2), 2.DecibelMillivolts());