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-2018 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 HBEFA-based emission computation
17 /****************************************************************************/
18 #ifndef HelpersHBEFA_h
19 #define HelpersHBEFA_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:
51  HelpersHBEFA();
52 
53 
67  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 {
68  UNUSED_PARAMETER(slope);
69  UNUSED_PARAMETER(param);
71  return 0.;
72  }
73  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - 1;
74  const double kmh = v * 3.6;
75  const double scale = (e == PollutantsInterface::FUEL) ? 3.6 * 790. : 3.6;
76  if (index >= 42) {
77  const double* f = myFunctionParameter[index - 42] + 6 * e;
78  return (double) MAX2((f[0] + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.);
79  }
80  if (a < 0.) {
81  return 0.;
82  }
83  const double* f = myFunctionParameter[index] + 6 * e;
84  const double alpha = asin(a / 9.81) * 180. / M_PI;
85  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.);
86  }
87 
88 
89 private:
91  static double myFunctionParameter[42][36];
92 
93 };
94 
95 
96 #endif
97 
98 /****************************************************************************/
99 
EmissionType
Enumerating all emission types, including fuel.
T MAX2(T a, T b)
Definition: StdDefs.h:76
static double myFunctionParameter[42][36]
The function parameter.
Definition: HelpersHBEFA.h:91
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:33
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:47
#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:67
Helper methods for PHEMlight-based emission computation.