Skip to content
Snippets Groups Projects
Commit 8bbe53e5 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding test running propagation simulation on GRAS scene 5

parent d34b5094
No related branches found
No related tags found
No related merge requests found
...@@ -23,3 +23,12 @@ vista_install( CombinedModelTest ) ...@@ -23,3 +23,12 @@ vista_install( CombinedModelTest )
vista_create_default_info_file( CombinedModelTest ) vista_create_default_info_file( CombinedModelTest )
set_property( TARGET CombinedModelTest PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/CombinedModel" ) set_property( TARGET CombinedModelTest PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/CombinedModel" )
add_executable( GRAS_scene5 GRAS_scene5.cpp )
target_link_libraries( GRAS_scene5 ${VISTA_USE_PACKAGE_LIBRARIES} )
vista_configure_app( GRAS_scene5 )
vista_install( GRAS_scene5 )
vista_create_default_info_file( GRAS_scene5 )
set_property( TARGET GRAS_scene5 PROPERTY FOLDER "ITAGeometricalAcoustics/Tests/ITAPropagationPathSim/CombinedModel" )
/*
* ----------------------------------------------------------------
*
* ITA geometrical acoustics
* (c) Copyright Institute of Technical Acoustics (ITA)
* RWTH Aachen University, Germany, 2015-2018
*
* ----------------------------------------------------------------
* ____ __________ _______
* // / //__ ___/ // _ |
* // / // / // /_| |
* // / // / // ___ |
* //__/ //__/ //__/ |__|
*
* ----------------------------------------------------------------
*
* Tests the image (source) model algorithm.
*
*/
#include <ITAStopWatch.h>
#include <ITAStringUtils.h>
#include <ITAPropagationPathSim/CombinedModel/PropagationEngine.h>
#include <ITAGeo/Base.h>
#include <ITAGeo/Utils.h>
#include <ITAGeo/SketchUp/Model.h>
#include <ITAGeo/Material/Material.h>
#include <ITAGeo/Material/Manager.h>
#include <cassert>
using namespace std;
using namespace ITAGeo;
using namespace ITAPropagationPathSim;
#if 1 //#ifdef WITH_JSON_SUPPORT
#include <libjson.h>
#endif
int main( int iNumInArgs, char* pcInArgs[] )
{
std::string sInFile = "GRAS_scene5_geometry.skp";
auto pMeshModelList = make_shared< ITAGeo::Halfedge::CMeshModelList>();
if( pMeshModelList->Load( sInFile ) )
{
cout << "Successfully loaded '" << sInFile << "'" << endl;
}
else
{
cerr << "Could not load " << sInFile << endl;
return 255;
}
// Configuration
const bool bOnlyNeighbouredEdgeDiffraction = false;
const bool bDiffractionOnlyIntoShadowedEdges = false;//
const bool bFilterNotVisiblePathsBetweenEdges = false; //Intersection test between edges(expensive)
const bool bFilterNotVisiblePointToEdge = true; //Intersection test between emitter/sensor and edges
const bool bFilterNotVisiblePaths = true; //Intersection test of calculated sub paths
const float fIntersectionTestResolution = 0.001;
const int iNumIterations = 4;//!< Number of iterations for the calculation of the aperture points
const int fMaxAccumulatedDiffractionAngle = -ITAConstants::PI_F;
const float fLevelDropThreshhold = -90.f - 30.f - 11.f; //90 dB Power level of Diesel; 30 dB masking; 11 dB initial power level drop
const float fReflectionPenalty = -10 * log10f( 0.8 ); //Level reduction of a reflection with reflection factor rho = 0.8 from ISO9613-2
const float fDiffractionPenalty = 2.5f; // Minimum level reduction of a diffracted signal into the shadow region for a low frequency (Taken from BA Filbert Figure 16. UTD)
const int iMaxDiffractionOrder = 3;
const int iMaxReflectionOrder = 3;
const int iMaxCombinedOrder = 5;
ITAStopWatch sw; sw.start();
auto pSensor = make_shared< CSensor >( VistaVector3D( 8.512f, 2.985f, 1.235f ) );
pSensor->qOrient = VistaQuaternion( Vista::ZeroVector, VistaVector3D( -1.0f, 0.0f, 0.0f ) );
pSensor->sName = "MP01_FABIAN";
auto pEmitter = make_shared< CEmitter >( VistaVector3D( 2.487f, 2.985f, 2.0f ) );
pEmitter->sName = "LS02_Genelec8020c";
auto pPathEngine = make_shared<CombinedModel::CPathEngine>();
cout << "Calculation time initialization path engine: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->Configure( bOnlyNeighbouredEdgeDiffraction, bDiffractionOnlyIntoShadowedEdges, bFilterNotVisiblePathsBetweenEdges, bFilterNotVisiblePointToEdge, bFilterNotVisiblePointToEdge, bFilterNotVisiblePaths, iNumIterations, fIntersectionTestResolution );
pPathEngine->SetAbortionCriteria( iMaxDiffractionOrder, iMaxReflectionOrder, iMaxCombinedOrder, fLevelDropThreshhold, fReflectionPenalty, fDiffractionPenalty, fMaxAccumulatedDiffractionAngle );
cout << "Calculation time configuring filter: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->InitializePathEnvironment( pMeshModelList );
cout << "Calculation time initialization path environment: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->ApplyEmitter( pEmitter );
cout << "Calculation time applying emitter: " << timeToString( sw.stop() ) << endl;
cout << "Number propagation path candidates after source insertion: " << pPathEngine->GetNumberPropagationPathCandidates() << endl;
sw.start();
pPathEngine->ApplySensor( pSensor );
cout << "Calculation time applying sensor: " << timeToString( sw.stop() ) << endl;
CPropagationPathList oPathList;
cout << "Calculation time applying sensor: " << timeToString( sw.stop() ) << endl;
sw.start();
pPathEngine->ConstructPropagationPaths( oPathList );
//pPathEngine->ConstructPropagationPathsWithStopWatch(oPathListAll);
cout << "Calculation time propagation path creation: " << timeToString( sw.stop() ) << endl;
cout << "Visible paths: " << to_string( oPathList.size() ) << endl;
SketchUp::CModel oGeoModel_Viz;
if( oGeoModel_Viz.Load( sInFile ) )
{
cout << "Successfully loaded '" << sInFile << "'" << endl;
}
else
{
cerr << "Could not load " << sInFile << endl;
return 255;
}
oGeoModel_Viz.AddEmitterVisualization( *pEmitter, pEmitter->sName );
oGeoModel_Viz.AddSensorVisualization( *pSensor, pSensor->sName );
cout << "The path with the longest length is " << oPathList.GetMaxLength() << " m." << endl;
size_t numberOfPaths[ iMaxDiffractionOrder + 1 ][ iMaxReflectionOrder + 1 ] = { 0 };
for( auto& oPath : oPathList )
{
long iNumReflections = ( long ) oPath.GetNumReflections();
long iNumDiffractions = ( long ) oPath.GetNumDiffractions();
numberOfPaths[ iNumDiffractions ][ iNumReflections ]++;
}
for( auto& oPath : oPathList )
{
long iNumReflections = ( long ) oPath.GetNumReflections();
long iNumDiffractions = ( long ) oPath.GetNumDiffractions();
string sPathName = "Refl_Order_" + to_string( iNumReflections ) + "_Diffr_Order_" + to_string( iNumDiffractions ) + "_Path_Amount_" + to_string( numberOfPaths[ iNumDiffractions ][ iNumReflections ] );
oGeoModel_Viz.AddPropagationPathVisualization( oPath, sPathName );
}
oPathList.Store( "GRAS_scene5_propagation_paths.json" );
oGeoModel_Viz.Store( "GRAS_scene5_visualization.skp" );
return 0;
}
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
This diff is collapsed.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment