44 #ifdef CHECK_MEMORY_LEAKS 46 #endif // CHECK_MEMORY_LEAKS 54 :
SUMOSAXHandler(
""), myComputeA(computeA), myDefaultClass(defaultClass),
55 myDefaultSlope(defaultSlope), myStdOut(stdOut), myXMLOut(xmlOut), myCurrentTime(-1), myStepSize(
TS) {}
79 WRITE_WARNING(
"Unknown actor configuration '" + acId +
"' for vehicle '" +
id +
"'!");
97 WRITE_WARNING(
"Motion state for unknown vehicle '" +
id +
"'!");
131 throw ProcessError(
"Acceleration information is missing; try running with --compute-a.");
151 o << t <<
";" << v <<
";" << a <<
";" << s
152 <<
";" << e.
CO <<
";" << e.
CO2 <<
";" << e.
HC <<
";" << e.
PMx <<
";" << e.
NOx <<
";" << e.
fuel << std::endl;
178 o <<
"CO:" <<
mySums[id].CO << std::endl
179 <<
"CO2:" <<
mySums[id].CO2 << std::endl
180 <<
"HC:" <<
mySums[id].HC << std::endl
181 <<
"NOx:" <<
mySums[id].NOx << std::endl
182 <<
"PMx:" <<
mySums[id].PMx << std::endl
183 <<
"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
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...
#define WRITE_WARNING(msg)
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.
TrajectoriesHandler(const bool computeA, const SUMOEmissionClass defaultClass, const SUMOReal defaultSlope, std::ostream *stdOut, OutputDevice *xmlOut)
Constructor.
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.
T get(int attr, const char *objectid, bool &ok, 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.