47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
61 const std::set<std::string>*
const vTypes,
64 nVehDeparted(0), nVehArrived(0), nVehEntered(0), nVehLeft(0),
65 nVehVaporized(0), waitSeconds(0),
66 nVehLaneChangeFrom(0), nVehLaneChangeTo(0),
67 vehLengthSum(0), myParent(parent) {}
81 nVehLaneChangeFrom = 0;
84 travelledDistance = 0;
109 sampleSeconds += timeOnLane;
110 travelledDistance += speed * timeOnLane;
112 if (myParent != 0 && speed < myParent->
myHaltSpeed) {
113 waitSeconds += timeOnLane;
120 if (vehicleApplies(veh) && (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane())) {
122 removeFromVehicleUpdateValues(veh);
127 ++nVehLaneChangeFrom;
144 if (vehicleApplies(veh)) {
145 if (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane()) {
162 return sampleSeconds == 0 && nVehDeparted == 0 && nVehArrived == 0 && nVehEntered == 0
163 && nVehLeft == 0 && nVehVaporized == 0 && nVehLaneChangeFrom == 0 && nVehLaneChangeTo == 0;
169 const SUMOReal numLanes,
const SUMOReal defaultTravelTime,
const int numVehicles)
const {
171 if (sampleSeconds > 0) {
174 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
177 if (nVehVaporized > 0) {
178 dev.
writeAttr(
"vaporized", nVehVaporized);
183 if (sampleSeconds > myParent->myMinSamples) {
184 SUMOReal traveltime = myParent->myMaxTravelTime;
185 if (travelledDistance > 0.f) {
186 traveltime =
MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance);
188 if (numVehicles > 0) {
189 dev.
writeAttr(
"traveltime", sampleSeconds / numVehicles).
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
194 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
196 }
else if (defaultTravelTime >= 0.) {
197 dev.
writeAttr(
"traveltime", defaultTravelTime).
writeAttr(
"speed", myLaneLength / defaultTravelTime);
200 .
writeAttr(
"laneChangedFrom", nVehLaneChangeFrom).
writeAttr(
"laneChangedTo", nVehLaneChangeTo);
201 if (nVehVaporized > 0) {
202 dev.
writeAttr(
"vaporized", nVehVaporized);
212 const SUMOTime dumpEnd,
const bool useLanes,
213 const bool withEmpty,
const bool printDefaults,
214 const bool withInternal,
215 const bool trackVehicles,
219 const std::set<std::string> vTypes)
220 :
MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
221 withInternal, trackVehicles, maxTravelTime, minSamples, vTypes),
Data collector for edges/lanes.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
virtual ~MSLaneMeanDataValues()
Destructor.
MSLaneMeanDataValues(MSLane *const lane, const SUMOReal length, const bool doAdd, const std::set< std::string > *const vTypes=0, const MSMeanData_Net *parent=0)
Constructor.
void write(OutputDevice &dev, const SUMOTime period, const SUMOReal numLanes, const SUMOReal defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
unsigned nVehVaporized
The number of vehicles that left this lane within the sample interval.
The vehicle arrived at a junction.
SUMOReal travelledDistance
The sum of the distances the vehicles travelled.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
Notification
Definition of a vehicle state.
SUMOReal getLength() const
Get vehicle's length [m].
MSMeanData_Net(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 SUMOReal maxTravelTime, const SUMOReal minSamples, const SUMOReal haltSpeed, const std::set< std::string > vTypes)
Constructor.
The vehicle got vaporized.
The vehicle changes the segment (meso only)
unsigned nVehLaneChangeFrom
The number of vehicles that changed from this lane.
const std::set< std::string > myVehicleTypes
The vehicle types to look for (empty means all)
Data structure for mean (aggregated) edge/lane values.
SUMOReal waitSeconds
The number of vehicle probes with small speed.
The vehicle changes lanes (micro only)
SUMOReal vehLengthSum
The sum of the lengths the vehicles had.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Computes current values and adds them to their sums.
Representation of a vehicle.
Data structure for mean (aggregated) edge/lane values.
void notifyMoveInternal(SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
Internal notification about the vehicle moves.
unsigned nVehArrived
The number of vehicles that finished on the lane.
unsigned nVehLaneChangeTo
The number of vehicles that changed to this lane.
unsigned nVehEntered
The number of vehicles that entered this lane within the sample interval.
virtual ~MSMeanData_Net()
Destructor.
The vehicle arrived at its destination (is deleted)
bool isEmpty() const
Returns whether any data was collected.
const SUMOReal myHaltSpeed
the minimum sample seconds
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Called if the vehicle leaves the reminder's lane.
The vehicle has departed (was inserted into the network)
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const SUMOReal length, const bool doAdd) const
Create an instance of MeanDataValues.
unsigned nVehLeft
The number of vehicles that left this lane within the sample interval.
Static storage of an output device and its base (abstract) implementation.
Network state mean data collector for edges/lanes.
bool closeTag()
Closes the most recently opened tag.
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
Representation of a lane in the micro simulation.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.