SUMO - Simulation of Urban MObility
HelpersHBEFA.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Helper methods for HBEFA-based emission computation
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 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 HelpersHBEFA_h
22 #define HelpersHBEFA_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:
58  HelpersHBEFA();
59 
60 
74  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 {
75  UNUSED_PARAMETER(slope);
76  UNUSED_PARAMETER(param);
78  return 0.;
79  }
80  const int index = (c & ~PollutantsInterface::HEAVY_BIT) - 1;
81  const double kmh = v * 3.6;
82  const double scale = (e == PollutantsInterface::FUEL) ? 3.6 * 790. : 3.6;
83  if (index >= 42) {
84  const double* f = myFunctionParameter[index - 42] + 6 * e;
85  return (double) MAX2((f[0] + f[3] * kmh + f[4] * kmh * kmh + f[5] * kmh * kmh * kmh) / scale, 0.);
86  }
87  if (a < 0.) {
88  return 0.;
89  }
90  const double* f = myFunctionParameter[index] + 6 * e;
91  const double alpha = asin(a / 9.81) * 180. / M_PI;
92  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.);
93  }
94 
95 
96 private:
98  static double myFunctionParameter[42][36];
99 
100 };
101 
102 
103 #endif
104 
105 /****************************************************************************/
106 
#define M_PI
Definition: angles.h:37
EmissionType
Enumerating all emission types, including fuel.
T MAX2(T a, T b)
Definition: StdDefs.h:70
static double myFunctionParameter[42][36]
The function parameter.
Definition: HelpersHBEFA.h:98
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
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:54
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:74
Helper methods for PHEMlight-based emission computation.