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