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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Helper methods for HBEFA3-based emission computation
17 /****************************************************************************/
18 #ifndef HelpersHBEFA3_h
19 #define HelpersHBEFA3_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
28 #include <limits>
29 #include <cmath>
30 #include <utils/common/StdDefs.h>
31 #include <utils/geom/GeomHelper.h>
33 #include "PollutantsInterface.h"
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
48 public:
49 
50 
51  static const int HBEFA3_BASE = 1 << 16;
52 
53 
56  HelpersHBEFA3();
57 
58 
67  SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string& vClass, const std::string& fuel, const std::string& eClass, const double weight) const;
68 
73  std::string getAmitranVehicleClass(const SUMOEmissionClass c) const;
74 
79  std::string getFuel(const SUMOEmissionClass c) const;
80 
85  int getEuroClass(const SUMOEmissionClass c) const;
86 
87 
101  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 {
102  UNUSED_PARAMETER(slope);
103  UNUSED_PARAMETER(param);
104  if (c == HBEFA3_BASE || a < 0. || e == PollutantsInterface::ELEC) {
105  return 0.;
106  }
107  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - HBEFA3_BASE - 1;
108  double scale = 3.6;
109  if (e == PollutantsInterface::FUEL) {
110  if (getFuel(c) == "Diesel") {
111  scale *= 836.;
112  } else {
113  scale *= 742.;
114  }
115  }
116  const double* f = myFunctionParameter[index][e];
117  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.);
118  }
119 
120 
121 private:
123  static double myFunctionParameter[45][6][6];
124 
125 };
126 
127 
128 #endif
129 
130 /****************************************************************************/
131 
int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
static const int HBEFA3_BASE
Definition: HelpersHBEFA3.h:51
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.
EmissionType
Enumerating all emission types, including fuel.
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.
T MAX2(T a, T b)
Definition: StdDefs.h:76
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:33
std::string getFuel(const SUMOEmissionClass c) const
Returns the fuel type described by this emission class as described in the Amitran interface (Gasolin...
abstract superclass for the model helpers
int SUMOEmissionClass
Helper methods for HBEFA3-based emission computation.
Definition: HelpersHBEFA3.h:47
std::string getAmitranVehicleClass(const SUMOEmissionClass c) const
Returns the vehicle class described by this emission class as described in the Amitran interface (Pas...
static double myFunctionParameter[45][6][6]
The function parameter.
HelpersHBEFA3()
Constructor (initializes myEmissionClassStrings)
Helper methods for PHEMlight-based emission computation.