Renaming ISO 9613 air attenuation functions

parent d52c746c
......@@ -67,10 +67,10 @@ namespace ITABase
* \param fHumidity Relative humidity [%]
* \param fStaticPressure Static air pressure [kPa]
*/
ITA_BASE_API void AtmosphericAbsorptionLevel( ITABase::CThirdOctaveDecibelMagnitudeSpectrum& oA_atm_dB, double dDistance, double dTemperature, double dHumidity, double dStaticPressure = 101.325);
ITA_BASE_API void AtmosphericAbsorption( ITABase::CThirdOctaveDecibelMagnitudeSpectrum& oA_atm_dB, double dDistance, double dTemperature, double dHumidity, double dStaticPressure = 101.325);
//! Calculates the atmospheric absorption in linear factors (instead of decibels)
ITA_BASE_API void AtmosphericAbsorptionFactor( ITABase::CThirdOctaveFactorMagnitudeSpectrum& oA_atm_factor, double dDistance, double dTemperature, double dHumidity, double dStaticPressure = 101.325);
ITA_BASE_API void AtmosphericAbsorption( ITABase::CThirdOctaveFactorMagnitudeSpectrum& oA_atm_factor, double dDistance, double dTemperature, double dHumidity, double dStaticPressure = 101.325);
}
}
......
......@@ -9,7 +9,7 @@
using namespace ITABase;
double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance, double dTemperature, double dHumidity, double dStaticPressure /*= 101.325*/)
double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance, double dTemperature, double dHumidity, double dStaticPressure /*= 101.325*/ )
{
// ISO 9613-1 Acoustics - Attenuation of sound during propagation outdoors
......@@ -18,20 +18,20 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance,
const double p_r = 101.325f;
// Ambient atmospheric pressure [kPa]
const double p_a = dStaticPressure;
const double p_a = dStaticPressure;
// Reference air temperature [K]
const double T_0 = 273.15 + 20.0;
// Temperature [K] used for equation (B.3)
const double T_01 = 273.15 + 0.01;
const double T_01 = 273.15 + 0.01;
// Ambient atmospheric temperature [K]
const double T = 273.15 + dTemperature;
// Equations (B.3) and (B.2) of Annex B used for calculation of h in (B.1)
const double C = -6.8346 * pow(T_01 / T, 1.261) + 4.6151;
const double p_sat_p_r = pow((double) 10.0f, C);
const double C = -6.8346 * pow( T_01 / T, 1.261 ) + 4.6151;
const double p_sat_p_r = pow( ( double ) 10.0f, C );
// Molar concentration of water vapour [%] (Molekldichte Wasserdampf)
// Equation (B.2)
......@@ -45,7 +45,7 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance,
// Nitrogen relaxation frequency [Hz]
// Equation (4)
const double f_r_n = ( p_a / p_r ) * pow( T / T_0, -1.0 / 2.0 ) * ( 9.0f + 280.0*h*exp( -4.710 * ( pow( T / T_0, -( 1 / 3.0 ) ) - 1.0 ) ) );
// Parts of Equation (5) for the calculation of the attenuation coefficient [dB/m]
double dAlpha1 = 8.686 * pow( dFrequency, 2.0 );
double dAlpha2 = 1.84e-11 * pow( p_a / p_r, -1.0 ) * pow( T / T_0, 1.0 / 2.0 );
......@@ -64,34 +64,34 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance,
return dAirAbsorptionDecibel;
}
double ISO9613::AtmosphericAbsorptionFactor(double dFrequency, double dDistance, double dTemperature, double dHumidity, double dStaticPressure /*= 101.325*/)
double ISO9613::AtmosphericAbsorptionFactor( double dFrequency, double dDistance, double dTemperature, double dHumidity, double dStaticPressure /*= 101.325*/ )
{
double dAirAbsorptionDecibel = AtmosphericAbsorptionLevel(dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure);
double dAirAbsorptionDecibel = AtmosphericAbsorptionLevel( dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure );
//Factor of absorped signal energy [0:1]
double dAirAbsorptionFactor = 1 - pow(10, -dAirAbsorptionDecibel / 10.0);
double dAirAbsorptionFactor = 1 - pow( 10, -dAirAbsorptionDecibel / 10.0 );
return dAirAbsorptionFactor;
}
void ISO9613::AtmosphericAbsorptionLevel(ITABase::CThirdOctaveDecibelMagnitudeSpectrum& oA_atm_dB, double dDistance, double dTemperature, double dHumidity, double dStaticPressure/*= 101.325*/)
void ISO9613::AtmosphericAbsorption( ITABase::CThirdOctaveDecibelMagnitudeSpectrum& oA_atm_dB, double dDistance, double dTemperature, double dHumidity, double dStaticPressure/*= 101.325*/ )
{
// loop over all frequencies
for (int i = 0; i < oA_atm_dB.GetNumBands(); i++)
for( int i = 0; i < oA_atm_dB.GetNumBands(); i++ )
{
double dFrequency = (double) oA_atm_dB.GetCenterFrequencies()[i];
double dAirAbsorptionDecibel = AtmosphericAbsorptionLevel(dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure);
oA_atm_dB.SetMagnitude(i, (float) dAirAbsorptionDecibel);
double dFrequency = ( double ) oA_atm_dB.GetCenterFrequencies()[ i ];
double dAirAbsorptionDecibel = AtmosphericAbsorptionLevel( dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure );
oA_atm_dB.SetMagnitude( i, ( float ) dAirAbsorptionDecibel );
}
}
void ISO9613::AtmosphericAbsorptionFactor(ITABase::CThirdOctaveFactorMagnitudeSpectrum& oA_atm_factor, double dDistance, double dTemperature, double dHumidity, double dStaticPressure/*= 101.325*/)
void ISO9613::AtmosphericAbsorption( ITABase::CThirdOctaveFactorMagnitudeSpectrum& oA_atm_factor, double dDistance, double dTemperature, double dHumidity, double dStaticPressure/*= 101.325*/ )
{
// loop over all frequencies and converting from decibel to a factor between 0 and 1
for (int i = 0; i < oA_atm_factor.GetNumBands(); i++)
for( int i = 0; i < oA_atm_factor.GetNumBands(); i++ )
{
double dFrequency = (double)oA_atm_factor.GetCenterFrequencies()[i];
double dAirAbsorptionFactor = AtmosphericAbsorptionFactor(dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure);
oA_atm_factor.SetMagnitude(i, (float)dAirAbsorptionFactor);
double dFrequency = ( double ) oA_atm_factor.GetCenterFrequencies()[ i ];
double dAirAbsorptionFactor = AtmosphericAbsorptionFactor( dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure );
oA_atm_factor.SetMagnitude( i, ( float ) dAirAbsorptionFactor );
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment