52 oc.
addDescription(
"device.emissions.begin",
"Emissions",
TL(
"Recording begin time for emission-data"));
55 oc.
addDescription(
"device.emissions.period",
"Emissions",
TL(
"Recording period for emission-output"));
90 if (oc.
isSet(
"emission-output.attributes")) {
92 for (std::string attrName : oc.
getStringVector(
"emission-output.attributes")) {
94 if (attrName ==
"all") {
97 WRITE_ERRORF(
TL(
"Unknown attribute '%' to write in emission output."), attrName);
114 :
MSVehicleDevice(holder,
"emissions_" + holder.getID()), myEmissions() {
141 const double timeOnLane,
143 const double meanSpeedVehicleOnLane,
157 if (tripinfoOut !=
nullptr) {
159 const int precision =
MAX2(
160 oc.
isDefault(
"emission-output.precision") ? 6 : oc.
getInt(
"emission-output.precision"),
162 tripinfoOut->
openTag(
"emissions");
#define WRITE_ERRORF(...)
std::bitset< 96 > SumoXMLAttrMask
int gPrecision
the precision for floating point outputs
A device which collects vehicular emissions.
void generateOutput(OutputDevice *tripinfoOut) const
Called on writing tripinfo output.
bool notifyIdle(SUMOTrafficObject &veh)
Computes idling emission values and adds them to the emission sums.
static SumoXMLAttrMask myWrittenAttributes
bit mask for checking attributes to be written
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Computes current emission values and adds them to their sums.
static void cleanup()
resets the attribute mask
MSDevice_Emissions(SUMOVehicle &holder)
Constructor.
static bool myAmInitialized
static SumoXMLAttrMask getDefaultMask()
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Emissions-options.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
void notifyMoveInternal(const SUMOTrafficObject &veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double meanLengthOnLane)
Internal notification about the vehicle moves, see MSMoveReminder::notifyMoveInternal()
PollutantsInterface::Emissions myEmissions
Internal storages for pollutant/fuel sum in mg or ml.
~MSDevice_Emissions()
Destructor.
static void initOnce()
initialize attribute mask (once)
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc, const bool isPerson=false)
Adds common command options that allow to assign devices to vehicles.
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, DEVICEHOLDER &v, bool outputOptionSet, const bool isPerson=false)
Determines whether a vehicle should get a certain device.
Abstract in-vehicle device.
SUMOVehicle & myHolder
The vehicle that stores the device.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
A storage for options typed value containers)
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
static std::string realString(const double v, const int precision=gPrecision)
Helper method for string formatting.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
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...
Representation of a vehicle, person, or container.
virtual double getAcceleration() const =0
Returns the object's acceleration.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual double getSlope() const =0
Returns the slope of the road at object's position in degrees.
Representation of a vehicle.
virtual EnergyParams * getEmissionParameters() const =0
Returns the vehicle's emission model parameter.
static SequentialStringBijection Attrs
The names of SUMO-XML attributes for use in netbuild.
int get(const std::string &str) const
void addScaled(const Emissions &a, const double scale=1.)
Add the values of the other struct to this one, scaling the values if needed.