86 fuel += scale * a.
fuel;
98 myBaseIndex(baseIndex) {
99 if (defaultClass != -1) {
116 if (myEmissionClassStrings.hasString(eClass)) {
117 return myEmissionClassStrings.get(eClass);
125 return myName +
"/" + myEmissionClassStrings.getString(c);
131 return (c & (
int)0xffffffff & ~
HEAVY_BIT) == 0;
201 if (param ==
nullptr) {
208 return MIN2(0., incl * v + 0.00001066 * mass + -0.38347107 - 20.0 * incl - grad);
214 myEmissionClassStrings.addKeysInto(list);
220 return (c >> 16) == (myBaseIndex >> 16);
229 const std::string::size_type sep = eClass.find(
"/");
230 const std::string model = eClass.substr(0, sep);
231 for (
int i = 0; i < 8; i++) {
233 if (sep != std::string::npos) {
234 const std::string subClass = eClass.substr(sep + 1);
235 if (subClass ==
"zero") {
243 if (sep == std::string::npos) {
244 if (eClass ==
"zero") {
254const std::vector<SUMOEmissionClass>
256 std::vector<SUMOEmissionClass> result;
257 for (
int i = 0; i < 8; i++) {
264const std::vector<std::string>&
269 std::vector<SUMOEmissionClass> emissionClasses;
270 for (
int i = 0; i < 8; i++) {
274 for (
const auto& i : emissionClasses) {
303 return "electricity";
323 const std::string& fuel,
const std::string& eClass,
const double weight) {
361 return Emissions(h->
compute(c,
CO2, v, a, slope, param), h->
compute(c,
CO, v, a, slope, param), h->
compute(c,
HC, v, a, slope, param),
362 h->
compute(c,
FUEL, v, a, slope, param), h->
compute(c,
NO_X, v, a, slope, param), h->
compute(c,
PM_X, v, a, slope, param),
370 return (h->
compute(c, e, v, 0, slope, param) + h->
compute(c, e, v - a, a, slope, param)) * tt / 2.;
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SUMO_ATTR_FRONTSURFACEAREA
Front surface area.
#define UNUSED_PARAMETER(x)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
An upper class for objects with additional parameters.
double getDouble(SumoXMLAttr attr) const
Returns the value for a given key.
static const EnergyParams * getDefault()
Helper methods for energy-based electricity consumption computation based on the battery device.
Helper methods for HBEFA3-based emission computation.
Helper methods for HBEFA4-based emission computation.
Helper methods for HBEFA-based emission computation.
This helper class allows the PollutantsInterface to load and use different MMPEVEMs.
Helper methods for PHEMlight-based emission computation.
Helper methods for PHEMlight-based emission computation.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
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.
static const double SPEED_DCEL_MIN
static const double GRAVITY_CONST
zero emission model, used as superclass for the other model helpers
virtual bool isSilent(const SUMOEmissionClass c)
Returns whether the class denotes a silent vehicle for interfacing with the noise model....
const std::string getClassName(const SUMOEmissionClass c) const
Returns the complete name of the emission class including the model.
virtual SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc)
Returns the emission class associated with the given name, aliases are possible If this method is ask...
const std::string & getName() const
Returns the name of the model.
bool includesClass(const SUMOEmissionClass c) const
virtual 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. The base is used to determine the model...
void addAllClassesInto(std::vector< SUMOEmissionClass > &list) const
Add all known emission classes of this model to the given container.
virtual std::string getAmitranVehicleClass(const SUMOEmissionClass c) const
Returns the vehicle class described by this emission class as described in the Amitran interface (Pas...
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...
virtual double getModifiedAccel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param) const
Returns the adapted acceleration value, useful for comparing with external PHEMlight references....
virtual double getWeight(const SUMOEmissionClass c) const
Returns a reference weight in kg described by this emission class as described in the Amitran interfa...
Helper(std::string name, const int baseIndex, const int defaultClass)
Constructor, intializes the name.
virtual double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const EnergyParams *param) const
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
static const double ZERO_SPEED_ACCURACY
the lowest speed which allows reliable coasting calculations
virtual int getEuroClass(const SUMOEmissionClass c) const
Returns the Euro emission class described by this emission class as described in the Amitran interfac...
StringBijection< SUMOEmissionClass > myEmissionClassStrings
Mapping between emission class names and integer representations.
virtual std::string getFuel(const SUMOEmissionClass c) const
Returns the fuel type described by this emission class as described in the Amitran interface (Gasolin...
static bool isSilent(const SUMOEmissionClass c)
Checks whether the emission class describes an electric or similar silent vehicle.
static HelpersHBEFA3 myHBEFA3Helper
Instance of HBEFA3Helper which gets cleaned up automatically.
static HelpersPHEMlight5 myPHEMlight5Helper
Instance of PHEMlight5Helper which gets cleaned up automatically.
static HelpersPHEMlight myPHEMlightHelper
Instance of PHEMlightHelper which gets cleaned up automatically.
static std::string getAmitranVehicleClass(const SUMOEmissionClass c)
Returns the vehicle class described by the given emission class.
static const HelpersEnergy & getEnergyHelper()
get energy helper
static std::string getPollutantName(const EmissionType e)
return the name for the given emission type
static double computeDefault(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const double tt, const EnergyParams *param)
Returns the amount of emitted pollutant given the vehicle type and default values for the state (in m...
EmissionType
Enumerating all emission types, including fuel.
static std::string getFuel(const SUMOEmissionClass c)
Returns the fuel type of the given emission class.
static bool isHeavy(const SUMOEmissionClass c)
Checks whether the emission class describes a bus, truck or similar vehicle.
static HelpersHBEFA4 myHBEFA4Helper
Instance of HBEFA4Helper which gets cleaned up automatically.
static double getWeight(const SUMOEmissionClass c)
Returns a representative weight for the given emission class see http://colombo-fp7....
static double getModifiedAccel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param)
Returns the adapted acceleration value, useful for comparing with external PHEMlight references.
static std::vector< std::string > myAllClassesStr
get all emission classes in string format
static HelpersHBEFA myHBEFA2Helper
Instance of HBEFA2Helper which gets cleaned up automatically.
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
static const std::vector< SUMOEmissionClass > getAllClasses()
Checks whether the string describes a known vehicle class.
static const int ZERO_EMISSIONS
the first class in each model representing a zero emission vehicle
static SUMOEmissionClass getClass(const SUMOEmissionClass base, const std::string &vClass, const std::string &fuel, const std::string &eClass, const double weight)
Returns the emission class fittig the given parameters.
static const int HEAVY_BIT
the bit to set for denoting heavy vehicles
static double getCoastingDecel(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param)
Returns the coasting deceleration value, useful for comparing with external PHEMlight references.
static int getEuroClass(const SUMOEmissionClass c)
Returns the Euro norm described by the given emission class.
static HelpersEnergy myEnergyHelper
Instance of EnergyHelper which gets cleaned up automatically.
static double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const EnergyParams *param)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
static const std::vector< std::string > & getAllClassesStr()
Get all SUMOEmissionClass in string format.
static Helper * myHelpers[]
the known model helpers
static Emissions computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope, const EnergyParams *param)
Returns the amount of all emitted pollutants given the vehicle type and state (in mg/s or ml/s for fu...
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
static HelpersMMPEVEM myMMPEVEMHelper
Instance of HelpersMMPEVEM which gets cleaned up automatically.
static Helper myZeroHelper
Instance of Helper which gets cleaned up automatically.
void addAlias(const std::string str, const T key)
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.
Storage for collected values of all emission types.
void addScaled(const Emissions &a, const double scale=1.)
Add the values of the other struct to this one, scaling the values if needed.
Emissions(double co2=0, double co=0, double hc=0, double f=0, double nox=0, double pmx=0, double elec=0)
Constructor, intializes all members.