50 #ifdef CHECK_MEMORY_LEAKS
52 #endif // CHECK_MEMORY_LEAKS
65 arrivalPos, route.back()->getLength(),
SUMO_ATTR_ARRIVALPOS,
"person walking to " + route.back()->getID()), MOVING_WITHOUT_VEHICLE), myWalkingTime(walkingTime), myRoute(route),
66 myCurrentInternalEdge(0),
67 myDepartPos(departPos),
69 myPedestrianState(0) {
72 if (walkingTime > 0) {
84 if (myCurrentInternalEdge != 0) {
85 return myCurrentInternalEdge;
94 return myRoute.front();
100 return myPedestrianState->getEdgePos(*
this, now);
106 return myPedestrianState->getPosition(*
this, now);
112 return myPedestrianState->getAngle(*
this, now);
118 return myPedestrianState->getWaitingTime(*
this, now);
124 return myPedestrianState->getSpeed(*
this);
131 myRouteStep = myRoute.begin();
132 if (myWalkingTime == 0) {
133 if (!person->
proceed(net, now)) {
140 if (myWalkingTime > 0) {
141 mySpeed = computeAverageSpeed();
145 (*myRouteStep)->addPerson(person);
152 for (ConstMSEdgeVector::const_iterator i = myRoute.begin(); i != myRoute.end(); ++i) {
153 length += (*i)->getLength();
155 length -= myDepartPos;
156 length -= myRoute.back()->getLength() - myArrivalPos;
157 return length /
STEPS2TIME(myWalkingTime + 1);
170 if (myWalkingTime > 0) {
172 }
else if (mySpeed > 0) {
182 .
writeAttr(
"agent", p.
getID()).writeAttr(
"link", myRoute.front()->getID()).closeTag();
189 .
writeAttr(
"agent", p.
getID()).writeAttr(
"link", myRoute.back()->getID()).closeTag();
197 if (myRouteStep == myRoute.end() - 1) {
198 if (myDestinationStop != 0) {
199 myDestinationStop->addTransportable(person);
207 if (nextInternal == 0) {
209 myCurrentInternalEdge = 0;
211 myCurrentInternalEdge = nextInternal;
238 myWaitingEdge = previous->
getEdge();
242 myWaitingSince = now;
245 myVehicle = availableVehicle;
246 myWaitingEdge->removePerson(person);
253 myWaitingEdge->addPerson(person);
301 (*myStep)->proceed(net,
this, time, prior);
328 return nextEdge->
getID();
338 assert(walkingStage != 0);
349 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
350 (*i)->tripInfoOutput(os);
362 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
363 (*i)->routeOutput(os);
The departure is person triggered.
virtual const MSEdge * getNextEdge(const MSPerson::MSPersonStage_Walking &stage) const =0
return the list of internal edges if the pedestrian is on an intersection
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge ...
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
void setArrived(SUMOTime now)
logs end of the step
MSEdge & getEdge() const
Returns the lane's edge.
virtual bool hasDeparted() const =0
Returns whether this vehicle has departed.
virtual ~MSPerson()
destructor
A lane area vehicles can halt at.
bool isWaiting4Vehicle() const
Whether the transportable waits for a vehicle.
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
virtual const MSEdge * getEdge() const =0
Returns the current edge.
const MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
virtual SUMOReal getEdgePos(SUMOTime now) const =0
Position getPosition(SUMOTime now) const
returns the position of the transportable
std::string time2string(SUMOTime t)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const MSEdge * getNextEdgePtr() const
returns the next edge ptr if this person is walking and the pedestrian model allows it ...
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
const std::string & getID() const
returns the id of the transportable
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
virtual bool proceed(MSNet *net, SUMOTime time)=0
MSTransportablePlan::iterator myStep
the iterator over the route
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
The simulated network and simulation perfomer.
The car-following model and parameter.
SUMOReal getEdgePos(SUMOTime now) const
virtual void erase(MSTransportable *transportable)
removes a single transportable
SUMOTime getDesiredDepart() const
Returns the desired departure time.
const MSEdge * getEdge() const
Returns the current edge.
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.
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, Stage *previous)
proceeds to the next step
ConstMSEdgeVector myRoute
The route of the person.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
virtual void removePerson(MSTransportable *p) const
const MSLane & getLane() const
Returns the lane this stop is located at.
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the person arrived
const MSEdge * getEdge() const
Returns the current edge.
PedestrianState * getPedestrianState() const
Representation of a vehicle.
static MSPModel * getModel()
virtual MSTransportableControl & getPersonControl()
Returns the person control.
A point in 2D or 3D with translation and scaling methods.
SUMOReal computeAverageSpeed() const
StageType getCurrentStageType() const
the current stage type of the transportable
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
~MSPersonStage_Driving()
destructor
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
Position getWaitPosition() const
Returns the next free waiting place for pedestrians / containers.
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
void unregisterOneWaitingForPerson()
decreases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
const MSEdge & getDestination() const
Returns the current destination.
static std::string emptyString
An empty string.
SUMOReal getAngle(SUMOTime now) const
returns the angle of the transportable
const MSEdge * getFromEdge() const
Returns the departure edge.
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
MSPersonStage_Driving(const MSEdge &destination, MSStoppingPlace *toStop, const SUMOReal arrivalPos, const std::vector< std::string > &lines)
constructor
Structure representing possible vehicle parameter.
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
~MSPersonStage_Walking()
destructor
const std::string & getNextEdge() const
return the list of internal edges if this person is walking and the pedestrian model allows it ...
std::string getStageDescription() const
returns the stage description as a string
bool proceed(MSNet *net, SUMOTime time)
virtual void addPerson(MSTransportable *person)=0
Adds a person to this vehicle.
const MSEdge * getFromEdge() const
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
MSPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
constructor
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
MSTransportablePlan * myPlan
the plan of the transportable
MSPersonStage_Walking(const ConstMSEdgeVector &route, MSStoppingPlace *toStop, SUMOTime walkingTime, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos)
constructor
SUMOReal getSpeed() const
the speed of the transportable
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void lf()
writes a line feed if applicable
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
static const Position INVALID