Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
I
ITAPropagationModels
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
ITAPropagationModels
Commits
31464c3e
Commit
31464c3e
authored
Jan 07, 2019
by
Armin Erraji
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://git.rwth-aachen.de/ita/ITAPropagationModels
into develop
parents
b21c8c92
e3a3e49f
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
1891 additions
and
386 deletions
+1891
-386
.gitignore
.gitignore
+1
-0
CMakeLists.txt
CMakeLists.txt
+2
-4
benchmarks/DiffractionModelsBenchmark.cpp
benchmarks/DiffractionModelsBenchmark.cpp
+21
-18
include/ITAPropagationModels/FilterEngine.h
include/ITAPropagationModels/FilterEngine.h
+65
-7
include/ITAPropagationModels/FilterGenerator.h
include/ITAPropagationModels/FilterGenerator.h
+0
-80
include/ITAPropagationModels/Maekawa.h
include/ITAPropagationModels/Maekawa.h
+152
-0
include/ITAPropagationModels/Svensson.h
include/ITAPropagationModels/Svensson.h
+1
-1
include/ITAPropagationModels/UTD.h
include/ITAPropagationModels/UTD.h
+20
-3
src/ITAPropagationModels/FilterEngine.cpp
src/ITAPropagationModels/FilterEngine.cpp
+371
-1
src/ITAPropagationModels/FilterGenerator.cpp
src/ITAPropagationModels/FilterGenerator.cpp
+0
-25
src/ITAPropagationModels/Kirchhoff.cpp
src/ITAPropagationModels/Kirchhoff.cpp
+0
-124
src/ITAPropagationModels/Maekawa.cpp
src/ITAPropagationModels/Maekawa.cpp
+59
-69
src/ITAPropagationModels/Svensson.cpp
src/ITAPropagationModels/Svensson.cpp
+3
-3
src/ITAPropagationModels/UTD.cpp
src/ITAPropagationModels/UTD.cpp
+33
-21
tests/CMakeLists.txt
tests/CMakeLists.txt
+2
-1
tests/FilterEngine/CMakeLists.txt
tests/FilterEngine/CMakeLists.txt
+26
-0
tests/FilterEngine/FilterEngineTest.cpp
tests/FilterEngine/FilterEngineTest.cpp
+96
-0
tests/FilterEngine/FilterEngineTest.m
tests/FilterEngine/FilterEngineTest.m
+9
-0
tests/FilterEngine/PropagationPathListExample.json
tests/FilterEngine/PropagationPathListExample.json
+962
-0
tests/FilterEngine/stonewall.mat
tests/FilterEngine/stonewall.mat
+7
-0
tests/Maekawa/CMakeLists.txt
tests/Maekawa/CMakeLists.txt
+6
-6
tests/Maekawa/MaekawaTest.cpp
tests/Maekawa/MaekawaTest.cpp
+20
-15
tests/Maekawa/MaekawaTest.m
tests/Maekawa/MaekawaTest.m
+27
-0
tests/Svensson/SvenssonTest.cpp
tests/Svensson/SvenssonTest.cpp
+2
-2
tests/UTD/UTDTest.cpp
tests/UTD/UTDTest.cpp
+6
-6
No files found.
.gitignore
View file @
31464c3e
*.exe
*.wav
*.bat
CMakeLists.txt
View file @
31464c3e
...
...
@@ -20,15 +20,13 @@ set( ITAPropagationModelsHeader
"include/ITAPropagationModels/Definitions.h"
"include/ITAPropagationModels/DiffractionFilter.h"
"include/ITAPropagationModels/FilterEngine.h"
"include/ITAPropagationModels/FilterGenerator.h"
"include/ITAPropagationModels/Kirchhoff.h"
"include/ITAPropagationModels/Maekawa.h"
"include/ITAPropagationModels/Svensson.h"
"include/ITAPropagationModels/UTD.h"
)
set
(
ITAPropagationModelsSources
"src/ITAPropagationModels/FilterEngine.cpp"
"src/ITAPropagationModels/FilterGenerator.cpp"
"src/ITAPropagationModels/Kirchhoff.cpp"
"src/ITAPropagationModels/Maekawa.cpp"
"src/ITAPropagationModels/Svensson.cpp"
"src/ITAPropagationModels/UTD.cpp"
)
...
...
benchmarks/DiffractionModelsBenchmark.cpp
View file @
31464c3e
...
...
@@ -21,7 +21,7 @@
#include <ITAPropagationModels/Base.h>
#include <ITAPropagationModels/
Kirchhoff
.h>
#include <ITAPropagationModels/
Maekawa
.h>
#include <ITAPropagationModels/UTD.h>
#include <ITAPropagationModels/Svensson.h>
...
...
@@ -47,7 +47,7 @@
using
namespace
std
;
using
namespace
ITAPropagationModels
;
float
g_fSpeedOfSound
=
344.0
f
;
float
g_fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
;
float
g_fSampleRate
=
44.1e3
;
int
g_iFilterLength
=
64
;
...
...
@@ -82,44 +82,47 @@ void benchmark_single_wedge()
oReceiver
->
qOrient
=
VistaQuaternion
(
0
,
1
,
0
,
0
);
oReceiver
->
vPos
.
SetValues
(
-
.4
f
,
.6
f
,
.1
f
);
auto
oWedge
=
std
::
make_shared
<
ITAGeo
::
CITADiffraction
WedgeAperture
>
();
o
Wedge
->
v3MainWedgeFaceNormal
=
VistaVector3D
(
1.0
f
,
1.0
f
,
.0
f
).
GetNormalized
();
o
Wedge
->
v3OppositeWedgeFaceNormal
=
VistaVector3D
(
-
1.0
f
,
1.0
f
,
.0
f
).
GetNormalized
();
o
Wedge
->
v3VertextStart
.
SetValues
(
.0
f
,
1.0
f
,
-
1.0
f
);
o
Wedge
->
v3VertextEnd
.
SetValues
(
.0
f
,
1.0
f
,
1.0
f
);
auto
pWedge
=
std
::
make_shared
<
ITAGeo
::
CITADiffractionOuter
WedgeAperture
>
();
p
Wedge
->
v3MainWedgeFaceNormal
=
VistaVector3D
(
1.0
f
,
1.0
f
,
.0
f
).
GetNormalized
();
p
Wedge
->
v3OppositeWedgeFaceNormal
=
VistaVector3D
(
-
1.0
f
,
1.0
f
,
.0
f
).
GetNormalized
();
p
Wedge
->
v3VertextStart
.
SetValues
(
.0
f
,
1.0
f
,
-
1.0
f
);
p
Wedge
->
v3VertextEnd
.
SetValues
(
.0
f
,
1.0
f
,
1.0
f
);
ITAGeoUtils
::
CalculateDiffractionAperturePoint
(
oWedge
->
GetEdgeRay
(),
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
o
Wedge
->
v3AperturePoint
);
ITAGeoUtils
::
CalculateDiffractionAperturePoint
(
pWedge
->
GetEdgeRay
(),
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
p
Wedge
->
v3AperturePoint
);
if
(
!
ITAGeoUtils
::
IsDiffractionAperturePointInRange
(
oWedge
->
v3VertextStart
,
oWedge
->
v3VertextEnd
,
o
Wedge
->
v3AperturePoint
)
)
if
(
!
ITAGeoUtils
::
IsDiffractionAperturePointInRange
(
pWedge
->
v3VertextStart
,
pWedge
->
v3VertextEnd
,
p
Wedge
->
v3AperturePoint
)
)
ITA_EXCEPT_INVALID_PARAMETER
(
"Aperture point over wedge is outside edge vertices"
);
if
(
!
o
Wedge
->
IsOutsideWedge
(
oSource
->
v3InteractionPoint
)
)
if
(
!
p
Wedge
->
IsOutsideWedge
(
oSource
->
v3InteractionPoint
)
)
ITA_EXCEPT_INVALID_PARAMETER
(
"Source point is inside wedge (solid part)"
);
if
(
!
o
Wedge
->
IsOutsideWedge
(
oReceiver
->
v3InteractionPoint
)
)
if
(
!
p
Wedge
->
IsOutsideWedge
(
oReceiver
->
v3InteractionPoint
)
)
ITA_EXCEPT_INVALID_PARAMETER
(
"Receiver point is inside wedge (solid part)"
);
ITAGeo
::
CPropagationPath
oPropPath
;
oPropPath
.
push_back
(
oSource
);
oPropPath
.
push_back
(
o
Wedge
);
oPropPath
.
push_back
(
p
Wedge
);
oPropPath
.
push_back
(
oReceiver
);
cout
<<
"Path: "
<<
oPropPath
<<
endl
;
// Kirchhoff
if
(
Kirchhoff
::
IsApplicable
(
oPropPath
)
)
if
(
Maekawa
::
IsApplicable
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
pWedge
)
)
ITA_EXCEPT_INVALID_PARAMETER
(
"Kirchhoff model can not be applied for this propagation path."
);
ITAStopWatch
sw
;
cout
<<
"Starting Kirchoff model benchmark:"
<<
endl
;
double
dStartTime
=
ITAClock
::
getDefaultClock
()
->
getTime
();
ITABase
::
CHDFTSpectrum
oTF
(
g_fSampleRate
,
g_iFilterLength
,
true
);
for
(
int
i
=
0
;
i
<
1e8
;
i
++
)
{
sw
.
start
();
Kirchhoff
::
CalculateDiffractionFilter
(
oPropPath
,
oTF
,
g_fSpeedOfSound
);
double
dDir
,
dDet
;
Maekawa
::
GetDirectLengthAndDetourLength
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
pWedge
,
dDir
,
dDet
);
Maekawa
::
CalculateDiffractionFilter
(
dDir
,
dDet
,
oTF
,
g_fSpeedOfSound
);
sw
.
stop
();
}
double
dStopTime
=
ITAClock
::
getDefaultClock
()
->
getTime
();
...
...
@@ -136,7 +139,7 @@ void benchmark_single_wedge()
for
(
int
i
=
0
;
i
<
1e6
;
i
++
)
{
sw
.
start
();
UTD
::
CalculateDiffractionFilter
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
o
Wedge
,
oTF
,
iMethod
,
g_fSpeedOfSound
);
UTD
::
CalculateDiffractionFilter
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
p
Wedge
,
oTF
,
iMethod
,
g_fSpeedOfSound
);
sw
.
stop
();
}
dStopTime
=
ITAClock
::
getDefaultClock
()
->
getTime
();
...
...
@@ -149,14 +152,14 @@ void benchmark_single_wedge()
sw
.
reset
();
cout
<<
"Starting Biot-Tolstoy-Medwin-Svensson model benchmark:"
<<
endl
;
dStartTime
=
ITAClock
::
getDefaultClock
()
->
getTime
();
const
float
fMinDelay
=
o
Wedge
->
GetMinimumWavefrontDelayTime
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
g_fSpeedOfSound
);
const
float
fMaxDelay
=
o
Wedge
->
GetMaximumWavefrontDelayTime
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
g_fSpeedOfSound
);
const
float
fMinDelay
=
p
Wedge
->
GetMinimumWavefrontDelayTime
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
g_fSpeedOfSound
);
const
float
fMaxDelay
=
p
Wedge
->
GetMaximumWavefrontDelayTime
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
g_fSpeedOfSound
);
const
int
iIRLength
=
(
int
)
ceil
(
float
(
fMaxDelay
-
fMinDelay
)
*
g_fSampleRate
);
ITABase
::
CFiniteImpulseResponse
oIR
(
iIRLength
,
g_fSampleRate
,
true
);
for
(
int
i
=
0
;
i
<
1e4
;
i
++
)
{
sw
.
start
();
Svensson
::
CalculateDiffractionIR
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
o
Wedge
,
oIR
,
g_fSpeedOfSound
);
Svensson
::
CalculateDiffractionIR
(
oSource
->
v3InteractionPoint
,
oReceiver
->
v3InteractionPoint
,
p
Wedge
,
oIR
,
g_fSpeedOfSound
);
sw
.
stop
();
}
dStopTime
=
ITAClock
::
getDefaultClock
()
->
getTime
();
...
...
include/ITAPropagationModels/FilterEngine.h
View file @
31464c3e
...
...
@@ -25,14 +25,18 @@
// ITA includes
#include <ITAGeo/Base.h>
#include <ITAGeo/Material//Manager.h>
#include <ITAHDFTSpectra.h>
#include <ITAHDFTSpectrum.h>
// STL includes
#include <vector>
namespace
ITAPropagationModels
{
using
namespace
std
;
//! Transfer function filter generator for propagation paths
/**
* Generates transfer functions in the frequency-domain that
...
...
@@ -65,12 +69,37 @@ namespace ITAPropagationModels
//! Applies all acoustic models like reflection diffraction models
void
ApplyAcousticModels
(
ITAGeo
::
CPropagationPathList
&
oPathList
);
void
ApplyDiffractionModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
1
);
void
ApplyReflectionModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
1
);
//!Applies diffraction models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void
ApplyDiffractionModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
-
1
);
//!Applies reflection models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void
ApplyReflectionModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
-
1
);
void
ApplyTransmissionModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
1
);
// @todo
//!Applies emitter models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void
ApplyEmitterModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
-
1
);
//! Generate multi-channel propagation path (for multi-channel receiver directivitiy)
//!Applies sensor models
/**
* @param[out] oPathList Propagation path list
* @param[in] iModel Acoustic material model type. If value is set to -1, the default material model is used.
*/
void
ApplySensorModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
-
1
);
void
ApplyTransmissionModel
(
ITAGeo
::
CPropagationPathList
&
oPathList
,
int
iModel
=
-
1
);
// @todo
//! Generate multi-channel propagation path (for multi-channel receiver directivity)
/**
* @todo AER
*/
...
...
@@ -79,15 +108,44 @@ namespace ITAPropagationModels
//! Generate single-channel propagation path (for single-channel receiver directivity)
inline
void
Generate
(
const
ITAGeo
::
CPropagationPathList
&
oPathList
,
ITABase
::
CHDFTSpectrum
&
oFilter
)
{
const
std
::
vector
<
ITABase
::
CHDFTSpectrum
*
>
vpSpectra
=
{
&
oFilter
};
const
vector
<
ITABase
::
CHDFTSpectrum
*
>
vpSpectra
=
{
&
oFilter
};
ITABase
::
CHDFTSpectra
oTF
(
vpSpectra
);
Generate
(
oPathList
,
oTF
);
};
//! Sets a connection to the material manager
void
SetMaterialManager
(
const
ITAGeo
::
CMaterialManager
*
pMaterialManager
);
// Returns pointer to material manager or null
const
ITAGeo
::
CMaterialManager
*
GetMaterialManager
()
const
;
private:
ITABase
::
CHDFTSpectra
m_oAccumulatedSpectra
;
//!< Gathered propagation paths from list
ITABase
::
CHDFTSpectra
m_oTempPropPathSpectra
;
//!< Single prop-path spectra
unique_ptr
<
ITABase
::
CHDFTSpectra
>
m_pAccumulatedSpectra
;
//!< Gathered propagation paths from list
unique_ptr
<
ITABase
::
CHDFTSpectra
>
m_pTempPropPathSpectra
;
//!< Single prop-path spectra
static
struct
m_DefaultValues
//!< Default values
{
static
const
int
iReflectionModel
=
ITAGeo
::
IAcousticMaterial
::
SCALAR
;
static
const
int
iDiffractionModel
=
ITAGeo
::
IAcousticMaterial
::
THIRD_OCTAVE
;
static
const
int
iEmitterModel
=
ITAGeo
::
IAcousticMaterial
::
SCALAR
;
static
const
int
iSensorModel
=
ITAGeo
::
IAcousticMaterial
::
SCALAR
;
};
const
ITAGeo
::
CMaterialManager
*
m_pMaterialManager
;
const
double
m_dHumidity
=
80.0
;
const
double
m_dTemperature
=
20.0
;
const
float
m_fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
;
static
struct
m_DefaultDiffractionModel
//!< Default values for diffractions
{
int
iModel
=
1
;
};
};
}
...
...
include/ITAPropagationModels/FilterGenerator.h
deleted
100644 → 0
View file @
b21c8c92
/*
* ----------------------------------------------------------------
*
* ITA geometrical acoustics
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
*/
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_GENERATOR
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_GENERATOR
#include "Base.h"
#include "Definitions.h"
#include "DiffractionFilter.h"
// ITA includes
#include <ITAGeo/Base.h>
#include <ITAHDFTSpectra.h>
#include <ITAHDFTSpectrum.h>
// STL includes
#include <vector>
namespace
ITAPropagationModels
{
//! Transfer function filter generator for propagation paths
/**
* Generates transfer functions in the frequency-domain that
* can be used as filters, e.g. for auralization.
*/
class
ITA_PROPAGATION_MODELS_API
CTFGenerator
{
public:
//! Construct a generator with predetermined output channels, e.g. for binaural or SH filters
/**
* @param[in] iNumOutputChannels Number of output channels
* @param[in] iDFTSize Length of the DFT used to construct and combine filter components
* @param[in] fSamplingRate Filer sampling rate
*/
CTFGenerator
(
const
int
iNumOutputChannels
,
const
int
iDFTSize
=
128
,
const
float
fSamplingRate
=
44100.0
f
);
//! Cunstruct a generator with matching properties of a target spectrum
inline
CTFGenerator
(
const
ITABase
::
CHDFTSpectrum
&
pTransferFunction
)
:
CTFGenerator
(
1
,
pTransferFunction
.
GetDFTSize
(),
pTransferFunction
.
GetSampleRate
()
)
{
};
//! Cunstruct a generator with matching properties of multi-channel target spectra
CTFGenerator
(
const
ITABase
::
CHDFTSpectra
&
pTransferFunctions
)
:
CTFGenerator
(
pTransferFunctions
.
GetNumChannels
(),
pTransferFunctions
.
GetDFTSize
(),
pTransferFunctions
.
GetSampleRate
()
)
{
};
//! Generate a single-channel transfer function
inline
void
GenerateTF
(
ITABase
::
CHDFTSpectrum
&
pTransferFunction
)
{
const
std
::
vector
<
ITABase
::
CHDFTSpectrum
*
>
vpSpectra
=
{
&
(
pTransferFunction
)
};
ITABase
::
CHDFTSpectra
oTF
(
vpSpectra
);
GenerateTF
(
oTF
);
};
//! Generate a multi-channel transfer function
inline
void
GenerateTF
(
ITABase
::
CHDFTSpectra
&
pTransferFunctions
);
private:
};
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER_GENERATOR
include/ITAPropagationModels/
Kirchhoff
.h
→
include/ITAPropagationModels/
Maekawa
.h
View file @
31464c3e
...
...
@@ -19,8 +19,8 @@
*
*/
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_
KIRCHHOFF
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_
KIRCHHOFF
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_
MAEKAWA
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_
MAEKAWA
#include "Definitions.h"
...
...
@@ -35,143 +35,118 @@
namespace
ITAPropagationModels
{
//! Diffraction calculation based on
Kirchhoff approximation
//! Diffraction calculation based on
Maekawa
/**
* @sa Maekawa, Z.; Noise reduction by screens Applied Acoustics; 1968, 1, 157 - 173
* @sa Pierce, A. D.; Diffraction of sound around corners and over wide barriers; J. Acoust. Soc. Am., 1974, 55, 941-955
*/
namespace
Kirchhoff
namespace
Maekawa
{
//! Validates if
Kirchhoff
diffraction method can be applied
//! Validates if
Maekawa
diffraction method can be applied
/**
* The
Kirchhoff detour
method only makes sense if the source is
* The
Maekawa
method only makes sense if the source is
* 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.
*
* @param[in] oPropPath Propagation path to be simulated
* @return True, if Kirchhoff can be used (makes sense for this path)
* @param[in] v3SourcePos Source position
* @param[in] v3TargetPos Target position
* @param[in] pApex Aperture point on wedge
*
* @sa KirchhoffDetourAndLength
* @sa KirchhoffDiffractionFilter
* @return True, if Maekawa can be used (diffracting into shadow zone)
*
* @sa MaekawaDetourAndLength
* @sa MaekawaDiffractionFilter
*
* @note Throws ITAException on error
*
*/
bool
ITA_PROPAGATION_MODELS_API
IsApplicable
(
const
ITAGeo
::
CPropagationPath
&
oPropPath
);
bool
ITA_PROPAGATION_MODELS_API
IsApplicable
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeApertureBase
>
pApex
);
//! Calculates the detour of a propagation path for the
Kirchhoff
method
//! Calculates the detour of a propagation path for the
Maekawa
method
/**
* Calculates the direct path vs. detour path by taking diffraction anchors into account.
* It is recommended to validate the path, first. Otherwise unpredictable results will occur.
*
* 1. Specular reflections will increase the direct path length AND detour length
* 2. Only diffraction around a wedge are treated (diffraction angle greater \pi, where 0 would be back-scattering and \pi is gracing angle)
* Calculates the direct path vs. detour path by taking the diffraction anchor into account.
*
* @param[in] oPropPath Propagation path to be simulated
* @param[out] dPropagationLengthDirect Propagation path length without occlusion [m]
* @param[out] dPropagationLengthDetour Propagation path detour length with occlusion [m]
* @param[in] v3SourcePos Source position
* @param[in] v3TargetPos Target position
* @param[in] pApex Aperture point on wedge
* @param[out] dPropagationLengthFreeField Propagation path length without occlusion [m]
* @param[out] dPropagationLengthOverApex Propagation path detour length with occlusion [m]
*
* @sa Is
Kirchhoff
Applicable
* @sa Is
Maekawa
Applicable
*
* @note Throws ITAException on error
*
*/
void
ITA_PROPAGATION_MODELS_API
GetDirectLengthAndDetourLength
(
const
ITAGeo
::
CPropagationPath
&
oPropPath
,
double
&
dPropagationLengthDirect
,
double
&
dPropagationLengthDetour
);
void
ITA_PROPAGATION_MODELS_API
GetDirectLengthAndDetourLength
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeApertureBase
>
pApex
,
double
&
dPropagationLengthFreeField
,
double
&
dPropagationLengthOverApex
);
//! Calculates the detour-and-direct-path difference of a propagation path for the
Kirchhoff
method
//! Calculates the detour-and-direct-path difference of a propagation path for the
Maekawa
method
/**
* @param[in] dPropagationLength
Direct
Direct path length [m] (sometimes referred to as 'd')
* @param[in] dPropagationLength
Detour
Detour path length [m] (sometimes referred to as 'A+B')
* @param[in] dPropagationLength
FreeField
Direct path length [m] (sometimes referred to as 'd')
* @param[in] dPropagationLength
OverApex
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
dPropagationLength
Direct
,
const
double
dPropagationLengthDetour
);
double
ITA_PROPAGATION_MODELS_API
KirchhoffDelta
(
const
double
dPropagationLength
FreeField
,
const
double
dPropagationLengthOverApex
);
//! Calculates the detour-and-direct-path inverse difference factor of a propagation path for the
Kirchhoff
method
//! Calculates the detour-and-direct-path inverse difference factor of a propagation path for the
Maekawa
method
/**
* @return Kirchhoff delta factor (ratio), always greater or equal 1.0
*
* @note Throws ITAException on error
*
*/
inline
double
KirchhoffDeltaInverseFactor
(
const
double
dPropagationLength
Direct
,
const
double
dPropagationLengthDetour
)
inline
double
KirchhoffDeltaInverseFactor
(
const
double
dPropagationLength
FreeField
,
const
double
dPropagationLengthOverApex
)
{
const
double
dKirchhoffDelta
=
Kirchhoff
::
KirchhoffDelta
(
dPropagationLengthDirect
,
dPropagationLengthDetour
);
const
double
dKirchhoffDeltaInverseFactor
=
(
dPropagationLength
Direct
+
dKirchhoffDelta
)
/
dPropagationLengthDirect
;
const
double
dKirchhoffDelta
=
Maekawa
::
KirchhoffDelta
(
dPropagationLengthFreeField
,
dPropagationLengthOverApex
);
const
double
dKirchhoffDeltaInverseFactor
=
(
dPropagationLength
FreeField
+
dKirchhoffDelta
)
/
dPropagationLengthFreeField
;
return
dKirchhoffDeltaInverseFactor
;
};
//! Calculate diffraction filter
(frequency domain) based on the Kirchhoff
detour method
//! Calculate diffraction filter
based on the Maekawa
detour method
/**
* This function calculates the
Kirchhoff diffraction filter
based on detour length around a wedge obstacle
* and the direct path length with and witho
n
t any obstacles.
* This function calculates the
Maekawa diffraction filter coefficient
based on detour length around a wedge obstacle
* and the direct path length with and witho
u
t any obstacles.
*
* @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] dPropagationLengthFreeField Direct path length [m]
* @param[in] dPropagationLengthOverApex Detour path length [m]
* @param[in] fFrequency Frequency [Hz]
* @param[in] fSpeedOfSound Speed of sound [m/s]
*
*/
void
ITA_PROPAGATION_MODELS_API
CalculateDiffractionFilter
(
const
double
dPropagationLengthDirect
,
const
double
dPropagationLengthDetour
,
ITABase
::
CHDFTSpectrum
&
oTransferFunction
,
const
float
fSpeedOfSound
=
344.0
f
);
double
ITA_PROPAGATION_MODELS_API
CalculateDiffractionFilterCoefficient
(
const
double
dPropagationLengthFreeField
,
const
double
dPropagationLengthOverApex
,
const
float
fFrequency
,
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
);
//! Calculate diffraction f
ilter (frequency domain) based on the Kirchhoff detour method for a single wedge
//! Calculate diffraction f
actor based on the Maekawa detour method
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
* This function calculates the Maekawa diffraction factor based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
* The diffraction factor contains the influence of the wedge without the influence of the propagation path length.
*
* @param[in] oPropPath Propagation path
* @param[out] oTransferFunction Destination filter of simulation (frequency domain)
*
* @return True, if Kirchhoff method could be applied
*
* @note Throws ITAException on error
* @param[in] dPropagationLengthFreeField Direct path length [m]
* @param[in] dPropagationLengthOverApex Detour path length [m]
* @param[in] fFrequency Frequency [Hz]
* @param[in] fSpeedOfSound Speed of sound [m/s]
*
*/
inline
bool
CalculateDiffractionFilter
(
const
ITAGeo
::
CPropagationPath
&
oPropPath
,
ITABase
::
CHDFTSpectrum
&
oTransferFunction
,
const
float
fSpeedOfSound
=
344.0
f
)
{
if
(
!
Kirchhoff
::
IsApplicable
(
oPropPath
)
)
return
false
;
double
dDirect
,
dDetour
;
Kirchhoff
::
GetDirectLengthAndDetourLength
(
oPropPath
,
dDirect
,
dDetour
);
Kirchhoff
::
CalculateDiffractionFilter
(
dDirect
,
dDetour
,
oTransferFunction
,
fSpeedOfSound
);
double
ITA_PROPAGATION_MODELS_API
CalculateDiffractionFactor
(
const
double
dPropagationLengthFreeField
,
const
double
dPropagationLengthOverApex
,
const
float
fFrequency
,
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
);
return
true
;
};
//! Calculate diffraction filter (frequency domain) based on the Kirchhoff detour method for a single wedge
//! Calculate diffraction filter (frequency domain) based on the Maekawa detour method
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
*
* @param[in] pSource Source of propagation (previous anchor point of path)
* @param[in] pWedge Diffraction wedge of propagation
* @param[in] pTarget Target of propagation (next anchor point of path)
* @param[out] oTransferFunction Destination filter of simulation (frequency domain)
*
* @return True, if Kirchhoff method could be applied
* 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.
*
* @note Throws ITAException on error
* @param[in] dPropagationLengthFreeField Direct path length [m]
* @param[in] dPropagationLengthOverApex 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]
*
*/
inline
bool
CalculateDiffractionFilter
(
std
::
shared_ptr
<
ITAGeo
::
CPropagationAnchor
>
pSource
,
std
::
shared_ptr
<
ITAGeo
::
CITADiffractionWedgeAperture
>
pWedge
,
std
::
shared_ptr
<
ITAGeo
::
CPropagationAnchor
>
pTarget
,
ITABase
::
CHDFTSpectrum
&
oTransferFunction
,
const
float
fSpeedOfSound
=
344.0
f
)
{
if
(
!
pWedge
->
IsOccluding
(
pSource
,
pTarget
)
)
return
false
;
// A little dirty removing const, but we know what we are doing, here.
ITAGeo
::
CPropagationPath
oPropPath
;
oPropPath
.
push_back
(
pSource
);
oPropPath
.
push_back
(
pWedge
);
oPropPath
.
push_back
(
pTarget
);
const
ITAGeo
::
CPropagationPath
&
oConstPropPath
(
oPropPath
);
// Not necessary, just making a point
return
CalculateDiffractionFilter
(
oConstPropPath
,
oTransferFunction
,
fSpeedOfSound
);
};
void
ITA_PROPAGATION_MODELS_API
CalculateDiffractionFilter
(
const
double
dPropagationLengthFreeField
,
const
double
dPropagationLengthOverApex
,
ITABase
::
CHDFTSpectrum
&
oTransferFunction
,
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
);
}
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_
KIRCHHOFF
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_
MAEKAWA
include/ITAPropagationModels/Svensson.h
View file @
31464c3e
...
...
@@ -49,7 +49,7 @@ namespace ITAPropagationModels
*
* @sa GetMinimumWavefrontDelayTime, GetMaximumWavefrontDelayTime
*/
ITA_PROPAGATION_MODELS_API
bool
CalculateDiffractionIR
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeAperture
>
pApex
,
ITABase
::
CFiniteImpulseResponse
&
oEffectiveDiffractionIR
,
const
float
fSpeedOfSound
=
344.0
f
);
ITA_PROPAGATION_MODELS_API
bool
CalculateDiffractionIR
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeAperture
Base
>
pApex
,
ITABase
::
CFiniteImpulseResponse
&
oEffectiveDiffractionIR
,
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
);
}
}
...
...
include/ITAPropagationModels/UTD.h
View file @
31464c3e
...
...
@@ -40,6 +40,9 @@ namespace ITAPropagationModels
{
namespace
UTD
{
using
namespace
std
;
//! UTD diffraction coefficient calculation methods (only approximation implemented yet!)
enum
UTD_DIFFRACTION_ALGORITHM
{
...
...
@@ -60,10 +63,24 @@ namespace ITAPropagationModels
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[in] fWaveNumber Wave number ( k )
* @param[out] cf
Coeff
Complex-valued diffraction coefficient ( D( n, k,\rho, r, \phi_i, \alpha_i, \alpha_d ) )
* @param[out] cf
Factor
Complex-valued diffraction coefficient ( D( n, k,\rho, r, \phi_i, \alpha_i, \alpha_d ) )
* @param[in] iMethod Approximation algorithm
*/
ITA_PROPAGATION_MODELS_API
bool
CalculateDiffractionCoefficient
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeAperture
>
pApex
,
const
float
fWaveNumber
,
std
::
complex
<
float
>&
cfCoeff
,
const
int
iMethod
=
UTD_APPROX_KAWAI_KOUYOUMJIAN
);
bool
ITA_PROPAGATION_MODELS_API
CalculateDiffractionCoefficient
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeApertureBase
>
pApex
,
const
float
fFrequency
,
complex
<
float
>&
cfCoeff
,
const
int
iMethod
=
UTD_APPROX_KAWAI_KOUYOUMJIAN
,
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
);
//! Calculate diffraction factor based on the Maekawa detour method
/**
* This function calculates the Maekawa diffraction factor based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
* The diffraction factor contains the influence of the wedge without the influence of the propagation path length.
*
* @param[in] dPropagationLengthFreeField Direct path length [m]
* @param[in] dPropagationLengthOverApex Detour path length [m]
* @param[in] fFrequency Frequency [Hz]
* @param[in] fSpeedOfSound Speed of sound [m/s]
*
*/
bool
ITA_PROPAGATION_MODELS_API
CalculateDiffractionFactor
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeApertureBase
>
pApex
,
const
float
fFrequency
,
complex
<
float
>&
cfFactor
,
const
int
iMethod
=
UTD_APPROX_KAWAI_KOUYOUMJIAN
,
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
);
//! Calculates the UTD diffraction filter in frequency domain for a given constellation
/**
...
...
@@ -78,7 +95,7 @@ namespace ITAPropagationModels
* @param[in] iMethod Approximation algorithm
* @param[in] fSpeedOfSound Sound speed
*/
ITA_PROPAGATION_MODELS_API
void
CalculateDiffractionFilter
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeAperture
>
pApex
,
ITABase
::
CHDFTSpectrum
&
oTF
,
const
int
iMethod
=
UTD_APPROX_KAWAI_KOUYOUMJIAN
,
const
float
fSpeedOfSound
=
344.0
f
);
void
ITA_PROPAGATION_MODELS_API
CalculateDiffractionFilter
(
const
VistaVector3D
&
v3SourcePos
,
const
VistaVector3D
&
v3TargetPos
,
std
::
shared_ptr
<
const
ITAGeo
::
CITADiffractionWedgeApertureBase
>
pApex
,
ITABase
::
CHDFTSpectrum
&
oTF
,
const
int
iMethod
=
UTD_APPROX_KAWAI_KOUYOUMJIAN
,
const
float
fSpeedOfSound
=
ITAConstants
::
SPEED_OF_SOUND_F
);
}
}
...
...
src/ITAPropagationModels/FilterEngine.cpp
View file @
31464c3e