Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYAcousticModel9613Solver.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef __TYACOUSTICMODEL_9613SOLVER__
17 #define __TYACOUSTICMODEL_9613SOLVER__
18 
19 #include "Tympan/core/interfaces.h"
25 #include <gtest/gtest_prod.h>
26 
27 // Custom hash function for OVector3D
29 {
30  std::size_t operator()(const OVector3D& vec) const
31  {
32  std::size_t hx = std::hash<double>()(vec._x);
33  std::size_t hy = std::hash<double>()(vec._y);
34  std::size_t hz = std::hash<double>()(vec._z);
35  return hx ^ (hy << 1) ^ (hz << 2); // Combining the hash values
36  }
37 };
38 
44 {
45 public:
46  TYAcousticModel9613Solver(TYSolver9613Solver& solver); //<! Constructor
47 
49  virtual void init() override;
50 
59  void compute(const std::deque<TYSIntersection>& tabIntersect, TYTrajet9613Solver& trajet,
60  TabPoint3D& ptsTop, TabPoint3D& ptsLeft, TabPoint3D& ptsRight);
61 
66  void computeWaveLength() override;
67 
83  virtual bool computeCheminsAvecEcran(const OSegment3D& rayon, const tympan::AcousticSource& source,
84  const TabPoint3D& pts, const bool vertical,
85  TYTabChemin9613Solver& TabChemins, double distance,
86  const bool left) const;
87 
97  virtual void computeCheminReflexion(const std::deque<TYSIntersection>& tabIntersect,
98  const OSegment3D& ray, const tympan::AcousticSource& source,
99  TYTabChemin9613Solver& TabChemins, double distance) const;
100 
112  void computeCheminSansEcran(const std::deque<TYSIntersection>& tabIntersect, const OSegment3D& rayon,
113  const tympan::AcousticSource& source, TYTabChemin9613Solver& TabChemins,
114  double distance, bool conditionFav = false) const;
115 
129  OSpectreOctave calculAttDiffraction(const OSegment3D& ray, const double& re, const double& dss,
130  const double& dsr, const double& width, const bool& vertical) const;
131 
138 
151  bool addGroundSteps(const OPoint3D& ptStart, const OPoint3D& ptEnd, const tympan::AcousticSource& source,
152  const bool& fromSource, TYTabEtape9613Solver& Etapes) const;
153 
169  bool getGroundfactors(const std::deque<TYSIntersection>& tabIntersect, const OSegment3D& ray2D, double hs,
170  double hr, double& Gs, double& Gm, double& Gr) const;
171 
189  bool getGroundfactors(const std::deque<TYSIntersection>& tabIntersectUpSegment,
190  const std::deque<TYSIntersection>& tabIntersectDownSegment, const OSegment3D& SO2D,
191  const OSegment3D& OR2D, double hs, double hr, double& Gs, double& Gm,
192  double& Gr) const;
193 
194  /*
195  * @brief Compute effective barrier attenuation implementing recommandation paragraph 5.6
196  * of ISO TR 17534-3
197  * @param [in] Abar_top Barrier attenuation for the vertical path.
198  * @param [in] Abar_left Barrier attenuation for the left lateral path.
199  * @param [in] Abar_right Barrier attenuation for the right lateral path.
200  *
201  */
203  const OSpectreOctave& Abar_left,
204  const OSpectreOctave& Abar_right);
205 
210  bool solve(TYTrajet9613Solver& trajet);
211 
212 protected:
213  virtual std::unique_ptr<TYChemin9613Solver> createChemin() const
214  {
215  return std::make_unique<TYChemin9613Solver>();
216  }
217 
225  bool computeSegmentEdgesHeights(double& hauteurA, double& hauteurB, const OSegment3D& meanSlope,
226  const OSegment3D& ray) const;
227 
234  OSpectreOctave calculC3(const double& epaisseur) const;
235 
245  virtual OSpectreOctave calculZMin(const double C2, const OSpectreOctave& C3) const;
246 
261  virtual OSpectreOctave calculKmeteo(const bool vertical, const double d_SS, const double d_SR,
262  const double d, const double z, const double e,
263  const OSpectreOctave& z_min) const;
264 
274  virtual OSpectreOctave calculDz(const double z, const double C2, const OSpectreOctave& C3,
275  const OSpectreOctave& Kmeteo, const OSpectreOctave& zmin) const;
276 
285  bool computeGZone(const OPoint3D& ptDebut, const OPoint3D& ptFin, double& GZone, double& dpZone,
286  const std::deque<TYSIntersection>& tabIntersect) const;
287 
288 private:
289  TYSolver& getSolver() const override
290  {
291  return _solver;
292  }
293 
294 protected:
298 
299 private:
300  FRIEND_TEST(test_TYAcoustiModel9613Solver, computeGZone);
301  FRIEND_TEST(test_TYAcousticModel9613Solver, calculZMin);
302  FRIEND_TEST(test_TYAcousticModel9613Solver, calculC3_single_diffraction);
303  FRIEND_TEST(test_TYAcousticModel9613Solver, calculC3_multiple_diffraction);
304  FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_z_0);
305  FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_z_30);
306  FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_lateral_diffraction);
307  FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_d_500_z_1);
308  FRIEND_TEST(test_TYAcousticModel9613Solver, calculDz_z_positive);
309  FRIEND_TEST(test_TYAcousticModel9613Solver, calculDz_z_negative);
310 
312 };
313 
314 #endif // __TYACOUSTICMODEL_9613SOLVER__
std::vector< OPoint3D > TabPoint3D
Definition: 3d.h:483
std::deque< TYChemin9613Solver > TYTabChemin9613Solver
TYChemin collection.
std::deque< TYEtape9613Solver > TYTabEtape9613Solver
TYEtape collection.
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
The 3D point class.
Definition: 3d.h:487
Class to define a segment.
Definition: 3d.h:1141
The 3D vector class.
Definition: 3d.h:298
Acoustic model for the 9613Solver.
void computeCheminSansEcran(const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &rayon, const tympan::AcousticSource &source, TYTabChemin9613Solver &TabChemins, double distance, bool conditionFav=false) const
Compute the main path between source and receptor. In 9613 solver, this path includes all attenuation...
OSpectreOctave calculC3(const double &epaisseur) const
Compute the spectrum of the C3 factor used in the diffraction calculation.
TYSolver & getSolver() const override
FRIEND_TEST(test_TYAcousticModel9613Solver, calculDz_z_positive)
OSpectreOctave calculAttDiffraction(const OSegment3D &ray, const double &re, const double &dss, const double &dsr, const double &width, const bool &vertical) const
Compute the attenuation from the diffraction on the screen.
virtual bool computeCheminsAvecEcran(const OSegment3D &rayon, const tympan::AcousticSource &source, const TabPoint3D &pts, const bool vertical, TYTabChemin9613Solver &TabChemins, double distance, const bool left) const
Compute barrier attenuation effect on the direct path for the considered geometrical path (top,...
bool solve(TYTrajet9613Solver &trajet)
Compute the source contributions to the receptor point.
FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_z_0)
bool addGroundSteps(const OPoint3D &ptStart, const OPoint3D &ptEnd, const tympan::AcousticSource &source, const bool &fromSource, TYTabEtape9613Solver &Etapes) const
Compute the different steps from a point to another via a reflection and a direct view.
TYAcousticModel9613Solver(TYSolver9613Solver &solver)
virtual void init() override
Initialize the acoustic model.
void computeWaveLength() override
Compute the wave length for the 9613Solver.
TYSolver9613Solver & _solver
Reference to the solver.
virtual OSpectreOctave calculKmeteo(const bool vertical, const double d_SS, const double d_SR, const double d, const double z, const double e, const OSpectreOctave &z_min) const
Compute Kmeteo, the correction factor for meteorological effects In Code_TYMPAN 9613Solver version 96...
bool computeGZone(const OPoint3D &ptDebut, const OPoint3D &ptFin, double &GZone, double &dpZone, const std::deque< TYSIntersection > &tabIntersect) const
Compute GZone and dpZone for the segment between ptDebut and ptFin.
FRIEND_TEST(test_TYAcousticModel9613Solver, calculDz_z_negative)
FRIEND_TEST(test_TYAcousticModel9613Solver, calculZMin)
FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_z_30)
bool computeSegmentEdgesHeights(double &hauteurA, double &hauteurB, const OSegment3D &meanSlope, const OSegment3D &ray) const
Compute heights relative to real ground, of the edges of a segment.
FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_lateral_diffraction)
OSpectreOctave limAttDiffraction(const OSpectreOctave &sNC, const OSpectreOctave &C) const
Limit the screen attenuation value with a frequency dependent criteria.
OSpectreOctave computeEffectiveBarAttenuation(const OSpectreOctave &Abar_top, const OSpectreOctave &Abar_left, const OSpectreOctave &Abar_right)
FRIEND_TEST(test_TYAcousticModel9613Solver, calculC3_single_diffraction)
FRIEND_TEST(test_TYAcousticModel9613Solver, calculK_meteo_d_500_z_1)
virtual std::unique_ptr< TYChemin9613Solver > createChemin() const
void compute(const std::deque< TYSIntersection > &tabIntersect, TYTrajet9613Solver &trajet, TabPoint3D &ptsTop, TabPoint3D &ptsLeft, TabPoint3D &ptsRight)
Main entry point, trigger acoustic computations.
FRIEND_TEST(test_TYAcousticModel9613Solver, calculC3_multiple_diffraction)
FRIEND_TEST(test_TYAcoustiModel9613Solver, computeGZone)
virtual void computeCheminReflexion(const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &ray, const tympan::AcousticSource &source, TYTabChemin9613Solver &TabChemins, double distance) const
Compute the list of path generated by reflection on the vertical walls.
virtual OSpectreOctave calculZMin(const double C2, const OSpectreOctave &C3) const
Compute zmin, the min value of z for which the barrier attenuation Dz is null. This minimum distance ...
virtual OSpectreOctave calculDz(const double z, const double C2, const OSpectreOctave &C3, const OSpectreOctave &Kmeteo, const OSpectreOctave &zmin) const
Compute Dz, the barrier attenuation for each octave band in dB.
bool getGroundfactors(const std::deque< TYSIntersection > &tabIntersect, const OSegment3D &ray2D, double hs, double hr, double &Gs, double &Gm, double &Gr) const
Get ground factors for source, middle and receptor zones.
Acoustic model for the considered solver.
void meanSlope(const OSegment3D &director, OSegment3D &slope) const
Create a segment corresponding to the projection of "director" segment on the ground.
Class which represents the Solver for 9613 family solvers.
Definition: TYSolver.h:36
This class TYTrajet (journey) links a couple Source-Receptor and a collection of paths,...
Describes an acoustic source.
Definition: entities.hpp:407
std::size_t operator()(const OVector3D &vec) const