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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A vehicle from the mesoscopic point of view
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <iostream>
25 #include <cassert>
26 #include <utils/common/StdDefs.h>
34 #include <microsim/MSGlobals.h>
35 #include <microsim/MSEdge.h>
36 #include <microsim/MSLane.h>
37 #include <microsim/MSNet.h>
38 #include <microsim/MSVehicleType.h>
39 #include <microsim/MSLink.h>
43 #include "MELoop.h"
44 #include "MEVehicle.h"
45 #include "MESegment.h"
46 
47 
48 // ===========================================================================
49 // method definitions
50 // ===========================================================================
52  MSVehicleType* type, const double speedFactor) :
53  MSBaseVehicle(pars, route, type, speedFactor),
54  mySegment(nullptr),
55  myQueIndex(0),
56  myEventTime(SUMOTime_MIN),
57  myLastEntryTime(SUMOTime_MIN),
58  myBlockTime(SUMOTime_MAX) {
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 its first edge.");
62  }
63  if (pars->departSpeedProcedure == DEPART_SPEED_GIVEN && pars->departSpeed > type->getMaxSpeed()) {
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)
163 }
164 
165 bool
167  return getSegment() != nullptr;
168 }
169 
170 
171 bool
173  return false; // parking attribute of a stop is not yet evaluated /implemented
174 }
175 
176 
177 bool
178 MEVehicle::replaceRoute(const MSRoute* newRoute, const std::string& info, bool onInit, int offset, bool addStops, bool removeStops) {
179  UNUSED_PARAMETER(addStops); // @todo recheck!
180  UNUSED_PARAMETER(removeStops); // @todo recheck!
181  const ConstMSEdgeVector& edges = newRoute->getEdges();
182  // assert the vehicle may continue (must not be "teleported" or whatever to another position)
183  if (!onInit && !newRoute->contains(*myCurrEdge)) {
184  return false;
185  }
186  MSLink* oldLink = nullptr;
187  MSLink* newLink = nullptr;
188  if (mySegment != nullptr) {
189  oldLink = mySegment->getLink(this);
190  }
191  // rebuild in-vehicle route information
192  if (onInit) {
193  myCurrEdge = newRoute->begin();
194  } else {
195  myCurrEdge = std::find(edges.begin() + offset, edges.end(), *myCurrEdge);
196  }
197  // check whether the old route may be deleted (is not used by anyone else)
198  newRoute->addReference();
199  myRoute->release();
200  // assign new route
201  myRoute = newRoute;
202  if (mySegment != nullptr) {
203  newLink = mySegment->getLink(this);
204  }
205  // update approaching vehicle information
206  if (oldLink != nullptr && oldLink != newLink) {
207  oldLink->removeApproaching(this);
208  MELoop::setApproaching(this, newLink);
209  }
210  // update arrival definition
212  // save information that the vehicle was rerouted
216  return true;
217 }
218 
219 
220 bool
221 MEVehicle::addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& /*errorMsg*/, SUMOTime untilOffset, bool /*collision*/,
222  MSRouteIterator* /* searchStart */) {
223  const MSEdge* const edge = MSEdge::dictionary(stopPar.lane.substr(0, stopPar.lane.rfind('_')));
224  assert(edge != 0);
225  MESegment* stopSeg = MSGlobals::gMesoNet->getSegmentForEdge(*edge, stopPar.endPos);
226  std::vector<SUMOVehicleParameter::Stop>& segmentStops = myStops[stopSeg];
227  bool cyclicRoute = (myStopEdges.size() > 0 && myStopEdges.back() == edge
228  && segmentStops.size() > 0 && segmentStops.back().endPos > stopPar.endPos
229  && stopPar.index != STOP_INDEX_FIT);
230  segmentStops.push_back(stopPar);
231  if (segmentStops.back().until >= 0) {
232  segmentStops.back().until += untilOffset;
233  }
234  if (myStopEdges.empty() || myStopEdges.back() != edge || cyclicRoute) {
235  myStopEdges.push_back(edge);
236  }
237  return true;
238 }
239 
240 
241 bool
243  return myStops.find(mySegment) != myStops.end();
244 }
245 
246 
247 bool
249  return false;
250 }
251 
252 
253 bool
254 MEVehicle::isStoppedInRange(const double /* pos */, const double /* tolerance */) const {
255  return isStopped();
256 }
257 
258 
259 SUMOTime
260 MEVehicle::getStoptime(const MESegment* const seg, SUMOTime time) const {
261  if (myStops.find(seg) != myStops.end()) {
262  for (const SUMOVehicleParameter::Stop& stop : myStops.find(seg)->second) {
263  time += stop.duration;
264  if (stop.until > time) {
265  // @note: this assumes the stop is reached at time. With the way this is called in MESegment (time == entryTime),
266  // travel time is overestimated of the stop is not at the start of the segment
267  time = stop.until;
268  }
269  }
270  }
271  return time;
272 }
273 
274 
275 double
278 }
279 
280 
281 const ConstMSEdgeVector
282 MEVehicle::getStopEdges(double& firstPos, double& lastPos) const {
283  if (myStopEdges.size() > 0) {
284  // always try to skip
285  firstPos = myStopEdges.front()->getLength();
286  lastPos = 0;
287  }
288  return myStopEdges;
289 }
290 
291 
292 std::vector<std::pair<int, double> >
294  std::vector<std::pair<int, double> > result;
295  auto it = myCurrEdge;
296  for (const MSEdge* e : myStopEdges) {
297  auto it2 = std::find(it, myRoute->end(), e);
298  if (it2 != myRoute->end()) {
299  result.push_back(std::make_pair((int)(it2 - myRoute->begin()), 0));
300  it = it2;
301  }
302  }
303  return result;
304 }
305 
306 void
308  assert(isStopped());
309  MSEdge* edge = const_cast<MSEdge*>(getEdge());
310  auto segStopsIt = myStops.find(mySegment);
311  std::vector<SUMOVehicleParameter::Stop>& stops = segStopsIt->second;
312  double lastPos = 0;
313  for (auto it = stops.begin(); it != stops.end();) {
314  SUMOVehicleParameter::Stop stop = *it;
315  if (stop.endPos <= lastPos) {
316  break;
317  }
318  lastPos = stop.endPos;
319  if (MSStopOut::active()) {
321  }
322  MSNet* const net = MSNet::getInstance();
323  SUMOTime dummy = -1; // boarding- and loading-time are not considered
324  if (net->hasPersons()) {
325  net->getPersonControl().boardAnyWaiting(edge, this, stop, dummy, dummy);
326  }
327  if (net->hasContainers()) {
328  net->getContainerControl().loadAnyWaiting(edge, this, stop, dummy, dummy);
329  }
330  MSDevice_Vehroutes* vehroutes = static_cast<MSDevice_Vehroutes*>(getDevice(typeid(MSDevice_Vehroutes)));
331  if (vehroutes != nullptr) {
332  vehroutes->stopEnded(stop);
333  }
334  if (MSStopOut::active()) {
336  }
337  it = stops.erase(it);
338  }
340  // clean up stops
341  if (stops.size() == 0) {
342  myStops.erase(segStopsIt);
343  }
344  bool removeStopEdge = true;
345  // remove the current stop edge if there are no stops on further segments of this edge
346  for (MESegment* next = mySegment->getNextSegment(); next != nullptr; next = next->getNextSegment()) {
347  if (myStops.count(next) != 0) {
348  removeStopEdge = false;
349  break;
350  }
351  }
352  if (removeStopEdge) {
353  if (myStopEdges.size() > 0) {
354  myStopEdges.erase(myStopEdges.begin());
355  } else {
356  assert(false);
357  }
358  }
359 }
360 
361 
362 bool
364  return mySegment == nullptr || mySegment->isOpen(this);
365 }
366 
367 
368 double
370  if (mySegment == nullptr) {
371  return 0;
372  } else {
373  return STEPS2TIME(mySegment->getLinkPenalty(this));
374  }
375 }
376 
377 
378 void
380  for (MoveReminderCont::iterator i = myMoveReminders.begin(); i != myMoveReminders.end(); ++i) {
381  if (i->first == rem) {
383  (mySegment->getIndex() + 1) * mySegment->getLength(),
384  getLastEntryTime(), currentTime, exitTime, false);
385 #ifdef _DEBUG
386  if (myTraceMoveReminders) {
387  traceMoveReminder("notifyMove", i->first, i->second, true);
388  }
389 #endif
390  return;
391  }
392  }
393 }
394 
395 
396 void
397 MEVehicle::updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason) {
398  // segments of the same edge have the same reminder so no cleaning up must take place
399  const bool cleanUp = isLeave && (reason != MSMoveReminder::NOTIFICATION_SEGMENT);
400  for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) {
401  if (currentTime != getLastEntryTime()) {
402  rem->first->updateDetector(*this, mySegment->getIndex() * mySegment->getLength(),
403  (mySegment->getIndex() + 1) * mySegment->getLength(),
404  getLastEntryTime(), currentTime, getEventTime(), cleanUp);
405 #ifdef _DEBUG
406  if (myTraceMoveReminders) {
407  traceMoveReminder("notifyMove", rem->first, rem->second, true);
408  }
409 #endif
410  }
411  if (!isLeave || rem->first->notifyLeave(*this, mySegment->getLength(), reason)) {
412 #ifdef _DEBUG
413  if (isLeave && myTraceMoveReminders) {
414  traceMoveReminder("notifyLeave", rem->first, rem->second, true);
415  }
416 #endif
417  ++rem;
418  } else {
419 #ifdef _DEBUG
420  if (myTraceMoveReminders) {
421  traceMoveReminder("remove", rem->first, rem->second, false);
422  }
423 #endif
424  rem = myMoveReminders.erase(rem);
425  }
426  }
427 }
428 
429 
430 void
433  assert(mySegment == 0 || *myCurrEdge == &mySegment->getEdge());
434  std::vector<SUMOTime> internals;
435  internals.push_back(myDeparture);
436  internals.push_back((SUMOTime)distance(myRoute->begin(), myCurrEdge));
437  internals.push_back((SUMOTime)myDepartPos * 1000); // store as mm
438  internals.push_back(mySegment == nullptr ? (SUMOTime) - 1 : (SUMOTime)mySegment->getIndex());
439  internals.push_back((SUMOTime)getQueIndex());
440  internals.push_back(myEventTime);
441  internals.push_back(myLastEntryTime);
442  internals.push_back(myBlockTime);
443  out.writeAttr(SUMO_ATTR_STATE, toString(internals));
444  // save stops and parameters
445  for (const auto& it : myStops) {
446  for (const SUMOVehicleParameter::Stop& stop : it.second) {
447  stop.write(out);
448  }
449  }
450  myParameter->writeParams(out);
451  for (MSDevice* dev : myDevices) {
452  dev->saveState(out);
453  }
454  out.closeTag();
455 }
456 
457 
458 void
459 MEVehicle::loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset) {
460  if (attrs.hasAttribute(SUMO_ATTR_POSITION)) {
461  throw ProcessError("Error: Invalid vehicles in state (may be a micro state)!");
462  }
463  int routeOffset;
464  int segIndex;
465  int queIndex;
466  std::istringstream bis(attrs.getString(SUMO_ATTR_STATE));
467  bis >> myDeparture;
468  bis >> routeOffset;
469  bis >> myDepartPos;
470  bis >> segIndex;
471  bis >> queIndex;
472  bis >> myEventTime;
473  bis >> myLastEntryTime;
474  bis >> myBlockTime;
475  myDepartPos *= 1000; // was stored as mm
476  if (hasDeparted()) {
477  myDeparture -= offset;
478  myEventTime -= offset;
479  myLastEntryTime -= offset;
480  myCurrEdge += routeOffset;
481  if (segIndex >= 0) {
483  while (seg->getIndex() != (int)segIndex) {
484  seg = seg->getNextSegment();
485  assert(seg != 0);
486  }
487  setSegment(seg, queIndex);
488  } else {
489  // on teleport
490  setSegment(nullptr, 0);
491  assert(myEventTime != SUMOTime_MIN);
492  MSGlobals::gMesoNet->addLeaderCar(this, nullptr);
493  }
494  }
495  if (myBlockTime != SUMOTime_MAX) {
496  myBlockTime -= offset;
497  }
498 }
499 
500 
501 /****************************************************************************/
502 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
MSTransportableControl::boardAnyWaiting
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...
Definition: MSTransportableControl.cpp:154
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
MSRoute::release
void release() const
deletes the route if there are no further references to it
Definition: MSRoute.cpp:101
MSVehicleType::getID
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:94
MSBaseVehicle::hasDeparted
bool hasDeparted() const
Returns whether this vehicle has already departed.
Definition: MSBaseVehicle.cpp:368
SUMOSAXAttributes::hasAttribute
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
MSCFModel::getMaxAccel
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:210
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:74
MSStopOut.h
MSNet::hasContainers
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:370
MSBaseVehicle::getContainerNumber
int getContainerNumber() const
Returns the number of containers.
Definition: MSBaseVehicle.cpp:599
MSNet.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
SUMOSAXAttributes::getString
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOVehicleParameter::Stop::lane
std::string lane
The lane to stop at.
Definition: SUMOVehicleParameter.h:580
MESegment
A single mesoscopic segment (cell)
Definition: MESegment.h:50
MEVehicle::updateDetectorForWriting
void updateDetectorForWriting(MSMoveReminder *rem, SUMOTime currentTime, SUMOTime exitTime)
Updates a single vehicle detector if present.
Definition: MEVehicle.cpp:379
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSBaseVehicle::myDeparture
SUMOTime myDeparture
The real departure time.
Definition: MSBaseVehicle.h:532
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
MSRoute::end
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:76
MSRouteIterator
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:58
MEVehicle::getAverageSpeed
double getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
Definition: MEVehicle.cpp:117
MSStopOut::getInstance
static MSStopOut * getInstance()
Definition: MSStopOut.h:63
SUMOVehicleParameter::departSpeed
double departSpeed
(optional) The initial speed of the vehicle
Definition: SUMOVehicleParameter.h:500
MEVehicle::saveState
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MEVehicle.cpp:431
MEVehicle::myStopEdges
ConstMSEdgeVector myStopEdges
edges to stop
Definition: MEVehicle.h:382
MSNet::getContainerControl
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:806
MSBaseVehicle::myDevices
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
Definition: MSBaseVehicle.h:523
MSNet::informVehicleStateListener
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
Definition: MSNet.cpp:882
MESegment::getEdge
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition: MESegment.h:266
MSVehicleControl::removeWaiting
void removeWaiting(const MSEdge *const edge, const SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles for the given edge.
Definition: MSVehicleControl.cpp:398
MsgHandler.h
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:92
FileHelpers.h
MEVehicle::getPositionOnLane
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MEVehicle.cpp:78
MEVehicle::getLastEntryTime
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
Definition: MEVehicle.h:268
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
MSBaseVehicle::myRoute
const MSRoute * myRoute
This vehicle's route.
Definition: MSBaseVehicle.h:496
PositionVector::slopeDegreeAtOffset
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
Definition: PositionVector.cpp:317
MEVehicle::getPosition
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MEVehicle.cpp:100
ConstMSEdgeVector
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:73
MEVehicle::myBlockTime
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
Definition: MEVehicle.h:376
MSNet::hasPersons
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:354
MEVehicle::getCurrentStoppingTimeSeconds
double getCurrentStoppingTimeSeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
Definition: MEVehicle.cpp:276
MSRoute::getEdges
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:121
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
MSEdge.h
MESegment::isOpen
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
Definition: MESegment.cpp:408
MSNet::VEHICLE_STATE_NEWROUTE
The vehicle got a new route.
Definition: MSNet.h:548
MSRoute
Definition: MSRoute.h:67
MSTransportableControl::loadAnyWaiting
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...
Definition: MSTransportableControl.cpp:199
MSDevice.h
MEVehicle::moveRoutePointer
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
Definition: MEVehicle.cpp:139
Parameterised::writeParams
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
Definition: Parameterised.cpp:111
MSBaseVehicle::calculateArrivalParams
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
Definition: MSBaseVehicle.cpp:480
MSMoveReminder
Something on a lane to be noticed about vehicle movement.
Definition: MSMoveReminder.h:64
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:254
MSVehicleType.h
MSBaseVehicle::myParameter
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
Definition: MSBaseVehicle.h:493
MSBaseVehicle::myArrivalPos
double myArrivalPos
The position on the destination lane where the vehicle stops.
Definition: MSBaseVehicle.h:538
MESegment.h
SUMOTime_MIN
#define SUMOTime_MIN
Definition: SUMOTime.h:37
MSBaseVehicle::getEdge
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
Definition: MSBaseVehicle.cpp:170
MEVehicle::updateDetectors
void updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
Definition: MEVehicle.cpp:397
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
MEVehicle::getEventTime
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
Definition: MEVehicle.h:226
BinaryInputDevice.h
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
MEVehicle::getSlope
double getSlope() const
Returns the slope of the road at vehicle's position.
Definition: MEVehicle.cpp:93
MELoop::addLeaderCar
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
Definition: MELoop.cpp:198
MSBaseVehicle::saveState
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
Definition: MSBaseVehicle.cpp:543
MSMoveReminder::updateDetector
void updateDetector(SUMOTrafficObject &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
Definition: MSMoveReminder.cpp:44
MEVehicle::isStopped
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MEVehicle.cpp:242
MEVehicle::addStop
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
Definition: MEVehicle.cpp:221
MSVehicleType::getCarFollowModel
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
Definition: MSVehicleType.h:141
MEVehicle::loadState
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MEVehicle.cpp:459
MEVehicle::getAngle
double getAngle() const
Returns the vehicle's direction in degrees.
Definition: MEVehicle.cpp:86
MSTransportableControl.h
DEPART_SPEED_GIVEN
The speed is given.
Definition: SUMOVehicleParameter.h:190
MEVehicle::mayProceed
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
Definition: MEVehicle.cpp:363
MSEdge::dictionary
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:804
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
STOP_INDEX_FIT
const int STOP_INDEX_FIT
Definition: SUMOVehicleParameter.h:72
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:462
MSBaseVehicle::myDepartPos
double myDepartPos
The real depart position.
Definition: MSBaseVehicle.h:535
MSLane::interpolateLanePosToGeometryPos
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:499
MEVehicle::isStoppedTriggered
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
Definition: MEVehicle.cpp:248
MELoop::getSegmentForEdge
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:293
MEVehicle::getBackPositionOnLane
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
Definition: MEVehicle.cpp:72
OutputDevice.h
MESegment::getLink
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:377
MSStopOut::active
static bool active()
Definition: MSStopOut.h:57
MSDevice
Abstract in-vehicle / in-person device.
Definition: MSDevice.h:64
ProcessError
Definition: UtilExceptions.h:40
MEVehicle::getStoptime
SUMOTime getStoptime(const MESegment *const seg, SUMOTime time) const
Returns until when to stop at the given segment.
Definition: MEVehicle.cpp:260
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
MEVehicle::isOnRoad
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MEVehicle.cpp:166
MEVehicle::MEVehicle
MEVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: MEVehicle.cpp:51
MSGlobals.h
SUMOVehicleParameter::Stop::write
void write(OutputDevice &dev) const
Writes the stop as XML.
Definition: SUMOVehicleParameter.cpp:167
MESegment::getNextSegment
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
Definition: MESegment.h:152
MEVehicle::processStop
void processStop()
ends the current stop and performs loading/unloading
Definition: MEVehicle.cpp:307
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
SUMOVehicleParameter::Stop::endPos
double endPos
The stopping position end.
Definition: SUMOVehicleParameter.h:598
MSBaseVehicle::getVehicleType
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:118
MEVehicle::getStopIndices
std::vector< std::pair< int, double > > getStopIndices() const
return list of route indices for the remaining stops
Definition: MEVehicle.cpp:293
SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:658
MELoop::setApproaching
static void setApproaching(MEVehicle *veh, MSLink *link)
registers vehicle with the given link
Definition: MELoop.cpp:205
MSMoveReminder::NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
Definition: MSMoveReminder.h:95
MSBaseVehicle::myNumberReroutes
int myNumberReroutes
The number of reroutings.
Definition: MSBaseVehicle.h:544
MEVehicle::estimateLeaveSpeed
double estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving accross the link.
Definition: MEVehicle.cpp:123
MSBaseVehicle::addStops
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Definition: MSBaseVehicle.cpp:559
MSDevice_Vehroutes::stopEnded
void stopEnded(const SUMOVehicleParameter::Stop &stop)
Definition: MSDevice_Vehroutes.cpp:171
MEVehicle::getWaitingTime
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
Definition: MEVehicle.h:291
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:478
MEVehicle::getCurrentLinkPenaltySeconds
double getCurrentLinkPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
Definition: MEVehicle.cpp:369
SUMO_ATTR_STATE
The state of a link.
Definition: SUMOXMLDefinitions.h:705
MEVehicle::getSegment
MESegment * getSegment() const
Returns the current segment the vehicle is on.
Definition: MEVehicle.h:244
MEVehicle::replaceRoute
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.
Definition: MEVehicle.cpp:178
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
MSNet::getPersonControl
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:798
MSGlobals::gMesoNet
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:106
MSBaseVehicle::myCurrEdge
MSRouteIterator myCurrEdge
Iterator to current route-edge.
Definition: MSBaseVehicle.h:502
MSDevice_Vehroutes
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Vehroutes.h:53
SUMOVehicleParameter::via
std::vector< std::string > via
List of the via-edges the vehicle must visit.
Definition: SUMOVehicleParameter.h:641
MESegment::getLength
double getLength() const
Returns the length of the segment in meters.
Definition: MESegment.h:160
MEVehicle::mySegment
MESegment * mySegment
The segment the vehicle is at.
Definition: MEVehicle.h:364
SUMOVehicleParameter::Stop::index
int index
at which position in the stops list
Definition: SUMOVehicleParameter.h:631
MEVehicle::myLastEntryTime
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
Definition: MEVehicle.h:373
MEVehicle::isParking
bool isParking() const
Returns whether the vehicle is parking.
Definition: MEVehicle.cpp:172
MEVehicle::getSpeed
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
Definition: MEVehicle.cpp:107
MEVehicle::getConservativeSpeed
double getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
Definition: MEVehicle.cpp:132
PositionVector::rotationAtOffset
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
Definition: PositionVector.cpp:286
MEVehicle::isStoppedInRange
bool isStoppedInRange(const double pos, const double tolerance) const
return whether the given position is within range of the current stop
Definition: MEVehicle.cpp:254
MSVehicleType::getLength
double getLength() const
Get vehicle's length [m].
Definition: MSVehicleType.h:110
MEVehicle::hasArrived
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)
Definition: MEVehicle.cpp:157
MSStopOut::stopStarted
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
Definition: MSStopOut.cpp:64
MEVehicle::setSegment
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
Definition: MEVehicle.h:235
MSBaseVehicle::getPersonNumber
int getPersonNumber() const
Returns the number of persons.
Definition: MSBaseVehicle.cpp:583
MEVehicle::getStopEdges
const ConstMSEdgeVector getStopEdges(double &firstPos, double &lastPos) const
Returns the list of still pending stop edges.
Definition: MEVehicle.cpp:282
SUMOSAXAttributes.h
MSBaseVehicle
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
MEVehicle.h
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:165
MSDevice_Vehroutes.h
MSVehicleType::getMaxSpeed
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
Definition: MSVehicleType.h:162
MEVehicle::getQueIndex
int getQueIndex() const
Returns the index of the que the vehicle is in.
Definition: MEVehicle.h:252
MSRoute::begin
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:70
config.h
StdDefs.h
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
MELoop.h
MESegment::getLinkPenalty
SUMOTime getLinkPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0)
Definition: MESegment.cpp:713
SUMOTime_MAX
#define SUMOTime_MAX
Definition: SUMOTime.h:36
MSRoute::addReference
void addReference() const
increments the reference counter for the route
Definition: MSRoute.cpp:95
MSLane.h
MSLane::getVehicleMaxSpeed
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:519
MSVehicleType::getVehicleClass
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
Definition: MSVehicleType.h:185
MSRoute::contains
bool contains(const MSEdge *const edge) const
Definition: MSRoute.h:103
MSStopOut::stopEnded
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID)
Definition: MSStopOut.cpp:99
MESegment::getIndex
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition: MESegment.h:144
MSBaseVehicle::getDevice
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
Definition: MSBaseVehicle.cpp:532
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
MSBaseVehicle::myMoveReminders
MoveReminderCont myMoveReminders
Currently relevant move reminders.
Definition: MSBaseVehicle.h:519
MSVehicleControl.h
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:89
POSITION_EPS
#define POSITION_EPS
Definition: config.h:169
MEVehicle::myStops
std::map< const MESegment *const, std::vector< SUMOVehicleParameter::Stop > > myStops
where to stop
Definition: MEVehicle.h:379
MEVehicle::myEventTime
SUMOTime myEventTime
The (planned) time of leaving the segment (cell)
Definition: MEVehicle.h:370
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:337
SUMOVehicleParameter::departSpeedProcedure
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
Definition: SUMOVehicleParameter.h:503
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:566