SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HelpersPHEMlight.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // Helper methods for PHEMlight-based emission computation
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
31 #include "HelpersPHEMlight.h"
32 #include "PHEMCEPHandler.h"
33 #include "PHEMConstants.h"
34 #include <limits>
35 #include <cmath>
36 
37 #ifdef CHECK_MEMORY_LEAKS
38 #include <foreign/nvwa/debug_new.h>
39 #endif // CHECK_MEMORY_LEAKS
40 
41 
42 // ===========================================================================
43 // method definitions
44 // ===========================================================================
46 HelpersPHEMlight::getMaxAccel(SUMOEmissionClass c, double v, double a, double slope) {
48  return currCep->GetMaxAccel(v, a, slope);
49 }
50 
51 
53 HelpersPHEMlight::computeCO(SUMOEmissionClass c, double v, double a, double slope) {
55  double power = currCep->CalcPower(v, a, slope);
56  return currCep->GetEmission("CO", power) / SECONDS_PER_HOUR * 1000.;
57 }
58 
59 
61 HelpersPHEMlight::computeCO2(SUMOEmissionClass c, double v, double a, double slope) {
63  double power = currCep->CalcPower(v, a, slope);
64  return currCep->GetEmission("FC", power) * 3.15 / SECONDS_PER_HOUR * 1000.;
65 }
66 
67 
69 HelpersPHEMlight::computeHC(SUMOEmissionClass c, double v, double a, double slope) {
71  double power = currCep->CalcPower(v, a, slope);
72  return currCep->GetEmission("HC", power) / SECONDS_PER_HOUR * 1000.;
73 }
74 
75 
77 HelpersPHEMlight::computeNOx(SUMOEmissionClass c, double v, double a, double slope) {
79  double power = currCep->CalcPower(v, a, slope);
80  return currCep->GetEmission("NOx", power) / SECONDS_PER_HOUR * 1000.;
81 }
82 
83 
85 HelpersPHEMlight::computePMx(SUMOEmissionClass c, double v, double a, double slope) {
87  double power = currCep->CalcPower(v, a, slope);
88  return currCep->GetEmission("PM", power) / SECONDS_PER_HOUR * 1000.;
89 }
90 
91 
93 HelpersPHEMlight::computeFuel(SUMOEmissionClass c, double v, double a, double slope) {
95  double power = currCep->CalcPower(v, a, slope);
96 
97  std::string fuelType = currCep->GetVehicleFuelType();
98  if(fuelType == "D") {
99  return currCep->GetEmission("FC", power) / 0.836 / SECONDS_PER_HOUR * 1000.;
100  } else if(fuelType == "G") {
101  return currCep->GetEmission("FC", power) / 0.742 / SECONDS_PER_HOUR * 1000.;
102  } else {
103  return currCep->GetEmission("FC", power) / SECONDS_PER_HOUR * 1000.; // surely false, but at least not additionally modified
104  }
105 }
106 
107 /****************************************************************************/
108 
static SUMOReal computeCO(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO given the vehicle type and state (in mg/s)
Data Handler for a single CEP emission data set.
Definition: PHEMCEP.h:46
static SUMOReal computePMx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted PMx given the vehicle type and state (in mg/s)
double GetEmission(const std::string &pollutantIdentifier, double power) const
Returns a emission measure for power[kW] level.
Definition: PHEMCEP.cpp:178
static SUMOReal computeHC(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted HC given the vehicle type and state (in mg/s)
std::string GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
Definition: PHEMCEP.h:214
static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted NOx given the vehicle type and state (in mg/s)
double GetMaxAccel(double v, double a, double gradient) const
Returns the maximum accelaration for a vehicle at state v,a, slope and loading.
Definition: PHEMCEP.cpp:170
static PHEMCEPHandler & getHandlerInstance()
Implementatio of Singelton pattern.
SUMOEmissionClass
Definition of vehicle emission classes.
static SUMOReal getMaxAccel(SUMOEmissionClass c, double v, double a, double slope)
Returns the maximum possible acceleration.
const double SECONDS_PER_HOUR
Definition: PHEMConstants.h:26
static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO2 given the vehicle type and state (in mg/s)
static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of consumed fuel given the vehicle type and state (in ml/s)
double CalcPower(double v, double a, double slope) const
Returns the power of used for a vehicle at state v,a, slope and loading.
Definition: PHEMCEP.cpp:159
PHEMCEP * GetCep(SUMOEmissionClass emissionClass)
Returns the CEP data for a PHEM emission class.
#define SUMOReal
Definition: config.h:215