SUMO - Simulation of Urban MObility
HelpersHBEFA3.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // Helper methods for HBEFA3-based emission computation
19 /****************************************************************************/
20 #ifndef HelpersHBEFA3_h
21 #define HelpersHBEFA3_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <limits>
35 #include <cmath>
36 #include <utils/common/StdDefs.h>
37 #include <utils/geom/GeomHelper.h>
39 #include "PollutantsInterface.h"
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
54 public:
55 
56 
57  static const int HBEFA3_BASE = 1 << 16;
58 
59 
62  HelpersHBEFA3();
63 
64 
73  SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string& vClass, const std::string& fuel, const std::string& eClass, const double weight) const;
74 
79  std::string getAmitranVehicleClass(const SUMOEmissionClass c) const;
80 
85  std::string getFuel(const SUMOEmissionClass c) const;
86 
91  int getEuroClass(const SUMOEmissionClass c) const;
92 
93 
107  inline double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map<int, double>* param) const {
108  UNUSED_PARAMETER(slope);
109  UNUSED_PARAMETER(param);
110  if (c == HBEFA3_BASE || a < 0. || e == PollutantsInterface::ELEC) {
111  return 0.;
112  }
113  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - HBEFA3_BASE - 1;
114  double scale = 3.6;
115  if (e == PollutantsInterface::FUEL) {
116  if (getFuel(c) == "Diesel") {
117  scale *= 836.;
118  } else {
119  scale *= 742.;
120  }
121  }
122  const double* f = myFunctionParameter[index][e];
123  return (double) MAX2((f[0] + f[1] * a * v + f[2] * a * a * v + f[3] * v + f[4] * v * v + f[5] * v * v * v) / scale, 0.);
124  }
125 
126 
127 private:
129  static double myFunctionParameter[45][6][6];
130 
131 };
132 
133 
134 #endif
135 
136 /****************************************************************************/
137 
double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map< int, double > *param) const
Computes the emitted pollutant amount using the given speed and acceleration.
static const int HBEFA3_BASE
Definition: HelpersHBEFA3.h:57
EmissionType
Enumerating all emission types, including fuel.
T MAX2(T a, T b)
Definition: StdDefs.h:73
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
abstract superclass for the model helpers
int SUMOEmissionClass
int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
std::string getAmitranVehicleClass(const SUMOEmissionClass c) const
Returns the vehicle class described by this emission class as described in the Amitran interface (Pas...
Helper methods for HBEFA3-based emission computation.
Definition: HelpersHBEFA3.h:53
SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string &vClass, const std::string &fuel, const std::string &eClass, const double weight) const
Returns the emission class described by the given parameters.
std::string getFuel(const SUMOEmissionClass c) const
Returns the fuel type described by this emission class as described in the Amitran interface (Gasolin...
static double myFunctionParameter[45][6][6]
The function parameter.
HelpersHBEFA3()
Constructor (initializes myEmissionClassStrings)
Helper methods for PHEMlight-based emission computation.