|
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 00120 private: 00132 static inline SUMOReal compute(SUMOEmissionClass c, const int offset, double v, const double a) { 00133 switch (c) { 00134 case SVE_ZERO_EMISSIONS: 00135 return 0.; 00136 case SVE_UNKNOWN: 00137 c = SVE_P_LDV_7_7; 00138 break; 00139 default: 00140 break; 00141 } 00142 v *= 3.6; 00143 if (c > 42) { 00144 const double* f = myFunctionParameter[c - 42] + offset; 00145 return (SUMOReal) MAX2((f[0] + f[3] * v + f[4] * v * v + f[5] * v * v * v) / 3.6, 0.); 00146 } 00147 if (a < 0.) { 00148 return 0.; 00149 } 00150 const double* f = myFunctionParameter[c] + offset; 00151 const double alpha = asin(a / 9.81) * 180. / PI; 00152 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.); 00153 } 00154 00155 00156 private: 00158 static double myFunctionParameter[42][36]; 00159 00160 }; 00161 00162 00163 #endif 00164 00165 /****************************************************************************/ 00166