56 typedTravelDistance.clear();
66 for (std::map<const MSVehicleType*, int>::const_iterator it = typedAmount.begin(); it != typedAmount.end(); ++it) {
69 for (std::map<const MSVehicleType*, double>::const_iterator it = typedSamples.begin(); it != typedSamples.end(); ++it) {
72 for (std::map<const MSVehicleType*, double>::const_iterator it = typedTravelDistance.begin(); it != typedTravelDistance.end(); ++it) {
80 sampleSeconds += timeOnLane;
81 travelledDistance += travelledDistanceVehicleOnLane;
83 typedTravelDistance[&veh.
getVehicleType()] += travelledDistanceVehicleOnLane;
89 if (myParent->vehicleApplies(veh)) {
90 if (getLane() ==
nullptr || getLane() ==
static_cast<MSVehicle&
>(veh).getLane()) {
104 return sampleSeconds == 0 && amount == 0;
110 const double ,
const double defaultTravelTime,
const int )
const {
112 if (sampleSeconds > 0) {
113 averageSpeed = int(100 * travelledDistance / sampleSeconds);
114 }
else if (defaultTravelTime >= 0.) {
115 averageSpeed = int(100 * myLaneLength / defaultTravelTime);
122 if (myParent->isTyped()) {
123 for (std::map<const MSVehicleType*, int>::const_iterator it = typedAmount.begin(); it != typedAmount.end(); ++it) {
125 const int averageSpeed = int(100 * typedTravelDistance.find(it->first)->second / typedSamples.find(it->first)->second);
140 const SUMOTime dumpEnd,
const bool useLanes,
141 const bool withEmpty,
const bool printDefaults,
142 const bool withInternal,
143 const bool trackVehicles,
145 const double maxTravelTime,
146 const double minSamples,
147 const double haltSpeed,
148 const std::string& vTypes,
149 const std::string& writeAttributes) :
150 MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
151 withInternal, trackVehicles,
detectPersons, maxTravelTime, minSamples, vTypes, writeAttributes),
173 const int duration = int(1000 *
STEPS2TIME(stopTime - startTime) + 0.5);
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_ATTR_AMOUNT
MSMeanData_Amitran.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool detectPersons() const
A road/street connecting two junctions.
int getNumericalID() const
Returns the numerical id of the edge.
Representation of a lane in the micro simulation.
Data structure for mean (aggregated) edge/lane values.
double travelledDistance
The sum of the distances the vehicles travelled.
virtual bool isEmpty() const
Returns whether any data was collected.
Data structure for mean (aggregated) edge/lane values.
void write(OutputDevice &dev, long long int attributeMask, const SUMOTime period, const double numLanes, const double defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
void notifyMoveInternal(const SUMOTrafficObject &veh, const double, const double timeOnLane, const double, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double)
Internal notification about the vehicle moves.
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Amitran *parent)
Constructor.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
bool isEmpty() const
Returns whether any data was collected.
std::map< const MSVehicleType *, double > typedTravelDistance
The sum of the distances the vehicles travelled by type.
std::map< const MSVehicleType *, int > typedAmount
The number of vehicles that entered this lane within the sample interval by type.
virtual ~MSLaneMeanDataValues()
Destructor.
std::map< const MSVehicleType *, double > typedSamples
The number of sampled vehicle movements by type (in s)
Network state mean data collector for edges/lanes.
virtual void openInterval(OutputDevice &dev, const SUMOTime startTime, const SUMOTime stopTime)
Writes the interval opener.
virtual void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "netstats" as root element.
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.
MSMeanData_Amitran(const std::string &id, const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes, const std::string &writeAttributes)
Constructor.
virtual bool writePrefix(OutputDevice &dev, const MeanDataValues &values, const SumoXMLTag tag, const std::string id) const
Checks for emptiness and writes prefix into the given stream.
virtual std::string getEdgeID(const MSEdge *const edge)
Return the relevant edge id.
virtual ~MSMeanData_Amitran()
Destructor.
const double myHaltSpeed
the minimum sample seconds
Data collector for edges/lanes.
const bool myDumpEmpty
Whether empty lanes/edges shall be written.
Notification
Definition of a vehicle state.
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
Representation of a vehicle in the micro simulation.
Static storage of an output device and its base (abstract) implementation.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Representation of a vehicle, person, or container.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.