Maekawa.h 5.71 KB
Newer Older
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * ----------------------------------------------------------------
 *
 *		ITA geometrical acoustics
 *		(c) Copyright Institute of Technical Acoustics (ITA)
 *		RWTH Aachen University, Germany, 2015-2018
 *
 * ----------------------------------------------------------------
 *				    ____  __________  _______
 *				   //  / //__   ___/ //  _   |
 *				  //  /    //  /    //  /_|  |
 *				 //  /    //  /    //  ___   |
 *				//__/    //__/    //__/   |__|
 *
 * ----------------------------------------------------------------
 *
 *		Diffraction simulation mode using the Kirchhoff 
 *      approximation based on detour.
 *
 */

22 23
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_MAEKAWA
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_MAEKAWA
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
24

25
#include "Definitions.h"
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
26 27 28

// ITA includes
#include <ITAConstants.h>
29
#include <ITAGeo/Base.h>
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
30 31 32 33 34 35
#include <ITAHDFTSpectrum.h>
#include <ITASampleBuffer.h>

// STL includes
#include <cassert>

36
namespace ITAPropagationModels
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
37
{
38
	//! Diffraction calculation based on Maekawa
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
39
	/**
40
	  * @sa Maekawa, Z.; Noise reduction by screens Applied Acoustics; 1968, 1, 157 - 173
41
	  * @sa Pierce, A. D.; Diffraction of sound around corners and over wide barriers; J. Acoust. Soc. Am., 1974, 55, 941-955
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
42
	  */
43
	namespace Maekawa
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
44
	{
45
		//! Validates if Maekawa diffraction method can be applied
46
		/**
47
		  * The Maekawa method only makes sense if the source is
48 49 50 51
		  * occluded by obstacles in it's way to the receiver (or vice versa).
		  * This may include specular reflections, but inverse wedges (corners) have to
		  * be excluded because they can not occlude entities.
		  *
52 53 54
		  * @param[in] v3SourcePos Source position
		  * @param[in] v3TargetPos Target position
		  * @param[in] pApex Aperture point on wedge
55
		  *
56 57 58 59
		  * @return True, if Maekawa can be used (diffracting into shadow zone)
		  *
		  * @sa MaekawaDetourAndLength
		  * @sa MaekawaDiffractionFilter
60 61 62 63
		  *
		  * @note Throws ITAException on error
		  *
		  */
64
		bool ITA_PROPAGATION_MODELS_API IsApplicable( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex );
65

66
		//! Calculates the detour of a propagation path for the Maekawa method
67
		/**
68
		  * Calculates the direct path vs. detour path by taking the diffraction anchor into account.
69
		  *
70 71 72
		  * @param[in] v3SourcePos Source position
		  * @param[in] v3TargetPos Target position
		  * @param[in] pApex Aperture point on wedge
73 74 75
		  * @param[out] dPropagationLengthDirect Propagation path length without occlusion [m]
		  * @param[out] dPropagationLengthDetour Propagation path detour length with occlusion [m]
		  *
76
		  * @sa IsMaekawaApplicable
77 78 79 80
		  *
		  * @note Throws ITAException on error
		  *
		  */
81
		void ITA_PROPAGATION_MODELS_API GetDirectLengthAndDetourLength( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, double& dPropagationLengthDirect, double& dPropagationLengthDetour );
82

83
		//! Calculates the detour-and-direct-path difference of a propagation path for the Maekawa method
84 85 86 87 88 89 90 91 92 93 94
		/**
		  * @param[in] dPropagationLengthDirect Direct path length [m] (sometimes referred to as 'd')
		  * @param[in] dPropagationLengthDetour Detour path length [m] (sometimes referred to as 'A+B')
		  *
		  * @return Kirchhoff delta (difference) [m] (\delta, sometimes referred to as 'A+B-d')
		  *
		  * @note Throws ITAException on error
		  *
		  */
		double ITA_PROPAGATION_MODELS_API KirchhoffDelta( const double dPropagationLengthDirect, const double dPropagationLengthDetour );

95
		//! Calculates the detour-and-direct-path inverse difference factor of a propagation path for the Maekawa method
96 97 98 99 100 101 102 103
		/**
		  * @return Kirchhoff delta factor (ratio), always greater or equal 1.0
		  *
		  * @note Throws ITAException on error
		  *
		  */
		inline double KirchhoffDeltaInverseFactor( const double dPropagationLengthDirect, const double dPropagationLengthDetour )
		{
104
			const double dKirchhoffDelta = Maekawa::KirchhoffDelta( dPropagationLengthDirect, dPropagationLengthDetour );
105 106 107 108
			const double dKirchhoffDeltaInverseFactor = ( dPropagationLengthDirect + dKirchhoffDelta ) / dPropagationLengthDirect;
			return dKirchhoffDeltaInverseFactor;
		};

109
		//! Calculate diffraction filter based on the Maekawa detour method
110
		/**
111
		  * This function calculates the Maekawa diffraction filter based on detour length around a wedge obstacle
112 113 114 115
		  * and the direct path length with and withont any obstacles.
		  *
		  * @param[in] dPropagationLengthDirect Direct path length [m]
		  * @param[in] dPropagationLengthDetour Detour path length [m]
116 117
		  * @param[in] fFrequency Frequency [Hz]
		  * @param[in] fSpeedOfSound Speed of sound [m/s]
118 119
		  *
		  */
120 121
		float ITA_PROPAGATION_MODELS_API CalculateDiffractionFilterCoefficient( const double dPropagationLengthDirect, const double dPropagationLengthDetour, const float fFrequency, const float fSpeedOfSound = 344.0f );
		
122

123
		//! Calculate diffraction filter (frequency domain) based on the Maekawa detour method
124
		/**
125 126
		  * This function calculates the Maekawa diffraction filter based on detour length around a wedge obstacle
		  * and the direct path length with and withont any obstacles.
127
		  *
128 129 130 131
		  * @param[in] dPropagationLengthDirect Direct path length [m]
		  * @param[in] dPropagationLengthDetour Detour path length [m]
		  * @param[out] oTransferFunction Destination filter of simulation (zero-phase frequency domain magnitude spectrum)
		  * @param[in] fSpeedOfSound Speed of sound [m/s]
132 133
		  *
		  */
134
		void ITA_PROPAGATION_MODELS_API CalculateDiffractionFilter( const double dPropagationLengthDirect, const double dPropagationLengthDetour, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = 344.0f );
135
	}
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
136 137
}

138
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_MAEKAWA