42 long long int attributes,
const double defaultSlope, std::ostream* stdOut,
OutputDevice* xmlOut) :
45 myComputeAForward(computeAForward),
46 myAccelZeroCorrection(accelZeroCorrection),
47 myDefaultClass(defaultClass),
48 myParams(params), myAttributes(attributes),
49 myDefaultSlope(defaultSlope), myStdOut(stdOut), myXMLOut(xmlOut), myCurrentTime(-1), myStepSize(
TS) {}
76 WRITE_WARNINGF(
TL(
"Unknown actor configuration '%' for vehicle '%'!"), acId,
id);
119 double& v,
double& a,
double& s) {
136 throw ProcessError(
TL(
"Acceleration information is missing; try running with --compute-a."));
152 if ((attributes & ((
long long int)1 << attr)) != 0) {
162 long long int attributes,
164 double& a,
double& s) {
172 const double nextS = s;
199 double a,
double s) {
222 o <<
"CO:" <<
mySums[id].CO << std::endl
223 <<
"CO2:" <<
mySums[id].CO2 << std::endl
224 <<
"HC:" <<
mySums[id].HC << std::endl
225 <<
"NOx:" <<
mySums[id].NOx << std::endl
226 <<
"PMx:" <<
mySums[id].PMx << std::endl
227 <<
"fuel:" <<
mySums[id].fuel << std::endl
228 <<
"electricity:" <<
mySums[id].electricity << std::endl;
234 o <<
mySums[id].fuel / factor <<
","
235 <<
mySums[id].electricity / factor <<
","
236 <<
mySums[id].CO2 / factor <<
","
237 <<
mySums[id].NOx / factor <<
","
238 <<
mySums[id].CO / factor <<
","
239 <<
mySums[id].HC / factor <<
","
240 <<
mySums[id].PMx / factor << std::endl;
#define WRITE_WARNINGF(...)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
@ SUMO_TAG_VEHICLE
description of a vehicle
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_EMISSIONCLASS
@ SUMO_ATTR_ELECTRICITY_ABS
@ SUMO_ATTR_CO_ABS
MSMeanData_Emissions.
@ SUMO_ATTR_AMOUNT
MSMeanData_Amitran.
@ SUMO_ATTR_TIME
trigger: the time of the step
An upper class for objects with additional parameters.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
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 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::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
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 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 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...
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
SAX-handler base for SUMO-files.
std::map< std::string, double > myLastSlope
const SUMOEmissionClass myDefaultClass
long long int myAttributes
void writeNormedSums(std::ostream &o, const std::string id, const double factor)
void writeOptional(std::ostream &o, long long int attributes, const SumoXMLAttr attr, double v)
std::map< std::string, PollutantsInterface::Emissions > mySums
void writeSums(std::ostream &o, const std::string id)
const double myDefaultSlope
static const int INVALID_VALUE
bool writeXMLEmissions(const std::string id, const SUMOEmissionClass c, EnergyParams *params, SUMOTime t, double &v, double a=INVALID_VALUE, double s=INVALID_VALUE)
std::map< std::string, SUMOEmissionClass > myEmissionClassByVehicle
const bool myAccelZeroCorrection
std::map< std::string, SUMOEmissionClass > myEmissionClassByType
std::map< std::string, double > myLastV
const PollutantsInterface::Emissions computeEmissions(const std::string id, const SUMOEmissionClass c, EnergyParams *params, double &v, double &a, double &s)
~TrajectoriesHandler()
Destructor.
TrajectoriesHandler(const bool computeA, const bool computeAForward, const bool accelZeroCorrection, const SUMOEmissionClass defaultClass, EnergyParams *params, long long int attributes, const double defaultSlope, std::ostream *stdOut, OutputDevice *xmlOut)
Constructor.
const bool myComputeAForward
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called when an opening-tag occurs.
bool writeEmissions(std::ostream &o, const std::string id, const SUMOEmissionClass c, EnergyParams *params, long long int attributes, double t, double &v, double &a, double &s)
Storage for collected values of all emission types.