44 #ifdef CHECK_MEMORY_LEAKS 46 #endif // CHECK_MEMORY_LEAKS 54 :
SUMOSAXHandler(
""), myComputeA(computeA), myComputeAForward(computeAForward), myDefaultClass(defaultClass),
55 myDefaultSlope(defaultSlope), myStdOut(stdOut), myXMLOut(xmlOut), myCurrentTime(-1), myStepSize(
TS) {}
82 WRITE_WARNING(
"Unknown actor configuration '" + acId +
"' for vehicle '" +
id +
"'!");
100 WRITE_WARNING(
"Motion state for unknown vehicle '" +
id +
"'!");
138 throw ProcessError(
"Acceleration information is missing; try running with --compute-a.");
165 o << t <<
";" << v <<
";" << a <<
";" << s <<
";" 166 << e.
CO <<
";" << e.
CO2 <<
";" << e.
HC <<
";" << e.
PMx <<
";" 199 o <<
"CO:" <<
mySums[id].CO << std::endl
200 <<
"CO2:" <<
mySums[id].CO2 << std::endl
201 <<
"HC:" <<
mySums[id].HC << std::endl
202 <<
"NOx:" <<
mySums[id].NOx << std::endl
203 <<
"PMx:" <<
mySums[id].PMx << std::endl
204 <<
"fuel:" <<
mySums[id].fuel << std::endl
205 <<
"electricity:" <<
mySums[id].electricity << std::endl;
211 o <<
mySums[id].fuel / factor <<
"," 212 <<
mySums[id].electricity / factor <<
"," 213 <<
mySums[id].CO2 / factor <<
"," 214 <<
mySums[id].NOx / factor <<
"," 215 <<
mySums[id].CO / factor <<
"," 216 <<
mySums[id].HC / factor <<
"," 217 <<
mySums[id].PMx / factor << std::endl;
bool writeXMLEmissions(const std::string id, const SUMOEmissionClass c, SUMOTime t, SUMOReal &v, SUMOReal a=INVALID_VALUE, SUMOReal s=INVALID_VALUE)
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const PollutantsInterface::Emissions computeEmissions(const std::string id, const SUMOEmissionClass c, SUMOReal &v, SUMOReal &a, SUMOReal &s)
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.
bool writeEmissions(std::ostream &o, const std::string id, const SUMOEmissionClass c, SUMOReal t, SUMOReal &v, SUMOReal &a, SUMOReal &s)
#define WRITE_WARNING(msg)
static const int INVALID_VALUE
Encapsulated SAX-Attributes.
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.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
~TrajectoriesHandler()
Destructor.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
std::map< std::string, SUMOEmissionClass > myEmissionClassByVehicle
void writeSums(std::ostream &o, const std::string id)
void writeNormedSums(std::ostream &o, const std::string id, const SUMOReal factor)
const SUMOReal myDefaultSlope
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
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
const bool myComputeAForward
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
TrajectoriesHandler(const bool computeA, const bool computeAForward, const SUMOEmissionClass defaultClass, const SUMOReal defaultSlope, std::ostream *stdOut, OutputDevice *xmlOut)
Constructor.