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 
107 void TYChemin9613Solver::computeBarAttenuation(const OSpectreOctave& Dz, const bool vertical, const bool left)
108 {
109  if (vertical)
110  {
116  for (unsigned int i = 0; i < TY_SPECTRE_OCT_NB_ELMT; i++)
117  {
118  if (Agr.getTabValReel()[i] > 0)
119  {
121  Agr.getTabValReel()[i];
122  }
123  if (_attenuations[TYTypeAttenuation::ATTENUATION_BAR_TOP].getTabValReel()[i] < 0)
124  {
126  }
127  }
128  }
129  else
130  {
131  if (left)
132  {
135  }
136  else
137  {
140  }
141  }
142 }
143 
145 {
146  return _attenuations[type];
147 }
148 
150 {
151  if (vertical)
152  {
154  }
155  else
156  {
157  if (left)
158  {
160  }
161  else
162  {
164  }
165  }
166 }
167 
168 void TYChemin9613Solver::calcGroundAttenuations(double dp, double hs, double hr, double Gs, double Gm,
169  double Gr)
170 {
171  // Main method for flat ground or with constant slope
172  // Compute zones dimensions
173  bool bHasIntermediateZone = dp > 30 * (hs + hr);
174 
175  double q = 0.0;
176  if (bHasIntermediateZone)
177  {
178  q = 1 - 30 * (hs + hr) / dp;
179  }
180 
181  // Compute ground attenuations for source, receptor and middle zones
185 }
186 
188 {
189  double a = 1.5 + 3.0 * exp(-0.12 * (h - 5) * (h - 5)) * (1 - exp(-dp / 50.0)) +
190  5.7 * exp(-0.09 * h * h) * (1 - exp(-2.8 * pow(10, -6) * dp * dp));
191  double b = 1.5 + 8.6 * exp(-0.09 * h * h) * (1 - exp(-dp / 50.0));
192  double c = 1.5 + 14.0 * exp(-0.46 * h * h) * (1 - exp(-dp / 50.0));
193  double d = 1.5 + 5.0 * exp(-0.9 * h * h) * (1 - exp(-dp / 50.0));
194 
195  const double As[9]{-1.5, -1.5, -1.5 + G * a, -1.5 + G * b, -1.5 + G * c,
196  -1.5 + G * d, -1.5 * (1 - G), -1.5 * (1 - G), -1.5 * (1 - G)};
197  return OSpectreOctave{As, 9, 0};
198 }
199 
201 {
202  OSpectreOctave Agr_m = OSpectreOctave{0.0};
203  if (q != 0.0)
204  {
205  const double Am[9]{-3.0 * q, -3.0 * q, -3 * q * (1 - Gm),
206  -3 * q * (1 - Gm), -3 * q * (1 - Gm), -3 * q * (1 - Gm),
207  -3 * q * (1 - Gm), -3 * q * (1 - Gm), -3 * q * (1 - Gm)};
208  Agr_m = OSpectreOctave{Am, 9, 0};
209  }
210  return Agr_m;
211 }
NxReal c
Definition: NxVec3.cpp:317
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
double * getTabValReel() override
Get an array of the real values of the spectrum.
Definition: spectre.h:614
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)
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin ...
Definition: TYChemin.h:64
TYTypeChemin _typeChemin
Path type (has an influence on the algorithm)
Definition: TYChemin.h:168
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:156
double _longueur
Total path length.
Definition: TYChemin.h:171
This file provides class for solver configuration.