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-sim.org/
13 // Copyright (C) 2001-2014 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 "MSNet.h"
40 #include "MSEdge.h"
41 #include "MSLane.h"
42 #include "MSPerson.h"
43 #include "MSPersonControl.h"
44 #include "MSInsertionControl.h"
45 #include "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  * ----------------------------------------------------------------------- */
119 MSPerson::MSPersonStage_Walking::MSPersonStage_Walking(const std::vector<const MSEdge*>& route,
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 (std::vector<const MSEdge*>::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() + 90;
336  } else {
337  return 0;
338  }
339  }
340  return getEdgeAngle(myWaitingEdge, myWaitingPos);
341 }
342 
343 
344 
345 void
347  MSEdge* previousEdge, const SUMOReal at) {
348  myWaitingEdge = previousEdge;
349  myWaitingPos = at;
350  myWaitingSince = now;
351  myVehicle = net->getVehicleControl().getWaitingVehicle(previousEdge, myLines);
352  if (myVehicle != 0 && myVehicle->getParameter().departProcedure == DEPART_TRIGGERED) {
353  previousEdge->removePerson(person);
354  myVehicle->addPerson(person);
355  net->getInsertionControl().add(myVehicle);
356  net->getVehicleControl().removeWaiting(previousEdge, myVehicle);
358  } else {
359  net->getPersonControl().addWaiting(previousEdge, person);
360  previousEdge->addPerson(person);
361  }
362 }
363 
364 
365 bool
366 MSPerson::MSPersonStage_Driving::isWaitingFor(const std::string& line) const {
367  return myLines.count(line) > 0;
368 }
369 
370 
371 bool
373  return myVehicle == 0;
374 }
375 
376 
377 SUMOTime
379  return isWaiting4Vehicle() ? now - myWaitingSince : 0;
380 }
381 
382 
383 SUMOReal
385  return myVehicle == 0 ? 0 : myVehicle->getSpeed();
386 }
387 
388 
389 std::string
391  return isWaiting4Vehicle() ? "waiting for " + joinToString(myLines, ",") : "driving";
392 }
393 
394 
395 void
397  os.openTag("ride").writeAttr("depart", time2string(myDeparted)).writeAttr("arrival", time2string(myArrived)).closeTag();
398 }
399 
400 
401 void
404  os.writeAttr(SUMO_ATTR_LINES, myLines).closeTag();
405 }
406 
407 
408 void
410  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
411 }
412 
413 
414 void
416  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "arrival").writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
417 }
418 
419 
420 
421 /* -------------------------------------------------------------------------
422  * MSPerson::MSPersonStage_Waiting - methods
423  * ----------------------------------------------------------------------- */
425  SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string& actType) :
426  MSPersonStage(destination, WAITING),
427  myWaitingDuration(duration),
428  myWaitingUntil(until),
429  myActType(actType),
430  myStartPos(pos) {
433 }
434 
435 
437 
438 
439 const MSEdge*
441  return &myDestination;
442 }
443 
444 
445 const MSEdge*
447  return &myDestination;
448 }
449 
450 
451 SUMOReal
453  return myStartPos;
454 }
455 
456 
457 SUMOTime
459  return myWaitingUntil;
460 }
461 
462 
463 Position
465  return getEdgePosition(&myDestination, myStartPos, MSPModel::SIDEWALK_OFFSET);
466 }
467 
468 
469 SUMOReal
471  return getEdgeAngle(&myDestination, myStartPos) + 45;
472 }
473 
474 
475 void
477  MSEdge* previousEdge, const SUMOReal /* at */) {
478  previousEdge->addPerson(person);
479  myWaitingStart = now;
480  const SUMOTime until = MAX3(now, now + myWaitingDuration, myWaitingUntil);
481  net->getPersonControl().setWaitEnd(until, person);
482 }
483 
484 
485 void
487  os.openTag("stop").writeAttr("arrival", time2string(myArrived)).closeTag();
488 }
489 
490 
491 void
494  if (myWaitingDuration >= 0) {
495  os.writeAttr(SUMO_ATTR_DURATION, time2string(myWaitingDuration));
496  }
497  if (myWaitingUntil >= 0) {
498  os.writeAttr(SUMO_ATTR_UNTIL, time2string(myWaitingUntil));
499  }
500  os.closeTag();
501 }
502 
503 
504 void
506  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actstart " + myActType)
507  .writeAttr("agent", p.getID()).writeAttr("link", getEdge()->getID()).closeTag();
508 }
509 
510 
511 void
513  os.openTag("event").writeAttr("time", time2string(t)).writeAttr("type", "actend " + myActType).writeAttr("agent", p.getID())
514  .writeAttr("link", getEdge()->getID()).closeTag();
515 }
516 
517 
518 SUMOTime
520  return now - myWaitingStart;
521 }
522 
523 
524 SUMOReal
526  return 0;
527 }
528 
529 
530 
531 
532 /* -------------------------------------------------------------------------
533  * MSPerson - methods
534  * ----------------------------------------------------------------------- */
536  : myParameter(pars), myVType(vtype), myPlan(plan) {
537  myStep = myPlan->begin();
538 }
539 
540 
542  for (MSPersonPlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
543  delete *i;
544  }
545  delete myPlan;
546  delete myParameter;
547 }
548 
549 
550 const std::string&
552  return myParameter->id;
553 }
554 
555 
556 bool
558  MSEdge* arrivedAt = (MSEdge*)(*myStep)->getEdge();
559  SUMOReal atPos = (*myStep)->getEdgePos(time);
560  //MSPersonPlan::iterator prior = myStep;
561  (*myStep)->setArrived(time);
562  /*
563  if(myWriteEvents) {
564  (*myStep)->endEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
565  }
566  */
567  myStep++;
568  if (myStep != myPlan->end()) {
569  (*myStep)->proceed(net, this, time, arrivedAt, atPos);
570  /*
571  if(myWriteEvents) {
572  (*myStep)->beginEventOutput(*this, time, OutputDevice::getDeviceByOption("person-event-output"));
573  }
574  */
575  return true;
576  } else {
577  arrivedAt->removePerson(this);
578  return false;
579  }
580 }
581 
582 
583 SUMOTime
585  return myParameter->depart;
586 }
587 
588 
589 void
591  (*myStep)->setDeparted(now);
592 }
593 
594 
595 void
597  for (MSPersonPlan::const_iterator i = myPlan->begin(); i != myPlan->end(); ++i) {
598  (*i)->tripInfoOutput(os);
599  }
600 }
601 
602 
603 void
605  MSPersonPlan::const_iterator i = myPlan->begin();
606  if ((*i)->getStageType() == WAITING && getDesiredDepart() == static_cast<MSPersonStage_Waiting*>(*i)->getUntil()) {
607  ++i;
608  }
609  for (; i != myPlan->end(); ++i) {
610  (*i)->routeOutput(os);
611  }
612 }
613 
614 SUMOReal
616  return (*myStep)->getEdgePos(MSNet::getInstance()->getCurrentTimeStep());
617 }
618 
619 Position
621  return (*myStep)->getPosition(MSNet::getInstance()->getCurrentTimeStep());
622 }
623 
624 
625 SUMOReal
627  return (*myStep)->getAngle(MSNet::getInstance()->getCurrentTimeStep());
628 }
629 
630 SUMOReal
632  return STEPS2TIME((*myStep)->getWaitingTime(MSNet::getInstance()->getCurrentTimeStep()));
633 }
634 
635 SUMOReal
637  return (*myStep)->getSpeed();
638 }
639 
640 /****************************************************************************/
641 
The departure is person triggered.
SUMOTime getUntil() const
Definition: MSPerson.cpp:458
SUMOReal getAngle(SUMOTime now) const
Definition: MSPerson.cpp:470
const std::string & getID() const
returns the person id
Definition: MSPerson.cpp:551
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:409
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
const MSEdge * getFromEdge() const
Definition: MSPerson.cpp:305
SUMOTime getDesiredDepart() const
Returns the desired departure time.
Definition: MSPerson.cpp:584
virtual ~MSPerson()
destructor
Definition: MSPerson.cpp:541
const SUMOVehicleParameter * myParameter
the plan of the person
Definition: MSPerson.h:519
SUMOTime getWaitingTime(SUMOTime now) const
the time this person spent waiting
Definition: MSPerson.cpp:519
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:525
void setDeparted(SUMOTime now)
logs end of the step
Definition: MSPerson.cpp:590
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:173
virtual Position getPosition() const
return the Network coordinate of the person
Definition: MSPerson.cpp:620
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:617
std::vector< const MSEdge * > myRoute
The route of the person.
Definition: MSPerson.h:294
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSPerson.h:559
const MSEdge * getFromEdge() const
Returns the departure edge.
Definition: MSPerson.h:564
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:505
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:631
Position getPosition(SUMOTime now) const
Definition: MSPerson.cpp:165
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:486
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:61
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
Definition: MSPerson.cpp:372
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:522
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:216
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:396
T MAX3(T a, T b, T c)
Definition: StdDefs.h:86
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:91
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:554
MSPersonStage_Walking(const std::vector< const MSEdge * > &route, MSBusStop *toBS, SUMOTime walkingTime, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos)
constructor
Definition: MSPerson.cpp:119
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.
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines)
const std::string & getID() const
Returns the id.
Definition: Named.h:60
A road/street connecting two junctions.
Definition: MSEdge.h:74
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:525
void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:604
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.cpp:576
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:452
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:384
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:269
void addWaiting(const MSEdge *edge, MSPerson *person)
adds a person to the list of persons waiting for a vehicle on the specified edge
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:464
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
Definition: MSPerson.cpp:476
T MIN2(T a, T b)
Definition: StdDefs.h:66
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Definition: MSPerson.cpp:402
virtual void removePerson(MSPerson *p) const
Definition: MSEdge.h:487
const MSEdge * getFromEdge() const
Definition: MSPerson.cpp:446
virtual SUMOReal getAngle() const
return the current angle of the person
Definition: MSPerson.cpp:626
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:483
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:366
MSPersonStage_Waiting(const MSEdge &destination, SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string &actType)
constructor
Definition: MSPerson.cpp:424
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:535
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:440
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:492
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Definition: MSPerson.cpp:415
void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:596
virtual MSPersonControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:627
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:300
void setWalking(MSPerson *p)
MSPersonPlan::iterator myStep
the iterator over the route
Definition: MSPerson.h:528
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:390
bool proceed(MSNet *net, SUMOTime time)
Definition: MSPerson.cpp:557
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:636
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
Definition: MSPerson.cpp:378
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Definition: MSPerson.cpp:512
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:153
virtual SUMOReal getEdgePos() const
return the offset from the start of the current edge
Definition: MSPerson.cpp:615
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:215
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:169
virtual ~MSPersonStage()
destructor
Definition: MSPerson.cpp:66
SUMOReal myDepartPos
A vector of computed times an edge is reached.
Definition: MSPerson.h:305
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:515
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:643