|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Helper methods for HBEFA-based emission computation 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef HelpersHBEFA_h 00020 #define HelpersHBEFA_h 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <vector> 00033 #include <cassert> 00034 #include "StdDefs.h" 00035 #include "SUMOVehicleClass.h" 00036 #include <limits> 00037 #include <cmath> 00038 00039 00040 // =========================================================================== 00041 // definitions 00042 // =========================================================================== 00043 #ifndef PI 00044 #define PI 3.1415926535897932384626433832795 00045 #endif 00046 00047 00048 // =========================================================================== 00049 // class definitions 00050 // =========================================================================== 00059 class HelpersHBEFA { 00060 public: 00067 static SUMOReal computeCO(SUMOEmissionClass c, double v, double a) throw(); 00068 00069 00076 static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a) throw(); 00077 00078 00085 static SUMOReal computeHC(SUMOEmissionClass c, double v, double a) throw(); 00086 00087 00094 static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a) throw(); 00095 00096 00103 static SUMOReal computePMx(SUMOEmissionClass c, double v, double a) throw(); 00104 00105 00112 static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a) throw(); 00113 00114 00115 private: 00120 static inline double* getParameterForClass(SUMOEmissionClass c) throw() { 00121 return myFunctionParameter[c]; 00122 } 00123 00124 00134 static inline double computeUsing(double* f, double v, double a) throw() { 00135 if (a<0) { 00136 return 0.; 00137 } 00138 v = v * 3.6; 00139 double alpha = asin(a/9.81)*180./PI; 00140 return MAX2(((f[0] + f[1]*alpha*v + f[2]*alpha*alpha*v + f[3]*v + f[4]*v*v + f[5]*v*v*v) / 3600.), 0.); 00141 } 00142 00143 00144 private: 00146 static double myFunctionParameter[42][36]; 00147 00148 }; 00149 00150 00151 #endif 00152 00153 /****************************************************************************/ 00154