SUMO - Simulation of Urban MObility
MSEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
13 // A road/street connecting two junctions
14 /****************************************************************************/
15 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
16 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
17 /****************************************************************************/
18 //
19 // This file is part of SUMO.
20 // SUMO is free software: you can redistribute it and/or modify
21 // it under the terms of the GNU General Public License as published by
22 // the Free Software Foundation, either version 3 of the License, or
23 // (at your option) any later version.
24 //
25 /****************************************************************************/
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #include <algorithm>
38 #include <iostream>
39 #include <cassert>
42 #include "MSEdge.h"
43 #include "MSInsertionControl.h"
44 #include "MSJunction.h"
45 #include "MSLane.h"
46 #include "MSLaneChanger.h"
47 #include "MSLaneChangerSublane.h"
48 #include "MSGlobals.h"
49 #include "MSNet.h"
50 #include "MSVehicle.h"
51 #include "MSLeaderInfo.h"
52 #include "MSContainer.h"
53 #include "MSEdgeWeightsStorage.h"
55 
56 #include <mesosim/MELoop.h>
57 #include <mesosim/MESegment.h>
58 #include <mesosim/MEVehicle.h>
59 
60 #define BEST_LANE_LOOKAHEAD 3000.0
61 
62 // ===========================================================================
63 // static member definitions
64 // ===========================================================================
67 
68 
69 // ===========================================================================
70 // member method definitions
71 // ===========================================================================
72 MSEdge::MSEdge(const std::string& id, int numericalID,
73  const EdgeBasicFunction function,
74  const std::string& streetName,
75  const std::string& edgeType,
76  int priority) :
77  Named(id), myNumericalID(numericalID), myLanes(0),
78  myLaneChanger(0), myFunction(function), myVaporizationRequests(0),
79  myLastFailedInsertionTime(-1),
80  myFromJunction(0), myToJunction(0),
81  myStreetName(streetName),
82  myEdgeType(edgeType),
83  myPriority(priority),
84  myWidth(0),
85  myLength(-1.),
86  myEmptyTraveltime(-1.),
87  myAmDelayed(false),
88  myAmRoundabout(false) {}
89 
90 
92  delete myLaneChanger;
93  for (AllowedLanesCont::iterator i1 = myAllowed.begin(); i1 != myAllowed.end(); i1++) {
94  delete(*i1).second;
95  }
96  for (ClassedAllowedLanesCont::iterator i2 = myClassedAllowed.begin(); i2 != myClassedAllowed.end(); i2++) {
97  for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
98  delete(*i1).second;
99  }
100  }
101  delete myLanes;
102  // Note: Lanes are delete using MSLane::clear();
103 }
104 
105 
106 void
107 MSEdge::initialize(const std::vector<MSLane*>* lanes) {
108  assert(lanes != 0);
109  myLanes = lanes;
112  }
113  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
114  myWidth += (*i)->getWidth();
115  }
116  double widthBefore = 0;
117  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
118  (*i)->setRightSideOnEdge(widthBefore, (int)mySublaneSides.size());
119  MSLeaderInfo ahead(*i);
120  for (int j = 0; j < ahead.numSublanes(); ++j) {
121  mySublaneSides.push_back(widthBefore + j * MSGlobals::gLateralResolution);
122  }
123  widthBefore += (*i)->getWidth();
124  }
125 }
126 
127 
129  if (myLanes->empty()) {
130  return;
131  }
132  myLength = myLanes->front()->getLength();
134 
136  // add tls penalties to the minimum travel time
137  SUMOTime minPenalty = -1;
138  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
139  MSLane* l = *i;
140  const MSLinkCont& lc = l->getLinkCont();
141  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
142  MSLink* link = *j;
143  SUMOTime linkPenalty = link->getMesoTLSPenalty() + (link->havePriority() ? 0 : MSGlobals::gMesoMinorPenalty);
144  if (minPenalty == -1) {
145  minPenalty = linkPenalty;
146  } else {
147  minPenalty = MIN2(minPenalty, linkPenalty);
148  }
149  }
150  }
151  if (minPenalty > 0) {
152  myEmptyTraveltime += STEPS2TIME(minPenalty);
153  }
154  }
155 }
156 
157 
158 void
160  myAllowed[0] = new std::vector<MSLane*>();
161  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
162  myAllowed[0]->push_back(*i);
163  const MSLinkCont& lc = (*i)->getLinkCont();
164  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
165  (*j)->initParallelLinks();
166  MSLane* toL = (*j)->getLane();
167  if (toL != 0) {
168  MSEdge& to = toL->getEdge();
169  //
170  if (std::find(mySuccessors.begin(), mySuccessors.end(), &to) == mySuccessors.end()) {
171  mySuccessors.push_back(&to);
172  }
173  if (std::find(to.myPredecessors.begin(), to.myPredecessors.end(), this) == to.myPredecessors.end()) {
174  to.myPredecessors.push_back(this);
175  }
176  //
177  if (myAllowed.find(&to) == myAllowed.end()) {
178  myAllowed[&to] = new std::vector<MSLane*>();
179  }
180  myAllowed[&to]->push_back(*i);
181  }
182  toL = (*j)->getViaLane();
183  if (toL != 0) {
184  MSEdge& to = toL->getEdge();
185  if (std::find(to.myPredecessors.begin(), to.myPredecessors.end(), this) == to.myPredecessors.end()) {
186  to.myPredecessors.push_back(this);
187  }
188  }
189  }
190  }
191  std::sort(mySuccessors.begin(), mySuccessors.end(), by_id_sorter());
193  recalcCache();
194  // segment building depends on the finished list of successors (for multi-queue)
195  if (MSGlobals::gUseMesoSim && !myLanes->empty()) {
197  }
198 }
199 
200 
201 void
203  if (!myLanes->empty()) {
204  const bool allowChanging = allowsLaneChanging();
206  // may always initiate sublane-change
207  myLaneChanger = new MSLaneChangerSublane(myLanes, allowChanging);
208  } else {
210  myLaneChanger = new MSLaneChanger(myLanes, allowChanging);
211  } else if (myLanes->size() > 1 || canChangeToOpposite()) {
212  myLaneChanger = new MSLaneChanger(myLanes, allowChanging);
213  }
214  }
215  }
216 }
217 
218 
219 bool
222  // allow changing only if all links leading to this internal lane have priority
223  // or they are controlled by a traffic light
224  for (std::vector<MSLane*>::const_iterator it = myLanes->begin(); it != myLanes->end(); ++it) {
225  MSLane* pred = (*it)->getLogicalPredecessorLane();
226  MSLink* link = MSLinkContHelper::getConnectingLink(*pred, **it);
227  assert(link != 0);
228  LinkState state = link->getState();
229  if (state == LINKSTATE_MINOR
230  || state == LINKSTATE_EQUAL
231  || state == LINKSTATE_STOP
232  || state == LINKSTATE_ALLWAY_STOP
233  || state == LINKSTATE_DEADEND) {
234  return false;
235  }
236  }
237  }
238  return true;
239 }
240 
241 
242 void
244  // clear myClassedAllowed.
245  // it will be rebuilt on demand
246  for (ClassedAllowedLanesCont::iterator i2 = myClassedAllowed.begin(); i2 != myClassedAllowed.end(); i2++) {
247  for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
248  delete(*i1).second;
249  }
250  }
251  myClassedAllowed.clear();
252  myClassesSuccessorMap.clear();
253  // rebuild myMinimumPermissions and myCombinedPermissions
256  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
257  myMinimumPermissions &= (*i)->getPermissions();
258  myCombinedPermissions |= (*i)->getPermissions();
259  }
260 }
261 
262 
263 // ------------ Access to the edge's lanes
264 MSLane*
265 MSEdge::leftLane(const MSLane* const lane) const {
266  return parallelLane(lane, 1);
267 }
268 
269 
270 MSLane*
271 MSEdge::rightLane(const MSLane* const lane) const {
272  return parallelLane(lane, -1);
273 }
274 
275 
276 MSLane*
277 MSEdge::parallelLane(const MSLane* const lane, int offset) const {
278  const int index = (int)(find(myLanes->begin(), myLanes->end(), lane) - myLanes->begin());
279  if (index == (int)myLanes->size()) {
280  return 0;
281  }
282  const int resultIndex = index + offset;
283  if (resultIndex >= (int)myLanes->size() || resultIndex < 0) {
284  return 0;
285  } else {
286  return (*myLanes)[resultIndex];
287  }
288 }
289 
290 
291 const std::vector<MSLane*>*
292 MSEdge::allowedLanes(const MSEdge& destination, SUMOVehicleClass vclass) const {
293  return allowedLanes(&destination, vclass);
294 }
295 
296 
297 const std::vector<MSLane*>*
299  return allowedLanes(0, vclass);
300 }
301 
302 
303 const std::vector<MSLane*>*
305  AllowedLanesCont::const_iterator it = c.find(dest);
306  if (it == c.end()) {
307  return 0;
308  }
309  return it->second;
310 }
311 
312 
313 const std::vector<MSLane*>*
314 MSEdge::allowedLanes(const MSEdge* destination, SUMOVehicleClass vclass) const {
315  if (destination == 0 && (myMinimumPermissions & vclass) == vclass) {
316  // all lanes allow vclass
317  return getAllowedLanesWithDefault(myAllowed, destination);
318  }
319  // look up cached result in myClassedAllowed
320  ClassedAllowedLanesCont::const_iterator i = myClassedAllowed.find(vclass);
321  if (i != myClassedAllowed.end()) {
322  // can use cached value
323  const AllowedLanesCont& c = (*i).second;
324  return getAllowedLanesWithDefault(c, destination);
325  } else {
326  // this vclass is requested for the first time. rebuild all destinations
327  // go through connected edges
328 #ifdef HAVE_FOX
329  if (MSDevice_Routing::isParallel()) {
330  MSDevice_Routing::lock();
331  }
332 #endif
333  for (AllowedLanesCont::const_iterator i1 = myAllowed.begin(); i1 != myAllowed.end(); ++i1) {
334  const MSEdge* edge = i1->first;
335  const std::vector<MSLane*>* lanes = i1->second;
336  myClassedAllowed[vclass][edge] = new std::vector<MSLane*>();
337  // go through lanes approaching current edge
338  for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
339  // origin lane allows the current vehicle class?
340  if ((*i2)->allowsVehicleClass(vclass)) {
341  if (edge == 0) {
342  myClassedAllowed[vclass][edge]->push_back(*i2);
343  } else {
344  // target lane allows the current vehicle class?
345  const MSLinkCont& lc = (*i2)->getLinkCont();
346  for (MSLinkCont::const_iterator it_link = lc.begin(); it_link != lc.end(); ++it_link) {
347  const MSLane* targetLane = (*it_link)->getLane();
348  if ((&(targetLane->getEdge()) == edge) && targetLane->allowsVehicleClass(vclass)) {
349  // -> may be used
350  myClassedAllowed[vclass][edge]->push_back(*i2);
351  break;
352  }
353  }
354  }
355  }
356  }
357  // assert that 0 is returned if no connection is allowed for a class
358  if (myClassedAllowed[vclass][edge]->size() == 0) {
359  delete myClassedAllowed[vclass][edge];
360  myClassedAllowed[vclass][edge] = 0;
361  }
362  }
363 #ifdef HAVE_FOX
364  if (MSDevice_Routing::isParallel()) {
365  MSDevice_Routing::unlock();
366  }
367 #endif
368  return myClassedAllowed[vclass][destination];
369  }
370 }
371 
372 
373 // ------------
374 SUMOTime
377  return 0;
378 }
379 
380 
381 SUMOTime
384  return 0;
385 }
386 
387 
388 MSLane*
389 MSEdge::getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass, double departPos) const {
390  if (allowed == 0) {
391  allowed = allowedLanes(vclass);
392  }
393  MSLane* res = 0;
394  if (allowed != 0) {
395  double largestGap = 0;
396  MSLane* resByGap = 0;
397  double leastOccupancy = std::numeric_limits<double>::max();;
398  for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
399  const double occupancy = (*i)->getBruttoOccupancy();
400  if (occupancy < leastOccupancy) {
401  res = (*i);
402  leastOccupancy = occupancy;
403  }
404  const MSVehicle* last = (*i)->getLastFullVehicle();
405  const double lastGap = (last != 0 ? last->getPositionOnLane() : myLength) - departPos;
406  if (lastGap > largestGap) {
407  largestGap = lastGap;
408  resByGap = (*i);
409  }
410  }
411  if (resByGap != 0) {
412  //if (res != resByGap) std::cout << SIMTIME << " edge=" << getID() << " departPos=" << departPos << " res=" << Named::getIDSecure(res) << " resByGap=" << Named::getIDSecure(resByGap) << " largestGap=" << largestGap << "\n";
413  res = resByGap;
414  }
415  }
416  return res;
417 }
418 
419 double
420 MSEdge::getDepartPosBound(const MSVehicle& veh, bool upper) const {
421  const SUMOVehicleParameter& pars = veh.getParameter();
422  double pos = getLength();
423  // determine the position
424  switch (pars.departPosProcedure) {
425  case DEPART_POS_GIVEN:
426  pos = pars.departPos;
427  if (pos < 0.) {
428  pos += myLength;
429  }
430  break;
431  case DEPART_POS_RANDOM:
432  // could be any position on the edge
433  break;
435  // could be any position on the edge due to multiple random attempts
436  break;
437  case DEPART_POS_FREE:
438  // many candidate positions, upper bound could be computed exactly
439  // with much effort
440  break;
441  case DEPART_POS_LAST:
442  if (upper) {
443  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
444  MSVehicle* last = (*i)->getLastFullVehicle();
445  if (last != 0) {
446  pos = MIN2(pos, last->getPositionOnLane());
447  }
448  }
449  } else {
450  pos = 0;
451  }
452  case DEPART_POS_BASE:
453  case DEPART_POS_DEFAULT:
454  break;
455  default:
456  pos = MIN2(pos, veh.getVehicleType().getLength());
457  break;
458  }
459  return pos;
460 }
461 
462 
463 MSLane*
465  switch (veh.getParameter().departLaneProcedure) {
466  case DEPART_LANE_GIVEN:
467  if ((int) myLanes->size() <= veh.getParameter().departLane || !(*myLanes)[veh.getParameter().departLane]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
468  return 0;
469  }
470  return (*myLanes)[veh.getParameter().departLane];
471  case DEPART_LANE_RANDOM:
473  case DEPART_LANE_FREE:
474  return getFreeLane(0, veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false));
476  if (veh.getRoute().size() == 1) {
477  return getFreeLane(0, veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false));
478  } else {
479  return getFreeLane(allowedLanes(**(veh.getRoute().begin() + 1)), veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false));
480  }
481  case DEPART_LANE_BEST_FREE: {
482  veh.updateBestLanes(false, myLanes->front());
483  const std::vector<MSVehicle::LaneQ>& bl = veh.getBestLanes();
484  double bestLength = -1;
485  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
486  if ((*i).length > bestLength) {
487  bestLength = (*i).length;
488  }
489  }
490  // beyond a certain length, all lanes are suitable
491  // however, we still need to check departPos to avoid unsuitable insertion
492  // (this is only possible in some cases)
493  double departPos = 0;
494  if (bestLength > BEST_LANE_LOOKAHEAD) {
495  departPos = getDepartPosBound(veh);
496  bestLength = MIN2(bestLength - departPos, BEST_LANE_LOOKAHEAD);
497  }
498  std::vector<MSLane*>* bestLanes = new std::vector<MSLane*>();
499  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
500  if (((*i).length - departPos) >= bestLength) {
501  bestLanes->push_back((*i).lane);
502  }
503  }
504  MSLane* ret = getFreeLane(bestLanes, veh.getVehicleType().getVehicleClass(), getDepartPosBound(veh, false));
505  delete bestLanes;
506  return ret;
507  }
508  case DEPART_LANE_DEFAULT:
510  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
511  if ((*i)->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
512  return *i;
513  }
514  }
515  return 0;
516  default:
517  break;
518  }
519  if (!(*myLanes)[0]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
520  return 0;
521  }
522  return (*myLanes)[0];
523 }
524 
525 
526 bool
527 MSEdge::insertVehicle(SUMOVehicle& v, SUMOTime time, const bool checkOnly, const bool forceCheck) const {
528  // when vaporizing, no vehicles are inserted, but checking needs to be successful to trigger removal
529  if (isVaporizing() || isTaz()) {
530  return checkOnly;
531  }
532  const SUMOVehicleParameter& pars = v.getParameter();
533  const MSVehicleType& type = v.getVehicleType();
535  const std::vector<double>& speedFactorParams = type.getSpeedFactor().getParameter();
536  if (speedFactorParams[1] > 0.) {
538  if (v.getChosenSpeedFactor() > speedFactorParams[0] + 2 * speedFactorParams[1]) {
539  // only warn for significant deviation
540  WRITE_WARNING("Choosing new speed factor " + toString(v.getChosenSpeedFactor()) + " for vehicle '" + pars.id + "' to match departure speed.");
541  }
542  } else {
543  throw ProcessError("Departure speed for vehicle '" + pars.id +
544  "' is too high for the departure edge '" + getID() + "'.");
545  }
546  }
548  double pos = 0.0;
549  switch (pars.departPosProcedure) {
550  case DEPART_POS_GIVEN:
551  if (pars.departPos >= 0.) {
552  pos = pars.departPos;
553  } else {
554  pos = pars.departPos + getLength();
555  }
556  if (pos < 0 || pos > getLength()) {
557  WRITE_WARNING("Invalid departPos " + toString(pos) + " given for vehicle '" +
558  v.getID() + "'. Inserting at lane end instead.");
559  pos = getLength();
560  }
561  break;
562  case DEPART_POS_RANDOM:
564  pos = RandHelper::rand(getLength());
565  break;
566  default:
567  break;
568  }
569  bool result = false;
570  MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this, pos);
571  MEVehicle* veh = static_cast<MEVehicle*>(&v);
572  if (pars.departPosProcedure == DEPART_POS_FREE) {
573  while (segment != 0 && !result) {
574  if (checkOnly) {
575  result = segment->hasSpaceFor(veh, time, true);
576  } else {
577  result = segment->initialise(veh, time);
578  }
579  segment = segment->getNextSegment();
580  }
581  } else {
582  if (checkOnly) {
583  result = segment->hasSpaceFor(veh, time, true);
584  } else {
585  result = segment->initialise(veh, time);
586  }
587  }
588  return result;
589  }
590  if (checkOnly) {
591  switch (v.getParameter().departLaneProcedure) {
592  case DEPART_LANE_GIVEN:
593  case DEPART_LANE_DEFAULT:
595  MSLane* insertionLane = getDepartLane(static_cast<MSVehicle&>(v));
596  if (insertionLane == 0) {
597  WRITE_WARNING("could not insert vehicle '" + v.getID() + "' on any lane of edge '" + getID() + "', time=" + time2string(MSNet::getInstance()->getCurrentTimeStep()));
598  return false;
599  }
600  const double occupancy = insertionLane->getBruttoOccupancy();
601  return occupancy == 0 || occupancy * myLength + v.getVehicleType().getLengthWithGap() <= myLength;
602  }
603  default:
604  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
605  const double occupancy = (*i)->getBruttoOccupancy();
606  if (occupancy == 0 || occupancy * myLength + v.getVehicleType().getLengthWithGap() <= myLength) {
607  return true;
608  }
609  }
610  }
611  return false;
612  }
613  MSLane* insertionLane = getDepartLane(static_cast<MSVehicle&>(v));
614  if (insertionLane == 0) {
615  return false;
616  }
617 
618  if (!forceCheck) {
619  if (myLastFailedInsertionTime == time) {
620  if (myFailedInsertionMemory.count(insertionLane->getIndex())) {
621  // A vehicle was already rejected for the proposed insertionLane in this timestep
622  return false;
623  }
624  } else {
625  // last rejection occured in a previous timestep, clear cache
626  myFailedInsertionMemory.clear();
627  }
628  }
629 
630  bool success = insertionLane->insertVehicle(static_cast<MSVehicle&>(v));
631 
632  if (!success) {
633  myFailedInsertionMemory.insert(insertionLane->getIndex());
634  }
635  return success;
636 }
637 
638 
639 void
641  if (myLaneChanger == 0) {
642  return;
643  }
645 }
646 
647 
648 
649 const MSEdge*
650 MSEdge::getInternalFollowingEdge(const MSEdge* followerAfterInternal) const {
651  //@todo to be optimized
652  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
653  MSLane* l = *i;
654  const MSLinkCont& lc = l->getLinkCont();
655  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
656  MSLink* link = *j;
657  if (&link->getLane()->getEdge() == followerAfterInternal) {
658  if (link->getViaLane() != 0) {
659  return &link->getViaLane()->getEdge();
660  } else {
661  return 0; // network without internal links
662  }
663  }
664  }
665  }
666  return 0;
667 }
668 
669 double
670 MSEdge::getInternalFollowingLengthTo(const MSEdge* followerAfterInternal) const {
671  assert(followerAfterInternal != 0);
672  assert(!followerAfterInternal->isInternal());
673  double dist = 0.;
674  const MSEdge* edge = getInternalFollowingEdge(followerAfterInternal);
675  // Take into account non-internal lengths until next non-internal edge
676  while (edge != 0 && edge->isInternal()) {
677  dist += edge->getLength();
678  edge = edge->getInternalFollowingEdge(followerAfterInternal);
679  }
680  return dist;
681 }
682 
683 double
685  double v = 0;
686  double no = 0;
688  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
689  const double vehNo = (double) segment->getCarNumber();
690  v += vehNo * segment->getMeanSpeed();
691  no += vehNo;
692  }
693  if (no == 0) {
694  return getLength() / myEmptyTraveltime; // may include tls-penalty
695  }
696  } else {
697  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
698  const double vehNo = (double)(*i)->getVehicleNumber();
699  v += vehNo * (*i)->getMeanSpeed();
700  no += vehNo;
701  }
702  if (no == 0) {
703  return getSpeedLimit();
704  }
705  }
706  return v / no;
707 }
708 
709 
710 double
711 MSEdge::getCurrentTravelTime(double minSpeed) const {
712  assert(minSpeed > 0);
713  if (!myAmDelayed) {
714  return myEmptyTraveltime;
715  }
716  return getLength() / MAX2(minSpeed, getMeanSpeed());
717 }
718 
719 
720 double
723 }
724 
725 
726 
727 bool
728 MSEdge::dictionary(const std::string& id, MSEdge* ptr) {
729  DictType::iterator it = myDict.find(id);
730  if (it == myDict.end()) {
731  // id not in myDict.
732  myDict[id] = ptr;
733  while ((int)myEdges.size() < ptr->getNumericalID() + 1) {
734  myEdges.push_back(0);
735  }
736  myEdges[ptr->getNumericalID()] = ptr;
737  return true;
738  }
739  return false;
740 }
741 
742 
743 MSEdge*
744 MSEdge::dictionary(const std::string& id) {
745  DictType::iterator it = myDict.find(id);
746  if (it == myDict.end()) {
747  // id not in myDict.
748  return 0;
749  }
750  return it->second;
751 }
752 
753 
754 int
756  return (int)myDict.size();
757 }
758 
759 
760 const MSEdgeVector&
762  return myEdges;
763 }
764 
765 
766 void
768  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
769  delete(*i).second;
770  }
771  myDict.clear();
772 }
773 
774 
775 void
776 MSEdge::insertIDs(std::vector<std::string>& into) {
777  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
778  into.push_back((*i).first);
779  }
780 }
781 
782 
783 void
784 MSEdge::parseEdgesList(const std::string& desc, ConstMSEdgeVector& into,
785  const std::string& rid) {
786  if (desc[0] == BinaryFormatter::BF_ROUTE) {
787  std::istringstream in(desc, std::ios::binary);
788  char c;
789  in >> c;
790  FileHelpers::readEdgeVector(in, into, rid);
791  } else {
792  StringTokenizer st(desc);
793  parseEdgesList(st.getVector(), into, rid);
794  }
795 }
796 
797 
798 void
799 MSEdge::parseEdgesList(const std::vector<std::string>& desc, ConstMSEdgeVector& into,
800  const std::string& rid) {
801  for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
802  const MSEdge* edge = MSEdge::dictionary(*i);
803  // check whether the edge exists
804  if (edge == 0) {
805  throw ProcessError("The edge '" + *i + "' within the route " + rid + " is not known."
806  + "\n The route can not be build.");
807  }
808  into.push_back(edge);
809  }
810 }
811 
812 
813 double
814 MSEdge::getDistanceTo(const MSEdge* other) const {
815  if (getLanes().size() > 0 && other->getLanes().size() > 0) {
817  } else {
818  return 0; // optimism is just right for astar
819  }
820 }
821 
822 
823 double
825  // @note lanes might have different maximum speeds in theory
826  return myLanes->empty() ? 1 : getLanes()[0]->getSpeedLimit();
827 }
828 
829 
830 double
832  return myLanes->empty() ? 1 : getLanes()[0]->getLengthGeometryFactor();
833 }
834 
835 double
836 MSEdge::getVehicleMaxSpeed(const SUMOVehicle* const veh) const {
837  // @note lanes might have different maximum speeds in theory
838  return myLanes->empty() ? 1 : getLanes()[0]->getVehicleMaxSpeed(veh);
839 }
840 
841 
842 void
843 MSEdge::setMaxSpeed(double val) const {
844  if (myLanes != 0) {
845  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
846  (*i)->setMaxSpeed(val);
847  }
848  }
849 }
850 
851 
852 
853 std::vector<MSTransportable*>
854 MSEdge::getSortedPersons(SUMOTime timestep, bool includeRiding) const {
855  std::vector<MSTransportable*> result(myPersons.begin(), myPersons.end());
856  if (includeRiding) {
857  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
858  const MSLane::VehCont& vehs = (*i)->getVehiclesSecure();
859  for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
860  const std::vector<MSTransportable*>& persons = (*j)->getPersons();
861  result.insert(result.end(), persons.begin(), persons.end());
862  }
863  (*i)->releaseVehicles();
864  }
865  }
866  sort(result.begin(), result.end(), transportable_by_position_sorter(timestep));
867  return result;
868 }
869 
870 
871 std::vector<MSTransportable*>
872 MSEdge::getSortedContainers(SUMOTime timestep, bool /* includeRiding */) const {
873  std::vector<MSTransportable*> result(myContainers.begin(), myContainers.end());
874  sort(result.begin(), result.end(), transportable_by_position_sorter(timestep));
875  return result;
876 }
877 
878 
879 int
881  const double pos1 = c1->getCurrentStage()->getEdgePos(myTime);
882  const double pos2 = c2->getCurrentStage()->getEdgePos(myTime);
883  if (pos1 != pos2) {
884  return pos1 < pos2;
885  }
886  return c1->getID() < c2->getID();
887 }
888 
889 const MSEdgeVector&
891  if (vClass == SVC_IGNORING || !MSNet::getInstance()->hasPermissions() || myFunction == EDGEFUNCTION_DISTRICT) {
892  return mySuccessors;
893  }
894 #ifdef HAVE_FOX
895  if (MSDevice_Routing::isParallel()) {
896  MSDevice_Routing::lock();
897  }
898 #endif
899  std::map<SUMOVehicleClass, MSEdgeVector>::iterator i = myClassesSuccessorMap.find(vClass);
900  if (i == myClassesSuccessorMap.end()) {
901  // instantiate vector
902  myClassesSuccessorMap[vClass];
903  i = myClassesSuccessorMap.find(vClass);
904  // this vClass is requested for the first time. rebuild all successors
905  for (MSEdgeVector::const_iterator it = mySuccessors.begin(); it != mySuccessors.end(); ++it) {
906  if ((*it)->getPurpose() == EDGEFUNCTION_DISTRICT) {
907  i->second.push_back(*it);
908  } else {
909  const std::vector<MSLane*>* allowed = allowedLanes(*it, vClass);
910  if (allowed != 0 && allowed->size() > 0) {
911  i->second.push_back(*it);
912  }
913  }
914  }
915  }
916  // can use cached value
917 #ifdef HAVE_FOX
918  if (MSDevice_Routing::isParallel()) {
919  MSDevice_Routing::unlock();
920  }
921 #endif
922  return i->second;
923 }
924 
925 
926 bool
928  return (!myLanes->empty() && myLanes->back()->getOpposite() != 0 &&
929  // do not change on curved internal lanes
930  (!isInternal() || myLanes->back()->getIncomingLanes()[0].viaLink->getDirection() == LINKDIR_STRAIGHT));
931 }
932 
933 
934 bool
936  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
937  const MSLinkCont& lc = (*i)->getLinkCont();
938  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
939  if (!(*j)->havePriority()) {
940  return true;
941  }
942  }
943  }
944  return false;
945 }
946 
947 
948 /****************************************************************************/
949 
static const T & getRandomFrom(const std::vector< T > &v)
Returns a random element from the given vector.
Definition: RandHelper.h:114
void laneChange(SUMOTime t)
Start lane-change-process for all vehicles on the edge&#39;e lanes.
bool myAmDelayed
whether this edge had a vehicle with less than max speed on it
Definition: MSEdge.h:843
double getDepartPosBound(const MSVehicle &veh, bool upper=true) const
return upper bound for the depart position on this edge
Definition: MSEdge.cpp:420
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
Definition: MSLane.cpp:2106
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
Definition: MESegment.h:157
double getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
static double gLateralResolution
Definition: MSGlobals.h:92
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
Definition: MSLane.cpp:1979
bool allowsLaneChanging()
Definition: MSEdge.cpp:220
bool insertVehicle(SUMOVehicle &v, SUMOTime time, const bool checkOnly=false, const bool forceCheck=false) const
Tries to insert the given vehicle into the network.
Definition: MSEdge.cpp:527
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:806
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:582
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:776
Sorts edges by their ids.
Definition: MSEdge.h:719
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:52
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:289
MSLane * parallelLane(const MSLane *const lane, int offset) const
Returns the lane with the given offset parallel to the given lane one or 0 if it does not exist...
Definition: MSEdge.cpp:277
static double gMesoTLSPenalty
Definition: MSGlobals.h:107
double getLengthGeometryFactor() const
return shape.length() / myLength
Definition: MSEdge.cpp:831
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static int dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:755
bool initialise(MEVehicle *veh, SUMOTime time)
Inserts (emits) vehicle into the segment.
Definition: MESegment.cpp:288
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:250
static void readEdgeVector(std::istream &in, std::vector< const E *> &edges, const std::string &rid)
Reads an edge vector binary.
Definition: FileHelpers.h:274
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
void recalcCache()
Recalculates the cached values.
Definition: MSEdge.cpp:128
This is an uncontrolled, minor link, has to stop.
static MSEdgeVector myEdges
Static list of edges.
Definition: MSEdge.h:865
std::vector< double > & getParameter()
Returns the parameters of this distribution.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:776
The position is given.
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:375
ClassedAllowedLanesCont myClassedAllowed
From vehicle class to lanes allowed to be used by it.
Definition: MSEdge.h:816
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
The least occupied lane is used.
void buildSegmentsFor(const MSEdge &e, const OptionsCont &oc)
Build the segments for a given edge.
Definition: MELoop.cpp:261
void closeBuilding()
Definition: MSEdge.cpp:159
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:60
virtual ~MSEdge()
Destructor.
Definition: MSEdge.cpp:91
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
Definition: MSEdge.cpp:292
This is a dead end link.
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:192
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:158
T MAX2(T a, T b)
Definition: StdDefs.h:70
double getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:684
const MSRoute & getRoute() const
Returns the current route.
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn&#39;t already in the dictionary...
Definition: MSEdge.cpp:728
std::vector< double > mySublaneSides
the right side for each sublane on this edge
Definition: MSEdge.h:849
This is an uncontrolled, right-before-left link.
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:375
The lane is chosen randomly.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
void initialize(const std::vector< MSLane *> *lanes)
Initialize the edge.
Definition: MSEdge.cpp:107
const std::string & getID() const
Returns the id.
Definition: Named.h:66
const SVCPermissions SVCAll
all VClasses are allowed
int myVaporizationRequests
Vaporizer counter.
Definition: MSEdge.h:779
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:89
int operator()(const MSTransportable *const c1, const MSTransportable *const c2) const
comparing operator
Definition: MSEdge.cpp:880
double getLength() const
return the length of the edge
Definition: MSEdge.h:586
int size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:86
const MSJunction * getToJunction() const
Definition: MSEdge.h:372
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge&#39;s persons sorted by pos.
Definition: MSEdge.cpp:854
The least occupied lane from best lanes.
The position is chosen randomly.
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:382
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:275
This is an uncontrolled, all-way stop link.
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:824
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
The speed is given.
std::map< std::string, MSEdge *> DictType
definition of the static dictionary type
Definition: MSEdge.h:855
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:391
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
Performs lane changing of vehicles.
The lane is given.
double getCurrentTravelTime(const double minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
Definition: MSEdge.cpp:711
bool hasSpaceFor(const MEVehicle *veh, SUMOTime entryTime, bool init=false) const
Returns whether the given vehicle would still fit into the segment.
Definition: MESegment.cpp:261
The link is a straight direction.
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:55
double departSpeed
(optional) The initial speed of the vehicle
A road/street connecting two junctions.
Definition: MSEdge.h:80
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
Definition: MSLane.cpp:428
SUMOTime myLastFailedInsertionTime
The time of last insertion failure.
Definition: MSEdge.h:782
MSTransportable::Stage * getCurrentStage() const
Return the current stage.
std::map< SUMOVehicleClass, MSEdgeVector > myClassesSuccessorMap
The successors available for a given vClass.
Definition: MSEdge.h:870
void rebuildAllowedLanes()
Definition: MSEdge.cpp:243
int getIndex() const
Returns the lane&#39;s index.
Definition: MSLane.h:507
#define max(a, b)
Definition: polyfonts.c:65
#define BEST_LANE_LOOKAHEAD
Definition: MSEdge.cpp:60
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle&#39;s initial speed shall be chosen.
virtual void setChosenSpeedFactor(const double factor)=0
double myLength
the length of the edge (cached value for speedup)
Definition: MSEdge.h:837
The edge is a district edge.
Definition: MSEdge.h:99
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
Representation of a vehicle.
Definition: SUMOVehicle.h:67
virtual double getEdgePos(SUMOTime now) const =0
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
The least occupied lane from lanes which allow the continuation.
This is an uncontrolled, minor link, has to brake.
AllowedLanesCont myAllowed
Associative container from destination-edge to allowed-lanes.
Definition: MSEdge.h:812
bool hasMinorLink() const
whether any lane has a minor link
Definition: MSEdge.cpp:935
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:2939
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:767
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition: MSEdge.h:819
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:793
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition: MSEdge.h:773
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:721
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
MSEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: MSEdge.cpp:72
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
MSLane * leftLane(const MSLane *const lane) const
Returns the lane left to the one given, 0 if the given lane is leftmost.
Definition: MSEdge.cpp:265
static double rand()
Returns a random real number in [0, 1)
Definition: RandHelper.h:62
static SUMOTime gMesoMinorPenalty
Definition: MSGlobals.h:110
T MIN2(T a, T b)
Definition: StdDefs.h:64
const Position & getPosition() const
Definition: MSJunction.cpp:63
const std::string & getID() const
returns the id of the transportable
MSLane * getDepartLane(MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition: MSEdge.cpp:464
const std::vector< MSLane * > * myLanes
Container for the edge&#39;s lane; should be sorted: (right-hand-traffic) the more left the lane...
Definition: MSEdge.h:770
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:254
virtual double getChosenSpeedFactor() const =0
If a fixed number of random choices fails, a free position is chosen.
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
bool canChangeToOpposite()
whether this edge allows changing to the opposite direction edge
Definition: MSEdge.cpp:927
Base class for objects which have an id.
Definition: Named.h:46
The rightmost lane the vehicle may use.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal) const
Definition: MSEdge.cpp:650
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:836
std::vector< std::string > getVector()
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition: MSEdge.h:821
No information given; use default.
void buildLaneChanger()
Has to be called after all sucessors and predecessors have been set (after closeBuilding()) ...
Definition: MSEdge.cpp:202
double departPos
(optional) The position the vehicle shall depart from
Structure representing possible vehicle parameter.
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:761
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
Definition: MSEdge.cpp:640
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle&#39;s parameter (including departure definition)
const MSJunction * getFromJunction() const
Definition: MSEdge.h:368
A single mesoscopic segment (cell)
Definition: MESegment.h:57
double myWidth
Edge width [m].
Definition: MSEdge.h:834
double getInternalFollowingLengthTo(const MSEdge *followerAfterInternal) const
returns the length of all internal edges on the junction until reaching the non-internal edge followe...
Definition: MSEdge.cpp:670
const MSEdgeVector & getSuccessors() const
Returns the following edges.
Definition: MSEdge.h:339
bool isTaz() const
Definition: MSEdge.h:268
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:113
double getLength() const
Get vehicle&#39;s length [m].
void setMaxSpeed(double val) const
Sets a new maximum speed for all lanes (used by TraCI and MSCalibrator)
Definition: MSEdge.cpp:843
bool allowsVehicleClass(SUMOVehicleClass vclass) const
Definition: MSLane.h:706
std::map< const MSEdge *, std::vector< MSLane * > *> AllowedLanesCont
Suceeding edges (keys) and allowed lanes to reach these edges (values).
Definition: MSEdge.h:108
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:860
Sorts transportables by their positions.
Definition: MSEdge.h:734
double getDistanceTo(const MSEdge *other) const
optimistic air distance heuristic for use in routing
Definition: MSEdge.cpp:814
long long int SUMOTime
Definition: TraCIDefs.h:52
#define NUMERICAL_EPS
Definition: config.h:151
int numSublanes() const
Definition: MSLeaderInfo.h:95
double computeChosenSpeedDeviation(MTRand *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:74
No information given; use default.
A free position is chosen.
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
Insert behind the last vehicle as close as possible to still allow the specified departSpeed. Fallback to DEPART_POS_BASE if there is no vehicle on the departLane yet.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:1597
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:2933
static double getAssumedSpeed(const MSEdge *edge)
return current travel speed assumption
The edge is an internal edge.
Definition: MSEdge.h:97
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:89
MSEdgeVector myPredecessors
The preceeding edges.
Definition: MSEdge.h:796
static bool gUseMesoSim
Definition: MSGlobals.h:98
std::vector< MSTransportable * > getSortedContainers(SUMOTime timestep, bool includeRiding=false) const
Returns this edge&#39;s containers sorted by pos.
Definition: MSEdge.cpp:872
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
MSLane * rightLane(const MSLane *const lane) const
Returns the lane right to the one given, 0 if the given lane is rightmost.
Definition: MSEdge.cpp:271
double myEmptyTraveltime
the traveltime on the empty edge (cached value for speedup)
Definition: MSEdge.h:840
MSLane * getFreeLane(const std::vector< MSLane *> *allowed, const SUMOVehicleClass vclass, double departPos) const
Finds the emptiest lane allowing the vehicle class.
Definition: MSEdge.cpp:389
const Distribution_Parameterized & getSpeedFactor() const
Returns this type&#39;s speed factor.
Back-at-zero position.
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
Definition: MSEdge.cpp:784
virtual const std::string & getID() const =0
Get the vehicle&#39;s ID.
const std::vector< MSLane * > * getAllowedLanesWithDefault(const AllowedLanesCont &c, const MSEdge *dest) const
lookup in map and return 0 if not found
Definition: MSEdge.cpp:304
vehicles ignoring classes
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
std::string id
The vehicle&#39;s id.
std::set< int > myFailedInsertionMemory
A cache for the rejected insertion attempts. Used to assure that no further insertion attempts are ma...
Definition: MSEdge.h:787
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:803
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle&#39;s type.