Eclipse SUMO - Simulation of Urban MObility
MSDevice_GLOSA.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2013-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A device for Green Light Optimal Speed Advisory
20 /****************************************************************************/
21 #include <config.h>
22 
28 #include <microsim/MSNet.h>
29 #include <microsim/MSLane.h>
30 #include <microsim/MSEdge.h>
31 #include <microsim/MSLink.h>
32 #include <microsim/MSVehicle.h>
33 #include "MSDevice_GLOSA.h"
34 
35 //#define DEBUG_GLOSA
36 #define DEBUG_COND (true)
37 
38 // ===========================================================================
39 // method definitions
40 // ===========================================================================
41 // ---------------------------------------------------------------------------
42 // static initialisation methods
43 // ---------------------------------------------------------------------------
44 void
46  oc.addOptionSubTopic("GLOSA Device");
47  insertDefaultAssignmentOptions("glosa", "GLOSA Device", oc);
48 
49  oc.doRegister("device.glosa.range", new Option_Float(100.0));
50  oc.addDescription("device.glosa.range", "GLOSA Device", TL("The communication range to the traffic light"));
51 
52  oc.doRegister("device.glosa.max-speedfactor", new Option_Float(1.1));
53  oc.addDescription("device.glosa.max-speedfactor", "GLOSA Device", TL("The maximum speed factor when approaching a green light"));
54 
55  oc.doRegister("device.glosa.min-speed", new Option_Float(5.0));
56  oc.addDescription("device.glosa.min-speed", "GLOSA Device", TL("Minimum speed when coasting towards a red light"));
57 
58  oc.doRegister("device.glosa.add-switchtime", new Option_Float(0.0));
59  oc.addDescription("device.glosa.add-switchtime", "GLOSA Device", TL("Additional time the vehicle shall need to reach the intersection after the signal turns green"));
60 
61  oc.doRegister("device.glosa.override-safety", new Option_Bool(false));
62  oc.addDescription("device.glosa.override-safety", "GLOSA Device", TL("Override safety features - ignore the current light state, always follow GLOSA's predicted state"));
63 
64  oc.doRegister("device.glosa.ignore-cfmodel", new Option_Bool(false));
65  oc.addDescription("device.glosa.ignore-cfmodel", "GLOSA Device", TL("Vehicles follow a perfect speed calculation - ignore speed calculations from the CF model if not safety critical"));
66 }
67 
68 
69 void
70 MSDevice_GLOSA::buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into) {
72  if (!MSGlobals::gUseMesoSim && equippedByDefaultAssignmentOptions(oc, "glosa", v, false)) {
73  MSDevice_GLOSA* device = new MSDevice_GLOSA(v, "glosa_" + v.getID(),
74  v.getFloatParam("device.glosa.min-speed", true),
75  v.getFloatParam("device.glosa.range", true),
76  v.getFloatParam("device.glosa.max-speedfactor", true),
77  v.getFloatParam("device.glosa.add-switchtime", true),
78  v.getBoolParam("device.glosa.override-safety", true),
79  v.getBoolParam("device.glosa.ignore-cfmodel", true));
80  into.push_back(device);
81  }
82 }
83 
84 void
86  // cleaning up global state (if any)
87 }
88 
89 // ---------------------------------------------------------------------------
90 // MSDevice_GLOSA-methods
91 // ---------------------------------------------------------------------------
92 MSDevice_GLOSA::MSDevice_GLOSA(SUMOVehicle& holder, const std::string& id, double minSpeed, double range, double maxSpeedFactor,
93  double addSwitchTime, bool overrideSafety, bool ignoreCFModel) :
94  MSVehicleDevice(holder, id),
95  myVeh(dynamic_cast<MSVehicle&>(holder)),
96  myNextTLSLink(nullptr),
97  myDistance(0),
98  myMinSpeed(minSpeed),
99  myRange(range),
100  myMaxSpeedFactor(maxSpeedFactor),
101  myAddSwitchTime(addSwitchTime),
102  myOverrideSafety(overrideSafety),
103  myIgnoreCFModel(ignoreCFModel),
104  mySpeedAdviceActive(false)
105 
106 {
108 }
109 
110 
112 }
113 
114 
115 bool
116 MSDevice_GLOSA::notifyMove(SUMOTrafficObject& /*tObject*/, double oldPos,
117  double newPos, double /*newSpeed*/) {
118  myDistance -= (newPos - oldPos);
119  if (myNextTLSLink != nullptr && myDistance <= myRange) {
120  const double vMax = myVeh.getLane()->getVehicleMaxSpeed(&myVeh);
121  const double timeToJunction = earliest_arrival(myDistance, vMax);
122  const double timeToSwitch = getTimeToSwitch(myNextTLSLink);
123 #ifdef DEBUG_GLOSA
124  if (DEBUG_COND) {
125  std::cout << SIMTIME << " veh=" << myVeh.getID() << " d=" << myDistance << " ttJ=" << timeToJunction << " ttS=" << timeToSwitch << "\n";
126  }
127 #endif
128  if (myNextTLSLink->haveGreen()) {
130  mySpeedAdviceActive = false;
131  if (timeToJunction > timeToSwitch) {
133  const double vMax2 = vMax / myVeh.getChosenSpeedFactor() * myMaxSpeedFactor;
134  const double timetoJunction2 = earliest_arrival(myDistance, vMax2);
135  // reaching the signal at yellow might be sufficient
137 #ifdef DEBUG_GLOSA
138  if (DEBUG_COND) {
139  std::cout << " vMax2=" << vMax2 << " ttJ2=" << timetoJunction2 << " yellowSlack=" << yellowSlack << "\n";
140  }
141 #endif
142  if (timetoJunction2 <= (timeToSwitch + yellowSlack)) {
143  // increase speed factor up to a maximum if necessary and useful
144  // XXX could compute optimal speed factor here
146  mySpeedAdviceActive = true;
147  }
148  }
149  }
150  } else if (myNextTLSLink->haveRed()) {
151  adaptSpeed(myDistance, timeToJunction, timeToSwitch + myAddSwitchTime);
152  }
153  }
154  return true; // keep the device
155 }
156 
157 
158 bool
159 MSDevice_GLOSA::notifyEnter(SUMOTrafficObject& /*veh*/, MSMoveReminder::Notification /*reason*/, const MSLane* /* enteredLane */) {
160  const MSLink* prevLink = myNextTLSLink;
161  myNextTLSLink = nullptr;
162  const MSLane* lane = myVeh.getLane();
163  if (myVeh.getDeparture() < SIMSTEP) {
164  // no need to call at insertion
166  }
167  const std::vector<MSLane*>& bestLaneConts = myVeh.getBestLanesContinuation(lane);
168  double seen = lane->getLength() - myVeh.getPositionOnLane();
169  int view = 1;
170  std::vector<MSLink*>::const_iterator linkIt = MSLane::succLinkSec(myVeh, view, *lane, bestLaneConts);
171  while (!lane->isLinkEnd(linkIt)) {
172  if (!lane->getEdge().isInternal()) {
173  if ((*linkIt)->isTLSControlled()) {
174  myNextTLSLink = *linkIt;
175  myDistance = seen;
176  break;
177  }
178  }
179  lane = (*linkIt)->getViaLaneOrLane();
180  if (!lane->getEdge().isInternal()) {
181  view++;
182  }
183  seen += lane->getLength();
184  linkIt = MSLane::succLinkSec(myVeh, view, *lane, bestLaneConts);
185  }
186  if (prevLink != nullptr && myNextTLSLink == nullptr) {
187  // moved pass tls
189  mySpeedAdviceActive = false;
190  } else if (myNextTLSLink != nullptr && prevLink != myNextTLSLink) {
191  // approaching new tls
192  double tlsRange = 1e10;
193  const std::string val = myNextTLSLink->getTLLogic()->getParameter("device.glosa.range", "1e10");
194  try {
195  tlsRange = StringUtils::toDouble(val);
196  } catch (const NumberFormatException&) {
197  WRITE_WARNINGF(TL("Invalid value '%' for parameter 'device.glosa.range' of traffic light '%'"),
198  val, myNextTLSLink->getTLLogic()->getID());
199  }
200  myRange = MIN2(myVeh.getFloatParam("device.glosa.range", true), tlsRange);
201  }
202 
203 #ifdef DEBUG_GLOSA
204  if (DEBUG_COND) {
205  std::cout << SIMTIME << " veh=" << myVeh.getID() << " enter=" << myVeh.getLane()->getID() << " tls=" << (myNextTLSLink == nullptr ? "NULL" : myNextTLSLink->getTLLogic()->getID()) << " dist=" << myDistance << "\n";
206  }
207 #endif
208  return true; // keep the device
209 }
210 
211 
212 double
214  assert(tlsLink != nullptr);
215  const MSTrafficLightLogic* const tl = tlsLink->getTLLogic();
216  assert(tl != nullptr);
217  const auto& phases = tl->getPhases();
218  const int n = (int)phases.size();
219  const int cur = tl->getCurrentPhaseIndex();
220  SUMOTime result = tl->getNextSwitchTime() - SIMSTEP;
221  for (int i = 1; i < n; i++) {
222  const auto& phase = phases[(cur + i) % n];
223  const char ls = phase->getState()[tlsLink->getTLIndex()];
224  if ((tlsLink->haveRed() && (ls == 'g' || ls == 'G'))
225  || (tlsLink->haveGreen() && ls != 'g' && ls != 'G')) {
226  break;
227  }
228  result += phase->duration;
229  }
230  return STEPS2TIME(result);
231 }
232 
233 
234 double
235 MSDevice_GLOSA::earliest_arrival(double distance, double vMax) {
236  // assume we keep acceleration until we hit maximum speed
237  const double v = myVeh.getSpeed();
238  const double a = myVeh.getCarFollowModel().getMaxAccel();
239  const double accel_time = MIN2((vMax - v) / a, time_to_junction_at_continuous_accel(distance, v));
240  const double remaining_dist = distance - distance_at_continuous_accel(v, accel_time);
241  const double remaining_time = remaining_dist / vMax;
242  return accel_time + remaining_time;
243 }
244 
245 
246 /*
247 double
248 MSDevice_GLOSA::latest_arrival(speed, distance, earliest) {
249  // assume we keep current speed until within myRange and then decelerate to myMinSpeed
250  speed = max(speed, GLOSA_MIN_SPEED)
251  potential_decel_dist = min(distance, GLOSA_RANGE)
252  decel_time = (speed - GLOSA_MIN_SPEED) / GLOSA_DECEL
253  avg_decel_speed = (speed + GLOSA_MIN_SPEED) / 2.0
254  decel_dist = decel_time * avg_decel_speed
255  if decel_dist > potential_decel_dist:
256  decel_dist = potential_decel_dist
257  # XXX actually avg_decel_speed is higher in this case
258  decel_time = decel_dist / avg_decel_speed
259  slow_dist = potential_decel_dist - decel_dist
260  fast_dist = distance - (decel_dist + slow_dist)
261  result = fast_dist / speed + decel_time + slow_dist / GLOSA_MIN_SPEED
262  if result < earliest:
263  if (distance > 15):
264  print("DEBUG: fixing latest arrival of %s to match earliest of %s" % (result, earliest))
265  result = earliest
266  return result
267  return 0;
268 }
269 */
270 
271 
272 double
274  const double v = speed;
275  const double t = time;
276  const double a = myVeh.getCarFollowModel().getMaxAccel();
277  // integrated area composed of a rectangle and a triangle
278  return v * t + a * t * t / 2;
279 }
280 
281 
282 double
284  // see distance_at_continuous_accel
285  // t^2 + (2v/a)t - 2d/a = 0
286  const double a = myVeh.getCarFollowModel().getMaxAccel();
287  const double p_half = v / a;
288  const double t = -p_half + sqrt(p_half * p_half + 2 * d / a);
289  return t;
290 }
291 
292 
293 void
294 MSDevice_GLOSA::adaptSpeed(double distance, double /*timeToJunction*/, double timeToSwitch) {
295  // ensure that myVehicle arrives at the
296  // junction with maximum speed when it switches to green
297  // car performs a slowDown at time z to speed x for duration y
298  // there are two basic strategies
299  // a) maximize z -> this saves road space but leads to low x and thus excessive braking
300  // b) maximize x -> this saves fuel but wastes road
301  // c) compromise: b) but only when distance to junction is below a threshold
302 
303  const double vMax = myVeh.getLane()->getSpeedLimit() * myOriginalSpeedFactor;
304 
305  // need to start/continue maneuver
306  const double t = timeToSwitch;
307  const double a = myVeh.getCarFollowModel().getMaxAccel();
308  const double u = myMinSpeed;
309  const double w = vMax;
310  const double s = distance;
311  const double v = myVeh.getSpeed();
312  // x : target speed
313  // y : slow down duration
314  // s is composed of 1 trapezoid (decel), 1 rectangle (maintain), 1 trapezoid (accel)
315  // s = (v^2-x^2)/2d + x*(t-y-(w-x)/a) + (w^2-x^2)/2a
316  // y = (v-x)/d
317  // solution for x curtesy of mathomatic.org
318 
319  // First, we calculate targetSpeed assuming we are driving that speed already (v=x)
320  // If this results in targetSpeed < currentSpeed, then we need to decelerate (and vice versa)
321  const double rootConst = a * a * t * t - 2.0 * a * w * t + 2 * a * s;
322  double vConst = 0;
323  if (rootConst >= 0) {
324  vConst = sqrt(rootConst) - a * t + w;
325  }
326  double d = myVeh.getCarFollowModel().getMaxDecel();
327  if (v < vConst) {
328  d = a;
329  }
330 
331  // Second, we calculate the correct targetSpeed, knowing if we need to accelerate or decelerate
332  const double sign0 = -1; // quadratic formula solution x1 (choose solution with higher speed)
333  const double root_argument = a * d * ((2.0 * d * (s - (w * t))) - ((v - w) * (v - w)) + (a * ((d * (t * t)) + (2.0 * (s - (t * v))))));
334  if (root_argument < 0) {
335 #ifdef DEBUG_GLOSA
336  WRITE_WARNINGF("GLOSA error 1 root_argument=% s=% t=% v=%", root_argument, s, t, v);
337 #endif
338  return;
339  }
340  const double x = (((a * (v - (d * t))) + (d * w) - sign0 * sqrt(root_argument)) / (d + a));
341  double y = (v - x) / d;
342  if (v < x) {
343  y = (x - v) / d;
344  }
345  if (s < (w * w - x * x) / 2.0 / a) {
346  // end maneuver
347  if (myIgnoreCFModel) {
348  std::vector<std::pair<SUMOTime, double> > speedTimeLine;
349  speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), myVeh.getSpeed()));
350  speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(w - x / a), vMax));
351  myVeh.getInfluencer().setSpeedTimeLine(speedTimeLine);
352  } else {
354  }
355  mySpeedAdviceActive = false;
356  return;
357  }
358  if (!(x >= u && x <= w && y < t)) {
359 #ifdef DEBUG_GLOSA
360  WRITE_WARNINGF("GLOSA error 2 x=% y=% s=% t=% v=%", x, y, s, t, v);
361 #endif
362  // end maneuver
364  mySpeedAdviceActive = false;
365  return;
366  }
367  const double targetSpeed = x;
368  const double duration = MAX2(y, TS);
369 #ifdef DEBUG_GLOSA
370  if (DEBUG_COND) {
371  std::cout << " targetSpeed=" << targetSpeed << " duration=" << y << "\n";
372  }
373 #endif
374  if (myIgnoreCFModel) {
375  std::vector<std::pair<SUMOTime, double> > speedTimeLine;
376  speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), myVeh.getSpeed()));
377  speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(duration), targetSpeed));
378  myVeh.getInfluencer().setSpeedTimeLine(speedTimeLine);
379  } else {
381  }
382  mySpeedAdviceActive = true;
383 }
384 
385 
386 void
388  /*
389  if (tripinfoOut != nullptr) {
390  tripinfoOut->openTag("glosa_device");
391  tripinfoOut->closeTag();
392  }
393  */
394 }
395 
396 std::string
397 MSDevice_GLOSA::getParameter(const std::string& key) const {
398  if (key == "minSpeed") {
399  return toString(myMinSpeed);
400  }
401  throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'");
402 }
403 
404 
405 void
406 MSDevice_GLOSA::setParameter(const std::string& key, const std::string& value) {
407  double doubleValue;
408  try {
409  doubleValue = StringUtils::toDouble(value);
410  } catch (NumberFormatException&) {
411  throw InvalidArgument("Setting parameter '" + key + "' requires a number for device of type '" + deviceName() + "'");
412  }
413  if (key == "minSpeed") {
414  myMinSpeed = doubleValue;
415  } else {
416  throw InvalidArgument("Setting parameter '" + key + "' is not supported for device of type '" + deviceName() + "'");
417  }
418 }
419 
420 
421 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
#define DEBUG_COND
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define TL(string)
Definition: MsgHandler.h:315
#define STEPS2TIME(x)
Definition: SUMOTime.h:55
#define SIMSTEP
Definition: SUMOTime.h:61
#define TS
Definition: SUMOTime.h:42
#define SIMTIME
Definition: SUMOTime.h:62
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
@ SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME
T MIN2(T a, T b)
Definition: StdDefs.h:76
T MAX2(T a, T b)
Definition: StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
SUMOTime getDeparture() const
Returns this vehicle's real departure time.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:256
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:264
A device which collects info on the vehicle trip (mainly on departure and arrival)
void generateOutput(OutputDevice *tripinfoOut) const
Called on writing tripinfo output.
const MSLink * myNextTLSLink
the upcoming traffic light
MSVehicle & myVeh
myHolder cast to needed type
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
bool mySpeedAdviceActive
If speedFactor is currently beeing changed by the GLOSA device.
double myAddSwitchTime
Additional time the vehicle shall need to reach the intersection after the signal turns green.
double myMaxSpeedFactor
maximum speed factor when trying to reach green light
double myRange
maximum communication range
void adaptSpeed(double distance, double timeToJunction, double timeToSwitch)
adapt speed to reach junction at green
double myMinSpeed
minimum approach speed towards red light
~MSDevice_GLOSA()
Destructor.
MSDevice_GLOSA(SUMOVehicle &holder, const std::string &id, double minSpeed, double range, double maxSpeedFactor, double addSwitchTime, bool overrideSafety, bool ignoreCFModel)
Constructor.
double time_to_junction_at_continuous_accel(double d, double v)
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_GLOSA-options.
double myDistance
the distance to the upcoming traffic light
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
updates next tls link
double distance_at_continuous_accel(double speed, double time)
double earliest_arrival(double speed, double distance)
return minimum number of seconds to reach the junction
double myOriginalSpeedFactor
original speed factor
static void cleanup()
resets counters
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
updates distance and computes speed advice
static double getTimeToSwitch(const MSLink *tlsLink)
compute time to next (relevant) switch
const std::string deviceName() const
return the name for this type of device
bool myIgnoreCFModel
if true ignore non-critical speed calculations from the CF model, follow GLOSA's perfect speed calcul...
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:155
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:195
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:268
static bool gUseMesoSim
Definition: MSGlobals.h:103
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
static std::vector< MSLink * >::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
Definition: MSLane.cpp:2600
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:584
double getLength() const
Returns the lane's length.
Definition: MSLane.h:598
bool isLinkEnd(std::vector< MSLink * >::const_iterator &i) const
Definition: MSLane.h:845
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:566
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:756
Notification
Definition of a vehicle state.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:184
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:320
The parent class for traffic light logics.
virtual int getCurrentPhaseIndex() const =0
Returns the current index within the program.
SUMOTime getNextSwitchTime() const
Returns the assumed next switch time.
virtual const Phases & getPhases() const =0
Returns the phases of this tls program.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
Definition: MSVehicle.cpp:399
Abstract in-vehicle device.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:5798
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:6290
Influencer & getInfluencer()
Definition: MSVehicle.cpp:7251
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:493
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:377
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:584
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:977
const SUMOVTypeParameter & getParameter() const
const std::string & getID() const
Returns the id.
Definition: Named.h:74
A storage for options typed value containers)
Definition: OptionsCont.h:89
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
Definition: OptionsCont.cpp:76
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:60
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
Representation of a vehicle, person, or container.
bool getBoolParam(const std::string &paramName, const bool required=false, const bool deflt=false) const
Retrieve a boolean parameter for the traffic object.
double getFloatParam(const std::string &paramName, const bool required=false, const double deflt=INVALID_DOUBLE) const
Retrieve a floating point parameter for the traffic object.
double getJMParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
Representation of a vehicle.
Definition: SUMOVehicle.h:62
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter