Eclipse SUMO - Simulation of Urban MObility
MSTransportable.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-2022 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>
42
44
45//#define DEBUG_PARKING
46
47// ===========================================================================
48// method definitions
49// ===========================================================================
51 SUMOTrafficObject(pars->id),
52 myParameter(pars), myVType(vtype), myPlan(plan),
53 myAmPerson(isPerson),
54 myNumericalID(myCurrentNumericalIndex++) {
55 myStep = myPlan->begin();
56 // init devices
58}
59
60
63 MSStageDriving* const stage = dynamic_cast<MSStageDriving*>(*myStep);
64 if (stage->getVehicle() != nullptr) {
65 stage->getVehicle()->removeTransportable(this);
66 } else if (stage->getOriginStop() != nullptr) {
67 stage->getOriginStop()->removeTransportable(this);
68 }
69 }
70 if (myPlan != nullptr) {
71 for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
72 delete *i;
73 }
74 delete myPlan;
75 myPlan = nullptr;
76 }
77 for (MSTransportableDevice* dev : myDevices) {
78 delete dev;
79 }
80 delete myParameter;
83 }
84}
85
88 return getEdge()->getLanes()[0]->getRNG();
89}
90
91bool
92MSTransportable::proceed(MSNet* net, SUMOTime time, const bool vehicleArrived) {
93 MSStage* prior = *myStep;
94 const std::string& error = prior->setArrived(net, this, time, vehicleArrived);
95 // must be done before increasing myStep to avoid invalid state for rendering
96 prior->getEdge()->removeTransportable(this);
97 myStep++;
98 if (error != "") {
99 throw ProcessError(error);
100 }
101 bool accessToStop = false;
103 accessToStop = checkAccess(prior);
104 } else if (prior->getStageType() == MSStageType::WAITING_FOR_DEPART) {
105 for (MSTransportableDevice* const dev : myDevices) {
106 dev->notifyEnter(*this, MSMoveReminder::NOTIFICATION_DEPARTED, nullptr);
107 }
108 }
109 if (!accessToStop && (myStep == myPlan->end()
110 || ((*myStep)->getStageType() != MSStageType::DRIVING
111 && (*myStep)->getStageType() != MSStageType::TRIP))) {
112 MSStoppingPlace* priorStop = prior->getStageType() == MSStageType::TRIP ? prior->getOriginStop() : prior->getDestinationStop();
113 // a trip might resolve to DRIVING so we would have to stay at the stop
114 // if a trip resolves to something else, this step will do stop removal
115 if (priorStop != nullptr) {
116 priorStop->removeTransportable(this);
117 }
118 }
119 if (myStep != myPlan->end()) {
120 if ((*myStep)->getStageType() == MSStageType::WALKING && (prior->getStageType() != MSStageType::ACCESS || prior->getDestination() != (*myStep)->getFromEdge())) {
121 checkAccess(prior, false);
122 }
123 (*myStep)->proceed(net, this, time, prior);
124 return true;
125 } else {
127 return false;
128 }
129}
130
131
132void
133MSTransportable::setID(const std::string& /*newID*/) {
134 throw ProcessError("Changing a transportable ID is not permitted");
135}
136
139 return myParameter->depart;
140}
141
142void
144 (*myStep)->setDeparted(now);
145}
146
149 for (const MSStage* const stage : *myPlan) {
150 if (stage->getDeparted() >= 0) {
151 return stage->getDeparted();
152 }
153 }
154 return -1;
155}
156
157
158double
160 return (*myStep)->getEdgePos(MSNet::getInstance()->getCurrentTimeStep());
161}
162
163double
165 return getEdgePos() - getVehicleType().getLength();
166}
167
168int
170 return (*myStep)->getDirection();
171}
172
175 return (*myStep)->getPosition(MSNet::getInstance()->getCurrentTimeStep());
176}
177
178double
180 return (*myStep)->getAngle(MSNet::getInstance()->getCurrentTimeStep());
181}
182
183double
185 return STEPS2TIME((*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep()));
186}
187
188double
190 return (*myStep)->getSpeed();
191}
192
193
194int
196 return (int)(myPlan->end() - myStep);
197}
198
199
200int
202 return (int)myPlan->size();
203}
204
205
206void
208 os.openTag(isPerson() ? "personinfo" : "containerinfo");
209 os.writeAttr("id", getID());
210 os.writeAttr("depart", time2string(getDesiredDepart()));
211 os.writeAttr("type", getVehicleType().getID());
212 if (isPerson()) {
213 os.writeAttr("speedFactor", getChosenSpeedFactor());
214 }
215 for (MSStage* const i : *myPlan) {
216 i->tripInfoOutput(os, this);
217 }
218 os.closeTag();
219}
220
221
222void
223MSTransportable::routeOutput(OutputDevice& os, const bool withRouteLength) const {
224 const std::string typeID = (
228 if (hasArrived()) {
229 os.writeAttr("arrival", time2string(MSNet::getInstance()->getCurrentTimeStep()));
230 }
231 const MSStage* previous = nullptr;
232 for (const MSStage* const stage : *myPlan) {
233 stage->routeOutput(myAmPerson, os, withRouteLength, previous);
234 previous = stage;
235 }
237 os.closeTag();
238 os.lf();
239}
240
241
242void
244 if (timeout < 0 && myAbortCommand != nullptr) {
246 myAbortCommand = nullptr;
247 return;
248 }
251}
252
253
256 WRITE_WARNINGF(TL("Teleporting % '%'; waited too long, from edge '%', time=%."),
257 isPerson() ? "person" : "container", getID(), (*myStep)->getEdge()->getID(), time2string(step));
258 (*myStep)->abort(this);
259 if (!proceed(MSNet::getInstance(), step)) {
261 }
262 return 0;
263}
264
265
266
267void
269 // myStep is invalidated upon modifying myPlan
270 const int stepIndex = (int)(myStep - myPlan->begin());
271 if (next < 0) {
272 myPlan->push_back(stage);
273 } else {
274 if (stepIndex + next > (int)myPlan->size()) {
275 throw ProcessError("invalid index '" + toString(next) + "' for inserting new stage into plan of '" + getID() + "'");
276 }
277 myPlan->insert(myPlan->begin() + stepIndex + next, stage);
278 }
279 myStep = myPlan->begin() + stepIndex;
280}
281
282
283void
284MSTransportable::removeStage(int next, bool stayInSim) {
285 assert(myStep + next < myPlan->end());
286 assert(next >= 0);
287 if (next > 0) {
288 // myStep is invalidated upon modifying myPlan
289 int stepIndex = (int)(myStep - myPlan->begin());
290 delete *(myStep + next);
291 myPlan->erase(myStep + next);
292 myStep = myPlan->begin() + stepIndex;
293 } else {
294 if (myStep + 1 == myPlan->end() && stayInSim) {
295 // stay in the simulation until the start of simStep to allow appending new stages (at the correct position)
296 appendStage(new MSStageWaiting(getEdge(), nullptr, 0, 0, getEdgePos(), "last stage removed", false));
297 }
298 (*myStep)->abort(this);
301 }
302 }
303}
304
305
306void
308 for (MSTransportablePlan::const_iterator i = myStep; i != myPlan->end(); ++i) {
309 (*i)->setSpeed(speed);
310 }
312}
313
314
315void
317 const SUMOVehicleClass oldVClass = myVType->getVehicleClass();
318 if (myVType->isVehicleSpecific()) {
320 }
321 if (isPerson()
322 && type->getVehicleClass() != oldVClass
323 && type->getVehicleClass() != SVC_PEDESTRIAN
325 WRITE_WARNINGF(TL("Person '%' receives type '%' which implicitly uses unsuitable vClass '%'."), getID(), type->getID(), toString(type->getVehicleClass()));
326 }
327 myVType = type;
328}
329
330
333 if (myVType->isVehicleSpecific()) {
334 return *myVType;
335 }
337 replaceVehicleType(type);
338 return *type;
339}
340
341
344 PositionVector centerLine;
345 const Position p = getPosition();
346 const double angle = getAngle();
347 const double length = getVehicleType().getLength();
348 const Position back = p + Position(-cos(angle) * length, -sin(angle) * length);
349 centerLine.push_back(p);
350 centerLine.push_back(back);
351 centerLine.move2side(0.5 * getVehicleType().getWidth());
352 PositionVector result = centerLine;
353 centerLine.move2side(-getVehicleType().getWidth());
354 result.append(centerLine.reverse(), POSITION_EPS);
355 //std::cout << " transp=" << getID() << " p=" << p << " angle=" << GeomHelper::naviDegree(angle) << " back=" << back << " result=" << result << "\n";
356 return result;
357}
358
359
360std::string
361MSTransportable::getStageSummary(int stageIndex) const {
362 assert(stageIndex < (int)myPlan->size());
363 assert(stageIndex >= 0);
364 return (*myPlan)[stageIndex]->getStageSummary(myAmPerson);
365}
366
367
368bool
370 return myStep == myPlan->end();
371}
372
373bool
375 return myPlan->size() > 0 && (myPlan->front()->getDeparted() >= 0 || myStep > myPlan->begin());
376}
377
378
379void
381 // check whether the transportable was riding to the orignal stop
382 // @note: parkingArea can currently not be set as myDestinationStop so we
383 // check for stops on the edge instead
384#ifdef DEBUG_PARKING
385 std::cout << SIMTIME << " person=" << getID() << " rerouteParkingArea orig=" << orig->getID() << " replacement=" << replacement->getID() << "\n";
386#endif
388 if (!myAmPerson) {
389 WRITE_WARNING(TL("parkingAreaReroute not support for containers"));
390 return;
391 }
392 if (getDestination() == &orig->getLane().getEdge()) {
393 MSStageDriving* const stage = dynamic_cast<MSStageDriving*>(*myStep);
394 assert(stage != 0);
395 assert(stage->getVehicle() != 0);
396 // adapt plan
397 stage->setDestination(&replacement->getLane().getEdge(), replacement);
398 stage->setArrivalPos((replacement->getBeginLanePosition() + replacement->getEndLanePosition()) / 2);
399#ifdef DEBUG_PARKING
400 std::cout << " set ride destination\n";
401#endif
402 if (myStep + 1 == myPlan->end()) {
403 return;
404 }
405 // if the next step is a walk, adapt the route
406 MSStage* nextStage = *(myStep + 1);
407 if (nextStage->getStageType() == MSStageType::TRIP) {
408 dynamic_cast<MSStageTrip*>(nextStage)->setOrigin(stage->getDestination());
409#ifdef DEBUG_PARKING
410 std::cout << " set subsequent trip origin\n";
411#endif
412 } else if (nextStage->getStageType() == MSStageType::WALKING) {
413#ifdef DEBUG_PARKING
414 std::cout << " replace subsequent walk with a trip\n";
415#endif
416 MSStageTrip* newStage = new MSStageTrip(stage->getDestination(), nullptr, nextStage->getDestination(),
417 nextStage->getDestinationStop(), -1, 0, "", -1, 1, getID(), 0, true, nextStage->getArrivalPos());
418 removeStage(1);
419 appendStage(newStage, 1);
420 } else if (nextStage->getStageType() == MSStageType::WAITING) {
421#ifdef DEBUG_PARKING
422 std::cout << " add subsequent walk to reach stop\n";
423 std::cout << " arrivalPos=" << nextStage->getArrivalPos() << "\n";
424#endif
425 MSStageTrip* newStage = new MSStageTrip(stage->getDestination(), nullptr, nextStage->getDestination(),
426 nextStage->getDestinationStop(), -1, 0, "", -1, 1, getID(), 0, true, nextStage->getArrivalPos());
427 appendStage(newStage, 1);
428 }
429 // if the plan contains another ride with the same vehicle from the same
430 // parking area, adapt the preceeding walk to end at the replacement
431 for (auto it = myStep + 2; it != myPlan->end(); it++) {
432 MSStage* const futureStage = *it;
433 MSStage* const prevStage = *(it - 1);
434 if (futureStage->getStageType() == MSStageType::DRIVING) {
435 MSStageDriving* const ds = static_cast<MSStageDriving*>(futureStage);
436 // ride origin is set implicitly from the walk destination
437 ds->setOrigin(nullptr);
438 if (ds->getLines() == stage->getLines()
439 && prevStage->getDestination() == &orig->getLane().getEdge()) {
440 if (prevStage->getStageType() == MSStageType::TRIP) {
441 dynamic_cast<MSStageTrip*>(prevStage)->setDestination(stage->getDestination(), replacement);
442#ifdef DEBUG_PARKING
443 std::cout << " replace later trip before ride (" << (it - myPlan->begin()) << ")\n";
444#endif
445 } else if (prevStage->getStageType() == MSStageType::WALKING) {
446#ifdef DEBUG_PARKING
447 std::cout << " replace later walk before ride (" << (it - myPlan->begin()) << ")\n";
448#endif
449 MSStageTrip* newStage = new MSStageTrip(prevStage->getFromEdge(), nullptr, stage->getDestination(),
450 replacement, -1, 0, "", -1, 1, getID(), 0, true, stage->getArrivalPos());
451 int prevStageRelIndex = (int)(it - 1 - myStep);
452 removeStage(prevStageRelIndex);
453 appendStage(newStage, prevStageRelIndex);
454 }
455 break;
456 }
457 }
458 }
459 }
460}
461
462
464MSTransportable::getDevice(const std::type_info& type) const {
465 for (MSTransportableDevice* const dev : myDevices) {
466 if (typeid(*dev) == type) {
467 return dev;
468 }
469 }
470 return nullptr;
471}
472
473
474void
475MSTransportable::setJunctionModelParameter(const std::string& key, const std::string& value) {
478 const_cast<SUMOVehicleParameter&>(getParameter()).setParameter(key, value);
479 // checked in MSLink::ignoreFoe
480 } else {
481 throw InvalidArgument(getObjectType() + " '" + getID() + "' does not support junctionModel parameter '" + key + "'");
482 }
483}
484
485
486double
488 const MSEdge* edge = getEdge();
489 const double ep = getEdgePos();
490 const double gp = edge->getLanes()[0]->interpolateLanePosToGeometryPos(ep);
491 return edge->getLanes()[0]->getShape().slopeDegreeAtOffset(gp);
492}
493
496 return (*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep());
497}
498
499double
501 return MIN2(getVehicleType().getMaxSpeed(), getVehicleType().getDesiredMaxSpeed() * getChosenSpeedFactor());
502}
503
507}
508
509
510void
512 // this saves lots of departParameters which are only needed for transportables that did not yet depart
513 // the parameters may hold the name of a vTypeDistribution but we are interested in the actual type
519 }
520 int stepIdx = (int)(myStep - myPlan->begin());
521 for (auto it = myPlan->begin(); it != myStep; ++it) {
522 const MSStageType st = (*it)->getStageType();
523 if (st == MSStageType::TRIP || st == MSStageType::ACCESS) {
524 stepIdx--;
525 }
526 }
527 std::ostringstream state;
528 state << myParameter->parametersSet << " " << stepIdx;
529 (*myStep)->saveState(state);
530 out.writeAttr(SUMO_ATTR_STATE, state.str());
531 const MSStage* previous = nullptr;
532 for (const MSStage* const stage : *myPlan) {
533 stage->routeOutput(myAmPerson, out, false, previous);
534 previous = stage;
535 }
536 out.closeTag();
537}
538
539
540void
541MSTransportable::loadState(const std::string& state) {
542 std::istringstream iss(state);
543 int step;
544 iss >> myParameter->parametersSet >> step;
545 myStep = myPlan->begin() + step;
546 (*myStep)->loadState(this, iss);
547}
548
549
550/****************************************************************************/
long long int SUMOTime
Definition: GUI.h:36
MSStageType
Definition: MSStage.h:54
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:266
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
#define TL(string)
Definition: MsgHandler.h:282
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
#define STEPS2TIME(x)
Definition: SUMOTime.h:54
#define SIMSTEP
Definition: SUMOTime.h:60
#define SIMTIME
Definition: SUMOTime.h:61
const long long int VTYPEPARS_VEHICLECLASS_SET
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_PEDTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
const int VEHPARS_JUNCTIONMODEL_PARAMS_SET
const int VEHPARS_SPEEDFACTOR_SET
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_PERSON
@ SUMO_ATTR_JM_IGNORE_IDS
@ SUMO_ATTR_JM_IGNORE_TYPES
@ SUMO_ATTR_SPEEDFACTOR
@ SUMO_ATTR_STATE
The state of a link.
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:25
int gPrecisionRandom
Definition: StdDefs.cpp:27
T MIN2(T a, T b)
Definition: StdDefs.h:71
T MAX2(T a, T b)
Definition: StdDefs.h:77
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static void buildTransportableDevices(MSTransportable &p, std::vector< MSTransportableDevice * > &into)
Build devices for the given person, if needed.
Definition: MSDevice.cpp:127
A road/street connecting two junctions.
Definition: MSEdge.h:77
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
virtual void removeTransportable(MSTransportable *t) const
Definition: MSEdge.cpp:1094
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:713
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
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
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition: MSNet.h:472
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:321
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:379
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:1096
SUMOVehicle * getVehicle() const
Current vehicle in which the transportable is driving (or nullptr)
const std::set< std::string > & getLines() const
MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
double getArrivalPos() const
return default value for undefined arrivalPos
void setOrigin(const MSEdge *origin)
change origin for parking area rerouting
const MSEdge * getDestination() const
returns the destination edge
Definition: MSStage.cpp:61
virtual const MSEdge * getFromEdge() const
Definition: MSStage.cpp:73
virtual double getArrivalPos() const
Definition: MSStage.h:89
virtual MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for MSStageTrip
Definition: MSStage.h:85
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
void setArrivalPos(double arrivalPos)
Definition: MSStage.h:93
void setDestination(const MSEdge *newDestination, MSStoppingPlace *newDestStop)
Definition: MSStage.cpp:155
virtual void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const =0
Called on writing vehroute output.
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition: MSStage.cpp:67
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getEndLanePosition() const
Returns the end position of 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.
virtual void erase(MSTransportable *transportable)
removes a single transportable
Abstract in-person device.
virtual double getChosenSpeedFactor() const
the current speed factor of the transportable (where applicable)
virtual double getEdgePos() const
Return the position on the edge.
bool hasDeparted() const
return whether the transportable has started it's plan
SUMOVehicleClass getVClass() const
Returns the object's access class.
static NumericalID myCurrentNumericalIndex
SUMOTime getWaitingTime() const
SUMOTime getDeparture() const
logs depart time of the current stage
double getBackPositionOnLane(const MSLane *lane) const
Get the object's back position along the given lane.
const MSEdge * getDestination() const
Returns the current destination.
virtual double getAngle() const
return the current angle of the transportable
void setAbortWaiting(const SUMOTime timeout)
void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
void setJunctionModelParameter(const std::string &key, const std::string &value)
set individual junction model paramete (not type related)
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
virtual double getSpeed() const
the current speed of the transportable
PositionVector getBoundingBox() const
return the bounding box of the person
const bool myAmPerson
virtual bool checkAccess(const MSStage *const prior, const bool waitAtStop=true)
SUMOTime abortStage(SUMOTime step)
Abort current stage (used for aborting waiting for a vehicle)
std::string getStageSummary(int stageIndex) const
return textual summary for the given stage
MSTransportableDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
void setDeparted(SUMOTime now)
logs depart time of the current stage
void setSpeed(double speed)
set the speed for all present and future (walking) stages and modify the vType so that stages added l...
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
MSTransportablePlan::iterator myStep
the iterator over the route
MSTransportablePlan * myPlan
the plan of the transportable
void removeStage(int next, bool stayInSim=true)
removes the nth next stage
MSVehicleType * myVType
This transportable's type. (mainly used for drawing related information Note sure if it is really nec...
bool isPerson() const
Whether it is a person.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
const SUMOVehicleParameter * myParameter
the plan of the transportable
void saveState(OutputDevice &out)
Saves the current state into the given stream.
bool isContainer() const
Whether it is a container.
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
virtual ~MSTransportable()
destructor
int getNumStages() const
Return the total number stages in this persons plan.
MSStageType getCurrentStageType() const
the current stage type of the transportable
void rerouteParkingArea(MSStoppingPlace *orig, MSStoppingPlace *replacement)
adapt plan when the vehicle reroutes and now stops at replacement instead of orig
std::string getObjectType()
void loadState(const std::string &state)
Reconstructs the current state.
std::vector< MSTransportableDevice * > myDevices
The devices this transportable has.
virtual double getWaitingSeconds() const
the time this transportable spent waiting in seconds
MSTransportable(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportablePlan *plan, const bool isPerson)
constructor
bool hasArrived() const
return whether the person has reached the end of its plan
double getSlope() const
Returns the slope of the road at object's position in degrees.
void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
SumoRNG * getRNG() const
returns the associated RNG
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
const MSEdge * getEdge() const
Returns the current edge.
virtual int getDirection() const
Return the movement directon on the edge.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
void setID(const std::string &newID)
set the id (inherited from Named but forbidden for transportables)
WrappingCommand< MSTransportable > * myAbortCommand
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
SUMOTime getDesiredDepart() const
Returns the desired departure time.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and physical maximum speed)
void removeVType(const MSVehicleType *vehType)
The car-following model and parameter.
Definition: MSVehicleType.h:63
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:91
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type's maximum speed.
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
double getLength() const
Get vehicle's length [m].
const SUMOVTypeParameter & getParameter() const
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
const std::string & getID() const
Returns the id.
Definition: Named.h:74
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:59
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:239
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
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.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
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:37
A list of positions.
void append(const PositionVector &v, double sameThreshold=2.0)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
PositionVector reverse() const
reverse position vector
Representation of a vehicle, person, or container.
long long int NumericalID
bool wasSet(long long int what) const
Returns whether the given parameter was set.
virtual void removeTransportable(MSTransportable *t)=0
removes a person or container
Structure representing possible vehicle parameter.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
bool wasSet(int what) const
Returns whether the given parameter was set.
void deschedule()
Marks this Command as being descheduled.