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 /****************************************************************************/
15 // Helper methods for HBEFA3-based emission computation
16 /****************************************************************************/
17 #ifndef HelpersHBEFA3_h
18 #define HelpersHBEFA3_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <limits>
28 #include <cmath>
29 #include <utils/common/StdDefs.h>
30 #include <utils/geom/GeomHelper.h>
32 #include "PollutantsInterface.h"
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
47 public:
48 
49 
50  static const int HBEFA3_BASE = 1 << 16;
51 
52 
55  HelpersHBEFA3();
56 
57 
66  SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string& vClass, const std::string& fuel, const std::string& eClass, const double weight) const;
67 
72  std::string getAmitranVehicleClass(const SUMOEmissionClass c) const;
73 
78  std::string getFuel(const SUMOEmissionClass c) const;
79 
84  int getEuroClass(const SUMOEmissionClass c) const;
85 
86 
100  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 {
101  UNUSED_PARAMETER(slope);
102  UNUSED_PARAMETER(param);
103  if (c == HBEFA3_BASE || a < 0. || e == PollutantsInterface::ELEC) {
104  return 0.;
105  }
106  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - HBEFA3_BASE - 1;
107  double scale = 3.6;
108  if (e == PollutantsInterface::FUEL) {
109  if (getFuel(c) == "Diesel") {
110  scale *= 836.;
111  } else {
112  scale *= 742.;
113  }
114  }
115  const double* f = myFunctionParameter[index][e];
116  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.);
117  }
118 
119 
120 private:
122  static double myFunctionParameter[45][6][6];
123 
124 };
125 
126 
127 #endif
128 
129 /****************************************************************************/
130 
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:31
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:543
PollutantsInterface::EmissionType
EmissionType
Enumerating all emission types, including fuel.
Definition: PollutantsInterface.h:55
PollutantsInterface::FUEL
@ FUEL
Definition: PollutantsInterface.h:55
HelpersHBEFA3::myFunctionParameter
static double myFunctionParameter[45][6][6]
The function parameter.
Definition: HelpersHBEFA3.h:122
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:473
HelpersHBEFA3::HBEFA3_BASE
static const int HBEFA3_BASE
Definition: HelpersHBEFA3.h:50
PollutantsInterface::Helper
abstract superclass for the model helpers
Definition: PollutantsInterface.h:102
SUMOEmissionClass
int SUMOEmissionClass
Definition: SUMOVehicleClass.h:231
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:516
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
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:532
PollutantsInterface.h
HelpersHBEFA3
Helper methods for HBEFA3-based emission computation.
Definition: HelpersHBEFA3.h:46
SUMOVehicleClass.h
HelpersHBEFA3::HelpersHBEFA3
HelpersHBEFA3()
Constructor (initializes myEmissionClassStrings)
Definition: HelpersHBEFA3.cpp:447
PollutantsInterface::ELEC
@ ELEC
Definition: PollutantsInterface.h:55
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:100
config.h
PollutantsInterface
Helper methods for PHEMlight-based emission computation.
Definition: PollutantsInterface.h:51
GeomHelper.h
StdDefs.h