SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00008 // Helper methods for HBEFA-based emission computation 00009 /****************************************************************************/ 00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00012 /****************************************************************************/ 00013 // 00014 // This file is part of SUMO. 00015 // SUMO is free software: you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation, either version 3 of the License, or 00018 // (at your option) any later version. 00019 // 00020 /****************************************************************************/ 00021 #ifndef HelpersHBEFA_h 00022 #define HelpersHBEFA_h 00023 00024 00025 // =========================================================================== 00026 // included modules 00027 // =========================================================================== 00028 #ifdef _MSC_VER 00029 #include <windows_config.h> 00030 #else 00031 #include <config.h> 00032 #endif 00033 00034 #include <vector> 00035 #include <cassert> 00036 #include "StdDefs.h" 00037 #include "SUMOVehicleClass.h" 00038 #include <limits> 00039 #include <cmath> 00040 00041 00042 // =========================================================================== 00043 // definitions 00044 // =========================================================================== 00045 #ifndef PI 00046 #define PI 3.1415926535897932384626433832795 00047 #endif 00048 00049 00050 // =========================================================================== 00051 // class definitions 00052 // =========================================================================== 00061 class HelpersHBEFA { 00062 public: 00069 static SUMOReal computeCO(SUMOEmissionClass c, double v, double a) ; 00070 00071 00078 static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a) ; 00079 00080 00087 static SUMOReal computeHC(SUMOEmissionClass c, double v, double a) ; 00088 00089 00096 static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a) ; 00097 00098 00105 static SUMOReal computePMx(SUMOEmissionClass c, double v, double a) ; 00106 00107 00117 static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a) ; 00118 00119 00127 static SUMOReal computeDefaultCO(SUMOEmissionClass c, double v, double a, SUMOReal tt) ; 00128 00129 00137 static SUMOReal computeDefaultCO2(SUMOEmissionClass c, double v, double a, SUMOReal tt) ; 00138 00139 00147 static SUMOReal computeDefaultHC(SUMOEmissionClass c, double v, double a, SUMOReal tt) ; 00148 00149 00157 static SUMOReal computeDefaultNOx(SUMOEmissionClass c, double v, double a, SUMOReal tt) ; 00158 00159 00167 static SUMOReal computeDefaultPMx(SUMOEmissionClass c, double v, double a, SUMOReal tt) ; 00168 00169 00177 static SUMOReal computeDefaultFuel(SUMOEmissionClass c, double v, double a, SUMOReal tt) ; 00178 00179 00180 private: 00192 static inline SUMOReal compute(SUMOEmissionClass c, const int offset, double v, const double a) { 00193 switch (c) { 00194 case SVE_ZERO_EMISSIONS: 00195 return 0.; 00196 case SVE_UNKNOWN: 00197 c = SVE_P_LDV_7_7; 00198 break; 00199 default: 00200 break; 00201 } 00202 v *= 3.6; 00203 if (c > 42) { 00204 const double* f = myFunctionParameter[c - 42] + offset; 00205 return (SUMOReal) MAX2((f[0] + f[3] * v + f[4] * v * v + f[5] * v * v * v) / 3.6, 0.); 00206 } 00207 if (a < 0.) { 00208 return 0.; 00209 } 00210 const double* f = myFunctionParameter[c] + offset; 00211 const double alpha = asin(a / 9.81) * 180. / PI; 00212 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.); 00213 } 00214 00215 00216 private: 00218 static double myFunctionParameter[42][36]; 00219 00220 }; 00221 00222 00223 #endif 00224 00225 /****************************************************************************/ 00226