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-2019 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/Named.h>
35 #include <utils/common/RGBColor.h>
41 #ifdef HAVE_FOX
43 #endif
44 
45 
46 // ===========================================================================
47 // member method definitions
48 // ===========================================================================
50  myLoadedVehNo(0),
51  myRunningVehNo(0),
52  myEndedVehNo(0),
53  myDiscarded(0),
54  myCollisions(0),
55  myTeleportsJam(0),
56  myTeleportsYield(0),
57  myTeleportsWrongLane(0),
58  myEmergencyStops(0),
59  myTotalDepartureDelay(0),
60  myTotalTravelTime(0),
61  myDefaultVTypeMayBeDeleted(true),
62  myDefaultPedTypeMayBeDeleted(true),
63  myDefaultBikeTypeMayBeDeleted(true),
64  myWaitingForPerson(0),
65  myWaitingForContainer(0),
66  myMaxSpeedFactor(1),
67  myMinDeceleration(SUMOVTypeParameter::getDefaultDecel(SVC_IGNORING)),
68  myPendingRemovals(MSGlobals::gNumSimThreads > 1) {
78  myScale = oc.getFloat("scale");
79  myStopTolerance = oc.getFloat("ride.stop-tolerance");
80 }
81 
82 
84  // delete vehicles
85  for (VehicleDictType::iterator i = myVehicleDict.begin(); i != myVehicleDict.end(); ++i) {
86  delete (*i).second;
87  }
88  myVehicleDict.clear();
89  // delete vehicle type distributions
90  for (VTypeDistDictType::iterator i = myVTypeDistDict.begin(); i != myVTypeDistDict.end(); ++i) {
91  delete (*i).second;
92  }
93  myVTypeDistDict.clear();
94  // delete vehicle types
95  for (VTypeDictType::iterator i = myVTypeDict.begin(); i != myVTypeDict.end(); ++i) {
96  //delete(*i).second;
97  }
98  myVTypeDict.clear();
99 }
100 
101 
104  const MSRoute* route, MSVehicleType* type,
105  const bool ignoreStopErrors, const bool fromRouteFile) {
106  myLoadedVehNo++;
107  MSVehicle* built = new MSVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : nullptr));
108  built->addStops(ignoreStopErrors);
110  return built;
111 }
112 
113 
114 void
116  assert(myRunningVehNo > 0);
117  if (!checkDuplicate ||
118 #ifdef HAVE_FOX
119  std::find(myPendingRemovals.getContainer().begin(), myPendingRemovals.getContainer().end(), veh) == myPendingRemovals.getContainer().end()
120 #else
121  std::find(myPendingRemovals.begin(), myPendingRemovals.end(), veh) == myPendingRemovals.end()
122 #endif
123  ) {
124  myPendingRemovals.push_back(veh);
125  }
126 }
127 
128 
129 void
131  OutputDevice* tripinfoOut = OptionsCont::getOptions().isSet("tripinfo-output") ? &OutputDevice::getDeviceByOption("tripinfo-output") : nullptr;
132 #ifdef HAVE_FOX
133  std::vector<SUMOVehicle*>& vehs = myPendingRemovals.getContainer();
134 #else
135  std::vector<SUMOVehicle*>& vehs = myPendingRemovals;
136 #endif
137  std::sort(vehs.begin(), vehs.end(), ComparatorNumericalIdLess());
138  for (SUMOVehicle* const veh : vehs) {
139  myTotalTravelTime += STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - veh->getDeparture());
140  myRunningVehNo--;
142  for (MSVehicleDevice* const dev : veh->getDevices()) {
143  dev->generateOutput();
144  }
145  if (tripinfoOut != nullptr) {
146  // close tag after tripinfo (possibly including emissions from another device) have been written
147  tripinfoOut->closeTag();
148  }
149  deleteVehicle(veh);
150  }
151  vehs.clear();
152  if (tripinfoOut != nullptr) {
153  // there seem to be people who think reading an unfinished xml is a good idea ;-)
154  tripinfoOut->flush();
155  }
156 #ifdef HAVE_FOX
157  myPendingRemovals.unlock();
158 #endif
159 }
160 
161 
162 void
164  ++myRunningVehNo;
168  if ((v.getVClass() & (SVC_PEDESTRIAN | SVC_NON_ROAD)) == 0) {
169  // only worry about deceleration of road users
171  }
172 }
173 
174 
175 void
176 MSVehicleControl::setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime) {
177  myRunningVehNo = runningVehNo;
178  myLoadedVehNo = loadedVehNo;
179  myEndedVehNo = endedVehNo;
180  myTotalDepartureDelay = totalDepartureDelay;
181  myTotalTravelTime = totalTravelTime;
182 }
183 
184 
185 void
187  out.openTag(SUMO_TAG_DELAY);
193  // save vehicle types
194  for (VTypeDictType::iterator it = myVTypeDict.begin(); it != myVTypeDict.end(); ++it) {
195  it->second->getParameter().write(out);
196  }
197  for (VTypeDistDictType::iterator it = myVTypeDistDict.begin(); it != myVTypeDistDict.end(); ++it) {
199  out.writeAttr(SUMO_ATTR_VTYPES, (*it).second->getVals());
200  out.writeAttr(SUMO_ATTR_PROBS, (*it).second->getProbs());
201  out.closeTag();
202  }
203  for (VehicleDictType::iterator it = myVehicleDict.begin(); it != myVehicleDict.end(); ++it) {
204  (*it).second->saveState(out);
205  }
206 }
207 
208 
209 bool
210 MSVehicleControl::addVehicle(const std::string& id, SUMOVehicle* v) {
211  VehicleDictType::iterator it = myVehicleDict.find(id);
212  if (it == myVehicleDict.end()) {
213  // id not in myVehicleDict.
214  myVehicleDict[id] = v;
215  const SUMOVehicleParameter& pars = v->getParameter();
217  const MSEdge* const firstEdge = v->getRoute().getEdges()[0];
218  if (!MSGlobals::gUseMesoSim) {
219  // position will be checked against person position later
220  static_cast<MSVehicle*>(v)->setTentativeLaneAndPosition(firstEdge->getLanes()[0], v->getParameter().departPos);
221  }
222  addWaiting(v->getRoute().getEdges().front(), v);
224  }
225  if (pars.line != "" && pars.repetitionNumber < 0) {
226  myPTVehicles.push_back(v);
227  }
228  return true;
229  }
230  return false;
231 }
232 
233 
235 MSVehicleControl::getVehicle(const std::string& id) const {
236  VehicleDictType::const_iterator it = myVehicleDict.find(id);
237  if (it == myVehicleDict.end()) {
238  return nullptr;
239  }
240  return it->second;
241 }
242 
243 
244 void
246  myEndedVehNo++;
247  if (discard) {
248  myDiscarded++;
249  }
250  if (veh != nullptr) {
251  myVehicleDict.erase(veh->getID());
252  }
253  auto ptVehIt = std::find(myPTVehicles.begin(), myPTVehicles.end(), veh);
254  if (ptVehIt != myPTVehicles.end()) {
255  myPTVehicles.erase(ptVehIt);
256  }
257  delete veh;
258 }
259 
260 
261 bool
262 MSVehicleControl::checkVType(const std::string& id) {
263  if (id == DEFAULT_VTYPE_ID) {
265  delete myVTypeDict[id];
266  myVTypeDict.erase(myVTypeDict.find(id));
268  } else {
269  return false;
270  }
271  } else if (id == DEFAULT_PEDTYPE_ID) {
273  delete myVTypeDict[id];
274  myVTypeDict.erase(myVTypeDict.find(id));
276  } else {
277  return false;
278  }
279  } else if (id == DEFAULT_BIKETYPE_ID) {
281  delete myVTypeDict[id];
282  myVTypeDict.erase(myVTypeDict.find(id));
284  } else {
285  return false;
286  }
287  } else {
288  if (myVTypeDict.find(id) != myVTypeDict.end() || myVTypeDistDict.find(id) != myVTypeDistDict.end()) {
289  return false;
290  }
291  }
292  return true;
293 }
294 
295 bool
297  if (checkVType(vehType->getID())) {
298  myVTypeDict[vehType->getID()] = vehType;
299  return true;
300  }
301  return false;
302 }
303 
304 
305 void
307  assert(vehType != 0);
308  assert(myVTypeDict.find(vehType->getID()) != myVTypeDict.end());
309  myVTypeDict.erase(vehType->getID());
310  if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
311  myVTypeToDist.erase(vehType->getID());
312  }
313  delete vehType;
314 }
315 
316 
317 bool
318 MSVehicleControl::addVTypeDistribution(const std::string& id, RandomDistributor<MSVehicleType*>* vehTypeDistribution) {
319  if (checkVType(id)) {
320  myVTypeDistDict[id] = vehTypeDistribution;
321  std::vector<MSVehicleType*> vehTypes = vehTypeDistribution->getVals();
322  for (auto vehType : vehTypes) {
323  if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
324  myVTypeToDist[vehType->getID()].insert(id);
325  } else {
326  myVTypeToDist[vehType->getID()] = { id };
327  }
328  }
329  return true;
330  }
331  return false;
332 }
333 
334 
335 bool
336 MSVehicleControl::hasVType(const std::string& id) const {
337  return myVTypeDict.count(id) > 0 || myVTypeDistDict.count(id) > 0;
338 }
339 
340 
341 bool
342 MSVehicleControl::hasVTypeDistribution(const std::string& id) const {
343  return myVTypeDistDict.count(id) > 0;
344 }
345 
346 
348 MSVehicleControl::getVType(const std::string& id, std::mt19937* rng) {
349  VTypeDictType::iterator it = myVTypeDict.find(id);
350  if (it == myVTypeDict.end()) {
351  VTypeDistDictType::iterator it2 = myVTypeDistDict.find(id);
352  if (it2 == myVTypeDistDict.end()) {
353  return nullptr;
354  }
355  return it2->second->get(rng);
356  }
357  if (id == DEFAULT_VTYPE_ID) {
359  } else if (id == DEFAULT_PEDTYPE_ID) {
361  }
362  return it->second;
363 }
364 
365 
366 void
367 MSVehicleControl::insertVTypeIDs(std::vector<std::string>& into) const {
368  into.reserve(into.size() + myVTypeDict.size() + myVTypeDistDict.size());
369  for (VTypeDictType::const_iterator i = myVTypeDict.begin(); i != myVTypeDict.end(); ++i) {
370  into.push_back((*i).first);
371  }
372  for (VTypeDistDictType::const_iterator i = myVTypeDistDict.begin(); i != myVTypeDistDict.end(); ++i) {
373  into.push_back((*i).first);
374  }
375 }
376 
377 
378 const std::set<std::string>
380  std::map<std::string, std::set<std::string>>::const_iterator it = myVTypeToDist.find(id);
381  if (it == myVTypeToDist.end()) {
382  return std::set<std::string>();
383  }
384  return it->second;
385 }
386 
387 
388 void
389 MSVehicleControl::addWaiting(const MSEdge* const edge, SUMOVehicle* vehicle) {
390  if (myWaiting.find(edge) == myWaiting.end()) {
391  myWaiting[edge] = std::vector<SUMOVehicle*>();
392  }
393  myWaiting[edge].push_back(vehicle);
394 }
395 
396 
397 void
398 MSVehicleControl::removeWaiting(const MSEdge* const edge, const SUMOVehicle* vehicle) {
399  if (myWaiting.find(edge) != myWaiting.end()) {
400  std::vector<SUMOVehicle*>::iterator it = std::find(myWaiting[edge].begin(), myWaiting[edge].end(), vehicle);
401  if (it != myWaiting[edge].end()) {
402  myWaiting[edge].erase(it);
403  }
404  }
405 }
406 
407 
409 MSVehicleControl::getWaitingVehicle(MSTransportable* transportable, const MSEdge* const edge, const double position) {
410  if (myWaiting.find(edge) != myWaiting.end()) {
411  for (SUMOVehicle* const vehicle : myWaiting[edge]) {
412  if (transportable->isWaitingFor(vehicle)) {
413  if (vehicle->isStoppedInRange(position, myStopTolerance) ||
414  (!vehicle->hasDeparted() &&
415  (vehicle->getParameter().departProcedure == DEPART_TRIGGERED ||
416  vehicle->getParameter().departProcedure == DEPART_CONTAINER_TRIGGERED))) {
417  return vehicle;
418  }
419  // !!! this gives false warnings when there are two stops on the same edge
420  WRITE_WARNING(transportable->getID() + " at edge '" + edge->getID() + "' position " + toString(position) + " cannot use waiting vehicle '"
421  + vehicle->getID() + "' at position " + toString(vehicle->getPositionOnLane()) + " because it is too far away.");
422  }
423  }
424  }
425  return nullptr;
426 }
427 
428 
429 void
431  for (VehicleDictType::iterator i = myVehicleDict.begin(); i != myVehicleDict.end(); ++i) {
432  WRITE_WARNING("Vehicle " + i->first + " aborted waiting for a person or a container that will never come.");
433  }
434 }
435 
436 
437 int
439  int result = 0;
440  for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
441  const SUMOVehicle* veh = it->second;
442  if ((veh->isOnRoad() || veh->isRemoteControlled()) && veh->getSpeed() < SUMO_const_haltingSpeed) {
443  result++;
444  }
445  }
446  return result;
447 }
448 
449 
450 
451 std::pair<double, double>
453  double speedSum = 0;
454  double relSpeedSum = 0;
455  int count = 0;
456  for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
457  const SUMOVehicle* veh = it->second;
458  if ((veh->isOnRoad() || veh->isRemoteControlled()) && !veh->isStopped()) {
459  count++;
460  speedSum += veh->getSpeed();
461  relSpeedSum += veh->getSpeed() / veh->getEdge()->getSpeedLimit();
462  }
463  }
464  if (count > 0) {
465  return std::make_pair(speedSum / count, relSpeedSum / count);
466  } else {
467  return std::make_pair(-1, -1);
468  }
469 }
470 
471 
472 int
473 MSVehicleControl::getQuota(double frac) const {
474  frac = frac < 0 ? myScale : frac;
475  if (frac < 0 || frac == 1.) {
476  return 1;
477  }
478  // the vehicle in question has already been loaded, hence the '-1'
479  const int loaded = frac > 1. ? (int)(myLoadedVehNo / frac) : myLoadedVehNo - 1;
480  const int base = (int)frac;
481  const int resolution = 1000;
482  const int intFrac = (int)floor((frac - base) * resolution + 0.5);
483  // apply % twice to avoid integer overflow
484  if (((loaded % resolution) * intFrac) % resolution < intFrac) {
485  return base + 1;
486  }
487  return base;
488 }
489 
490 int
493 }
494 
495 
496 void
498  for (const SUMOVehicle* const veh : myPTVehicles) {
499  // add single vehicles with line attribute which are not part of a flow
500  const MSRoute* const route = MSRoute::dictionary(veh->getParameter().routeid);
501  router.getNetwork()->addSchedule(veh->getParameter(), route == nullptr ? nullptr : &route->getStops());
502  }
503 }
504 
505 
506 /****************************************************************************/
507 
The departure is person triggered.
The vehicle has departed (was inserted into the network)
Definition: MSNet.h:540
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 vehicles for the given edge.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
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:882
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:121
int myEndedVehNo
The number of removed vehicles.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle&#39;s type.
static bool teleportOnCollision()
Definition: MSLane.h:1198
virtual const std::string & getID() const =0
Get the vehicle&#39;s ID.
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.
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.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
Returns the named vehicle type or a sample from the named 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.
classes which (normally) do not drive on normal roads
int getQuota(double frac=-1) const
Returns the number of instances of the current vehicle that shall be emitted considering that "frac" ...
MSVehicleControl()
Constructor.
#define HAVE_FOX
Definition: config.h:38
const std::set< std::string > getVTypeDistributionMembership(const std::string &id) const
Return the distribution IDs the vehicle type is a member of.
weights: time range begin
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:165
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
T MAX2(T a, T b)
Definition: StdDefs.h:80
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.
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle&#39;s access class.
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.
virtual double getChosenSpeedFactor() const =0
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:916
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.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
The car-following model and parameter.
Definition: MSVehicleType.h:66
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
static std::mt19937 * getParsingRNG()
get parsing RNG
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:76
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
#define STEPFLOOR(x)
Definition: SUMOTime.h:60
std::vector< SUMOVehicle * > myPendingRemovals
List of vehicles which are going to be removed.
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:546
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
Representation of a vehicle.
Definition: SUMOVehicle.h:61
void registerOneWaiting(const bool isPerson)
increases the count of vehicles waiting for a transport to allow recognition of person / container re...
void removeVType(const MSVehicleType *vehType)
double myTotalTravelTime
The aggregated time vehicles needed to aacomplish their route (in seconds)
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
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:74
double myStopTolerance
The tolerance to apply when matching waiting persons and vehicles.
const std::string & getID() const
returns the id of the transportable
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)
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)
void abortWaiting()
informes about all waiting vehicles (deletion in destructor)
int parametersSet
Information for the router which parameter were set.
The vehicle was built, but has not yet departed.
Definition: MSNet.h:538
bool addVType(MSVehicleType *vehType)
Adds a vehicle type.
Function-object for stable sorting of objects with numerical ids.
Definition: Named.h:42
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.
Structure representing possible vehicle parameter.
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const MSEdge *const edge, const double position)
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
void removePending()
Removes a vehicle after it has ended.
virtual ~MSVehicleControl()
Destructor.
A storage for options typed value containers)
Definition: OptionsCont.h:90
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:61
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
virtual bool isStopped() const =0
Returns whether the vehicle is at a stop.
int getTeleportCount() const
return the number of teleports (including collisions)
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
Definition: MSRoute.cpp:375
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 for the given edge.
bool isWaitingFor(const SUMOVehicle *vehicle) const
Whether the transportable waits for the given vehicle in the current step.
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.