44 #ifdef CHECK_MEMORY_LEAKS
46 #endif // CHECK_MEMORY_LEAKS
59 myJamHaltingSpeedThreshold(haltingSpeedThreshold),
60 myJamHaltingTimeThreshold(haltingTimeThreshold),
61 myJamDistanceThreshold(jamDistThreshold),
62 myStartPos(startPos), myEndPos(startPos + detLength),
64 myCurrentOccupancy(0), myCurrentMeanSpeed(-1), myCurrentJamNo(0),
65 myCurrentMaxJamLengthInMeters(0), myCurrentMaxJamLengthInVehicles(0),
66 myCurrentJamLengthInMeters(0), myCurrentJamLengthInVehicles(0), myCurrentStartedHalts(0),
67 myCurrentHaltingsNumber(0)
71 assert(
myStartPos >= 0 && myStartPos < myLane->getLength());
166 std::map<const SUMOVehicle*, SUMOTime> haltingVehicles;
167 std::map<const SUMOVehicle*, SUMOTime> intervalHaltingVehicles;
168 std::vector<JamInfo*> jams;
206 bool isInJam =
false;
217 haltingVehicles[veh] =
DELTA_T;
218 intervalHaltingVehicles[veh] =
DELTA_T;
245 if (currentJam == 0) {
256 jams.push_back(currentJam);
265 if (currentJam != 0) {
266 jams.push_back(currentJam);
271 if (currentJam != 0) {
272 jams.push_back(currentJam);
281 for (std::vector<JamInfo*>::iterator i = jams.begin(); i != jams.end(); ++i) {
284 (*(*i)->firstStandingVehicle)->getPositionOnLane()
285 - (*(*i)->lastStandingVehicle)->getPositionOnLane()
286 + (*(*i)->lastStandingVehicle)->getVehicleType().getLengthWithGap();
288 if (occ && occ == *(*i)->firstStandingVehicle && occ != *(*i)->lastStandingVehicle) {
290 - (*(*i)->lastStandingVehicle)->getPositionOnLane()
291 + (*(*i)->lastStandingVehicle)->getVehicleType().getLengthWithGap();
293 unsigned jamLengthInVehicles = (unsigned) distance((*i)->firstStandingVehicle, (*i)->lastStandingVehicle) + 1;
328 for (std::vector<JamInfo*>::iterator i = jams.begin(); i != jams.end(); ++i) {
338 dev <<
" <interval begin=\"" <<
time2string(startTime) <<
"\" end=\"" <<
time2string(stopTime) <<
"\" " <<
"id=\"" <<
getID() <<
"\" ";
348 unsigned haltingNo = 0;
350 haltingDurationSum += (*i);
351 maxHaltingDuration =
MAX2(maxHaltingDuration, (*i));
355 haltingDurationSum += (*i).second;
356 maxHaltingDuration =
MAX2(maxHaltingDuration, (*i).second);
359 const SUMOTime meanHaltingDuration = haltingNo != 0 ? haltingDurationSum / haltingNo : 0;
361 SUMOTime intervalHaltingDurationSum = 0;
362 SUMOTime intervalMaxHaltingDuration = 0;
363 unsigned intervalHaltingNo = 0;
365 intervalHaltingDurationSum += (*i);
366 intervalMaxHaltingDuration =
MAX2(intervalMaxHaltingDuration, (*i));
370 intervalHaltingDurationSum += (*i).second;
371 intervalMaxHaltingDuration =
MAX2(intervalMaxHaltingDuration, (*i).second);
374 const SUMOTime intervalMeanHaltingDuration = intervalHaltingNo != 0 ? intervalHaltingDurationSum / intervalHaltingNo : 0;
377 <<
"meanSpeed=\"" << meanSpeed <<
"\" "
378 <<
"meanOccupancy=\"" << meanOccupancy <<
"\" "
380 <<
"meanMaxJamLengthInVehicles=\"" << meanJamLengthInVehicles <<
"\" "
381 <<
"meanMaxJamLengthInMeters=\"" << meanJamLengthInMeters <<
"\" "
386 <<
"meanHaltingDuration=\"" <<
STEPS2TIME(meanHaltingDuration) <<
"\" "
387 <<
"maxHaltingDuration=\"" <<
STEPS2TIME(maxHaltingDuration) <<
"\" "
388 <<
"haltingDurationSum=\"" <<
STEPS2TIME(haltingDurationSum) <<
"\" "
389 <<
"meanIntervalHaltingDuration=\"" <<
STEPS2TIME(intervalMeanHaltingDuration) <<
"\" "
390 <<
"maxIntervalHaltingDuration=\"" <<
STEPS2TIME(intervalMaxHaltingDuration) <<
"\" "
391 <<
"intervalHaltingDurationSum=\"" <<
STEPS2TIME(intervalHaltingDurationSum) <<
"\" "
393 <<
"meanVehicleNumber=\"" << meanVehicleNumber <<
"\" "
402 dev.
writeXMLHeader(
"detector",
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/det_e2_file.xsd\"");
484 std::vector<std::string>
486 std::vector<std::string> ret;
489 ret.push_back(veh->
getID());
491 std::sort(ret.begin(), ret.end());