SUMO - Simulation of Urban MObility
MSE3Collector.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // A detector of vehicles passing an area between entry/exit points
20 /****************************************************************************/
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <algorithm>
28 
29 #include "MSE3Collector.h"
30 #include <microsim/MSNet.h>
31 #include <microsim/MSVehicle.h>
32 
33 //#define DEBUG_E3_NOTIFY_ENTER_AND_LEAVE
34 //#define DEBUG_E3_NOTIFY_MOVE
35 //#define DEBUG_COND(obj) ((obj.getID() == ""))
36 #define DEBUG_COND(obj) (true)
37 #define DEBUG_COND_VEH(veh) (veh.isSelected())
38 
39 // ===========================================================================
40 // method definitions
41 // ===========================================================================
42 /* -------------------------------------------------------------------------
43  * MSE3Collector::MSE3EntryReminder - definitions
44  * ----------------------------------------------------------------------- */
46  const MSCrossSection& crossSection, MSE3Collector& collector) :
47  MSMoveReminder(collector.getID() + "_entry", crossSection.myLane),
48  myCollector(collector), myPosition(crossSection.myPosition) {
49 }
50 
51 bool
53  if (reason != NOTIFICATION_JUNCTION) {
54  const double posOnLane = veh.getBackPositionOnLane(enteredLane) + veh.getVehicleType().getLength();
55  if (posOnLane > myPosition) {
56  // if the vehicle changes into a covered section we assume it was already registred on another lane
57  return false;
58  }
59  }
60  return true;
61 }
62 
63 
64 bool
66  double newPos, double newSpeed) {
67  if (myCollector.myEnteredContainer.find(&veh) == myCollector.myEnteredContainer.end() && newPos > myPosition) {
68  if (oldPos > myPosition) {
69  // was behind the detector already in the last step
70  return false;
71  } else {
72  // entered in this step
73  const double oldSpeed = veh.getPreviousSpeed();
74  const double entryTime = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep());
75  assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); // how could it move across the detector otherwise
76  const double timeBeforeEnter = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed);
77  const double fractionTimeOnDet = TS - timeBeforeEnter;
78  myCollector.enter(veh, entryTime - fractionTimeOnDet, fractionTimeOnDet);
79 #ifdef DEBUG_E3_NOTIFY_MOVE
80  if (DEBUG_COND(myCollector) && DEBUG_COND_VEH(veh)) {
81  std::cout << "\n" << SIMTIME
82  << " MSE3EntryReminder::notifyMove() (" << getDescription() << "on lane '" << myLane->getID() << "')"
83  << " vehicle '" << veh.getID() << "'"
84  << " entered. oldPos=" << oldPos << " newPos=" << newPos << " newSpeed=" << newSpeed << "\n";
85  }
86 #endif
87  }
88  }
89  return true;
90 }
91 
92 
93 bool
96  WRITE_WARNING("Vehicle '" + veh.getID() + "' arrived inside " + toString(SUMO_TAG_E3DETECTOR) + " '" + myCollector.getID() + "'.");
97  myCollector.myEnteredContainer.erase(&veh);
98  return false;
99  }
100  return true;
101 }
102 
103 
104 /* -------------------------------------------------------------------------
105  * MSE3Collector::MSE3LeaveReminder - definitions
106  * ----------------------------------------------------------------------- */
108  const MSCrossSection& crossSection, MSE3Collector& collector) :
109  MSMoveReminder(collector.getID() + "_exit", crossSection.myLane),
110  myCollector(collector), myPosition(crossSection.myPosition) {}
111 
112 
113 bool
115  if (reason != NOTIFICATION_JUNCTION) {
116  const double backPosOnLane = veh.getBackPositionOnLane(enteredLane);
117  if (backPosOnLane > myPosition) {
118  // if the vehicle changes into a covered section we assume it was already registred on another lane
119  // however, if it is not fully past the detector we still need to track it
120  return false;
121  }
122  }
123  return true;
124 }
125 
126 
127 bool
129  double newPos, double newSpeed) {
130  if (newPos < myPosition) {
131  // crossSection not yet reached
132  return true;
133  }
134  const double oldSpeed = veh.getPreviousSpeed();
135  if (oldPos < myPosition) {
136  assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); // how could it move across the detector otherwise
137  const double timeBeforeLeave = MSCFModel::passingTime(oldPos, myPosition, newPos, oldSpeed, newSpeed);
138 // const double leaveTimeFront = SIMTIME - TS + (myPosition - oldPos) / newSpeed;
139  const double leaveTimeFront = SIMTIME - TS + timeBeforeLeave;
140  myCollector.leaveFront(veh, leaveTimeFront);
141 #ifdef DEBUG_E3_NOTIFY_MOVE
142  if (DEBUG_COND(myCollector) && DEBUG_COND_VEH(veh)) {
143  std::cout << "\n" << SIMTIME
144  << " MSE3LeaveReminder::notifyMove() (" << getDescription() << "on lane '" << myLane->getID() << "')"
145  << " vehicle '" << veh.getID() << "'"
146  << " leaveFront. oldPos=" << oldPos << " newPos=" << newPos << " newSpeed=" << newSpeed << "\n";
147  }
148 #endif
149  }
150  const double backPos = newPos - veh.getVehicleType().getLength();
151  if (backPos < myPosition) {
152  // crossSection not yet left
153  return true;
154  }
155  // crossSection left
156  const double oldBackPos = oldPos - veh.getVehicleType().getLength();
157  const double leaveStep = SIMTIME;
158  assert(!MSGlobals::gSemiImplicitEulerUpdate || newSpeed != 0); // how could it move across the detector otherwise
159  const double timeBeforeLeave = MSCFModel::passingTime(oldBackPos, myPosition, backPos, oldSpeed, newSpeed);
160  myCollector.leave(veh, leaveStep - TS + timeBeforeLeave, timeBeforeLeave);
161 #ifdef DEBUG_E3_NOTIFY_MOVE
162  if (DEBUG_COND(myCollector) && DEBUG_COND_VEH(veh)) {
163  std::cout << "\n" << SIMTIME
164  << " MSE3LeaveReminder::notifyMove() (" << getDescription() << "on lane '" << myLane->getID() << "')"
165  << " vehicle '" << veh.getID() << "'"
166  << " left. oldPos=" << oldPos << " newPos=" << newPos << " newSpeed=" << newSpeed << "\n";
167  }
168 #endif
169  return false;
170 }
171 
172 
173 bool
174 MSE3Collector::MSE3LeaveReminder::notifyLeave(SUMOVehicle& veh , double /* lastPos */, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) {
176  return false;
177  }
179  WRITE_WARNING("Vehicle '" + veh.getID() + "' teleported from " + toString(SUMO_TAG_E3DETECTOR) + " '" + myCollector.getID() + "'.");
180  myCollector.myEnteredContainer.erase(&veh);
181  return false;
182  }
183  return true;
184 }
185 
186 /* -------------------------------------------------------------------------
187  * MSE3Collector - definitions
188  * ----------------------------------------------------------------------- */
189 MSE3Collector::MSE3Collector(const std::string& id,
190  const CrossSectionVector& entries,
191  const CrossSectionVector& exits,
192  double haltingSpeedThreshold,
193  SUMOTime haltingTimeThreshold,
194  const std::string& vTypes,
195  bool openEntry) :
196  MSDetectorFileOutput(id, vTypes), myEntries(entries), myExits(exits),
197  myHaltingTimeThreshold(haltingTimeThreshold), myHaltingSpeedThreshold(haltingSpeedThreshold),
199  myOpenEntry(openEntry) {
200  // Set MoveReminders to entries and exits
201  for (CrossSectionVectorConstIt crossSec1 = entries.begin(); crossSec1 != entries.end(); ++crossSec1) {
202  myEntryReminders.push_back(new MSE3EntryReminder(*crossSec1, *this));
203  }
204  for (CrossSectionVectorConstIt crossSec2 = exits.begin(); crossSec2 != exits.end(); ++crossSec2) {
205  myLeaveReminders.push_back(new MSE3LeaveReminder(*crossSec2, *this));
206  }
207  reset();
208 }
209 
210 
212  for (std::vector<MSE3EntryReminder*>::iterator i = myEntryReminders.begin(); i != myEntryReminders.end(); ++i) {
213  delete *i;
214  }
215  for (std::vector<MSE3LeaveReminder*>::iterator i = myLeaveReminders.begin(); i != myLeaveReminders.end(); ++i) {
216  delete *i;
217  }
218 }
219 
220 
221 void
223  myLeftContainer.clear();
224 }
225 
226 
227 
228 void
229 MSE3Collector::enter(const SUMOVehicle& veh, const double entryTimestep, const double fractionTimeOnDet) {
230  if (!vehicleApplies(veh)) {
231  return;
232  }
233  if (myEnteredContainer.find(&veh) != myEnteredContainer.end()) {
234  WRITE_WARNING("Vehicle '" + veh.getID() + "' reentered " + toString(SUMO_TAG_E3DETECTOR) + " '" + getID() + "'.");
235  return;
236  }
237  const double speedFraction = veh.getSpeed() * fractionTimeOnDet;
238  E3Values v;
239  v.entryTime = entryTimestep;
240  v.frontLeaveTime = 0;
241  v.backLeaveTime = 0;
242  v.speedSum = speedFraction;
243  v.haltingBegin = veh.getSpeed() < myHaltingSpeedThreshold ? entryTimestep : -1;
244  v.intervalSpeedSum = entryTimestep >= STEPS2TIME(myLastResetTime) ? speedFraction : 0;
245  v.haltings = 0;
246  v.intervalHaltings = 0;
247  if (veh.getSpeed() < myHaltingSpeedThreshold) {
248  if (fractionTimeOnDet > myHaltingTimeThreshold) {
249  v.haltings++;
250  v.intervalHaltings++;
251  }
252  }
253  v.hadUpdate = false;
254  if (!MSGlobals::gUseMesoSim) {
255  v.timeLoss = static_cast<const MSVehicle&>(veh).getTimeLoss();
257  }
258  myEnteredContainer[&veh] = v;
259 }
260 
261 
262 void
263 MSE3Collector::leaveFront(const SUMOVehicle& veh, const double leaveTimestep) {
264  if (!vehicleApplies(veh)) {
265  return;
266  }
267  if (myEnteredContainer.find(&veh) == myEnteredContainer.end()) {
268  if (!myOpenEntry) {
269  WRITE_WARNING("Vehicle '" + veh.getID() + "' left " + toString(SUMO_TAG_E3DETECTOR) + " '" + getID() + "' without entering it.");
270  }
271  } else {
272  myEnteredContainer[&veh].frontLeaveTime = leaveTimestep;
273  }
274 }
275 
276 
277 void
278 MSE3Collector::leave(const SUMOVehicle& veh, const double leaveTimestep, const double fractionTimeOnDet) {
279  if (!vehicleApplies(veh)) {
280  return;
281  }
282  if (myEnteredContainer.find(&veh) == myEnteredContainer.end()) {
283  if (!myOpenEntry) {
284  WRITE_WARNING("Vehicle '" + veh.getID() + "' left " + toString(SUMO_TAG_E3DETECTOR) + " '" + getID() + "' without entering it.");
285  }
286  } else {
287  E3Values values = myEnteredContainer[&veh];
288  values.backLeaveTime = leaveTimestep;
289  const double speedFraction = veh.getSpeed() * (TS - fractionTimeOnDet);
290  values.speedSum -= speedFraction;
291  values.intervalSpeedSum -= speedFraction;
293  // not yet supported
294  values.timeLoss = 0;
295  } else {
296  // timeLoss was initialized when entering
297  values.timeLoss = static_cast<const MSVehicle&>(veh).getTimeLoss() - values.timeLoss;
298  }
299  myEnteredContainer.erase(&veh);
300  myLeftContainer.push_back(values);
301  }
302 }
303 
304 
305 void
307  SUMOTime startTime, SUMOTime stopTime) {
308  dev << " <interval begin=\"" << time2string(startTime) << "\" end=\"" << time2string(stopTime) << "\" " << "id=\"" << myID << "\" ";
309  // collect values about vehicles that have left the area
310  const int vehicleSum = (int) myLeftContainer.size();
311  double meanTravelTime = 0.;
312  double meanOverlapTravelTime = 0.;
313  double meanSpeed = 0.;
314  double meanHaltsPerVehicle = 0.;
315  double meanTimeLoss = 0.;
316  for (const E3Values& values : myLeftContainer) {
317  meanHaltsPerVehicle += (double)values.haltings;
318  meanTravelTime += values.frontLeaveTime - values.entryTime;
319  const double steps = values.backLeaveTime - values.entryTime;
320  meanOverlapTravelTime += steps;
321  meanSpeed += (values.speedSum / steps);
322  meanTimeLoss += STEPS2TIME(values.timeLoss);
323  }
324  meanTravelTime = vehicleSum != 0 ? meanTravelTime / (double)vehicleSum : -1;
325  meanOverlapTravelTime = vehicleSum != 0 ? meanOverlapTravelTime / (double)vehicleSum : -1;
326  meanSpeed = vehicleSum != 0 ? meanSpeed / (double)vehicleSum : -1;
327  meanHaltsPerVehicle = vehicleSum != 0 ? meanHaltsPerVehicle / (double) vehicleSum : -1;
328  meanTimeLoss = vehicleSum != 0 ? meanTimeLoss / (double) vehicleSum : -1;
329  // clear container
330  myLeftContainer.clear();
331 
332  // collect values about vehicles within the container
333  const int vehicleSumWithin = (int) myEnteredContainer.size();
334  double meanSpeedWithin = 0.;
335  double meanDurationWithin = 0.;
336  double meanHaltsPerVehicleWithin = 0.;
337  double meanIntervalSpeedWithin = 0.;
338  double meanIntervalHaltsPerVehicleWithin = 0.;
339  double meanIntervalDurationWithin = 0.;
340  double meanTimeLossWithin = 0.;
341  for (std::map<const SUMOVehicle*, E3Values>::iterator i = myEnteredContainer.begin(); i != myEnteredContainer.end(); ++i) {
342  meanHaltsPerVehicleWithin += (double)(*i).second.haltings;
343  meanIntervalHaltsPerVehicleWithin += (double)(*i).second.intervalHaltings;
344  const double end = (*i).second.backLeaveTime == 0 ? STEPS2TIME(stopTime) : (*i).second.backLeaveTime;
345  const double time = end - (*i).second.entryTime;
346  const double timeWithin = MIN2(time, end - STEPS2TIME(startTime));
347  if (i->second.speedSum > 0.) {
348  meanSpeedWithin += i->second.speedSum / time;
349  }
350  if (i->second.intervalSpeedSum > 0.) {
351  meanIntervalSpeedWithin += i->second.intervalSpeedSum / timeWithin;
352  }
353  meanDurationWithin += time;
354  meanIntervalDurationWithin += timeWithin;
355  // reset interval values
356  (*i).second.intervalHaltings = 0;
357  (*i).second.intervalSpeedSum = 0;
358 
359  if (!MSGlobals::gUseMesoSim) {
360  const SUMOTime currentTimeLoss = static_cast<const MSVehicle*>(i->first)->getTimeLoss();
361  meanTimeLossWithin += STEPS2TIME(currentTimeLoss - (*i).second.intervalTimeLoss);
362  (*i).second.intervalTimeLoss = currentTimeLoss;
363  }
364  }
365  myLastResetTime = stopTime;
366  meanSpeedWithin = vehicleSumWithin != 0 ? meanSpeedWithin / (double) vehicleSumWithin : -1;
367  meanHaltsPerVehicleWithin = vehicleSumWithin != 0 ? meanHaltsPerVehicleWithin / (double) vehicleSumWithin : -1;
368  meanDurationWithin = vehicleSumWithin != 0 ? meanDurationWithin / (double) vehicleSumWithin : -1;
369  meanIntervalSpeedWithin = vehicleSumWithin != 0 ? meanIntervalSpeedWithin / (double) vehicleSumWithin : -1;
370  meanIntervalHaltsPerVehicleWithin = vehicleSumWithin != 0 ? meanIntervalHaltsPerVehicleWithin / (double) vehicleSumWithin : -1;
371  meanIntervalDurationWithin = vehicleSumWithin != 0 ? meanIntervalDurationWithin / (double) vehicleSumWithin : -1;
372  meanTimeLossWithin = vehicleSumWithin != 0 ? meanTimeLossWithin / (double) vehicleSumWithin : -1;
373 
374  // write values
375  dev << "meanTravelTime=\"" << meanTravelTime
376  << "\" meanOverlapTravelTime=\"" << meanOverlapTravelTime
377  << "\" meanSpeed=\"" << meanSpeed
378  << "\" meanHaltsPerVehicle=\"" << meanHaltsPerVehicle
379  << "\" meanTimeLoss=\"" << meanTimeLoss
380  << "\" vehicleSum=\"" << vehicleSum
381  << "\" meanSpeedWithin=\"" << meanSpeedWithin
382  << "\" meanHaltsPerVehicleWithin=\"" << meanHaltsPerVehicleWithin
383  << "\" meanDurationWithin=\"" << meanDurationWithin
384  << "\" vehicleSumWithin=\"" << vehicleSumWithin
385  << "\" meanIntervalSpeedWithin=\"" << meanIntervalSpeedWithin
386  << "\" meanIntervalHaltsPerVehicleWithin=\"" << meanIntervalHaltsPerVehicleWithin
387  << "\" meanIntervalDurationWithin=\"" << meanIntervalDurationWithin
388  << "\" meanTimeLossWithin=\"" << meanTimeLossWithin
389  << "\"/>\n";
390 }
391 
392 
393 void
395  dev.writeXMLHeader("e3Detector", "det_e3_file.xsd");
396 }
397 
398 
399 void
401  myCurrentMeanSpeed = 0;
403  for (std::map<const SUMOVehicle*, E3Values>::iterator pair = myEnteredContainer.begin(); pair != myEnteredContainer.end(); ++pair) {
404  const SUMOVehicle* veh = pair->first;
405  E3Values& values = pair->second;
406  myCurrentMeanSpeed += veh->getSpeed();
407  values.hadUpdate = true;
408  values.speedSum += veh->getSpeed() * TS;
409  values.intervalSpeedSum += veh->getSpeed() * TS;
410  if (veh->getSpeed() < myHaltingSpeedThreshold) {
411  if (values.haltingBegin == -1) {
412  values.haltingBegin = STEPS2TIME(step);
413  }
414  if (step - values.haltingBegin > myHaltingTimeThreshold) {
415  values.haltings++;
416  values.intervalHaltings++;
418  }
419  } else {
420  values.haltingBegin = -1;
421  }
422  }
423  if (myEnteredContainer.size() == 0) {
424  myCurrentMeanSpeed = -1;
425  } else {
427  }
428 }
429 
430 
431 double
433  return myCurrentMeanSpeed;
434 }
435 
436 
437 int
440 }
441 
442 
443 int
445  return (int) myEnteredContainer.size();
446 }
447 
448 
449 std::vector<std::string>
451  std::vector<std::string> ret;
452  for (std::map<const SUMOVehicle*, E3Values>::const_iterator pair = myEnteredContainer.begin(); pair != myEnteredContainer.end(); ++pair) {
453  ret.push_back((*pair).first->getID());
454  }
455  std::sort(ret.begin(), ret.end());
456  return ret;
457 }
458 
459 
460 /****************************************************************************/
461 
double intervalSpeedSum
The sum of registered speeds the vehicle has/had inside the area during the current interval...
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
long long int SUMOTime
Definition: SUMOTime.h:36
bool notifyMove(SUMOVehicle &veh, double, double newPos, double)
Checks whether the vehicle enters.
int haltings
The sum of haltings the vehicle has/had within the area.
int getCurrentHaltingNumber() const
Returns the number of current haltings within the area.
void enter(const SUMOVehicle &veh, const double entryTimestep, const double fractionTimeOnDet)
Called if a vehicle touches an entry-cross-section.
virtual ~MSE3Collector()
Destructor.
A simple description of a position on a lane (crossing of a lane)
std::vector< MSE3EntryReminder * > myEntryReminders
The detector&#39;s built entry reminder.
bool vehicleApplies(const SUMOVehicle &veh) const
Checks whether the detector measures vehicles of the given type.
bool hadUpdate
An internal information whether the update step was performed.
A place on the road net (at a certain lane and position on it) where the E3 area ends.
MSE3EntryReminder(const MSCrossSection &crossSection, MSE3Collector &collector)
Constructor.
The vehicle arrived at a junction.
A place on the road net (at a certain lane and position on it) where the E3 area begins.
Definition: MSE3Collector.h:64
MSLane *const myLane
Lane on which the reminder works.
double myHaltingSpeedThreshold
Speed-threshold to determine if a vehicle is halting.
#define DEBUG_COND_VEH(veh)
Notification
Definition of a vehicle state.
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:67
std::vector< MSCrossSection > CrossSectionVector
double frontLeaveTime
The time the vehicle&#39;s front was crossing the leave line.
double myCurrentMeanSpeed
The current mean speed of known vehicles (inside)
CrossSectionVector::const_iterator CrossSectionVectorConstIt
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:160
SUMOTime myLastResetTime
Information when the last reset has been done.
std::vector< std::string > getCurrentVehicleIDs() const
Returns the number of vehicles within the area.
const std::string & getID() const
Returns the id.
Definition: Named.h:69
std::vector< MSE3LeaveReminder * > myLeaveReminders
The detector&#39;s built exit reminder.
#define TS
Definition: SUMOTime.h:45
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Processes state changes of a vehicle.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:242
#define SIMTIME
Definition: SUMOTime.h:65
double backLeaveTime
The time the vehicle&#39;s back was crossing the leave line.
int myCurrentHaltingsNumber
The current number of haltings (inside)
#define DEBUG_COND(obj)
The vehicle changes lanes (micro only)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
Representation of a vehicle.
Definition: SUMOVehicle.h:60
std::map< const SUMOVehicle *, E3Values > myEnteredContainer
Container for vehicles that have entered the area.
Internal storage for values from a vehicle.
double entryTime
The vehicle&#39;s entry time.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
bool notifyEnter(SUMOVehicle &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
double getCurrentMeanSpeed() const
Returns the mean speed within the area.
SUMOTime myHaltingTimeThreshold
The vehicle arrived at its destination (is deleted)
MSE3Collector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Constructor.
#define STEPS2TIME(x)
Definition: SUMOTime.h:58
T MIN2(T a, T b)
Definition: StdDefs.h:70
const bool myOpenEntry
whether this dector is declared as having incomplete entry detectors
MSE3Collector & myCollector
The parent collector.
Something on a lane to be noticed about vehicle movement.
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double)
Checks whether the vehicle leaves.
MSE3LeaveReminder(const MSCrossSection &crossSection, MSE3Collector &collector)
Constructor.
void leaveFront(const SUMOVehicle &veh, const double leaveTimestep)
Called if a vehicle front passes a leave-cross-section.
void leave(const SUMOVehicle &veh, const double leaveTimestep, const double fractionTimeOnDet)
Called if a vehicle back passes a leave-cross-section.
std::vector< E3Values > myLeftContainer
Container for vehicles that have left the area.
SUMOTime intervalTimeLoss
The timeLoss of the vehicle when entering. Updated to the current timeLoss at interval write...
CrossSectionVector myEntries
The detector&#39;s entries.
double myPosition
The position on the lane.
static double passingTime(const double lastPos, const double passedPos, const double currentPos, const double lastSpeed, const double currentSpeed)
Calculates the time at which the position passedPosition has been passed In case of a ballistic updat...
Definition: MSCFModel.cpp:592
virtual double getBackPositionOnLane(const MSLane *lane) const =0
Get the vehicle&#39;s back position along the given lane.
std::string myID
The name of the object.
Definition: Named.h:121
double speedSum
The sum of registered speeds the vehicle has/had inside the area.
const std::string & getDescription() const
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Processes state changes of a vehicle.
double getLength() const
Get vehicle&#39;s length [m].
void reset()
Resets all generated values to allow computation of next interval.
A detector of vehicles passing an area between entry/exit points.
Definition: MSE3Collector.h:58
bool notifyEnter(SUMOVehicle &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
int intervalHaltings
The sum of haltings the vehicle has/had within the area during the current interval.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:56
int getVehiclesWithin() const
Returns the number of vehicles within the area.
void detectorUpdate(const SUMOTime step)
Computes the detector values in each time step.
virtual double getSpeed() const =0
Returns the vehicle&#39;s current speed.
static bool gUseMesoSim
Definition: MSGlobals.h:91
Representation of a lane in the micro simulation.
Definition: MSLane.h:71
double haltingBegin
Begin time of last halt begin.
virtual double getPreviousSpeed() const =0
Returns the vehicle&#39;s previous speed.
virtual const std::string & getID() const =0
Get the vehicle&#39;s ID.
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Writes collected values into the given stream.
MSE3Collector & myCollector
The parent collector.
SUMOTime timeLoss
The timeLoss of the vehicle when entering. Updated to the actual time loss within the area when leavi...
Base of value-generating classes (detectors)
double myPosition
The position on the lane.
The vehicle is being teleported.
CrossSectionVector myExits
The detector&#39;s exits.
void writeXMLDetectorProlog(OutputDevice &dev) const
Opens the XML-output using "e3Detector" as root element.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle&#39;s type.