 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
42 const double defaultSlope, std::ostream* stdOut,
OutputDevice* xmlOut)
43 :
SUMOSAXHandler(
""), myComputeA(computeA), myComputeAForward(computeAForward), myAccelZeroCorrection(accelZeroCorrection), myDefaultClass(defaultClass),
44 myDefaultSlope(defaultSlope), myStdOut(stdOut), myXMLOut(xmlOut), myCurrentTime(-1), myStepSize(
TS) {}
71 WRITE_WARNING(
"Unknown actor configuration '" + acId +
"' for vehicle '" +
id +
"'!");
89 WRITE_WARNING(
"Motion state for unknown vehicle '" +
id +
"'!");
113 double& v,
double& a,
double& s) {
130 throw ProcessError(
"Acceleration information is missing; try running with --compute-a.");
148 double& a,
double& s) {
156 const double nextS = s;
161 o << t <<
";" << v <<
";" << a <<
";" << s <<
";"
162 << e.
CO <<
";" << e.
CO2 <<
";" << e.
HC <<
";" << e.
PMx <<
";"
172 double a,
double s) {
195 o <<
"CO:" <<
mySums[id].CO << std::endl
196 <<
"CO2:" <<
mySums[id].CO2 << std::endl
197 <<
"HC:" <<
mySums[id].HC << std::endl
198 <<
"NOx:" <<
mySums[id].NOx << std::endl
199 <<
"PMx:" <<
mySums[id].PMx << std::endl
200 <<
"fuel:" <<
mySums[id].fuel << std::endl
201 <<
"electricity:" <<
mySums[id].electricity << std::endl;
207 o <<
mySums[id].fuel / factor <<
","
208 <<
mySums[id].electricity / factor <<
","
209 <<
mySums[id].CO2 / factor <<
","
210 <<
mySums[id].NOx / factor <<
","
211 <<
mySums[id].CO / factor <<
","
212 <<
mySums[id].HC / factor <<
","
213 <<
mySums[id].PMx / factor << std::endl;
~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.
#define WRITE_WARNING(msg)
std::map< std::string, SUMOEmissionClass > myEmissionClassByVehicle
const PollutantsInterface::Emissions computeEmissions(const std::string id, const SUMOEmissionClass c, double &v, double &a, double &s)
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SAX-handler base for SUMO-files.
Static storage of an output device and its base (abstract) implementation.
bool writeXMLEmissions(const std::string id, const SUMOEmissionClass c, SUMOTime t, double &v, double a=INVALID_VALUE, double s=INVALID_VALUE)
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
const bool myAccelZeroCorrection
static const int INVALID_VALUE
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
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.
bool writeEmissions(std::ostream &o, const std::string id, const SUMOEmissionClass c, double t, double &v, double &a, double &s)
std::map< std::string, double > myLastSlope
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)
Returns the adapted acceleration value, useful for comparing with external PHEMlight references.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
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.
const double myDefaultSlope
static Emissions computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope, const std::map< int, double > *param=0)
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)
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.
trigger: the time of the step
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::map< std::string, SUMOEmissionClass > myEmissionClassByType
Storage for collected values of all emission types.
const SUMOEmissionClass myDefaultClass
const bool myComputeAForward
std::map< std::string, double > myLastV
void writeSums(std::ostream &o, const std::string id)
void writeNormedSums(std::ostream &o, const std::string id, const double factor)
std::map< std::string, PollutantsInterface::Emissions > mySums
TrajectoriesHandler(const bool computeA, const bool computeAForward, const bool accelZeroCorrection, const SUMOEmissionClass defaultClass, const double defaultSlope, std::ostream *stdOut, OutputDevice *xmlOut)
Constructor.
Encapsulated SAX-Attributes.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called when an opening-tag occurs.