Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYChemin9613Solver.cpp
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 
18 
20 {
21  _attenuations.clear();
22 }
23 
25 {
26  *this = other;
27 }
28 
30 {
31  _attenuations.clear();
32 }
33 
35 {
36  if (this != &other)
37  {
38  TYChemin::operator=(other);
40  }
41 
42  return *this;
43 }
44 
46 {
47  if (this != &other)
48  {
49  if (TYChemin::operator!=(other))
50  {
51  return false;
52  }
53  if (_attenuations != other._attenuations)
54  {
55  return false;
56  }
57  }
58 
59  return true;
60 }
61 
63 {
64  return !operator==(other);
65 }
66 
68  const AtmosphericConditions& atmos, double dp, double hs, double hr,
69  double Gs, double Gm, double Gr)
70 {
71  unsigned int i = 0;
72 
73  switch (_typeChemin)
74  {
77  tabEtapes[0]._Absorption; // S = Source directivity index
79  atmos.compute_length_absorption_oct(_longueur); // Aatm = alpha * d
80  calcGroundAttenuations(dp, hs, hr, Gs, Gm, Gr);
81  break;
82 
85  atmos.compute_length_absorption_oct(_longueur); // Aatm = alpha * d
86  calcGroundAttenuations(dp, hs, hr, Gs, Gm, Gr);
88  tabEtapes[0]._Absorption; // S = Source directivity index
89  // We multiply steps absorptions from second
91  for (i = 1; i < tabEtapes.size(); i++)
92  {
95  (OSpectreOctave(1.0) -
96  tabEtapes[i]._Absorption); // Product of directivty factor and reflexion coefficients
97  }
98  break;
99 
100  default:
101  break;
102  }
103 
104  build_eq_path(tabEtapes);
105 }
106 
108  const OPoint3D& R, double a, double h,
109  const OVector3D& n)
110 {
111  // this code assumes 1st order reflection
114 }
115 
116 void TYChemin9613Solver::computeBarAttenuation(const OSpectreOctave& Dz, const bool vertical, const bool left)
117 {
118  if (vertical)
119  {
123  for (unsigned int i = 0; i < TY_SPECTRE_OCT_NB_ELMT; i++)
124  {
125  if (Agr.getTabValReel()[i] > 0)
126  {
128  Agr.getTabValReel()[i];
129  }
130  if (_attenuations[TYTypeAttenuation::ATTENUATION_BAR_TOP].getTabValReel()[i] < 0)
131  {
133  }
134  }
135  }
136  else
137  {
138  if (left)
139  {
142  }
143  else
144  {
147  }
148  }
149 }
150 
152 {
153  return _attenuations[type];
154 }
155 
157 {
158  if (vertical)
159  {
161  }
162  else
163  {
164  if (left)
165  {
167  }
168  else
169  {
171  }
172  }
173 }
174 
175 void TYChemin9613Solver::calcGroundAttenuations(double dp, double hs, double hr, double Gs, double Gm,
176  double Gr)
177 {
178  // Main method for flat ground or with constant slope
179  // Compute zones dimensions
180  bool bHasIntermediateZone = dp > 30 * (hs + hr);
181 
182  double q = 0.0;
183  if (bHasIntermediateZone)
184  {
185  q = 1 - 30 * (hs + hr) / dp;
186  }
187 
188  // Compute ground attenuations for source, receptor and middle zones
196 }
197 
199 {
200  double a = 1.5 + 3.0 * exp(-0.12 * (h - 5) * (h - 5)) * (1 - exp(-dp / 50.0)) +
201  5.7 * exp(-0.09 * h * h) * (1 - exp(-2.8 * pow(10, -6) * dp * dp));
202  double b = 1.5 + 8.6 * exp(-0.09 * h * h) * (1 - exp(-dp / 50.0));
203  double c = 1.5 + 14.0 * exp(-0.46 * h * h) * (1 - exp(-dp / 50.0));
204  double d = 1.5 + 5.0 * exp(-0.9 * h * h) * (1 - exp(-dp / 50.0));
205 
206  const double As[9]{-1.5, -1.5, -1.5 + G * a, -1.5 + G * b, -1.5 + G * c,
207  -1.5 + G * d, -1.5 * (1 - G), -1.5 * (1 - G), -1.5 * (1 - G)};
208  return OSpectreOctave{As, 9, 0};
209 }
210 
212 {
213  OSpectreOctave Agr_m = OSpectreOctave{0.0};
214  if (q != 0.0)
215  {
216  const double Am[9]{-3.0 * q, -3.0 * q, -3 * q * (1 - Gm),
217  -3 * q * (1 - Gm), -3 * q * (1 - Gm), -3 * q * (1 - Gm),
218  -3 * q * (1 - Gm), -3 * q * (1 - Gm), -3 * q * (1 - Gm)};
219  Agr_m = OSpectreOctave{Am, 9, 0};
220  }
221  return Agr_m;
222 }
223 
225  const OSpectreOctave& Agr_r,
226  const OSpectreOctave& Agr_m, double hs,
227  double hr, double dp) const
228 {
229  return Agr_s + Agr_r + Agr_m;
230 }
231 
233  const OPoint3D& S, const OPoint3D& O, const OPoint3D& R, double a, double h, const OVector3D& n) const
234 {
235  OSpectreOctave allWavelengthsAreReflected{1.};
236  return allWavelengthsAreReflected;
237 }
NxReal c
Definition: NxVec3.cpp:317
Representation of one of the most optimal path between source and receptor: S—>R Specific derivation ...
TYTypeAttenuation
Definition: TYChemin.h:41
std::deque< TYEtape9613Solver > TYTabEtape9613Solver
TYEtape collection.
Class for the definition of atmospheric conditions.
OSpectreOctave compute_length_absorption_oct(double length) const
The 3D point class.
Definition: 3d.h:487
double * getTabValReel() override
Get an array of the real values of the spectrum.
Definition: spectre.h:614
The 3D vector class.
Definition: 3d.h:298
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin ...
bool operator!=(const TYChemin9613Solver &other) const
Operator !=.
bool operator==(const TYChemin9613Solver &other) const
Operator ==.
OSpectreOctave calcGroundAttenuationM(double q, double Gm)
TYChemin9613Solver & operator=(const TYChemin9613Solver &other)
Operator =.
void calcGroundAttenuations(double distance, double hs, double hr, double Gs, double Gm, double Gr)
~TYChemin9613Solver() override
Destructor.
OSpectreOctave calcGroundAttenuationSR(double dp, double h, double G)
std::map< TYTypeAttenuation, OSpectreOctave > _attenuations
Attenuations spectra of the path.
void setAttenuationBarWhenNoPath(bool vertical, bool left)
Set attenuation bar to max to traduce the lack of diffracted ray on this path.
OSpectreOctave & getAttenuation(const TYTypeAttenuation type)
Return attenuation of the path of the type.
void calcAttenuation(const TYTabEtape9613Solver &tabEtapes, const AtmosphericConditions &atmos, double dp=0.0, double hs=0.0, double hr=0.0, double Gs=0.5, double Gm=0.5, double Gr=0.5)
Compute the global attenuation on the path.
TYChemin9613Solver()
Constructor.
void computeBarAttenuation(const OSpectreOctave &Dz, const bool vertical, const bool left)
Compute barrier attenuation on the path. It implements recommendation 5.5 of 17534-3 standard,...
virtual OSpectreOctave calcTotalGroundAttenuation(const OSpectreOctave &Agr_s, const OSpectreOctave &Agr_r, const OSpectreOctave &Agr_m, double hs, double hr, double dp) const
Compute total ground attenuation Agr from region ground attenuations and geometric configuration.
virtual OSpectreOctave calcMinimalExtensionConditionOneReflection(const OPoint3D &S, const OPoint3D &O, const OPoint3D &R, double a, double h, const OVector3D &n) const
Evaluate minimal extension condition for a specular reflection on a flat surface in function of the w...
void calcMinimalExtensionCondition(const OPoint3D &S, const OPoint3D &O, const OPoint3D &R, double a, double h, const OVector3D &n)
Evaluate minimal extension condition for specular reflections on flat surfaces in function of the wav...
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin ...
Definition: TYChemin.h:66
TYTypeChemin _typeChemin
Path type (has an influence on the algorithm)
Definition: TYChemin.h:170
TYChemin & operator=(const TYChemin &other)
Operator =.
Definition: TYChemin.cpp:37
void build_eq_path(const T &tabEtapes)
build an acoustic_path from the tab of etapes
Definition: TYChemin.h:158
double _longueur
Total path length.
Definition: TYChemin.h:173
This file provides class for solver configuration.