Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TYAcousticModel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2014> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14 */
15 
16 #ifndef __TYACOUSTICMODEL__
17 #define __TYACOUSTICMODEL__
18 
19 #include "Tympan/core/interfaces.h"
22 #include <gtest/gtest_prod.h>
23 
24 class TYTrajet;
25 class TYSolver;
26 
32 {
33 public:
34  TYAcousticModel(TYSolver& solver); //<! Constructor
35  virtual ~TYAcousticModel(); //<! Destructor
36 
37  virtual void compute(const std::deque<TYSIntersection>& tabIntersect,
38  TYTrajet& trajet, TabPoint3D& ptsTop, TabPoint3D& ptsLeft,
39  TabPoint3D& ptsRight );
40 
42  void init();
43 
56  virtual bool computeCheminsAvecEcran(const OSegment3D& rayon, const tympan::AcousticSource& source,
57  const TabPoint3D& pts, const bool vertical,
58  TYTabChemin& TabChemins, double distance, bool conditionFav = false) const;
59 
68  void computeCheminReflexion(const std::deque<TYSIntersection>& tabIntersect, const OSegment3D& rayon,
69  const tympan::AcousticSource& source, TYTabChemin& TabChemins,
70  double distance ) const;
71 
72  // * \fn getSpectreAttVegetation
73  // * @brief Calcule les spectres d'attenuation caracteristiques de la vegetation
74  // * pour chaque terrain survole par rayon.
75  // *
76  // * @param rayon Un segment representant le rayon acoustique.
77  // * @param tabSegSp Le tableau dans lequel sont stockes les spectres d'attenuation et segments associes.
78  // * @param penteMoyenne La pente moyenne sur le rayon.
79  // */
80  //void getSpectreAttVegetation(const OSegment3D& rayon, const OSegment3D& penteMoyenne, TYTabStructSegLPSp& tabSegSp) const;
81 
82  // * \fn computeCheminAvecVeg
83  // * @brief Calcule le chemin direct en tenant compte de la vegetation.
84  // *
85  // * @param rayon Un segment representant le rayon acoustique.
86  // * @param Atmo L'atmosphere courante.
87  // * @param pSrcGeoNode La source ponctuelle.
88  // * @param penteMoyenne La pente moyenne sur le rayon.
89  // *
90  // * @return Le chemin determine.
91  // */
92  //void computeCheminAvecVeg(const OSegment3D& rayon, const tympan::AcousticSource& source, const OSegment3D& penteMoyenne, TYTabChemin& TabChemin, double distance) const;
93 
101  void computeCheminSansEcran(const OSegment3D& rayon, const tympan::AcousticSource& source, TYTabChemin& TabChemins, double distance, bool conditionFav = false) const;
102 
110  void computeCheminAPlat(const OSegment3D& rayon, const tympan::AcousticSource& source, TYTabChemin& TabChemins, double distance) const;
111 
112 
119  OSpectre calculC(const double& epaisseur) const;
120 
134  OSpectre calculAttDiffraction(const OSegment3D& rayon, const OSegment3D& penteMoyenne, const bool& miroir, const double& re, const double& epaisseur, const bool& vertical, const bool& avantApres, bool& bDiffOk, bool conditionFav=false) const;
135 
141  OSpectre limAttDiffraction(const OSpectre& sNC, const OSpectre& C) const;
142 
158  bool addEtapesSol(const OPoint3D& ptDebut, const OPoint3D& ptFin, const OSegment3D& penteMoyenne, const tympan::AcousticSource& source, const bool& fromSource, const bool& toRecepteur, TYTabEtape& Etapes, double& longueur) const;
159 
165  void addEtapeDirectToChemins(const TYEtape& EtapeDirecte, TYTabChemin& TabChemin) const;
166 
171  bool solve(TYTrajet& trajet);
172 
173 private :
177  OSpectreComplex getReflexionSpectrumAt(const OSegment3D& incident, double length, const OSegment3D& segPente, const tympan::AcousticSource& source) const;
178 
182  void meanSlope(const OSegment3D& director, OSegment3D& slope) const;
183 
184 private:
185  FRIEND_TEST(test_TYAcousticModel, calculAttDiffraction);
186  FRIEND_TEST(test_TYAcousticModel, calculC);
187  FRIEND_TEST(test_TYAcousticModel, limAttDiffraction);
188  FRIEND_TEST(test_TYAcousticModel, computeCheminReflexion);
189  bool _useSol;
192  bool _useAtmo;
194  double _paramH;
195 
196  std::unique_ptr<AtmosphericConditions> pSolverAtmos;
197 
200 
201 
204 };
205 
206 #endif // __TYACOUSTICMODEL__
void init()
Initialize the acoustic model.
void addEtapeDirectToChemins(const TYEtape &EtapeDirecte, TYTabChemin &TabChemin) const
Add a direct journey to all the paths.
The TYEtape class is used to describe a part (a step) of a path (TYChemin) for the computation of tra...
Definition: TYEtape.h:47
void computeCheminReflexion(const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &rayon, const tympan::AcousticSource &source, TYTabChemin &TabChemins, double distance) const
Compute the list of path generated by reflection on the vertical walls.
Default solver.
Definition: TYSolver.h:38
std::vector< OPoint3D > TabPoint3D
Definition: 3d.h:481
OSpectre limAttDiffraction(const OSpectre &sNC, const OSpectre &C) const
Limit the screen attenuation value with a frequency dependent criteria.
OSpectreComplex getReflexionSpectrumAt(const OSegment3D &incident, double length, const OSegment3D &segPente, const tympan::AcousticSource &source) const
Find Reflexion spectrum at point defined by the end of an incident segment.
std::deque< TYChemin > TYTabChemin
TYChemin collection.
Definition: TYChemin.h:149
virtual void compute(const std::deque< TYSIntersection > &tabIntersect, TYTrajet &trajet, TabPoint3D &ptsTop, TabPoint3D &ptsLeft, TabPoint3D &ptsRight)
virtual ~TYAcousticModel()
This class TYTrajet (journey) links a couple Source-Receptor and a collection of paths, in addition to the direct path.
Definition: TYTrajet.h:35
virtual bool computeCheminsAvecEcran(const OSegment3D &rayon, const tympan::AcousticSource &source, const TabPoint3D &pts, const bool vertical, TYTabChemin &TabChemins, double distance, bool conditionFav=false) const
Compute the segment path from the list of the points of the TYTrajet journey. It takes in account the...
OSpectreComplex _absoNulle
FRIEND_TEST(test_TYAcousticModel, calculAttDiffraction)
TYAcousticModel(TYSolver &solver)
OSpectre calculAttDiffraction(const OSegment3D &rayon, const OSegment3D &penteMoyenne, const bool &miroir, const double &re, const double &epaisseur, const bool &vertical, const bool &avantApres, bool &bDiffOk, bool conditionFav=false) const
Compute the attenuation from the diffraction on the screen.
OSpectre calculC(const double &epaisseur) const
Compute the spectrum of the C factor used in the diffraction calculation.
Interface class for acoustic models.
Definition: interfaces.h:47
Representation of one of the most optimal path between source and receptor: S—>R.
TYSolver & _solver
Reference to the solver.
void meanSlope(const OSegment3D &director, OSegment3D &slope) const
Create a segment corresponding to the projection of "director" segment on the ground.
Class to define a segment.
Definition: 3d.h:1087
std::deque< TYEtape > TYTabEtape
TYEtape collection.
Definition: TYEtape.h:149
std::unique_ptr< AtmosphericConditions > pSolverAtmos
Describes an acoustic source.
Definition: entities.hpp:315
bool addEtapesSol(const OPoint3D &ptDebut, const OPoint3D &ptFin, const OSegment3D &penteMoyenne, const tympan::AcousticSource &source, const bool &fromSource, const bool &toRecepteur, TYTabEtape &Etapes, double &longueur) const
Compute the different steps from a point to another via a reflection and a direct view...
The 3D point class.
Definition: 3d.h:484
Acoustic model for the default solver.
bool solve(TYTrajet &trajet)
Compute the source contribution to the point.
void computeCheminSansEcran(const OSegment3D &rayon, const tympan::AcousticSource &source, TYTabChemin &TabChemins, double distance, bool conditionFav=false) const
Compute the list of paths generated by reflection on the ground if there is no screen.
Store acoustic power values for different frequencies.
Definition: spectre.h:49
void computeCheminAPlat(const OSegment3D &rayon, const tympan::AcousticSource &source, TYTabChemin &TabChemins, double distance) const
Compute the list of paths for a perfectly flat and reflective ground.