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-2012 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 <cassert>
36 #include "StdDefs.h"
37 #include "SUMOVehicleClass.h"
38 #include <limits>
39 #include <cmath>
40 
41 
42 // ===========================================================================
43 // definitions
44 // ===========================================================================
45 #ifndef PI
46 #define PI 3.1415926535897932384626433832795
47 #endif
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
61 class HelpersHBEFA {
62 public:
69  static SUMOReal computeCO(SUMOEmissionClass c, double v, double a) ;
70 
71 
78  static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a) ;
79 
80 
87  static SUMOReal computeHC(SUMOEmissionClass c, double v, double a) ;
88 
89 
96  static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a) ;
97 
98 
105  static SUMOReal computePMx(SUMOEmissionClass c, double v, double a) ;
106 
107 
117  static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a) ;
118 
119 
127  static SUMOReal computeDefaultCO(SUMOEmissionClass c, double v, double a, SUMOReal tt) ;
128 
129 
137  static SUMOReal computeDefaultCO2(SUMOEmissionClass c, double v, double a, SUMOReal tt) ;
138 
139 
147  static SUMOReal computeDefaultHC(SUMOEmissionClass c, double v, double a, SUMOReal tt) ;
148 
149 
157  static SUMOReal computeDefaultNOx(SUMOEmissionClass c, double v, double a, SUMOReal tt) ;
158 
159 
167  static SUMOReal computeDefaultPMx(SUMOEmissionClass c, double v, double a, SUMOReal tt) ;
168 
169 
177  static SUMOReal computeDefaultFuel(SUMOEmissionClass c, double v, double a, SUMOReal tt) ;
178 
179 
180 private:
192  static inline SUMOReal compute(SUMOEmissionClass c, const int offset, double v, const double a) {
193  switch (c) {
194  case SVE_ZERO_EMISSIONS:
195  return 0.;
196  case SVE_UNKNOWN:
197  c = SVE_P_LDV_7_7;
198  break;
199  default:
200  break;
201  }
202  v *= 3.6;
203  if (c > 42) {
204  const double* f = myFunctionParameter[c - 42] + offset;
205  return (SUMOReal) MAX2((f[0] + f[3] * v + f[4] * v * v + f[5] * v * v * v) / 3.6, 0.);
206  }
207  if (a < 0.) {
208  return 0.;
209  }
210  const double* f = myFunctionParameter[c] + offset;
211  const double alpha = asin(a / 9.81) * 180. / PI;
212  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.);
213  }
214 
215 
216 private:
218  static double myFunctionParameter[42][36];
219 
220 };
221 
222 
223 #endif
224 
225 /****************************************************************************/
226