SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
16 // Copyright (C) 2001-2014 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 "MSLane.h"
44 #include "MSLaneChanger.h"
45 #include "MSGlobals.h"
46 #include "MSVehicle.h"
47 #include "MSEdgeWeightsStorage.h"
48 
49 #ifdef HAVE_INTERNAL
50 #include <mesosim/MELoop.h>
51 #include <mesosim/MESegment.h>
52 #include <mesosim/MEVehicle.h>
53 #endif
54 
55 #ifdef CHECK_MEMORY_LEAKS
56 #include <foreign/nvwa/debug_new.h>
57 #endif // CHECK_MEMORY_LEAKS
58 
59 
60 // ===========================================================================
61 // static member definitions
62 // ===========================================================================
64 std::vector<MSEdge*> MSEdge::myEdges;
65 
66 
67 // ===========================================================================
68 // member method definitions
69 // ===========================================================================
70 MSEdge::MSEdge(const std::string& id, int numericalID,
71  const EdgeBasicFunction function,
72  const std::string& streetName) :
73  Named(id), myNumericalID(numericalID), myLanes(0),
74  myLaneChanger(0), myFunction(function), myVaporizationRequests(0),
75  myLastFailedInsertionTime(-1), myStreetName(streetName), myAmRoundabout(false) {}
76 
77 
79  delete myLaneChanger;
80  for (AllowedLanesCont::iterator i1 = myAllowed.begin(); i1 != myAllowed.end(); i1++) {
81  delete(*i1).second;
82  }
83  for (ClassedAllowedLanesCont::iterator i2 = myClassedAllowed.begin(); i2 != myClassedAllowed.end(); i2++) {
84  for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
85  delete(*i1).second;
86  }
87  }
88  delete myLanes;
89  // Note: Lanes are delete using MSLane::clear();
90 }
91 
92 
93 void
94 MSEdge::initialize(std::vector<MSLane*>* lanes) {
95  assert(myFunction == EDGEFUNCTION_DISTRICT || lanes != 0);
96  myLanes = lanes;
97  if (myLanes && myLanes->size() > 1) {
98  myLaneChanger = new MSLaneChanger(myLanes, OptionsCont::getOptions().getBool("lanechange.allow-swap"));
99  }
102  }
103 }
104 
105 
106 bool
108  if (myLanes == 0 || myLanes->size() < 2) {
109  return false;
110  }
112  return true;
113  }
114  // allow changing only if all links leading to this internal lane have priority
115  for (std::vector<MSLane*>::iterator it = myLanes->begin(); it != myLanes->end(); ++it) {
116  MSLane* pred = (*it)->getLogicalPredecessorLane();
117  MSLink* link = MSLinkContHelper::getConnectingLink(*pred, **it);
118  assert(link != 0);
119  if (!link->havePriority()) {
120  return false;
121  }
122  }
123  return true;
124 }
125 
126 
127 void
129  myAllowed[0] = new std::vector<MSLane*>();
130  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
131  myAllowed[0]->push_back(*i);
132  const MSLinkCont& lc = (*i)->getLinkCont();
133  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
134  MSLane* toL = (*j)->getLane();
135  if (toL != 0) {
136  MSEdge& to = toL->getEdge();
137  //
138  if (std::find(mySuccessors.begin(), mySuccessors.end(), &to) == mySuccessors.end()) {
139  mySuccessors.push_back(&to);
140  }
141  if (std::find(to.myPredeccesors.begin(), to.myPredeccesors.end(), this) == to.myPredeccesors.end()) {
142  to.myPredeccesors.push_back(this);
143  }
144  //
145  if (myAllowed.find(&to) == myAllowed.end()) {
146  myAllowed[&to] = new std::vector<MSLane*>();
147  }
148  myAllowed[&to]->push_back(*i);
149  }
150 #ifdef HAVE_INTERNAL_LANES
151  toL = (*j)->getViaLane();
152  if (toL != 0) {
153  MSEdge& to = toL->getEdge();
154  to.myPredeccesors.push_back(this);
155  }
156 #endif
157  }
158  }
159  std::sort(mySuccessors.begin(), mySuccessors.end(), by_id_sorter());
161 }
162 
163 
164 void
166  // clear myClassedAllowed.
167  // it will be rebuilt on demand
168  for (ClassedAllowedLanesCont::iterator i2 = myClassedAllowed.begin(); i2 != myClassedAllowed.end(); i2++) {
169  for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
170  delete(*i1).second;
171  }
172  }
173  myClassedAllowed.clear();
174  // rebuild myMinimumPermissions and myCombinedPermissions
177  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
178  myMinimumPermissions &= (*i)->getPermissions();
179  myCombinedPermissions |= (*i)->getPermissions();
180  }
181 }
182 
183 
184 // ------------ Access to the edge's lanes
185 MSLane*
186 MSEdge::leftLane(const MSLane* const lane) const {
187  return parallelLane(lane, 1);
188 }
189 
190 
191 MSLane*
192 MSEdge::rightLane(const MSLane* const lane) const {
193  return parallelLane(lane, -1);
194 }
195 
196 
197 MSLane*
198 MSEdge::parallelLane(const MSLane* const lane, int offset) const {
199  const int index = (int)(find(myLanes->begin(), myLanes->end(), lane) - myLanes->begin());
200  if (index == (int)myLanes->size()) {
201  return 0;
202  }
203  const int resultIndex = index + offset;
204  if (resultIndex >= (int)myLanes->size() || resultIndex < 0) {
205  return 0;
206  } else {
207  return (*myLanes)[resultIndex];
208  }
209 }
210 
211 
212 const std::vector<MSLane*>*
213 MSEdge::allowedLanes(const MSEdge& destination, SUMOVehicleClass vclass) const {
214  return allowedLanes(&destination, vclass);
215 }
216 
217 
218 const std::vector<MSLane*>*
220  return allowedLanes(0, vclass);
221 }
222 
223 
224 const std::vector<MSLane*>*
226  AllowedLanesCont::const_iterator it = c.find(dest);
227  if (it == c.end()) {
228  return 0;
229  }
230  return it->second;
231 }
232 
233 
234 const std::vector<MSLane*>*
235 MSEdge::allowedLanes(const MSEdge* destination, SUMOVehicleClass vclass) const {
236  if ((myMinimumPermissions & vclass) == vclass) {
237  // all lanes allow vclass
238  return getAllowedLanesWithDefault(myAllowed, destination);
239  }
240  // look up cached result in myClassedAllowed
241  ClassedAllowedLanesCont::const_iterator i = myClassedAllowed.find(vclass);
242  if (i != myClassedAllowed.end()) {
243  // can use cached value
244  const AllowedLanesCont& c = (*i).second;
245  return getAllowedLanesWithDefault(c, destination);
246  } else {
247  // this vclass is requested for the first time. rebuild all destinations
248  // go through connected edges
249  for (AllowedLanesCont::const_iterator i1 = myAllowed.begin(); i1 != myAllowed.end(); ++i1) {
250  const MSEdge* edge = i1->first;
251  const std::vector<MSLane*>* lanes = i1->second;
252  myClassedAllowed[vclass][edge] = new std::vector<MSLane*>();
253  // go through lanes approaching current edge
254  for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
255  // allows the current vehicle class?
256  if ((*i2)->allowsVehicleClass(vclass)) {
257  // -> may be used
258  myClassedAllowed[vclass][edge]->push_back(*i2);
259  }
260  }
261  // assert that 0 is returned if no connection is allowed for a class
262  if (myClassedAllowed[vclass][edge]->size() == 0) {
263  delete myClassedAllowed[vclass][edge];
264  myClassedAllowed[vclass][edge] = 0;
265  }
266  }
267  return myClassedAllowed[vclass][destination];
268  }
269 }
270 
271 
272 // ------------
273 SUMOTime
276  return 0;
277 }
278 
279 
280 SUMOTime
283  return 0;
284 }
285 
286 
287 MSLane*
288 MSEdge::getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass) const {
289  if (allowed == 0) {
290  allowed = allowedLanes(vclass);
291  }
292  MSLane* res = 0;
293  if (allowed != 0) {
294  unsigned int noCars = INT_MAX;
295  for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
296  if ((*i)->getVehicleNumber() < noCars) {
297  res = (*i);
298  noCars = (*i)->getVehicleNumber();
299  }
300  }
301  }
302  return res;
303 }
304 
305 
306 MSLane*
307 MSEdge::getDepartLane(const MSVehicle& veh) const {
308  switch (veh.getParameter().departLaneProcedure) {
309  case DEPART_LANE_GIVEN:
310  if ((int) myLanes->size() <= veh.getParameter().departLane || !(*myLanes)[veh.getParameter().departLane]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
311  return 0;
312  }
313  return (*myLanes)[veh.getParameter().departLane];
314  case DEPART_LANE_RANDOM:
316  case DEPART_LANE_FREE:
317  return getFreeLane(0, veh.getVehicleType().getVehicleClass());
319  if (veh.getRoute().size() == 1) {
320  return getFreeLane(0, veh.getVehicleType().getVehicleClass());
321  } else {
322  return getFreeLane(allowedLanes(**(veh.getRoute().begin() + 1)), veh.getVehicleType().getVehicleClass());
323  }
324  case DEPART_LANE_BEST_FREE: {
325  const std::vector<MSVehicle::LaneQ>& bl = veh.getBestLanes(false, (*myLanes)[0]);
326  SUMOReal bestLength = -1;
327  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
328  if ((*i).length > bestLength) {
329  bestLength = (*i).length;
330  }
331  }
332  std::vector<MSLane*>* bestLanes = new std::vector<MSLane*>();
333  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
334  if ((*i).length == bestLength) {
335  bestLanes->push_back((*i).lane);
336  }
337  }
338  MSLane* ret = getFreeLane(bestLanes, veh.getVehicleType().getVehicleClass());
339  delete bestLanes;
340  return ret;
341  }
342  case DEPART_LANE_DEFAULT:
343  default:
344  break;
345  }
346  if (!(*myLanes)[0]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
347  return 0;
348  }
349  return (*myLanes)[0];
350 }
351 
352 
353 bool
355  // when vaporizing, no vehicles are inserted...
356  if (isVaporizing()) {
357  return false;
358  }
359 #ifdef HAVE_INTERNAL
361  const SUMOVehicleParameter& pars = v.getParameter();
362  SUMOReal pos = 0.0;
363  switch (pars.departPosProcedure) {
364  case DEPART_POS_GIVEN:
365  if (pars.departPos >= 0.) {
366  pos = pars.departPos;
367  } else {
368  pos = pars.departPos + getLength();
369  }
370  if (pos < 0 || pos > getLength()) {
371  WRITE_WARNING("Invalid departPos " + toString(pos) + " given for vehicle '" +
372  v.getID() + "'. Inserting at lane end instead.");
373  pos = getLength();
374  }
375  break;
376  case DEPART_POS_RANDOM:
378  pos = RandHelper::rand(getLength());
379  break;
380  default:
381  break;
382  }
383  bool result = false;
384  MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this, pos);
385  MEVehicle* veh = static_cast<MEVehicle*>(&v);
386  if (pars.departPosProcedure == DEPART_POS_FREE) {
387  while (segment != 0 && !result) {
388  result = segment->initialise(veh, time);
389  segment = segment->getNextSegment();
390  }
391  } else {
392  result = segment->initialise(veh, time);
393  }
394  return result;
395  }
396 #else
397  UNUSED_PARAMETER(time);
398 #endif
399  MSLane* insertionLane = getDepartLane(static_cast<MSVehicle&>(v));
400  return insertionLane != 0 && insertionLane->insertVehicle(static_cast<MSVehicle&>(v));
401 }
402 
403 
404 void
406  if (laneChangeAllowed()) {
408  }
409 }
410 
411 
412 
413 #ifdef HAVE_INTERNAL_LANES
414 const MSEdge*
415 MSEdge::getInternalFollowingEdge(MSEdge* followerAfterInternal) const {
416  //@todo to be optimized
417  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
418  MSLane* l = *i;
419  const MSLinkCont& lc = l->getLinkCont();
420  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
421  MSLink* link = *j;
422  if (&link->getLane()->getEdge() == followerAfterInternal) {
423  if (link->getViaLane() != 0) {
424  return &link->getViaLane()->getEdge();
425  } else {
426  return 0; // network without internal links
427  }
428  }
429  }
430  }
431  return 0;
432 }
433 #endif
434 
435 
436 SUMOReal
438  assert(minSpeed > 0);
439  SUMOReal v = 0;
440 #ifdef HAVE_INTERNAL
442  MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*this);
443  unsigned segments = 0;
444  do {
445  v += first->getMeanSpeed();
446  first = first->getNextSegment();
447  segments++;
448  } while (first != 0);
449  v /= (SUMOReal) segments;
450  } else {
451 #endif
452  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
453  v += (*i)->getMeanSpeed();
454  }
455  v /= (SUMOReal) myLanes->size();
456 #ifdef HAVE_INTERNAL
457  }
458 #endif
459  v = MAX2(minSpeed, v);
460  return getLength() / v;
461 }
462 
463 
464 bool
465 MSEdge::dictionary(const std::string& id, MSEdge* ptr) {
466  DictType::iterator it = myDict.find(id);
467  if (it == myDict.end()) {
468  // id not in myDict.
469  myDict[id] = ptr;
470  while ((int)myEdges.size() < ptr->getNumericalID() + 1) {
471  myEdges.push_back(0);
472  }
473  myEdges[ptr->getNumericalID()] = ptr;
474  return true;
475  }
476  return false;
477 }
478 
479 
480 MSEdge*
481 MSEdge::dictionary(const std::string& id) {
482  DictType::iterator it = myDict.find(id);
483  if (it == myDict.end()) {
484  // id not in myDict.
485  return 0;
486  }
487  return it->second;
488 }
489 
490 
491 MSEdge*
492 MSEdge::dictionary(size_t id) {
493  assert(myEdges.size() > id);
494  return myEdges[id];
495 }
496 
497 
498 size_t
500  return myDict.size();
501 }
502 
503 
504 size_t
506  return myEdges.size();
507 }
508 
509 
510 void
512  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
513  delete(*i).second;
514  }
515  myDict.clear();
516 }
517 
518 
519 void
520 MSEdge::insertIDs(std::vector<std::string>& into) {
521  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
522  into.push_back((*i).first);
523  }
524 }
525 
526 
527 void
528 MSEdge::parseEdgesList(const std::string& desc, std::vector<const MSEdge*>& into,
529  const std::string& rid) {
530  if (desc[0] == BinaryFormatter::BF_ROUTE) {
531  std::istringstream in(desc, std::ios::binary);
532  char c;
533  in >> c;
534  FileHelpers::readEdgeVector(in, into, rid);
535  } else {
536  StringTokenizer st(desc);
537  parseEdgesList(st.getVector(), into, rid);
538  }
539 }
540 
541 
542 void
543 MSEdge::parseEdgesList(const std::vector<std::string>& desc, std::vector<const MSEdge*>& into,
544  const std::string& rid) {
545  for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
546  const MSEdge* edge = MSEdge::dictionary(*i);
547  // check whether the edge exists
548  if (edge == 0) {
549  throw ProcessError("The edge '" + *i + "' within the route " + rid + " is not known."
550  + "\n The route can not be build.");
551  }
552  into.push_back(edge);
553  }
554 }
555 
556 
557 SUMOReal
558 MSEdge::getDistanceTo(const MSEdge* other) const {
559  if (getLanes().size() > 0 && other->getLanes().size() > 0) {
560  return getLanes()[0]->getShape()[-1].distanceTo2D(other->getLanes()[0]->getShape()[0]);
561  } else {
562  return 0; // optimism is just right for astar
563  }
564 }
565 
566 
567 SUMOReal
569  return getLanes()[0]->getLength();
570 }
571 
572 
573 SUMOReal
575  // @note lanes might have different maximum speeds in theory
576  return getLanes()[0]->getSpeedLimit();
577 }
578 
579 
580 SUMOReal
581 MSEdge::getVehicleMaxSpeed(const SUMOVehicle* const veh) const {
582  // @note lanes might have different maximum speeds in theory
583  return getLanes()[0]->getVehicleMaxSpeed(veh);
584 }
585 
586 /****************************************************************************/
587 
void laneChange(SUMOTime t)
Start lane-change-process for all vehicles on the edge'e lanes.
virtual const std::vector< LaneQ > & getBestLanes(bool forceRebuild=false, MSLane *startLane=0) const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:1752
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:452
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
std::vector< MSLane * > * myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane...
Definition: MSEdge.h:547
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:520
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
Sorts edges by their ids.
Definition: MSEdge.h:514
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
SUMOReal getDistanceTo(const MSEdge *other) const
optimistic air distance heuristic for use in routing
Definition: MSEdge.cpp:558
static size_t numericalDictSize()
Returns the number of edges with a numerical id.
Definition: MSEdge.cpp:505
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
std::vector< MSEdge * > mySuccessors
The succeeding edges.
Definition: MSEdge.h:562
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:553
The position is given.
ClassedAllowedLanesCont myClassedAllowed
From vehicle class to lanes allowed to be used by it.
Definition: MSEdge.h:578
The least occupied lane is used.
void closeBuilding()
Definition: MSEdge.cpp:128
static SUMOReal rand()
Returns a random real number in [0, 1)
Definition: RandHelper.h:61
virtual ~MSEdge()
Destructor.
Definition: MSEdge.cpp:78
SUMOReal getCurrentTravelTime(const SUMOReal minSpeed=0.00001) const
Computes and returns the current travel time for this edge.
Definition: MSEdge.cpp:437
T MAX2(T a, T b)
Definition: StdDefs.h:71
const MSRoute & getRoute() const
Returns the current route.
Definition: MSBaseVehicle.h:86
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
Definition: MSEdge.cpp:465
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:274
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass) const
Finds the emptiest lane allowing the vehicle class.
Definition: MSEdge.cpp:288
The lane is chosen randomly.
static T getRandomFrom(const std::vector< T > &v)
Returns a random element from the given vector.
Definition: RandHelper.h:98
int myVaporizationRequests
Vaporizer counter.
Definition: MSEdge.h:556
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:82
The least occupied lane from best lanes.
The position is chosen randomly.
SUMOTime decVaporization(SUMOTime t)
Disables vaporization.
Definition: MSEdge.cpp:281
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:196
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition: MSEdge.h:596
MSEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName="")
Constructor.
Definition: MSEdge.cpp:70
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:67
void initialize(std::vector< MSLane * > *lanes)
Initialize the edge.
Definition: MSEdge.cpp:94
The lane is given.
static std::vector< MSEdge * > myEdges
Static list of edges.
Definition: MSEdge.h:606
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:54
A road/street connecting two junctions.
Definition: MSEdge.h:73
static void parseEdgesList(const std::string &desc, std::vector< const MSEdge * > &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
Definition: MSEdge.cpp:528
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
Definition: MSLane.cpp:336
void rebuildAllowedLanes()
Definition: MSEdge.cpp:165
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.cpp:568
MSLane * getLogicalPredecessorLane() const
Definition: MSLane.cpp:1224
The edge is a district edge.
Definition: MSEdge.h:92
Representation of a vehicle.
Definition: SUMOVehicle.h:63
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
The least occupied lane from lanes which allow the continuation.
AllowedLanesCont myAllowed
Associative container from destination-edge to allowed-lanes.
Definition: MSEdge.h:574
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:511
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition: MSEdge.h:581
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:186
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition: MSEdge.h:550
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:270
std::vector< MSEdge * > myPredeccesors
The preceeding edges.
Definition: MSEdge.h:565
MSLane * getDepartLane(const MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition: MSEdge.cpp:307
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:52
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:574
If a fixed number of random choices fails, a free position is chosen.
const SVCPermissions SVCFreeForAll
Base class for objects which have an id.
Definition: Named.h:45
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::vector< std::string > getVector()
unsigned int getVehicleNumber() const
Returns the number of vehicles on this lane.
Definition: MSLane.h:285
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition: MSEdge.h:583
No information given; use default.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_UNKNOWN) const
Get the allowed lanes to reach the destination-edge.
Definition: MSEdge.cpp:213
Structure representing possible vehicle parameter.
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:212
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:198
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
Definition: MSEdge.cpp:405
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
static size_t dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:499
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:94
int SUMOTime
Definition: SUMOTime.h:43
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
SUMOReal departPos
(optional) The position the vehicle shall depart from
std::map< const MSEdge *, std::vector< MSLane * > * > AllowedLanesCont
Suceeding edges (keys) and allowed lanes to reach these edges (values).
Definition: MSEdge.h:97
unsigned size() const
Returns the number of edges to pass.
Definition: MSRoute.cpp:86
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:601
static void readEdgeVector(std::istream &in, std::vector< const E * > &edges, const std::string &rid)
Reads an edge vector binary.
Definition: FileHelpers.h:278
#define SUMOReal
Definition: config.h:215
static const bool gUseMesoSim
Definition: MSGlobals.h:98
bool laneChangeAllowed() const
whether lane changing may be performed on this edge
Definition: MSEdge.cpp:107
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:581
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:998
A free position is chosen.
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:192
bool insertVehicle(SUMOVehicle &v, SUMOTime time) const
Tries to insert the given vehicle into the network.
Definition: MSEdge.cpp:354
The edge is an internal edge.
Definition: MSEdge.h:90
const std::vector< MSLane * > * getAllowedLanesWithDefault(const AllowedLanesCont &c, const MSEdge *dest) const
lookup in map and return 0 if not found
Definition: MSEdge.cpp:225
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
virtual const std::string & getID() const =0
Get the vehicle's ID.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:74