SUMO - Simulation of Urban MObility
MSDevice_Vehroutes.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-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 /****************************************************************************/
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/MSRoute.h>
31 #include <microsim/MSVehicle.h>
32 #include <microsim/MSVehicleType.h>
37 #include "MSDevice_Vehroutes.h"
38 
39 
40 // ===========================================================================
41 // static member variables
42 // ===========================================================================
46 bool MSDevice_Vehroutes::mySorted = false;
51 std::map<const SUMOTime, int> MSDevice_Vehroutes::myDepartureCounts;
52 std::map<const SUMOTime, std::map<const std::string, std::string> > MSDevice_Vehroutes::myRouteInfos;
53 
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
58 // ---------------------------------------------------------------------------
59 // static initialisation methods
60 // ---------------------------------------------------------------------------
61 void
64  if (oc.isSet("vehroute-output")) {
65  OutputDevice::createDeviceByOption("vehroute-output", "routes", "routes_file.xsd");
66  mySaveExits = oc.getBool("vehroute-output.exit-times");
67  myLastRouteOnly = oc.getBool("vehroute-output.last-route");
68  myDUAStyle = oc.getBool("vehroute-output.dua");
69  mySorted = myDUAStyle || oc.getBool("vehroute-output.sorted");
70  myIntendedDepart = oc.getBool("vehroute-output.intended-depart");
71  myRouteLength = oc.getBool("vehroute-output.route-length");
72  mySkipPTLines = oc.getBool("vehroute-output.skip-ptlines");
74  }
75 }
76 
77 
79 MSDevice_Vehroutes::buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*>& into, int maxRoutes) {
80  if (maxRoutes < std::numeric_limits<int>::max()) {
81  return new MSDevice_Vehroutes(v, "vehroute_" + v.getID(), maxRoutes);
82  }
83  if (OptionsCont::getOptions().isSet("vehroute-output")) {
84  if (myLastRouteOnly) {
85  maxRoutes = 0;
86  }
87  myStateListener.myDevices[&v] = new MSDevice_Vehroutes(v, "vehroute_" + v.getID(), maxRoutes);
88  into.push_back(myStateListener.myDevices[&v]);
89  return myStateListener.myDevices[&v];
90  }
91  return 0;
92 }
93 
94 
95 // ---------------------------------------------------------------------------
96 // MSDevice_Vehroutes::StateListener-methods
97 // ---------------------------------------------------------------------------
98 void
100  if (to == MSNet::VEHICLE_STATE_NEWROUTE) {
101  myDevices[vehicle]->addRoute(info);
102  }
103 }
104 
105 
106 // ---------------------------------------------------------------------------
107 // MSDevice_Vehroutes-methods
108 // ---------------------------------------------------------------------------
109 MSDevice_Vehroutes::MSDevice_Vehroutes(SUMOVehicle& holder, const std::string& id, int maxRoutes) :
110  MSDevice(holder, id),
111  myCurrentRoute(&holder.getRoute()),
112  myMaxRoutes(maxRoutes),
113  myLastSavedAt(0),
114  myDepartLane(-1),
115  myDepartPos(-1),
116  myDepartSpeed(-1),
117  myDepartPosLat(0),
118  myStopOut(false, 2) {
120 }
121 
122 
124  for (std::vector<RouteReplaceInfo>::iterator i = myReplacedRoutes.begin(); i != myReplacedRoutes.end(); ++i) {
125  (*i).route->release();
126  }
129 }
130 
131 
132 bool
135  if (mySorted && myStateListener.myDevices[&veh] == this) {
137  myDepartureCounts[departure]++;
138  }
139  if (!MSGlobals::gUseMesoSim) {
140  myDepartLane = static_cast<MSVehicle&>(veh).getLane()->getIndex();
141  myDepartPosLat = static_cast<MSVehicle&>(veh).getLateralPositionOnLane();
142  }
143  myDepartSpeed = veh.getSpeed();
145  }
146  return mySaveExits;
147 }
148 
149 
150 bool
151 MSDevice_Vehroutes::notifyLeave(SUMOVehicle& veh, double /*lastPos*/, MSMoveReminder::Notification reason, const MSLane* /* enteredLane */) {
152  if (mySaveExits && reason != NOTIFICATION_LANE_CHANGE) {
153  if (reason != NOTIFICATION_TELEPORT && myLastSavedAt == veh.getEdge()) { // need to check this for internal lanes
155  } else if (myLastSavedAt != veh.getEdge()) {
156  myExits.push_back(MSNet::getInstance()->getCurrentTimeStep());
157  myLastSavedAt = veh.getEdge();
158  }
159  }
160  return mySaveExits;
161 }
162 
163 
164 void
166  stop.write(myStopOut);
167 }
168 
169 
170 void
172  if (index == 0 && myReplacedRoutes[index].route->size() == 2 &&
173  myReplacedRoutes[index].route->getEdges().front()->isTazConnector() &&
174  myReplacedRoutes[index].route->getEdges().back()->isTazConnector()) {
175  return;
176  }
177  // check if a previous route shall be written
179  if (index >= 0) {
180  assert((int)myReplacedRoutes.size() > index);
181  if (myDUAStyle) {
182  os.writeAttr(SUMO_ATTR_COST, myReplacedRoutes[index].route->getCosts());
183  }
184  // write edge on which the vehicle was when the route was valid
185  os.writeAttr("replacedOnEdge", (myReplacedRoutes[index].edge ?
186  myReplacedRoutes[index].edge->getID() : ""));
187  // write the reason for replacement
188  os.writeAttr("reason", myReplacedRoutes[index].info);
189 
190  // write the time at which the route was replaced
191  os.writeAttr("replacedAtTime", time2string(myReplacedRoutes[index].time));
192  os.writeAttr(SUMO_ATTR_PROB, "0");
193  os << " edges=\"";
194  // get the route
195  int i = index;
196  while (i > 0 && myReplacedRoutes[i - 1].edge) {
197  i--;
198  }
199  const MSEdge* lastEdge = 0;
200  for (; i < index; ++i) {
201  myReplacedRoutes[i].route->writeEdgeIDs(os, lastEdge, myReplacedRoutes[i].edge);
202  lastEdge = myReplacedRoutes[i].edge;
203  }
204  myReplacedRoutes[index].route->writeEdgeIDs(os, lastEdge);
205  } else {
206  if (myDUAStyle) {
208  }
209  os << " edges=\"";
210  const MSEdge* lastEdge = 0;
211  int numWritten = 0;
212  if (myHolder.getNumberReroutes() > 0) {
213  assert((int)myReplacedRoutes.size() <= myHolder.getNumberReroutes());
214  int i = (int)myReplacedRoutes.size();
215  while (i > 0 && myReplacedRoutes[i - 1].edge) {
216  i--;
217  }
218  for (; i < (int)myReplacedRoutes.size(); ++i) {
219  numWritten += myReplacedRoutes[i].route->writeEdgeIDs(os, lastEdge, myReplacedRoutes[i].edge);
220  lastEdge = myReplacedRoutes[i].edge;
221  }
222  }
223  const MSEdge* upTo = 0;
224  if (mySaveExits) {
225  int remainingWithExitTime = (int)myExits.size() - numWritten;
226  assert(remainingWithExitTime >= 0);
227  assert(remainingWithExitTime <= (int)myCurrentRoute->size());
228  if (remainingWithExitTime < (int)myCurrentRoute->size()) {
229  upTo = *(myCurrentRoute->begin() + remainingWithExitTime);
230  }
231  }
232  myCurrentRoute->writeEdgeIDs(os, lastEdge, upTo);
233  if (mySaveExits) {
234  os << "\" exitTimes=\"";
235  for (std::vector<SUMOTime>::const_iterator it = myExits.begin(); it != myExits.end(); ++it) {
236  if (it != myExits.begin()) {
237  os << " ";
238  }
239  os << time2string(*it);
240  }
241  }
242  }
243  (os << "\"").closeTag();
244 }
245 
246 
247 void
249  writeOutput(true);
250 }
251 
252 
253 void
254 MSDevice_Vehroutes::writeOutput(const bool hasArrived) const {
255  if (mySkipPTLines && myHolder.getParameter().line != "") {
256  return;
257  }
258  OutputDevice& routeOut = OutputDevice::getDeviceByOption("vehroute-output");
259  OutputDevice_String od(routeOut.isBinary(), 1);
262  if (!MSGlobals::gUseMesoSim) {
263  if (tmp.wasSet(VEHPARS_DEPARTLANE_SET)) {
264  tmp.departLaneProcedure = DEPART_LANE_GIVEN;
265  tmp.departLane = myDepartLane;
266  }
267  if (tmp.wasSet(VEHPARS_DEPARTPOSLAT_SET)) {
268  tmp.departPosLatProcedure = DEPART_POSLAT_GIVEN;
269  tmp.departPosLat = myDepartPosLat;
270  }
271  }
272  if (tmp.wasSet(VEHPARS_DEPARTPOS_SET)) {
273  tmp.departPosProcedure = DEPART_POS_GIVEN;
274  tmp.departPos = myDepartPos;
275  }
276  if (tmp.wasSet(VEHPARS_DEPARTSPEED_SET)) {
277  tmp.departSpeedProcedure = DEPART_SPEED_GIVEN;
278  tmp.departSpeed = myDepartSpeed;
279  }
280  const std::string typeID = myHolder.getVehicleType().getID() != DEFAULT_VTYPE_ID ? myHolder.getVehicleType().getID() : "";
281  tmp.write(od, OptionsCont::getOptions(), SUMO_TAG_VEHICLE, typeID);
282  if (hasArrived) {
283  od.writeAttr("arrival", time2string(MSNet::getInstance()->getCurrentTimeStep()));
284  if (myRouteLength) {
285  const bool includeInternalLengths = MSGlobals::gUsingInternalLanes && MSNet::getInstance()->hasInternalLinks();
287  myHolder.getRoute().begin(), myHolder.getCurrentRouteEdge(), includeInternalLengths);
288  od.writeAttr("routeLength", routeLength);
289  }
290  }
291  if (myDUAStyle) {
293  if (routeDist != 0) {
294  const std::vector<const MSRoute*>& routes = routeDist->getVals();
295  unsigned index = 0;
296  while (index < routes.size() && routes[index] != myCurrentRoute) {
297  ++index;
298  }
299  od.openTag(SUMO_TAG_ROUTE_DISTRIBUTION).writeAttr(SUMO_ATTR_LAST, index);
300  const std::vector<double>& probs = routeDist->getProbs();
301  for (int i = 0; i < (int)routes.size(); ++i) {
302  od.setPrecision();
303  od.openTag(SUMO_TAG_ROUTE).writeAttr(SUMO_ATTR_COST, routes[i]->getCosts());
304  od.setPrecision(8);
305  od.writeAttr(SUMO_ATTR_PROB, probs[i]);
306  od.setPrecision();
307  od << " edges=\"";
308  routes[i]->writeEdgeIDs(od, *routes[i]->begin());
309  (od << "\"").closeTag();
310  }
311  od.closeTag();
312  } else {
313  writeXMLRoute(od);
314  }
315  } else {
316  if (myReplacedRoutes.size() > 0) {
317  od.openTag(SUMO_TAG_ROUTE_DISTRIBUTION);
318  for (int i = 0; i < (int)myReplacedRoutes.size(); ++i) {
319  writeXMLRoute(od, i);
320  }
321  }
322  writeXMLRoute(od);
323  if (myReplacedRoutes.size() > 0) {
324  od.closeTag();
325  }
326  }
327  od << myStopOut.getString();
329  od.closeTag();
330  od.lf();
331  if (mySorted) {
332  myRouteInfos[tmp.depart][myHolder.getID()] = od.getString();
333  myDepartureCounts[tmp.depart]--;
334  std::map<const SUMOTime, int>::iterator it = myDepartureCounts.begin();
335  while (it != myDepartureCounts.end() && it->second == 0) {
336  std::map<const std::string, std::string>& infos = myRouteInfos[it->first];
337  for (std::map<const std::string, std::string>::const_iterator it2 = infos.begin(); it2 != infos.end(); ++it2) {
338  routeOut << it2->second;
339  }
340  myRouteInfos.erase(it->first);
341  myDepartureCounts.erase(it);
342  it = myDepartureCounts.begin();
343  }
344  } else {
345  routeOut << od.getString();
346  }
347 }
348 
349 
350 const MSRoute*
352  if (index < (int)myReplacedRoutes.size()) {
353  return myReplacedRoutes[index].route;
354  } else {
355  return 0;
356  }
357 }
358 
359 
360 void
361 MSDevice_Vehroutes::addRoute(const std::string& info) {
362  if (myMaxRoutes > 0) {
363  if (myHolder.hasDeparted()) {
365  } else {
366  myReplacedRoutes.push_back(RouteReplaceInfo(0, MSNet::getInstance()->getCurrentTimeStep(), myCurrentRoute, info));
367  }
368  if ((int)myReplacedRoutes.size() > myMaxRoutes) {
369  myReplacedRoutes.front().route->release();
370  myReplacedRoutes.erase(myReplacedRoutes.begin());
371  }
372  } else {
374  }
377 }
378 
379 
380 void
382  for (std::map<const SUMOVehicle*, MSDevice_Vehroutes*, ComparatorIdLess >::const_iterator it = myStateListener.myDevices.begin();
383  it != myStateListener.myDevices.end(); ++it) {
384  if (it->first->hasDeparted()) {
385  it->second->writeOutput(false);
386  }
387  }
388 }
389 
390 
391 void
394  out.writeAttr(SUMO_ATTR_ID, getID());
395  std::vector<std::string> internals;
396  if (!MSGlobals::gUseMesoSim) {
397  internals.push_back(toString(myDepartLane));
398  internals.push_back(toString(myDepartPosLat));
399  }
400  internals.push_back(toString(myDepartSpeed));
401  internals.push_back(toString(myDepartPos));
402  internals.push_back(toString(myReplacedRoutes.size()));
403  for (int i = 0; i < (int)myReplacedRoutes.size(); ++i) {
404  const std::string replacedOnEdge = myReplacedRoutes[i].edge == 0 ? "!NULL" : myReplacedRoutes[i].edge->getID();
405  internals.push_back(replacedOnEdge);
406  internals.push_back(toString(myReplacedRoutes[i].time));
407  internals.push_back(myReplacedRoutes[i].route->getID());
408  internals.push_back(myReplacedRoutes[i].info);
409  }
410  out.writeAttr(SUMO_ATTR_STATE, toString(internals));
411  out.closeTag();
412 }
413 
414 
415 void
417  std::istringstream bis(attrs.getString(SUMO_ATTR_STATE));
418  if (!MSGlobals::gUseMesoSim) {
419  bis >> myDepartLane;
420  bis >> myDepartPosLat;
421  }
422  bis >> myDepartSpeed;
423  bis >> myDepartPos;
424  int size;
425  bis >> size;
426  for (int i = 0; i < size; ++i) {
427  std::string edgeID;
428  SUMOTime time;
429  std::string routeID;
430  std::string info;
431  bis >> edgeID;
432  bis >> time;
433  bis >> routeID;
434  bis >> info;
435  myReplacedRoutes.push_back(RouteReplaceInfo(MSEdge::dictionary(edgeID), time, MSRoute::dictionary(routeID), info));
436  }
437 }
438 
439 
440 /****************************************************************************/
static std::map< const SUMOTime, int > myDepartureCounts
Map needed to sort vehicles by departure time.
const MSLane * getLane() const
Returns the lane the reminder works on.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
const int myMaxRoutes
The maximum number of routes to report.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
The position is given.
long long int SUMOTime
Definition: SUMOTime.h:36
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
virtual double getArrivalPos() const =0
Returns this vehicle&#39;s desired arrivalPos for its current route (may change on reroute) ...
const MSRoute * myCurrentRoute
The currently used route.
static StateListener myStateListener
A class that is notified about reroutings.
void release() const
deletes the route if there are no further references to it
Definition: MSRoute.cpp:98
virtual const MSRoute & getRoute() const =0
Returns the current route.
Represents a generic random distribution.
SUMOVehicle & myHolder
The vehicle that stores the device.
Definition: MSDevice.h:195
distribution of a route
static bool myDUAStyle
A shortcut for the Option "vehroute-output.dua".
std::string getString() const
Returns the current content as a string.
The position is given.
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
Notification
Definition of a vehicle state.
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
Definition: MSRoute.cpp:274
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:67
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:160
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn&#39;t already in the dictionary...
Definition: MSEdge.cpp:742
const std::vector< T > & getVals() const
Returns the members of the distribution.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Does nothing, returns true only if exit times should be collected.
std::vector< SUMOTime > myExits
The times the vehicle exites an edge.
static bool mySorted
A shortcut for the Option "vehroute-output.sorted".
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
double getCosts() const
Returns the costs of the route.
Definition: MSRoute.h:159
static RandomDistributor< const MSRoute * > * distDictionary(const std::string &id)
Returns the named route distribution.
Definition: MSRoute.cpp:154
const std::string & getID() const
Returns the id.
Definition: Named.h:69
int size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:79
const std::string DEFAULT_VTYPE_ID
static bool mySaveExits
A shortcut for the Option "vehroute-output.exit-times".
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
Definition: MSNet.cpp:810
void writeXMLRoute(OutputDevice &os, int index=-1) const
Called on route output.
begin/end of the description of a route
The speed is given.
static bool myIntendedDepart
A shortcut for the Option "vehroute-output.intended-depart".
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
The lane is given.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
The state of a link.
void generateOutput() const
Called on writing vehroutes output.
static void init()
Static intialization.
void stopEnded(const SUMOVehicleParameter::Stop &stop)
A road/street connecting two junctions.
Definition: MSEdge.h:75
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
The vehicle changes lanes (micro only)
int myDepartLane
The lane the vehicle departed at.
static bool myLastRouteOnly
A shortcut for the Option "vehroute-output.last-route".
int getIndex() const
Returns the lane&#39;s index.
Definition: MSLane.h:530
The vehicle got a new route.
Definition: MSNet.h:499
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
const std::vector< double > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
Encapsulated SAX-Attributes.
std::map< const SUMOVehicle *, MSDevice_Vehroutes *, ComparatorIdLess > myDevices
A map for internal notification.
const int VEHPARS_DEPARTSPEED_SET
virtual int getNumberReroutes() const =0
Returns the number of new routes this vehicle got.
double myDepartPosLat
The lateral depart position.
void addRoute(const std::string &info)
Called on route change.
std::vector< RouteReplaceInfo > myReplacedRoutes
Prior routes.
const int VEHPARS_DEPARTPOSLAT_SET
SUMOTime depart
The vehicle&#39;s departure time.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:256
bool hasInternalLinks() const
return whether the network contains internal links
Definition: MSNet.h:598
A class that is notified about reroutings.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition: MSGlobals.h:69
int writeEdgeIDs(OutputDevice &os, const MSEdge *const from, const MSEdge *const upTo=0) const
Output the edge ids up to but not including the id of the given edge.
Definition: MSRoute.cpp:215
static void generateOutputForUnfinished()
generate vehroute output for vehicles which are still in the network
static bool mySkipPTLines
A shortcut for the Option "vehroute-output.skip-ptlines".
void writeOutput(const bool hasArrived) const
Called on writing vehroutes output.
std::string line
The vehicle&#39;s line (mainly for public transport)
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
static bool myRouteLength
A shortcut for the Option "vehroute-output.route-length".
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:487
void saveState(OutputDevice &out) const
Saves the state of the device.
bool notifyLeave(SUMOVehicle &veh, double lastPos, Notification reason, const MSLane *enteredLane=0)
Saves exit times if needed.
Abstract in-vehicle device.
Definition: MSDevice.h:65
void write(OutputDevice &dev) const
Writes the stop as XML.
virtual double getDepartPos() const =0
Returns this vehicle&#39;s real departure position.
The vehicle has departed (was inserted into the network)
Structure representing possible vehicle parameter.
virtual SUMOTime getDeparture() const =0
Returns this vehicle&#39;s real departure time.
double myDepartSpeed
The speed on departure.
virtual double getPositionOnLane() const =0
Get the vehicle&#39;s position along the lane.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle&#39;s parameter (including departure definition)
Definition of vehicle stop (position and duration)
MSDevice_Vehroutes(SUMOVehicle &holder, const std::string &id, int maxRoutes)
Constructor.
A storage for options typed value containers)
Definition: OptionsCont.h:92
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:94
const int VEHPARS_DEPARTLANE_SET
OutputDevice_String myStopOut
void addReference() const
increments the reference counter for the route
Definition: MSRoute.cpp:92
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
static MSDevice_Vehroutes * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into, int maxRoutes=std::numeric_limits< int >::max())
Build devices for the given vehicle, if needed.
description of a vehicle
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="")
Creates the device using the output definition stored in the named option.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
const MSRoute * getRoute(int index) const
Called on route retrieval.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:67
static std::map< const SUMOTime, std::map< const std::string, std::string > > myRouteInfos
const int VEHPARS_DEPARTPOS_SET
virtual const ConstMSEdgeVector::const_iterator & getCurrentRouteEdge() const =0
Returns an iterator pointing to the current edge in this vehicles route.
virtual double getSpeed() const =0
Returns the vehicle&#39;s current speed.
bool isBinary() const
Returns whether we have a binary output.
Definition: OutputDevice.h:244
double myDepartPos
The lane the vehicle departed at.
static bool gUseMesoSim
Definition: MSGlobals.h:91
Representation of a lane in the micro simulation.
Definition: MSLane.h:71
void vehicleStateChanged(const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="")
Called if a vehicle changes its state.
virtual const std::string & getID() const =0
Get the vehicle&#39;s ID.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
An output device that encapsulates an ofstream.
The vehicle is being teleported.
const MSEdge * myLastSavedAt
The last edge the exit time was saved for.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle&#39;s type.
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
Definition: MSRoute.cpp:111
~MSDevice_Vehroutes()
Destructor.
Information about a replaced route.