40 #ifdef CHECK_MEMORY_LEAKS
42 #endif // CHECK_MEMORY_LEAKS
56 oc.
addDescription(
"device.emissions.probability",
"Emissions",
"The probability for a vehicle to have an emission logging device");
59 oc.
addSynonyme(
"device.emissions.explicit",
"device.emissions.knownveh",
true);
60 oc.
addDescription(
"device.emissions.explicit",
"Emissions",
"Assign a device to named vehicles");
63 oc.
addDescription(
"device.emissions.deterministic",
"Emissions",
"The devices are set deterministic using a fraction of 1000");
70 if (oc.
getFloat(
"device.emissions.probability") == 0 && !oc.
isSet(
"device.emissions.explicit")) {
75 bool haveByNumber =
false;
76 if (oc.
getBool(
"device.emissions.deterministic")) {
82 if (haveByNumber || haveByName) {
85 into.push_back(device);
95 myCO2(0), myCO(0), myHC(0), myPMx(0), myNOx(0), myFuel(0) {
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Computes current emission values and adds them to their sums.
bool isInStringVector(const std::string &optionName, const std::string &itemName)
Returns the named option is a list of string values containing the specified item.
MSDevice_Emissions(SUMOVehicle &holder, const std::string &id)
Constructor.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static SUMOReal rand()
Returns a random real number in [0, 1)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
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)
SUMOEmissionClass
Definition of vehicle emission classes.
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)
~MSDevice_Emissions()
Destructor.
Representation of a vehicle.
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)
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
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)
Abstract in-vehicle device.
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)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
static void insertOptions()
Inserts MSDevice_Emissions-options.
A storage for options typed value containers)
virtual SUMOReal getAcceleration() const =0
Returns the vehicle's acceleration.
static std::string realString(const SUMOReal v, const int precision=OUTPUT_ACCURACY)
Helper method for string formatting.
void generateOutput() const
Called on writing tripinfo output.
bool isInQuota(SUMOReal frac=-1) const
Returns the information whether the currently vehicle number shall be emitted considering that only f...
Static storage of an output device and its base (abstract) implementation.
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
virtual SUMOReal getSlope() const =0
Returns the slope of the road at vehicle's position.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
A device which collects vehicular emissions.
virtual const std::string & getID() const =0
Get the vehicle's ID.
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)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.