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-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 /****************************************************************************/
17 // The class responsible for building and deletion of vehicles
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include "MSVehicleControl.h"
27 #include "MSVehicle.h"
28 #include "MSLane.h"
29 #include "MSEdge.h"
30 #include "MSNet.h"
31 #include "MSRouteHandler.h"
34 #include <utils/common/RGBColor.h>
40 
41 
42 // ===========================================================================
43 // member method definitions
44 // ===========================================================================
46  myLoadedVehNo(0),
47  myRunningVehNo(0),
48  myEndedVehNo(0),
49  myDiscarded(0),
50  myCollisions(0),
51  myTeleportsJam(0),
52  myTeleportsYield(0),
53  myTeleportsWrongLane(0),
54  myEmergencyStops(0),
55  myTotalDepartureDelay(0),
56  myTotalTravelTime(0),
57  myDefaultVTypeMayBeDeleted(true),
58  myDefaultPedTypeMayBeDeleted(true),
59  myDefaultBikeTypeMayBeDeleted(true),
60  myWaitingForPerson(0),
61  myWaitingForContainer(0),
62  myMaxSpeedFactor(1),
63  myMinDeceleration(SUMOVTypeParameter::getDefaultDecel(SVC_IGNORING)) {
73  myScale = oc.getFloat("scale");
74 }
75 
76 
78  // delete vehicles
79  for (VehicleDictType::iterator i = myVehicleDict.begin(); i != myVehicleDict.end(); ++i) {
80  delete(*i).second;
81  }
82  myVehicleDict.clear();
83  // delete vehicle type distributions
84  for (VTypeDistDictType::iterator i = myVTypeDistDict.begin(); i != myVTypeDistDict.end(); ++i) {
85  delete(*i).second;
86  }
87  myVTypeDistDict.clear();
88  // delete vehicle types
89  for (VTypeDictType::iterator i = myVTypeDict.begin(); i != myVTypeDict.end(); ++i) {
90  //delete(*i).second;
91  }
92  myVTypeDict.clear();
93 }
94 
97  const MSRoute* route, MSVehicleType* type,
98  const bool ignoreStopErrors, const bool fromRouteFile) {
99  myLoadedVehNo++;
100  MSVehicle* built = new MSVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : nullptr));
101  built->addStops(ignoreStopErrors);
103  return built;
104 }
105 
106 
107 void
109  assert(myRunningVehNo > 0);
110  myTotalTravelTime += STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - veh->getDeparture());
111  myRunningVehNo--;
113  for (MSVehicleDevice* const dev : veh->getDevices()) {
114  dev->generateOutput();
115  }
116  if (OptionsCont::getOptions().isSet("tripinfo-output")) {
117  // close tag after tripinfo (possibly including emissions from another device) have been written
118  OutputDevice::getDeviceByOption("tripinfo-output").closeTag();
119  }
120  deleteVehicle(veh);
121 }
122 
123 
124 void
126  ++myRunningVehNo;
131  // only worry about deceleration of road users
133  }
134 }
135 
136 
137 void
138 MSVehicleControl::setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime) {
139  myRunningVehNo = runningVehNo;
140  myLoadedVehNo = loadedVehNo;
141  myEndedVehNo = endedVehNo;
142  myTotalDepartureDelay = totalDepartureDelay;
143  myTotalTravelTime = totalTravelTime;
144 }
145 
146 
147 void
149  out.openTag(SUMO_TAG_DELAY);
155  // save vehicle types
156  for (VTypeDictType::iterator it = myVTypeDict.begin(); it != myVTypeDict.end(); ++it) {
157  it->second->getParameter().write(out);
158  }
159  for (VTypeDistDictType::iterator it = myVTypeDistDict.begin(); it != myVTypeDistDict.end(); ++it) {
161  out.writeAttr(SUMO_ATTR_VTYPES, (*it).second->getVals());
162  out.writeAttr(SUMO_ATTR_PROBS, (*it).second->getProbs());
163  out.closeTag();
164  }
165  for (VehicleDictType::iterator it = myVehicleDict.begin(); it != myVehicleDict.end(); ++it) {
166  (*it).second->saveState(out);
167  }
168 }
169 
170 
171 bool
172 MSVehicleControl::addVehicle(const std::string& id, SUMOVehicle* v) {
173  VehicleDictType::iterator it = myVehicleDict.find(id);
174  if (it == myVehicleDict.end()) {
175  // id not in myVehicleDict.
176  myVehicleDict[id] = v;
177  const SUMOVehicleParameter& pars = v->getParameter();
179  const MSEdge* const firstEdge = v->getRoute().getEdges()[0];
180  if (!MSGlobals::gUseMesoSim) {
181  // position will be checked against person position later
182  static_cast<MSVehicle*>(v)->setTentativeLaneAndPosition(firstEdge->getLanes()[0], v->getParameter().departPos);
183  }
184  addWaiting(v->getRoute().getEdges().front(), v);
186  }
187  if (pars.line != "" && pars.repetitionNumber < 0) {
188  myPTVehicles.push_back(v);
189  }
190  return true;
191  }
192  return false;
193 }
194 
195 
197 MSVehicleControl::getVehicle(const std::string& id) const {
198  VehicleDictType::const_iterator it = myVehicleDict.find(id);
199  if (it == myVehicleDict.end()) {
200  return nullptr;
201  }
202  return it->second;
203 }
204 
205 
206 void
208  myEndedVehNo++;
209  if (discard) {
210  myDiscarded++;
211  }
212  if (veh != nullptr) {
213  myVehicleDict.erase(veh->getID());
214  }
215  delete veh;
216 }
217 
218 
219 bool
220 MSVehicleControl::checkVType(const std::string& id) {
221  if (id == DEFAULT_VTYPE_ID) {
223  delete myVTypeDict[id];
224  myVTypeDict.erase(myVTypeDict.find(id));
226  } else {
227  return false;
228  }
229  } else if (id == DEFAULT_PEDTYPE_ID) {
231  delete myVTypeDict[id];
232  myVTypeDict.erase(myVTypeDict.find(id));
234  } else {
235  return false;
236  }
237  } else if (id == DEFAULT_BIKETYPE_ID) {
239  delete myVTypeDict[id];
240  myVTypeDict.erase(myVTypeDict.find(id));
242  } else {
243  return false;
244  }
245  } else {
246  if (myVTypeDict.find(id) != myVTypeDict.end() || myVTypeDistDict.find(id) != myVTypeDistDict.end()) {
247  return false;
248  }
249  }
250  return true;
251 }
252 
253 bool
255  if (checkVType(vehType->getID())) {
256  myVTypeDict[vehType->getID()] = vehType;
257  return true;
258  }
259  return false;
260 }
261 
262 
263 void
265  assert(vehType != 0);
266  assert(myVTypeDict.find(vehType->getID()) != myVTypeDict.end());
267  myVTypeDict.erase(vehType->getID());
268  if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
269  myVTypeToDist.erase(vehType->getID());
270  }
271  delete vehType;
272 }
273 
274 
275 bool
276 MSVehicleControl::addVTypeDistribution(const std::string& id, RandomDistributor<MSVehicleType*>* vehTypeDistribution) {
277  if (checkVType(id)) {
278  myVTypeDistDict[id] = vehTypeDistribution;
279  std::vector<MSVehicleType*> vehTypes = vehTypeDistribution->getVals();
280  for (auto vehType : vehTypes) {
281  if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
282  myVTypeToDist[vehType->getID()].insert(id);
283  } else {
284  myVTypeToDist[vehType->getID()] = { id };
285  }
286  }
287  return true;
288  }
289  return false;
290 }
291 
292 
293 bool
294 MSVehicleControl::hasVType(const std::string& id) const {
295  return myVTypeDict.count(id) > 0 || myVTypeDistDict.count(id) > 0;
296 }
297 
298 
299 bool
300 MSVehicleControl::hasVTypeDistribution(const std::string& id) const {
301  return myVTypeDistDict.count(id) > 0;
302 }
303 
304 
306 MSVehicleControl::getVType(const std::string& id, std::mt19937* rng) {
307  VTypeDictType::iterator it = myVTypeDict.find(id);
308  if (it == myVTypeDict.end()) {
309  VTypeDistDictType::iterator it2 = myVTypeDistDict.find(id);
310  if (it2 == myVTypeDistDict.end()) {
311  return nullptr;
312  }
313  return it2->second->get(rng);
314  }
315  if (id == DEFAULT_VTYPE_ID) {
317  } else if (id == DEFAULT_PEDTYPE_ID) {
319  }
320  return it->second;
321 }
322 
323 
324 void
325 MSVehicleControl::insertVTypeIDs(std::vector<std::string>& into) const {
326  into.reserve(into.size() + myVTypeDict.size() + myVTypeDistDict.size());
327  for (VTypeDictType::const_iterator i = myVTypeDict.begin(); i != myVTypeDict.end(); ++i) {
328  into.push_back((*i).first);
329  }
330  for (VTypeDistDictType::const_iterator i = myVTypeDistDict.begin(); i != myVTypeDistDict.end(); ++i) {
331  into.push_back((*i).first);
332  }
333 }
334 
335 
336 std::set<std::string>
338  std::map<std::string, std::set<std::string>>::const_iterator it = myVTypeToDist.find(id);
339  if (it == myVTypeToDist.end()) {
340  return std::set<std::string>();
341  }
342  return it->second;
343 }
344 
345 
346 void
347 MSVehicleControl::addWaiting(const MSEdge* const edge, SUMOVehicle* vehicle) {
348  if (myWaiting.find(edge) == myWaiting.end()) {
349  myWaiting[edge] = std::vector<SUMOVehicle*>();
350  }
351  myWaiting[edge].push_back(vehicle);
352 }
353 
354 
355 void
356 MSVehicleControl::removeWaiting(const MSEdge* const edge, const SUMOVehicle* vehicle) {
357  if (myWaiting.find(edge) != myWaiting.end()) {
358  std::vector<SUMOVehicle*>::iterator it = std::find(myWaiting[edge].begin(), myWaiting[edge].end(), vehicle);
359  if (it != myWaiting[edge].end()) {
360  myWaiting[edge].erase(it);
361  }
362  }
363 }
364 
365 
367 MSVehicleControl::getWaitingVehicle(const MSEdge* const edge, const std::set<std::string>& lines, const double position, const std::string ridingID) {
368  if (myWaiting.find(edge) != myWaiting.end()) {
369  // for every vehicle waiting vehicle at this edge
370  std::vector<SUMOVehicle*> waitingTooFarAway;
371  for (std::vector<SUMOVehicle*>::const_iterator it = myWaiting[edge].begin(); it != myWaiting[edge].end(); ++it) {
372  const std::string& line = (*it)->getParameter().line == "" ? (*it)->getParameter().id : (*it)->getParameter().line;
373  double vehiclePosition = (*it)->getPositionOnLane();
374  // if the line of the vehicle is contained in the set of given lines and the vehicle is stopped and is positioned
375  // in the interval [position - t, position + t] for a tolerance t=10
376  if (lines.count(line)) {
377  if ((position - 10 <= vehiclePosition) && (vehiclePosition <= position + 10)) {
378  return (*it);
379  } else if ((*it)->isStoppedTriggered() ||
380  (*it)->getParameter().departProcedure == DEPART_TRIGGERED) {
381  // maybe we are within the range of the stop
382  if ((*it)->isStoppedInRange(position)) {
383  return (*it);
384  } else {
385  waitingTooFarAway.push_back(*it);
386  }
387  }
388  }
389  }
390  for (std::vector<SUMOVehicle*>::iterator it = waitingTooFarAway.begin(); it != waitingTooFarAway.end(); ++it) {
391  WRITE_WARNING(ridingID + " at edge '" + edge->getID() + "' position " + toString(position) + " cannot use waiting vehicle '" + (*it)->getID() + "' at position " + toString((*it)->getPositionOnLane()) + " because it is too far away.");
392  }
393  }
394  return nullptr;
395 }
396 
397 
398 void
400  for (VehicleDictType::iterator i = myVehicleDict.begin(); i != myVehicleDict.end(); ++i) {
401  WRITE_WARNING("Vehicle " + i->first + " aborted waiting for a person or a container that will never come.");
402  }
403 }
404 
405 
406 int
408  int result = 0;
409  for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
410  const SUMOVehicle* veh = it->second;
411  if ((veh->isOnRoad() || veh->isRemoteControlled()) && veh->getSpeed() < SUMO_const_haltingSpeed) {
412  result++;
413  }
414  }
415  return result;
416 }
417 
418 
419 
420 std::pair<double, double>
422  double speedSum = 0;
423  double relSpeedSum = 0;
424  int count = 0;
425  for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
426  const SUMOVehicle* veh = it->second;
427  if ((veh->isOnRoad() || veh->isRemoteControlled()) && !veh->isStopped()) {
428  count++;
429  speedSum += veh->getSpeed();
430  relSpeedSum += veh->getSpeed() / veh->getEdge()->getSpeedLimit();
431  }
432  }
433  if (count > 0) {
434  return std::make_pair(speedSum / count, relSpeedSum / count);
435  } else {
436  return std::make_pair(-1, -1);
437  }
438 }
439 
440 
441 int
442 MSVehicleControl::getQuota(double frac) const {
443  frac = frac < 0 ? myScale : frac;
444  if (frac < 0 || frac == 1.) {
445  return 1;
446  }
447  // the vehicle in question has already been loaded, hence the '-1'
448  const int loaded = frac > 1. ? (int)(myLoadedVehNo / frac) : myLoadedVehNo - 1;
449  const int base = (int)frac;
450  const int resolution = 1000;
451  const int intFrac = (int)floor((frac - base) * resolution + 0.5);
452  // apply % twice to avoid integer overflow
453  if (((loaded % resolution) * intFrac) % resolution < intFrac) {
454  return base + 1;
455  }
456  return base;
457 }
458 
459 int
462 }
463 
464 
465 void
467  for (const SUMOVehicle* const veh : myPTVehicles) {
468  // add single vehicles with line attribute which are not part of a flow
469  const MSRoute* const route = MSRoute::dictionary(veh->getParameter().routeid);
470  router.getNetwork()->addSchedule(veh->getParameter(), route == nullptr ? nullptr : &route->getStops());
471  }
472 }
473 
474 
475 /****************************************************************************/
476 
The departure is person triggered.
The vehicle has departed (was inserted into the network)
Definition: MSNet.h:498
bool myDefaultPedTypeMayBeDeleted
Whether the default pedestrian type was already used or can still be replaced.
bool checkVType(const std::string &id)
Checks whether the vehicle type (distribution) may be added.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
void addWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Adds a vehicle to the list of waiting vehiclse to a given edge.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
int myTeleportsWrongLane
The number of teleports due to vehicles stuck on the wrong lane.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle&#39;s state change.
Definition: MSNet.cpp:855
is a pedestrian
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:121
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
int myEndedVehNo
The number of removed vehicles.
static bool teleportOnCollision()
Definition: MSLane.h:1132
virtual const MSRoute & getRoute() const =0
Returns the current route.
Represents a generic random distribution.
int myDiscarded
The number of vehicles which were discarded while loading.
vehicle is a not electrified rail
The departure is container triggered.
Structure representing possible vehicle parameter.
std::map< const MSEdge *const, std::vector< SUMOVehicle * > > myWaiting
the lists of waiting vehicles to a given edge
vehicle is a bicycle
bool hasVTypeDistribution(const std::string &id) const
Asks for a vehicle type distribution.
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
int getQuota(double frac=-1) const
Returns the number of instances of the current vehicle that shall be emitted considering that "frac" ...
MSVehicleControl()
Constructor.
weights: time range begin
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:162
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:165
T MAX2(T a, T b)
Definition: StdDefs.h:76
VehicleDictType myVehicleDict
Dictionary of vehicles.
const std::string DEFAULT_BIKETYPE_ID
const std::vector< T > & getVals() const
Returns the members of the distribution.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
VTypeDictType myVTypeDict
Dictionary of vehicle types.
int myTeleportsJam
The number of teleports due to jam.
const std::string & getID() const
Returns the id.
Definition: Named.h:78
bool myDefaultVTypeMayBeDeleted
Whether the default vehicle type was already used or can still be replaced.
bool hasVType(const std::string &id) const
Asks for existence of a vehicle type.
double myMaxSpeedFactor
The maximum speed factor for all vehicles in the network.
const std::string DEFAULT_VTYPE_ID
double getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:899
void setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime)
Sets the current state variables as loaded from the stream.
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
vehicle is a (possibly fast moving) electric rail
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:241
The car-following model and parameter.
Definition: MSVehicleType.h:66
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
vehicle is a city rail
static std::mt19937 * getParsingRNG()
virtual std::pair< double, double > getVehicleMeanSpeeds() const
get current absolute and relative mean vehicle speed in the network
A road/street connecting two junctions.
Definition: MSEdge.h:75
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle&#39;s access class.
#define STEPFLOOR(x)
Definition: SUMOTime.h:61
std::set< std::string > getVTypeDistributionMembership(const std::string &id) const
Return the distribution IDs the vehicle type is a member of.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type&#39;s car following model definition (const version)
The vehicle arrived at his destination (is deleted)
Definition: MSNet.h:504
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
Representation of a vehicle.
Definition: SUMOVehicle.h:60
void registerOneWaiting(const bool isPerson)
increases the count of vehicles waiting for a transport to allow recognition of person / container re...
virtual const std::vector< MSVehicleDevice * > & getDevices() const =0
Returns this vehicle&#39;s devices.
void removeVType(const MSVehicleType *vehType)
double myTotalTravelTime
The aggregated time vehicles needed to aacomplish their route (in seconds)
SUMOTime depart
The vehicle&#39;s departure time.
#define STEPS2TIME(x)
Definition: SUMOTime.h:58
virtual bool isRemoteControlled() const =0
Returns the information whether the vehicle is fully controlled via TraCI.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
int myLoadedVehNo
The number of build vehicles.
T MIN2(T a, T b)
Definition: StdDefs.h:70
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines, const double position, const std::string ridingID)
void saveState(OutputDevice &out)
Saves the current state into the given stream.
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
double getMaxDecel() const
Get the vehicle type&#39;s maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:218
int myRunningVehNo
The number of vehicles within the network (build and inserted but not removed)
virtual double getChosenSpeedFactor() const =0
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
vehicle is a passenger car (a "normal" car)
void insertVTypeIDs(std::vector< std::string > &into) const
Inserts ids of all known vehicle types and vehicle type distributions to the given vector...
std::string line
The vehicle&#39;s line (mainly for public transport)
is an arbitrary ship
void abortWaiting()
informes about all waiting vehicles (deletion in destructor)
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=0)
Returns the named vehicle type or a sample from the named distribution.
int parametersSet
Information for the router which parameter were set.
The vehicle was built, but has not yet departed.
Definition: MSNet.h:496
bool addVType(MSVehicleType *vehType)
Adds a vehicle type.
double myTotalDepartureDelay
The aggregated time vehicles had to wait for departure (in seconds)
double departPos
(optional) The position the vehicle shall depart from
trigger: the time of the step
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
void scheduleVehicleRemoval(SUMOVehicle *veh)
Removes a vehicle after it has ended.
Structure representing possible vehicle parameter.
std::map< std::string, std::set< std::string > > myVTypeToDist
Inverse lookup from vehicle type to distributions it is a member of.
void addSchedule(const SUMOVehicleParameter &pars, const std::vector< SUMOVehicleParameter::Stop > *addStops=nullptr)
VTypeDistDictType myVTypeDistDict
A distribution of vehicle types (probability->vehicle type)
virtual SUMOTime getDeparture() const =0
Returns this vehicle&#39;s real departure time.
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
int myCollisions
The number of collisions.
const std::string DEFAULT_PEDTYPE_ID
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)
weights: time range end
virtual ~MSVehicleControl()
Destructor.
A storage for options typed value containers)
Definition: OptionsCont.h:92
bool addVTypeDistribution(const std::string &id, RandomDistributor< MSVehicleType *> *vehTypeDistribution)
Adds a vehicle type distribution.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:94
Abstract in-vehicle device.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:60
virtual bool isStopped() const =0
Returns whether the vehicle is at a stop.
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 vehicleDeparted(const SUMOVehicle &v)
Informs this control about a vehicle&#39;s departure.
double myScale
The scaling factor (especially for inc-dua)
double myMinDeceleration
The minimum deceleration capability for all vehicles in the network.
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
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.
int myTeleportsYield
The number of teleports due to vehicles stuck on a minor road.
const int VTYPEPARS_VEHICLECLASS_SET
distribution of a vehicle type
virtual double getSpeed() const =0
Returns the vehicle&#39;s current speed.
static bool gUseMesoSim
Definition: MSGlobals.h:91
int getTeleportCount() const
return the number of teleports (including collisions)
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
Definition: MSRoute.cpp:366
virtual const std::string & getID() const =0
Get the vehicle&#39;s ID.
vehicles ignoring classes
bool myDefaultBikeTypeMayBeDeleted
Whether the default bicycle type was already used or can still be replaced.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Network * getNetwork() const
void removeWaiting(const MSEdge *const edge, const SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
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:114
std::vector< SUMOVehicle * > myPTVehicles
List of vehicles which belong to public transport.