56 typedTravelDistance.clear();
67 for (std::map<const MSVehicleType*, int>::const_iterator it = typedAmount.begin(); it != typedAmount.end(); ++it) {
70 for (std::map<const MSVehicleType*, double>::const_iterator it = typedSamples.begin(); it != typedSamples.end(); ++it) {
73 for (std::map<const MSVehicleType*, double>::const_iterator it = typedTravelDistance.begin(); it != typedTravelDistance.end(); ++it) {
81 sampleSeconds += timeOnLane;
82 travelledDistance += travelledDistanceVehicleOnLane;
84 typedTravelDistance[&veh.
getVehicleType()] += travelledDistanceVehicleOnLane;
90 if (myParent->vehicleApplies(veh)) {
91 if (getLane() ==
nullptr || getLane() ==
static_cast<MSVehicle&
>(veh).getLane()) {
105 return sampleSeconds == 0 && amount == 0;
111 const int ,
const double ,
const double defaultTravelTime,
const int )
const {
113 if (sampleSeconds > 0) {
114 averageSpeed = int(100 * travelledDistance / sampleSeconds);
115 }
else if (defaultTravelTime >= 0.) {
116 averageSpeed = int(100 * myLaneLength / defaultTravelTime);
123 if (myParent->isTyped()) {
124 for (std::map<const MSVehicleType*, int>::const_iterator it = typedAmount.begin(); it != typedAmount.end(); ++it) {
126 const int typedAvgSpeed = int(100 * typedTravelDistance.find(it->first)->second / typedSamples.find(it->first)->second);
141 const SUMOTime dumpEnd,
const bool useLanes,
142 const std::string& excludeEmpty,
143 const bool withInternal,
144 const bool trackVehicles,
145 const int detectPersons,
146 const double maxTravelTime,
147 const double minSamples,
148 const double haltSpeed,
149 const std::string& vTypes,
150 const std::string& writeAttributes,
151 const std::vector<MSEdge*>& edges,
153 MSMeanData(id, dumpBegin, dumpEnd, useLanes, excludeEmpty,
154 withInternal, trackVehicles, detectPersons, maxTravelTime, minSamples, vTypes, writeAttributes, edges, aggregate),
176 const int duration = int(1000 *
STEPS2TIME(stopTime - startTime) + 0.5);
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::bitset< 96 > SumoXMLAttrMask
AggregateType
Numbers representing special SUMO-XML-attribute values Information on edgeData/laneData output should...
@ SUMO_ATTR_AMOUNT
MSMeanData_Amitran.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
Data structure for mean (aggregated) edge/lane values.
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.
void write(OutputDevice &dev, const SumoXMLAttrMask &attributeMask, const SUMOTime period, const int numLanes, const double speedLimit, const double defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
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.
virtual void writePrefix(OutputDevice &dev, const MeanDataValues &values, const SumoXMLTag tag, const std::string id) const
Writes the surrounding element 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
MSMeanData_Amitran(const std::string &id, const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const std::string &excludeEmpty, 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, const std::vector< MSEdge * > &edges, AggregateType aggregate)
Constructor.
Data collector for edges/lanes.
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.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
OutputDevice & writeOptionalAttr(const SumoXMLAttr attr, const T &val, const SumoXMLAttrMask &attributeMask, const bool isNull=false)
writes a named attribute unless filtered
Representation of a vehicle, person, or container.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.