40 myIndex(PHEMLIGHT5_BASE) {
45 for (
const auto& cep :
myCEPs) {
62 if (eClass.size() < 6) {
67 std::vector<std::string> phemPath;
68 phemPath.push_back(oc.
getString(
"phemlight-path") +
"/");
69 if (getenv(
"PHEMLIGHT_PATH") !=
nullptr) {
70 phemPath.push_back(std::string(getenv(
"PHEMLIGHT_PATH")) +
"/");
72 if (getenv(
"SUMO_HOME") !=
nullptr) {
73 phemPath.push_back(std::string(getenv(
"SUMO_HOME")) +
"/data/emissions/PHEMlight5/");
81 throw InvalidArgument(
"Error reading PHEMlight5 deterioration data.\n" + err);
85 if (!oc.
isDefault(
"phemlight-temperature")) {
89 throw InvalidArgument(
"Error reading PHEMlight5 deterioration data.\n" + err);
121 if (currCep !=
nullptr) {
123 return v == 0.0 ? 0.0 :
MIN2(a, currCep->
GetMaxAccel(v, slope, isHBEV));
131 return myCEPs.find(c)->second->GetDecelCoast(v, a, slope);
140 const double corrSpeed =
MAX2(0.0, v);
141 assert(
myCEPs.count(c) == 1);
146 const double power_raw = currCep->
CalcPower(corrSpeed, corrAcc, slope, isBEV || isHybrid);
149 if (!isBEV && corrAcc < currCep->GetDecelCoast(corrSpeed, corrAcc, slope) &&
153 const std::string& fuelType = currCep->
getFuelType();
const double SECONDS_PER_HOUR
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
An upper class for objects with additional parameters.
bool isEngineOff() const
Returns the state of the engine when the vehicle is not moving.
int myIndex
the index of the next class
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.
HelpersPHEMlight5()
Constructor.
virtual double getCoastingDecel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param) const
Returns the maximum deceleration value (as a negative number), which can still be considered as non-b...
double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams *param) const
Returns the amount of emitted pollutant given the vehicle type and state (in mg/s or in ml/s for fuel...
PHEMlightdllV5::CEPHandler myCEPHandler
std::map< SUMOEmissionClass, PHEMlightdllV5::CEP * > myCEPs
PHEMlightdllV5::Correction * myCorrection
double getEmission(PHEMlightdllV5::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...
SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc)
Checks whether the string describes a known vehicle class.
virtual ~HelpersPHEMlight5()
Destructor.
PHEMlightdllV5::Helpers myHelper
Helper methods for PHEMlight-based emission computation.
A storage for options typed value containers)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
const std::map< std::string, CEP * > & getCEPS() const
bool GetCEP(std::vector< std::string > &DataPath, Helpers *Helper, Correction *DataCor)
double CalcPower(double speed, double acc, double gradient, bool HBEV)
double CalcWheelPower(double speed, double acc, double gradient)
const bool & getHeavyVehicle() const
double GetMaxAccel(double speed, double gradient, bool HBEV)
const std::string & getFuelType() const
double getAuxPower() const
double CalcEngPower(double power)
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
static const std::string strBEV
static const double ZERO_SPEED_ACCURACY
static const std::string strHybrid
static const std::string strGasoline
static const std::string strDiesel
void setAmbTemp(const double &value)
bool ReadDet(std::string &ErrMSG)
bool ReadTNOx(std::string &ErrMSG)
void setYear(const int &value)
void setUseTNOx(const bool &value)
void setUseDet(const bool &value)
void setPHEMDataV(const std::string &value)
bool setclass(const std::string &VEH)
const std::string & getgClass() const
void setCommentPrefix(const std::string &value)
const std::string & getErrMsg() const
bool myVolumetricFuel
return fuel consumption in l instead of mg
StringBijection< SUMOEmissionClass > myEmissionClassStrings
Mapping between emission class names and integer representations.
EmissionType
Enumerating all emission types, including fuel.
static const int HEAVY_BIT
the bit to set for denoting heavy vehicles
bool hasString(const std::string &str) const
void addAlias(const std::string str, const T key)
T get(const std::string &str) const
void insert(const std::string str, const T key, bool checkDuplicates=true)
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.