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-2013 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) {}
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 && myFunction != EDGEFUNCTION_INTERNAL) {
98  myLaneChanger = new MSLaneChanger(myLanes, OptionsCont::getOptions().getBool("lanechange.allow-swap"));
99  }
102  }
103 }
104 
105 
106 void
108  myAllowed[0] = new std::vector<MSLane*>();
109  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
110  myAllowed[0]->push_back(*i);
111  const MSLinkCont& lc = (*i)->getLinkCont();
112  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
113  MSLane* toL = (*j)->getLane();
114  if (toL != 0) {
115  MSEdge& to = toL->getEdge();
116  //
117  if (std::find(mySuccessors.begin(), mySuccessors.end(), &to) == mySuccessors.end()) {
118  mySuccessors.push_back(&to);
119  }
120  if (std::find(to.myPredeccesors.begin(), to.myPredeccesors.end(), this) == to.myPredeccesors.end()) {
121  to.myPredeccesors.push_back(this);
122  }
123  //
124  if (myAllowed.find(&to) == myAllowed.end()) {
125  myAllowed[&to] = new std::vector<MSLane*>();
126  }
127  myAllowed[&to]->push_back(*i);
128  }
129 #ifdef HAVE_INTERNAL_LANES
130  toL = (*j)->getViaLane();
131  if (toL != 0) {
132  MSEdge& to = toL->getEdge();
133  to.myPredeccesors.push_back(this);
134  }
135 #endif
136  }
137  }
138  std::sort(mySuccessors.begin(), mySuccessors.end(), by_id_sorter());
140 }
141 
142 
143 void
145  // clear myClassedAllowed.
146  // it will be rebuilt on demand
147  for (ClassedAllowedLanesCont::iterator i2 = myClassedAllowed.begin(); i2 != myClassedAllowed.end(); i2++) {
148  for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
149  delete(*i1).second;
150  }
151  }
152  myClassedAllowed.clear();
153  // rebuild myMinimumPermissions and myCombinedPermissions
156  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
157  myMinimumPermissions &= (*i)->getPermissions();
158  myCombinedPermissions |= (*i)->getPermissions();
159  }
160 }
161 
162 
163 // ------------ Access to the edge's lanes
164 MSLane*
165 MSEdge::leftLane(const MSLane* const lane) const {
166  return parallelLane(lane, 1);
167 }
168 
169 
170 MSLane*
171 MSEdge::rightLane(const MSLane* const lane) const {
172  return parallelLane(lane, -1);
173 }
174 
175 
176 MSLane*
177 MSEdge::parallelLane(const MSLane* const lane, int offset) const {
178  const int index = (int)(find(myLanes->begin(), myLanes->end(), lane) - myLanes->begin());
179  if (index == (int)myLanes->size()) {
180  return 0;
181  }
182  const int resultIndex = index + offset;
183  if (resultIndex >= (int)myLanes->size() || resultIndex < 0) {
184  // check for parallel running internal lanes
186  const MSLane* pred = lane->getLogicalPredecessorLane();
187  const MSLane* next = lane->getLinkCont()[0]->getLane();
188  assert(pred != 0);
189  assert(next != 0);
190  const MSLane* predParallel = pred->getParallelLane(offset);
191  const MSLane* nextParallel = next->getParallelLane(offset);
192  if (predParallel != 0 && nextParallel != 0) {
193  const MSLink* connecting = MSLinkContHelper::getConnectingLink(*predParallel, *nextParallel);
194  if (connecting != 0) {
195  return connecting->getViaLaneOrLane();
196  }
197  }
198  }
199  return 0;
200  } else {
201  return (*myLanes)[resultIndex];
202  }
203 }
204 
205 
206 const std::vector<MSLane*>*
207 MSEdge::allowedLanes(const MSEdge& destination, SUMOVehicleClass vclass) const {
208  return allowedLanes(&destination, vclass);
209 }
210 
211 
212 const std::vector<MSLane*>*
214  return allowedLanes(0, vclass);
215 }
216 
217 
218 const std::vector<MSLane*>*
220  AllowedLanesCont::const_iterator it = c.find(dest);
221  if (it == c.end()) {
222  return 0;
223  }
224  return it->second;
225 }
226 
227 
228 const std::vector<MSLane*>*
229 MSEdge::allowedLanes(const MSEdge* destination, SUMOVehicleClass vclass) const {
230  if ((myMinimumPermissions & vclass) == vclass) {
231  // all lanes allow vclass
232  return getAllowedLanesWithDefault(myAllowed, destination);
233  }
234  // look up cached result in myClassedAllowed
235  ClassedAllowedLanesCont::const_iterator i = myClassedAllowed.find(vclass);
236  if (i != myClassedAllowed.end()) {
237  // can use cached value
238  const AllowedLanesCont& c = (*i).second;
239  return getAllowedLanesWithDefault(c, destination);
240  } else {
241  // this vclass is requested for the first time. rebuild all destinations
242  // go through connected edges
243  for (AllowedLanesCont::const_iterator i1 = myAllowed.begin(); i1 != myAllowed.end(); ++i1) {
244  const MSEdge* edge = i1->first;
245  const std::vector<MSLane*>* lanes = i1->second;
246  myClassedAllowed[vclass][edge] = new std::vector<MSLane*>();
247  // go through lanes approaching current edge
248  for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
249  // allows the current vehicle class?
250  if ((*i2)->allowsVehicleClass(vclass)) {
251  // -> may be used
252  myClassedAllowed[vclass][edge]->push_back(*i2);
253  }
254  }
255  // assert that 0 is returned if no connection is allowed for a class
256  if (myClassedAllowed[vclass][edge]->size() == 0) {
257  delete myClassedAllowed[vclass][edge];
258  myClassedAllowed[vclass][edge] = 0;
259  }
260  }
261  return myClassedAllowed[vclass][destination];
262  }
263 }
264 
265 
266 // ------------
267 SUMOTime
270  return 0;
271 }
272 
273 
274 SUMOTime
277  return 0;
278 }
279 
280 
281 MSLane*
282 MSEdge::getFreeLane(const std::vector<MSLane*>* allowed, const SUMOVehicleClass vclass) const {
283  if (allowed == 0) {
284  allowed = allowedLanes(vclass);
285  }
286  MSLane* res = 0;
287  if (allowed != 0) {
288  unsigned int noCars = INT_MAX;
289  for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
290  if ((*i)->getVehicleNumber() < noCars) {
291  res = (*i);
292  noCars = (*i)->getVehicleNumber();
293  }
294  }
295  }
296  return res;
297 }
298 
299 
300 MSLane*
301 MSEdge::getDepartLane(const MSVehicle& veh) const {
302  switch (veh.getParameter().departLaneProcedure) {
303  case DEPART_LANE_GIVEN:
304  if ((int) myLanes->size() <= veh.getParameter().departLane || !(*myLanes)[veh.getParameter().departLane]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
305  return 0;
306  }
307  return (*myLanes)[veh.getParameter().departLane];
308  case DEPART_LANE_RANDOM:
310  case DEPART_LANE_FREE:
311  return getFreeLane(0, veh.getVehicleType().getVehicleClass());
313  if (veh.getRoute().size() == 1) {
314  return getFreeLane(0, veh.getVehicleType().getVehicleClass());
315  } else {
316  return getFreeLane(allowedLanes(**(veh.getRoute().begin() + 1)), veh.getVehicleType().getVehicleClass());
317  }
318  case DEPART_LANE_BEST_FREE: {
319  const std::vector<MSVehicle::LaneQ>& bl = veh.getBestLanes(false, (*myLanes)[0]);
320  SUMOReal bestLength = -1;
321  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
322  if ((*i).length > bestLength) {
323  bestLength = (*i).length;
324  }
325  }
326  std::vector<MSLane*>* bestLanes = new std::vector<MSLane*>();
327  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
328  if ((*i).length == bestLength) {
329  bestLanes->push_back((*i).lane);
330  }
331  }
332  MSLane* ret = getFreeLane(bestLanes, veh.getVehicleType().getVehicleClass());
333  delete bestLanes;
334  return ret;
335  }
336  case DEPART_LANE_DEFAULT:
337  default:
338  break;
339  }
340  if (!(*myLanes)[0]->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) {
341  return 0;
342  }
343  return (*myLanes)[0];
344 }
345 
346 
347 bool
349  // when vaporizing, no vehicles are inserted...
350  if (isVaporizing()) {
351  return false;
352  }
353 #ifdef HAVE_INTERNAL
355  const SUMOVehicleParameter& pars = v.getParameter();
356  SUMOReal pos = 0.0;
357  switch (pars.departPosProcedure) {
358  case DEPART_POS_GIVEN:
359  if (pars.departPos >= 0.) {
360  pos = pars.departPos;
361  } else {
362  pos = pars.departPos + getLength();
363  }
364  if (pos < 0 || pos > getLength()) {
365  WRITE_WARNING("Invalid departPos " + toString(pos) + " given for vehicle '" +
366  v.getID() + "'. Inserting at lane end instead.");
367  pos = getLength();
368  }
369  break;
370  case DEPART_POS_RANDOM:
372  pos = RandHelper::rand(getLength());
373  break;
374  default:
375  break;
376  }
377  bool result = false;
378  MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this, pos);
379  MEVehicle* veh = static_cast<MEVehicle*>(&v);
380  if (pars.departPosProcedure == DEPART_POS_FREE) {
381  while (segment != 0 && !result) {
382  result = segment->initialise(veh, time);
383  segment = segment->getNextSegment();
384  }
385  } else {
386  result = segment->initialise(veh, time);
387  }
388  return result;
389  }
390 #else
391  UNUSED_PARAMETER(time);
392 #endif
393  MSLane* insertionLane = getDepartLane(static_cast<MSVehicle&>(v));
394  return insertionLane != 0 && insertionLane->insertVehicle(static_cast<MSVehicle&>(v));
395 }
396 
397 
398 void
401  return;
402  }
403  assert(myLaneChanger != 0);
405 }
406 
407 
408 
409 #ifdef HAVE_INTERNAL_LANES
410 const MSEdge*
411 MSEdge::getInternalFollowingEdge(MSEdge* followerAfterInternal) const {
412  //@todo to be optimized
413  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
414  MSLane* l = *i;
415  const MSLinkCont& lc = l->getLinkCont();
416  for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
417  MSLink* link = *j;
418  if (&link->getLane()->getEdge() == followerAfterInternal) {
419  if (link->getViaLane() != 0) {
420  return &link->getViaLane()->getEdge();
421  } else {
422  return 0; // network without internal links
423  }
424  }
425  }
426  }
427  return 0;
428 }
429 #endif
430 
431 
432 SUMOReal
434  assert(minSpeed > 0);
435  SUMOReal v = 0;
436 #ifdef HAVE_INTERNAL
438  MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*this);
439  unsigned segments = 0;
440  do {
441  v += first->getMeanSpeed();
442  first = first->getNextSegment();
443  segments++;
444  } while (first != 0);
445  v /= (SUMOReal) segments;
446  } else {
447 #endif
448  for (std::vector<MSLane*>::iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
449  v += (*i)->getMeanSpeed();
450  }
451  v /= (SUMOReal) myLanes->size();
452 #ifdef HAVE_INTERNAL
453  }
454 #endif
455  v = MAX2(minSpeed, v);
456  return getLength() / v;
457 }
458 
459 
460 bool
461 MSEdge::dictionary(const std::string& id, MSEdge* ptr) {
462  DictType::iterator it = myDict.find(id);
463  if (it == myDict.end()) {
464  // id not in myDict.
465  myDict[id] = ptr;
466  while ((int)myEdges.size() < ptr->getNumericalID() + 1) {
467  myEdges.push_back(0);
468  }
469  myEdges[ptr->getNumericalID()] = ptr;
470  return true;
471  }
472  return false;
473 }
474 
475 
476 MSEdge*
477 MSEdge::dictionary(const std::string& id) {
478  DictType::iterator it = myDict.find(id);
479  if (it == myDict.end()) {
480  // id not in myDict.
481  return 0;
482  }
483  return it->second;
484 }
485 
486 
487 MSEdge*
488 MSEdge::dictionary(size_t id) {
489  assert(myEdges.size() > id);
490  return myEdges[id];
491 }
492 
493 
494 size_t
496  return myDict.size();
497 }
498 
499 
500 size_t
502  return myEdges.size();
503 }
504 
505 
506 void
508  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
509  delete(*i).second;
510  }
511  myDict.clear();
512 }
513 
514 
515 void
516 MSEdge::insertIDs(std::vector<std::string>& into) {
517  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
518  into.push_back((*i).first);
519  }
520 }
521 
522 
523 void
524 MSEdge::parseEdgesList(const std::string& desc, std::vector<const MSEdge*>& into,
525  const std::string& rid) {
526  if (desc[0] == BinaryFormatter::BF_ROUTE) {
527  std::istringstream in(desc, std::ios::binary);
528  char c;
529  in >> c;
530  FileHelpers::readEdgeVector(in, into, rid);
531  } else {
532  StringTokenizer st(desc);
533  parseEdgesList(st.getVector(), into, rid);
534  }
535 }
536 
537 
538 void
539 MSEdge::parseEdgesList(const std::vector<std::string>& desc, std::vector<const MSEdge*>& into,
540  const std::string& rid) {
541  for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
542  const MSEdge* edge = MSEdge::dictionary(*i);
543  // check whether the edge exists
544  if (edge == 0) {
545  throw ProcessError("The edge '" + *i + "' within the route " + rid + " is not known."
546  + "\n The route can not be build.");
547  }
548  into.push_back(edge);
549  }
550 }
551 
552 
553 SUMOReal
554 MSEdge::getDistanceTo(const MSEdge* other) const {
555  if (getLanes().size() > 0 && other->getLanes().size() > 0) {
556  return getLanes()[0]->getShape()[-1].distanceTo2D(other->getLanes()[0]->getShape()[0]);
557  } else {
558  return 0; // optimism is just right for astar
559  }
560 }
561 
562 
563 SUMOReal
565  return getLanes()[0]->getLength();
566 }
567 
568 
569 SUMOReal
571  // @note lanes might have different maximum speeds in theory
572  return getLanes()[0]->getSpeedLimit();
573 }
574 
575 
576 SUMOReal
577 MSEdge::getVehicleMaxSpeed(const SUMOVehicle* const veh) const {
578  // @note lanes might have different maximum speeds in theory
579  return getLanes()[0]->getVehicleMaxSpeed(veh);
580 }
581 
582 /****************************************************************************/
583 
void laneChange(SUMOTime t)
Start lane-change-process for all vehicles on the edge&#39;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:1539
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:442
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
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:535
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:516
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
Sorts edges by their ids.
Definition: MSEdge.h:502
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:554
static size_t numericalDictSize()
Returns the number of edges with a numerical id.
Definition: MSEdge.cpp:501
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:167
std::vector< MSEdge * > mySuccessors
The succeeding edges.
Definition: MSEdge.h:550
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:541
The position is given.
ClassedAllowedLanesCont myClassedAllowed
From vehicle class to lanes allowed to be used by it.
Definition: MSEdge.h:566
The least occupied lane is used.
void closeBuilding()
Definition: MSEdge.cpp:107
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:433
T MAX2(T a, T b)
Definition: StdDefs.h:63
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&#39;t already in the dictionary...
Definition: MSEdge.cpp:461
SUMOTime incVaporization(SUMOTime t)
Enables vaporization.
Definition: MSEdge.cpp:268
MSLane * getFreeLane(const std::vector< MSLane * > *allowed, const SUMOVehicleClass vclass) const
Finds the emptiest lane allowing the vehicle class.
Definition: MSEdge.cpp:282
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:544
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:275
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:36
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:196
std::map< std::string, MSEdge * > DictType
definition of the static dictionary type
Definition: MSEdge.h:582
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:592
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:524
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
Definition: MSLane.cpp:335
void rebuildAllowedLanes()
Definition: MSEdge.cpp:144
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.cpp:564
MSLane * getLogicalPredecessorLane() const
Definition: MSLane.cpp:1175
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:562
static void clear()
Clears the dictionary.
Definition: MSEdge.cpp:507
SVCPermissions myMinimumPermissions
The intersection of lane permissions for this edge.
Definition: MSEdge.h:569
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
Definition: MSLane.cpp:972
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:165
MSLaneChanger * myLaneChanger
This member will do the lane-change.
Definition: MSEdge.h:538
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:268
std::vector< MSEdge * > myPredeccesors
The preceeding edges.
Definition: MSEdge.h:553
MSLane * getDepartLane(const MSVehicle &veh) const
Finds a depart lane for the given vehicle parameters.
Definition: MSEdge.cpp:301
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:51
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:570
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:280
SVCPermissions myCombinedPermissions
The union of lane permissions for this edge.
Definition: MSEdge.h:571
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:207
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:203
Structure representing possible vehicle parameter.
int getNumericalID() const
Returns the numerical id of the edge.
Definition: MSEdge.h:211
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:177
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
Definition: MSEdge.cpp:399
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle&#39;s parameter (including departure definition)
static size_t dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:495
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
Definition: MSBaseVehicle.h:94
int SUMOTime
Definition: SUMOTime.h:43
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;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:87
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:587
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:221
static const bool gUseMesoSim
Definition: MSGlobals.h:95
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:577
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:945
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:171
bool insertVehicle(SUMOVehicle &v, SUMOTime time) const
Tries to insert the given vehicle into the network.
Definition: MSEdge.cpp:348
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:219
Representation of a lane in the micro simulation.
Definition: MSLane.h:73
virtual const std::string & getID() const =0
Get the vehicle&#39;s ID.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:75