42 long long int attributes,
const double defaultSlope, std::ostream* stdOut,
OutputDevice* xmlOut) :
76 WRITE_WARNINGF(
TL(
"Unknown actor configuration '%' for vehicle '%'!"), acId,
id);
116const PollutantsInterface::Emissions
119 double& v,
double& a,
double& s) {
133 a = PollutantsInterface::getModifiedAccel(c, v, a, s, params);
136 throw ProcessError(
TL(
"Acceleration information is missing; try running with --compute-a."));
141 const PollutantsInterface::Emissions result = PollutantsInterface::computeAll(c, v, a, s, params);
152 if ((attributes & ((
long long int)1 << attr)) != 0) {
162 long long int attributes,
164 double& a,
double& s) {
172 const double nextS = s;
176 const PollutantsInterface::Emissions e =
computeEmissions(
id, c, params, v, a, s);
199 double a,
double s) {
211 const PollutantsInterface::Emissions e =
computeEmissions(
id, c, params, v, a, s);
212 myXMLOut->openTag(
"vehicle").writeAttr(
"id",
id).writeAttr(
"eclass", PollutantsInterface::getName(c));
213 myXMLOut->writeAttr(
"CO2", e.CO2).writeAttr(
"CO", e.CO).writeAttr(
"HC", e.HC).writeAttr(
"NOx", e.NOx);
214 myXMLOut->writeAttr(
"PMx", e.PMx).writeAttr(
"fuel", e.fuel).writeAttr(
"electricity", e.electricity);
215 myXMLOut->writeAttr(
"speed", v).closeTag();
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.
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.
SUMOSAXHandler(const std::string &file="", const std::string &expectedRoot="")
Constructor.
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)