44 #include <mesosim/MELoop.h>
45 #include <mesosim/MESegment.h>
48 #ifdef CHECK_MEMORY_LEAKS
50 #endif // CHECK_MEMORY_LEAKS
62 const std::set<std::string>*
const vTypes,
65 nVehDeparted(0), nVehArrived(0), nVehEntered(0), nVehLeft(0),
66 nVehVaporized(0), waitSeconds(0),
67 nVehLaneChangeFrom(0), nVehLaneChangeTo(0),
68 vehLengthSum(0), myParent(parent) {}
82 nVehLaneChangeFrom = 0;
85 travelledDistance = 0;
110 sampleSeconds += timeOnLane;
111 travelledDistance += speed * timeOnLane;
113 if (myParent != 0 && speed < myParent->
myHaltSpeed) {
114 waitSeconds += timeOnLane;
121 if (vehicleApplies(veh) && (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane())) {
124 myLastVehicleUpdateValues.erase(&veh);
130 ++nVehLaneChangeFrom;
149 if (vehicleApplies(veh)) {
150 if (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane()) {
167 return sampleSeconds == 0 && nVehDeparted == 0 && nVehArrived == 0 && nVehEntered == 0
168 && nVehLeft == 0 && nVehVaporized == 0 && nVehLaneChangeFrom == 0 && nVehLaneChangeTo == 0;
174 const SUMOReal numLanes,
const SUMOReal defaultTravelTime,
const int numVehicles)
const {
176 if (sampleSeconds > 0) {
179 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
182 if (nVehVaporized > 0) {
183 dev.
writeAttr(
"vaporized", nVehVaporized);
188 if (sampleSeconds > myParent->myMinSamples) {
189 SUMOReal traveltime = myParent->myMaxTravelTime;
190 if (travelledDistance > 0.f) {
191 traveltime =
MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance);
193 if (numVehicles > 0) {
194 dev.
writeAttr(
"traveltime", sampleSeconds / numVehicles).
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
199 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
201 }
else if (defaultTravelTime >= 0.) {
202 dev.
writeAttr(
"traveltime", defaultTravelTime).
writeAttr(
"speed", myLaneLength / defaultTravelTime);
205 .
writeAttr(
"laneChangedFrom", nVehLaneChangeFrom).
writeAttr(
"laneChangedTo", nVehLaneChangeTo);
206 if (nVehVaporized > 0) {
207 dev.
writeAttr(
"vaporized", nVehVaporized);
217 const SUMOTime dumpEnd,
const bool useLanes,
218 const bool withEmpty,
const bool printDefaults,
219 const bool withInternal,
220 const bool trackVehicles,
224 const std::set<std::string> vTypes)
225 :
MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
226 withInternal, trackVehicles, maxTravelTime, minSamples, vTypes),