39 #ifdef CHECK_MEMORY_LEAKS
41 #endif // CHECK_MEMORY_LEAKS
60 if (eClass.size() < 8 || (eClass.find(
"_D_EU") == std::string::npos && eClass.find(
"_G_EU") == std::string::npos)) {
64 const std::string type = eClass.substr(0, 3);
65 if (type ==
"LB_" || type ==
"RB_" || type ==
"LSZ" || eClass.find(
"LKW") != std::string::npos) {
72 throw InvalidArgument(
"File for PHEM emission class " + eClass +
" not found.");
74 std::string eclower = eClass;
75 std::transform(eclower.begin(), eclower.end(), eclower.begin(), tolower);
93 std::string eClassOffset =
"0";
94 if (eClass.length() == 5 && eClass.substr(0, 4) ==
"Euro") {
95 if (eClass[4] >=
'0' && eClass[4] <=
'6') {
96 eClassOffset = eClass.substr(4, 1);
100 if (vClass ==
"Passenger") {
102 if (fuel ==
"Gasoline") {
104 }
else if (fuel ==
"Diesel") {
106 }
else if (fuel ==
"HybridGasoline") {
107 desc =
"H_" + desc +
"G_";
108 }
else if (fuel ==
"HybridDiesel") {
109 desc =
"H_" + desc +
"G_";
111 desc +=
"EU" + eClassOffset;
112 }
else if (vClass ==
"Moped") {
113 desc =
"KKR_G_EU" + eClassOffset;
114 }
else if (vClass ==
"Motorcycle") {
115 desc =
"MR_G_EU" + eClassOffset;
116 if (fuel ==
"Gasoline2S") {
121 }
else if (vClass ==
"Delivery") {
123 if (fuel ==
"Gasoline") {
125 }
else if (fuel ==
"Diesel") {
128 desc +=
"EU" + eClassOffset +
"_I";
129 if (weight > 1305.) {
131 if (weight > 1760.) {
135 }
else if (vClass ==
"UrbanBus") {
136 desc =
"LB_D_EU" + eClassOffset;
137 }
else if (vClass ==
"Coach") {
138 desc =
"RB_D_EU" + eClassOffset;
139 }
else if (vClass ==
"Truck") {
140 desc =
"Solo_LKW_D_EU" + eClassOffset +
"_I";
141 if (weight > 1305.) {
144 }
else if (vClass ==
"Trailer") {
145 desc =
"LSZ_D_EU" + eClassOffset;
157 if (name.find(
"KKR_") != std::string::npos) {
159 }
else if (name.find(
"RB_") != std::string::npos) {
161 }
else if (name.find(
"LB_") != std::string::npos) {
163 }
else if (name.find(
"LNF_") != std::string::npos) {
165 }
else if (name.find(
"LSZ_") != std::string::npos) {
167 }
else if (name.find(
"MR_") != std::string::npos) {
169 }
else if (name.find(
"LKW_") != std::string::npos) {
179 std::string fuel =
"Gasoline";
180 if (name.find(
"_D_") != std::string::npos) {
183 if (name.find(
"H_") != std::string::npos) {
184 fuel =
"Hybrid" + fuel;
193 if (name.find(
"_EU1") != std::string::npos) {
195 }
else if (name.find(
"_EU2") != std::string::npos) {
197 }
else if (name.find(
"_EU3") != std::string::npos) {
199 }
else if (name.find(
"_EU4") != std::string::npos) {
201 }
else if (name.find(
"_EU5") != std::string::npos) {
203 }
else if (name.find(
"_EU6") != std::string::npos) {
213 if (name.find(
"LNF_") != std::string::npos) {
214 if (name.find(
"_III") != std::string::npos) {
216 }
else if (name.find(
"_II") != std::string::npos) {
218 }
else if (name.find(
"_I") != std::string::npos) {
222 if (name.find(
"Solo_LKW_") != std::string::npos) {
223 if (name.find(
"_II") != std::string::npos) {
225 }
else if (name.find(
"_I") != std::string::npos) {
239 const double corrSpeed =
MAX2((
double) 0.0, v);
240 const double decelCoast = currCep->
GetDecelCoast(corrSpeed, a, slope, 0);
241 if (a < decelCoast) {
244 double power = currCep->
CalcPower(corrSpeed, a, slope);
258 if (fuelType ==
"D") {
260 }
else if (fuelType ==
"G") {
Data Handler for a single CEP emission data set.
void remove(const std::string str, const T key)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
bool hasString(const std::string &str) const
int myIndex
the index of the next class
HelpersPHEMlight()
Constructor.
int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
EmissionType
Enumerating all emission types, including fuel.
std::string GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
SUMOReal compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope) const
Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel...
SUMOReal getWeight(const SUMOEmissionClass c) const
Returns a reference weight in kg described by this emission class as described in the Amitran interfa...
static const int HEAVY_BIT
the bit to set for denoting heavy vehicles
static PHEMCEPHandler & getHandlerInstance()
Implementatio of Singelton pattern.
void insert(const std::string str, const T key, bool checkDuplicates=true)
void addAlias(const std::string str, const T key)
std::string getFuel(const SUMOEmissionClass c) const
Returns the fuel type described by this emission class as described in the Amitran interface (Gasolin...
const std::string & getString(const T key) const
const double SECONDS_PER_HOUR
static const int PHEMLIGHT_BASE
double GetMaxAccel(double v, double a, double gradient, double vehicleLoading=0) const
Returns the maximum accelaration for a vehicle at state v,a, slope and loading.
StringBijection< SUMOEmissionClass > myEmissionClassStrings
Mapping between emission class names and integer representations.
SUMOReal getMaxAccel(SUMOEmissionClass c, double v, double a, double slope) const
Returns the maximum possible acceleration.
std::string getAmitranVehicleClass(const SUMOEmissionClass c) const
Returns the vehicle class described by this emission class as described in the Amitran interface (Pas...
double CalcPower(double v, double a, double slope, double vehicleLoading=0) const
Returns the power of used for a vehicle at state v,a, slope and loading.
SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc)
Checks whether the string describes a known vehicle class.
T get(const std::string &str) const
PHEMCEP * GetCep(SUMOEmissionClass emissionClass)
Returns the CEP data for a PHEM emission class.
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string &vClass, const std::string &fuel, const std::string &eClass, const double weight) const
Returns the emission class described by the given parameters.
double GetEmission(const std::string &pollutantIdentifier, double power, double speed, bool normalized=false) const
Returns a emission measure for power[kW] level.
Helper methods for PHEMlight-based emission computation.