Commit 5f3a36b2 authored by Armin Erraji's avatar Armin Erraji
Browse files

Merge branch 'develop' of https://git.rwth-aachen.de/ita/ITABase into develop

# Conflicts:
#	src/ITAISO9613.cpp
parents dda795f9 3f32d1b5
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
using namespace ITABase; 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 // ISO 9613-1 Acoustics - Attenuation of sound during propagation outdoors
...@@ -18,20 +18,20 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance, ...@@ -18,20 +18,20 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance,
const double p_r = 101.325f; const double p_r = 101.325f;
// Ambient atmospheric pressure [kPa] // Ambient atmospheric pressure [kPa]
const double p_a = dStaticPressure; const double p_a = dStaticPressure;
// Reference air temperature [K] // Reference air temperature [K]
const double T_0 = 273.15 + 20.0; const double T_0 = 273.15 + 20.0;
// Temperature [K] used for equation (B.3) // 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] // Ambient atmospheric temperature [K]
const double T = 273.15 + dTemperature; const double T = 273.15 + dTemperature;
// Equations (B.3) and (B.2) of Annex B used for calculation of h in (B.1) // 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 C = -6.8346 * pow( T_01 / T, 1.261 ) + 4.6151;
const double p_sat_p_r = pow((double) 10.0f, C); const double p_sat_p_r = pow( ( double ) 10.0f, C );
// Molar concentration of water vapour [%] (Molekldichte Wasserdampf) // Molar concentration of water vapour [%] (Molekldichte Wasserdampf)
// Equation (B.2) // Equation (B.2)
...@@ -45,7 +45,7 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance, ...@@ -45,7 +45,7 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance,
// Nitrogen relaxation frequency [Hz] // Nitrogen relaxation frequency [Hz]
// Equation (4) // 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 ) ) ); 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] // Parts of Equation (5) for the calculation of the attenuation coefficient [dB/m]
double dAlpha1 = 8.686 * pow( dFrequency, 2.0 ); 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 ); 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, ...@@ -64,34 +64,34 @@ double ISO9613::AtmosphericAbsorptionLevel( double dFrequency, double dDistance,
return dAirAbsorptionDecibel; 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 absorbed signal energy [0:1] //Factor of absorbed signal energy [0:1]
double dAirAbsorptionFactor = 1 - pow(10, -dAirAbsorptionDecibel / 10.0); double dAirAbsorptionFactor = 1 - pow( 10, -dAirAbsorptionDecibel / 10.0 );
return dAirAbsorptionFactor; return dAirAbsorptionFactor;
} }
void ISO9613::AtmosphericAbsorption(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 // 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 dFrequency = ( double ) oA_atm_dB.GetCenterFrequencies()[ i ];
double dAirAbsorptionDecibel = AtmosphericAbsorptionLevel(dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure); double dAirAbsorptionDecibel = AtmosphericAbsorptionLevel( dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure );
oA_atm_dB.SetMagnitude(i, (float) dAirAbsorptionDecibel); oA_atm_dB.SetMagnitude( i, ( float ) dAirAbsorptionDecibel );
} }
} }
void ISO9613::AtmosphericAbsorption(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 // 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 dFrequency = ( double ) oA_atm_factor.GetCenterFrequencies()[ i ];
double dAirAbsorptionFactor = AtmosphericAbsorptionFactor(dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure); double dAirAbsorptionFactor = AtmosphericAbsorptionFactor( dFrequency, dDistance, dTemperature, dHumidity, dStaticPressure );
oA_atm_factor.SetMagnitude(i, (float)dAirAbsorptionFactor); 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