SUMO - Simulation of Urban MObility
HelpersHBEFA3.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Helper methods for HBEFA3-based emission computation
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef HelpersHBEFA3_h
22 #define HelpersHBEFA3_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <limits>
36 #include <cmath>
37 #include <utils/common/StdDefs.h>
38 #include <utils/geom/GeomHelper.h>
40 #include "PollutantsInterface.h"
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
55 public:
56 
57 
58  static const int HBEFA3_BASE = 1 << 16;
59 
60 
63  HelpersHBEFA3();
64 
65 
74  SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string& vClass, const std::string& fuel, const std::string& eClass, const double weight) const;
75 
80  std::string getAmitranVehicleClass(const SUMOEmissionClass c) const;
81 
86  std::string getFuel(const SUMOEmissionClass c) const;
87 
92  int getEuroClass(const SUMOEmissionClass c) const;
93 
94 
108  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 {
109  UNUSED_PARAMETER(slope);
110  UNUSED_PARAMETER(param);
111  if (c == HBEFA3_BASE || a < 0. || e == PollutantsInterface::ELEC) {
112  return 0.;
113  }
114  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - HBEFA3_BASE - 1;
115  double scale = 3.6;
116  if (e == PollutantsInterface::FUEL) {
117  if (getFuel(c) == "Diesel") {
118  scale *= 836.;
119  } else {
120  scale *= 742.;
121  }
122  }
123  const double* f = myFunctionParameter[index][e];
124  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.);
125  }
126 
127 
128 private:
130  static double myFunctionParameter[45][6][6];
131 
132 };
133 
134 
135 #endif
136 
137 /****************************************************************************/
138 
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:58
EmissionType
Enumerating all emission types, including fuel.
T MAX2(T a, T b)
Definition: StdDefs.h:70
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
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:54
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.