Eclipse 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-2019 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 
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
HelpersHBEFA3::getEuroClass
int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
Definition: HelpersHBEFA3.cpp:544
PollutantsInterface::EmissionType
EmissionType
Enumerating all emission types, including fuel.
Definition: PollutantsInterface.h:56
PollutantsInterface::FUEL
Definition: PollutantsInterface.h:56
HelpersHBEFA3::myFunctionParameter
static double myFunctionParameter[45][6][6]
The function parameter.
Definition: HelpersHBEFA3.h:123
HelpersHBEFA3::getClass
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.
Definition: HelpersHBEFA3.cpp:474
HelpersHBEFA3::HBEFA3_BASE
static const int HBEFA3_BASE
Definition: HelpersHBEFA3.h:51
PollutantsInterface::Helper
abstract superclass for the model helpers
Definition: PollutantsInterface.h:103
SUMOEmissionClass
int SUMOEmissionClass
Definition: SUMOVehicleClass.h:232
HelpersHBEFA3::getAmitranVehicleClass
std::string getAmitranVehicleClass(const SUMOEmissionClass c) const
Returns the vehicle class described by this emission class as described in the Amitran interface (Pas...
Definition: HelpersHBEFA3.cpp:517
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
HelpersHBEFA3::getFuel
std::string getFuel(const SUMOEmissionClass c) const
Returns the fuel type described by this emission class as described in the Amitran interface (Gasolin...
Definition: HelpersHBEFA3.cpp:533
PollutantsInterface.h
HelpersHBEFA3
Helper methods for HBEFA3-based emission computation.
Definition: HelpersHBEFA3.h:47
SUMOVehicleClass.h
HelpersHBEFA3::HelpersHBEFA3
HelpersHBEFA3()
Constructor (initializes myEmissionClassStrings)
Definition: HelpersHBEFA3.cpp:448
PollutantsInterface::ELEC
Definition: PollutantsInterface.h:56
HelpersHBEFA3::compute
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.
Definition: HelpersHBEFA3.h:101
config.h
PollutantsInterface
Helper methods for PHEMlight-based emission computation.
Definition: PollutantsInterface.h:52
GeomHelper.h
StdDefs.h