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-2016 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 SUMOReal compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope) const {
109  UNUSED_PARAMETER(slope);
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  SUMOReal 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 (SUMOReal) 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 
SUMOReal compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope) const
Computes the emitted pollutant amount using the given speed and acceleration.
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:58
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:75
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
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:54
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.
#define SUMOReal
Definition: config.h:213
HelpersHBEFA3()
Constructor (initializes myEmissionClassStrings)
Helper methods for PHEMlight-based emission computation.