SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSE2Collector.cpp
Go to the documentation of this file.
1 /****************************************************************************/
13 // An areal (along a single lane) detector
14 /****************************************************************************/
15 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
16 // Copyright (C) 2014 DLR (http://www.dlr.de/) and contributors
17 /****************************************************************************/
18 //
19 // This file is part of SUMO.
20 // SUMO is free software: you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation, either version 3 of the License, or
23 // (at your option) any later version.
24 //
25 /****************************************************************************/
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <cassert>
38 #include <algorithm>
39 #include "MSE2Collector.h"
40 #include <microsim/MSLane.h>
41 #include <microsim/MSVehicle.h>
42 #include <microsim/MSVehicleType.h>
43 
44 #ifdef CHECK_MEMORY_LEAKS
45 #include <foreign/nvwa/debug_new.h>
46 #endif // CHECK_MEMORY_LEAKS
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
52 MSE2Collector::MSE2Collector(const std::string& id, DetectorUsage usage,
53  MSLane* const lane, SUMOReal startPos, SUMOReal detLength,
54  SUMOTime haltingTimeThreshold,
55  SUMOReal haltingSpeedThreshold,
56  SUMOReal jamDistThreshold) :
57  MSMoveReminder(id, lane),
59  myJamHaltingSpeedThreshold(haltingSpeedThreshold),
60  myJamHaltingTimeThreshold(haltingTimeThreshold),
61  myJamDistanceThreshold(jamDistThreshold),
62  myStartPos(startPos), myEndPos(startPos + detLength),
63  myUsage(usage),
64  myCurrentOccupancy(0), myCurrentMeanSpeed(-1), myCurrentJamNo(0),
65  myCurrentMaxJamLengthInMeters(0), myCurrentMaxJamLengthInVehicles(0),
66  myCurrentJamLengthInMeters(0), myCurrentJamLengthInVehicles(0), myCurrentStartedHalts(0),
67  myCurrentHaltingsNumber(0)
68 
69 {
70  assert(myLane != 0);
71  assert(myStartPos >= 0 && myStartPos < myLane->getLength());
72  assert(myEndPos - myStartPos > 0 && myEndPos <= myLane->getLength());
73  reset();
74 }
75 
76 
78  myKnownVehicles.clear();
79 }
80 
81 
82 bool
84  SUMOReal newPos, SUMOReal) {
85  if (newPos <= myStartPos) {
86  // detector not yet reached
87  return true;
88  }
89  if (newPos > myStartPos && oldPos <= myStartPos) {
90  assert(find(myKnownVehicles.begin(), myKnownVehicles.end(), &veh) == myKnownVehicles.end());
91  myKnownVehicles.push_back(&veh);
92  }
93  if (newPos - veh.getVehicleType().getLength() > myEndPos) {
94  std::list<SUMOVehicle*>::iterator i = find(myKnownVehicles.begin(), myKnownVehicles.end(), &veh);
95  assert(i != myKnownVehicles.end());
96  myKnownVehicles.erase(i);
97  return false;
98  }
99  return true;
100 }
101 
102 
103 bool
105  if (reason != MSMoveReminder::NOTIFICATION_JUNCTION || (lastPos > myStartPos && lastPos - veh.getVehicleType().getLength() < myEndPos)) {
106  std::list<SUMOVehicle*>::iterator i = find(myKnownVehicles.begin(), myKnownVehicles.end(), &veh);
107  if (i != myKnownVehicles.end()) {
108  myKnownVehicles.erase(i);
109  }
110  return false;
111  }
112  return true;
113 }
114 
115 
116 bool
118  if (!veh.isOnRoad()) {
119  // vehicle is teleporting over the edge
120  return false;
121  }
122  if (veh.getPositionOnLane() - veh.getVehicleType().getLength() >= myEndPos) {
123  // vehicle is beyond the detector
124  return false;
125  }
127  // the junction case is handled in the notifyMove
128  // vehicle is on the detector, being already beyond was checked before
129  myKnownVehicles.push_back(&veh);
130  }
131  // vehicle is in front of the detector
132  return true;
133 }
134 
135 
136 void
138  mySpeedSum = 0;
139  myStartedHalts = 0;
142  myVehicleSamples = 0;
143  myOccupancySum = 0;
144  myMaxOccupancy = 0;
147  myMaxJamInVehicles = 0;
148  myMaxJamInMeters = 0;
149  myTimeSamples = 0;
151  myMaxVehicleNumber = 0;
152  for (std::map<const SUMOVehicle*, SUMOTime>::iterator i = myIntervalHaltingVehicleDurations.begin(); i != myIntervalHaltingVehicleDurations.end(); ++i) {
153  (*i).second = 0;
154  }
155  myPastStandingDurations.clear();
157 }
158 
159 
160 
161 void
163  JamInfo* currentJam = 0;
164  std::map<const SUMOVehicle*, SUMOTime> haltingVehicles;
165  std::map<const SUMOVehicle*, SUMOTime> intervalHaltingVehicles;
166  std::vector<JamInfo*> jams;
167 
168  SUMOReal lengthSum = 0;
169  myCurrentMeanSpeed = 0;
173 
174  // go through the (sorted) list of vehicles positioned on the detector
175  // sum up values and prepare the list of jams
177  for (std::list<SUMOVehicle*>::const_iterator i = myKnownVehicles.begin(); i != myKnownVehicles.end(); ++i) {
178  const MSVehicle* const veh = static_cast<MSVehicle*>(*i);
179 
180  SUMOReal length = veh->getVehicleType().getLength();
181  if (veh->getLane() == getLane()) {
182  if (veh->getPositionOnLane() - veh->getVehicleType().getLength() < myStartPos) {
183  // vehicle entered detector partially
184  length -= (veh->getVehicleType().getLength() - (veh->getPositionOnLane() - myStartPos));
185  }
186  if (veh->getPositionOnLane() > myEndPos && veh->getPositionOnLane() - veh->getVehicleType().getLength() <= myEndPos) {
187  // vehicle left detector partially
188  length -= (veh->getPositionOnLane() - myEndPos);
189  }
190  } else {
191  // ok, the vehicle is only partially still on the detector, has already moved to the
192  // next lane; still, we do not know how far away it is
193  assert(veh == myLane->getPartialOccupator());
194  length = myEndPos - myLane->getPartialOccupatorEnd();
195  }
196  assert(length >= 0);
197 
198  mySpeedSum += veh->getSpeed();
199  myCurrentMeanSpeed += veh->getSpeed();
200  lengthSum += length;
201  myCurrentMeanLength += length;
202 
203  // jam-checking begins
204  bool isInJam = false;
205  // first, check whether the vehicle is slow enough to be states as halting
206  if (veh->getSpeed() < myJamHaltingSpeedThreshold) {
208  // we have to track the time it was halting;
209  // so let's look up whether it was halting before and compute the overall halting time
210  bool wasHalting = myHaltingVehicleDurations.find(veh) != myHaltingVehicleDurations.end();
211  if (wasHalting) {
212  haltingVehicles[veh] = myHaltingVehicleDurations[veh] + DELTA_T;
213  intervalHaltingVehicles[veh] = myIntervalHaltingVehicleDurations[veh] + DELTA_T;
214  } else {
215  haltingVehicles[veh] = DELTA_T;
216  intervalHaltingVehicles[veh] = DELTA_T;
218  myStartedHalts++;
219  }
220  // we now check whether the halting time is large enough
221  if (haltingVehicles[veh] > myJamHaltingTimeThreshold) {
222  // yep --> the vehicle is a part of a jam
223  isInJam = true;
224  }
225  } else {
226  // is not standing anymore; keep duration information
227  std::map<const SUMOVehicle*, SUMOTime>::iterator v = myHaltingVehicleDurations.find(veh);
228  if (v != myHaltingVehicleDurations.end()) {
229  myPastStandingDurations.push_back((*v).second);
230  myHaltingVehicleDurations.erase(v);
231  }
232  v = myIntervalHaltingVehicleDurations.find(veh);
233  if (v != myIntervalHaltingVehicleDurations.end()) {
234  myPastIntervalStandingDurations.push_back((*v).second);
236  }
237  }
238 
239  // jam-building
240  if (isInJam) {
241  // the vehicle is in a jam;
242  // it may be a new one or already an existing one
243  if (currentJam == 0) {
244  // the vehicle is the first vehicle in a jam
245  currentJam = new JamInfo();
246  currentJam->firstStandingVehicle = i;
247  } else {
248  // ok, we have a jam already. But - maybe it is too far away
249  // ... honestly, I can hardly find a reason for doing this,
250  // but jams were defined this way in an earlier version...
251  if (veh->getPositionOnLane() - (*currentJam->lastStandingVehicle)->getPositionOnLane() > myJamDistanceThreshold) {
252  // yep, yep, yep - it's a new one...
253  // close the frist, build a new
254  jams.push_back(currentJam);
255  currentJam = new JamInfo;
256  currentJam->firstStandingVehicle = i;
257  }
258  }
259  currentJam->lastStandingVehicle = i;
260  } else {
261  // the vehicle is not part of a jam...
262  // maybe we have to close an already computed jam
263  if (currentJam != 0) {
264  jams.push_back(currentJam);
265  currentJam = 0;
266  }
267  }
268  }
269  if (currentJam != 0) {
270  jams.push_back(currentJam);
271  currentJam = 0;
272  }
273 
278  // process jam information
279  for (std::vector<JamInfo*>::iterator i = jams.begin(); i != jams.end(); ++i) {
280  // compute current jam's values
281  SUMOReal jamLengthInMeters =
282  (*(*i)->firstStandingVehicle)->getPositionOnLane()
283  - (*(*i)->lastStandingVehicle)->getPositionOnLane()
284  + (*(*i)->lastStandingVehicle)->getVehicleType().getLengthWithGap();
285  const MSVehicle* const occ = myLane->getPartialOccupator();
286  if (occ && occ == *(*i)->firstStandingVehicle && occ != *(*i)->lastStandingVehicle) {
287  jamLengthInMeters = myLane->getPartialOccupatorEnd() + occ->getVehicleType().getLengthWithGap()
288  - (*(*i)->lastStandingVehicle)->getPositionOnLane()
289  + (*(*i)->lastStandingVehicle)->getVehicleType().getLengthWithGap();
290  }
291  unsigned jamLengthInVehicles = (unsigned) distance((*i)->firstStandingVehicle, (*i)->lastStandingVehicle) + 1;
292  // apply them to the statistics
295  myJamLengthInMetersSum += jamLengthInMeters;
296  myJamLengthInVehiclesSum += jamLengthInVehicles;
297  myCurrentJamLengthInMeters += jamLengthInMeters;
298  myCurrentJamLengthInVehicles += jamLengthInVehicles;
299  }
300  myCurrentJamNo = (unsigned) jams.size();
301 
302  const unsigned numVehicles = (unsigned) myKnownVehicles.size();
303  myVehicleSamples += numVehicles;
304  myTimeSamples += 1;
305  // compute occupancy values
306  SUMOReal currentOccupancy = lengthSum / (myEndPos - myStartPos) * (SUMOReal) 100.;
307  myCurrentOccupancy = currentOccupancy;
308  myOccupancySum += currentOccupancy;
309  myMaxOccupancy = MAX2(myMaxOccupancy, currentOccupancy);
310  // compute jam values
315  // save information about halting vehicles
316  myHaltingVehicleDurations = haltingVehicles;
317  myIntervalHaltingVehicleDurations = intervalHaltingVehicles;
318  // compute information about vehicle numbers
319  myMeanVehicleNumber += numVehicles;
321  // norm current values
322  myCurrentMeanSpeed = numVehicles != 0 ? myCurrentMeanSpeed / (SUMOReal) numVehicles : -1;
323  myCurrentMeanLength = numVehicles != 0 ? myCurrentMeanLength / (SUMOReal) numVehicles : -1;
324 
325  // clean up
326  for (std::vector<JamInfo*>::iterator i = jams.begin(); i != jams.end(); ++i) {
327  delete *i;
328  }
329  jams.clear();
330 }
331 
332 
333 
334 void
336  dev << " <interval begin=\"" << time2string(startTime) << "\" end=\"" << time2string(stopTime) << "\" " << "id=\"" << getID() << "\" ";
337 
338  const SUMOReal meanSpeed = myVehicleSamples != 0 ? mySpeedSum / (SUMOReal) myVehicleSamples : -1;
339  const SUMOReal meanOccupancy = myTimeSamples != 0 ? myOccupancySum / (SUMOReal) myTimeSamples : 0;
340  const SUMOReal meanJamLengthInMeters = myTimeSamples != 0 ? myMeanMaxJamInMeters / (SUMOReal) myTimeSamples : 0;
341  const SUMOReal meanJamLengthInVehicles = myTimeSamples != 0 ? myMeanMaxJamInVehicles / (SUMOReal) myTimeSamples : 0;
342  const SUMOReal meanVehicleNumber = myTimeSamples != 0 ? (SUMOReal) myMeanVehicleNumber / (SUMOReal) myTimeSamples : 0;
343 
344  SUMOTime haltingDurationSum = 0;
345  SUMOTime maxHaltingDuration = 0;
346  unsigned haltingNo = 0;
347  for (std::vector<SUMOTime>::iterator i = myPastStandingDurations.begin(); i != myPastStandingDurations.end(); ++i) {
348  haltingDurationSum += (*i);
349  maxHaltingDuration = MAX2(maxHaltingDuration, (*i));
350  haltingNo++;
351  }
352  for (std::map<const SUMOVehicle*, SUMOTime> ::iterator i = myHaltingVehicleDurations.begin(); i != myHaltingVehicleDurations.end(); ++i) {
353  haltingDurationSum += (*i).second;
354  maxHaltingDuration = MAX2(maxHaltingDuration, (*i).second);
355  haltingNo++;
356  }
357  const SUMOTime meanHaltingDuration = haltingNo != 0 ? haltingDurationSum / haltingNo : 0;
358 
359  SUMOTime intervalHaltingDurationSum = 0;
360  SUMOTime intervalMaxHaltingDuration = 0;
361  unsigned intervalHaltingNo = 0;
362  for (std::vector<SUMOTime>::iterator i = myPastIntervalStandingDurations.begin(); i != myPastIntervalStandingDurations.end(); ++i) {
363  intervalHaltingDurationSum += (*i);
364  intervalMaxHaltingDuration = MAX2(intervalMaxHaltingDuration, (*i));
365  intervalHaltingNo++;
366  }
367  for (std::map<const SUMOVehicle*, SUMOTime> ::iterator i = myIntervalHaltingVehicleDurations.begin(); i != myIntervalHaltingVehicleDurations.end(); ++i) {
368  intervalHaltingDurationSum += (*i).second;
369  intervalMaxHaltingDuration = MAX2(intervalMaxHaltingDuration, (*i).second);
370  intervalHaltingNo++;
371  }
372  const SUMOTime intervalMeanHaltingDuration = intervalHaltingNo != 0 ? intervalHaltingDurationSum / intervalHaltingNo : 0;
373 
374  dev << "nSamples=\"" << myVehicleSamples << "\" "
375  << "meanSpeed=\"" << meanSpeed << "\" "
376  << "meanOccupancy=\"" << meanOccupancy << "\" "
377  << "maxOccupancy=\"" << myMaxOccupancy << "\" "
378  << "meanMaxJamLengthInVehicles=\"" << meanJamLengthInVehicles << "\" "
379  << "meanMaxJamLengthInMeters=\"" << meanJamLengthInMeters << "\" "
380  << "maxJamLengthInVehicles=\"" << myMaxJamInVehicles << "\" "
381  << "maxJamLengthInMeters=\"" << myMaxJamInMeters << "\" "
382  << "jamLengthInVehiclesSum=\"" << myJamLengthInVehiclesSum << "\" "
383  << "jamLengthInMetersSum=\"" << myJamLengthInMetersSum << "\" "
384  << "meanHaltingDuration=\"" << STEPS2TIME(meanHaltingDuration) << "\" "
385  << "maxHaltingDuration=\"" << STEPS2TIME(maxHaltingDuration) << "\" "
386  << "haltingDurationSum=\"" << STEPS2TIME(haltingDurationSum) << "\" "
387  << "meanIntervalHaltingDuration=\"" << STEPS2TIME(intervalMeanHaltingDuration) << "\" "
388  << "maxIntervalHaltingDuration=\"" << STEPS2TIME(intervalMaxHaltingDuration) << "\" "
389  << "intervalHaltingDurationSum=\"" << STEPS2TIME(intervalHaltingDurationSum) << "\" "
390  << "startedHalts=\"" << myStartedHalts << "\" "
391  << "meanVehicleNumber=\"" << meanVehicleNumber << "\" "
392  << "maxVehicleNumber=\"" << myMaxVehicleNumber << "\" "
393  << "/>\n";
394  reset();
395 }
396 
397 
398 void
400  dev.writeXMLHeader("detector", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo.dlr.de/xsd/det_e2_file.xsd\"");
401 }
402 
403 
404 unsigned
406  return (unsigned) myKnownVehicles.size();
407 }
408 
409 
410 SUMOReal
412  return myCurrentOccupancy * (SUMOReal) 100.;
413 }
414 
415 
416 SUMOReal
418  return myCurrentMeanSpeed;
419 }
420 
421 
422 SUMOReal
424  return myCurrentMeanLength;
425 }
426 
427 
428 unsigned
430  return myCurrentJamNo;
431 }
432 
433 
434 unsigned
437 }
438 
439 
440 SUMOReal
443 }
444 
445 
446 unsigned
449 }
450 
451 
452 SUMOReal
455 }
456 
457 
458 unsigned
460  return myCurrentStartedHalts;
461 }
462 
463 
464 int
466  const MSVehicle* const occ = myLane->getPartialOccupator();
467  if (v1 == occ) {
468  return true;
469  }
470  if (v2 == occ) {
471  return false;
472  }
473  return v1->getPositionOnLane() > v2->getPositionOnLane();
474 }
475 
476 int
479 }
480 
481 
482 std::vector<std::string>
484  std::vector<std::string> ret;
485  for (std::list<SUMOVehicle*>::const_iterator i = myKnownVehicles.begin(); i != myKnownVehicles.end(); ++i) {
486  MSVehicle* veh = static_cast<MSVehicle*>(*i);
487  ret.push_back(veh->getID());
488  }
489  std::sort(ret.begin(), ret.end());
490  return ret;
491 }
492 
493 /****************************************************************************/
494 
std::map< const SUMOVehicle *, SUMOTime > myHaltingVehicleDurations
Storage for halting durations of known vehicles (for halting vehicles)
std::vector< SUMOTime > myPastIntervalStandingDurations
Halting durations of ended halts for the current interval [s].
std::vector< std::string > getCurrentVehicleIDs() const
Returns the IDs of the vehicles within the area.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
unsigned myCurrentJamNo
The current jam number.
unsigned getCurrentJamNumber() const
Returns the current number of jams.
SUMOReal myMaxJamInMeters
The max jam length [m].
unsigned getCurrentStartedHalts() const
Returns the length of all jams in meters.
virtual ~MSE2Collector()
Destructor.
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
SUMOReal getCurrentMeanLength() const
Returns the mean vehicle length of vehicles currently on the detector.
The vehicle arrived at a junction.
Internal representation of a jam.
MSLane *const myLane
Lane on which the reminder works.
unsigned getCurrentMaxJamLengthInVehicles() const
Returns the length in vehicles of the currently largest jam.
virtual SUMOReal getPositionOnLane() const =0
Get the vehicle's position along the lane.
SUMOReal myStartedHalts
The number of started halts [#].
Notification
Definition of a vehicle state.
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:61
SUMOReal getLength() const
Get vehicle's length [m].
A class used to sort known vehicles by their position.
T MAX2(T a, T b)
Definition: StdDefs.h:74
std::vector< SUMOTime > myPastStandingDurations
Halting durations of ended halts [s].
unsigned myMaxVehicleNumber
The max number of vehicles [#veh].
SUMOReal getCurrentJamLengthInMeters() const
Returns the length of all jams in meters.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:286
SUMOReal myCurrentMeanLength
The current mean length.
unsigned myCurrentStartedHalts
The number of started halts in the last step.
const MSLane * getLane() const
Returns the lane the reminder works on.
SUMOReal getPartialOccupatorEnd() const
Returns the position of the in-lapping vehicle's end.
Definition: MSLane.h:261
bool writeXMLHeader(const std::string &rootElement, const std::string &attrs="", const std::string &comment="")
Writes an XML header with optional configuration.
const std::string & getID() const
Returns the id.
Definition: Named.h:60
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Adds the vehicle to known vehicles if not beyond the dector.
unsigned myVehicleSamples
The number of collected samples [#].
Representation of a vehicle.
Definition: SUMOVehicle.h:65
std::list< SUMOVehicle * > myKnownVehicles
List of known vehicles.
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
SUMOReal getCurrentMeanSpeed() const
Returns the mean vehicle speed of vehicles currently on the detector.
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
Something on a lane to be noticed about vehicle movement.
SUMOReal myJamHaltingSpeedThreshold
A vehicle must driver slower than this to be counted as a part of a jam.
unsigned myCurrentJamLengthInVehicles
The overall jam length in vehicles.
SUMOTime myJamHaltingTimeThreshold
A vehicle must be that long beyond myJamHaltingSpeedThreshold to be counted as a part of a jam...
SUMOReal mySpeedSum
The sum of collected vehicle speeds [m/s].
unsigned myMeanVehicleNumber
The mean number of vehicles [#veh].
SUMOReal myCurrentMaxJamLengthInMeters
the current maximum jam length in meters
unsigned myMeanMaxJamInVehicles
The mean jam length [#veh].
SUMOReal myCurrentJamLengthInMeters
The overall jam length in meters.
std::list< SUMOVehicle * >::const_iterator firstStandingVehicle
The first standing vehicle.
SUMOReal myStartPos
The position the detector starts at.
unsigned myMaxJamInVehicles
The max jam length [#veh].
void detectorUpdate(const SUMOTime step)
Computes the detector values in each time step.
SUMOReal myEndPos
The position the detector ends at.
SUMOReal myCurrentOccupancy
The current occupancy.
SUMOReal myMaxOccupancy
The maximum occupancy [%].
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Adds/removes vehicles from the list of vehicles to regard.
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Writes collected values into the given stream.
SUMOReal getCurrentOccupancy() const
Returns the curent detector occupancy.
SUMOReal myCurrentMeanSpeed
The current mean speed.
void reset()
Resets all values.
unsigned myTimeSamples
The current aggregation duration [#steps].
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:90
unsigned getCurrentVehicleNumber() const
Returns the number of vehicles currently on the detector.
SUMOReal myMeanMaxJamInMeters
The mean jam length [m].
SUMOReal myOccupancySum
The sum of occupancies [%].
const MSLane *const myLane
The lane the detector is placed at.
SUMOReal getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:294
int SUMOTime
Definition: SUMOTime.h:43
MSE2Collector(const std::string &id, DetectorUsage usage, MSLane *const lane, SUMOReal startPos, SUMOReal detLength, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Constructor.
std::list< SUMOVehicle * >::const_iterator lastStandingVehicle
The last standing vehicle.
unsigned myCurrentMaxJamLengthInVehicles
The current maximum jam length in vehicles.
SUMOReal myJamLengthInMetersSum
The sum of jam lengths [m].
SUMOReal getCurrentMaxJamLengthInMeters() const
Returns the length in meters of the currently largest jam.
MSVehicle * getPartialOccupator() const
Returns the vehicle which laps into this lane.
Definition: MSLane.h:253
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
int myCurrentHaltingsNumber
The number of halted vehicles [#].
unsigned getCurrentJamLengthInVehicles() const
Returns the length of all jams in vehicles.
#define SUMOReal
Definition: config.h:218
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Removes a known vehicle due to its lane-change.
std::map< const SUMOVehicle *, SUMOTime > myIntervalHaltingVehicleDurations
Storage for halting durations of known vehicles (current interval)
#define DELTA_T
Definition: SUMOTime.h:50
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:331
int getCurrentHaltingNumber() const
Returns the number of current haltings within the area.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
int operator()(const SUMOVehicle *v1, const SUMOVehicle *v2)
Comparison funtcion.
Base of value-generating classes (detectors)
const std::string & getID() const
Returns the name of the vehicle.
SUMOReal myJamDistanceThreshold
Two standing vehicles must be closer than this to be counted into the same jam.
unsigned myJamLengthInVehiclesSum
The sum of jam lengths [#veh].
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "detector" as root element.