Exemplo n.º 1
0
        public double ExpectVoltageConvertedToAmplitudeRatioCorrectly(double voltage)
        {
            // Amplitude ratio increases linearly by 20 dBV with power-of-10 increases of voltage.
            ElectricPotential v = ElectricPotential.FromVolts(voltage);

            return(AmplitudeRatio.FromElectricPotential(v).DecibelVolts);
        }
Exemplo n.º 2
0
        public void ExpectVoltageConvertedToAmplitudeRatioCorrectly(double voltage, double expected)
        {
            // Amplitude ratio increases linearly by 20 dBV with power-of-10 increases of voltage.
            ElectricPotential v = ElectricPotential.FromVolts(voltage);

            double actual = AmplitudeRatio.FromElectricPotential(v).DecibelVolts;

            Assert.Equal(expected, actual);
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Gets an <see cref="AmplitudeRatio" /> in decibels (dB) relative to 1 volt RMS from this <see cref="ElectricPotential" />.
 /// </summary>
 /// <remarks>
 ///     Provides a nicer syntax for converting a voltage to an amplitude ratio (relative to 1 volt RMS).
 ///     <example>
 ///         <c>var voltageRatio = voltage.ToAmplitudeRatio();</c>
 ///     </example>
 /// </remarks>
 public AmplitudeRatio ToAmplitudeRatio()
 {
     return(AmplitudeRatio.FromElectricPotential(this));
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Gets an <see cref="AmplitudeRatio" /> in decibels (dB) relative to 1 volt RMS from an
 ///     <see cref="ElectricPotential" />.
 /// </summary>
 /// <remarks>
 ///     Provides a nicer syntax for converting a voltage to an amplitude ratio (relative to 1 volt RMS).
 ///     <example>
 ///         <c>var voltageRatio = voltage.ToAmplitudeRatio();</c>
 ///     </example>
 /// </remarks>
 public static AmplitudeRatio ToAmplitudeRatio(this ElectricPotential voltage)
 {
     return(AmplitudeRatio.FromElectricPotential(voltage));
 }