43 #ifdef CHECK_MEMORY_LEAKS
45 #endif // CHECK_MEMORY_LEAKS
53 :
SUMOSAXHandler(
""), myComputeA(computeA), myDefaultClass(defaultClass),
54 myDefaultSlope(defaultSlope), myXMLOut(xmlOut), myCurrentTime(-1) {}
116 throw ProcessError(
"Acceleration information is missing; try running with --compute-a.");
122 mySums[id].addScaled(result);
133 o << t <<
";" << v <<
";" << a <<
";" << s
134 <<
";" << e.
CO <<
";" << e.
CO2 <<
";" << e.
HC <<
";" << e.
PMx <<
";" << e.
NOx <<
";" << e.
fuel << std::endl;
160 o <<
"CO:" <<
mySums[id].CO << std::endl
161 <<
"CO2:" <<
mySums[id].CO2 << std::endl
162 <<
"HC:" <<
mySums[id].HC << std::endl
163 <<
"NOx:" <<
mySums[id].NOx << std::endl
164 <<
"PMx:" <<
mySums[id].PMx << std::endl
165 <<
"fuel:" <<
mySums[id].fuel << std::endl;
void writeEmissions(std::ostream &o, const std::string id, const SUMOEmissionClass c, const SUMOReal t, const SUMOReal v, SUMOReal a=INVALID_VALUE, SUMOReal s=INVALID_VALUE)
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const SUMOEmissionClass myDefaultClass
TrajectoriesHandler(const bool computeA, const SUMOEmissionClass defaultClass, const SUMOReal defaultSlope, OutputDevice *xmlOut)
Constructor.
std::map< std::string, SUMOEmissionClass > myEmissionClassByType
static Emissions computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope)
Returns the amount of all emitted pollutants given the vehicle type and state (in mg/s or ml/s for fu...
std::string time2string(SUMOTime t)
Storage for collected values of all emission types.
the weight of a district's source or sink
SAX-handler base for SUMO-files.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
const PollutantsInterface::Emissions computeEmissions(const std::string id, const SUMOEmissionClass c, const SUMOReal v, SUMOReal &a, SUMOReal &s)
static const int INVALID_VALUE
Encapsulated SAX-Attributes.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called when an opening-tag occurs.
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 std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
void writeXMLEmissions(const std::string id, const SUMOEmissionClass c, const SUMOTime t, const SUMOReal v, SUMOReal a=INVALID_VALUE, SUMOReal s=INVALID_VALUE)
~TrajectoriesHandler()
Destructor.
std::map< std::string, SUMOEmissionClass > myEmissionClassByVehicle
void writeSums(std::ostream &o, const std::string id)
const SUMOReal myDefaultSlope
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
std::map< std::string, SUMOReal > myLastV
std::map< std::string, PollutantsInterface::Emissions > mySums
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.