Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYRoute.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <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 #include <limits>
17 #include <cmath>
18 
19 #include <boost/math/special_functions/fpclassify.hpp>
20 
21 #include "Tympan/core/logging.h"
23 #if TY_USE_IHM
27 #endif
28 #include "TYRoute.h"
29 
30 #include <math.h>
31 
34 
35 bool TYRoute::is_valid_declivity(double decli)
36 {
37  return !boost::math::isnan(decli);
38 } // Could and should use std::isnan in C++ '11
39 
40 const double TYRoute::undefined_declivity = std::numeric_limits<double>::quiet_NaN();
41 TYRoute::TYRoute() : computed_declivity(false), _offSet(0.05)
42 {
44 
45  float r = 80.0f, g = 80.0f, b = 80.0f;
46 
47 #if TY_USE_IHM
48  if (TYPreferenceManager::exists(TYDIRPREFERENCEMANAGER, "TYRouteGraphicColor"))
49  {
50  TYPreferenceManager::getColor(TYDIRPREFERENCEMANAGER, "TYRouteGraphicColor", r, g, b);
51  }
52  else
53  {
54  TYPreferenceManager::setColor(TYDIRPREFERENCEMANAGER, "TYRouteGraphicColor", r, g, b);
55  }
56 
57  if (TYPreferenceManager::exists(TYDIRPREFERENCEMANAGER, "TYRouteSourceOffSet"))
58  {
59  _offSet = TYPreferenceManager::getDouble(TYDIRPREFERENCEMANAGER, "TYRouteSourceOffSet");
60  }
61  else
62  {
63  TYPreferenceManager::setDouble(TYDIRPREFERENCEMANAGER, "TYRouteSourceOffSet", 0.05);
64  }
65 #endif // TY_USE_IHM
66  OColor color;
67  color.r = r / 255;
68  color.g = g / 255;
69  color.b = b / 255;
70 
71  setColor(color);
72 
73  _regimeChangeAble = false;
74 
75  road_traffic.surfaceType = RoadSurface_Default;
76  road_traffic.surfaceAge = 0.0;
77  road_traffic.ramp = 0.0;
78  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
79  {
80  traffic_regimes[i].setParent(this);
81  // On rajoute un ieme regime (un premier a ete construit par TYAcousticLine)
82  if (i > 0)
83  {
85  }
86  }
87 
88  _largeur = 3.5;
89 
91 
92  // On nomme les regimes
93  _tabRegimes[0].setName(std::string("Jour")); // TODO i18n
94  _tabRegimes[1].setName(std::string("Soir")); // TODO i18n
95  _tabRegimes[2].setName(std::string("Nuit")); // TODO i18n
96 
98 }
99 
101 {
102  *this = other;
103 }
104 
106 
108 {
109  if (this != &other)
110  {
112  road_traffic = other.road_traffic;
113  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
114  {
115  traffic_regimes[i] = other.traffic_regimes[i];
116  }
119  }
120  return *this;
121 }
122 
123 bool TYRoute::operator==(const TYRoute& other) const
124 {
125  if (this != &other)
126  {
127  if (TYAcousticLine::operator!=(other))
128  {
129  return false;
130  }
131  if (road_traffic.surfaceType != other.road_traffic.surfaceType)
132  {
133  return false;
134  }
135  if (road_traffic.surfaceAge != other.road_traffic.surfaceAge)
136  {
137  return false;
138  }
139  if (road_traffic.ramp != other.road_traffic.ramp)
140  {
141  return false;
142  }
143  if (road_traffic.nbComponents != other.road_traffic.nbComponents)
144  {
145  return false;
146  }
147  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
148  {
149  if (traffic_regimes[i] != other.traffic_regimes[i])
150  {
151  return false;
152  };
153  }
154  }
155  return true;
156 }
157 
158 bool TYRoute::operator!=(const TYRoute& other) const
159 {
160  return !operator==(other);
161 }
162 
163 bool TYRoute::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
164 {
165  if (!TYAcousticLine::deepCopy(pOther, copyId))
166  {
167  return false;
168  }
169 
170  const TYRoute* pOtherRoute = dynamic_cast<const TYRoute*>(pOther);
171  assert(pOtherRoute && "Invalid cast to TYRoute*");
172 
173  road_traffic = pOtherRoute->road_traffic;
174  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
175  {
176  traffic_regimes[i].deepCopy(&pOtherRoute->traffic_regimes[i], copyId);
177  }
179 
180  return true;
181 }
182 
183 std::string TYRoute::toString() const
184 {
185  return "TYRoute";
186 }
187 
189 {
190  DOM_Element domNewElem = TYAcousticLine::toXML(domElement);
191  // NB DOM_Element is actually a QDomElement
192 
193  // Serialise the RoadTraffic attribute
194  domNewElem.setAttribute("surfaceType", road_traffic.surfaceType);
195  domNewElem.setAttribute("ramp", road_traffic.ramp);
196  domNewElem.setAttribute("surfaceAge", road_traffic.surfaceAge);
197 
198  // Serialise each of the regimes
199  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
200  {
201  traffic_regimes[i].toXML(domNewElem);
202  }
203 
204  return domNewElem;
205 }
206 
208 {
209  // NB DOM_Element is actually a QDomElement
210  TYAcousticLine::fromXML(domElement);
211 
212  QString s;
213  bool ok = false;
214 
215  // Deserialise the RoadTraffic attribute surfaceType
216  s = domElement.attribute("surfaceType", QString());
217  if (s.isEmpty()) // Attribute not found
218  {
219  OMessageManager::get()->error("Can not read the road `surfaceType` attribute for element %s.",
220  str_qt2c(getStringID()));
221  return 0;
222  }
223  unsigned surfType = s.toUInt(&ok);
224  if (!ok)
225  {
226  OMessageManager::get()->error("Integer expected for attribute `surfaceType` on element %s, not %s",
228  return 0;
229  }
230  road_traffic.surfaceType = static_cast<RoadSurfaceType>(surfType);
231 
232  // Deserialise the RoadTraffic attribute ramp
233  s = domElement.attribute("ramp", QString());
234  if (s.isEmpty()) // Attribute not found
235  {
236  OMessageManager::get()->error("Can not read the road `ramp` attribute for element %s.",
237  str_qt2c(getStringID()));
238  return 0;
239  }
240  double tmp_d = s.toDouble(&ok);
241  if (!ok)
242  {
244  "Floating point number expected for attribute `ramp` on element %s, not %s",
246  return 0;
247  }
248  road_traffic.ramp = tmp_d;
249 
250  // Deserialise the RoadTraffic attribute surfaceAge
251  s = domElement.attribute("surfaceAge", QString());
252  if (s.isEmpty()) // Attribute not found
253  {
254  OMessageManager::get()->error("Can not read the road `surfaceAge` attribute for element %s.",
255  str_qt2c(getStringID()));
256  return 0;
257  }
258  tmp_d = s.toUInt(&ok);
259  if (!ok)
260  {
261  OMessageManager::get()->error("Integer expected for attribute `surfaceAge` on element %s, not %s",
263  return 0;
264  }
265  road_traffic.surfaceAge = tmp_d;
266 
267  // Deserialise the traffic for the regimes
268  QDomNodeList children = domElement.elementsByTagName("Trafic");
269  if (children.size() != NB_TRAFFIC_REGIMES)
270  {
271  OMessageManager::get()->error("Loading TYRoute element %s, "
272  "%u TYTrafic child elements were found but %u were expected",
273  str_qt2c(getStringID()), children.size(), NB_TRAFFIC_REGIMES);
274  return 0;
275  }
276 
277  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
278  {
279  QDomElement elem = children.item(i).toElement();
280  if (elem.isNull())
281  {
282  debugXml(children.item(i));
283  return 0;
284  }
285  traffic_regimes[i].fromXML(elem);
286  }
287 
288  // TODO : handle ascendant compatibility (out-of-scope for now)
289  // Cf. https://extranet.logilab.fr/ticket/1521703
290  return 1;
291 }
292 
294 {
295  // This updates the road_traffic to point to the array of RoadTrafficComponents
296  // corresponding to the selected regime.
298 
300 
301  // Handle a simplified model of traffic wrt to the declivity
302  // Cf. https://extranet.logilab.fr/ticket/1513437
303 
304  // Half the global traffic to get the flow for only one roadway
305  TrafficHalfer halves_the_traffic(*this);
306 
307  double* tab = nullptr;
308  tab = NMPB08_Lwm(&road_traffic, Spectrum_3oct_lin);
309  OSpectre s_one_way(tab, 18, 8);
310  s_one_way.setType(SPECTRE_TYPE_LW);
311  // NB: This initialise `s_one_way` with the 18 values provided in `tab`
312  // Because the 1st frequency provided by NMPB08 is 100Hz whereas 100Hz
313  // is the 9th frequency in Code_TYMPAN representation the offset is 8
314  // Both spectrum uses 3rd octave as frequency steps and the common
315  // higest frequency is 5000Hz.
316 
317  // Coinsider the opposite road_way which differ by opposite declivity
318  road_traffic.ramp *= -1.0;
319  tab = NMPB08_Lwm(&road_traffic, Spectrum_3oct_lin);
320  OSpectre s_other_way(tab, 18, 8);
321  s_other_way.setType(SPECTRE_TYPE_LW);
322 
323  // NB : The original traffic is restored on destroyuing the halves_the_traffic helper
324  return s_one_way.sumdB(s_other_way);
325 }
326 
328 {
329  // TODO cf https://extranet.logilab.fr/ticket/1513440
330  // Iter on the _listSrcPonct (sources) instead of _tabPoint (2d geometry)
331 
332  size_t nbPoint = _tabPoint.size();
333  if (nbPoint < 2) // Declivity is undefined
334  {
335  return undefined_declivity;
336  }
337  double* XTemp = new double[nbPoint]; // sert a ramener les points repartis sur une surface sur une droite
338  double X = 0.0;
339  double Z = 0.0;
340  // double XZ = 0.0;
341 
342  double moy_x = 0.0;
343  double moy_z = _tabPoint[0]._z;
344  double sommeX = 0.0;
345  double sommeXZ = 0.0;
346 
347  size_t i = 0;
348  // 1. Calcul de la moyenne des x et des z et calcul des pseudo x
349  for (i = 1; i < nbPoint; i++)
350  {
351  XTemp[i] = _tabPoint[i].distFrom(_tabPoint[i - 1]);
352  moy_x = moy_x + XTemp[i];
353  moy_z = moy_z + _tabPoint[i]._z;
354  }
355 
356  moy_x = moy_x / nbPoint;
357  moy_z = moy_z / nbPoint;
358 
359  // 2. Calcul du carre des ecarts a la moyenne leurs sommes et produits
360  for (i = 0; i < nbPoint; i++)
361  {
362  X = (XTemp[i] - moy_x) * (XTemp[i] - moy_x);
363  Z = (_tabPoint[i]._z - moy_z) * (_tabPoint[i]._z - moy_z);
364 
365  sommeX = sommeX + X;
366  sommeXZ = sommeXZ + sqrt(X * Z);
367  }
368 
369  // destruction des tableaux
370  delete[] XTemp;
371 
372  return sommeXZ / sommeX;
373 }
374 /*
375 void TYRoute::setTraficJour(const LPTYTrafic pTrafic)
376 {
377  _pTraficJour = pTrafic;
378  _pTraficJour->setParent(this);
379  TYSpectre aTYSpectre=computeSpectre(_pTraficJour);
380  _pSrcLineic->setRegime(aTYSpectre, 0); // calcul du spectre associe a ce regime
381 
382  this->distriSrcs(); //Distribution des sources sur la TYSourceLineic
383 }
384 
385 void TYRoute::setTraficNuit(const LPTYTrafic pTrafic)
386 {
387  _pTraficNuit = pTrafic;
388  _pTraficNuit->setParent(this);
389  TYSpectre aTYSpectre=computeSpectre(_pTraficardNuit);
390  _pSrcLineic->setRegime(aTYSpectre, 1); // calcul du spectre associe a ce regime
391 
392  this->distriSrcs(); //Distribution des sources sur la TYSourceLineic
393 }
394 */
395 
396 bool TYRoute::updateAcoustic(const bool& force) // force = false
397 {
399  {
400  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
401  {
402  // Calcul des spectres correspondant aux regimes jours et nuit
403  TYSpectre spectrum = computeSpectre(static_cast<enum TrafficRegimes>(i));
404  spectrum.setType(SPECTRE_TYPE_LW);
405  // Affectation des regimes
406  _tabRegimes[i].setSpectre(spectrum);
407  }
408  }
409 
410  // NB : The sources are expected to have already been created during
411  // before calling updateAltitudes, called before thsi method
412  // So we do not want to call distriSrcs();
413 
414  // Affectation de la puissance aux sources
415  setSrcsLw();
416 
417  return true;
418 }
419 
420 bool TYRoute::updateAltitudes(const TYAltimetrie& alti, LPTYRouteGeoNode pGeoNode, OMatrix globalMatrix)
421 {
422  assert(pGeoNode->getElement() == static_cast<TYElement*>(this) &&
423  "Inconsistent arguments : the geoNode passed must point on `this` !");
424 
425  // Transform representing this element pose relative to the world
426  const OMatrix& matrix = globalMatrix * pGeoNode->getMatrix();
427  OMatrix matrixinv = matrix.getInvert();
428 
429  // Road heigth relative to the ground
430  double hauteur = pGeoNode->getHauteur();
431 
432  // Positionning of the road defining points at the specified
433  // height above the ground (NB this created tunnels and bridges)
434  for (size_t i = 0; i < this->getTabPoint().size(); i++)
435  {
436  // Transform to site frame pose
437  OPoint3D pt = matrix * this->getTabPoint()[i];
438 
439  // Init the point at ground altitude
440  alti.updateAltitude(pt);
441  // NB updateAltitude already report possibel problems
442 
443  // Add the heigth relative to the ground
444  pt._z += hauteur;
445 
446  // Transform back from site frame pose
447  this->getTabPoint()[i] = matrixinv * pt;
448  }
449 
450  // We create sources along the acoustic line...
451  // and then project them on the altimetry and add the required offset
452  // Note this is distriSrcs(const TYAltimetrie&) NOT base class distriSrcs()
453  distriSrcs(alti, pGeoNode, globalMatrix);
454 
456 
457  this->setIsGeometryModified(false);
458  return true;
459 }
460 
461 void TYRoute::distriSrcs(const TYAltimetrie& alti, LPTYRouteGeoNode pGeoNode, OMatrix globalMatrix)
462 {
463  assert(pGeoNode->getElement() == static_cast<TYElement*>(this) &&
464  "Inconsistent arguments : the geoNode passed must point on `this` !");
465 
467 
468  // Transform representing this element pose relative to the world
469  const OMatrix& matrix = globalMatrix * pGeoNode->getMatrix();
470  OMatrix matrixinv = matrix.getInvert();
471  // Road heigth relative to the ground
472  double hauteur = pGeoNode->getHauteur();
473 
474  for (unsigned int i = 0; i < _pSrcLineic->getNbSrcs(); i++)
475  {
477 
478  // Transform to site frame pose
479  OPoint3D pt = matrix * (*pSrc->getPos());
480  alti.updateAltitude(pt);
481  // TODO Check this comment : NB updateAltitude already report possible problems
482  // Add the heigth relative to the ground plus height offset
483  pt._z += hauteur + _offSet;
484 
485  // Transform back from site frame pose
486  *pSrc->getPos() = matrixinv * pt;
487  }
488 }
489 
490 RoadTrafficComponent& TYRoute::accessRoadTrafficComponent(enum TrafficRegimes regime,
491  enum TYTrafic::VehicleTypes vehic_type)
492 {
493  return traffic_regimes[regime].arr[vehic_type];
494 }
495 
496 const RoadTrafficComponent&
498  enum TYTrafic::VehicleTypes vehic_type) const
499 {
500  return traffic_regimes[regime].arr[vehic_type];
501 }
502 
504 {
505  road_traffic.nbComponents = TYTrafic::NB_VEHICLE_TYPES; // LV & HGV
506  road_traffic.traffic = &traffic_regimes[regime].arr[0];
507 }
508 
510 {
511  if (!computed_declivity)
512  {
513  return;
514  }
515 
516  double penteMoy = calculPenteMoyenne();
517 
518  if (is_valid_declivity(penteMoy))
519  {
520  road_traffic.ramp = penteMoy; // TODO assert units
521  }
522  else
523  {
524  OMessageManager::get()->error("Can not compute declivity for road %s.", str_qt2c(getStringID()));
525  }
526 }
527 
528 // table C1
530  // Link motorways
531  {// Long distance function
532  {7000, 1300, 16},
533  // Regional roads
534  {7000, 500, 6}},
535  // Intercity roads
536  {// Long distance function
537  {2500, 300, 8},
538  // Regional roads
539  {2500, 250, 5}}};
540 // table C1
542  // Link motorways
543  {// Long distance function
544  {70000, 13500, 30},
545  // Regional roads
546  {93000, 14000, 34}},
547  // Intercity roads
548  {// Long distance function
549  {22500, 5000, 34},
550  // Regional roads
551  {22000, 2500, 17}}};
552 // table C2
554  // Link motorways
555  {// Long distance function
556  {20, 20, 39},
557  // Regional roads
558  {17, 28, 50}},
559  // Intercity roads
560  {// Long distance function
561  {17, 27, 51},
562  // Regional roads
563  {16, 34, 73}}};
564 // table C2
566  // Link motorways
567  {// Long distance function
568  {17, 19, 82},
569  // Regional roads
570  {17, 18, 100}},
571  // Intercity roads
572  {// Long distance function
573  {17, 19, 110},
574  // Regional roads
575  {17, 19, 120}}};
576 
577 static bool inline is_in(double val, double min, double max)
578 {
579  return min <= val && val <= max;
580 }
581 
582 bool TYRoute::note77_check_validity(double aadt_hgv, double aadt_lv, TYRoute::RoadType road_type,
583  TYRoute::RoadFunction road_function, QString* out_msg)
584 {
585  // TODO i18n when i18n will be properly handled by Qt
586 
587  double min = NAN, max = NAN;
588  if (out_msg)
589  {
590  out_msg->clear();
591  }
592 
593  const double aadt_total = aadt_lv + aadt_hgv;
594  // TODO Use propoer loggin to report validity violations
595  const double hgv_percent = aadt_hgv / aadt_total * 100;
596 
597  min = note77_lower_bounds[road_type][road_function][0];
598  max = note77_upper_bounds[road_type][road_function][0];
599  bool ok_total = is_in(aadt_total, min, max);
600  if (out_msg && !ok_total)
601  out_msg->append(QString::fromUtf8("TMJA total (%1 v/j) invalide : "
602  "doit être entre %2 et %3 v/j.\n")
603  .arg(aadt_total)
604  .arg(min)
605  .arg(max));
606 
607  min = note77_lower_bounds[road_type][road_function][1];
608  max = note77_upper_bounds[road_type][road_function][1];
609  bool ok_hgv = is_in(aadt_hgv, min, max);
610  if (out_msg && !ok_hgv)
611  out_msg->append(QString::fromUtf8("TMJA poids-lourds (%1 v/j) invalide : "
612  "doit être entre %2 et %3 v/j.\n")
613  .arg(aadt_hgv)
614  .arg(min)
615  .arg(max));
616 
617  min = note77_lower_bounds[road_type][road_function][2];
618  max = note77_upper_bounds[road_type][road_function][2];
619  bool ok_percent = is_in(hgv_percent, min, max);
620  if (out_msg && !ok_percent)
621  out_msg->append(QString::fromUtf8("Proportion de poids-lourds (%1%) invalide : "
622  "doit être entre %2% et %3%.\n")
623  .arg(hgv_percent)
624  .arg(min)
625  .arg(max));
626 
627  return ok_total && ok_hgv && ok_percent;
628 }
629 
630 bool TYRoute::setFromAADT(double aadt_hgv, double aadt_lv, TYRoute::RoadType road_type,
631  TYRoute::RoadFunction road_function, QString* out_msg)
632 {
633  if (!note77_check_validity(aadt_hgv, aadt_lv, road_type, road_function, out_msg))
634  {
635  return false;
636  }
637 
638  for (unsigned i = 0; i < NB_TRAFFIC_REGIMES; ++i)
639  {
640  enum TrafficRegimes regime = static_cast<TrafficRegimes>(i);
641  RoadTrafficComponent& traffic_lv = accessRoadTrafficComponent(regime, TYTrafic::LV);
642  traffic_lv.trafficFlow = // Compute hourly traffic
643  aadt_lv / note77_hourly_LV_coeff[road_type][road_function][regime];
644  RoadTrafficComponent& traffic_hgv = accessRoadTrafficComponent(regime, TYTrafic::HGV);
645  traffic_hgv.trafficFlow = // Compute hourly traffic
646  aadt_hgv / note77_hourly_HGV_coeff[road_type][road_function][regime];
647  }
648  return true;
649 }
650 
652 {
653  for (unsigned j = 0; j < NB_TRAFFIC_REGIMES; ++j)
654  {
655  enum TrafficRegimes regime = static_cast<TrafficRegimes>(j);
656  for (unsigned i = 0; i < TYTrafic::NB_VEHICLE_TYPES; ++i)
657  {
658  enum TYTrafic::VehicleTypes vehicle_type = static_cast<TYTrafic::VehicleTypes>(i);
659  road.accessRoadTrafficComponent(regime, vehicle_type).trafficFlow /= 2.0;
660  }
661  }
662 }
663 
665 {
666  // Restore the traffic
667  for (unsigned j = 0; j < NB_TRAFFIC_REGIMES; ++j)
668  {
669  enum TrafficRegimes regime = static_cast<TrafficRegimes>(j);
670  for (unsigned i = 0; i < TYTrafic::NB_VEHICLE_TYPES; ++i)
671  {
672  enum TYTrafic::VehicleTypes vehicle_type = static_cast<TYTrafic::VehicleTypes>(i);
673  road.accessRoadTrafficComponent(regime, vehicle_type).trafficFlow *= 2.0;
674  }
675  }
676  road.road_traffic.ramp = std::fabs(road.road_traffic.ramp);
677 }
678 
679 const RoadTraffic& TYRoute::getNMBP08RoadTraffic(enum TrafficRegimes regime)
680 {
682  return road_traffic;
683 }
684 
685 void TYRoute::setSurfaceType(RoadSurfaceType type)
686 {
687  road_traffic.surfaceType = type;
688 }
689 
690 void TYRoute::setSurfaceAge(double age)
691 {
692  road_traffic.surfaceAge = age;
693 }
694 
695 void TYRoute::setRamp(double ramp)
696 {
697  road_traffic.ramp = ramp;
698 }
699 
701  double flow, double speed, RoadFlowType type)
702 {
703  RoadTrafficComponent& rtc = accessRoadTrafficComponent(regime, vehic_type);
704  rtc.trafficFlow = flow; // vehicle / hour
705  rtc.trafficSpeed = speed; // km / hour
706  rtc.flowType = type;
707 }
NxReal s
Definition: NxVec3.cpp:317
QDomElement DOM_Element
Definition: QT2DOM.h:30
#define min(a, b)
#define debugXml(expr)
Definition: TYElement.h:1036
const char * str_qt2c(const QString &qstr)
Definition: TYElement.h:1012
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:52
Representation graphique d'une route (fichier header)
outil IHM pour une route (fichier header)
TY_EXT_GRAPHIC_INST(TYRoute)
TY_EXTENSION_INST(TYRoute)
Definition: color.h:31
float b
Definition: color.h:33
float r
Definition: color.h:33
float g
Definition: color.h:33
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
The 4x4 matrix class.
Definition: 3d.h:625
OMatrix getInvert(int *ok=0) const
Return the inverse matrix of this matrix.
Definition: 3d.cpp:813
virtual void error(const char *message,...)
Definition: logging.cpp:127
static OMessageManager * get()
Definition: logging.cpp:108
The 3D point class.
Definition: 3d.h:487
virtual const char * getClassName() const
Definition: TYElement.h:249
void setType(TYSpectreType type)
Set the spectrum type.
Definition: spectre.h:152
OSpectreAbstract & sumdB(const OSpectreAbstract &spectre) const
Energetic sum of two spectrums.
Definition: spectre.cpp:171
TYTabPoint & getTabPoint()
virtual int addRegime(TYRegime regime)
TYTabRegimes _tabRegimes
Tableau des regimes.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual void computeSpectre()
virtual int fromXML(DOM_Element domElement)
LPTYSourceLineic _pSrcLineic
Source Lineique.
virtual bool setSrcsLw()
virtual TYRegime buildRegime()
double _largeur
Largeur.
bool _regimeChangeAble
Indique si on peut ajouter un regime a un element (cas des routes)
TYAcousticLine & operator=(const TYAcousticLine &other)
Operateur =.
int _typeDistribution
Indique le type de distribution a utiliser. pour l'etat courant.
virtual void distriSrcs()
virtual DOM_Element toXML(DOM_Element &domElement)
TYTabPoint _tabPoint
Tableau des points.
Assigne une altitude a chaque point de l'espace.
Definition: TYAltimetrie.h:35
bool updateAltitude(OPoint3D &pt) const
Modifie l'altitude d'un point donn�. Si le point est hors de la zone dans laquelle l'altim�trie e...
virtual void setColor(const OColor &color)
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
void setParent(TYElement *pParent)
Definition: TYElement.h:692
QString getStringID() const
Definition: TYElement.h:653
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
This helper class halves and restore the traffic flow of the road.
Definition: TYRoute.h:350
TrafficHalfer(TYRoute &road)
Definition: TYRoute.cpp:651
virtual std::string toString() const
Definition: TYRoute.cpp:183
bool computed_declivity
If true, the mean declivity of the read is computed from the altimetry.
Definition: TYRoute.h:269
bool operator==(const TYRoute &other) const
Operateur ==.
Definition: TYRoute.cpp:123
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYRoute.cpp:163
RoadTraffic road_traffic
Definition: TYRoute.h:332
RoadTrafficComponent & accessRoadTrafficComponent(enum TrafficRegimes regime, enum TYTrafic::VehicleTypes vehic_type)
Definition: TYRoute.cpp:490
virtual void distriSrcs()
Definition: TYRoute.h:278
TYRoute()
Definition: TYRoute.cpp:41
static const note77_tables note77_hourly_HGV_coeff
Definition: TYRoute.h:362
TrafficRegimes
Definition: TYRoute.h:56
@ Day
Definition: TYRoute.h:57
@ NB_TRAFFIC_REGIMES
Definition: TYRoute.h:60
static const note77_tables note77_upper_bounds
Definition: TYRoute.h:361
void updateComputedDeclivity()
update the mean declivity from the current source distribution.
Definition: TYRoute.cpp:509
double note77_tables[2][2][3]
Definition: TYRoute.h:359
double _offSet
Definition: TYRoute.h:338
static bool is_valid_declivity(double decli)
Check that the declivity is valid, i.e. is not undefined_declivity.
Definition: TYRoute.cpp:35
double ramp() const
Getter for the ramp in percent ( > 0 if rise, < 0 if down)
Definition: TYRoute.h:233
void setSurfaceAge(double age)
Setter for the surface age.
Definition: TYRoute.cpp:690
static const double undefined_declivity
Definition: TYRoute.h:53
virtual bool updateAltitudes(const TYAltimetrie &alti, LPTYRouteGeoNode pGeoNode, OMatrix globalMatrix)
Required the road to update its altitude after altimetry changed.
Definition: TYRoute.cpp:420
bool setFromAADT(double aadt_hgv, double aadt_lv, RoadType road_type, RoadFunction road_function, QString *out_msg=NULL)
Apply Note77 from Setra to estimate trafic from AADT and road kind.
Definition: TYRoute.cpp:630
RoadType
Definition: TYRoute.h:152
TYRoute & operator=(const TYRoute &other)
Operateur =.
Definition: TYRoute.cpp:107
const RoadTrafficComponent & getNMPB08RoadTrafficComponent(enum TrafficRegimes regime, enum TYTrafic::VehicleTypes vehic_type) const
Definition: TYRoute.cpp:497
void setSurfaceType(RoadSurfaceType type)
Setter for the road surface type.
Definition: TYRoute.cpp:685
virtual ~TYRoute()
Definition: TYRoute.cpp:105
void setRoadTrafficComponent(enum TrafficRegimes regime, enum TYTrafic::VehicleTypes vehic_type, double flow, double speed, RoadFlowType type=FlowType_CONST)
Set the traffic parameter for a given regime and type of vehicles.
Definition: TYRoute.cpp:700
void setRamp(double ramp)
Setter for the ramp in percent ( > 0 if rise, < 0 if down)
Definition: TYRoute.cpp:695
static bool note77_check_validity(double aadt_hgv, double aadt_lv, RoadType road_type, RoadFunction road_function, QString *out_msg=NULL)
Check the validity domain of AADT for Note 77.
Definition: TYRoute.cpp:582
TYTrafic traffic_regimes[NB_TRAFFIC_REGIMES]
Definition: TYRoute.h:333
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYRoute.cpp:188
static const note77_tables note77_hourly_LV_coeff
Definition: TYRoute.h:363
static const note77_tables note77_lower_bounds
Definition: TYRoute.h:360
virtual bool updateAcoustic(const bool &force=false)
Definition: TYRoute.cpp:396
RoadFunction
Definition: TYRoute.h:157
void setRoadTrafficArrayForRegime(enum TrafficRegimes regime)
internally set the RoadTraffic's array of RoadTrafficComponents according to the given regime.
Definition: TYRoute.cpp:503
bool operator!=(const TYRoute &other) const
Operateur !=.
Definition: TYRoute.cpp:158
double calculPenteMoyenne()
Calcul de la pente moyenne de la route.
Definition: TYRoute.cpp:327
virtual int fromXML(DOM_Element domElement)
Definition: TYRoute.cpp:207
const RoadTraffic & getNMBP08RoadTraffic(enum TrafficRegimes regime)
Definition: TYRoute.cpp:679
LPTYSourcePonctuelle getSrc(int index)
size_t getNbSrcs() const
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYTrafic.cpp:95
VehicleTypes
Definition: TYTrafic.h:38
@ NB_VEHICLE_TYPES
Definition: TYTrafic.h:41
RoadTrafficComponent arr[NB_VEHICLE_TYPES]
Definition: TYTrafic.h:125
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYTrafic.cpp:114
virtual int fromXML(DOM_Element domElement)
Definition: TYTrafic.cpp:133
@ SPECTRE_TYPE_LW
Definition: spectre.h:30