SUMO - Simulation of Urban MObility
MSPerson.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // The class for modelling person-movements
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <vector>
37 #include <utils/common/ToString.h>
39 #include <utils/geom/GeomHelper.h>
40 #include <microsim/MSNet.h>
41 #include <microsim/MSEdge.h>
42 #include <microsim/MSLane.h>
43 #include "MSPerson.h"
46 #include <microsim/MSVehicle.h>
50 #include "MSPModel.h"
51 
52 // ===========================================================================
53 // method definitions
54 // ===========================================================================
55 /* -------------------------------------------------------------------------
56  * MSPerson::MSPersonStage_Walking - methods
57  * ----------------------------------------------------------------------- */
59  const ConstMSEdgeVector& route,
60  MSStoppingPlace* toStop,
61  SUMOTime walkingTime, double speed,
62  double departPos, double arrivalPos, double departPosLat) :
63  MSTransportable::Stage(*route.back(), toStop,
64  SUMOVehicleParameter::interpretEdgePos(arrivalPos, route.back()->getLength(), SUMO_ATTR_ARRIVALPOS,
65  "person '" + personID + "' walking to " + route.back()->getID()),
66  MOVING_WITHOUT_VEHICLE),
67  myWalkingTime(walkingTime),
68  myRoute(route),
69  myCurrentInternalEdge(0),
70  myDepartPos(departPos),
71  myDepartPosLat(departPosLat),
72  mySpeed(speed),
73  myPedestrianState(0) {
74  myDepartPos = SUMOVehicleParameter::interpretEdgePos(departPos, route.front()->getLength(), SUMO_ATTR_DEPARTPOS,
75  "person '" + personID + "' walking from " + route.front()->getID());
76  if (walkingTime > 0) {
78  }
79 }
80 
81 
83 }
84 
85 
86 const MSEdge*
88  if (myCurrentInternalEdge != 0) {
89  return myCurrentInternalEdge;
90  } else {
91  return *myRouteStep;
92  }
93 }
94 
95 
96 const MSEdge*
98  return myRoute.front();
99 }
100 
101 
102 double
104  return myPedestrianState == 0 ? -1 : myPedestrianState->getEdgePos(*this, now);
105 }
106 
107 
108 Position
110  return myPedestrianState->getPosition(*this, now);
111 }
112 
113 
114 double
116  return myPedestrianState->getAngle(*this, now);
117 }
118 
119 
120 SUMOTime
122  return myPedestrianState->getWaitingTime(*this, now);
123 }
124 
125 
126 double
128  return myPedestrianState->getSpeed(*this);
129 }
130 
131 
134  return myRoute;
135 }
136 
137 void
139  myDeparted = now;
140  myRouteStep = myRoute.begin();
141  if (myWalkingTime == 0) {
142  if (!person->proceed(net, now)) {
144  }
145  return;
146  }
147  if (previous->getEdgePos(now) >= 0 && previous->getEdge() == *myRouteStep) {
148  myDepartPos = previous->getEdgePos(now);
149  if (myWalkingTime > 0) {
151  }
152  }
153  myPedestrianState = MSPModel::getModel()->add(dynamic_cast<MSPerson*>(person), this, now);
154  if (myPedestrianState == 0) {
156  return;
157  }
158  (*myRouteStep)->addPerson(person);
159 }
160 
161 void
164  myPedestrianState = 0;
165 }
166 
167 void
169  mySpeed = speed;
170 }
171 
172 
173 double
175  return walkDistance() / STEPS2TIME(myWalkingTime + 1); // avoid systematic rounding errors
176 }
177 
178 
179 double
181  double length = 0;
182  for (const MSEdge* edge : myRoute) {
183  length += edge->getLength();
184  }
185  if (myRoute.size() > 1 && MSPModel::getModel()->usingInternalLanes()) {
186  // use lower bound for distance to pass the intersection
187  for (ConstMSEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end() - 1; ++i) {
188  const MSEdge* fromEdge = *i;
189  const MSEdge* toEdge = *(i + 1);
190  const MSLane* from = getSidewalk<MSEdge, MSLane>(fromEdge);
191  const MSLane* to = getSidewalk<MSEdge, MSLane>(toEdge);
192  Position fromPos;
193  Position toPos;
194  if (from != 0 && to != 0) {
195  if (fromEdge->getToJunction() == toEdge->getFromJunction()) {
196  fromPos = from->getShape().back();
197  toPos = to->getShape().front();
198  } else if (fromEdge->getToJunction() == toEdge->getToJunction()) {
199  fromPos = from->getShape().back();
200  toPos = to->getShape().back();
201  } else if (fromEdge->getFromJunction() == toEdge->getFromJunction()) {
202  fromPos = from->getShape().front();
203  toPos = to->getShape().front();
204  } else if (fromEdge->getFromJunction() == toEdge->getToJunction()) {
205  fromPos = from->getShape().front();
206  toPos = to->getShape().back();
207  }
208  length += fromPos.distanceTo2D(toPos);
209  }
210  }
211  }
212  // determine walking direction for depart and arrival
213  bool departFwd = true;
214  bool arriveFwd = true;
215  if (myRoute.front() == myRoute.back()) {
216  if (myDepartPos > myArrivalPos) {
217  departFwd = false;
218  arriveFwd = false;
219  }
220  } else {
221  // disconnected defaults to forward
222  if ((myRoute.front()->getFromJunction() == myRoute[1]->getToJunction())
223  || (myRoute.front()->getFromJunction() == myRoute[1]->getFromJunction())) {
224  departFwd = false;
225  }
226  if ((myRoute.back()->getToJunction() == myRoute[myRoute.size() - 2]->getFromJunction())
227  || (myRoute.back()->getToJunction() == myRoute[myRoute.size() - 2]->getToJunction())) {
228  arriveFwd = false;
229  }
230  }
231  length -= (departFwd ? myDepartPos : myRoute.front()->getLength() - myDepartPos);
232  length -= (arriveFwd ? myRoute.back()->getLength() - myArrivalPos : myArrivalPos);
233  return MAX2(POSITION_EPS, length);
234 }
235 
236 
237 void
239  const double distance = walkDistance();
240  const double maxSpeed = getMaxSpeed(dynamic_cast<MSPerson*>(person));
241  const SUMOTime duration = myArrived - myDeparted;
242  const SUMOTime timeLoss = duration - TIME2STEPS(distance / maxSpeed);
243  MSDevice_Tripinfo::addPedestrianData(distance, duration, timeLoss);
244  os.openTag("walk");
245  os.writeAttr("depart", time2string(myDeparted));
246  os.writeAttr("departPos", myDepartPos);
247  os.writeAttr("arrival", time2string(myArrived));
248  os.writeAttr("arrivalPos", myArrivalPos);
249  os.writeAttr("duration", time2string(duration));
250  os.writeAttr("routeLength", distance);
251  os.writeAttr("timeLoss", time2string(timeLoss));
252  os.writeAttr("maxSpeed", maxSpeed);
253  os.closeTag();
254 }
255 
256 
257 void
260  if (myDestinationStop != 0) {
262  }
263  if (myWalkingTime > 0) {
265  } else if (mySpeed > 0) {
267  }
268  os.closeTag();
269 }
270 
271 
272 void
274  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "departure")
275  .writeAttr("agent", p.getID()).writeAttr("link", myRoute.front()->getID()).closeTag();
276 }
277 
278 
279 void
281  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival")
282  .writeAttr("agent", p.getID()).writeAttr("link", myRoute.back()->getID()).closeTag();
283 }
284 
285 
286 bool
288  ((MSEdge*)getEdge())->removePerson(person);
289  //std::cout << SIMTIME << " moveToNextEdge person=" << person->getID() << "\n";
290  if (myRouteStep == myRoute.end() - 1) {
291  if (myDestinationStop != 0) {
293  }
294  if (!person->proceed(MSNet::getInstance(), currentTime)) {
296  }
297  //std::cout << " end walk. myRouteStep=" << (*myRouteStep)->getID() << "\n";
298  return true;
299  } else {
300  if (nextInternal == 0) {
301  ++myRouteStep;
303  } else {
304  myCurrentInternalEdge = nextInternal;
305  }
306  ((MSEdge*) getEdge())->addPerson(person);
307  return false;
308  }
309 }
310 
311 
312 double
314  return mySpeed > 0 ? mySpeed : person->getVehicleType().getMaxSpeed() * person->getSpeedFactor();
315 }
316 
317 
318 /* -------------------------------------------------------------------------
319  * MSPerson::MSPersonStage_Driving - methods
320  * ----------------------------------------------------------------------- */
322  MSStoppingPlace* toStop, const double arrivalPos, const std::vector<std::string>& lines) :
323  MSTransportable::Stage_Driving(destination, toStop,
324  SUMOVehicleParameter::interpretEdgePos(
325  arrivalPos, destination.getLength(), SUMO_ATTR_ARRIVALPOS, "person riding to " + destination.getID()),
326  lines) {
327 }
328 
329 
331 
332 
333 void
335  if (previous->getDestinationStop() != 0) {
336  // the arrival stop may have an access point
337  myWaitingEdge = &previous->getDestinationStop()->getLane().getEdge();
340  } else {
341  myWaitingEdge = previous->getEdge();
343  myWaitingPos = previous->getEdgePos(now);
344  }
345  myWaitingSince = now;
346  SUMOVehicle* availableVehicle = net->getVehicleControl().getWaitingVehicle(myWaitingEdge, myLines, myWaitingPos, person->getID());
347  if (availableVehicle != 0 && availableVehicle->getParameter().departProcedure == DEPART_TRIGGERED && !availableVehicle->hasDeparted()) {
348  setVehicle(availableVehicle);
349  myVehicle->addPerson(person);
353  } else {
354  net->getPersonControl().addWaiting(myWaitingEdge, person);
355  myWaitingEdge->addPerson(person);
356  }
357 }
358 
359 
360 std::string
362  return isWaiting4Vehicle() ? "waiting for " + joinToString(myLines, ",") : "driving";
363 }
364 
365 
366 void
368  const SUMOTime waitingTime = myDeparted - myWaitingSince;
369  const SUMOTime duration = myArrived - myDeparted;
371  os.openTag("ride");
372  os.writeAttr("waitingTime", time2string(waitingTime));
373  os.writeAttr("vehicle", myVehicleID);
374  os.writeAttr("depart", time2string(myDeparted));
375  os.writeAttr("arrival", time2string(myArrived));
376  os.writeAttr("arrivalPos", toString(myArrivalPos));
377  os.writeAttr("duration", time2string(duration));
378  os.writeAttr("routeLength", myVehicleDistance);
379  os.closeTag();
380 }
381 
382 
383 void
386  if (myDestinationStop != 0) {
388  }
390 }
391 
392 
393 
394 /* -------------------------------------------------------------------------
395  * MSPerson - methods
396  * ----------------------------------------------------------------------- */
397 MSPerson::MSPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor) :
398  MSTransportable(pars, vtype, plan),
399  myInfluencer(0), myChosenSpeedFactor(speedFactor) {
400 }
401 
402 
404 }
405 
406 
407 bool
409  MSTransportable::Stage* prior = *myStep;
410  prior->setArrived(time);
411  /*
412  if(myWriteEvents) {
413  (*myStep)->endEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
414  }
415  */
416  //if (getID() == "ego") {
417  // std::cout << time2string(time) << " person=" << getID() << " proceed priorStep=" << myStep - myPlan->begin() << " planSize=" << myPlan->size() << "\n";
418  //}
419  // must be done before increasing myStep to avoid invalid state for rendering
420  prior->getEdge()->removePerson(this);
421  myStep++;
422  if (myStep != myPlan->end()) {
423  (*myStep)->proceed(net, this, time, prior);
424  /*
425  if(myWriteEvents) {
426  (*myStep)->beginEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
427  }
428  */
429  return true;
430  } else {
431  return false;
432  }
433 }
434 
435 
436 const std::string&
438 // if (getCurrentStageType() == MOVING_WITHOUT_VEHICLE) {
439 // MSPersonStage_Walking* walkingStage = dynamic_cast<MSPersonStage_Walking*>(*myStep);
440 // assert(walkingStage != 0);
441 // const MSEdge* nextEdge = walkingStage->getPedestrianState()->getNextEdge(*walkingStage);
442 // if (nextEdge != 0) {
443 // return nextEdge->getID();
444 // }
445 // }
446 // return StringUtils::emptyString;
447  const MSEdge* nextEdge = getNextEdgePtr();
448  if (nextEdge != 0) {
449  return nextEdge->getID();
450  }
452 }
453 
454 
455 const MSEdge*
458  MSPersonStage_Walking* walkingStage = dynamic_cast<MSPersonStage_Walking*>(*myStep);
459  assert(walkingStage != 0);
460  return walkingStage->getPedestrianState()->getNextEdge(*walkingStage);
461 
462  }
463  return 0;
464 }
465 
466 
467 
468 void
470  os.openTag("personinfo").writeAttr("id", getID()).writeAttr("depart", time2string(getDesiredDepart()));
471  for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
472  (*i)->tripInfoOutput(os, transportable);
473  }
474  os.closeTag();
475 }
476 
477 
478 void
480  const std::string typeID = getVehicleType().getID() != DEFAULT_PEDTYPE_ID ? getVehicleType().getID() : "";
482  if (myStep == myPlan->end()) {
483  os.writeAttr("arrival", time2string(MSNet::getInstance()->getCurrentTimeStep()));
484  }
485  for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
486  (*i)->routeOutput(os);
487  }
488  os.closeTag();
489  os.lf();
490 }
491 
492 
493 void
495  double departPos = getEdgePos();
496  double arrivalPos = getArrivalPos();
497  double speed = getVehicleType().getMaxSpeed();
498  //std::cout << " from=" << from->getID() << " to=" << to->getID() << " newEdges=" << toString(newEdges) << "\n";
499  MSPerson::MSPersonStage_Walking* newStage = new MSPerson::MSPersonStage_Walking(getID(), newEdges, 0, -1, speed, departPos, arrivalPos, 0);
500  if (getNumRemainingStages() == 1) {
501  // Do not remove the last stage (a waiting stage would be added otherwise)
502  appendStage(newStage);
503  //std::cout << "case a: remaining=" << p->getNumRemainingStages() << "\n";
504  removeStage(0);
505  } else {
506  removeStage(0);
507  appendStage(newStage);
508  //std::cout << "case b: remaining=" << p->getNumRemainingStages() << "\n";
509  }
510 }
511 
514  if (myInfluencer == 0) {
515  myInfluencer = new Influencer();
516  }
517  return *myInfluencer;
518 }
519 
520 
523  return myInfluencer;
524 }
525 
526 
527 
528 /* -------------------------------------------------------------------------
529  * methods of MSPerson::Influencer
530  * ----------------------------------------------------------------------- */
531 #ifndef NO_TRACI
533 
534 
536 
537 
538 void
539 MSPerson::Influencer::setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t) {
540  myRemoteXYPos = xyPos;
541  myRemoteLane = l;
542  myRemotePos = pos;
543  myRemotePosLat = posLat;
544  myRemoteAngle = angle;
545  myRemoteEdgeOffset = edgeOffset;
546  myRemoteRoute = route;
547  myLastRemoteAccess = t;
548 }
549 
550 
551 bool
553  return myLastRemoteAccess == MSNet::getInstance()->getCurrentTimeStep();
554 }
555 
556 
557 bool
559  return myLastRemoteAccess >= t - TIME2STEPS(10);
560 }
561 
562 
563 void
565  switch (p->getStageType(0)) {
566  case MOVING_WITHOUT_VEHICLE: {
568  assert(s != 0);
569  s->getPedestrianState()->moveToXY(p, myRemoteXYPos, myRemoteLane, myRemotePos, myRemotePosLat, myRemoteAngle, myRemoteEdgeOffset, myRemoteRoute,
570  MSNet::getInstance()->getCurrentTimeStep());
571  }
572  break;
573  default:
574  break;
575  }
576 }
577 
578 
579 
580 
581 #endif
582 
583 /****************************************************************************/
584 
The departure is person triggered.
Position getWaitPosition() const
Returns the next free waiting place for pedestrians / containers.
virtual const MSEdge * getNextEdge(const MSPerson::MSPersonStage_Walking &stage) const =0
return the list of internal edges if the pedestrian is on an intersection
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge ...
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:260
virtual void setArrived(SUMOTime now)
logs end of the step
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:607
static void addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss)
record tripinfo data for pedestrians
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Definition: MSPerson.cpp:280
virtual ~MSPerson()
destructor
Definition: MSPerson.cpp:403
virtual double getAngle(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the direction in which the person faces in degrees
double getArrivalPos() const
returns the final arrival pos
double getWaitingPositionOnLane() const
Returns the lane position corresponding to getWaitPosition()
~Influencer()
Destructor.
Definition: MSPerson.cpp:535
A lane area vehicles can halt at.
virtual SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the time the person spent standing
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSPerson.cpp:334
virtual double getEdgePos() const
Return the position on the edge.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:249
MSEdge * myCurrentInternalEdge
The current internal edge this person is on or 0.
Definition: MSPerson.h:199
MSPersonStage_Driving(const MSEdge &destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines)
constructor
Definition: MSPerson.cpp:321
virtual const MSEdge * getEdge() const =0
Returns the current edge.
void postProcessRemoteControl(MSPerson *p)
Definition: MSPerson.cpp:564
double getMaxSpeed(const MSPerson *person) const
accessors to be used by MSPModel
Definition: MSPerson.cpp:313
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSPerson.cpp:87
static void addRideData(double rideLength, SUMOTime rideDuration, SUMOVehicleClass vClass, const std::string &line, SUMOTime waitingTime)
record tripinfo data for rides
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:59
Position getPosition(SUMOTime now) const
returns the position of the transportable
Definition: MSPerson.cpp:109
virtual void remove(PedestrianState *state)=0
remove the specified person from the pedestrian simulation
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition: MSPerson.cpp:539
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
T MAX2(T a, T b)
Definition: StdDefs.h:73
const std::string & getNextEdge() const
return the list of internal edges if this person is walking and the pedestrian model allows it ...
Definition: MSPerson.cpp:437
const PositionVector & getShape() const
Returns this lane&#39;s shape.
Definition: MSLane.h:439
const std::set< std::string > myLines
the lines to choose from
virtual bool usingInternalLanes()=0
whether movements on intersections are modelled
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
virtual bool proceed(MSNet *net, SUMOTime time)=0
const std::string & getID() const
Returns the id.
Definition: Named.h:74
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
MSTransportablePlan::iterator myStep
the iterator over the route
const MSJunction * getToJunction() const
Definition: MSEdge.h:352
const MSEdge * getFromEdge() const
bool isRemoteAffected(SUMOTime t) const
Definition: MSPerson.cpp:558
void reroute(ConstMSEdgeVector &newEdges)
set new walk
Definition: MSPerson.cpp:494
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
The simulated network and simulation perfomer.
Definition: MSNet.h:90
The car-following model and parameter.
Definition: MSVehicleType.h:72
virtual void erase(MSTransportable *transportable)
removes a single transportable
void addTransportable(MSTransportable *p)
adds a transportable to this stop
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
virtual Position getPosition(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the network coordinate of the person
PedestrianState * getPedestrianState() const
Definition: MSPerson.h:172
const SUMOVehicleParameter * myParameter
the plan of the transportable
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:367
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:479
virtual PedestrianState * add(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, SUMOTime now)=0
register the given person as a pedestrian
void removeStage(int next)
removes the nth next stage
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Definition: MSPerson.cpp:273
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:469
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
SUMOTime myWaitingSince
The time since which this person is waiting for a ride.
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSPerson.cpp:138
ConstMSEdgeVector myRoute
The route of the person.
Definition: MSPerson.h:193
A road/street connecting two junctions.
Definition: MSEdge.h:80
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
MSTransportable::Stage * getCurrentStage() const
Return the current stage.
void abort(MSTransportable *)
abort this stage (TraCI)
Definition: MSPerson.cpp:162
SUMOTime myArrived
the time at which this stage ended
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the person arrived
Definition: MSPerson.cpp:287
the edges of a route
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSPerson.cpp:513
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
SUMOTime myDeparted
the time at which this stage started
Representation of a vehicle.
Definition: SUMOVehicle.h:66
MSStoppingPlace *const myDestinationStop
the stop to reach by getting transported (if any)
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:258
virtual double getEdgePos(SUMOTime now) const =0
static MSPModel * getModel()
Definition: MSPModel.cpp:65
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:768
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
SUMOTime getDesiredDepart() const
Returns the desired departure time.
ConstMSEdgeVector getEdges() const
the edges of the current stage
Definition: MSPerson.cpp:133
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.h:595
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:306
virtual double getEdgePos(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const =0
return the offset from the start of the current edge measured in its natural direction ...
#define STEPS2TIME(x)
Definition: SUMOTime.h:64
double getAngle(SUMOTime now) const
returns the angle of the transportable
Definition: MSPerson.cpp:115
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:253
std::string getStageDescription() const
returns the stage description as a string
Definition: MSPerson.cpp:361
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
virtual double getSpeed(const MSPerson::MSPersonStage_Walking &stage) const =0
return the current speed of the person
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines, const double position, const std::string ridingID)
std::string myVehicleID
cached vehicle data for output after the vehicle has been removed
#define POSITION_EPS
Definition: config.h:175
const std::string & getID() const
returns the id of the transportable
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.h:599
ConstMSEdgeVector::iterator myRouteStep
Definition: MSPerson.h:196
SUMOVehicle * myVehicle
The taken vehicle.
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
Definition: MSPerson.cpp:168
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:384
MSPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
constructor
Definition: MSPerson.cpp:397
static std::string emptyString
An empty string.
Definition: StringUtils.h:84
void appendStage(Stage *stage, int next=-1)
Appends the given stage to the current plan.
Changes the wished person speed and position.
Definition: MSPerson.h:316
double computeAverageSpeed() const
Definition: MSPerson.cpp:174
double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition: MSPerson.h:302
Structure representing possible vehicle parameter.
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
Definition: MSPerson.cpp:121
const MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:359
const std::string DEFAULT_PEDTYPE_ID
const double myChosenSpeedFactor
Definition: MSPerson.h:372
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle&#39;s parameter (including departure definition)
const MSJunction * getFromJunction() const
Definition: MSEdge.h:348
SUMOTime myWalkingTime
the time the person is walking
Definition: MSPerson.h:190
double getSpeed() const
the speed of the transportable
Definition: MSPerson.cpp:127
~MSPersonStage_Walking()
destructor
Definition: MSPerson.cpp:82
const std::string & getID() const
Returns the name of the vehicle type.
MSPersonStage_Walking(const std::string &personID, const ConstMSEdgeVector &route, MSStoppingPlace *toStop, SUMOTime walkingTime, double speed, double departPos, double arrivalPos, double departPosLat)
constructor
Definition: MSPerson.cpp:58
StageType getStageType(int next) const
the stage type for the nth next stage
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:238
PedestrianState * myPedestrianState
state that is to be manipulated by MSPModel
Definition: MSPerson.h:206
bool proceed(MSNet *net, SUMOTime time)
Definition: MSPerson.cpp:408
virtual void addPerson(MSTransportable *person)=0
Adds a person to this vehicle.
const MSEdge & getDestination() const
returns the destination edge
const MSEdge * getNextEdgePtr() const
returns the next edge ptr if this person is walking and the pedestrian model allows it ...
Definition: MSPerson.cpp:456
const MSVehicleType & getVehicleType() const
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:70
bool closeTag()
Closes the most recently opened tag.
MSTransportablePlan * myPlan
the plan of the transportable
long long int SUMOTime
Definition: TraCIDefs.h:51
const MSLane & getLane() const
Returns the lane this stop is located at.
double walkDistance() const
compute total walking distance
Definition: MSPerson.cpp:180
Influencer * myInfluencer
An instance of a speed/position influencing instance; built in "getInfluencer".
Definition: MSPerson.h:368
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
bool isRemoteControlled() const
Definition: MSPerson.cpp:552
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
const MSEdge * getFromEdge() const
Definition: MSPerson.cpp:97
Influencer()
Constructor.
Definition: MSPerson.cpp:532
void unregisterOneWaiting(const bool isPerson)
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:236
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
double getEdgePos(SUMOTime now) const
Definition: MSPerson.cpp:103
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:238
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:277
double myArrivalPos
the position at which we want to arrive
StageType getCurrentStageType() const
the current stage type of the transportable
virtual void moveToXY(MSPerson *p, Position pos, MSLane *lane, double lanePos, double lanePosLat, double angle, int routeOffset, const ConstMSEdgeVector &edges, SUMOTime t)
try to move person to the given position
Definition: MSPModel.h:154