Adding ISO 9613 header of air absorption / atmospheric attenuation

parent d84daa74
......@@ -75,10 +75,11 @@ set( ITABaseHeader
"include/ITAFastMath.h"
"include/ITAFileSystemUtils.h"
"include/ITAFiniteImpulseResponse.h"
"include/ITAFunctors.h"
"include/ITAHDFTSpectra.h"
"include/ITAHDFTSpectrum.h"
"include/ITAFunctors.h"
"include/ITAInterpolation.h"
"include/ITAISO9613.h"
"include/ITALog.h"
"include/ITAMagnitudeSpectrum.h"
"include/ITAMultichannelFiniteImpulseResponse.h"
......@@ -115,6 +116,7 @@ set( ITABaseSources
"src/ITAHDFTSpectra.cpp"
"src/ITAHDFTSpectrum.cpp"
"src/ITAInterpolation.cpp"
"src/ITAISO9613.cpp"
"src/ITALog.cpp"
"src/ITAMagnitudeSpectrum.cpp"
"src/ITAMultichannelFiniteImpulseResponse.cpp"
......
/*
* ----------------------------------------------------------------
*
* ITA core libs
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_ISO_9613
#define INCLUDE_WATCHER_ITA_ISO_9613
// ITABase
#include <ITABaseDefinitions.h>
#include <ITAThirdOctaveMagnitudeSpectrum.h>
#include <string>
namespace ITABase
{
namespace ISO9613
{
//! Calculates the atmospheric absorption after ISO 9613-1 for one frequency in decibels
/**
* Standard: ISO 9613-1:1993
*
* \param dFrequency Base frequency [Hz]
* \param fDistance Distance [m]
* \param fTemperature Temperature [C]
* \param fStaticPressure Static air pressure [Pa]
* \param fHumidity Relative humidity [%]
*
* @return Atmospheric absorption in dB
*/
double AtmosphericAbsorption( double dFrequency, double dDistance, double dTemperature, double dStaticPressure, double dHumidity );
//! Calculates the atmospheric absorption after ISO 9613-1: A_{atm} (formula 8) in decibels
/**
* Standard: ISO 9613-1:1993
*
* \param oA_atm_dB Third-octave magnitude spectrum with atmospheric attenuation values in decibel
* \param fDistance Distance [m]
* \param fTemperature Temperature [C]
* \param fStaticPressure Static air pressure [Pa]
* \param fHumidity Relative humidity [%]
*/
void AtmosphericAbsorption( ITABase::CThirdOctaveDecibelMagnitudeSpectrum& oA_atm_dB, double dDistance, double dTemperature, double dStaticPressure, double dHumidity );
//! Calculates the atmospheric absorption in linear factors (instead of decibels)
void AtmosphericAbsorption( ITABase::CThirdOctaveFactorMagnitudeSpectrum& oA_atm_factor, double dDistance, double dTemperature, double dStaticPressure, double dHumidity );
}
}
#endif // INCLUDE_WATCHER_ITA_ISO_9613
#include <ITAISO9613.h>
#include <ITAConstants.h>
#include <ITAException.h>
#include <ITAThirdOctaveMagnitudeSpectrum.h>
#include <cassert>
using namespace ITABase;
using namespace ISO9613;
void AtmosphericAbsorption( ITABase::CThirdOctaveDecibelMagnitudeSpectrum& oA_atm_dB, double dDistance, double dTemperature, double dStaticPressure, double dHumidity )
{
// @todo schleife ber freqs
}
double AtmosphericAbsorption( double dFrequency, double dDistance, double dTemperature, double dStaticPressure, double dHumidity )
{
// ISO 9613-1 Acoustics - Attenuation of sound during propagation outdoors
// Noch nicht fertig ....
ITA_EXCEPT0( NOT_IMPLEMENTED );
// Reference ambient atmospheric pressure (Standard Ambient Atmosphere) [kPa]
// (Referenzatmosphrendruck Umgebung nach ISO Standard)
const double p_r = 101.325f;
const double p_a = 101.325f;
// Inital sound pressure amplitude [kPa]
const double p_i = p_r + 0.0f;
// Sound pressure amplitude [Pa]
const double p_t = 1.0f;
// Reference air temperature [K]
const double T_0 = 273.15f + 20.0f;
// Temperature [K]
const double T = 273.15f + dTemperature;
// Molar concentration dry air
const double tmp = ( 10.79586f * ( 1.0f - ( ( T_0 - 20.0f ) / T ) ) ) -
( 5.02808f * log10( ( T / ( T_0 - 20.0f ) ) ) ) +
( 1.50474f * 0.0001f * ( 1.0f - pow( ( double ) 10.0f, ( -8.29692f*( ( T / ( T_0 - 20.0f ) ) - 1.0f ) ) ) ) ) +
( 0.42873f * 0.001f * ( -1.0f + pow( ( double ) 10.0f, ( -4.76955f*( 1.0f - ( ( T_0 - 20.0f ) / T ) ) ) ) ) ) -
2.2195983f;
// Molar concentration of water vapour [%] (Molekldichte Wasserdampf)
assert( 0.0f <= dHumidity && dHumidity <= 100.0f );
const double h = dHumidity * pow( ( double ) 10.0f, tmp ) / ( p_a / p_r );
// Equation (3)
const double f_r_o = ( p_a / p_r ) * ( 24.0f + 4.04f*10.0e4*h*( 0.02f + h ) / ( 0.391f + h ) );
// Equation (4)
const double f_r_n = ( p_a / p_r ) * pow( T / T_0, ( double ) -1.0f / 2.0f ) * ( 9.0f + 280.0f*h*exp( -4.710f * ( pow( T / T_0, ( double ) -( 1 / 3.0f ) ) - 1.0f ) ) );
// Parts of Equation (5)
double dAlpha1 = 8.686f * pow( dFrequency, ( double ) 2.0f );
double dAlpha2 = 1.84f * 10e-11 * pow( p_a / p_r, ( double ) -1.0f ) * pow( T / T_0, ( double ) -1.0f / 2.0f );
double dAlpha3 = pow( T / T_0, ( double ) -5.0f / 2.0f );
double dAlpha4 = 0.01275f * exp( -2239.1f / T ) * pow( f_r_o + pow( dFrequency, ( double ) 2.0f ) / f_r_o, ( double ) -1.0f );
double dAlpha5 = 0.10680f * exp( -3352.0f / T ) * pow( f_r_n + pow( dFrequency, ( double ) 2.0f ) / f_r_n, ( double ) -1.0f );
// Attenuation coefficient [dB/m], ~f, as assembly of Equation (5) parts
double dAlpha = dAlpha1 * ( dAlpha2 + dAlpha3 * ( dAlpha4 + dAlpha5 ) );
// Resulting attenuation [dB], ~alpha (~f)
double dAttenuationAirAbsorptionDecibel = dAlpha * dDistance;
// Attenuation factor in decibel
return dAttenuationAirAbsorptionDecibel;
}
\ 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