Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MELoop.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// The main mesocopic simulation loop
19/****************************************************************************/
20#include <config.h>
21
22#include <queue>
23#include <vector>
24#include <map>
25#include <cmath>
26
27#include <microsim/MSNet.h>
28#include <microsim/MSEdge.h>
30#include <microsim/MSGlobals.h>
31#include <microsim/MSLane.h>
32#include <microsim/MSVehicle.h>
39#include "MELoop.h"
40#include "MESegment.h"
41#include "MELSegment.h"
42#include "MEVehicle.h"
43
45
46// ===========================================================================
47// method definitions
48// ===========================================================================
49MELoop::MELoop(const SUMOTime recheckInterval) : myFullRecheckInterval(recheckInterval), myLinkRecheckInterval(TIME2STEPS(1)) {
51 OptionsCont::getOptions().isSet("fcd-output") ||
52 OptionsCont::getOptions().isSet("queue-output"));
53}
54
56 for (std::vector<MESegment*>::const_iterator j = myEdges2FirstSegments.begin(); j != myEdges2FirstSegments.end(); ++j) {
57 for (MESegment* s = *j; s != nullptr;) {
58 MESegment* n = s->getNextSegment();
59 delete s;
60 s = n;
61 }
62 }
63}
64
65
66void
70 for (const MSEdge* const edge : ec.getEdges()) {
71 // needs to be called every stop because meso position one step t+1 depends on the position computed in step t
72 for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*edge);
73 segment != nullptr; segment = segment->getNextSegment()) {
74 if (segment->getCarNumber() > 0) {
75 segment->updateMesoPositions();
76 }
77 }
78 }
79 }
80 while (!myLeaderCars.empty()) {
81 LeaderEvent e = myLeaderCars.top();
82 assert(e.time > tMax - DELTA_T);
83 if (e.time > tMax) {
84 return;
85 }
86 myLeaderCars.pop();
87 while (!myInvalidatedLeaderCars.empty() && e.time > myInvalidatedLeaderCars.top().time) {
89 }
90 if (!myInvalidatedLeaderCars.empty()) {
91 if (wasInvalidated(e)) {
92 continue;
93 }
94 }
95 //std::cout << SIMTIME << " checkChar " << e.veh->getID() << " on=" << e.veh->getSegment()->getID() << " t=" << e.time << " nid=" << e.veh->getNumericalID() << "\n";
96 checkCar(e.veh);
97 assert(myLeaderCars.empty() || myLeaderCars.top().time >= e.time);
98 }
99}
100
101
102bool
104 if (e.time == myInvalidatedLeaderCars.top().time) {
105 // we need to check whether any of the events with the same time
106 // is our current vehicle because the order in which
107 // removeLeaderCar was called is unrelated to the order of addLeaderCar
108 std::vector<LeaderEvent> tmp;
109 bool curInvalid = false;
110 while (!myInvalidatedLeaderCars.empty() && e.time == myInvalidatedLeaderCars.top().time) {
111 if (e == myInvalidatedLeaderCars.top()) {
113 curInvalid = true;
114 break;
115 } else {
116 tmp.push_back(myInvalidatedLeaderCars.top());
118 }
119 }
120 for (LeaderEvent& le : tmp) {
122 }
123 return curInvalid;
124 }
125 return false;
126}
127
128
130MELoop::changeSegment(MEVehicle* veh, SUMOTime leaveTime, MESegment* const toSegment, MSMoveReminder::Notification reason, const bool ignoreLink) const {
131 int qIdx = 0;
132 MESegment* const onSegment = veh->getSegment();
133 if (MESegment::isInvalid(toSegment)) {
134 if (veh->isStoppedTriggered()) {
135 return leaveTime + MAX2(SUMOTime(1), myLinkRecheckInterval);
136 }
137 if (onSegment != nullptr) {
138 onSegment->send(veh, toSegment, qIdx, leaveTime, reason);
139 } else {
140 WRITE_WARNINGF(TL("Vehicle '%' teleports beyond arrival edge '%', time=%."),
141 veh->getID(), veh->getEdge()->getID(), time2string(leaveTime));
142 }
143 veh->setSegment(toSegment); // signal arrival
145 return leaveTime;
147 && !ignoreLink
148 && !MESegment::isInvalid(onSegment)
149 && &onSegment->getEdge() != &toSegment->getEdge()
150 && veh->getEdge()->allowedLanes(*veh->succEdge(1), veh->getVClass()) == nullptr) {
151 if (veh->isStopped()) {
152 veh->processStop();
153 }
154 // all queues on the next segment are forbidden. We don't want to check
155 // too often whether the forbiden edge has become permitted again
157 if (ttt > 0) {
158 // if teleporting is enabled, make sure we look at the vehicle when the gridlock-time is up
160 return MAX2(MIN2(leaveTime + myLinkRecheckInterval, MIN2(veh->getBlockTime(), leaveTime) + recheck + 1), leaveTime + 1);
161 }
162 return leaveTime + myLinkRecheckInterval;
163 }
164 toSegment->updateEntryBlockTime(leaveTime);
165 const SUMOTime entry = toSegment->hasSpaceFor(veh, leaveTime, qIdx);
167 if (entry == leaveTime) {
168 if (ignoreLink) {
170 } else {
171 ps = veh->mayProceed();
172 }
173 }
174 if (ps == MESegment::PROCEED_YES) {
175 if (onSegment != nullptr) {
176 if (veh->getQueIndex() == MESegment::PARKING_QUEUE) { // parking or just aborted parking
177 if (veh->isParking()) {
178 veh->processStop();
179 }
180 veh->getEdge()->getLanes()[0]->removeParking(veh); // TODO for GUI only
181 } else {
182 onSegment->send(veh, toSegment, qIdx, leaveTime, onSegment->getNextSegment() == nullptr ? MSMoveReminder::NOTIFICATION_JUNCTION : MSMoveReminder::NOTIFICATION_SEGMENT);
183 }
184 toSegment->receive(veh, qIdx, leaveTime, false, ignoreLink, &onSegment->getEdge() != &toSegment->getEdge());
185 } else {
186 WRITE_WARNINGF(TL("Vehicle '%' ends teleporting on edge '%':%, time=%."),
187 veh->getID(), toSegment->getEdge().getID(), toSegment->getIndex(), time2string(leaveTime));
188 // this is not quite correct but suffices for interrogation by
189 // subsequent methods (veh->getSpeed() needs segment != 0)
191 // clean up detectors (do not add traffic data)
192 // note: updateDatector is not called if leaveTime == getLastEntryTime()
194 toSegment->receive(veh, qIdx, leaveTime, false, true, true);
195 }
196 return entry;
197 } else {
198 if (veh->getQueIndex() != MESegment::PARKING_QUEUE && veh->isStopped() && veh->endTriggeredStop()) {
199 veh->processStop();
200 }
201 }
202 if ((ps & MESegment::PROCEED_NO) != 0) {
203 if ((ps & MESegment::PROCEED_NO_TLS) != 0) {
204 // recheck on the step grid: link states only change between steps, so keeping the sub-step phase of the
205 // arrival would release the car up to one step before the link opened, depending on that phase alone
206 return entry == SIMSTEP ? SIMSTEP + DELTA_T : SIMSTEP;
207 } else {
208 return entry + myLinkRecheckInterval;
209 }
210 }
211 return entry;
212}
213
214
215void
217 const SUMOTime leaveTime = veh->getEventTime();
218 MESegment* const onSegment = veh->getSegment();
219 MESegment* const toSegment = veh->getQueIndex() == MESegment::PARKING_QUEUE ? onSegment : nextSegment(onSegment, veh);
220 const bool teleporting = (onSegment == nullptr); // is the vehicle currently teleporting?
221 // @note reason is only evaluated if toSegment == nullptr
222 const SUMOTime nextEntry = changeSegment(veh, leaveTime, toSegment, MSMoveReminder::NOTIFICATION_ARRIVED, teleporting);
223 if (nextEntry == leaveTime) {
224 return;
225 }
227 const bool r1 = ttt > 0 && veh->getWaitingTime() > ttt;
229 if (!veh->isStopped() && (r1 || r3)) {
230 const bool disconnected = (MSGlobals::gTimeToTeleportDisconnected >= 0
231 && veh->succEdge(1) != nullptr
232 && veh->getEdge()->allowedLanes(*veh->succEdge(1), veh->getVClass()) == nullptr);
233 if ((r1 && !disconnected) || (r3 && disconnected)) {
234 teleportVehicle(veh, toSegment, disconnected);
235 return;
236 }
237 }
238 if (veh->getBlockTime() == SUMOTime_MAX && (!veh->isStopped()
239 || (!veh->isStoppedTriggered() && veh->isStoppedParking()))) {
240 veh->setBlockTime(leaveTime);
241 }
242 if (nextEntry == SUMOTime_MAX) {
243 // all usable queues on the next segment are full
244 SUMOTime newEventTime = MAX3(toSegment->getEventTime() + 1, leaveTime + 1, leaveTime + myFullRecheckInterval);
245 if (ttt) {
246 // if teleporting is enabled, make sure we look at the vehicle when the gridlock-time is up
247 const SUMOTime recheck = veh->getBlockTime() + 1 + ttt;
248 if (recheck > leaveTime) {
249 newEventTime = MIN2(newEventTime, recheck);
250 }
251 }
254 if (recheck > leaveTime && veh->getEdge()->allowedLanes(*veh->succEdge(1), veh->getVClass()) == nullptr) {
255 newEventTime = MIN2(newEventTime, recheck);
256 }
257 }
258 veh->setEventTime(newEventTime);
259 } else {
260 // receiving segment has recently received another vehicle or the junction is blocked
261 veh->setEventTime(nextEntry);
262 }
263 addLeaderCar(veh, teleporting ? nullptr : onSegment->getLink(veh));
264}
265
266
267void
268MELoop::teleportVehicle(MEVehicle* veh, MESegment* const toSegment, bool disconnected) {
269 const SUMOTime leaveTime = veh->getEventTime();
270 MESegment* const onSegment = veh->getSegment();
272 WRITE_WARNINGF(TL("Teleporting vehicle '%'; waited too long, from edge '%':%, time=%."),
273 veh->getID(), onSegment->getEdge().getID(), onSegment->getIndex(),
274 time2string(leaveTime));
276 int qIdx = 0;
277 onSegment->send(veh, nullptr, qIdx, leaveTime, MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED);
278 veh->setSegment(nullptr);
280 return;
281 }
282 const bool teleporting = (onSegment == nullptr); // is the vehicle already teleporting?
283 // try to find a place on the current edge
284 MESegment* teleSegment = disconnected ? toSegment : toSegment->getNextSegment();
285 while (teleSegment != nullptr && changeSegment(veh, leaveTime, teleSegment, MSMoveReminder::NOTIFICATION_TELEPORT, true) != leaveTime) {
286 // @caution the time to get to the next segment here is ignored XXX
287 teleSegment = teleSegment->getNextSegment();
288 }
289 if (teleSegment != nullptr) {
290 if (!teleporting) {
291 // we managed to teleport in a single jump
292 const std::string reason = disconnected ? " (disconnected)" : "";
293 WRITE_WARNINGF(TL("Teleporting vehicle '%'; waited too long%, from edge '%':% to edge '%':%, time=%."),
294 veh->getID(), reason, onSegment->getEdge().getID(), onSegment->getIndex(),
295 teleSegment->getEdge().getID(), teleSegment->getIndex(), time2string(leaveTime));
297 }
298 } else {
299 // teleport across the current edge and try insertion later
300 if (!teleporting) {
301 int qIdx = 0;
302 // announce start of multi-step teleport, arrival will be announced in changeSegment()
303 WRITE_WARNINGF(TL("Teleporting vehicle '%'; waited too long, from edge '%':%, time=%."),
304 veh->getID(), onSegment->getEdge().getID(), onSegment->getIndex(), time2string(leaveTime));
306 // remove from current segment
307 onSegment->send(veh, nullptr, qIdx, leaveTime, MSMoveReminder::NOTIFICATION_TELEPORT);
308 // mark veh as teleporting
309 veh->setSegment(nullptr);
310 } else {
312 }
313 // @caution microsim uses current travel time teleport duration
314 const SUMOTime teleArrival = leaveTime + TIME2STEPS(veh->getEdge()->getLength() / MAX2(veh->getEdge()->getSpeedLimit(), NUMERICAL_EPS));
315 const bool atDest = veh->moveRoutePointer();
316 if (atDest) {
317 // teleporting to end of route
318 changeSegment(veh, teleArrival, nullptr, MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED, true);
319 } else {
320 veh->setEventTime(teleArrival);
321 addLeaderCar(veh, nullptr);
322 // teleporting vehicles must react to rerouters
325 }
326 }
327}
328
329
330void
331MELoop::addLeaderCar(MEVehicle* veh, MSLink* link, const bool fromState) {
332 if (!fromState) {
334 }
335 myLeaderCars.push(LeaderEvent(veh));
336 veh->setApproaching(link);
337}
338
339
340void
345
346
347void
351
352
353void
355 int qIdx = 0;
356 v->getSegment()->send(v, nullptr, qIdx, MSNet::getInstance()->getCurrentTimeStep(), reason);
358}
359
360
363 if (s != nullptr) { // vehicle is not teleporting
364 MESegment* next = s->getNextSegment();
365 if (next != nullptr) {
366 // ok, the street continues
367 return next;
368 }
369 }
370 // we have to check the next edge in the vehicle's route
371 const MSEdge* nextEdge = v->succEdge(1);
372 if (nextEdge == nullptr) {
373 // end of route
374 return nullptr;
375 }
376 if (MSGlobals::gUsingInternalLanes && s != nullptr && s->getEdge().isNormal()) {
377 const MSEdge* internal = s->getEdge().getInternalFollowingEdge(nextEdge, v->getVClass());
378 if (internal) {
379 nextEdge = internal;
380 }
381 }
382 return myEdges2FirstSegments[nextEdge->getNumericalID()];
383}
384
385
386int
387MELoop::numSegmentsFor(const double length, const double sLength) {
388 int no = (int)floor(length / sLength + 0.5);
389 if (no == 0) { // assure there is at least one segment
390 return 1;
391 } else {
392 return no;
393 }
394}
395
396
397void
400 const double length = e.getLength();
401 const int numSegments = numSegmentsFor(length, edgeType.edgeLength);
402 const double slength = length / (double)numSegments;
403 MESegment* newSegment = nullptr;
404 MESegment* nextSegment = nullptr;
405 const bool laneQueue = oc.getBool("meso-lane-queue");
406 const bool lift = oc.getBool("meso-ltm");
407 bool multiQueue = laneQueue || (oc.getBool("meso-multi-queue") && e.getLanes().size() > 1 && e.getNumSuccessors() > 1);
408 for (int s = numSegments - 1; s >= 0; s--) {
409 std::string id = e.getID() + ":" + toString(s);
410 newSegment = lift
411 ? new MELSegment(id, e, nextSegment, slength, e.getLanes()[0]->getSpeedLimit(), s, multiQueue, edgeType)
412 : new MESegment(id, e, nextSegment, slength, e.getLanes()[0]->getSpeedLimit(), s, multiQueue, edgeType);
413 multiQueue = laneQueue;
414 nextSegment = newSegment;
415 }
417 // Accumulate in edge order to preserve the interpolated positions.
418 double offset = 0;
419 for (MESegment* segment = newSegment; segment != nullptr; segment = segment->getNextSegment()) {
420 segment->setStartOffset(offset);
421 offset += segment->getLength();
422 }
423 }
424 while (e.getNumericalID() >= static_cast<int>(myEdges2FirstSegments.size())) {
425 myEdges2FirstSegments.push_back(0);
426 }
427 myEdges2FirstSegments[e.getNumericalID()] = newSegment;
428 for (MSLane* lane : e.getLanes()) {
429 lane->updateMesoGUISegments();
430 }
431}
432
433
435MELoop::getSegmentForEdge(const MSEdge& e, double pos) {
436 if (e.getNumericalID() >= (int)myEdges2FirstSegments.size()) {
437 return nullptr;
438 }
440 if (pos > 0) {
441 double cpos = 0;
442 while (s->getNextSegment() != nullptr && cpos + s->getLength() < pos) {
443 cpos += s->getLength();
444 s = s->getNextSegment();
445 }
446 }
447 return s;
448}
449
450
451bool
453 for (const MSEdge* succ : e.getSuccessors()) {
454 if (succ->isRoundabout()) {
455 return true;
456 }
457 }
458 return false;
459}
460
461
463 time(v->getEventTime()),
464 eventIndex(v->getEventIndex()),
465 nid(v->getNumericalID()),
466 veh(v) { }
467
468/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:299
#define TL(string)
Definition MsgHandler.h:316
SUMOTime DELTA_T
Definition SUMOTime.cpp:39
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:107
#define SIMSTEP
Definition SUMOTime.h:69
constexpr SUMOTime TIME2STEPS(double x)
Definition SUMOTime.h:60
#define SUMOTime_MAX
Definition SUMOTime.h:34
T MIN2(T a, T b)
Definition StdDefs.h:80
T MAX2(T a, T b)
Definition StdDefs.h:86
T MAX3(T a, T b, T c)
Definition StdDefs.h:100
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
A single mesoscopic segment (cell)
Definition MELSegment.h:38
bool myInterpolateMesoPos
Definition MELoop.h:192
MESegment * nextSegment(MESegment *s, MEVehicle *v)
Retrieve next segment.
Definition MELoop.cpp:362
static bool isEnteringRoundabout(const MSEdge &e)
whether the given edge is entering a roundabout
Definition MELoop.cpp:452
LeaderEventQueue myInvalidatedLeaderCars
Definition MELoop.h:181
void addLeaderCar(MEVehicle *veh, MSLink *link, const bool fromState=false)
Adds the given car to the leading vehicles.
Definition MELoop.cpp:331
bool wasInvalidated(const LeaderEvent &e)
check whether the current car was invalidated and remove it from myInvalidatedLeaderCars
Definition MELoop.cpp:103
MELoop(const SUMOTime recheckInterval)
SUMO constructor.
Definition MELoop.cpp:49
SUMOTime changeSegment(MEVehicle *veh, SUMOTime leaveTime, MESegment *const toSegment, MSMoveReminder::Notification reason, const bool ignoreLink=false) const
change to the next segment this handles combinations of the following cases: (ending / continuing rou...
Definition MELoop.cpp:130
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition MELoop.cpp:435
std::priority_queue< LeaderEvent > LeaderEventQueue
leader cars in the segments sorted by exit time
Definition MELoop.h:179
const SUMOTime myLinkRecheckInterval
the interval at which to recheck at blocked junctions (<=0 means asap)
Definition MELoop.h:190
void simulate(SUMOTime tMax)
Perform simulation up to the given time.
Definition MELoop.cpp:67
const SUMOTime myFullRecheckInterval
the interval at which to recheck at full segments (<=0 means asap)
Definition MELoop.h:187
void vaporizeCar(MEVehicle *v, MSMoveReminder::Notification reason)
remove the given car and clean up the relevant data structures
Definition MELoop.cpp:354
LeaderEventQueue myLeaderCars
Definition MELoop.h:180
void clearState()
Remove all vehicles before quick-loading state.
Definition MELoop.cpp:341
void removeLeaderCar(MEVehicle *v)
Removes the given car from the leading vehicles.
Definition MELoop.cpp:348
std::vector< MESegment * > myEdges2FirstSegments
mapping from internal edge ids to their initial segments
Definition MELoop.h:184
~MELoop()
Definition MELoop.cpp:55
void checkCar(MEVehicle *veh)
Check whether the vehicle may move.
Definition MELoop.cpp:216
void teleportVehicle(MEVehicle *veh, MESegment *const toSegment, bool disconnected)
teleports a vehicle or continues a teleport
Definition MELoop.cpp:268
static int numSegmentsFor(const double length, const double slength)
Compute number of segments per edge (best value stay close to the configured segment length)
Definition MELoop.cpp:387
void buildSegmentsFor(const MSEdge &e, const OptionsCont &oc)
Build the segments for a given edge.
Definition MELoop.cpp:398
A single mesoscopic segment (cell)
Definition MESegment.h:50
void addReminders(MEVehicle *veh) const
add this lanes MoveReminders to the given vehicle
static const int PARKING_QUEUE
Definition MESegment.h:53
void receive(MEVehicle *veh, const int qIdx, SUMOTime time, const bool isDepart=false, const bool isTeleport=false, const bool newEdge=false)
Adds the vehicle to the segment, adapting its parameters.
void setStartOffset(double offset)
Definition MESegment.h:541
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
double getLength() const
Returns the length of the segment in meters.
Definition MESegment.h:282
SUMOTime hasSpaceFor(const MEVehicle *const veh, const SUMOTime entryTime, int &qIdx, const bool init=false) const
Returns whether the given vehicle would still fit into the segment.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition MESegment.h:405
virtual void updateEntryBlockTime(SUMOTime)
update entry blockTime for all queues
Definition MESegment.h:213
virtual void send(MEVehicle *veh, MESegment *const next, const int nextQIdx, SUMOTime time, const MSMoveReminder::Notification reason)
Removes the vehicle from the segment, adapting its parameters.
SUMOTime getEventTime() const
Returns the (planned) time at which the next vehicle leaves this segment.
@ PROCEED_NO
the vehicle must stay on the current segment
Definition MESegment.h:79
@ PROCEED_NO_TLS
vehicle want's to change to right lane
Definition MESegment.h:81
@ PROCEED_UNKNOWN
mayProceed was not called
Definition MESegment.h:75
@ PROCEED_YES
the vehicle may proceed to the next segment
Definition MESegment.h:77
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition MESegment.h:266
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
Definition MESegment.h:498
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
Definition MESegment.h:274
A vehicle from the mesoscopic point of view.
Definition MEVehicle.h:42
void processStop()
ends the current stop and performs loading/unloading
SUMOTime getWaitingTime(const bool accumulated=false) const
Returns the duration for which the vehicle was blocked.
Definition MEVehicle.h:347
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
void updateDetectors(const SUMOTime currentTime, const SUMOTime exitTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
Definition MEVehicle.h:318
void setEventTime(SUMOTime t, bool hasDelay=true)
Sets the (planned) time at which the vehicle leaves its current segment.
Definition MEVehicle.h:206
void setApproaching(MSLink *link)
registers vehicle with the given link
bool endTriggeredStop()
process triggered stops and return true if all stops on the current segment are completed
MESegment * getSegment() const
Returns the current segment the vehicle is on.
Definition MEVehicle.h:266
int getQueIndex() const
Returns the index of the que the vehicle is in.
Definition MEVehicle.h:275
void setEventIndex(long long int index)
Sets the index of the vehicle's event (orders events with the same time)
Definition MEVehicle.h:223
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
Definition MEVehicle.h:250
int mayProceed()
Returns whether the vehicle is allowed to pass the next junction, checks also for triggered stops.
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves its current segment.
Definition MEVehicle.h:218
void setBlockTime(const SUMOTime t)
Sets the time at which the vehicle was blocked.
Definition MEVehicle.h:332
SUMOTime getBlockTime() const
Returns the time at which the vehicle was blocked.
Definition MEVehicle.h:341
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
bool isStoppedParking() const
Returns whether the vehicle is on a parking stop.
bool isParking() const
Returns whether the vehicle is parking.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
bool ignoreTransientPermissions() const
Returns whether this object is ignoring transient permission changes (during routing)
virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
bool isStopped() const
Returns whether the vehicle is at a stop.
Stores edges and lanes, performs moving of vehicle.
const MSEdgeVector & getEdges() const
Returns loaded edges.
A road/street connecting two junctions.
Definition MSEdge.h:78
int getNumSuccessors() const
Returns the number of edges that may be reached from this edge.
Definition MSEdge.h:389
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition MSEdge.h:169
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING, bool ignoreTransientPermissions=false) const
Get the allowed lanes to reach the destination-edge.
Definition MSEdge.cpp:516
bool isNormal() const
return whether this edge is an internal edge
Definition MSEdge.h:265
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is returned; should pr...
Definition MSEdge.cpp:1235
double getLength() const
return the length of the edge
Definition MSEdge.h:695
int getNumericalID() const
Returns the numerical id of the edge.
Definition MSEdge.h:308
const std::string & getEdgeType() const
Returns the type of the edge.
Definition MSEdge.h:321
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal, SUMOVehicleClass vClass) const
Definition MSEdge.cpp:970
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition MSEdge.cpp:1342
static SUMOTime gTimeToTeleportDisconnected
Definition MSGlobals.h:66
static bool gMesoInterpolatePos
Definition MSGlobals.h:112
static bool gCheckRoutes
Definition MSGlobals.h:91
static bool gRemoveGridlocked
Definition MSGlobals.h:75
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition MSGlobals.h:115
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
Definition MSGlobals.h:81
static SUMOTime gTimeToGridlock
Definition MSGlobals.h:57
Representation of a lane in the micro simulation.
Definition MSLane.h:84
Notification
Definition of a vehicle state.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
@ NOTIFICATION_TELEPORT_ARRIVED
The vehicle was teleported out of the net.
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:201
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:403
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition MSNet.h:446
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
Definition MSNet.cpp:440
void registerTeleportJam()
register one non-collision-related teleport
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
const SUMOVTypeParameter & getParameter() const
const std::string & getID() const
Returns the id.
Definition Named.h:73
A storage for options typed value containers)
Definition OptionsCont.h:92
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
SUMOTime getTimeToTeleport(SUMOTime defaultValue) const
return time-to-teleport (either custom or default)
MEVehicle * veh
Definition MELoop.h:158
static long long int myEventCounter
Definition MELoop.h:171
LeaderEvent(MEVehicle *v)
Definition MELoop.cpp:462
edge type specific meso parameters
Definition MESegment.h:58