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& O, double dSO,
109  double dOR, double a, double h,
110  const OVector3D& n) const
111 {
112  OSpectreOctave allWavelengthsAreReflected{1.};
113  return allWavelengthsAreReflected;
114 }
115 
117  const OPoint3D& P, const OPoint3D& M, double r,
118  const OVector3D& axis)
119 {
120  OSpectreOctave Acurv{0.};
122 }
123 
125 {
127 }
128 
129 void TYChemin9613Solver::computeBarAttenuation(const OSpectreOctave& Dz, const bool vertical, const bool left)
130 {
131  if (vertical)
132  {
136  for (unsigned int i = 0; i < TY_SPECTRE_OCT_NB_ELMT; i++)
137  {
138  if (Agr.getTabValReel()[i] > 0)
139  {
141  Agr.getTabValReel()[i];
142  }
143  if (_attenuations[TYTypeAttenuation::ATTENUATION_BAR_TOP].getTabValReel()[i] < 0)
144  {
146  }
147  }
148  }
149  else
150  {
151  if (left)
152  {
155  }
156  else
157  {
160  }
161  }
162 }
163 
165 {
166  return _attenuations[type];
167 }
168 
170 {
171  if (vertical)
172  {
174  }
175  else
176  {
177  if (left)
178  {
180  }
181  else
182  {
184  }
185  }
186 }
187 
188 void TYChemin9613Solver::calcGroundAttenuations(double dp, double hs, double hr, double Gs, double Gm,
189  double Gr)
190 {
191  // Main method for flat ground or with constant slope
192  // Compute zones dimensions
193  bool bHasIntermediateZone = dp > 30 * (hs + hr);
194 
195  double q = 0.0;
196  if (bHasIntermediateZone)
197  {
198  q = 1 - 30 * (hs + hr) / dp;
199  }
200 
201  // Compute ground attenuations for source, receptor and middle zones
209 }
210 
212 {
213  double a = 1.5 + 3.0 * exp(-0.12 * (h - 5) * (h - 5)) * (1 - exp(-dp / 50.0)) +
214  5.7 * exp(-0.09 * h * h) * (1 - exp(-2.8 * pow(10, -6) * dp * dp));
215  double b = 1.5 + 8.6 * exp(-0.09 * h * h) * (1 - exp(-dp / 50.0));
216  double c = 1.5 + 14.0 * exp(-0.46 * h * h) * (1 - exp(-dp / 50.0));
217  double d = 1.5 + 5.0 * exp(-0.9 * h * h) * (1 - exp(-dp / 50.0));
218 
219  const double As[9]{-1.5, -1.5, -1.5 + G * a, -1.5 + G * b, -1.5 + G * c,
220  -1.5 + G * d, -1.5 * (1 - G), -1.5 * (1 - G), -1.5 * (1 - G)};
221  return OSpectreOctave{As, 9, 0};
222 }
223 
225 {
226  OSpectreOctave Agr_m = OSpectreOctave{0.0};
227  if (q != 0.0)
228  {
229  const double Am[9]{-3.0 * q, -3.0 * q, -3 * q * (1 - Gm),
230  -3 * q * (1 - Gm), -3 * q * (1 - Gm), -3 * q * (1 - Gm),
231  -3 * q * (1 - Gm), -3 * q * (1 - Gm), -3 * q * (1 - Gm)};
232  Agr_m = OSpectreOctave{Am, 9, 0};
233  }
234  return Agr_m;
235 }
236 
238  const OSpectreOctave& Agr_r,
239  const OSpectreOctave& Agr_m, double hs,
240  double hr, double dp) const
241 {
242  return Agr_s + Agr_r + Agr_m;
243 }
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 setMinimalExtensionConditionReflection(const OSpectreOctave &filter)
Set the minimal extension condition reflection.
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.
virtual void calcCylinderReflectionAttenuation(const OPoint3D &S, const OPoint3D &R, const OPoint3D &P, const OPoint3D &M, double r, const OVector3D &axis)
Compute attenuation when a reflection occur on a cylinder Its value is 0 for 9613Solver.
virtual OSpectreOctave calcMinimalExtensionConditionOneReflection(const OPoint3D &Oprev, const OPoint3D &O, double d_SO, double d_OR, 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 setAttenuation(const TYTypeAttenuation &type, const OSpectreOctave &att)
Set the atmospheric attenuation.
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.
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin ...
Definition: TYChemin.h:67
TYTypeChemin _typeChemin
Path type (has an influence on the algorithm)
Definition: TYChemin.h:171
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:159
double _longueur
Total path length.
Definition: TYChemin.h:174
This file provides class for solver configuration.