Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSTransportable.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>
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(TL("Changing a transportable ID is not permitted"));
135}
136
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
252
253
256 WRITE_WARNINGF(TL("Teleporting % '%'; waited too long, from edge '%', time=%."),
257 isPerson() ? "person" : "container", getID(), (*myStep)->getEdge()->getID(), time2string(step));
260 (*myStep)->abort(this);
261 if (!proceed(MSNet::getInstance(), step)) {
262 tc.erase(this);
263 }
264 return 0;
265}
266
267
268
269void
271 // myStep is invalidated upon modifying myPlan
272 const int stepIndex = (int)(myStep - myPlan->begin());
273 if (next < 0) {
274 myPlan->push_back(stage);
275 } else {
276 if (stepIndex + next > (int)myPlan->size()) {
277 throw ProcessError("invalid index '" + toString(next) + "' for inserting new stage into plan of '" + getID() + "'");
278 }
279 myPlan->insert(myPlan->begin() + stepIndex + next, stage);
280 }
281 myStep = myPlan->begin() + stepIndex;
282}
283
284
285void
286MSTransportable::removeStage(int next, bool stayInSim) {
287 assert(myStep + next < myPlan->end());
288 assert(next >= 0);
289 if (next > 0) {
290 // myStep is invalidated upon modifying myPlan
291 int stepIndex = (int)(myStep - myPlan->begin());
292 delete *(myStep + next);
293 myPlan->erase(myStep + next);
294 myStep = myPlan->begin() + stepIndex;
295 } else {
296 if (myStep + 1 == myPlan->end() && stayInSim) {
297 // stay in the simulation until the start of simStep to allow appending new stages (at the correct position)
298 appendStage(new MSStageWaiting(getEdge(), nullptr, 0, 0, getEdgePos(), "last stage removed", false));
299 }
300 (*myStep)->abort(this);
303 }
304 }
305}
306
307
308void
310 for (MSTransportablePlan::const_iterator i = myStep; i != myPlan->end(); ++i) {
311 (*i)->setSpeed(speed);
312 }
314}
315
316
317void
319 const SUMOVehicleClass oldVClass = myVType->getVehicleClass();
320 if (myVType->isVehicleSpecific()) {
322 }
323 if (isPerson()
324 && type->getVehicleClass() != oldVClass
325 && type->getVehicleClass() != SVC_PEDESTRIAN
327 WRITE_WARNINGF(TL("Person '%' receives type '%' which implicitly uses unsuitable vClass '%'."), getID(), type->getID(), toString(type->getVehicleClass()));
328 }
329 myVType = type;
330}
331
332
335 if (myVType->isVehicleSpecific()) {
336 return *myVType;
337 }
339 replaceVehicleType(type);
340 return *type;
341}
342
343
346 PositionVector centerLine;
347 const Position p = getPosition();
348 const double angle = getAngle();
349 const double length = getVehicleType().getLength();
350 const Position back = p + Position(-cos(angle) * length, -sin(angle) * length);
351 centerLine.push_back(p);
352 centerLine.push_back(back);
353 centerLine.move2side(0.5 * getVehicleType().getWidth());
354 PositionVector result = centerLine;
355 centerLine.move2side(-getVehicleType().getWidth());
356 result.append(centerLine.reverse(), POSITION_EPS);
357 //std::cout << " transp=" << getID() << " p=" << p << " angle=" << GeomHelper::naviDegree(angle) << " back=" << back << " result=" << result << "\n";
358 return result;
359}
360
361
362std::string
363MSTransportable::getStageSummary(int stageIndex) const {
364 assert(stageIndex < (int)myPlan->size());
365 assert(stageIndex >= 0);
366 return (*myPlan)[stageIndex]->getStageSummary(myAmPerson);
367}
368
369
370bool
372 return myStep == myPlan->end();
373}
374
375bool
377 return myPlan->size() > 0 && (myPlan->front()->getDeparted() >= 0 || myStep > myPlan->begin());
378}
379
380
381void
383 // check whether the transportable was riding to the orignal stop
384 // @note: parkingArea can currently not be set as myDestinationStop so we
385 // check for stops on the edge instead
386#ifdef DEBUG_PARKING
387 std::cout << SIMTIME << " person=" << getID() << " rerouteParkingArea orig=" << orig->getID() << " replacement=" << replacement->getID() << "\n";
388#endif
390 if (!myAmPerson) {
391 WRITE_WARNING(TL("parkingAreaReroute not support for containers"));
392 return;
393 }
394 if (getDestination() == &orig->getLane().getEdge()) {
395 MSStageDriving* const stage = dynamic_cast<MSStageDriving*>(*myStep);
396 assert(stage != 0);
397 assert(stage->getVehicle() != 0);
398 // adapt plan
399 stage->setDestination(&replacement->getLane().getEdge(), replacement);
400 stage->setArrivalPos((replacement->getBeginLanePosition() + replacement->getEndLanePosition()) / 2);
401#ifdef DEBUG_PARKING
402 std::cout << " set ride destination\n";
403#endif
404 if (myStep + 1 == myPlan->end()) {
405 return;
406 }
407 // if the next step is a walk, adapt the route
408 MSStage* nextStage = *(myStep + 1);
409 if (nextStage->getStageType() == MSStageType::TRIP) {
410 dynamic_cast<MSStageTrip*>(nextStage)->setOrigin(stage->getDestination());
411#ifdef DEBUG_PARKING
412 std::cout << " set subsequent trip origin\n";
413#endif
414 } else if (nextStage->getStageType() == MSStageType::WALKING) {
415#ifdef DEBUG_PARKING
416 std::cout << " replace subsequent walk with a trip\n";
417#endif
418 MSStageTrip* newStage = new MSStageTrip(stage->getDestination(), nullptr, nextStage->getDestination(),
419 nextStage->getDestinationStop(), -1, 0, "", -1, 1, getID(), 0, true, nextStage->getArrivalPos());
420 removeStage(1);
421 appendStage(newStage, 1);
422 } else if (nextStage->getStageType() == MSStageType::WAITING) {
423#ifdef DEBUG_PARKING
424 std::cout << " add subsequent walk to reach stop\n";
425 std::cout << " arrivalPos=" << nextStage->getArrivalPos() << "\n";
426#endif
427 MSStageTrip* newStage = new MSStageTrip(stage->getDestination(), nullptr, nextStage->getDestination(),
428 nextStage->getDestinationStop(), -1, 0, "", -1, 1, getID(), 0, true, nextStage->getArrivalPos());
429 appendStage(newStage, 1);
430 }
431 // if the plan contains another ride with the same vehicle from the same
432 // parking area, adapt the preceeding walk to end at the replacement
433 for (auto it = myStep + 2; it != myPlan->end(); it++) {
434 MSStage* const futureStage = *it;
435 MSStage* const prevStage = *(it - 1);
436 if (futureStage->getStageType() == MSStageType::DRIVING) {
437 MSStageDriving* const ds = static_cast<MSStageDriving*>(futureStage);
438 // ride origin is set implicitly from the walk destination
439 ds->setOrigin(nullptr);
440 if (ds->getLines() == stage->getLines()
441 && prevStage->getDestination() == &orig->getLane().getEdge()) {
442 if (prevStage->getStageType() == MSStageType::TRIP) {
443 dynamic_cast<MSStageTrip*>(prevStage)->setDestination(stage->getDestination(), replacement);
444#ifdef DEBUG_PARKING
445 std::cout << " replace later trip before ride (" << (it - myPlan->begin()) << ")\n";
446#endif
447 } else if (prevStage->getStageType() == MSStageType::WALKING) {
448#ifdef DEBUG_PARKING
449 std::cout << " replace later walk before ride (" << (it - myPlan->begin()) << ")\n";
450#endif
451 MSStageTrip* newStage = new MSStageTrip(prevStage->getFromEdge(), nullptr, stage->getDestination(),
452 replacement, -1, 0, "", -1, 1, getID(), 0, true, stage->getArrivalPos());
453 int prevStageRelIndex = (int)(it - 1 - myStep);
454 removeStage(prevStageRelIndex);
455 appendStage(newStage, prevStageRelIndex);
456 }
457 break;
458 }
459 }
460 }
461 }
462}
463
464
466MSTransportable::getDevice(const std::type_info& type) const {
467 for (MSTransportableDevice* const dev : myDevices) {
468 if (typeid(*dev) == type) {
469 return dev;
470 }
471 }
472 return nullptr;
473}
474
475
476void
477MSTransportable::setJunctionModelParameter(const std::string& key, const std::string& value) {
480 const_cast<SUMOVehicleParameter&>(getParameter()).setParameter(key, value);
481 // checked in MSLink::ignoreFoe
482 } else {
483 throw InvalidArgument(getObjectType() + " '" + getID() + "' does not support junctionModel parameter '" + key + "'");
484 }
485}
486
487
488double
490 const MSEdge* edge = getEdge();
491 const double ep = getEdgePos();
492 const double gp = edge->getLanes()[0]->interpolateLanePosToGeometryPos(ep);
493 return edge->getLanes()[0]->getShape().slopeDegreeAtOffset(gp);
494}
495
498 return (*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep());
499}
500
501double
503 return MIN2(getVehicleType().getMaxSpeed(), getVehicleType().getDesiredMaxSpeed() * getChosenSpeedFactor());
504}
505
510
511
512void
514 // this saves lots of departParameters which are only needed for transportables that did not yet depart
515 // the parameters may hold the name of a vTypeDistribution but we are interested in the actual type
521 }
522 int stepIdx = (int)(myStep - myPlan->begin());
523 for (auto it = myPlan->begin(); it != myStep; ++it) {
524 const MSStageType st = (*it)->getStageType();
525 if (st == MSStageType::TRIP || st == MSStageType::ACCESS) {
526 stepIdx--;
527 }
528 }
529 std::ostringstream state;
530 state << myParameter->parametersSet << " " << stepIdx;
531 (*myStep)->saveState(state);
532 out.writeAttr(SUMO_ATTR_STATE, state.str());
533 const MSStage* previous = nullptr;
534 for (const MSStage* const stage : *myPlan) {
535 stage->routeOutput(myAmPerson, out, false, previous);
536 previous = stage;
537 }
538 out.closeTag();
539}
540
541
542void
543MSTransportable::loadState(const std::string& state) {
544 std::istringstream iss(state);
545 int step;
546 iss >> myParameter->parametersSet >> step;
547 myStep = myPlan->begin() + step;
548 (*myStep)->loadState(this, iss);
549}
550
551
552/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
MSStageType
Definition MSStage.h:54
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:271
#define WRITE_WARNING(msg)
Definition MsgHandler.h:270
#define TL(string)
Definition MsgHandler.h:287
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define STEPS2TIME(x)
Definition SUMOTime.h:55
#define SIMSTEP
Definition SUMOTime.h:61
#define SIMTIME
Definition SUMOTime.h:62
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:26
int gPrecisionRandom
Definition StdDefs.cpp:28
T MIN2(T a, T b)
Definition StdDefs.h:76
T MAX2(T a, T b)
Definition StdDefs.h:82
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:131
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:1095
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:745
@ 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:473
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition MSNet.cpp:1181
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:322
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:380
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition MSNet.cpp:1172
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.
void registerTeleportAbortWait()
register a teleport after aborting a long wait
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.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
const std::string & getID() const
Returns the name of the vehicle type.
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.
Static storage of an output device and its base (abstract) implementation.
void lf()
writes a line feed if applicable
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.
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.
A wrapper for a Command function.
void deschedule()
Marks this Command as being descheduled.