45 #include <mesosim/MELoop.h>
46 #include <mesosim/MESegment.h>
49 #ifdef CHECK_MEMORY_LEAKS
51 #endif // CHECK_MEMORY_LEAKS
63 const std::set<std::string>*
const vTypes,
66 nVehDeparted(0), nVehArrived(0), nVehEntered(0), nVehLeft(0),
67 nVehVaporized(0), waitSeconds(0),
68 nVehLaneChangeFrom(0), nVehLaneChangeTo(0),
69 vehLengthSum(0), myParent(parent) {}
83 nVehLaneChangeFrom = 0;
86 travelledDistance = 0;
111 sampleSeconds += timeOnLane;
112 travelledDistance += speed * timeOnLane;
114 if (myParent != 0 && speed < myParent->
myHaltSpeed) {
115 waitSeconds += timeOnLane;
122 if (vehicleApplies(veh) && (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane())) {
125 myLastVehicleUpdateValues.erase(&veh);
131 ++nVehLaneChangeFrom;
150 if (vehicleApplies(veh)) {
151 if (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane()) {
168 return sampleSeconds == 0 && nVehDeparted == 0 && nVehArrived == 0 && nVehEntered == 0
169 && nVehLeft == 0 && nVehVaporized == 0 && nVehLaneChangeFrom == 0 && nVehLaneChangeTo == 0;
175 const SUMOReal numLanes,
const SUMOReal defaultTravelTime,
const int numVehicles)
const {
177 if (sampleSeconds > 0) {
180 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
183 if (nVehVaporized > 0) {
184 dev.
writeAttr(
"vaporized", nVehVaporized);
189 if (sampleSeconds > myParent->myMinSamples) {
190 SUMOReal traveltime = myParent->myMaxTravelTime;
191 if (travelledDistance > 0.f) {
192 traveltime =
MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance);
194 if (numVehicles > 0) {
195 dev.
writeAttr(
"traveltime", sampleSeconds / numVehicles).
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
200 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
202 }
else if (defaultTravelTime >= 0.) {
203 dev.
writeAttr(
"traveltime", defaultTravelTime).
writeAttr(
"speed", myLaneLength / defaultTravelTime);
206 .
writeAttr(
"laneChangedFrom", nVehLaneChangeFrom).
writeAttr(
"laneChangedTo", nVehLaneChangeTo);
207 if (nVehVaporized > 0) {
208 dev.
writeAttr(
"vaporized", nVehVaporized);
218 const SUMOTime dumpEnd,
const bool useLanes,
219 const bool withEmpty,
const bool printDefaults,
220 const bool withInternal,
221 const bool trackVehicles,
225 const std::set<std::string> vTypes)
226 :
MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
227 withInternal, trackVehicles, maxTravelTime, minSamples, vTypes),