SUMO - Simulation of Urban MObility
HelpersHBEFA.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // Helper methods for HBEFA-based emission computation
19 /****************************************************************************/
20 #ifndef HelpersHBEFA_h
21 #define HelpersHBEFA_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <limits>
35 #include <cmath>
36 #include <utils/common/StdDefs.h>
37 #include <utils/geom/GeomHelper.h>
39 #include "PollutantsInterface.h"
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
54 public:
57  HelpersHBEFA();
58 
59 
73  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 {
74  UNUSED_PARAMETER(slope);
75  UNUSED_PARAMETER(param);
77  return 0.;
78  }
79  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - 1;
80  const double kmh = v * 3.6;
81  const double scale = (e == PollutantsInterface::FUEL) ? 3.6 * 790. : 3.6;
82  if (index >= 42) {
83  const double* f = myFunctionParameter[index - 42] + 6 * e;
84  return (double) MAX2((f[0] + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.);
85  }
86  if (a < 0.) {
87  return 0.;
88  }
89  const double* f = myFunctionParameter[index] + 6 * e;
90  const double alpha = asin(a / 9.81) * 180. / M_PI;
91  return (double) MAX2((f[0] + f[1] * alpha * kmh + f[2] * alpha * alpha * kmh + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.);
92  }
93 
94 
95 private:
97  static double myFunctionParameter[42][36];
98 
99 };
100 
101 
102 #endif
103 
104 /****************************************************************************/
105 
EmissionType
Enumerating all emission types, including fuel.
T MAX2(T a, T b)
Definition: StdDefs.h:73
static double myFunctionParameter[42][36]
The function parameter.
Definition: HelpersHBEFA.h:97
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
static const int ZERO_EMISSIONS
the first class in each model representing a zero emission vehicle
abstract superclass for the model helpers
int SUMOEmissionClass
HelpersHBEFA()
Constructor (initializes myEmissionClassStrings)
Helper methods for HBEFA-based emission computation.
Definition: HelpersHBEFA.h:53
#define M_PI
Definition: odrSpiral.cpp:40
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: HelpersHBEFA.h:73
Helper methods for PHEMlight-based emission computation.