Eclipse SUMO - Simulation of Urban MObility
MSVehicleControl.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 /****************************************************************************/
20 // The class responsible for building and deletion of vehicles
21 /****************************************************************************/
22 #include <config.h>
23 
24 #include "MSVehicleControl.h"
25 #include "MSVehicle.h"
26 #include "MSLane.h"
27 #include "MSEdge.h"
28 #include "MSNet.h"
29 #include "MSRouteHandler.h"
33 #include <utils/common/Named.h>
34 #include <utils/common/RGBColor.h>
39 
40 
41 // ===========================================================================
42 // member method definitions
43 // ===========================================================================
45  myLoadedVehNo(0),
46  myRunningVehNo(0),
47  myEndedVehNo(0),
48  myDiscarded(0),
49  myCollisions(0),
50  myTeleportsCollision(0),
51  myTeleportsJam(0),
52  myTeleportsYield(0),
53  myTeleportsWrongLane(0),
54  myEmergencyStops(0),
55  myStoppedVehicles(0),
56  myTotalDepartureDelay(0),
57  myTotalTravelTime(0),
58  myWaitingForTransportable(0),
59  myMaxSpeedFactor(1),
60  myMinDeceleration(SUMOVTypeParameter::getDefaultDecel(SVC_IGNORING)),
61  myPendingRemovals(MSGlobals::gNumSimThreads > 1) {
62 
65 }
66 
67 
69  clearState(false);
70 }
71 
72 
73 void
77 
81 
85 
89 
91  // ISO Container TEU (cannot set this based on vClass)
92  defContainerType.length = 6.1;
93  defContainerType.width = 2.4;
94  defContainerType.height = 2.6;
95  defContainerType.parametersSet |= VTYPEPARS_VEHICLECLASS_SET;
97 
99 }
100 
101 
104  const MSRoute* route, MSVehicleType* type,
105  const bool ignoreStopErrors, const bool fromRouteFile) {
106  MSVehicle* built = new MSVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : nullptr));
107  initVehicle(built, ignoreStopErrors);
108  return built;
109 }
110 
111 
112 void
113 MSVehicleControl::initVehicle(MSBaseVehicle* built, const bool ignoreStopErrors) {
114  myLoadedVehNo++;
115  try {
116  built->initDevices();
117  built->addStops(ignoreStopErrors);
118  } catch (ProcessError&) {
119  delete built;
120  throw;
121  }
123 }
124 
125 
126 void
128  assert(myRunningVehNo > 0);
129  if (!checkDuplicate || !isPendingRemoval(veh)) {
130  myPendingRemovals.push_back(veh);
131  }
132 }
133 
134 
135 bool
137 #ifdef HAVE_FOX
138  return myPendingRemovals.contains(veh);
139 #else
140  return std::find(myPendingRemovals.begin(), myPendingRemovals.end(), veh) == myPendingRemovals.end();
141 #endif
142 }
143 
144 
145 void
147  OutputDevice* const tripinfoOut = OptionsCont::getOptions().isSet("tripinfo-output") ? &OutputDevice::getDeviceByOption("tripinfo-output") : nullptr;
148 #ifdef HAVE_FOX
149  std::vector<SUMOVehicle*>& vehs = myPendingRemovals.getContainer();
150 #else
151  std::vector<SUMOVehicle*>& vehs = myPendingRemovals;
152 #endif
153  std::sort(vehs.begin(), vehs.end(), ComparatorNumericalIdLess());
154  for (SUMOVehicle* const veh : vehs) {
155  myTotalTravelTime += STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - veh->getDeparture());
156  myRunningVehNo--;
158  // vehicle is equipped with tripinfo device (not all vehicles are)
159  const bool hasTripinfo = veh->getDevice(typeid(MSDevice_Tripinfo)) != nullptr;
160  for (MSVehicleDevice* const dev : veh->getDevices()) {
161  dev->generateOutput(hasTripinfo ? tripinfoOut : nullptr);
162  }
163  if (tripinfoOut != nullptr && hasTripinfo) {
164  // close tag after tripinfo (possibly including emissions from another device) have been written
165  tripinfoOut->closeTag();
166  }
167  deleteVehicle(veh);
168  }
169  vehs.clear();
170  if (tripinfoOut != nullptr) {
171  // there seem to be people who think reading an unfinished xml is a good idea ;-)
172  tripinfoOut->flush();
173  }
174 #ifdef HAVE_FOX
175  myPendingRemovals.unlock();
176 #endif
177 }
178 
179 
180 void
182  ++myRunningVehNo;
186  if ((v.getVClass() & (SVC_PEDESTRIAN | SVC_NON_ROAD)) == 0) {
187  // only worry about deceleration of road users
189  }
190 }
191 
192 
193 void
194 MSVehicleControl::setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime) {
195  myRunningVehNo = runningVehNo;
196  myLoadedVehNo = loadedVehNo;
197  myEndedVehNo = endedVehNo;
198  myTotalDepartureDelay = totalDepartureDelay;
199  myTotalTravelTime = totalTravelTime;
200 }
201 
202 
203 void
205  out.openTag(SUMO_TAG_DELAY);
211  // save vehicle types
212  for (const auto& item : myVTypeDict) {
213  if (myReplaceableDefaultVTypes.count(item.first) == 0) {
214  item.second->getParameter().write(out);
215  }
216  }
217  for (const auto& item : myVTypeDistDict) {
219  out.writeAttr(SUMO_ATTR_VTYPES, item.second->getVals());
220  out.writeAttr(SUMO_ATTR_PROBS, item.second->getProbs());
221  out.closeTag();
222  }
223  for (const auto& item : myVehicleDict) {
224  item.second->saveState(out);
225  }
226 }
227 
228 
229 void
230 MSVehicleControl::clearState(const bool reinit) {
231  for (const auto& item : myVehicleDict) {
232  delete item.second;
233  }
234  myVehicleDict.clear();
235  // delete vehicle type distributions
236  for (const auto& item : myVTypeDistDict) {
237  delete item.second;
238  }
239  myVTypeDistDict.clear();
240  // delete vehicle types
241  for (const auto& item : myVTypeDict) {
242  delete item.second;
243  }
244  myVTypeDict.clear();
245  myPendingRemovals.clear(); // could be leftovers from MSVehicleTransfer::checkInsertions (teleport beyond arrival)
246  if (reinit) {
248  }
249 }
250 
251 
252 bool
253 MSVehicleControl::addVehicle(const std::string& id, SUMOVehicle* v) {
254  VehicleDictType::iterator it = myVehicleDict.find(id);
255  if (it == myVehicleDict.end()) {
256  // id not in myVehicleDict.
257  myVehicleDict[id] = v;
258  const SUMOVehicleParameter& pars = v->getParameter();
260  const MSEdge* const firstEdge = v->getRoute().getEdges()[0];
261  if (!MSGlobals::gUseMesoSim) {
262  // position will be checked against person position later
263  static_cast<MSVehicle*>(v)->setTentativeLaneAndPosition(firstEdge->getLanes()[0], v->getParameter().departPos);
264  }
265  firstEdge->addWaiting(v);
267  }
268  if (v->getVClass() != SVC_TAXI && pars.line != "" && pars.repetitionNumber < 0) {
269  myPTVehicles.push_back(v);
270  }
271  return true;
272  }
273  return false;
274 }
275 
276 
278 MSVehicleControl::getVehicle(const std::string& id) const {
279  VehicleDictType::const_iterator it = myVehicleDict.find(id);
280  if (it == myVehicleDict.end()) {
281  return nullptr;
282  }
283  return it->second;
284 }
285 
286 
287 void
289  myEndedVehNo++;
290  if (discard) {
291  myDiscarded++;
292  }
293  if (veh != nullptr) {
294  myVehicleDict.erase(veh->getID());
295  }
296  auto ptVehIt = std::find(myPTVehicles.begin(), myPTVehicles.end(), veh);
297  if (ptVehIt != myPTVehicles.end()) {
298  myPTVehicles.erase(ptVehIt);
299  }
300  delete veh;
301 }
302 
303 
304 bool
305 MSVehicleControl::checkVType(const std::string& id) {
306  if (myReplaceableDefaultVTypes.erase(id) > 0) {
307  delete myVTypeDict[id];
308  myVTypeDict.erase(myVTypeDict.find(id));
309  } else {
310  if (myVTypeDict.find(id) != myVTypeDict.end() || myVTypeDistDict.find(id) != myVTypeDistDict.end()) {
311  return false;
312  }
313  }
314  return true;
315 }
316 
317 
318 bool
320  if (checkVType(vehType->getID())) {
321  myVTypeDict[vehType->getID()] = vehType;
322  return true;
323  }
324  return false;
325 }
326 
327 
328 void
330  assert(vehType != 0);
331  assert(myVTypeDict.find(vehType->getID()) != myVTypeDict.end());
332  myVTypeDict.erase(vehType->getID());
333  if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
334  myVTypeToDist.erase(vehType->getID());
335  }
336  delete vehType;
337 }
338 
339 
340 bool
341 MSVehicleControl::addVTypeDistribution(const std::string& id, RandomDistributor<MSVehicleType*>* vehTypeDistribution) {
342  if (checkVType(id)) {
343  myVTypeDistDict[id] = vehTypeDistribution;
344  std::vector<MSVehicleType*> vehTypes = vehTypeDistribution->getVals();
345  for (auto vehType : vehTypes) {
346  if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
347  myVTypeToDist[vehType->getID()].insert(id);
348  } else {
349  myVTypeToDist[vehType->getID()] = { id };
350  }
351  }
352  return true;
353  }
354  return false;
355 }
356 
357 
358 bool
359 MSVehicleControl::hasVType(const std::string& id) const {
360  return myVTypeDict.count(id) > 0 || myVTypeDistDict.count(id) > 0;
361 }
362 
363 
364 bool
365 MSVehicleControl::hasVTypeDistribution(const std::string& id) const {
366  return myVTypeDistDict.count(id) > 0;
367 }
368 
369 
371 MSVehicleControl::getVType(const std::string& id, SumoRNG* rng, bool readOnly) {
372  VTypeDictType::iterator it = myVTypeDict.find(id);
373  if (it == myVTypeDict.end()) {
374  VTypeDistDictType::iterator it2 = myVTypeDistDict.find(id);
375  if (it2 == myVTypeDistDict.end()) {
376  return nullptr;
377  }
378  return it2->second->get(rng);
379  }
380  if (!readOnly && myReplaceableDefaultVTypes.erase(id) > 0) {
381  it->second->check();
382  }
383  return it->second;
384 }
385 
386 
387 void
388 MSVehicleControl::insertVTypeIDs(std::vector<std::string>& into) const {
389  into.reserve(into.size() + myVTypeDict.size() + myVTypeDistDict.size());
390  for (VTypeDictType::const_iterator i = myVTypeDict.begin(); i != myVTypeDict.end(); ++i) {
391  into.push_back((*i).first);
392  }
393  for (VTypeDistDictType::const_iterator i = myVTypeDistDict.begin(); i != myVTypeDistDict.end(); ++i) {
394  into.push_back((*i).first);
395  }
396 }
397 
398 
399 const std::set<std::string>
401  std::map<std::string, std::set<std::string>>::const_iterator it = myVTypeToDist.find(id);
402  if (it == myVTypeToDist.end()) {
403  return std::set<std::string>();
404  }
405  return it->second;
406 }
407 
408 
410 MSVehicleControl::getVTypeDistribution(const std::string& typeDistID) const {
411  auto it = myVTypeDistDict.find(typeDistID);
412  if (it != myVTypeDistDict.end()) {
413  return it->second;
414  } else {
415  return nullptr;
416  }
417 }
418 
419 
420 void
422  for (VehicleDictType::iterator i = myVehicleDict.begin(); i != myVehicleDict.end(); ++i) {
423  WRITE_WARNINGF("Vehicle '%' aborted waiting for a % that will never come.", i->first,
424  i->second->getParameter().departProcedure == DEPART_SPLIT ? "split" : "person or container")
425  }
426 }
427 
428 
429 int
431  int result = 0;
432  for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
433  const SUMOVehicle* veh = it->second;
434  if ((veh->isOnRoad() || veh->isRemoteControlled()) && veh->getSpeed() < SUMO_const_haltingSpeed) {
435  result++;
436  }
437  }
438  return result;
439 }
440 
441 
442 std::pair<double, double>
444  double speedSum = 0;
445  double relSpeedSum = 0;
446  int count = 0;
447  for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
448  const SUMOVehicle* veh = it->second;
449  if ((veh->isOnRoad() || veh->isRemoteControlled()) && !veh->isStopped()) {
450  count++;
451  speedSum += veh->getSpeed();
452  relSpeedSum += veh->getSpeed() / veh->getEdge()->getSpeedLimit();
453  }
454  }
455  if (count > 0) {
456  return std::make_pair(speedSum / count, relSpeedSum / count);
457  } else {
458  return std::make_pair(-1, -1);
459  }
460 }
461 
462 
463 int
464 MSVehicleControl::getQuota(double frac, int loaded) const {
465  frac = frac < 0 ? myScale : frac;
466  const int origLoaded = (loaded < 1
467  // the vehicle in question has already been loaded, hence the '-1'
468  ? frac > 1. ? (int)(myLoadedVehNo / frac) : myLoadedVehNo - 1
469  // given transportable number reflects only previously loaded
470  : frac > 1. ? (int)(loaded / frac) : loaded);
471  return getScalingQuota(frac, origLoaded);
472 }
473 
474 
475 int
478 }
479 
480 
481 void
483  for (const SUMOVehicle* const veh : myPTVehicles) {
484  // add single vehicles with line attribute which are not part of a flow
485  const MSRoute* const route = MSRoute::dictionary(veh->getParameter().routeid);
486  router.getNetwork()->addSchedule(veh->getParameter(), route == nullptr ? nullptr : &route->getStops());
487  }
488 }
489 
490 
491 /****************************************************************************/
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:281
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define STEPFLOOR(x)
Definition: SUMOTime.h:56
const int VTYPEPARS_VEHICLECLASS_SET
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_NON_ROAD
classes which (normally) do not drive on normal roads
@ SVC_TAXI
vehicle is a taxi
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_PEDTYPE_ID
const std::set< std::string > DEFAULT_VTYPES
const std::string DEFAULT_VTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
const std::string DEFAULT_BIKETYPE_ID
@ DEPART_SPLIT
The departure is triggered by a train split.
@ DEPART_CONTAINER_TRIGGERED
The departure is container triggered.
@ DEPART_TRIGGERED
The departure is person triggered.
@ SUMO_TAG_DELAY
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_ATTR_NUMBER
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_PROBS
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ID
@ SUMO_ATTR_TIME
trigger: the time of the step
int getScalingQuota(double frac, int loaded)
Returns the number of instances of the current object that shall be emitted given the number of loade...
Definition: StdDefs.cpp:50
T MIN2(T a, T b)
Definition: StdDefs.h:74
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:61
T MAX2(T a, T b)
Definition: StdDefs.h:80
void addSchedule(const SUMOVehicleParameter &pars, const std::vector< SUMOVehicleParameter::Stop > *addStops=nullptr)
Network * getNetwork() const
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:51
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr)
Adds stops to the built vehicle.
virtual void initDevices()
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:239
A device which collects info on the vehicle trip (mainly on departure and arrival)
A road/street connecting two junctions.
Definition: MSEdge.h:77
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
Definition: MSEdge.cpp:990
void addWaiting(SUMOVehicle *vehicle) const
Adds a vehicle to the list of waiting vehicles.
Definition: MSEdge.cpp:1230
static bool gUseMesoSim
Definition: MSGlobals.h:94
@ BUILT
The vehicle was built, but has not yet departed.
@ ARRIVED
The vehicle arrived at his destination (is deleted)
@ DEPARTED
The vehicle has departed (was inserted into the network)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:174
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
Definition: MSNet.cpp:1144
static SumoRNG * getParsingRNG()
get parsing RNG
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
Definition: MSRoute.cpp:389
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
Definition: MSRoute.cpp:113
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:120
int myTeleportsCollision
The number of teleports due to collision.
double myScale
The scaling factor (especially for inc-dua)
bool hasVType(const std::string &id) const
Asks for existence of a vehicle type.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
bool addVType(MSVehicleType *vehType)
Adds a vehicle type.
void setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime)
Sets the current state variables as loaded from the stream.
void removePending()
Removes a vehicle after it has ended.
std::set< std::string > myReplaceableDefaultVTypes
the default vehicle types which may still be replaced
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
std::vector< SUMOVehicle * > myPendingRemovals
List of vehicles which are going to be removed.
int myLoadedVehNo
The number of build vehicles.
bool hasVTypeDistribution(const std::string &id) const
Asks for a vehicle type distribution.
void vehicleDeparted(const SUMOVehicle &v)
Informs this control about a vehicle's departure.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
void initDefaultTypes()
create default types
int myTeleportsYield
The number of teleports due to vehicles stuck on a minor road.
int myTeleportsWrongLane
The number of teleports due to vehicles stuck on the wrong lane.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void clearState(const bool reinit)
Remove all vehicles before quick-loading state.
std::map< std::string, std::set< std::string > > myVTypeToDist
Inverse lookup from vehicle type to distributions it is a member of.
double myMinDeceleration
The minimum deceleration capability for all vehicles in the network.
bool isPendingRemoval(SUMOVehicle *veh)
whether the given vehicle is scheduled for removal
virtual ~MSVehicleControl()
Destructor.
void removeVType(const MSVehicleType *vehType)
void registerOneWaiting()
increases the count of vehicles waiting for a transport to allow recognition of person / container re...
virtual std::pair< double, double > getVehicleMeanSpeeds() const
get current absolute and relative mean vehicle speed in the network
bool checkVType(const std::string &id)
Checks whether the vehicle type (distribution) may be added.
void initVehicle(MSBaseVehicle *built, const bool ignoreStopErrors)
int getQuota(double frac=-1, int loaded=-1) const
Returns the number of instances of the current vehicle that shall be emitted considering that "frac" ...
MSVehicleControl()
Constructor.
double myMaxSpeedFactor
The maximum speed factor for all vehicles in the network.
int myDiscarded
The number of vehicles which were discarded while loading.
int myEndedVehNo
The number of removed vehicles.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
bool addVTypeDistribution(const std::string &id, RandomDistributor< MSVehicleType * > *vehTypeDistribution)
Adds a vehicle type distribution.
int myTeleportsJam
The number of teleports due to jam.
void insertVTypeIDs(std::vector< std::string > &into) const
Inserts ids of all known vehicle types and vehicle type distributions to the given vector.
double myTotalDepartureDelay
The aggregated time vehicles had to wait for departure (in seconds)
VTypeDictType myVTypeDict
Dictionary of vehicle types.
const RandomDistributor< MSVehicleType * > * getVTypeDistribution(const std::string &typeDistID) const
return the vehicle type distribution with the given id
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
double myTotalTravelTime
The aggregated time vehicles needed to aacomplish their route (in seconds)
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
std::vector< SUMOVehicle * > myPTVehicles
List of vehicles which belong to public transport.
int getTeleportCount() const
return the number of teleports (including collisions)
VTypeDistDictType myVTypeDistDict
A distribution of vehicle types (probability->vehicle type)
void abortWaiting()
informes about all waiting vehicles (deletion in destructor)
void saveState(OutputDevice &out)
Saves the current state into the given stream.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
const std::set< std::string > getVTypeDistributionMembership(const std::string &id) const
Return the distribution IDs the vehicle type is a member of.
int myRunningVehNo
The number of vehicles within the network (build and inserted but not removed)
VehicleDictType myVehicleDict
Dictionary of vehicles.
Abstract in-vehicle device.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:75
The car-following model and parameter.
Definition: MSVehicleType.h:62
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:90
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
double computeChosenSpeedDeviation(SumoRNG *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
const std::string & getID() const
Returns the id.
Definition: Named.h:74
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:248
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
const std::vector< T > & getVals() const
Returns the members of the distribution.
virtual double getChosenSpeedFactor() const =0
virtual double getSpeed() const =0
Returns the object's current speed.
virtual bool isStopped() const =0
Returns whether the object is at a stop.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
Structure representing possible vehicle parameter.
double width
This class' width.
double height
This class' height.
double length
The physical vehicle length.
int parametersSet
Information for the router which parameter were set.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
virtual const MSRoute & getRoute() const =0
Returns the current route.
virtual SUMOTime getDeparture() const =0
Returns this vehicle's real departure time.
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
virtual bool isRemoteControlled() const =0
Returns the information whether the vehicle is fully controlled via TraCI.
Structure representing possible vehicle parameter.
double departPos
(optional) The position the vehicle shall depart from
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
std::string line
The vehicle's line (mainly for public transport)
Function-object for stable sorting of objects with numerical ids.
Definition: Named.h:39