Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // The class for modelling person-movements
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <vector>
31 #include <utils/common/ToString.h>
33 #include <utils/geom/GeomHelper.h>
35 #include <microsim/MSNet.h>
36 #include <microsim/MSEdge.h>
37 #include <microsim/MSLane.h>
38 #include "MSPerson.h"
42 #include <microsim/MSVehicle.h>
46 #include "MSPModel.h"
47 
48 // ===========================================================================
49 // static value definitions
50 // ===========================================================================
52 
53 /* -------------------------------------------------------------------------
54  * MSPerson::MSPersonStage_Walking - methods
55  * ----------------------------------------------------------------------- */
57  const ConstMSEdgeVector& route,
58  MSStoppingPlace* toStop,
59  SUMOTime walkingTime, double speed,
60  double departPos, double arrivalPos, double departPosLat) :
61  MSTransportable::Stage(route.back(), toStop,
62  SUMOVehicleParameter::interpretEdgePos(arrivalPos, route.back()->getLength(), SUMO_ATTR_ARRIVALPOS,
63  "person '" + personID + "' walking to " + route.back()->getID()),
64  MOVING_WITHOUT_VEHICLE),
65  myWalkingTime(walkingTime),
66  myRoute(route),
67  myCurrentInternalEdge(nullptr),
68  myDepartPos(departPos),
69  myDepartPosLat(departPosLat),
70  mySpeed(speed),
71  myPedestrianState(&myDummyState) {
72  myDepartPos = SUMOVehicleParameter::interpretEdgePos(departPos, route.front()->getLength(), SUMO_ATTR_DEPARTPOS,
73  "person '" + personID + "' walking from " + route.front()->getID());
74  if (walkingTime > 0) {
76  }
77 }
78 
79 
81  if (myPedestrianState != &myDummyState) {
82  delete myPedestrianState;
83  }
84 }
85 
88  return new MSPersonStage_Walking("dummyID", myRoute, myDestinationStop, myWalkingTime, mySpeed, myDepartPos, myArrivalPos, myDepartPosLat);
89 }
90 
91 const MSEdge*
93  if (myCurrentInternalEdge != nullptr) {
94  return myCurrentInternalEdge;
95  } else {
96  return *myRouteStep;
97  }
98 }
99 
100 
101 const MSEdge*
103  return myRoute.front();
104 }
105 
106 
107 double
109  return myPedestrianState == nullptr ? -1 : myPedestrianState->getEdgePos(*this, now);
110 }
111 
112 
113 Position
115  return myPedestrianState->getPosition(*this, now);
116 }
117 
118 
119 double
121  return myPedestrianState->getAngle(*this, now);
122 }
123 
124 
125 SUMOTime
127  return myPedestrianState->getWaitingTime(*this, now);
128 }
129 
130 
131 double
133  return myPedestrianState->getSpeed(*this);
134 }
135 
136 
139  return myRoute;
140 }
141 
142 
143 void
145  myDeparted = now;
146  myRouteStep = myRoute.begin();
147  myLastEdgeEntryTime = now;
148  if (myWalkingTime == 0) {
149  if (!person->proceed(net, now)) {
151  }
152  return;
153  }
154  if (previous->getEdgePos(now) >= 0 && previous->getEdge() == *myRouteStep) {
155  myDepartPos = previous->getEdgePos(now);
156  if (myWalkingTime > 0) {
157  mySpeed = computeAverageSpeed();
158  }
159  }
160  myPedestrianState = MSPModel::getModel()->add(dynamic_cast<MSPerson*>(person), this, now);
161  if (myPedestrianState == nullptr) {
163  return;
164  }
165  const MSEdge* edge = *myRouteStep;
166  const MSLane* lane = getSidewalk<MSEdge, MSLane>(getEdge());
167  if (lane != nullptr) {
168  for (MSMoveReminder* rem : lane->getMoveReminders()) {
169  rem->notifyEnter(*person, MSMoveReminder::NOTIFICATION_DEPARTED, lane);
170  }
171  }
172  edge->addPerson(person);
173 }
174 
175 
176 void
178  MSPModel::getModel()->remove(myPedestrianState);
179 }
180 
181 
182 void
184  mySpeed = speed;
185 }
186 
187 
188 double
190  return walkDistance() / STEPS2TIME(myWalkingTime + 1); // avoid systematic rounding errors
191 }
192 
193 
194 double
196  double length = 0;
197  for (const MSEdge* edge : myRoute) {
198  length += edge->getLength();
199  }
200  if (myRoute.size() > 1 && MSPModel::getModel()->usingInternalLanes()) {
201  // use lower bound for distance to pass the intersection
202  for (ConstMSEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end() - 1; ++i) {
203  const MSEdge* fromEdge = *i;
204  const MSEdge* toEdge = *(i + 1);
205  const MSLane* from = getSidewalk<MSEdge, MSLane>(fromEdge);
206  const MSLane* to = getSidewalk<MSEdge, MSLane>(toEdge);
207  Position fromPos;
208  Position toPos;
209  if (from != nullptr && to != nullptr) {
210  if (fromEdge->getToJunction() == toEdge->getFromJunction()) {
211  fromPos = from->getShape().back();
212  toPos = to->getShape().front();
213  } else if (fromEdge->getToJunction() == toEdge->getToJunction()) {
214  fromPos = from->getShape().back();
215  toPos = to->getShape().back();
216  } else if (fromEdge->getFromJunction() == toEdge->getFromJunction()) {
217  fromPos = from->getShape().front();
218  toPos = to->getShape().front();
219  } else if (fromEdge->getFromJunction() == toEdge->getToJunction()) {
220  fromPos = from->getShape().front();
221  toPos = to->getShape().back();
222  }
223  length += fromPos.distanceTo2D(toPos);
224  }
225  }
226  }
227  // determine walking direction for depart and arrival
228  const int departFwdArrivalDir = MSPModel::canTraverse(MSPModel::FORWARD, myRoute);
229  const int departBwdArrivalDir = MSPModel::canTraverse(MSPModel::BACKWARD, myRoute);
230  const bool mayStartForward = departFwdArrivalDir != MSPModel::UNDEFINED_DIRECTION;
231  const bool mayStartBackward = departBwdArrivalDir != MSPModel::UNDEFINED_DIRECTION;
232  const double lengthFwd = (length - myDepartPos - (
233  departFwdArrivalDir == MSPModel::BACKWARD
234  ? myArrivalPos
235  : myRoute.back()->getLength() - myArrivalPos));
236  const double lengthBwd = (length - (myRoute.front()->getLength() - myDepartPos) - (
237  departBwdArrivalDir == MSPModel::BACKWARD
238  ? myArrivalPos
239  : myRoute.back()->getLength() - myArrivalPos));
240 
241  if (myRoute.size() == 1) {
242  if (myDepartPos > myArrivalPos) {
243  length = lengthBwd;
244  } else {
245  length = lengthFwd;
246  }
247  } else {
248  if (mayStartForward && mayStartBackward) {
249  length = lengthFwd < lengthBwd ? lengthFwd : lengthBwd;
250  } else if (mayStartForward) {
251  length = lengthFwd;
252  } else if (mayStartBackward) {
253  length = lengthBwd;
254  } else {
255  length = lengthFwd;
256  }
257  }
258  //std::cout << SIMTIME << " route=" << toString(myRoute)
259  // << " depPos=" << myDepartPos << " arPos=" << myArrivalPos
260  // << " dFwdADir=" << departFwdArrivalDir
261  // << " dBwdADir=" << departBwdArrivalDir
262  // << " lengthFwd=" << lengthFwd
263  // << " lengthBwd=" << lengthBwd
264  // << "\n";
265 
266  return MAX2(POSITION_EPS, length);
267 }
268 
269 
270 void
272  const double distance = walkDistance();
273  const double maxSpeed = getMaxSpeed(person);
274  const SUMOTime duration = myArrived - myDeparted;
275  const SUMOTime timeLoss = myArrived == -1 ? 0 : duration - TIME2STEPS(distance / maxSpeed);
276  MSDevice_Tripinfo::addPedestrianData(distance, duration, timeLoss);
277  os.openTag("walk");
278  os.writeAttr("depart", time2string(myDeparted));
279  os.writeAttr("departPos", myDepartPos);
280  os.writeAttr("arrival", myArrived >= 0 ? time2string(myArrived) : "-1");
281  os.writeAttr("arrivalPos", myArrivalPos);
282  os.writeAttr("duration", myDeparted < 0 ? "-1" :
283  time2string(myArrived >= 0 ? duration : MSNet::getInstance()->getCurrentTimeStep() - myDeparted));
284  os.writeAttr("routeLength", distance);
285  os.writeAttr("timeLoss", time2string(timeLoss));
286  os.writeAttr("maxSpeed", maxSpeed);
287  os.closeTag();
288 }
289 
290 
291 void
292 MSPerson::MSPersonStage_Walking::routeOutput(OutputDevice& os, const bool withRouteLength) const {
293  os.openTag("walk").writeAttr(SUMO_ATTR_EDGES, myRoute);
294  std::string comment = "";
295  if (myDestinationStop != nullptr) {
296  os.writeAttr(SUMO_ATTR_BUS_STOP, myDestinationStop->getID());
297  if (myDestinationStop->getMyName() != "") {
298  comment = " <!-- " + StringUtils::escapeXML(myDestinationStop->getMyName(), true) + " -->";
299  }
300  }
301  if (myWalkingTime > 0) {
302  os.writeAttr(SUMO_ATTR_DURATION, time2string(myWalkingTime));
303  } else if (mySpeed > 0) {
304  os.writeAttr(SUMO_ATTR_SPEED, mySpeed);
305  }
306  if (withRouteLength) {
307  os.writeAttr("routeLength", walkDistance());
308  }
309  os.closeTag(comment);
310 }
311 
312 
313 void
315  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "departure")
316  .writeAttr("agent", p.getID()).writeAttr("link", myRoute.front()->getID()).closeTag();
317 }
318 
319 
320 void
322  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival")
323  .writeAttr("agent", p.getID()).writeAttr("link", myRoute.back()->getID()).closeTag();
324 }
325 
326 
327 bool
329  ((MSEdge*)getEdge())->removePerson(person);
330  const MSLane* lane = getSidewalk<MSEdge, MSLane>(getEdge());
331  const bool arrived = myRouteStep == myRoute.end() - 1;
332  if (lane != nullptr) {
333  for (MSMoveReminder* rem : lane->getMoveReminders()) {
334  rem->updateDetector(*person, 0.0, lane->getLength(), myLastEdgeEntryTime, currentTime, currentTime, true);
335  rem->notifyLeave(*person,
336  arrived ? getArrivalPos() : lane->getLength(),
338  }
339  }
340  myLastEdgeEntryTime = currentTime;
341  //std::cout << SIMTIME << " moveToNextEdge person=" << person->getID() << "\n";
342  if (arrived) {
343  if (myDestinationStop != nullptr) {
344  myDestinationStop->addTransportable(person);
345  }
346  if (!person->proceed(MSNet::getInstance(), currentTime)) {
348  }
349  //std::cout << " end walk. myRouteStep=" << (*myRouteStep)->getID() << "\n";
350  return true;
351  } else {
352  if (nextInternal == nullptr) {
353  ++myRouteStep;
354  myCurrentInternalEdge = nullptr;
355  } else {
356  myCurrentInternalEdge = nextInternal;
357  }
358  const MSLane* nextLane = getSidewalk<MSEdge, MSLane>(getEdge());
359  if (nextLane != nullptr) {
360  for (MSMoveReminder* rem : nextLane->getMoveReminders()) {
361  rem->notifyEnter(*person, MSMoveReminder::NOTIFICATION_JUNCTION, nextLane);
362  }
363  }
364  ((MSEdge*) getEdge())->addPerson(person);
365  return false;
366  }
367 }
368 
369 void
371  assert(routeOffset >= 0);
372  assert(routeOffset < (int)myRoute.size());
373  ((MSEdge*)getEdge())->removePerson(person);
374  myRouteStep = myRoute.begin() + routeOffset;
375  ((MSEdge*)getEdge())->addPerson(person);
376 }
377 
378 double
380  return mySpeed > 0 ? mySpeed : person->getVehicleType().getMaxSpeed() * person->getSpeedFactor();
381 }
382 
383 std::string
385  const std::string dest = (getDestinationStop() == nullptr ?
386  " edge '" + getDestination()->getID() + "'" :
387  " stop '" + getDestinationStop()->getID() + "'" + (
388  getDestinationStop()->getMyName() != "" ? " (" + getDestinationStop()->getMyName() + ")" : ""));
389  return "walking to " + dest;
390 }
391 
392 
393 /* -------------------------------------------------------------------------
394 * MSPerson::MSPersonStage_Driving - methods
395 * ----------------------------------------------------------------------- */
397  MSStoppingPlace* toStop, const double arrivalPos, const std::vector<std::string>& lines,
398  const std::string& intendedVeh, SUMOTime intendedDepart) :
399  MSTransportable::Stage_Driving(destination, toStop,
400  SUMOVehicleParameter::interpretEdgePos(
401  arrivalPos, destination->getLength(), SUMO_ATTR_ARRIVALPOS, "person riding to " + destination->getID()),
402  lines,
403  intendedVeh, intendedDepart) {
404 }
405 
406 
408 
411  return new MSPersonStage_Driving(myDestination, myDestinationStop, myArrivalPos, std::vector<std::string>(myLines.begin(), myLines.end()),
412  myIntendedVehicleID, myIntendedDepart);
413 }
414 
415 void
417  const MSStoppingPlace* start = (previous->getStageType() == TRIP
418  ? previous->getOriginStop()
419  : previous->getDestinationStop());
420  if (start != nullptr) {
421  // the arrival stop may have an access point
422  myWaitingEdge = &start->getLane().getEdge();
423  myStopWaitPos = start->getWaitPosition(person);
424  myWaitingPos = start->getWaitingPositionOnLane(person);
425  } else {
426  myWaitingEdge = previous->getEdge();
427  myStopWaitPos = Position::INVALID;
428  myWaitingPos = previous->getEdgePos(now);
429  }
430  myWaitingSince = now;
431  SUMOVehicle* availableVehicle = net->getVehicleControl().getWaitingVehicle(person, myWaitingEdge, myWaitingPos);
432  if (availableVehicle != nullptr && availableVehicle->getParameter().departProcedure == DEPART_TRIGGERED && !availableVehicle->hasDeparted()) {
433  setVehicle(availableVehicle);
434  myVehicle->addPerson(person);
435  net->getInsertionControl().add(myVehicle);
436  net->getVehicleControl().removeWaiting(myWaitingEdge, myVehicle);
438  } else {
439  net->getPersonControl().addWaiting(myWaitingEdge, person);
440  myWaitingEdge->addPerson(person);
441  }
442 }
443 
444 
445 std::string
447  return isWaiting4Vehicle() ? "waiting for " + joinToString(myLines, ",") : "driving";
448 }
449 
450 
451 std::string
453  const std::string dest = (getDestinationStop() == nullptr ?
454  " edge '" + getDestination()->getID() + "'" :
455  " stop '" + getDestinationStop()->getID() + "'" + (
456  getDestinationStop()->getMyName() != "" ? " (" + getDestinationStop()->getMyName() + ")" : ""));
457  const std::string intended = myIntendedVehicleID != "" ?
458  " (vehicle " + myIntendedVehicleID + " at time " + time2string(myIntendedDepart) + ")" :
459  "";
460  return isWaiting4Vehicle() ?
461  "waiting for " + joinToString(myLines, ",") + intended + " then drive to " + dest :
462  "driving to " + dest;
463 }
464 
465 
466 void
469  const SUMOTime departed = myDeparted >= 0 ? myDeparted : now;
470  const SUMOTime waitingTime = myWaitingSince >= 0 && myDeparted >= 0 ? departed - myWaitingSince : -1;
471  const SUMOTime duration = myArrived - myDeparted;
472  MSDevice_Tripinfo::addRideData(myVehicleDistance, duration, myVehicleVClass, myVehicleLine, waitingTime);
473  os.openTag("ride");
474  os.writeAttr("waitingTime", waitingTime >= 0 ? time2string(waitingTime) : "-1");
475  os.writeAttr("vehicle", myVehicleID);
476  os.writeAttr("depart", myDeparted >= 0 ? time2string(myDeparted) : "-1");
477  os.writeAttr("arrival", myArrived >= 0 ? time2string(myArrived) : "-1");
478  os.writeAttr("arrivalPos", toString(myArrivalPos));
479  os.writeAttr("duration", myArrived >= 0 ? time2string(duration) :
480  (myDeparted >= 0 ? time2string(now - myDeparted) : "-1"));
481  os.writeAttr("routeLength", myVehicleDistance);
482  os.closeTag();
483 }
484 
485 
486 void
487 MSPerson::MSPersonStage_Driving::routeOutput(OutputDevice& os, const bool withRouteLength) const {
488  os.openTag("ride");
489  if (getFromEdge() != nullptr) {
491  }
493  std::string comment = "";
494  if (myDestinationStop != nullptr) {
495  os.writeAttr(SUMO_ATTR_BUS_STOP, myDestinationStop->getID());
496  if (myDestinationStop->getMyName() != "") {
497  comment = " <!-- " + StringUtils::escapeXML(myDestinationStop->getMyName()) + " -->";
498  }
499  }
500  os.writeAttr(SUMO_ATTR_LINES, myLines);
501  if (myIntendedVehicleID != "") {
502  os.writeAttr(SUMO_ATTR_INTENDED, myIntendedVehicleID);
503  }
504  if (myIntendedDepart >= 0) {
505  os.writeAttr(SUMO_ATTR_DEPART, time2string(myIntendedDepart));
506  }
507  if (withRouteLength) {
508  os.writeAttr("routeLength", myVehicleDistance);
509  }
510  os.closeTag(comment);
511 }
512 
513 
514 /* -------------------------------------------------------------------------
515 * MSPerson::MSPersonStage_Access - methods
516 * ----------------------------------------------------------------------- */
518  const double arrivalPos, const double dist, const bool isExit) :
519  MSTransportable::Stage(destination, toStop, arrivalPos, ACCESS),
520  myDist(dist), myAmExit(isExit) {
521  myPath.push_back(destination->getLanes()[0]->geometryPositionAtOffset(myDestinationStop->getAccessPos(destination)));
522  myPath.push_back(toStop->getLane().geometryPositionAtOffset((toStop->getEndLanePosition() + toStop->getBeginLanePosition()) / 2));
523  if (isExit) {
524  myPath = myPath.reverse();
525  }
526 }
527 
528 
530 
533  return new MSPersonStage_Access(myDestination, myDestinationStop, myArrivalPos, myDist, myAmExit);
534 }
535 
536 void
538  myDeparted = now;
539  myEstimatedArrival = now + TIME2STEPS(myDist / person->getVehicleType().getMaxSpeed());
540  net->getBeginOfTimestepEvents()->addEvent(new ProceedCmd(person, &myDestinationStop->getLane().getEdge()), myEstimatedArrival);
541  myDestinationStop->getLane().getEdge().addPerson(person);
542 }
543 
544 
545 std::string
547  return "access";
548 }
549 
550 
551 std::string
553  return (myAmExit ? "access from stop '" : "access to stop '") + getDestinationStop()->getID() + "'";
554 }
555 
556 
557 Position
559  return myPath.positionAtOffset(myPath.length() * (now - myDeparted) / (myEstimatedArrival - myDeparted));
560 }
561 
562 
563 double
565  return myPath.angleAt2D(0);
566 }
567 
568 
569 void
571  os.openTag("access");
572  os.writeAttr("stop", getDestinationStop()->getID());
573  os.writeAttr("duration", myArrived > 0 ? time2string(myArrived - myDeparted) : "-1");
574  os.writeAttr("routeLength", myDist);
575  os.closeTag();
576 }
577 
578 
579 SUMOTime
581  myStopEdge->removePerson(myPerson);
582  if (!myPerson->proceed(MSNet::getInstance(), currentTime)) {
584  }
585  return 0;
586 }
587 
588 
589 /* -------------------------------------------------------------------------
590  * MSPerson - methods
591  * ----------------------------------------------------------------------- */
592 MSPerson::MSPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor) :
593  MSTransportable(pars, vtype, plan),
594  myInfluencer(nullptr), myChosenSpeedFactor(speedFactor) {
595 }
596 
597 
599 }
600 
601 
602 bool
604  MSTransportable::Stage* prior = *myStep;
605  prior->setArrived(net, this, time);
606  /*
607  if(myWriteEvents) {
608  (*myStep)->endEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
609  }
610  */
611  //if (getID() == "ego") {
612  // std::cout << time2string(time) << " person=" << getID() << " proceed priorStep=" << myStep - myPlan->begin() << " planSize=" << myPlan->size() << "\n";
613  //}
614  // must be done before increasing myStep to avoid invalid state for rendering
615  prior->getEdge()->removePerson(this);
616  myStep++;
617  if (prior->getStageType() == MOVING_WITHOUT_VEHICLE) {
618  MSStoppingPlace* const bs = prior->getDestinationStop();
619  if (bs != nullptr) {
620  const double accessDist = bs->getAccessDistance(prior->getDestination());
621  if (accessDist > 0.) {
622  const double arrivalAtBs = (bs->getBeginLanePosition() + bs->getEndLanePosition()) / 2;
623  myStep = myPlan->insert(myStep, new MSPersonStage_Access(prior->getDestination(), bs, arrivalAtBs, accessDist, false));
624  }
625  }
626  }
627  if (myStep != myPlan->end()) {
628  if ((*myStep)->getStageType() == MOVING_WITHOUT_VEHICLE && (prior->getStageType() != ACCESS || prior->getDestination() != (*myStep)->getFromEdge())) {
629  MSStoppingPlace* const prevStop = prior->getDestinationStop();
630  if (prevStop != nullptr && prior->getStageType() != TRIP) {
631  const double accessDist = prevStop->getAccessDistance((*myStep)->getFromEdge());
632  if (accessDist > 0.) {
633  myStep = myPlan->insert(myStep, new MSPersonStage_Access((*myStep)->getFromEdge(), prevStop, prevStop->getAccessPos((*myStep)->getFromEdge()), accessDist, true));
634  }
635  }
636  }
637  (*myStep)->proceed(net, this, time, prior);
638  /*
639  if(myWriteEvents) {
640  (*myStep)->beginEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
641  }
642  */
643  return true;
644  } else {
645  // cleanup
646  if (prior->getDestinationStop() != nullptr) {
647  prior->getDestinationStop()->removeTransportable(this);
648  }
649  return false;
650  }
651 }
652 
653 
654 const std::string&
656 // if (getCurrentStageType() == MOVING_WITHOUT_VEHICLE) {
657 // MSPersonStage_Walking* walkingStage = dynamic_cast<MSPersonStage_Walking*>(*myStep);
658 // assert(walkingStage != 0);
659 // const MSEdge* nextEdge = walkingStage->getPedestrianState()->getNextEdge(*walkingStage);
660 // if (nextEdge != 0) {
661 // return nextEdge->getID();
662 // }
663 // }
664 // return StringUtils::emptyString;
665  const MSEdge* nextEdge = getNextEdgePtr();
666  if (nextEdge != nullptr) {
667  return nextEdge->getID();
668  }
670 }
671 
672 
673 const MSEdge*
676  MSPersonStage_Walking* walkingStage = dynamic_cast<MSPersonStage_Walking*>(*myStep);
677  assert(walkingStage != 0);
678  return walkingStage->getPedestrianState()->getNextEdge(*walkingStage);
679 
680  }
681  return nullptr;
682 }
683 
684 
685 
686 void
688  os.openTag("personinfo");
689  os.writeAttr("id", getID());
690  os.writeAttr("depart", time2string(getDesiredDepart()));
691  os.writeAttr("type", getVehicleType().getID());
692  for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
693  (*i)->tripInfoOutput(os, this);
694  }
695  os.closeTag();
696 }
697 
698 
699 void
700 MSPerson::routeOutput(OutputDevice& os, const bool withRouteLength) const {
701  const std::string typeID = getVehicleType().getID() != DEFAULT_PEDTYPE_ID ? getVehicleType().getID() : "";
703  if (hasArrived()) {
704  os.writeAttr("arrival", time2string(MSNet::getInstance()->getCurrentTimeStep()));
705  }
706  for (MSTransportablePlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
707  (*i)->routeOutput(os, withRouteLength);
708  }
709  os.closeTag();
710  os.lf();
711 }
712 
713 
714 void
715 MSPerson::reroute(ConstMSEdgeVector& newEdges, double departPos, int firstIndex, int nextIndex) {
716  assert(nextIndex > firstIndex);
717  //std::cout << SIMTIME << " reroute person " << getID()
718  // << " newEdges=" << toString(newEdges)
719  // << " firstIndex=" << firstIndex
720  // << " nextIndex=" << nextIndex
721  // << " departPos=" << getEdgePos()
722  // << " arrivalPos=" << getNextStage(nextIndex - 1)->getArrivalPos()
723  // << "\n";
725  getNextStage(nextIndex - 1)->getDestinationStop(), -1,
726  -1,
727  departPos,
728  getNextStage(nextIndex - 1)->getArrivalPos(),
729  0);
730  appendStage(newStage, nextIndex);
731  // remove stages in reverse order so that proceed will only be called at the last removal
732  for (int i = nextIndex - 1; i >= firstIndex; i--) {
733  //std::cout << " removeStage=" << i << "\n";
734  removeStage(i);
735  }
736 }
737 
738 
741  if (myInfluencer == nullptr) {
742  myInfluencer = new Influencer();
743  }
744  return *myInfluencer;
745 }
746 
747 
750  return myInfluencer;
751 }
752 
753 
754 
755 /* -------------------------------------------------------------------------
756  * methods of MSPerson::Influencer
757  * ----------------------------------------------------------------------- */
759 
760 
762 
763 
764 void
765 MSPerson::Influencer::setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t) {
766  myRemoteXYPos = xyPos;
767  myRemoteLane = l;
768  myRemotePos = pos;
769  myRemotePosLat = posLat;
770  myRemoteAngle = angle;
771  myRemoteEdgeOffset = edgeOffset;
772  myRemoteRoute = route;
773  myLastRemoteAccess = t;
774 }
775 
776 
777 bool
779  return myLastRemoteAccess == MSNet::getInstance()->getCurrentTimeStep();
780 }
781 
782 
783 bool
785  return myLastRemoteAccess >= t - TIME2STEPS(10);
786 }
787 
788 
789 void
791  /*
792  std::cout << SIMTIME << " moveToXY person=" << p->getID()
793  << " xyPos=" << myRemoteXYPos
794  << " lane=" << Named::getIDSecure(myRemoteLane)
795  << " pos=" << myRemotePos
796  << " posLat=" << myRemotePosLat
797  << " angle=" << myRemoteAngle
798  << " eOf=" << myRemoteEdgeOffset
799  << " route=" << toString(myRemoteRoute)
800  << " aTime=" << time2string(myLastRemoteAccess)
801  << "\n";
802  */
803  switch (p->getStageType(0)) {
804  case MOVING_WITHOUT_VEHICLE: {
805  MSPersonStage_Walking* s = dynamic_cast<MSPerson::MSPersonStage_Walking*>(p->getCurrentStage());
806  assert(s != 0);
807  s->getPedestrianState()->moveToXY(p, myRemoteXYPos, myRemoteLane, myRemotePos, myRemotePosLat, myRemoteAngle, myRemoteEdgeOffset, myRemoteRoute,
808  MSNet::getInstance()->getCurrentTimeStep());
809  }
810  break;
811  default:
812  break;
813  }
814 }
815 
816 
817 /****************************************************************************/
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
MSPerson::MSPersonStage_Walking::endEventOutput
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Definition: MSPerson.cpp:321
MSStoppingPlace::getLane
const MSLane & getLane() const
Returns the lane this stop is located at.
Definition: MSStoppingPlace.cpp:58
ToString.h
MSVehicleType::getID
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:94
MSPerson::MSPersonStage_Access::ProceedCmd
Definition: MSPerson.h:331
MSPerson::MSPersonStage_Access
Definition: MSPerson.h:286
SUMO_ATTR_DEPART
Definition: SUMOXMLDefinitions.h:432
MSStoppingPlace
A lane area vehicles can halt at.
Definition: MSStoppingPlace.h:60
MSPerson::MSPersonStage_Walking::computeAverageSpeed
double computeAverageSpeed() const
Definition: MSPerson.cpp:189
MSTransportable::getDestination
const MSEdge * getDestination() const
Returns the current destination.
Definition: MSTransportable.h:618
MSEventControl::addEvent
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
Definition: MSEventControl.cpp:53
MSPModel::canTraverse
static int canTraverse(int dir, const ConstMSEdgeVector &route)
Definition: MSPModel.cpp:92
MSNet.h
MSPModel::BACKWARD
static const int BACKWARD
Definition: MSPModel.h:104
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
DEFAULT_PEDTYPE_ID
const std::string DEFAULT_PEDTYPE_ID
MSPerson::getNextEdge
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:655
MSPerson::MSPersonStage_Access::~MSPersonStage_Access
~MSPersonStage_Access()
destructor
Definition: MSPerson.cpp:529
MSPerson::MSPersonStage_Access::tripInfoOutput
void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:570
SUMOVehicle::getParameter
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
MSTransportable::appendStage
void appendStage(Stage *stage, int next=-1)
Appends the given stage to the current plan.
Definition: MSTransportable.cpp:745
MSStoppingPlace::getEndLanePosition
double getEndLanePosition() const
Returns the end position of this stop.
Definition: MSStoppingPlace.cpp:70
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
MSTransportable::Stage::myDestinationStop
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
Definition: MSTransportable.h:207
Position::INVALID
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:285
OptionsCont.h
MSTransportable::Stage_Driving
Definition: MSTransportable.h:436
MSPerson::MSPersonStage_Driving::MSPersonStage_Driving
MSPersonStage_Driving(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines, const std::string &intendedVeh="", SUMOTime intendedDepart=-1)
constructor
Definition: MSPerson.cpp:396
MSNet::getBeginOfTimestepEvents
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Definition: MSNet.h:430
MSTransportable::myParameter
const SUMOVehicleParameter * myParameter
the plan of the transportable
Definition: MSTransportable.h:798
MSVehicleControl::removeWaiting
void removeWaiting(const MSEdge *const edge, const SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles for the given edge.
Definition: MSVehicleControl.cpp:398
MSPerson::Influencer::postProcessRemoteControl
void postProcessRemoteControl(MSPerson *p)
Definition: MSPerson.cpp:790
MSTransportableControl::erase
virtual void erase(MSTransportable *transportable)
removes a single transportable
Definition: MSTransportableControl.cpp:86
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:92
MSStoppingPlace::getBeginLanePosition
double getBeginLanePosition() const
Returns the begin position of this stop.
Definition: MSStoppingPlace.cpp:64
MSPerson
Definition: MSPerson.h:64
MSPerson::MSPersonStage_Walking::~MSPersonStage_Walking
~MSPersonStage_Walking()
destructor
Definition: MSPerson.cpp:80
MSPerson::MSPersonStage_Access::myPath
PositionVector myPath
Definition: MSPerson.h:348
MSNet::getInsertionControl
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:390
MSPerson::MSPersonStage_Access::getStageDescription
std::string getStageDescription() const
returns the stage description as a string
Definition: MSPerson.cpp:546
MSPerson::MSPersonStage_Walking::MSPersonStage_Walking
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:56
SUMO_TAG_PERSON
Definition: SUMOXMLDefinitions.h:296
MSTransportable::Stage
Definition: MSTransportable.h:74
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:61
SUMO_ATTR_LINES
Definition: SUMOXMLDefinitions.h:773
ConstMSEdgeVector
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:73
MSPerson::Influencer::~Influencer
~Influencer()
Destructor.
Definition: MSPerson.cpp:761
MSPerson::MSPersonStage_Access::getStageSummary
std::string getStageSummary() const
return string summary of the current stage
Definition: MSPerson.cpp:552
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
SUMOVehicleParameter::departProcedure
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
Definition: SUMOVehicleParameter.h:479
MSStoppingPlace::removeTransportable
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
Definition: MSStoppingPlace.cpp:199
MSEdge::addPerson
virtual void addPerson(MSTransportable *p) const
Definition: MSEdge.h:609
SUMO_ATTR_SPEED
Definition: SUMOXMLDefinitions.h:385
MSPerson::Influencer::setRemoteControlled
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition: MSPerson.cpp:765
SUMO_ATTR_ARRIVALPOS
Definition: SUMOXMLDefinitions.h:438
MSTransportable::Stage::setArrived
virtual void setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now)
logs end of the step
Definition: MSTransportable.cpp:114
MSTransportable::Stage::getEdgePos
virtual double getEdgePos(SUMOTime now) const
Definition: MSTransportable.cpp:76
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
MSEdge.h
MSTransportable
Definition: MSTransportable.h:59
MSInsertionControl.h
MSTransportable::proceed
virtual bool proceed(MSNet *net, SUMOTime time)=0
MSPerson::MSPersonStage_Access::ProceedCmd::execute
SUMOTime execute(SUMOTime currentTime)
Executes the command.
Definition: MSPerson.cpp:580
MSPerson::MSPersonStage_Walking::getFromEdge
const MSEdge * getFromEdge() const
Definition: MSPerson.cpp:102
MSTransportable::getStageType
StageType getStageType(int next) const
the stage type for the nth next stage
Definition: MSTransportable.h:663
MSTransportable::getCurrentStageType
StageType getCurrentStageType() const
the current stage type of the transportable
Definition: MSTransportable.h:658
MSPerson::MSPersonStage_Walking::tripInfoOutput
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:271
MSTransportable::Stage::getDestination
const MSEdge * getDestination() const
returns the destination edge
Definition: MSTransportable.cpp:58
MSVehicle.h
MSMoveReminder
Something on a lane to be noticed about vehicle movement.
Definition: MSMoveReminder.h:64
MSDevice_Tripinfo::addPedestrianData
static void addPedestrianData(double walkLength, SUMOTime walkDuration, SUMOTime walkTimeLoss)
record tripinfo data for pedestrians
Definition: MSDevice_Tripinfo.cpp:316
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:254
MSPerson::Influencer
Changes the wished person speed and position.
Definition: MSPerson.h:400
MSTransportable::Stage::getEdge
virtual const MSEdge * getEdge() const
Returns the current edge.
Definition: MSTransportable.cpp:64
SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:638
MSTransportable::getSpeedFactor
virtual double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition: MSTransportable.h:653
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
MSPerson::MSPersonStage_Walking::walkDistance
double walkDistance() const
compute total walking distance
Definition: MSPerson.cpp:195
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
MSEdge::getFromJunction
const MSJunction * getFromJunction() const
Definition: MSEdge.h:357
MSTransportable::getEdge
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSTransportable.h:628
MSPerson::getInfluencer
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSPerson.cpp:740
MSPerson::MSPersonStage_Walking::getSpeed
double getSpeed() const
the speed of the transportable
Definition: MSPerson.cpp:132
MSPerson::MSPersonStage_Walking::proceed
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSPerson.cpp:144
MSPerson::MSPersonStage_Walking::getWaitingTime
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
Definition: MSPerson.cpp:126
MSPerson::tripInfoOutput
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:687
MSTransportable::getCurrentStage
MSTransportable::Stage * getCurrentStage() const
Return the current stage.
Definition: MSTransportable.h:678
MSPerson::MSPersonStage_Walking::beginEventOutput
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Definition: MSPerson.cpp:314
MSTransportableControl.h
MSPerson::MSPersonStage_Walking::abort
void abort(MSTransportable *)
abort this stage (TraCI)
Definition: MSPerson.cpp:177
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:59
MSPerson::Influencer::isRemoteAffected
bool isRemoteAffected(SUMOTime t) const
Definition: MSPerson.cpp:784
MSLane::getMoveReminders
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
Definition: MSLane.h:268
MSTransportable::getMaxSpeed
double getMaxSpeed() const
Returns the vehicle's maximum speed.
Definition: MSTransportable.cpp:925
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:284
MSPModel::add
virtual PedestrianState * add(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, SUMOTime now)=0
register the given person as a pedestrian
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
MSPerson::MSPersonStage_Walking::getStageSummary
std::string getStageSummary() const
return string summary of the current stage
Definition: MSPerson.cpp:384
StringUtils::escapeXML
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
Definition: StringUtils.cpp:158
SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:428
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:541
OutputDevice.h
MSPerson::MSPersonStage_Driving::~MSPersonStage_Driving
~MSPersonStage_Driving()
destructor
Definition: MSPerson.cpp:407
MSPerson::MSPersonStage_Walking::getMaxSpeed
double getMaxSpeed(const MSTransportable *const person) const
accessors to be used by MSPModel
Definition: MSPerson.cpp:379
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
MSPerson::MSPersonStage_Access::getPosition
Position getPosition(SUMOTime now) const
returns the position of the transportable
Definition: MSPerson.cpp:558
MSPerson::MSPersonStage_Walking::getPosition
Position getPosition(SUMOTime now) const
returns the position of the transportable
Definition: MSPerson.cpp:114
MSPerson::MSPersonStage_Driving::getStageSummary
std::string getStageSummary() const
return string summary of the current stage
Definition: MSPerson.cpp:452
time2string
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:65
MSTransportable::isWaiting4Vehicle
bool isWaiting4Vehicle() const
Whether the transportable waits for a vehicle.
Definition: MSTransportable.h:722
MSPerson::MSPersonStage_Walking::routeOutput
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
Definition: MSPerson.cpp:292
MSPerson::MSPersonStage_Walking::setSpeed
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
Definition: MSPerson.cpp:183
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
DEPART_TRIGGERED
The departure is person triggered.
Definition: SUMOVehicleParameter.h:98
SUMO_ATTR_INTENDED
Definition: SUMOXMLDefinitions.h:775
MSInsertionControl::add
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Definition: MSInsertionControl.cpp:71
MSEdge::getToJunction
const MSJunction * getToJunction() const
Definition: MSEdge.h:361
MSTransportable::Stage::getOriginStop
virtual const MSStoppingPlace * getOriginStop() const
returns the origin stop (if any). only needed for Stage_Trip
Definition: MSTransportable.h:91
MSStoppingPlace::getAccessDistance
double getAccessDistance(const MSEdge *edge) const
the distance from the access on the given edge to the stop, -1 on failure
Definition: MSStoppingPlace.cpp:245
MSPerson::MSPersonStage_Access::MSPersonStage_Access
MSPersonStage_Access(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const double dist, const bool isExit)
constructor
Definition: MSPerson.cpp:517
MSMoveReminder::NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
Definition: MSMoveReminder.h:91
MSPerson::myChosenSpeedFactor
const double myChosenSpeedFactor
Definition: MSPerson.h:454
MSPerson::MSPersonStage_Walking::getAngle
double getAngle(SUMOTime now) const
returns the angle of the transportable
Definition: MSPerson.cpp:120
MSTransportable::Stage::getStageType
StageType getStageType() const
Definition: MSTransportable.h:111
MSPerson::MSPersonStage_Access::clone
Stage * clone() const
Definition: MSPerson.cpp:532
MSPerson.h
MSPerson::MSPersonStage_Driving::routeOutput
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
Definition: MSPerson.cpp:487
SUMOVehicleParameter::write
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.
Definition: SUMOVehicleParameter.cpp:66
MSEdge::removePerson
virtual void removePerson(MSTransportable *p) const
Definition: MSEdge.h:613
SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:637
MSPModel::remove
virtual void remove(PedestrianState *state)=0
remove the specified person from the pedestrian simulation
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:670
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
MSPerson::myDummyState
static DummyState myDummyState
Definition: MSPerson.h:456
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:240
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
MSPModel::FORWARD
static const int FORWARD
Definition: MSPModel.h:100
StringUtils.h
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:478
MSPerson::MSPerson
MSPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
constructor
Definition: MSPerson.cpp:592
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:588
SUMO_ATTR_DURATION
Definition: SUMOXMLDefinitions.h:665
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
MSNet::getPersonControl
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:798
SUMOVehicle::hasDeparted
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
MSMoveReminder::NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
Definition: MSMoveReminder.h:105
MSPerson::MSPersonStage_Driving::proceed
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSPerson.cpp:416
MSPerson::MSPersonStage_Driving
Definition: MSPerson.h:246
MSTransportable::getArrivalPos
double getArrivalPos() const
returns the final arrival pos
Definition: MSTransportable.h:741
MSTransportable::ACCESS
Definition: MSTransportable.h:66
MSPerson::MSPersonStage_Walking::moveToNextEdge
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=nullptr)
move forward and return whether the person arrived
Definition: MSPerson.cpp:328
PositionVector::reverse
PositionVector reverse() const
reverse position vector
Definition: PositionVector.cpp:1069
MSTransportable::getVehicleType
const MSVehicleType & getVehicleType() const
Returns the vehicle's type.
Definition: MSTransportable.h:607
DummyState
Definition: MSPModel.h:169
MSTransportable::getNextStage
MSTransportable::Stage * getNextStage(int next) const
Return the current stage.
Definition: MSTransportable.h:683
MSTransportable::hasArrived
bool hasArrived() const
return whether the person has reached the end of its plan
Definition: MSTransportable.cpp:836
MSPerson::MSPersonStage_Walking::clone
Stage * clone() const
Definition: MSPerson.cpp:87
MSTransportableControl::addWaiting
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge
Definition: MSTransportableControl.cpp:146
MSPModel::UNDEFINED_DIRECTION
static const int UNDEFINED_DIRECTION
Definition: MSPModel.h:105
MSPerson::MSPersonStage_Walking
Definition: MSPerson.h:71
MSTransportable::getDesiredDepart
SUMOTime getDesiredDepart() const
Returns the desired departure time.
Definition: MSTransportable.cpp:699
OutputDevice::lf
void lf()
writes a line feed if applicable
Definition: OutputDevice.h:234
MSPModel.h
MSPerson::getNextEdgePtr
const MSEdge * getNextEdgePtr() const
returns the next edge ptr if this person is walking and the pedestrian model allows it
Definition: MSPerson.cpp:674
MSTransportable::getID
const std::string & getID() const
returns the id of the transportable
Definition: MSTransportable.cpp:694
MSStoppingPlace::getAccessPos
double getAccessPos(const MSEdge *edge) const
the position on the given edge which is connected to this stop, -1 on failure
Definition: MSStoppingPlace.cpp:231
StringUtils::emptyString
static std::string emptyString
An empty string.
Definition: StringUtils.h:79
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:247
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:165
MSTransportable::TRIP
Definition: MSTransportable.h:67
MSVehicleType::getMaxSpeed
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
Definition: MSVehicleType.h:162
MSStoppingPlace::getWaitingPositionOnLane
double getWaitingPositionOnLane(MSTransportable *t) const
Returns the lane position corresponding to getWaitPosition()
Definition: MSStoppingPlace.cpp:123
MSPModel::getModel
static MSPModel * getModel()
Definition: MSPModel.cpp:59
config.h
MSTransportable::myStep
MSTransportablePlan::iterator myStep
the iterator over the route
Definition: MSTransportable.h:811
MSDevice_Tripinfo.h
GeomHelper.h
MSTransportable::MOVING_WITHOUT_VEHICLE
Definition: MSTransportable.h:64
PedestrianState::moveToXY
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:151
MSStoppingPlace::getWaitPosition
virtual Position getWaitPosition(MSTransportable *person) const
Returns the next free waiting place for pedestrians / containers.
Definition: MSStoppingPlace.cpp:144
MSTransportable::Stage::getDestinationStop
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition: MSTransportable.h:86
MSTransportable::removeStage
void removeStage(int next)
removes the nth next stage
Definition: MSTransportable.cpp:761
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
MSTransportable::myPlan
MSTransportablePlan * myPlan
the plan of the transportable
Definition: MSTransportable.h:808
SUMO_ATTR_DEPARTPOS
Definition: SUMOXMLDefinitions.h:434
MSVehicleControl::getWaitingVehicle
SUMOVehicle * getWaitingVehicle(MSTransportable *transportable, const MSEdge *const edge, const double position)
Definition: MSVehicleControl.cpp:409
MSTransportable::getFromEdge
const MSEdge * getFromEdge() const
Returns the departure edge.
Definition: MSTransportable.h:633
MSEventControl.h
MSLane.h
MSPerson::MSPersonStage_Walking::myDepartPos
double myDepartPos
Definition: MSPerson.h:211
MSPerson::MSPersonStage_Walking::getEdge
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSPerson.cpp:92
MSPerson::reroute
void reroute(ConstMSEdgeVector &newEdges, double departPos, int firstIndex, int nextIndex)
set new walk and replace the stages with relative indices in the interval [firstIndex,...
Definition: MSPerson.cpp:715
MSPerson::~MSPerson
virtual ~MSPerson()
destructor
Definition: MSPerson.cpp:598
SUMO_ATTR_BUS_STOP
Definition: SUMOXMLDefinitions.h:766
MSPerson::MSPersonStage_Walking::getEdges
ConstMSEdgeVector getEdges() const
the edges of the current stage
Definition: MSPerson.cpp:138
MSPerson::MSPersonStage_Access::getAngle
double getAngle(SUMOTime now) const
returns the angle of the transportable
Definition: MSPerson.cpp:564
MSPerson::MSPersonStage_Walking::getEdgePos
double getEdgePos(SUMOTime now) const
Definition: MSPerson.cpp:108
MSStoppingPlace.h
MSPerson::MSPersonStage_Driving::clone
Stage * clone() const
Definition: MSPerson.cpp:410
MSVehicleControl.h
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
POSITION_EPS
#define POSITION_EPS
Definition: config.h:169
MSDevice_Tripinfo::addRideData
static void addRideData(double rideLength, SUMOTime rideDuration, SUMOVehicleClass vClass, const std::string &line, SUMOTime waitingTime)
record tripinfo data for rides
Definition: MSDevice_Tripinfo.cpp:325
MSMoveReminder::NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
Definition: MSMoveReminder.h:93
MSPModel::usingInternalLanes
virtual bool usingInternalLanes()=0
whether movements on intersections are modelled
MSPerson::MSPersonStage_Walking::setRouteIndex
void setRouteIndex(MSPerson *person, int routeOffset)
place person on a previously passed edge
Definition: MSPerson.cpp:370
MSPerson::Influencer::isRemoteControlled
bool isRemoteControlled() const
Definition: MSPerson.cpp:778
PedestrianState::getNextEdge
virtual const MSEdge * getNextEdge(const MSPerson::MSPersonStage_Walking &stage) const =0
return the list of internal edges if the pedestrian is on an intersection
MSPerson::MSPersonStage_Walking::mySpeed
double mySpeed
Definition: MSPerson.h:213
SUMOVehicleParameter::interpretEdgePos
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
Definition: SUMOVehicleParameter.cpp:510
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:337
MSPerson::MSPersonStage_Driving::getStageDescription
std::string getStageDescription() const
returns the stage description as a string
Definition: MSPerson.cpp:446
MSPerson::proceed
bool proceed(MSNet *net, SUMOTime time)
Definition: MSPerson.cpp:603
MSPerson::myInfluencer
Influencer * myInfluencer
An instance of a speed/position influencing instance; built in "getInfluencer".
Definition: MSPerson.h:452
MSPerson::Influencer::Influencer
Influencer()
Constructor.
Definition: MSPerson.cpp:758
MSVehicleControl::unregisterOneWaiting
void unregisterOneWaiting(const bool isPerson)
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
Definition: MSVehicleControl.h:441
MSPerson::MSPersonStage_Driving::tripInfoOutput
virtual void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:467
MSPerson::routeOutput
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
Definition: MSPerson.cpp:700
IntermodalNetwork.h
MSPerson::MSPersonStage_Access::proceed
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
Definition: MSPerson.cpp:537
MSPerson::MSPersonStage_Walking::getPedestrianState
PedestrianState * getPedestrianState() const
Definition: MSPerson.h:179