SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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.sourceforge.net/
11 // Copyright (C) 2001-2013 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 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
53 class HelpersHBEFA {
54 public:
61  static SUMOReal computeCO(SUMOEmissionClass c, double v, double a);
62 
63 
70  static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a);
71 
72 
79  static SUMOReal computeHC(SUMOEmissionClass c, double v, double a);
80 
81 
88  static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a);
89 
90 
97  static SUMOReal computePMx(SUMOEmissionClass c, double v, double a);
98 
99 
109  static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a);
110 
111 
112 private:
124  static inline SUMOReal compute(SUMOEmissionClass c, const int offset, double v, const double a) {
125  switch (c) {
126  case SVE_ZERO_EMISSIONS:
127  return 0.;
128  case SVE_UNKNOWN:
129  c = SVE_P_LDV_7_7;
130  break;
131  default:
132  break;
133  }
134  v *= 3.6;
135  if (c > 42) {
136  const double* f = myFunctionParameter[c - 42] + offset;
137  return (SUMOReal) MAX2((f[0] + f[3] * v + f[4] * v * v + f[5] * v * v * v) / 3.6, 0.);
138  }
139  if (a < 0.) {
140  return 0.;
141  }
142  const double* f = myFunctionParameter[c] + offset;
143  const double alpha = asin(a / 9.81) * 180. / M_PI;
144  return (SUMOReal) MAX2((f[0] + f[1] * alpha * v + f[2] * alpha * alpha * v + f[3] * v + f[4] * v * v + f[5] * v * v * v) / 3.6, 0.);
145  }
146 
147 
148 private:
150  static double myFunctionParameter[42][36];
151 
152 };
153 
154 
155 #endif
156 
157 /****************************************************************************/
158 
static SUMOReal computeCO(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted CO given the vehicle type and state (in mg/s)
static SUMOReal computeHC(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted HC given the vehicle type and state (in mg/s)
#define M_PI
Definition: angles.h:37
T MAX2(T a, T b)
Definition: StdDefs.h:71
static double myFunctionParameter[42][36]
The function parameter.
Definition: HelpersHBEFA.h:150
SUMOEmissionClass
Definition of vehicle emission classes.
static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted CO2 given the vehicle type and state (in mg/s)
static SUMOReal compute(SUMOEmissionClass c, const int offset, double v, const double a)
Computes the emitted pollutant amount using the given speed and acceleration.
Definition: HelpersHBEFA.h:124
Helper methods for HBEFA-based emission computation.
Definition: HelpersHBEFA.h:53
static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted NOx given the vehicle type and state (in mg/s)
static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a)
Returns the amount of consumed fuel given the vehicle type and state (in ml/s)
static SUMOReal computePMx(SUMOEmissionClass c, double v, double a)
Returns the amount of emitted PMx given the vehicle type and state (in mg/s)
#define SUMOReal
Definition: config.h:215