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