Eclipse SUMO - Simulation of Urban MObility
MSDevice_Tripinfo.h
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 #ifndef MSDevice_Tripinfo_h
20 #define MSDevice_Tripinfo_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include "MSVehicleDevice.h"
29 #include <utils/common/SUMOTime.h>
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class SUMOVehicle;
35 class SUMOTrafficObject;
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
49 public:
60  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
61 
63  static void generateOutputForUnfinished();
64 
66  static void addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss);
67 
69  static void addRideData(double rideLength, SUMOTime rideDuration, SUMOVehicleClass vClass, const std::string& line, SUMOTime waitingTime);
70 
72  static std::string printStatistics();
73 
75  static double getAvgRouteLength();
76  static double getAvgDuration();
77  static double getAvgWaitingTime();
78  static double getAvgTimeLoss();
79  static double getAvgDepartDelay();
80 
81  static double getAvgWalkRouteLength();
82  static double getAvgWalkDuration();
83  static double getAvgWalkTimeLoss();
84 
85  static double getAvgRideRouteLength();
86  static double getAvgRideWaitingTime();
87  static double getAvgRideDuration();
88 
89 public:
92 
93 
95  static void cleanup();
96 
97 
100 
109  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
110 
111 
120  bool notifyEnter(SUMOTrafficObject& veh, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
121 
122 
131  bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
133 
134 
136  const std::string deviceName() const {
137  return "tripinfo";
138  }
139 
146  void generateOutput() const;
147 
152  void saveState(OutputDevice& out) const;
153 
158  void loadState(const SUMOSAXAttributes& attrs);
159 
160 
161 private:
167  MSDevice_Tripinfo(SUMOVehicle& holder, const std::string& id);
168 
169 
170 protected:
174  void notifyMoveInternal(const SUMOTrafficObject& veh,
175  const double frontOnLane,
176  const double timeOnLane,
177  const double meanSpeedFrontOnLane,
178  const double meanSpeedVehicleOnLane,
179  const double travelledDistanceFrontOnLane,
180  const double travelledDistanceVehicleOnLane,
181  const double /* meanLengthOnLane */);
182 
183 private:
185  std::string myDepartLane;
186 
189 
192 
195 
198 
201 
204 
207 
210 
212  std::string myArrivalLane;
213 
215  double myArrivalPos;
216 
219 
222 
225 
228 
230  static std::set<const MSDevice_Tripinfo*, ComparatorNumericalIdLess> myPendingOutput;
231 
233  static double myVehicleCount;
234  static double myTotalRouteLength;
240 
241  static int myWalkCount;
242  static double myTotalWalkRouteLength;
245 
246  static int myRideCount;
247  static int myRideBusCount;
248  static int myRideRailCount;
249  static int myRideBikeCount;
250  static int myRideAbortCount;
251  static double myTotalRideWaitingTime;
252  static double myTotalRideRouteLength;
254 
255 private:
258 
261 
262 
263 };
264 
265 
266 #endif
267 
268 /****************************************************************************/
269 
static SUMOTime myTotalWalkDuration
static double getAvgRideRouteLength()
static int myRideBikeCount
static SUMOTime myTotalWalkTimeLoss
SUMOTime myArrivalTime
The vehicle&#39;s arrival time.
long long int SUMOTime
Definition: SUMOTime.h:35
static void addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss)
record tripinfo data for pedestrians
static SUMOTime myTotalWaitingTime
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static double myTotalRouteLength
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
static double getAvgTimeLoss()
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
Notification
Definition of a vehicle state.
static void addRideData(double rideLength, SUMOTime rideDuration, SUMOVehicleClass vClass, const std::string &line, SUMOTime waitingTime)
record tripinfo data for rides
MSDevice_Tripinfo(SUMOVehicle &holder, const std::string &id)
Constructor.
~MSDevice_Tripinfo()
Destructor.
static double myVehicleCount
global tripinfo statistics
static SUMOTime myWaitingDepartDelay
SUMOTime myStoppingTime
The overall intentional stopping time.
MSDevice_Tripinfo & operator=(const MSDevice_Tripinfo &)
Invalidated assignment operator.
static double getAvgRideWaitingTime()
static std::set< const MSDevice_Tripinfo *, ComparatorNumericalIdLess > myPendingOutput
devices which may still need to produce output
double myArrivalSpeed
The speed when arriving.
static double getAvgDuration()
SUMOTime myWaitingTime
The overall waiting time.
static double getAvgWalkTimeLoss()
int myWaitingCount
The overall number of unintended stops.
static void generateOutputForUnfinished()
generate output for vehicles which are still in the network
static std::string printStatistics()
get statistics for printing to stdout
Representation of a vehicle.
Definition: SUMOVehicle.h:61
static double getAvgWalkRouteLength()
Encapsulated SAX-Attributes.
SUMOTime myParkingStarted
The time when parking started.
static SUMOTime myTotalDuration
static double myTotalRideWaitingTime
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice *> &into)
Build devices for the given vehicle, if needed.
double myArrivalPosLat
The lateral position on the lane the vehicle arrived at.
static double getAvgWalkDuration()
std::string myDepartLane
The lane the vehicle departed at.
static void cleanup()
resets counters
static SUMOTime myTotalRideDuration
static double getAvgRideDuration()
static double getAvgWaitingTime()
static double myTotalWalkRouteLength
Representation of a vehicle or person.
std::string myArrivalLane
The lane the vehicle arrived at.
const std::string deviceName() const
return the name for this type of device
double myDepartSpeed
The speed on departure.
static SUMOTime myTotalDepartDelay
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
Abstract in-vehicle device.
static double getAvgRouteLength()
accessors for GUINet-Parameters
static double myTotalRideRouteLength
double myRouteLength
The route length.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
static double getAvgDepartDelay()
static int myRideAbortCount
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
static int myRideRailCount
void generateOutput() const
Called on writing tripinfo output.
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() ...
static SUMOTime myTotalTimeLoss
SUMOTime myMesoTimeLoss
The time loss when compared to the desired and allowed speed.
double myDepartPosLat
The lateral depart position.
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
double myArrivalPos
The position on the lane the vehicle arrived at.
void saveState(OutputDevice &out) const
Saves the state of the device.
bool myAmWaiting
Whether the vehicle is currently waiting.