 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
36 #define IDLE_SPEED (10 / 3.6)
54 if (eClass.size() < 6) {
58 const std::string type = eClass.substr(0, 3);
59 if (type ==
"HDV" || type ==
"LB_" || type ==
"RB_" || type ==
"LSZ" || eClass.find(
"LKW") != std::string::npos) {
66 std::vector<std::string> phemPath;
68 if (getenv(
"PHEMLIGHT_PATH") !=
nullptr) {
69 phemPath.push_back(std::string(getenv(
"PHEMLIGHT_PATH")) +
"/");
71 if (getenv(
"SUMO_HOME") !=
nullptr) {
72 phemPath.push_back(std::string(getenv(
"SUMO_HOME")) +
"/data/emissions/PHEMlight/");
86 std::string eclower = eClass;
87 std::transform(eclower.begin(), eclower.end(), eclower.begin(), tolower);
95 std::string eClassOffset =
"0";
96 if (eClass.length() == 5 && eClass.substr(0, 4) ==
"Euro") {
97 if (eClass[4] >=
'0' && eClass[4] <=
'6') {
98 eClassOffset = eClass.substr(4, 1);
102 if (vClass ==
"Passenger") {
104 if (fuel ==
"Gasoline") {
106 }
else if (fuel ==
"Diesel") {
108 }
else if (fuel ==
"HybridGasoline") {
109 desc =
"H_" + desc +
"G_";
110 }
else if (fuel ==
"HybridDiesel") {
111 desc =
"H_" + desc +
"G_";
113 desc +=
"EU" + eClassOffset;
114 }
else if (vClass ==
"Moped") {
115 desc =
"KKR_G_EU" + eClassOffset;
116 }
else if (vClass ==
"Motorcycle") {
117 desc =
"MR_G_EU" + eClassOffset;
118 if (fuel ==
"Gasoline2S") {
123 }
else if (vClass ==
"Delivery") {
125 if (fuel ==
"Gasoline") {
127 }
else if (fuel ==
"Diesel") {
130 desc +=
"EU" + eClassOffset +
"_I";
131 if (weight > 1305.) {
133 if (weight > 1760.) {
137 }
else if (vClass ==
"UrbanBus") {
138 desc =
"LB_D_EU" + eClassOffset;
139 }
else if (vClass ==
"Coach") {
140 desc =
"RB_D_EU" + eClassOffset;
141 }
else if (vClass ==
"Truck") {
142 desc =
"Solo_LKW_D_EU" + eClassOffset +
"_I";
143 if (weight > 1305.) {
146 }
else if (vClass ==
"Trailer") {
147 desc =
"LSZ_D_EU" + eClassOffset;
159 if (name.find(
"KKR_") != std::string::npos) {
161 }
else if (name.find(
"RB_") != std::string::npos) {
163 }
else if (name.find(
"LB_") != std::string::npos) {
165 }
else if (name.find(
"LNF_") != std::string::npos) {
167 }
else if (name.find(
"LSZ_") != std::string::npos) {
169 }
else if (name.find(
"MR_") != std::string::npos) {
171 }
else if (name.find(
"LKW_") != std::string::npos) {
181 std::string fuel =
"Gasoline";
182 if (name.find(
"_D_") != std::string::npos) {
185 if (name.find(
"H_") != std::string::npos) {
186 fuel =
"Hybrid" + fuel;
195 if (name.find(
"_EU1") != std::string::npos) {
197 }
else if (name.find(
"_EU2") != std::string::npos) {
199 }
else if (name.find(
"_EU3") != std::string::npos) {
201 }
else if (name.find(
"_EU4") != std::string::npos) {
203 }
else if (name.find(
"_EU5") != std::string::npos) {
205 }
else if (name.find(
"_EU6") != std::string::npos) {
215 if (name.find(
"LNF_") != std::string::npos) {
216 if (name.find(
"_III") != std::string::npos) {
218 }
else if (name.find(
"_II") != std::string::npos) {
220 }
else if (name.find(
"_I") != std::string::npos) {
224 if (name.find(
"Solo_LKW_") != std::string::npos) {
225 if (name.find(
"_II") != std::string::npos) {
227 }
else if (name.find(
"_I") != std::string::npos) {
237 if (oldCep !=
nullptr) {
247 if (currCep !=
nullptr) {
259 const double corrSpeed =
MAX2((
double) 0.0, v);
263 if (oldCep !=
nullptr) {
264 if (v >
IDLE_SPEED && a < oldCep->GetDecelCoast(corrSpeed, a, slope, 0)) {
269 power = oldCep->
CalcPower(corrSpeed, a, slope);
272 const PHEMCEP*
const oldCep = 0;
275 if (currCep !=
nullptr) {
281 power = currCep->
CalcPower(corrSpeed, corrAcc, slope);
288 if (oldCep !=
nullptr) {
292 getEmission(
nullptr, currCep,
"CO", power, corrSpeed),
bool GetCEP(const std::vector< std::string > &DataPath, Helpers *Helper)
void setCommentPrefix(const std::string &value)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
std::string getAmitranVehicleClass(const SUMOEmissionClass c) const
Returns the vehicle class described by this emission class as described in the Amitran interface (Pas...
Data Handler for a single CEP emission data set.
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.
const std::map< std::string, CEP * > & getCEPS() const
double GetEmission(const std::string &pollutantIdentifier, double power, double speed, bool normalized=false) const
Returns a emission measure for power[kW] level.
void setPHEMDataV(const std::string &value)
const std::string & getString(const T key) const
static const std::string strBEV
EmissionType
Enumerating all emission types, including fuel.
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
std::string getFuel(const SUMOEmissionClass c) const
Returns the fuel type described by this emission class as described in the Amitran interface (Gasolin...
PHEMlightdll::Helpers myHelper
int myIndex
the index of the next class
static OptionsCont & getOptions()
Retrieves the options.
static const int HEAVY_BIT
the bit to set for denoting heavy vehicles
const std::string & getErrMsg() const
PHEMCEP * GetCep(SUMOEmissionClass emissionClass)
Returns the CEP data for a PHEM emission class.
const std::string & getFuelType() const
SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc)
Checks whether the string describes a known vehicle class.
const double SECONDS_PER_HOUR
void addAlias(const std::string str, const T key)
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
HelpersPHEMlight()
Constructor.
double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const std::map< int, double > *param) const
Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel...
void insert(const std::string str, const T key, bool checkDuplicates=true)
T get(const std::string &str) const
double GetMaxAccel(double speed, double gradient)
PHEMlightdll::CEPHandler myCEPHandler
double getModifiedAccel(const SUMOEmissionClass c, const double v, const double a, const double slope) const
Returns the adapted acceleration value, useful for comparing with external PHEMlight references.
const std::string & GetVehicleFuelType() const
Getter function to recieve vehicle data from CEP.
static const std::string strDiesel
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.
static const std::string strGasoline
std::map< SUMOEmissionClass, PHEMlightdll::CEP * > myCEPs
StringBijection< SUMOEmissionClass > myEmissionClassStrings
Mapping between emission class names and integer representations.
const std::string & getgClass() const
double CalcPower(double speed, double acc, double gradient)
double getWeight(const SUMOEmissionClass c) const
Returns a reference weight in kg described by this emission class as described in the Amitran interfa...
static PHEMCEPHandler & getHandlerInstance()
Implementatio of Singelton pattern.
bool hasString(const std::string &str) const
int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
Helper methods for PHEMlight-based emission computation.
double getEmission(const PHEMCEP *oldCep, PHEMlightdll::CEP *currCep, const std::string &e, const double p, const double v) const
Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel...
bool setclass(const std::string &VEH)
void remove(const std::string str, const T key)
static const double ZERO_SPEED_ACCURACY
static const int PHEMLIGHT_BASE