Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSStageDriving.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-2023 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/****************************************************************************/
20// The common superclass for modelling transportable objects like persons and containers
21/****************************************************************************/
22#include <config.h>
23
29#include <microsim/MSEdge.h>
30#include <microsim/MSLane.h>
31#include <microsim/MSNet.h>
32#include <microsim/MSStop.h>
43
44
45// ===========================================================================
46// method definitions
47// ===========================================================================
48MSStageDriving::MSStageDriving(const MSEdge* origin, const MSEdge* destination,
49 MSStoppingPlace* toStop, const double arrivalPos, const std::vector<std::string>& lines,
50 const std::string& group,
51 const std::string& intendedVeh, SUMOTime intendedDepart) :
52 MSStage(destination, toStop, arrivalPos, MSStageType::DRIVING, group),
53 myOrigin(origin),
54 myLines(lines.begin(), lines.end()),
55 myVehicle(nullptr),
56 myVehicleID("NULL"),
57 myVehicleVClass(SVC_IGNORING),
58 myVehicleDistance(-1.),
59 myTimeLoss(-1),
60 myWaitingSince(-1),
61 myWaitingEdge(nullptr),
62 myStopWaitPos(Position::INVALID),
63 myOriginStop(nullptr),
64 myIntendedVehicleID(intendedVeh),
65 myIntendedDepart(intendedDepart) {
66}
67
68
74
75
77
78
79const MSEdge*
81 if (myVehicle != nullptr) {
82 if (myVehicle->getLane() != nullptr) {
83 return &myVehicle->getLane()->getEdge();
84 }
85 return myVehicle->getEdge();
86 } else if (myArrived >= 0) {
87 return myDestination;
88 } else {
89 return myWaitingEdge;
90 }
91}
92
93
94const MSEdge*
98
99
100double
102 if (isWaiting4Vehicle()) {
103 return myWaitingPos;
104 } else if (myArrived >= 0) {
105 return myArrivalPos;
106 } else {
107 // vehicle may already have passed the lane (check whether this is correct)
108 return MIN2(myVehicle->getPositionOnLane(), getEdge()->getLength());
109 }
110}
111
112int
114 if (isWaiting4Vehicle()) {
116 } else if (myArrived >= 0) {
118 } else {
119 return MSPModel::FORWARD;
120 }
121}
122
123const MSLane*
125 return myVehicle != nullptr ? myVehicle->getLane() : nullptr;
126}
127
128
131 if (isWaiting4Vehicle()) {
133 return myStopWaitPos;
134 }
137 } else if (myArrived >= 0) {
140 } else {
141 return myVehicle->getPosition();
142 }
143}
144
145
146double
148 if (isWaiting4Vehicle()) {
150 } else if (myArrived >= 0) {
152 } else {
153 MSVehicle* veh = dynamic_cast<MSVehicle*>(myVehicle);
154 if (veh != nullptr) {
155 return veh->getAngle();
156 } else {
157 return 0;
158 }
159 }
160}
161
162
163double
165 if (myVehicle != nullptr) {
166 // distance was previously set to driven distance upon embarking
168 }
169 return myVehicleDistance;
170}
171
172
173std::string
174MSStageDriving::getStageDescription(const bool isPerson) const {
175 return isWaiting4Vehicle() ? "waiting for " + joinToString(myLines, ",") : (isPerson ? "driving" : "transport");
176}
177
178
179std::string
180MSStageDriving::getStageSummary(const bool isPerson) const {
181 const std::string dest = (getDestinationStop() == nullptr ?
182 " edge '" + getDestination()->getID() + "'" :
183 " stop '" + getDestinationStop()->getID() + "'" + (
184 getDestinationStop()->getMyName() != "" ? " (" + getDestinationStop()->getMyName() + ")" : ""));
185 const std::string intended = myIntendedVehicleID != "" ?
186 " (vehicle " + myIntendedVehicleID + " at time=" + time2string(myIntendedDepart) + ")" :
187 "";
188 const std::string modeName = isPerson ? "driving" : "transported";
189 return isWaiting4Vehicle() ?
190 "waiting for " + joinToString(myLines, ",") + intended + " then " + modeName + " to " + dest :
191 modeName + " to " + dest;
192}
193
194
195void
196MSStageDriving::proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* previous) {
198 ? previous->getOriginStop()
199 : previous->getDestinationStop());
200 myWaitingSince = now;
201 const bool isPerson = transportable->isPerson();
203 && transportable->getNumRemainingStages() == transportable->getNumStages() - 1) {
204 // we are the first real stage (stage 0 is WAITING_FOR_DEPART)
205 const std::string vehID = *myLines.begin();
206 SUMOVehicle* startVeh = net->getVehicleControl().getVehicle(vehID);
207 if (startVeh == nullptr) {
208 throw ProcessError("Vehicle '" + vehID + "' not found for triggered departure of " +
209 (isPerson ? "person" : "container") + " '" + transportable->getID() + "'.");
210 }
211 setVehicle(startVeh);
212 if (myOriginStop != nullptr) {
213 myOriginStop->removeTransportable(transportable);
214 }
215 myWaitingEdge = previous->getEdge();
217 myWaitingPos = previous->getEdgePos(now);
218 myVehicle->addTransportable(transportable);
219 return;
220 }
221 if (myOriginStop != nullptr) {
222 // the arrival stop may have an access point
226 } else {
227 myWaitingEdge = previous->getEdge();
229 myWaitingPos = previous->getEdgePos(now);
230 }
231 if (myOrigin != nullptr && myOrigin != myWaitingEdge
232 && (myOriginStop == nullptr || myOriginStop->getAccessPos(myOrigin) < 0)) {
233 // transfer at junction (rather than access)
235 myWaitingPos = 0;
236 }
237 SUMOVehicle* const availableVehicle = myWaitingEdge->getWaitingVehicle(transportable, myWaitingPos);
238 const bool triggered = availableVehicle != nullptr &&
239 ((isPerson && availableVehicle->getParameter().departProcedure == DepartDefinition::TRIGGERED) ||
240 (!isPerson && availableVehicle->getParameter().departProcedure == DepartDefinition::CONTAINER_TRIGGERED));
241 if (triggered && !availableVehicle->hasDeparted()) {
242 setVehicle(availableVehicle);
243 if (myOriginStop != nullptr) {
244 myOriginStop->removeTransportable(transportable);
245 }
246 myVehicle->addTransportable(transportable);
249 } else {
250 registerWaiting(transportable, now);
251 }
252}
253
254void
256 // check if the ride can be conducted and reserve it
258 const MSEdge* to = getDestination();
259 double toPos = getArrivalPos();
260 if ((to->getPermissions() & SVC_TAXI) == 0 && getDestinationStop() != nullptr) {
261 // try to find usable access edge
262 for (const auto& tuple : getDestinationStop()->getAllAccessPos()) {
263 const MSEdge* access = &std::get<0>(tuple)->getEdge();
264 if ((access->getPermissions() & SVC_TAXI) != 0) {
265 to = access;
266 toPos = std::get<1>(tuple);
267 break;
268 }
269 }
270 }
271 if ((myWaitingEdge->getPermissions() & SVC_TAXI) == 0 && myOriginStop != nullptr) {
272 // try to find usable access edge
273 for (const auto& tuple : myOriginStop->getAllAccessPos()) {
274 const MSEdge* access = &std::get<0>(tuple)->getEdge();
275 if ((access->getPermissions() & SVC_TAXI) != 0) {
276 myWaitingEdge = access;
278 myWaitingPos = std::get<1>(tuple);
279 break;
280 }
281 }
282 }
283 MSDevice_Taxi::addReservation(transportable, getLines(), now, now, myWaitingEdge, myWaitingPos, to, toPos, myGroup);
284 }
285 if (transportable->isPerson()) {
287 } else {
289 }
290 myWaitingEdge->addTransportable(transportable);
291}
292
293void
294MSStageDriving::tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const {
296 const SUMOTime departed = myDeparted >= 0 ? myDeparted : now;
297 const SUMOTime waitingTime = myWaitingSince >= 0 ? departed - myWaitingSince : -1;
298 const SUMOTime duration = myArrived - myDeparted;
300 os.openTag(transportable->isPerson() ? "ride" : "transport");
301 os.writeAttr("waitingTime", waitingTime >= 0 ? time2string(waitingTime) : "-1");
302 os.writeAttr("vehicle", myVehicleID);
303 os.writeAttr("depart", myDeparted >= 0 ? time2string(myDeparted) : "-1");
304 os.writeAttr("arrival", myArrived >= 0 ? time2string(myArrived) : "-1");
305 os.writeAttr("arrivalPos", myArrived >= 0 ? toString(getArrivalPos()) : "-1");
306 os.writeAttr("duration", myArrived >= 0 ? time2string(duration) :
307 (myDeparted >= 0 ? time2string(now - myDeparted) : "-1"));
308 os.writeAttr("routeLength", myArrived >= 0 || myVehicle != nullptr ? toString(getDistance()) : "-1");
309 os.writeAttr("timeLoss", myArrived >= 0 ? time2string(myTimeLoss) : "-1");
310 os.closeTag();
311}
312
313
314void
315MSStageDriving::routeOutput(const bool isPerson, OutputDevice& os, const bool withRouteLength, const MSStage* const previous) const {
317 if (getFromEdge() != nullptr) {
319 } else if (previous != nullptr && previous->getStageType() == MSStageType::WAITING_FOR_DEPART) {
320 os.writeAttr(SUMO_ATTR_FROM, previous->getEdge()->getID());
321 }
323 std::string comment = "";
324 if (myDestinationStop != nullptr) {
326 if (myDestinationStop->getMyName() != "") {
327 comment = " <!-- " + StringUtils::escapeXML(myDestinationStop->getMyName(), true) + " -->";
328 }
329 } else if (!unspecifiedArrivalPos()) {
331 }
333 if (myIntendedVehicleID != "") {
335 }
336 if (myIntendedDepart >= 0) {
338 }
339 if (withRouteLength) {
340 os.writeAttr("routeLength", myVehicleDistance);
341 }
342 if (OptionsCont::getOptions().getBool("vehroute-output.exit-times")) {
343 os.writeAttr("vehicle", myVehicleID);
346 }
347 os.closeTag(comment);
348}
349
350
351bool
353 assert(myLines.size() > 0);
354 return (myLines.count(vehicle->getID()) > 0
355 || myLines.count(vehicle->getParameter().line) > 0
357 || (myLines.count("ANY") > 0 && (
358 myDestinationStop == nullptr
359 ? vehicle->stopsAtEdge(myDestination)
360 : vehicle->stopsAt(myDestinationStop))));
361}
362
363
364bool
366 return myVehicle == nullptr && myArrived < 0;
367}
368
369
374
375
376double
378 return myVehicle == nullptr ? 0 : myVehicle->getSpeed();
379}
380
381
384 ConstMSEdgeVector result;
385 result.push_back(getFromEdge());
386 result.push_back(getDestination());
387 return result;
388}
389
390double
394
395bool
397 return myArrivalPos == std::numeric_limits<double>::infinity();
398}
399
400const std::string
401MSStageDriving::setArrived(MSNet* net, MSTransportable* transportable, SUMOTime now, const bool vehicleArrived) {
402 MSStage::setArrived(net, transportable, now, vehicleArrived);
403 if (myVehicle != nullptr) {
404 // distance was previously set to driven distance upon embarking
407 if (vehicleArrived) {
409 } else {
411 }
412 } else {
413 myVehicleDistance = -1.;
414 myTimeLoss = -1;
415 }
416 myVehicle = nullptr; // avoid dangling pointer after vehicle arrival
417 return "";
418}
419
420
421void
423 myVehicle = v;
424 if (myVehicle != nullptr) {
425 myVehicleID = v->getID();
429 if (myVehicle->hasDeparted()) {
432 } else {
433 // it probably got triggered by the person
435 myTimeLoss = 0;
436 }
437 }
438}
439
440void
442 myDestinationStop = nullptr;
443 if (myVehicle != nullptr) {
444 // jumping out of a moving vehicle!
447 // myVehicleDistance and myTimeLoss are updated in subsequent call to setArrived
448 } else {
449 MSTransportableControl& tc = (t->isPerson() ?
455 }
456}
457
458
459std::string
461 return isWaiting4Vehicle() ? ("waiting for " + joinToString(myLines, ",")
462 + " at " + (myDestinationStop == nullptr
463 ? ("edge '" + myWaitingEdge->getID() + "'")
464 : ("busStop '" + myDestinationStop->getID() + "'"))
465 ) : "";
466}
467
468
469bool
471 const MSEdge* stopEdge = stop.getEdge();
472 bool canLeave = false;
473 if (t->getDestination() == stopEdge) {
474 // if this is the last stage, we can use the arrivalPos of the person
475 const bool unspecifiedAP = unspecifiedArrivalPos() && (
477 const double arrivalPos = (unspecifiedArrivalPos()
479 SUMO_ATTR_ARRIVALPOS, t->getID(), true)
480 : getArrivalPos());
481 if (unspecifiedAP || stop.isInRange(arrivalPos, veh.getLength() + MSGlobals::gStopTolerance)) {
482 canLeave = true;
483 }
484 }
485 if (myDestinationStop != nullptr) {
486 if (!canLeave) {
487 // check with more tolerance due to busStop size and also check
488 // access edges
489 const double accessPos = myDestinationStop->getAccessPos(veh.getEdge());
490 if (accessPos >= 0) {
491 double tolerance = veh.getLength() + MSGlobals::gStopTolerance;
492 if (&myDestinationStop->getLane().getEdge() == veh.getEdge()) {
493 // accessPos is in the middle of the stop
495 }
496 canLeave = stop.isInRange(accessPos, tolerance);
497 }
498 }
499 }
500 return canLeave;
501}
502
503
504void
505MSStageDriving::saveState(std::ostringstream& out) {
506 const bool hasVehicle = myVehicle != nullptr;
507 out << " " << myWaitingSince << " " << myTimeLoss << " " << myArrived << " " << hasVehicle;
508 if (hasVehicle) {
509 out << " " << myDeparted << " " << myVehicle->getID() << " " << myVehicleDistance;
510 }
511}
512
513
514void
515MSStageDriving::loadState(MSTransportable* transportable, std::istringstream& state) {
516 bool hasVehicle;
517 state >> myWaitingSince >> myTimeLoss >> myArrived >> hasVehicle;
518 if (hasVehicle) {
519 std::string vehID;
520 state >> myDeparted >> vehID;
522 setVehicle(startVeh);
523 myVehicle->addTransportable(transportable);
524 state >> myVehicleDistance;
525 } else {
526 // there should always be at least one prior WAITING_FOR_DEPART stage
527 MSStage* previous = transportable->getNextStage(-1);
529 ? previous->getOriginStop()
530 : previous->getDestinationStop());
531 if (myOriginStop != nullptr) {
532 // the arrival stop may have an access point
533 myOriginStop->addTransportable(transportable);
537 } else {
538 myWaitingEdge = previous->getEdge();
540 myWaitingPos = previous->getArrivalPos();
541 }
542 registerWaiting(transportable, SIMSTEP);
543 }
544}
545
546
547/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSEdge.h:74
MSStageType
Definition MSStage.h:54
std::vector< const MSEdge * > ConstMSEdgeVector
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define SIMSTEP
Definition SUMOTime.h:61
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_TAXI
vehicle is a taxi
const int VEHPARS_ARRIVALPOS_SET
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
@ SUMO_TAG_TRANSPORT
@ SUMO_TAG_RIDE
@ SUMO_ATTR_LINES
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_STARTED
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_ENDED
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_INTENDED
T MIN2(T a, T b)
Definition StdDefs.h:76
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition ToString.h:283
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
static void removeReservation(MSTransportable *person, const std::set< std::string > &lines, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group)
retract reservation
static bool isReservation(const std::set< std::string > &lines)
whether the given lines description is a taxi call
static void addReservation(MSTransportable *person, const std::set< std::string > &lines, SUMOTime reservationTime, SUMOTime pickupTime, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group)
add new reservation
bool compatibleLine(const Reservation *res)
whether the given reservation is compatible with the taxi line
static void addRideTransportData(const bool isPerson, const double distance, const SUMOTime duration, const SUMOVehicleClass vClass, const std::string &line, const SUMOTime waitingTime)
record tripinfo data for rides and transports
A road/street connecting two junctions.
Definition MSEdge.h:77
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const double position) const
Definition MSEdge.cpp:1355
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition MSEdge.h:622
double getLength() const
return the length of the edge
Definition MSEdge.h:658
virtual void addTransportable(MSTransportable *t) const
Definition MSEdge.cpp:1086
static double gStopTolerance
The tolerance to apply when matching waiting persons and vehicles.
Definition MSGlobals.h:163
static bool gLefthand
Whether lefthand-drive is being simulated.
Definition MSGlobals.h:169
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
Definition MSLane.h:84
MSEdge & getEdge() const
Returns the lane's edge.
Definition MSLane.h:745
The simulated network and simulation perfomer.
Definition MSNet.h:88
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:183
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition MSNet.cpp:1181
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:322
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:433
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:380
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1172
static const int FORWARD
Definition MSPModel.h:119
static const int UNDEFINED_DIRECTION
Definition MSPModel.h:121
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
MSStage * clone() const
MSStoppingPlace * myOriginStop
the stop at which this ride starts (or nullptr)
const MSEdge * getEdge() const
Returns the current edge.
void loadState(MSTransportable *transportable, std::istringstream &state)
Reconstructs the current state.
void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, MSStage *previous)
proceeds to this stage
std::string myVehicleID
cached vehicle data for output after the vehicle has been removed
virtual ~MSStageDriving()
destructor
Position myStopWaitPos
ConstMSEdgeVector getEdges() const
the edges of the current stage
std::string getWaitingDescription() const
Return where the person waits and for what.
const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
marks arrival time and records driven distance
std::string myIntendedVehicleID
double getEdgePos(SUMOTime now) const
double getAngle(SUMOTime now) const
returns the angle of the transportable
void registerWaiting(MSTransportable *transportable, SUMOTime now)
brief register waiting person (on proceed or loadState)
bool unspecifiedArrivalPos() const
double getSpeed() const
the speed of the transportable
bool canLeaveVehicle(const MSTransportable *t, const SUMOVehicle &veh, const MSStop &stop)
checks whether the person may exit at the current vehicle position
bool isWaitingFor(const SUMOVehicle *vehicle) const
Whether the person waits for the given vehicle.
Position getPosition(SUMOTime now) const
returns the position of the transportable
void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
const MSEdge * myOrigin
the origin edge
const MSLane * getLane() const
Returns the current lane (if applicable)
SUMOVehicleClass myVehicleVClass
std::string getStageDescription(const bool isPerson) const
return (brief) string representation of the current stage
void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const
Called on writing vehroute output.
const MSEdge * getFromEdge() const
SUMOTime myWaitingSince
The time since which this person is waiting for a ride.
std::string myVehicleLine
void saveState(std::ostringstream &out)
Saves the current state into the given stream.
const MSEdge * myWaitingEdge
SUMOTime myIntendedDepart
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
void setVehicle(SUMOVehicle *v)
std::string myVehicleType
double getDistance() const
get travel distance in this stage
const std::set< std::string > myLines
the lines to choose from
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
SUMOTime myTimeLoss
While driving, this is the timeLoss of the vehicle when the ride started, after arrival this is the t...
const std::set< std::string > & getLines() const
double getArrivalPos() const
return default value for undefined arrivalPos
SUMOVehicle * myVehicle
The taken vehicle.
void abort(MSTransportable *t)
abort this stage (TraCI)
int getDirection() const
Return the movement directon on the edge.
MSStageDriving(const MSEdge *origin, const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines, const std::string &group="", const std::string &intendedVeh="", SUMOTime intendedDepart=-1)
constructor
const MSEdge * getDestination() const
returns the destination edge
Definition MSStage.cpp:61
virtual double getEdgePos(SUMOTime now) const
Definition MSStage.cpp:79
virtual double getArrivalPos() const
Definition MSStage.h:89
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
Definition MSStage.h:238
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
Definition MSStage.h:85
const std::string myGroup
The id of the group of transportables traveling together.
Definition MSStage.h:253
virtual const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
Definition MSStage.cpp:127
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition MSStage.h:80
MSStageType getStageType() const
Definition MSStage.h:117
SUMOTime myArrived
the time at which this stage ended
Definition MSStage.h:247
double getEdgeAngle(const MSEdge *e, double at) const
get angle of the edge at a certain position
Definition MSStage.cpp:149
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition MSStage.cpp:67
static const double ROADSIDE_OFFSET
the offset for computing positions when standing at an edge
Definition MSStage.h:259
double myArrivalPos
the position at which we want to arrive
Definition MSStage.h:241
Position getEdgePosition(const MSEdge *e, double at, double offset) const
get position on edge e at length at with orthogonal offset
Definition MSStage.cpp:138
const MSEdge * myDestination
the next edge to reach by getting transported
Definition MSStage.h:235
SUMOTime myDeparted
the time at which this stage started
Definition MSStage.h:244
bool isInRange(const double pos, const double tolerance) const
whether the stop is in range of the given position
Definition MSStop.cpp:163
const MSEdge * getEdge() const
Definition MSStop.cpp:54
A lane area vehicles can halt at.
double getWaitingPositionOnLane(MSTransportable *t) const
Returns the lane position corresponding to getWaitPosition()
double getBeginLanePosition() const
Returns the begin position of this stop.
SumoXMLTag getElement() const
return the type of this stopping place
double getEndLanePosition() const
Returns the end position of this stop.
const std::vector< std::tuple< MSLane *, double, double > > & getAllAccessPos() const
lanes and positions connected to this stop
void removeTransportable(const MSTransportable *p)
Removes a transportable from this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
const std::string & getMyName() const
Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
bool addTransportable(const MSTransportable *p)
adds a transportable to this stop
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
void abortWaitingForVehicle(MSTransportable *t)
let the given transportable abort waiting for a vehicle (when removing stage via TraCI)
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge
const MSEdge * getDestination() const
Returns the current destination.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
bool isPerson() const
Whether it is a person.
int getNumStages() const
Return the total number stages in this persons plan.
MSStage * getNextStage(int next) const
Return the current stage.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void handleTriggeredDepart(SUMOVehicle *v, bool add)
register / unregister depart-triggered vehicles with edges
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
double getAngle() const
Returns the vehicle's direction in radians.
Definition MSVehicle.h:738
const std::string & getID() const
Returns the name of the vehicle type.
const std::string & getID() const
Returns the id.
Definition Named.h:74
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:300
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual double getSpeed() const =0
Returns the object's current speed.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.
Definition SUMOVehicle.h:62
virtual void removeTransportable(MSTransportable *t)=0
removes a person or container
virtual bool stopsAtEdge(const MSEdge *edge) const =0
Returns whether the vehicle stops at the given edge.
virtual SUMOTime getTimeLoss() const =0
virtual bool stopsAt(MSStoppingPlace *stop) const =0
Returns whether the vehicle stops at the given stopping place.
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
virtual double getOdometer() const =0
Returns the distance that was already driven by this vehicle.
virtual double getLength() const =0
Returns the vehicles's length.
virtual void addTransportable(MSTransportable *transportable)=0
Adds a person or container to this vehicle.
virtual double getArrivalPos() const =0
Returns this vehicle's desired arrivalPos for its current route (may change on reroute)
double arrivalPos
(optional) The position the vehicle shall arrive on
bool wasSet(int what) const
Returns whether the given parameter was set.
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id, bool silent=false)
Interprets negative edge positions and fits them onto a given edge.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
std::string line
The vehicle's line (mainly for public transport)
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
#define M_PI
Definition odrSpiral.cpp:45