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