SUMO - Simulation of Urban MObility
MSBaseVehicle.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // A base class for vehicle implementations
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <iostream>
34 #include <cassert>
35 #include <utils/common/StdDefs.h>
39 #include "MSGlobals.h"
40 #include "MSVehicleType.h"
41 #include "MSEdge.h"
42 #include "MSLane.h"
43 #include "MSMoveReminder.h"
44 #include "MSBaseVehicle.h"
45 #include "MSNet.h"
46 #include "devices/MSDevice.h"
47 
48 #ifdef CHECK_MEMORY_LEAKS
49 #include <foreign/nvwa/debug_new.h>
50 #endif // CHECK_MEMORY_LEAKS
51 
52 // ===========================================================================
53 // static members
54 // ===========================================================================
56 #ifdef _DEBUG
57 std::set<std::string> MSBaseVehicle::myShallTraceMoveReminders;
58 #endif
59 
60 // ===========================================================================
61 // method definitions
62 // ===========================================================================
63 
66  throw ProcessError("getPreviousSpeed() is not available for non-MSVehicles.");
67 }
68 
70  const MSVehicleType* type, const SUMOReal speedFactor) :
71  myParameter(pars),
72  myRoute(route),
73  myType(type),
74  myCurrEdge(route->begin()),
75  myChosenSpeedFactor(speedFactor),
76  myMoveReminders(0),
78  myDepartPos(-1),
79  myArrivalPos(-1),
80  myArrivalLane(-1),
82 #ifdef _DEBUG
83  , myTraceMoveReminders(myShallTraceMoveReminders.count(pars->id) > 0)
84 #endif
85 {
86  if ((*myRoute->begin())->isTaz() || myRoute->getLastEdge()->isTaz()) {
88  }
89  // init devices
91  //
92  for (std::vector< MSDevice* >::iterator dev = myDevices.begin(); dev != myDevices.end(); ++dev) {
93  myMoveReminders.push_back(std::make_pair(*dev, 0.));
94  }
96  if (!pars->wasSet(VEHPARS_FORCE_REROUTE)) {
98  }
99 }
100 
102  myRoute->release();
103  if (myParameter->repetitionNumber == 0) {
105  }
106  for (std::vector< MSDevice* >::iterator dev = myDevices.begin(); dev != myDevices.end(); ++dev) {
107  delete *dev;
108  }
109  delete myParameter;
110 }
111 
112 
113 const std::string&
115  return myParameter->id;
116 }
117 
118 
121  return *myParameter;
122 }
123 
124 
125 SUMOReal
127  return myType->getMaxSpeed();
128 }
129 
130 
131 const MSEdge*
132 MSBaseVehicle::succEdge(int nSuccs) const {
133  if (myCurrEdge + nSuccs < myRoute->end() && std::distance(myCurrEdge, myRoute->begin()) <= nSuccs) {
134  return *(myCurrEdge + nSuccs);
135  } else {
136  return 0;
137  }
138 }
139 
140 
141 const MSEdge*
143  return *myCurrEdge;
144 }
145 
146 
147 void
148 MSBaseVehicle::reroute(SUMOTime t, SUMOAbstractRouter<MSEdge, SUMOVehicle>& router, const bool onInit, const bool withTaz) {
149  // check whether to reroute
150  const MSEdge* source = withTaz && onInit ? MSEdge::dictionary(myParameter->fromTaz + "-source") : getRerouteOrigin();
151  if (source == 0) {
152  source = getRerouteOrigin();
153  }
154  const MSEdge* sink = withTaz ? MSEdge::dictionary(myParameter->toTaz + "-sink") : myRoute->getLastEdge();
155  if (sink == 0) {
156  sink = myRoute->getLastEdge();
157  }
158  ConstMSEdgeVector edges;
159  ConstMSEdgeVector stops;
160  if (myParameter->via.size() == 0) {
161  stops = getStopEdges();
162  } else {
163  // via takes precedence over stop edges
164  // XXX check for inconsistencies #2275
165  for (std::vector<std::string>::const_iterator it = myParameter->via.begin(); it != myParameter->via.end(); ++it) {
166  MSEdge* viaEdge = MSEdge::dictionary(*it);
167  assert(viaEdge != 0);
168  if (viaEdge->allowedLanes(getVClass()) == 0) {
169  throw ProcessError("Vehicle '" + getID() + "' is not allowed on any lane of via edge '" + viaEdge->getID() + "'.");
170  }
171  stops.push_back(viaEdge);
172  }
173  }
174 
175  for (MSRouteIterator s = stops.begin(); s != stops.end(); ++s) {
176  if (*s != source) {
177  // !!! need to adapt t here
178  router.compute(source, *s, this, t, edges);
179  source = *s;
180  edges.pop_back();
181  }
182  }
183  router.compute(source, sink, this, t, edges);
184  if (!edges.empty() && edges.front()->getPurpose() == MSEdge::EDGEFUNCTION_DISTRICT) {
185  edges.erase(edges.begin());
186  }
187  if (!edges.empty() && edges.back()->getPurpose() == MSEdge::EDGEFUNCTION_DISTRICT) {
188  edges.pop_back();
189  }
190  replaceRouteEdges(edges, onInit);
191  // this must be called even if the route could not be replaced
192  if (onInit) {
194  }
195 }
196 
197 
198 bool
199 MSBaseVehicle::replaceRouteEdges(ConstMSEdgeVector& edges, bool onInit, bool check, bool addStops) {
200  if (edges.empty()) {
201  WRITE_WARNING("No route for vehicle '" + getID() + "' found.");
202  return false;
203  }
204  // build a new id, first
205  std::string id = getID();
206  if (id[0] != '!') {
207  id = "!" + id;
208  }
209  if (myRoute->getID().find("!var#") != std::string::npos) {
210  id = myRoute->getID().substr(0, myRoute->getID().rfind("!var#") + 5) + toString(getNumberReroutes() + 1);
211  } else {
212  id = id + "!var#1";
213  }
214  int oldSize = (int)edges.size();
215  if (!onInit) {
216  const MSEdge* const origin = getRerouteOrigin();
217  if (origin != *myCurrEdge && edges.front() == origin) {
218  edges.insert(edges.begin(), *myCurrEdge);
219  oldSize = (int)edges.size();
220  }
221  edges.insert(edges.begin(), myRoute->begin(), myCurrEdge);
222  }
223  if (edges == myRoute->getEdges()) {
224  return true;
225  }
226  const RGBColor& c = myRoute->getColor();
227  MSRoute* newRoute = new MSRoute(id, edges, false, &c == &RGBColor::DEFAULT_COLOR ? 0 : new RGBColor(c), myRoute->getStops());
228  if (!MSRoute::dictionary(id, newRoute)) {
229  delete newRoute;
230  return false;
231  }
232 
233  std::string msg;
234  if (check && !hasValidRoute(msg, newRoute)) {
235  WRITE_WARNING("Invalid route replacement for vehicle '" + getID() + "'. " + msg);
237  newRoute->addReference();
238  newRoute->release();
239  return false;
240  }
241  }
242  if (!replaceRoute(newRoute, onInit, (int)edges.size() - oldSize, addStops)) {
243  newRoute->addReference();
244  newRoute->release();
245  return false;
246  }
247  return true;
248 }
249 
250 
251 SUMOReal
253  return 0;
254 }
255 
256 
257 SUMOReal
259  return 0;
260 }
261 
262 
263 void
268 }
269 
270 
271 bool
273  return myDeparture != NOT_YET_DEPARTED;
274 }
275 
276 
277 bool
279  return succEdge(1) == 0;
280 }
281 
282 void
284 }
285 
286 void
288 }
289 
290 bool
291 MSBaseVehicle::hasValidRoute(std::string& msg, const MSRoute* route) const {
292  MSRouteIterator start = myCurrEdge;
293  if (route == 0) {
294  route = myRoute;
295  } else {
296  start = route->begin();
297  }
298  MSRouteIterator last = route->end() - 1;
299  // check connectivity, first
300  for (MSRouteIterator e = start; e != last; ++e) {
301  if ((*e)->allowedLanes(**(e + 1), myType->getVehicleClass()) == 0) {
302  msg = "No connection between edge '" + (*e)->getID() + "' and edge '" + (*(e + 1))->getID() + "'.";
303  return false;
304  }
305  }
306  last = route->end();
307  // check usable lanes, then
308  for (MSRouteIterator e = start; e != last; ++e) {
309  if ((*e)->prohibits(this)) {
310  msg = "Edge '" + (*e)->getID() + "' prohibits.";
311  return false;
312  }
313  }
314  return true;
315 }
316 
317 
318 void
320 #ifdef _DEBUG
321  if (myTraceMoveReminders) {
322  traceMoveReminder("add", rem, 0, true);
323  }
324 #endif
325  myMoveReminders.push_back(std::make_pair(rem, 0.));
326 }
327 
328 
329 void
331  for (MoveReminderCont::iterator r = myMoveReminders.begin(); r != myMoveReminders.end(); ++r) {
332  if (r->first == rem) {
333 #ifdef _DEBUG
334  if (myTraceMoveReminders) {
335  traceMoveReminder("remove", rem, 0, false);
336  }
337 #endif
338  myMoveReminders.erase(r);
339  return;
340  }
341  }
342 }
343 
344 
345 void
347  for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) {
348  if (rem->first->notifyEnter(*this, reason)) {
349 #ifdef _DEBUG
350  if (myTraceMoveReminders) {
351  traceMoveReminder("notifyEnter", rem->first, rem->second, true);
352  }
353 #endif
354  ++rem;
355  } else {
356 #ifdef _DEBUG
357  if (myTraceMoveReminders) {
358  traceMoveReminder("notifyEnter", rem->first, rem->second, false);
359  }
360 #endif
361  rem = myMoveReminders.erase(rem);
362  }
363  }
364 }
365 
366 
367 void
369  if (myRoute->getLastEdge()->isTaz()) {
370  return;
371  }
372  const std::vector<MSLane*>& lanes = myRoute->getLastEdge()->getLanes();
373  const SUMOReal lastLaneLength = lanes[0]->getLength();
374  switch (myParameter->arrivalPosProcedure) {
375  case ARRIVAL_POS_GIVEN:
376  if (fabs(myParameter->arrivalPos) > lastLaneLength) {
377  WRITE_WARNING("Vehicle '" + getID() + "' will not be able to arrive at the given position!");
378  }
379  // Maybe we should warn the user about invalid inputs!
380  myArrivalPos = MIN2(myParameter->arrivalPos, lastLaneLength);
381  if (myArrivalPos < 0) {
382  myArrivalPos = MAX2(myArrivalPos + lastLaneLength, static_cast<SUMOReal>(0));
383  }
384  break;
385  case ARRIVAL_POS_RANDOM:
386  myArrivalPos = RandHelper::rand(static_cast<SUMOReal>(0), lastLaneLength);
387  break;
388  default:
389  myArrivalPos = lastLaneLength;
390  break;
391  }
393  if (myParameter->arrivalLane >= (int)lanes.size() || !lanes[myParameter->arrivalLane]->allowsVehicleClass(myType->getVehicleClass())) {
394  WRITE_WARNING("Vehicle '" + getID() + "' will not be able to arrive at the given lane '" + myRoute->getLastEdge()->getID() + "_" + toString(myParameter->arrivalLane) + "'!");
395  }
396  myArrivalLane = MIN2(myParameter->arrivalLane, (int)(lanes.size() - 1));
397  }
399  for (std::vector<MSLane*>::const_iterator l = lanes.begin(); l != lanes.end(); ++l) {
400  if (myParameter->arrivalSpeed <= (*l)->getVehicleMaxSpeed(this)) {
401  return;
402  }
403  }
404  WRITE_WARNING("Vehicle '" + getID() + "' will not be able to arrive with the given speed!");
405  }
406 }
407 
408 
409 SUMOReal
413 // Alternavite to avoid time to teleport effect on the simulation. No effect if time to teleport is -1
414 // return MAX2((SUMOReal)0, MIN2((SUMOReal)1, getVehicleType().getImpatience()));
415 }
416 
417 
418 MSDevice*
419 MSBaseVehicle::getDevice(const std::type_info& type) const {
420  for (std::vector<MSDevice*>::const_iterator dev = myDevices.begin(); dev != myDevices.end(); ++dev) {
421  if (typeid(**dev) == type) {
422  return *dev;
423  }
424  }
425  return 0;
426 }
427 
428 
429 void
431  // this saves lots of departParameters which are only needed for vehicles that did not yet depart
432  // the parameters may hold the name of a vTypeDistribution but we are interested in the actual type
434  // params and stops must be written in child classes since they may wish to add additional attributes first
436  // here starts the vehicle internal part (see loading)
437  // @note: remember to close the vehicle tag when calling this in a subclass!
438 }
439 
440 
441 void
442 MSBaseVehicle::addStops(const bool ignoreStopErrors) {
443  for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = myParameter->stops.begin(); i != myParameter->stops.end(); ++i) {
444  std::string errorMsg;
445  if (!addStop(*i, errorMsg) && !ignoreStopErrors) {
446  throw ProcessError(errorMsg);
447  }
448  if (errorMsg != "") {
449  WRITE_WARNING(errorMsg);
450  }
451  }
452  for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = myRoute->getStops().begin(); i != myRoute->getStops().end(); ++i) {
453  std::string errorMsg;
454  if (!addStop(*i, errorMsg) && !ignoreStopErrors) {
455  throw ProcessError(errorMsg);
456  }
457  if (errorMsg != "") {
458  WRITE_WARNING(errorMsg);
459  }
460  }
461 }
462 
463 #ifdef _DEBUG
464 void
465 MSBaseVehicle::initMoveReminderOutput(const OptionsCont& oc) {
466  if (oc.isSet("movereminder-output.vehicles")) {
467  const std::vector<std::string> vehicles = oc.getStringVector("movereminder-output.vehicles");
468  myShallTraceMoveReminders.insert(vehicles.begin(), vehicles.end());
469  }
470 }
471 
472 
473 void
474 MSBaseVehicle::traceMoveReminder(const std::string& type, MSMoveReminder* rem, SUMOReal pos, bool keep) const {
475  OutputDevice& od = OutputDevice::getDeviceByOption("movereminder-output");
476  od.openTag("movereminder");
477  od.writeAttr(SUMO_ATTR_TIME, STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()));
478  od.writeAttr("veh", getID());
480  od.writeAttr("type", type);
481  od.writeAttr("pos", toString(pos));
482  od.writeAttr("keep", toString(keep));
483  od.closeTag();
484 }
485 #endif
486 
487 /****************************************************************************/
488 
void removeReminder(MSMoveReminder *rem)
Removes a MoveReminder dynamically.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
const MSVehicleType * myType
This Vehicle&#39;s type.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
MSDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
virtual bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true)=0
Replaces the current route by the given one.
SUMOReal getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
long long int SUMOTime
Definition: SUMOTime.h:43
const int VEHPARS_FORCE_REROUTE
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
const std::string & getDescription() const
SUMOReal myArrivalPos
The position on the destination lane where the vehicle stops.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
virtual SUMOTime getWaitingTime() const =0
SUMOReal getMaxSpeed() const
Returns the maximum speed.
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:192
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
SUMOVehicleClass getVClass() const
Returns the vehicle&#39;s access class.
The speed is given.
SUMOReal getImpatience() const
Returns this vehicles impatience.
const MSEdge * getLastEdge() const
returns the destination edge
Definition: MSRoute.cpp:96
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
Notification
Definition of a vehicle state.
static SUMOReal rand()
Returns a random real number in [0, 1)
Definition: RandHelper.h:62
int getNumberReroutes() const
Returns the number of new routes this vehicle got.
SUMOReal arrivalPos
(optional) The position the vehicle shall arrive on
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:159
T MAX2(T a, T b)
Definition: StdDefs.h:70
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
virtual ~MSBaseVehicle()
Destructor.
const MSRoute * myRoute
This Vehicle&#39;s route.
bool hasDeparted() const
Returns whether this vehicle has already departed.
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:693
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle&#39;s end speed shall be chosen.
int myArrivalLane
The destination lane where the vehicle stops.
const SUMOVehicleParameter * myParameter
This Vehicle&#39;s parameter.
The arrival position is given.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
Definition: MSRoute.cpp:358
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:255
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
MSBaseVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice.cpp:81
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false, bool addStops=true)
Replaces the current route by the given edges.
The car-following model and parameter.
Definition: MSVehicleType.h:74
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
virtual bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)=0
Adds a stop.
std::string toTaz
The vehicle&#39;s destination zone (district)
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
SUMOReal getPreviousSpeed() const
Returns the vehicle&#39;s previous speed.
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
const std::string & getID() const
Returns the id.
Definition: Named.h:66
A road/street connecting two junctions.
Definition: MSEdge.h:80
virtual void addPerson(MSTransportable *person)
Adds a person to this vehicle.
bool isTaz() const
Definition: MSEdge.h:268
The edge is a district edge.
Definition: MSEdge.h:99
virtual SUMOReal getPositionOnLane() const =0
Get the vehicle&#39;s position along the lane.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
std::string routeid
The vehicle&#39;s route id.
static bool gCheckRoutes
Definition: MSGlobals.h:83
virtual SUMOReal getAcceleration() const
Returns the vehicle&#39;s acceleration.
bool wasSet(int what) const
Returns whether the given parameter was set.
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
Definition: RGBColor.h:200
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:308
int size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:90
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:65
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:128
T MIN2(T a, T b)
Definition: StdDefs.h:64
std::string fromTaz
The vehicle&#39;s origin zone (district)
Something on a lane to be noticed about vehicle movement.
void addReference() const
increments the reference counter for the route
Definition: MSRoute.cpp:103
std::vector< std::string > via
List of the via-edges the vehicle must visit.
Abstract in-vehicle device.
Definition: MSDevice.h:69
SUMOReal myChosenSpeedFactor
A precomputed factor by which the driver wants to be faster than the speed limit. ...
trigger: the time of the step
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Structure representing possible vehicle parameter.
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs&#39;th successor of edge the vehicle is currently at.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:84
#define SUMOTime_MAX
Definition: SUMOTime.h:44
int setParameter
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
virtual void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
Definition: MSEdge.cpp:299
void onDepart()
Called when the vehicle is inserted into the network.
A storage for options typed value containers)
Definition: OptionsCont.h:99
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
virtual bool hasArrived() const
Returns whether this vehicle has already arived (by default this is true if the vehicle has reached i...
virtual const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
The arrival lane is given.
int myNumberReroutes
The number of reroutings.
static SUMOTime gTimeToGridlock
Definition: MSGlobals.h:67
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
virtual const ConstMSEdgeVector getStopEdges() const =0
Returns the list of still pending stop edges.
description of a vehicle
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
const RGBColor & getColor() const
Returns the color.
Definition: MSRoute.cpp:349
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:208
MSRouteIterator myCurrEdge
Iterator to current route-edge.
void reroute(SUMOTime t, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false)
Performs a rerouting using the given router.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
void vehicleDeparted(const SUMOVehicle &v)
Informs this control about a vehicle&#39;s departure.
void release() const
deletes the route if there are no further references to it
Definition: MSRoute.cpp:109
virtual SUMOReal getSlope() const
Returns the slope of the road at vehicle&#39;s position.
SUMOReal myDepartPos
The real depart position.
void addReminder(MSMoveReminder *rem)
Adds a MoveReminder dynamically.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
virtual void addContainer(MSTransportable *container)
Adds a container to this vehicle.
static void checkDist(const std::string &id)
Checks the distribution whether it is permanent and deletes it if not.
Definition: MSRoute.cpp:194
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
SUMOTime myDeparture
The real departure time.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:78
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static const SUMOTime NOT_YET_DEPARTED
std::string id
The vehicle&#39;s id.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
const std::string & getID() const
Returns the name of the vehicle.
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
Definition: MSRoute.cpp:122
The arrival position is chosen randomly.