SUMO - Simulation of Urban MObility
MSPerson.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // The class for modelling person-movements
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
35 #include <vector>
38 #include <utils/common/ToString.h>
39 #include <microsim/MSNet.h>
40 #include <microsim/MSEdge.h>
41 #include <microsim/MSLane.h>
42 #include "MSPerson.h"
45 #include <microsim/MSVehicle.h>
46 #include "MSPModel.h"
47 
48 #ifdef CHECK_MEMORY_LEAKS
49 #include <foreign/nvwa/debug_new.h>
50 #endif // CHECK_MEMORY_LEAKS
51 
52 /* -------------------------------------------------------------------------
53  * static member definitions
54  * ----------------------------------------------------------------------- */
55 
56 // ===========================================================================
57 // method definitions
58 // ===========================================================================
59 /* -------------------------------------------------------------------------
60  * MSPerson::MSPersonStage - methods
61  * ----------------------------------------------------------------------- */
63  : myDestination(destination), myDeparted(-1), myArrived(-1), myType(type) {}
64 
65 
67 
68 
69 const MSEdge&
71  return myDestination;
72 }
73 
74 
75 void
77  if (myDeparted < 0) {
78  myDeparted = now;
79  }
80 }
81 
82 
83 void
85  myArrived = now;
86 }
87 
88 
89 bool
90 MSPerson::MSPersonStage::isWaitingFor(const std::string& /*line*/) const {
91  return false;
92 }
93 
94 
97  return getLanePosition(e->getLanes()[0], at, offset);
98 }
99 
100 
101 Position
103  return lane->getShape().positionAtOffset(lane->interpolateLanePosToGeometryPos(at), offset);
104 }
105 
106 
107 SUMOReal
109  // @todo: well, definitely not the nicest way... Should be precomputed
110  PositionVector shp = e->getLanes()[0]->getShape();
111  return -shp.rotationDegreeAtOffset(at);
112 }
113 
114 
115 
116 /* -------------------------------------------------------------------------
117  * MSPerson::MSPersonStage_Walking - methods
118  * ----------------------------------------------------------------------- */
120  MSBusStop* toBS,
121  SUMOTime walkingTime, SUMOReal speed,
122  SUMOReal departPos, SUMOReal arrivalPos) :
123  MSPersonStage(*route.back(), WALKING), myWalkingTime(walkingTime), myRoute(route),
124  myCurrentInternalEdge(0),
125  myDepartPos(departPos), myArrivalPos(arrivalPos), myDestinationBusStop(toBS),
126  mySpeed(speed),
127  myPedestrianState(0) {
129  myDepartPos, myRoute.front()->getLength(), SUMO_ATTR_DEPARTPOS, "person walking from " + myRoute.front()->getID());
131  myArrivalPos, myRoute.back()->getLength(), SUMO_ATTR_ARRIVALPOS, "person walking to " + myRoute.back()->getID());
132  if (walkingTime > 0) {
134  }
135 }
136 
137 
139 }
140 
141 
142 const MSEdge*
144  if (myCurrentInternalEdge != 0) {
145  return myCurrentInternalEdge;
146  } else {
147  return *myRouteStep;
148  }
149 }
150 
151 
152 const MSEdge*
154  return myRoute.front();
155 }
156 
157 
158 SUMOReal
160  return myPedestrianState->getEdgePos(*this, now);
161 }
162 
163 
164 Position
166  return myPedestrianState->getPosition(*this, now);
167 }
168 
169 
170 SUMOReal
172  return myPedestrianState->getAngle(*this, now);
173 }
174 
175 
176 SUMOTime
178  return myPedestrianState->getWaitingTime(*this, now);
179 }
180 
181 
182 SUMOReal
184  return myPedestrianState->getSpeed(*this);
185 }
186 
187 
188 void
190  MSEdge* previousEdge, const SUMOReal at) {
191  previousEdge->removePerson(person);
192  myRouteStep = myRoute.begin();
193  if (myWalkingTime == 0) {
194  if (!person->proceed(net, now)) {
196  };
197  return;
198  }
200  if (at >= 0) {
201  myDepartPos = at;
202  if (myWalkingTime > 0) {
203  mySpeed = computeAverageSpeed();
204  }
205  }
206  myPedestrianState = MSPModel::getModel()->add(person, this, now);
207  ((MSEdge*) *myRouteStep)->addPerson(person);
208 }
209 
210 
211 SUMOReal
213  SUMOReal length = 0;
214  for (ConstMSEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end(); ++i) {
215  length += (*i)->getLength();
216  }
217  length -= myDepartPos;
218  length -= myRoute.back()->getLength() - myArrivalPos;
219  return length / STEPS2TIME(myWalkingTime + 1); // avoid systematic rounding errors
220 }
221 
222 
223 void
225  os.openTag("walk").writeAttr("arrival", time2string(myArrived)).closeTag();
226 }
227 
228 
229 void
231  os.openTag("walk").writeAttr(SUMO_ATTR_EDGES, myRoute);
232  if (myWalkingTime > 0) {
233  os.writeAttr(SUMO_ATTR_DURATION, time2string(myWalkingTime));
234  } else if (mySpeed > 0) {
235  os.writeAttr(SUMO_ATTR_SPEED, mySpeed);
236  }
237  os.closeTag();
238 }
239 
240 
241 void
243  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "departure")
244  .writeAttr("agent", p.getID()).writeAttr("link", myRoute.front()->getID()).closeTag();
245 }
246 
247 
248 void
250  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival")
251  .writeAttr("agent", p.getID()).writeAttr("link", myRoute.back()->getID()).closeTag();
252 }
253 
254 
255 bool
257  ((MSEdge*)getEdge())->removePerson(person);
258  //std::cout << SIMTIME << " moveToNextEdge person=" << person->getID() << "\n";
259  if (myRouteStep == myRoute.end() - 1) {
261  if (myDestinationBusStop != 0) {
262  myDestinationBusStop->addPerson(person);
263  }
264  if (!person->proceed(MSNet::getInstance(), currentTime)) {
266  }
267  //std::cout << " end walk. myRouteStep=" << (*myRouteStep)->getID() << "\n";
268  return true;
269  } else {
270  if (nextInternal == 0) {
271  ++myRouteStep;
272  myCurrentInternalEdge = 0;
273  } else {
274  myCurrentInternalEdge = nextInternal;
275  }
276  ((MSEdge*) getEdge())->addPerson(person);
277  return false;
278  }
279 }
280 
281 
282 
283 /* -------------------------------------------------------------------------
284  * MSPerson::MSPersonStage_Driving - methods
285  * ----------------------------------------------------------------------- */
287  MSBusStop* toBS, const std::vector<std::string>& lines)
288  : MSPersonStage(destination, DRIVING), myLines(lines.begin(), lines.end()),
289  myVehicle(0), myDestinationBusStop(toBS) {}
290 
291 
293 
294 
295 const MSEdge*
297  if (myVehicle != 0) {
298  return myVehicle->getEdge();
299  }
300  return myWaitingEdge;
301 }
302 
303 
304 const MSEdge*
306  return myWaitingEdge;
307 }
308 
309 
310 SUMOReal
312  if (myVehicle != 0) {
313  // vehicle may already have passed the lane (check whether this is correct)
314  return MIN2(myVehicle->getPositionOnLane(), getEdge()->getLength());
315  }
316  return myWaitingPos;
317 }
318 
319 
320 Position
322  if (myVehicle != 0) {
324  return myVehicle->getEdge()->getLanes()[0]->getShape().positionAtOffset(myVehicle->getPositionOnLane());
325  }
326  return getEdgePosition(myWaitingEdge, myWaitingPos, MSPModel::SIDEWALK_OFFSET);
327 }
328 
329 
330 SUMOReal
332  if (myVehicle != 0) {
333  MSVehicle* veh = dynamic_cast<MSVehicle*>(myVehicle);
334  if (veh != 0) {
335  return veh->getAngle();
336  } else {
337  return 0;
338  }
339  }
340  return getEdgeAngle(myWaitingEdge, myWaitingPos) + 90;
341 }
342 
343 
344 
345 void
347  MSEdge* previousEdge, const SUMOReal at) {
348  myWaitingEdge = previousEdge;
349  myWaitingPos = at;
350  myWaitingSince = now;
351  SUMOVehicle* availableVehicle = net->getVehicleControl().getWaitingVehicle(previousEdge, myLines, myWaitingPos, person->getID());
352  if (availableVehicle != 0 && availableVehicle->getParameter().departProcedure == DEPART_TRIGGERED) {
353  myVehicle = availableVehicle;
354  previousEdge->removePerson(person);
355  myVehicle->addPerson(person);
356  net->getInsertionControl().add(myVehicle);
357  net->getVehicleControl().removeWaiting(previousEdge, myVehicle);
359  } else {
360  net->getPersonControl().addWaiting(previousEdge, person);
361  previousEdge->addPerson(person);
362  }
363 }
364 
365 
366 bool
367 MSPerson::MSPersonStage_Driving::isWaitingFor(const std::string& line) const {
368  return myLines.count(line) > 0;
369 }
370 
371 
372 bool
374  return myVehicle == 0;
375 }
376 
377 
378 SUMOTime
380  return isWaiting4Vehicle() ? now - myWaitingSince : 0;
381 }
382 
383 
384 SUMOReal
386  return myVehicle == 0 ? 0 : myVehicle->getSpeed();
387 }
388 
389 
390 std::string
392  return isWaiting4Vehicle() ? "waiting for " + joinToString(myLines, ",") : "driving";
393 }
394 
395 
396 void
398  os.openTag("ride").writeAttr("depart", time2string(myDeparted)).writeAttr("arrival", time2string(myArrived)).closeTag();
399 }
400 
401 
402 void
405  os.writeAttr(SUMO_ATTR_LINES, myLines).closeTag();
406 }
407 
408 
409 void
411  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
412 }
413 
414 
415 void
417  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
418 }
419 
420 
421 
422 /* -------------------------------------------------------------------------
423  * MSPerson::MSPersonStage_Waiting - methods
424  * ----------------------------------------------------------------------- */
426  SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string& actType) :
427  MSPersonStage(destination, WAITING),
428  myWaitingDuration(duration),
429  myWaitingUntil(until),
430  myActType(actType),
431  myStartPos(pos) {
434 }
435 
436 
438 
439 
440 const MSEdge*
442  return &myDestination;
443 }
444 
445 
446 const MSEdge*
448  return &myDestination;
449 }
450 
451 
452 SUMOReal
454  return myStartPos;
455 }
456 
457 
458 SUMOTime
460  return myWaitingUntil;
461 }
462 
463 
464 Position
466  return getEdgePosition(&myDestination, myStartPos, MSPModel::SIDEWALK_OFFSET);
467 }
468 
469 
470 SUMOReal
472  return getEdgeAngle(&myDestination, myStartPos) - 90;
473 }
474 
475 
476 void
478  MSEdge* previousEdge, const SUMOReal /* at */) {
479  previousEdge->addPerson(person);
480  myWaitingStart = now;
481  const SUMOTime until = MAX3(now, now + myWaitingDuration, myWaitingUntil);
482  net->getPersonControl().setWaitEnd(until, person);
483 }
484 
485 
486 void
488  os.openTag("stop").writeAttr("arrival", time2string(myArrived)).closeTag();
489 }
490 
491 
492 void
495  if (myWaitingDuration >= 0) {
496  os.writeAttr(SUMO_ATTR_DURATION, time2string(myWaitingDuration));
497  }
498  if (myWaitingUntil >= 0) {
499  os.writeAttr(SUMO_ATTR_UNTIL, time2string(myWaitingUntil));
500  }
501  os.closeTag();
502 }
503 
504 
505 void
507  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actstart " + myActType)
508  .writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
509 }
510 
511 
512 void
514  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actend " + myActType).writeAttr("agent", p.getID())
515  .writeAttr("link", getEdge()->getID()).closeTag();
516 }
517 
518 
519 SUMOTime
521  return now - myWaitingStart;
522 }
523 
524 
525 SUMOReal
527  return 0;
528 }
529 
530 
531 
532 
533 /* -------------------------------------------------------------------------
534  * MSPerson - methods
535  * ----------------------------------------------------------------------- */
537  : myParameter(pars), myVType(vtype), myPlan(plan) {
538  myStep = myPlan->begin();
539 }
540 
541 
543  for (MSPersonPlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
544  delete *i;
545  }
546  delete myPlan;
547  delete myParameter;
548 }
549 
550 
551 const std::string&
553  return myParameter->id;
554 }
555 
556 
557 bool
559  MSEdge* arrivedAt = (MSEdge*)(*myStep)->getEdge();
560  SUMOReal atPos = (*myStep)->getEdgePos(time);
561  //MSPersonPlan::iterator prior = myStep;
562  (*myStep)->setArrived(time);
563  /*
564  if(myWriteEvents) {
565  (*myStep)->endEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
566  }
567  */
568  myStep++;
569  if (myStep != myPlan->end()) {
570  (*myStep)->proceed(net, this, time, arrivedAt, atPos);
571  /*
572  if(myWriteEvents) {
573  (*myStep)->beginEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
574  }
575  */
576  return true;
577  } else {
578  arrivedAt->removePerson(this);
579  return false;
580  }
581 }
582 
583 
584 SUMOTime
586  return myParameter->depart;
587 }
588 
589 
590 void
592  (*myStep)->setDeparted(now);
593 }
594 
595 
596 void
598  for (MSPersonPlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
599  (*i)->tripInfoOutput(os);
600  }
601 }
602 
603 
604 void
606  MSPersonPlan::const_iterator i = myPlan->begin();
607  if ((*i)->getStageType() == WAITING && getDesiredDepart() == static_cast<MSPersonStage_Waiting*>(*i)->getUntil()) {
608  ++i;
609  }
610  for (; i != myPlan->end(); ++i) {
611  (*i)->routeOutput(os);
612  }
613 }
614 
615 SUMOReal
617  return (*myStep)->getEdgePos(MSNet::getInstance()->getCurrentTimeStep());
618 }
619 
620 Position
622  return (*myStep)->getPosition(MSNet::getInstance()->getCurrentTimeStep());
623 }
624 
625 
626 SUMOReal
628  return (*myStep)->getAngle(MSNet::getInstance()->getCurrentTimeStep());
629 }
630 
631 SUMOReal
633  return STEPS2TIME((*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep()));
634 }
635 
636 SUMOReal
638  return (*myStep)->getSpeed();
639 }
640 
641 /****************************************************************************/
642 
The departure is person triggered.
SUMOTime getUntil() const
Definition: MSPerson.cpp:459
SUMOReal getAngle(SUMOTime now) const
Definition: MSPerson.cpp:471
const std::string & getID() const
returns the person id
Definition: MSPerson.cpp:552
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:257
virtual void beginEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Definition: MSPerson.cpp:410
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
const MSEdge * getFromEdge() const
Definition: MSPerson.cpp:305
SUMOTime getDesiredDepart() const
Returns the desired departure time.
Definition: MSPerson.cpp:585
virtual ~MSPerson()
destructor
Definition: MSPerson.cpp:542
const SUMOVehicleParameter * myParameter
the plan of the person
Definition: MSPerson.h:617
SUMOTime getWaitingTime(SUMOTime now) const
the time this person spent waiting
Definition: MSPerson.cpp:520
const MSEdge & getDestination() const
returns the destination edge
Definition: MSPerson.cpp:70
Position getLanePosition(const MSLane *lane, SUMOReal at, SUMOReal offset) const
get position on lane at length at with orthogonal offset
Definition: MSPerson.cpp:102
SUMOReal getSpeed() const
the time this person spent waiting
Definition: MSPerson.cpp:526
void setDeparted(SUMOTime now)
logs end of the step
Definition: MSPerson.cpp:591
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:186
virtual Position getPosition() const
return the Network coordinate of the person
Definition: MSPerson.cpp:621
MSPersonStage(const MSEdge &destination, StageType type)
constructor
Definition: MSPerson.cpp:62
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSPerson.cpp:296
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
Definition: MSPerson.h:600
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSPerson.h:542
const MSEdge * getFromEdge() const
Returns the departure edge.
Definition: MSPerson.h:547
virtual bool isWaitingFor(const std::string &line) const
Whether the person waits for a vehicle of the line specified.
Definition: MSPerson.cpp:90
virtual void beginEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Definition: MSPerson.cpp:506
void setDeparted(SUMOTime now)
logs end of the step
Definition: MSPerson.cpp:76
virtual SUMOReal getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: MSPerson.cpp:632
Position getPosition(SUMOTime now) const
Definition: MSPerson.cpp:165
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:487
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:61
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
Definition: MSPerson.cpp:373
SUMOReal getEdgePos(SUMOTime now) const
Definition: MSPerson.cpp:311
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:159
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:230
const MSVehicleType * myVType
This Persons's type. (mainly used for drawing related information.
Definition: MSPerson.h:620
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines, const SUMOReal position, const std::string ridingID)
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:79
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:235
SUMOReal getEdgeAngle(const MSEdge *e, SUMOReal at) const
Definition: MSPerson.cpp:108
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:397
T MAX3(T a, T b, T c)
Definition: StdDefs.h:88
virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
Definition: MSPerson.cpp:189
The simulated network and simulation perfomer.
Definition: MSNet.h:94
The car-following model and parameter.
Definition: MSVehicleType.h:74
SUMOReal getEdgePos(SUMOTime now) const
Definition: MSPerson.cpp:159
const MSEdge & getDestination() const
Returns the current destination.
Definition: MSPerson.h:537
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSPerson.cpp:143
virtual PedestrianState * add(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, SUMOTime now)=0
register the given person as a pedestrian
static SUMOReal interpretEdgePos(SUMOReal pos, SUMOReal maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
ConstMSEdgeVector myRoute
The route of the person.
Definition: MSPerson.h:293
const std::string & getID() const
Returns the id.
Definition: Named.h:60
A road/street connecting two junctions.
Definition: MSEdge.h:81
Position getEdgePosition(const MSEdge *e, SUMOReal at, SUMOReal offset) const
get position on edge e at length at with orthogonal offset
Definition: MSPerson.cpp:96
MSPersonPlan * myPlan
the plan of the person
Definition: MSPerson.h:623
void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:605
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.h:535
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the person arrived
Definition: MSPerson.cpp:256
the edges of a route
SUMOReal getEdgePos(SUMOTime now) const
Definition: MSPerson.cpp:453
Representation of a vehicle.
Definition: SUMOVehicle.h:65
static MSPModel * getModel()
Definition: MSPModel.cpp:65
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
SUMOReal getAngle(SUMOTime now) const
Definition: MSPerson.cpp:331
SUMOReal getSpeed() const
the time this person spent waiting
Definition: MSPerson.cpp:385
A lane area vehicles can halt at.
Definition: MSBusStop.h:64
A list of positions.
SUMOReal computeAverageSpeed() const
Definition: MSPerson.cpp:212
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:288
void addWaiting(const MSEdge *edge, MSPerson *person)
adds a person to the list of persons waiting for a vehicle on the specified edge
MSPersonStage_Walking(const ConstMSEdgeVector &route, MSBusStop *toBS, SUMOTime walkingTime, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos)
constructor
Definition: MSPerson.cpp:119
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Definition: MSPerson.cpp:249
SUMOTime depart
The vehicle's departure time.
Position getPosition(SUMOTime now) const
Definition: MSPerson.cpp:465
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
Definition: MSPerson.cpp:477
T MIN2(T a, T b)
Definition: StdDefs.h:68
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:403
virtual void removePerson(MSPerson *p) const
Definition: MSEdge.h:560
const MSEdge * getFromEdge() const
Definition: MSPerson.cpp:447
virtual SUMOReal getAngle() const
return the current angle of the person
Definition: MSPerson.cpp:627
void setWaitEnd(SUMOTime time, MSPerson *person)
sets the arrival time for a waiting or walking person
virtual void addPerson(MSPerson *p) const
Definition: MSEdge.h:556
void unsetWalking(MSPerson *p)
SUMOTime getWaitingTime(SUMOTime now) const
the time this person spent waiting
Definition: MSPerson.cpp:177
bool isWaitingFor(const std::string &line) const
Whether the person waits for a vehicle of the line specified.
Definition: MSPerson.cpp:367
MSPersonStage_Waiting(const MSEdge &destination, SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string &actType)
constructor
Definition: MSPerson.cpp:425
void unregisterOneWaitingForPerson()
decreases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
SUMOReal getAngle(SUMOTime now) const
Definition: MSPerson.cpp:171
MSPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSPersonPlan *plan)
constructor
Definition: MSPerson.cpp:536
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
virtual void beginEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Definition: MSPerson.cpp:242
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSPerson.cpp:441
static const SUMOReal SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk ...
Definition: MSPModel.h:84
Structure representing possible vehicle parameter.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:493
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Definition: MSPerson.cpp:416
void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:597
virtual MSPersonControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:658
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:329
void setWalking(MSPerson *p)
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
MSPersonPlan::iterator myStep
the iterator over the route
Definition: MSPerson.h:626
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition: MSLane.h:334
int SUMOTime
Definition: SUMOTime.h:43
Position getPosition(SUMOTime now) const
Definition: MSPerson.cpp:321
std::string getStageDescription() const
return string representation of the current stage
Definition: MSPerson.cpp:391
bool proceed(MSNet *net, SUMOTime time)
Definition: MSPerson.cpp:558
MSPersonStage_Driving(const MSEdge &destination, MSBusStop *toBS, const std::vector< std::string > &lines)
constructor
Definition: MSPerson.cpp:286
virtual SUMOReal getSpeed() const
the current speed of the person
Definition: MSPerson.cpp:637
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
Definition: MSPerson.cpp:379
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Definition: MSPerson.cpp:513
const MSEdge * getFromEdge() const
Definition: MSPerson.cpp:153
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:323
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:159
virtual SUMOReal getEdgePos() const
return the offset from the start of the current edge
Definition: MSPerson.cpp:616
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
bool closeTag()
Closes the most recently opened tag.
#define SUMOReal
Definition: config.h:218
virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
Definition: MSPerson.cpp:346
const MSEdge & myDestination
the next edge to reach (either by walking or driving)
Definition: MSPerson.h:168
virtual ~MSPersonStage()
destructor
Definition: MSPerson.cpp:66
SUMOReal myDepartPos
A vector of computed times an edge is reached.
Definition: MSPerson.h:304
SUMOReal getSpeed() const
the time this person spent waiting
Definition: MSPerson.cpp:183
void setArrived(SUMOTime now)
logs end of the step
Definition: MSPerson.cpp:84
virtual void erase(MSPerson *person)
removes a single person
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
std::vector< MSPersonStage * > MSPersonPlan
the structure holding the plan of a person
Definition: MSPerson.h:514
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:224
std::string id
The vehicle's id.
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
Definition: MSVehicle.cpp:646