Eclipse SUMO - Simulation of Urban MObility
MEVehicle.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 /****************************************************************************/
19 // A vehicle from the mesoscopic point of view
20 /****************************************************************************/
21 #include <config.h>
22 
23 #include <iostream>
24 #include <cassert>
25 #include <utils/common/StdDefs.h>
32 #include <microsim/MSGlobals.h>
33 #include <microsim/MSEdge.h>
34 #include <microsim/MSLane.h>
35 #include <microsim/MSNet.h>
36 #include <microsim/MSVehicleType.h>
37 #include <microsim/MSLink.h>
38 #include <microsim/MSStop.h>
42 #include "MELoop.h"
43 #include "MEVehicle.h"
44 #include "MESegment.h"
45 
46 
47 // ===========================================================================
48 // method definitions
49 // ===========================================================================
51  MSVehicleType* type, const double speedFactor) :
52  MSBaseVehicle(pars, route, type, speedFactor),
53  mySegment(nullptr),
54  myQueIndex(0),
55  myEventTime(SUMOTime_MIN),
56  myLastEntryTime(SUMOTime_MIN),
57  myBlockTime(SUMOTime_MAX),
58  myInfluencer(nullptr) {
59  if (!(*myCurrEdge)->isTazConnector()) {
60  if ((*myCurrEdge)->allowedLanes(type->getVehicleClass()) == nullptr) {
61  throw ProcessError("Vehicle '" + pars->id + "' is not allowed to depart on any lane of edge '" + (*myCurrEdge)->getID() + "'.");
62  }
64  throw ProcessError("Departure speed for vehicle '" + pars->id +
65  "' is too high for the vehicle type '" + type->getID() + "'.");
66  }
67  }
68 }
69 
70 
71 double
72 MEVehicle::getBackPositionOnLane(const MSLane* /* lane */) const {
74 }
75 
76 
77 double
79 // the following interpolation causes problems with arrivals and calibrators
80 // const double fracOnSegment = MIN2(double(1), STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - myLastEntryTime) / STEPS2TIME(myEventTime - myLastEntryTime));
81  return mySegment == nullptr ? 0 : (double(mySegment->getIndex()) /* + fracOnSegment */) * mySegment->getLength();
82 }
83 
84 
85 double
87  const MSLane* const lane = getEdge()->getLanes()[0];
89 }
90 
91 
92 double
94  const MSLane* const lane = getEdge()->getLanes()[0];
96 }
97 
98 
100 MEVehicle::getPosition(const double offset) const {
101  const MSLane* const lane = getEdge()->getLanes()[0];
102  return lane->geometryPositionAtOffset(getPositionOnLane() + offset);
103 }
104 
105 
106 double
108  if (getWaitingTime() > 0) {
109  return 0;
110  } else {
111  return getAverageSpeed();
112  }
113 }
114 
115 
116 double
119 }
120 
121 
122 double
125  const double v = getSpeed();
126  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
127  (double)sqrt(2 * link->getLength() * getVehicleType().getCarFollowModel().getMaxAccel() + v * v));
128 }
129 
130 
131 double
132 MEVehicle::getConservativeSpeed(SUMOTime& earliestArrival) const {
133  earliestArrival = MAX2(myEventTime, earliestArrival - DELTA_T); // event times have subsecond resolution
134  return mySegment->getLength() / STEPS2TIME(earliestArrival - myLastEntryTime);
135 }
136 
137 
138 bool
140  // vehicle has just entered a new edge. Position is 0
141  if (myCurrEdge == myRoute->end() - 1) { // may happen during teleport
142  return true;
143  }
144  ++myCurrEdge;
145  if ((*myCurrEdge)->isVaporizing()) {
146  return true;
147  }
148  // update via
149  if (myParameter->via.size() > 0 && (*myCurrEdge)->getID() == myParameter->via.front()) {
150  myParameter->via.erase(myParameter->via.begin());
151  }
152  return hasArrived();
153 }
154 
155 
156 bool
158  // mySegment may be 0 due to teleporting or arrival
159  return myCurrEdge == myRoute->end() - 1 && (
160  (mySegment == nullptr)
162  || getPositionOnLane() > myArrivalPos - POSITION_EPS);
163 }
164 
165 
166 bool
168  return getSegment() != nullptr;
169 }
170 
171 
172 bool
174  return false;
175 }
176 
177 
178 void
180  if (link != nullptr) {
181  const double speed = getSpeed();
182  link->setApproaching(this, getEventTime() + (link->getState() == LINKSTATE_ALLWAY_STOP ?
183  (SUMOTime)RandHelper::rand((int)2) : 0), // tie braker
184  speed, speed, true,
185  getEventTime(), speed, getWaitingTime(),
186  // @note: dist is not used by meso (getZipperSpeed is never called)
187  getSegment()->getLength());
188  }
189 }
190 
191 
192 bool
193 MEVehicle::replaceRoute(const MSRoute* newRoute, const std::string& info, bool onInit, int offset, bool addRouteStops, bool removeStops) {
194  MSLink* const oldLink = mySegment != nullptr ? mySegment->getLink(this) : nullptr;
195  if (MSBaseVehicle::replaceRoute(newRoute, info, onInit, offset, addRouteStops, removeStops)) {
196  if (mySegment != nullptr) {
197  MSLink* const newLink = mySegment->getLink(this);
198  // update approaching vehicle information
199  if (oldLink != newLink) {
200  if (oldLink != nullptr) {
201  oldLink->removeApproaching(this);
202  }
203  setApproaching(newLink);
204  }
205  }
206  return true;
207  }
208  return false;
209 }
210 
211 
212 SUMOTime
214  for (MSStop& stop : myStops) {
215  if (stop.edge != myCurrEdge || stop.segment != mySegment) {
216  return time;
217  }
218  time += stop.duration;
219  if (stop.pars.until > time) {
220  // @note: this assumes the stop is reached at time. With the way this is called in MESegment (time == entryTime),
221  // travel time is overestimated of the stop is not at the start of the segment
222  time = stop.pars.until;
223  }
224  stop.reached = true;
225  stop.pars.actualArrival = myLastEntryTime;
226  if (MSStopOut::active()) {
228  }
229  }
230  return time;
231 }
232 
233 
234 double
236  SUMOTime time = myLastEntryTime;
237  for (const MSStop& stop : myStops) {
238  if (stop.reached) {
239  time += stop.duration;
240  if (stop.pars.until > time) {
241  // @note: this assumes the stop is reached at time. With the way this is called in MESegment (time == entryTime),
242  // travel time is overestimated of the stop is not at the start of the segment
243  time = stop.pars.until;
244  }
245  } else {
246  break;
247  }
248  }
249  return STEPS2TIME(time - myLastEntryTime);
250 }
251 
252 
253 void
255  assert(isStopped());
256  MSEdge* edge = const_cast<MSEdge*>(getEdge());
257  double lastPos = 0;
258  for (auto it = myStops.begin(); it != myStops.end();) {
259  MSStop& stop = *it;
260  if (stop.edge != myCurrEdge || stop.segment != mySegment || stop.pars.endPos <= lastPos) {
261  break;
262  }
263  lastPos = stop.pars.endPos;
264  MSNet* const net = MSNet::getInstance();
265  SUMOTime dummy = -1; // boarding- and loading-time are not considered
266  if (net->hasPersons()) {
267  net->getPersonControl().boardAnyWaiting(edge, this, stop.pars, dummy, dummy);
268  }
269  if (net->hasContainers()) {
270  net->getContainerControl().loadAnyWaiting(edge, this, stop.pars, dummy, dummy);
271  }
272  MSDevice_Vehroutes* vehroutes = static_cast<MSDevice_Vehroutes*>(getDevice(typeid(MSDevice_Vehroutes)));
273  if (vehroutes != nullptr) {
274  vehroutes->stopEnded(stop.pars);
275  }
276  if (MSStopOut::active()) {
278  }
279  SUMOVehicleParameter::Stop pars = stop.pars;
281  myPastStops.emplace_back(pars);
282  it = myStops.erase(it);
283  }
285 }
286 
287 
288 bool
290  return mySegment == nullptr || mySegment->isOpen(this);
291 }
292 
293 
294 double
296  if (mySegment == nullptr) {
297  return 0;
298  } else {
299  return STEPS2TIME(mySegment->getLinkPenalty(this));
300  }
301 }
302 
303 
304 void
306  for (MoveReminderCont::iterator i = myMoveReminders.begin(); i != myMoveReminders.end(); ++i) {
307  if (i->first == rem) {
309  (mySegment->getIndex() + 1) * mySegment->getLength(),
310  getLastEntryTime(), currentTime, exitTime, false);
311 #ifdef _DEBUG
312  if (myTraceMoveReminders) {
313  traceMoveReminder("notifyMove", i->first, i->second, true);
314  }
315 #endif
316  return;
317  }
318  }
319 }
320 
321 
322 void
323 MEVehicle::updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason) {
324  // segments of the same edge have the same reminder so no cleaning up must take place
325  const bool cleanUp = isLeave && (reason != MSMoveReminder::NOTIFICATION_SEGMENT);
326  for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) {
327  if (currentTime != getLastEntryTime()) {
328  rem->first->updateDetector(*this, mySegment->getIndex() * mySegment->getLength(),
329  (mySegment->getIndex() + 1) * mySegment->getLength(),
330  getLastEntryTime(), currentTime, getEventTime(), cleanUp);
331 #ifdef _DEBUG
332  if (myTraceMoveReminders) {
333  traceMoveReminder("notifyMove", rem->first, rem->second, true);
334  }
335 #endif
336  }
337  if (!isLeave || rem->first->notifyLeave(*this, mySegment->getLength(), reason)) {
338 #ifdef _DEBUG
339  if (isLeave && myTraceMoveReminders) {
340  traceMoveReminder("notifyLeave", rem->first, rem->second, true);
341  }
342 #endif
343  ++rem;
344  } else {
345 #ifdef _DEBUG
346  if (myTraceMoveReminders) {
347  traceMoveReminder("remove", rem->first, rem->second, false);
348  }
349 #endif
350  rem = myMoveReminders.erase(rem);
351  }
352  }
354  myOdometer += getEdge()->getLength();
355  }
356 }
357 
358 
361  if (myInfluencer == nullptr) {
363  }
364  return *myInfluencer;
365 }
366 
367 
370  return myInfluencer;
371 }
372 
373 
374 void
377  MSGlobals::gMesoNet->changeSegment(this, MSNet::getInstance()->getCurrentTimeStep(), nullptr, reason);
378 }
379 
380 void
382  if (mySegment != nullptr && MESegment::isInvalid(mySegment)) {
383  // segment is vaporization target, do not write this vehicle
384  return;
385  }
387  assert(mySegment == nullptr || *myCurrEdge == &mySegment->getEdge());
388  std::vector<SUMOTime> internals;
389  internals.push_back(myDeparture);
390  internals.push_back((SUMOTime)distance(myRoute->begin(), myCurrEdge));
391  internals.push_back((SUMOTime)myDepartPos * 1000); // store as mm
392  internals.push_back(mySegment == nullptr ? (SUMOTime) - 1 : (SUMOTime)mySegment->getIndex());
393  internals.push_back((SUMOTime)getQueIndex());
394  internals.push_back(myEventTime);
395  internals.push_back(myLastEntryTime);
396  internals.push_back(myBlockTime);
397  out.writeAttr(SUMO_ATTR_STATE, toString(internals));
398  // save past stops
400  stop.write(out, false);
401  out.writeAttr("actualArrival", time2string(stop.actualArrival));
402  out.writeAttr(SUMO_ATTR_DEPART, time2string(stop.depart));
403  out.closeTag();
404  }
405  // save upcoming stops
406  for (const MSStop& stop : myStops) {
407  stop.write(out);
408  }
409  // save parameters
410  myParameter->writeParams(out);
411  for (MSDevice* dev : myDevices) {
412  dev->saveState(out);
413  }
414  out.closeTag();
415 }
416 
417 
418 void
419 MEVehicle::loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset) {
420  if (attrs.hasAttribute(SUMO_ATTR_POSITION)) {
421  throw ProcessError("Error: Invalid vehicles in state (may be a micro state)!");
422  }
423  int routeOffset;
424  int segIndex;
425  int queIndex;
426  std::istringstream bis(attrs.getString(SUMO_ATTR_STATE));
427  bis >> myDeparture;
428  bis >> routeOffset;
429  bis >> myDepartPos;
430  bis >> segIndex;
431  bis >> queIndex;
432  bis >> myEventTime;
433  bis >> myLastEntryTime;
434  bis >> myBlockTime;
435  myDepartPos *= 1000; // was stored as mm
436  if (hasDeparted()) {
437  myDeparture -= offset;
438  myEventTime -= offset;
439  myLastEntryTime -= offset;
440  myCurrEdge += routeOffset;
441  if (segIndex >= 0) {
443  while (seg->getIndex() != (int)segIndex) {
444  seg = seg->getNextSegment();
445  assert(seg != 0);
446  }
447  setSegment(seg, queIndex);
448  } else {
449  // on teleport
450  setSegment(nullptr, 0);
451  assert(myEventTime != SUMOTime_MIN);
452  MSGlobals::gMesoNet->addLeaderCar(this, nullptr);
453  }
454  // see MSBaseVehicle constructor
457  }
458  }
459  if (myBlockTime != SUMOTime_MAX) {
460  myBlockTime -= offset;
461  }
462  std::istringstream dis(attrs.getString(SUMO_ATTR_DISTANCE));
463  dis >> myOdometer >> myNumberReroutes;
464 }
465 
466 
467 /****************************************************************************/
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define SUMOTime_MAX
Definition: SUMOTime.h:32
#define SUMOTime_MIN
Definition: SUMOTime.h:33
long long int SUMOTime
Definition: SUMOTime.h:31
@ GIVEN
The speed is given.
const int VEHPARS_FORCE_REROUTE
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_DISTANCE
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_STATE
The state of a link.
T MIN2(T a, T b)
Definition: StdDefs.h:73
T MAX2(T a, T b)
Definition: StdDefs.h:79
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
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:79
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:302
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
Definition: MELoop.cpp:203
void removeLeaderCar(MEVehicle *v)
Removes the given car from the leading vehicles.
Definition: MELoop.cpp:215
A single mesoscopic segment (cell)
Definition: MESegment.h:47
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
Definition: MESegment.cpp:444
SUMOTime getLinkPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0)
Definition: MESegment.cpp:770
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
Definition: MESegment.cpp:415
double getLength() const
Returns the length of the segment in meters.
Definition: MESegment.h:216
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
Definition: MESegment.h:208
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition: MESegment.h:325
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition: MESegment.h:200
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
Definition: MESegment.h:409
double getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
Definition: MEVehicle.cpp:132
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MEVehicle.cpp:100
double getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
Definition: MEVehicle.cpp:117
double getAngle() const
Returns the vehicle's direction in degrees.
Definition: MEVehicle.cpp:86
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
Definition: MEVehicle.cpp:72
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
Definition: MEVehicle.cpp:289
SUMOTime myEventTime
The (planned) time of leaving the segment (cell)
Definition: MEVehicle.h:381
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MEVehicle.cpp:375
void updateDetectorForWriting(MSMoveReminder *rem, SUMOTime currentTime, SUMOTime exitTime)
Updates a single vehicle detector if present.
Definition: MEVehicle.cpp:305
BaseInfluencer & getBaseInfluencer()
Returns the velocity/lane influencer.
Definition: MEVehicle.cpp:360
double getCurrentStoppingTimeSeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
Definition: MEVehicle.cpp:235
double estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving accross the link.
Definition: MEVehicle.cpp:123
void processStop()
ends the current stop and performs loading/unloading
Definition: MEVehicle.cpp:254
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)
Definition: MEVehicle.cpp:157
MEVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: MEVehicle.cpp:50
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
Definition: MEVehicle.cpp:139
SUMOTime checkStop(SUMOTime time)
Returns until when to stop at the current segment and sets the information that the stop has been rea...
Definition: MEVehicle.cpp:213
void updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
Definition: MEVehicle.cpp:323
virtual bool isIdling() const
Returns whether the vehicle is trying to re-enter the net.
Definition: MEVehicle.cpp:173
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
Definition: MEVehicle.h:261
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MEVehicle.cpp:78
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
Definition: MEVehicle.h:384
BaseInfluencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MEVehicle.h:390
void setApproaching(MSLink *link)
registers vehicle with the given link
Definition: MEVehicle.cpp:179
bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addRouteStops=true, bool removeStops=true)
Replaces the current route by the given one.
Definition: MEVehicle.cpp:193
MESegment * getSegment() const
Returns the current segment the vehicle is on.
Definition: MEVehicle.h:237
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MEVehicle.cpp:381
MESegment * mySegment
The segment the vehicle is at.
Definition: MEVehicle.h:375
int getQueIndex() const
Returns the index of the que the vehicle is in.
Definition: MEVehicle.h:245
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
Definition: MEVehicle.h:284
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MEVehicle.cpp:419
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
Definition: MEVehicle.h:228
double getCurrentLinkPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
Definition: MEVehicle.cpp:295
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
Definition: MEVehicle.h:219
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MEVehicle.cpp:167
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
Definition: MEVehicle.cpp:107
double getSlope() const
Returns the slope of the road at vehicle's position in degrees.
Definition: MEVehicle.cpp:93
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
Definition: MEVehicle.h:387
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:51
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
std::list< MSStop > myStops
The vehicle's list of stops.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
double myDepartPos
The real depart position.
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
virtual bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
double getLength() const
Returns the vehicle's length.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
int getPersonNumber() const
Returns the number of persons.
MSRouteIterator myCurrEdge
Iterator to current route-edge.
bool hasDeparted() const
Returns whether this vehicle has already departed.
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
const MSRoute * myRoute
This vehicle's route.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
SUMOTime myDeparture
The real departure time.
std::vector< SUMOVehicleParameter::Stop > myPastStops
The list of stops that the vehicle has already reached.
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
bool isStopped() const
Returns whether the vehicle is at a stop.
int myNumberReroutes
The number of reroutings.
double myArrivalPos
The position on the destination lane where the vehicle stops.
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
double myOdometer
A simple odometer to keep track of the length of the route already driven.
int getContainerNumber() const
Returns the number of containers.
A device which collects info on the vehicle trip (mainly on departure and arrival)
void stopEnded(const SUMOVehicleParameter::Stop &stop)
Abstract in-vehicle / in-person device.
Definition: MSDevice.h:61
A road/street connecting two junctions.
Definition: MSEdge.h:77
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:166
double getLength() const
return the length of the edge
Definition: MSEdge.h:630
void removeWaiting(const SUMOVehicle *vehicle) const
Removes a vehicle from the list of waiting vehicles.
Definition: MSEdge.cpp:1168
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:94
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:517
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:476
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:497
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:503
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
void updateDetector(SUMOTrafficObject &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
The simulated network and simulation perfomer.
Definition: MSNet.h:89
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:171
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:995
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:313
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:404
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:388
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:986
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:75
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:69
Definition: MSStop.h:44
const MESegment * segment
The segment to stop at (mesosim only)
Definition: MSStop.h:52
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSStop.h:48
const SUMOVehicleParameter::Stop pars
The stop parameter.
Definition: MSStop.h:65
static MSStopOut * getInstance()
Definition: MSStopOut.h:60
static bool active()
Definition: MSStopOut.h:54
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID)
Definition: MSStopOut.cpp:98
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
Definition: MSStopOut.cpp:65
bool loadAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToLoadNextContainer, SUMOTime &stopDuration)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
bool boardAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToBoardNextPerson, SUMOTime &stopDuration)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
The car-following model and parameter.
Definition: MSVehicleType.h:62
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:90
double getLength() const
Get vehicle's length [m].
const std::string & getID() const
Returns the id.
Definition: Named.h:73
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
static double rand(std::mt19937 *rng=nullptr)
Returns a random real number in [0, 1)
Definition: RandHelper.h:51
Encapsulated SAX-Attributes.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
Definition of vehicle stop (position and duration)
SUMOTime depart
the time at which this stop was ended
double endPos
The stopping position end.
Structure representing possible vehicle parameter.
double departSpeed
(optional) The initial speed of the vehicle
std::vector< std::string > via
List of the via-edges the vehicle must visit.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
std::string id
The vehicle's id.
bool wasSet(int what) const
Returns whether the given parameter was set.