41 #ifdef CHECK_MEMORY_LEAKS
43 #endif // CHECK_MEMORY_LEAKS
55 myJamHaltingSpeedThreshold(haltingSpeedThreshold),
56 myJamHaltingTimeThreshold(haltingTimeThreshold),
57 myJamDistanceThreshold(jamDistThreshold),
58 myStartPos(startPos), myEndPos(startPos + detLength),
60 myCurrentOccupancy(0), myCurrentMeanSpeed(-1), myCurrentJamNo(0),
61 myCurrentMaxJamLengthInMeters(0), myCurrentMaxJamLengthInVehicles(0),
62 myCurrentJamLengthInMeters(0), myCurrentJamLengthInVehicles(0), myCurrentStartedHalts(0)
66 assert(
myStartPos >= 0 && myStartPos < myLane->getLength());
157 std::map<SUMOVehicle*, SUMOTime> haltingVehicles;
158 std::map<SUMOVehicle*, SUMOTime> intervalHaltingVehicles;
159 std::vector<JamInfo*> jams;
196 bool isInJam =
false;
206 haltingVehicles[veh] =
DELTA_T;
207 intervalHaltingVehicles[veh] =
DELTA_T;
234 if (currentJam == 0) {
245 jams.push_back(currentJam);
254 if (currentJam != 0) {
255 jams.push_back(currentJam);
260 if (currentJam != 0) {
261 jams.push_back(currentJam);
270 for (std::vector<JamInfo*>::iterator i = jams.begin(); i != jams.end(); ++i) {
273 (*(*i)->firstStandingVehicle)->getPositionOnLane()
274 - (*(*i)->lastStandingVehicle)->getPositionOnLane()
275 + (*(*i)->lastStandingVehicle)->getVehicleType().getLengthWithGap();
277 if (occ && occ == *(*i)->firstStandingVehicle && occ != *(*i)->lastStandingVehicle) {
279 - (*(*i)->lastStandingVehicle)->getPositionOnLane()
280 + (*(*i)->lastStandingVehicle)->getVehicleType().getLengthWithGap();
282 unsigned jamLengthInVehicles = (unsigned) distance((*i)->firstStandingVehicle, (*i)->lastStandingVehicle) + 1;
317 for (std::vector<JamInfo*>::iterator i = jams.begin(); i != jams.end(); ++i) {
327 dev <<
" <interval begin=\"" <<
time2string(startTime) <<
"\" end=\"" <<
time2string(stopTime) <<
"\" " <<
"id=\"" <<
getID() <<
"\" ";
337 unsigned haltingNo = 0;
339 haltingDurationSum += (*i);
340 maxHaltingDuration =
MAX2(maxHaltingDuration, (*i));
344 haltingDurationSum += (*i).second;
345 maxHaltingDuration =
MAX2(maxHaltingDuration, (*i).second);
348 const SUMOTime meanHaltingDuration = haltingNo != 0 ? haltingDurationSum / haltingNo : 0;
350 SUMOTime intervalHaltingDurationSum = 0;
351 SUMOTime intervalMaxHaltingDuration = 0;
352 unsigned intervalHaltingNo = 0;
354 intervalHaltingDurationSum += (*i);
355 intervalMaxHaltingDuration =
MAX2(intervalMaxHaltingDuration, (*i));
359 intervalHaltingDurationSum += (*i).second;
360 intervalMaxHaltingDuration =
MAX2(intervalMaxHaltingDuration, (*i).second);
363 const SUMOTime intervalMeanHaltingDuration = intervalHaltingNo != 0 ? intervalHaltingDurationSum / intervalHaltingNo : 0;
366 <<
"meanSpeed=\"" << meanSpeed <<
"\" "
367 <<
"meanOccupancy=\"" << meanOccupancy <<
"\" "
369 <<
"meanMaxJamLengthInVehicles=\"" << meanJamLengthInVehicles <<
"\" "
370 <<
"meanMaxJamLengthInMeters=\"" << meanJamLengthInMeters <<
"\" "
375 <<
"meanHaltingDuration=\"" <<
STEPS2TIME(meanHaltingDuration) <<
"\" "
376 <<
"maxHaltingDuration=\"" <<
STEPS2TIME(maxHaltingDuration) <<
"\" "
377 <<
"haltingDurationSum=\"" <<
STEPS2TIME(haltingDurationSum) <<
"\" "
378 <<
"meanIntervalHaltingDuration=\"" <<
STEPS2TIME(intervalMeanHaltingDuration) <<
"\" "
379 <<
"maxIntervalHaltingDuration=\"" <<
STEPS2TIME(intervalMaxHaltingDuration) <<
"\" "
380 <<
"intervalHaltingDurationSum=\"" <<
STEPS2TIME(intervalHaltingDurationSum) <<
"\" "
382 <<
"meanVehicleNumber=\"" << meanVehicleNumber <<
"\" "