Eclipse SUMO - Simulation of Urban MObility
MSDevice_Tripinfo.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2009-2019 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 /****************************************************************************/
17 // A device which collects info on the vehicle trip
18 /****************************************************************************/
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <microsim/MSGlobals.h>
26 #include <microsim/MSNet.h>
27 #include <microsim/MSLane.h>
28 #include <microsim/MSEdge.h>
29 #include <microsim/MSVehicle.h>
31 #include <mesosim/MEVehicle.h>
35 #include "MSDevice_Tripinfo.h"
36 
37 #define NOT_ARRIVED TIME2STEPS(-1)
38 
39 
40 // ===========================================================================
41 // static members
42 // ===========================================================================
43 std::set<const MSDevice_Tripinfo*, ComparatorNumericalIdLess> MSDevice_Tripinfo::myPendingOutput;
44 
52 
57 
66 
67 // ===========================================================================
68 // method definitions
69 // ===========================================================================
70 // ---------------------------------------------------------------------------
71 // static initialisation methods
72 // ---------------------------------------------------------------------------
73 void
75  oc.addOptionSubTopic("Tripinfo Device");
76  insertDefaultAssignmentOptions("tripinfo", "Tripinfo Device", oc);
77 }
78 
79 
80 void
81 MSDevice_Tripinfo::buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into) {
83  const bool enableByOutputOption = oc.isSet("tripinfo-output") || oc.getBool("duration-log.statistics");
84  if (equippedByDefaultAssignmentOptions(oc, "tripinfo", v, enableByOutputOption)) {
85  MSDevice_Tripinfo* device = new MSDevice_Tripinfo(v, "tripinfo_" + v.getID());
86  into.push_back(device);
87  myPendingOutput.insert(device);
88  }
89 }
90 
91 
92 // ---------------------------------------------------------------------------
93 // MSDevice_Tripinfo-methods
94 // ---------------------------------------------------------------------------
95 MSDevice_Tripinfo::MSDevice_Tripinfo(SUMOVehicle& holder, const std::string& id) :
96  MSVehicleDevice(holder, id),
97  myDepartLane(""),
98  myDepartSpeed(-1),
99  myDepartPosLat(0),
100  myWaitingTime(0),
101  myAmWaiting(false),
102  myWaitingCount(0),
103  myStoppingTime(0),
104  myParkingStarted(0),
105  myArrivalTime(NOT_ARRIVED),
106  myArrivalLane(""),
107  myArrivalPos(-1),
108  myArrivalPosLat(0.),
109  myArrivalSpeed(-1),
110  myMesoTimeLoss(0),
111  myRouteLength(0.) {
112 }
113 
114 
116  // ensure clean up for vaporized vehicles which do not generate output
117  myPendingOutput.erase(this);
118 }
119 
120 void
122  myVehicleCount = 0;
123  myTotalRouteLength = 0;
124  myTotalDuration = 0;
125  myTotalWaitingTime = 0;
126  myTotalTimeLoss = 0;
127  myTotalDepartDelay = 0;
129 
130  myWalkCount = 0;
134 
135  myRideCount = 0;
136  myRideBusCount = 0;
137  myRideRailCount = 0;
138  myRideBikeCount = 0;
139  myRideAbortCount = 0;
143 }
144 
145 bool
147  double /*newPos*/, double newSpeed) {
148  if (veh.isStopped()) {
150  } else if (newSpeed <= SUMO_const_haltingSpeed) {
152  if (!myAmWaiting) {
153  myWaitingCount++;
154  myAmWaiting = true;
155  }
156  } else {
157  myAmWaiting = false;
158  }
159  return true;
160 }
161 
162 
163 void
165  const double /* frontOnLane */,
166  const double timeOnLane,
167  const double /* meanSpeedFrontOnLane */,
168  const double meanSpeedVehicleOnLane,
169  const double /* travelledDistanceFrontOnLane */,
170  const double /* travelledDistanceVehicleOnLane */,
171  const double /* meanLengthOnLane */) {
172 
173  // called by meso
174  const MEVehicle* mesoVeh = dynamic_cast<const MEVehicle*>(&veh);
175  assert(mesoVeh);
176  const double vmax = veh.getEdge()->getVehicleMaxSpeed(&veh);
177  if (vmax > 0) {
178  myMesoTimeLoss += TIME2STEPS(timeOnLane * (vmax - meanSpeedVehicleOnLane) / vmax);
179  }
180  myWaitingTime += veh.getWaitingTime();
182 }
183 
184 
185 bool
188  if (!MSGlobals::gUseMesoSim) {
189  myDepartLane = static_cast<MSVehicle&>(veh).getLane()->getID();
190  myDepartPosLat = static_cast<MSVehicle&>(veh).getLateralPositionOnLane();
191  }
192  myDepartSpeed = veh.getSpeed();
194  } else if (reason == MSMoveReminder::NOTIFICATION_PARKING) {
195  // notifyMove is not called while parking
196  // @note insertion delay when resuming after parking is included
198  }
199  return true;
200 }
201 
202 
203 bool
205  MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) {
206  if (reason >= MSMoveReminder::NOTIFICATION_ARRIVED) {
208  if (!MSGlobals::gUseMesoSim) {
209  myArrivalLane = static_cast<MSVehicle&>(veh).getLane()->getID();
210  myArrivalPosLat = static_cast<MSVehicle&>(veh).getLateralPositionOnLane();
211  }
212  // @note vehicle may have moved past its arrivalPos during the last step
213  // due to non-zero arrivalspeed but we consider it as arrived at the desired position
214  // However, vaporization may happen anywhere (via TraCI)
217  } else {
219  }
220  myArrivalSpeed = veh.getSpeed();
221  } else if (reason == MSMoveReminder::NOTIFICATION_PARKING) {
223  } else if (reason == NOTIFICATION_JUNCTION || reason == NOTIFICATION_TELEPORT) {
226  } else {
227  myRouteLength += static_cast<MSVehicle&>(veh).getLane()->getLength();
228  }
229  }
230  return true;
231 }
232 
233 
234 void
236  const SUMOTime timeLoss = MSGlobals::gUseMesoSim ? myMesoTimeLoss : static_cast<MSVehicle&>(myHolder).getTimeLoss();
237  const double routeLength = myRouteLength + (myArrivalTime == NOT_ARRIVED ? myHolder.getPositionOnLane() : myArrivalPos);
239 
240  myVehicleCount++;
241  myTotalRouteLength += routeLength;
242  myTotalDuration += duration;
244  myTotalTimeLoss += timeLoss;
246  if (!OptionsCont::getOptions().isSet("tripinfo-output")) {
247  return;
248  }
249  myPendingOutput.erase(this);
250 
251  // write
252  OutputDevice& os = OutputDevice::getDeviceByOption("tripinfo-output");
253  os.openTag("tripinfo").writeAttr("id", myHolder.getID());
254  os.writeAttr("depart", time2string(myHolder.getDeparture()));
255  os.writeAttr("departLane", myDepartLane);
256  os.writeAttr("departPos", myHolder.getDepartPos());
258  os.writeAttr("departPosLat", myDepartPosLat);
259  }
260  os.writeAttr("departSpeed", myDepartSpeed);
261  os.writeAttr("departDelay", time2string(myHolder.getDepartDelay()));
262  os.writeAttr("arrival", time2string(myArrivalTime));
263  os.writeAttr("arrivalLane", myArrivalLane);
264  os.writeAttr("arrivalPos", myArrivalPos);
266  os.writeAttr("arrivalPosLat", myArrivalPosLat);
267  }
268  os.writeAttr("arrivalSpeed", myArrivalSpeed);
269  os.writeAttr("duration", time2string(duration));
270  os.writeAttr("routeLength", routeLength);
271  os.writeAttr("waitingTime", time2string(myWaitingTime));
272  os.writeAttr("waitingCount", myWaitingCount);
273  os.writeAttr("stopTime", time2string(myStoppingTime));
274  os.writeAttr("timeLoss", time2string(timeLoss));
275  os.writeAttr("rerouteNo", myHolder.getNumberReroutes());
276  os.writeAttr("devices", toString(myHolder.getDevices()));
277  os.writeAttr("vType", myHolder.getVehicleType().getID());
278  os.writeAttr("speedFactor", myHolder.getChosenSpeedFactor());
279  os.writeAttr("vaporized", (myHolder.getEdge() == *(myHolder.getRoute().end() - 1) ? "" : "0"));
280  // cannot close tag because emission device output might follow
281 }
282 
283 
284 void
286  MSNet* net = MSNet::getInstance();
287  const bool writeTripinfos = OptionsCont::getOptions().isSet("tripinfo-output");
289  int undeparted = 0;
290  int departed = 0;
291  const SUMOTime t = net->getCurrentTimeStep();
292  while (myPendingOutput.size() > 0) {
293  const MSDevice_Tripinfo* d = *myPendingOutput.begin();
294  if (d->myHolder.hasDeparted()) {
295  departed++;
296  d->generateOutput();
297  if (writeTripinfos) {
298  // @todo also generate emission output if holder has a device
299  OutputDevice::getDeviceByOption("tripinfo-output").closeTag();
300  } else {
301  myPendingOutput.erase(d);
302  }
303  } else {
304  undeparted++;
306  myPendingOutput.erase(d);
307  }
308  }
309  if (myWaitingDepartDelay > 0) {
310  myWaitingDepartDelay /= undeparted;
311  }
312  // unfinished persons
313  if (net->hasPersons()) {
315  while (pc.loadedBegin() != pc.loadedEnd()) {
316  pc.erase(pc.loadedBegin()->second);
317  }
318  }
319 
320 }
321 
322 
323 void
324 MSDevice_Tripinfo::addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss) {
325  myWalkCount++;
326  myTotalWalkRouteLength += walkLength;
327  myTotalWalkDuration += walkDuration;
328  myTotalWalkTimeLoss += walkTimeLoss;
329 }
330 
331 
332 void
333 MSDevice_Tripinfo::addRideData(double rideLength, SUMOTime rideDuration, SUMOVehicleClass vClass, const std::string& line, SUMOTime waitingTime) {
334  myRideCount++;
335  if (rideDuration > 0) {
336  myTotalRideWaitingTime += waitingTime;
337  myTotalRideRouteLength += rideLength;
338  myTotalRideDuration += rideDuration;
339  if (vClass == SVC_BICYCLE) {
340  myRideBikeCount++;
341  } else if (!line.empty()) {
342  if (isRailway(vClass)) {
343  myRideRailCount++;
344  } else {
345  // some kind of road vehicle
346  myRideBusCount++;
347  }
348  }
349  } else {
351  }
352 }
353 
354 
355 std::string
357  std::ostringstream msg;
358  msg.setf(msg.fixed);
359  msg.precision(gPrecision);
360  msg << "Statistics (avg):\n"
361  << " RouteLength: " << getAvgRouteLength() << "\n"
362  << " Duration: " << getAvgDuration() << "\n"
363  << " WaitingTime: " << getAvgWaitingTime() << "\n"
364  << " TimeLoss: " << getAvgTimeLoss() << "\n"
365  << " DepartDelay: " << getAvgDepartDelay() << "\n";
366  if (myWaitingDepartDelay >= 0) {
367  msg << " DepartDelayWaiting: " << STEPS2TIME(myWaitingDepartDelay) << "\n";
368  }
369  if (myWalkCount > 0) {
370  msg << "Pedestrian Statistics (avg of " << myWalkCount << " walks):\n"
371  << " RouteLength: " << getAvgWalkRouteLength() << "\n"
372  << " Duration: " << getAvgWalkDuration() << "\n"
373  << " TimeLoss: " << getAvgWalkTimeLoss() << "\n";
374  }
375  if (myRideCount > 0) {
376  msg << "Ride Statistics (avg of " << myRideCount << " rides):\n"
377  << " WaitingTime: " << getAvgRideWaitingTime() << "\n"
378  << " RouteLength: " << getAvgRideRouteLength() << "\n"
379  << " Duration: " << getAvgRideDuration() << "\n"
380  << " Bus: " << myRideBusCount << "\n"
381  << " Train: " << myRideRailCount << "\n"
382  << " Bike: " << myRideBikeCount << "\n"
383  << " Aborted: " << myRideAbortCount << "\n";
384  }
385  return msg.str();
386 }
387 
388 
389 double
391  if (myVehicleCount > 0) {
393  } else {
394  return 0;
395  }
396 }
397 
398 double
400  if (myVehicleCount > 0) {
402  } else {
403  return 0;
404  }
405 }
406 
407 double
409  if (myVehicleCount > 0) {
411  } else {
412  return 0;
413  }
414 }
415 
416 
417 double
419  if (myVehicleCount > 0) {
421  } else {
422  return 0;
423  }
424 }
425 
426 
427 double
429  if (myVehicleCount > 0) {
431  } else {
432  return 0;
433  }
434 }
435 
436 
437 double
439  if (myWalkCount > 0) {
441  } else {
442  return 0;
443  }
444 }
445 
446 double
448  if (myWalkCount > 0) {
450  } else {
451  return 0;
452  }
453 }
454 
455 
456 double
458  if (myWalkCount > 0) {
460  } else {
461  return 0;
462  }
463 }
464 
465 
466 double
468  if (myRideCount > 0) {
470  } else {
471  return 0;
472  }
473 }
474 
475 double
477  if (myRideCount > 0) {
479  } else {
480  return 0;
481  }
482 }
483 
484 double
486  if (myRideCount > 0) {
488  } else {
489  return 0;
490  }
491 }
492 
493 
494 void
497  out.writeAttr(SUMO_ATTR_ID, getID());
498  std::vector<std::string> internals;
499  if (!MSGlobals::gUseMesoSim) {
500  internals.push_back(myDepartLane);
501  internals.push_back(toString(myDepartPosLat));
502  }
503  internals.push_back(toString(myDepartSpeed));
504  internals.push_back(toString(myRouteLength));
505  out.writeAttr(SUMO_ATTR_STATE, toString(internals));
506  out.closeTag();
507 }
508 
509 
510 void
512  std::istringstream bis(attrs.getString(SUMO_ATTR_STATE));
513  if (!MSGlobals::gUseMesoSim) {
514  bis >> myDepartLane;
515  bis >> myDepartPosLat;
516  }
517  bis >> myDepartSpeed;
518  bis >> myRouteLength;
519 }
520 
521 
522 /****************************************************************************/
MSDevice_Tripinfo::myTotalDepartDelay
static SUMOTime myTotalDepartDelay
Definition: MSDevice_Tripinfo.h:242
MSDevice_Tripinfo::getAvgRideDuration
static double getAvgRideDuration()
Definition: MSDevice_Tripinfo.cpp:467
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
MEVehicle
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:44
MSDevice_Tripinfo::cleanup
static void cleanup()
resets counters
Definition: MSDevice_Tripinfo.cpp:121
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
MSDevice_Tripinfo::myStoppingTime
SUMOTime myStoppingTime
The overall intentional stopping time.
Definition: MSDevice_Tripinfo.h:207
MSDevice_Tripinfo::getAvgWaitingTime
static double getAvgWaitingTime()
Definition: MSDevice_Tripinfo.cpp:408
SUMOTrafficObject::getWaitingTime
virtual SUMOTime getWaitingTime() const =0
MSVehicleType::getID
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:93
SUMOVehicle::getDepartDelay
virtual SUMOTime getDepartDelay() const =0
MSDevice_Tripinfo::myWaitingCount
int myWaitingCount
The overall number of unintended stops.
Definition: MSDevice_Tripinfo.h:204
MSDevice_Tripinfo::myArrivalSpeed
double myArrivalSpeed
The speed when arriving.
Definition: MSDevice_Tripinfo.h:225
MSNet.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSDevice_Tripinfo::myRouteLength
double myRouteLength
The route length.
Definition: MSDevice_Tripinfo.h:231
MSEdge::getVehicleMaxSpeed
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:889
MSDevice_Tripinfo::myWaitingTime
SUMOTime myWaitingTime
The overall waiting time.
Definition: MSDevice_Tripinfo.h:198
SUMOSAXAttributes::getString
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
MSDevice_Tripinfo::getAvgWalkRouteLength
static double getAvgWalkRouteLength()
Definition: MSDevice_Tripinfo.cpp:438
SUMOVehicle::getParameter
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSDevice_Tripinfo::myDepartSpeed
double myDepartSpeed
The speed on departure.
Definition: MSDevice_Tripinfo.h:192
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:36
MSDevice_Tripinfo::myWalkCount
static int myWalkCount
Definition: MSDevice_Tripinfo.h:245
MSRoute::end
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:75
OptionsCont.h
SUMOTrafficObject::getEdge
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
SUMOTrafficObject::getVehicleType
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
SUMOTrafficObject::getID
virtual const std::string & getID() const =0
Get the vehicle's ID.
MSTransportableControl::erase
virtual void erase(MSTransportable *transportable)
removes a single transportable
Definition: MSTransportableControl.cpp:85
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
MSDevice_Tripinfo::myDepartPosLat
double myDepartPosLat
The lateral depart position.
Definition: MSDevice_Tripinfo.h:195
MSDevice_Tripinfo::myArrivalPos
double myArrivalPos
The position on the lane the vehicle arrived at.
Definition: MSDevice_Tripinfo.h:219
MSDevice_Tripinfo::myRideRailCount
static int myRideRailCount
Definition: MSDevice_Tripinfo.h:252
MSDevice_Tripinfo::loadState
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
Definition: MSDevice_Tripinfo.cpp:511
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
SVC_BICYCLE
vehicle is a bicycle
Definition: SUMOVehicleClass.h:179
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
MSDevice_Tripinfo::myParkingStarted
SUMOTime myParkingStarted
The time when parking started.
Definition: MSDevice_Tripinfo.h:210
MSDevice_Tripinfo::saveState
void saveState(OutputDevice &out) const
Saves the state of the device.
Definition: MSDevice_Tripinfo.cpp:495
MSNet::hasPersons
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:353
MEVehicle::getCurrentStoppingTimeSeconds
double getCurrentStoppingTimeSeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
Definition: MEVehicle.cpp:275
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:90
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
MSEdge.h
MSDevice_Tripinfo::myArrivalTime
SUMOTime myArrivalTime
The vehicle's arrival time.
Definition: MSDevice_Tripinfo.h:213
MSDevice_Tripinfo::myMesoTimeLoss
SUMOTime myMesoTimeLoss
The time loss when compared to the desired and allowed speed.
Definition: MSDevice_Tripinfo.h:228
MSVehicleDevice::myHolder
SUMOVehicle & myHolder
The vehicle that stores the device.
Definition: MSVehicleDevice.h:84
MSDevice_Tripinfo::myTotalRideDuration
static SUMOTime myTotalRideDuration
Definition: MSDevice_Tripinfo.h:257
MSEdge::getLength
double getLength() const
return the length of the edge
Definition: MSEdge.h:589
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:482
SUMO_const_haltingSpeed
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:60
MSGlobals::gLateralResolution
static double gLateralResolution
Definition: MSGlobals.h:84
MSVehicle.h
MSDevice_Tripinfo::addPedestrianData
static void addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss)
record tripinfo data for pedestrians
Definition: MSDevice_Tripinfo.cpp:324
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
MSMoveReminder::NOTIFICATION_VAPORIZED
The vehicle got vaporized.
Definition: MSMoveReminder.h:109
MSDevice_Tripinfo::getAvgRideRouteLength
static double getAvgRideRouteLength()
Definition: MSDevice_Tripinfo.cpp:485
MSTransportableControl
Definition: MSTransportableControl.h:51
SUMOTrafficObject::getChosenSpeedFactor
virtual double getChosenSpeedFactor() const =0
MSDevice_Tripinfo::getAvgWalkDuration
static double getAvgWalkDuration()
Definition: MSDevice_Tripinfo.cpp:447
MSDevice_Tripinfo
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Tripinfo.h:47
SUMOVehicle::getDeparture
virtual SUMOTime getDeparture() const =0
Returns this vehicle's real departure time.
SUMOVehicle::getRoute
virtual const MSRoute & getRoute() const =0
Returns the current route.
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
MSDevice_Tripinfo::insertOptions
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Tripinfo-options.
Definition: MSDevice_Tripinfo.cpp:74
MSDevice_Tripinfo::myTotalRouteLength
static double myTotalRouteLength
Definition: MSDevice_Tripinfo.h:238
MSDevice_Tripinfo::notifyEnter
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
Definition: MSDevice_Tripinfo.cpp:186
MSDevice::insertDefaultAssignmentOptions
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc, const bool isPerson=false)
Adds common command options that allow to assign devices to vehicles.
Definition: MSDevice.cpp:126
MSDevice_Tripinfo::getAvgTimeLoss
static double getAvgTimeLoss()
Definition: MSDevice_Tripinfo.cpp:418
MSDevice_Tripinfo::notifyLeave
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
Definition: MSDevice_Tripinfo.cpp:204
MSTransportableControl.h
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:58
MSDevice_Tripinfo::myArrivalLane
std::string myArrivalLane
The lane the vehicle arrived at.
Definition: MSDevice_Tripinfo.h:216
MSDevice_Tripinfo::buildVehicleDevices
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice_Tripinfo.cpp:81
MSDevice_Tripinfo::myTotalRideRouteLength
static double myTotalRideRouteLength
Definition: MSDevice_Tripinfo.h:256
MSDevice_Tripinfo::getAvgRouteLength
static double getAvgRouteLength()
accessors for GUINet-Parameters
Definition: MSDevice_Tripinfo.cpp:390
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
MSDevice_Tripinfo::myRideAbortCount
static int myRideAbortCount
Definition: MSDevice_Tripinfo.h:254
MSDevice_Tripinfo::notifyMove
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
Definition: MSDevice_Tripinfo.cpp:146
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
OutputDevice.h
isRailway
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
Definition: SUMOVehicleClass.cpp:363
SUMO_TAG_DEVICE
Definition: SUMOXMLDefinitions.h:271
MSTransportableControl::loadedBegin
constVehIt loadedBegin() const
Returns the begin of the internal transportables map.
Definition: MSTransportableControl.h:149
time2string
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:67
MSDevice_Tripinfo::myTotalTimeLoss
static SUMOTime myTotalTimeLoss
Definition: MSDevice_Tripinfo.h:241
MSGlobals.h
MSDevice_Tripinfo::myVehicleCount
static double myVehicleCount
global tripinfo statistics
Definition: MSDevice_Tripinfo.h:237
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
MSDevice_Tripinfo::notifyMoveInternal
void notifyMoveInternal(const SUMOTrafficObject &veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double)
Internal notification about the vehicle moves, see MSMoveReminder::notifyMoveInternal()
Definition: MSDevice_Tripinfo.cpp:164
SIMSTEP
#define SIMSTEP
Definition: SUMOTime.h:62
MSDevice_Tripinfo::myPendingOutput
static std::set< const MSDevice_Tripinfo *, ComparatorNumericalIdLess > myPendingOutput
devices which may still need to produce output
Definition: MSDevice_Tripinfo.h:234
MSMoveReminder::NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
Definition: MSMoveReminder.h:93
MSDevice_Tripinfo::getAvgDepartDelay
static double getAvgDepartDelay()
Definition: MSDevice_Tripinfo.cpp:428
MSDevice_Tripinfo::myRideBusCount
static int myRideBusCount
Definition: MSDevice_Tripinfo.h:251
OptionsCont::addOptionSubTopic
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
Definition: OptionsCont.cpp:519
MSDevice_Tripinfo::generateOutput
void generateOutput() const
Called on writing tripinfo output.
Definition: MSDevice_Tripinfo.cpp:235
NOT_ARRIVED
#define NOT_ARRIVED
Definition: MSDevice_Tripinfo.cpp:37
MSDevice_Tripinfo::myRideBikeCount
static int myRideBikeCount
Definition: MSDevice_Tripinfo.h:253
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
MSDevice_Tripinfo::generateOutputForUnfinished
static void generateOutputForUnfinished()
generate output for vehicles which are still in the network
Definition: MSDevice_Tripinfo.cpp:285
SUMO_ATTR_STATE
The state of a link.
Definition: SUMOXMLDefinitions.h:708
MSMoveReminder::NOTIFICATION_PARKING
The vehicle starts or ends parking.
Definition: MSMoveReminder.h:105
MSDevice_Tripinfo::getAvgRideWaitingTime
static double getAvgRideWaitingTime()
Definition: MSDevice_Tripinfo.cpp:476
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
MSDevice::equippedByDefaultAssignmentOptions
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, DEVICEHOLDER &v, bool outputOptionSet, const bool isPerson=false)
Determines whether a vehicle should get a certain device.
Definition: MSDevice.h:203
MSTransportableControl::loadedEnd
constVehIt loadedEnd() const
Returns the end of the internal transportables map.
Definition: MSTransportableControl.h:157
MSNet::getPersonControl
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:810
MSDevice_Tripinfo::myAmWaiting
bool myAmWaiting
Whether the vehicle is currently waiting.
Definition: MSDevice_Tripinfo.h:201
SUMOVehicle::hasDeparted
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
MSMoveReminder::NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
Definition: MSMoveReminder.h:107
MSDevice_Tripinfo::printStatistics
static std::string printStatistics()
get statistics for printing to stdout
Definition: MSDevice_Tripinfo.cpp:356
MSDevice_Tripinfo::myTotalWalkDuration
static SUMOTime myTotalWalkDuration
Definition: MSDevice_Tripinfo.h:247
MSDevice_Tripinfo::getAvgWalkTimeLoss
static double getAvgWalkTimeLoss()
Definition: MSDevice_Tripinfo.cpp:457
SUMOVehicle::getNumberReroutes
virtual int getNumberReroutes() const =0
Returns the number of new routes this vehicle got.
MSDevice_Tripinfo::myTotalWalkTimeLoss
static SUMOTime myTotalWalkTimeLoss
Definition: MSDevice_Tripinfo.h:248
MSDevice_Tripinfo::myTotalDuration
static SUMOTime myTotalDuration
Definition: MSDevice_Tripinfo.h:239
SUMOSAXAttributes.h
MEVehicle.h
SUMOVehicle::getArrivalPos
virtual double getArrivalPos() const =0
Returns this vehicle's desired arrivalPos for its current route (may change on reroute)
MSDevice_Tripinfo::myTotalWaitingTime
static SUMOTime myTotalWaitingTime
Definition: MSDevice_Tripinfo.h:240
config.h
MSDevice_Tripinfo.h
MSDevice_Tripinfo::myTotalRideWaitingTime
static double myTotalRideWaitingTime
Definition: MSDevice_Tripinfo.h:255
gPrecision
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:26
SUMOVehicle::getDevices
virtual const std::vector< MSVehicleDevice * > & getDevices() const =0
Returns this vehicle's devices.
MSLane.h
SUMOTrafficObject::getPositionOnLane
virtual double getPositionOnLane() const =0
Get the vehicle's position along the lane.
MSDevice_Tripinfo::MSDevice_Tripinfo
MSDevice_Tripinfo(SUMOVehicle &holder, const std::string &id)
Constructor.
Definition: MSDevice_Tripinfo.cpp:95
MSDevice_Tripinfo::~MSDevice_Tripinfo
~MSDevice_Tripinfo()
Destructor.
Definition: MSDevice_Tripinfo.cpp:115
MSDevice_Tripinfo::myDepartLane
std::string myDepartLane
The lane the vehicle departed at.
Definition: MSDevice_Tripinfo.h:189
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:91
MSDevice_Tripinfo::addRideData
static void addRideData(double rideLength, SUMOTime rideDuration, SUMOVehicleClass vClass, const std::string &line, SUMOTime waitingTime)
record tripinfo data for rides
Definition: MSDevice_Tripinfo.cpp:333
MSMoveReminder::NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
Definition: MSMoveReminder.h:95
SUMOVehicle::getDepartPos
virtual double getDepartPos() const =0
Returns this vehicle's real departure position.
OutputDevice::getDeviceByOption
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
Definition: OutputDevice.cpp:116
MSDevice_Tripinfo::myArrivalPosLat
double myArrivalPosLat
The lateral position on the lane the vehicle arrived at.
Definition: MSDevice_Tripinfo.h:222
MSDevice_Tripinfo::myWaitingDepartDelay
static SUMOTime myWaitingDepartDelay
Definition: MSDevice_Tripinfo.h:243
MSMoveReminder::NOTIFICATION_TELEPORT
The vehicle is being teleported.
Definition: MSMoveReminder.h:103
MSDevice_Tripinfo::myRideCount
static int myRideCount
Definition: MSDevice_Tripinfo.h:250
SUMOTrafficObject::getSpeed
virtual double getSpeed() const =0
Returns the vehicle's current speed.
MSDevice_Tripinfo::myTotalWalkRouteLength
static double myTotalWalkRouteLength
Definition: MSDevice_Tripinfo.h:246
SUMOTrafficObject::isStopped
virtual bool isStopped() const =0
Returns whether the vehicle is at a stop.
MSDevice_Tripinfo::getAvgDuration
static double getAvgDuration()
Definition: MSDevice_Tripinfo.cpp:399
MSVehicleDevice
Abstract in-vehicle device.
Definition: MSVehicleDevice.h:54