48 #ifdef CHECK_MEMORY_LEAKS
50 #endif // CHECK_MEMORY_LEAKS
63 : myDestination(destination), myDeparted(-1), myArrived(-1), myType(type) {}
97 return getLanePosition(e->
getLanes()[0], at, offset);
124 myCurrentInternalEdge(0),
125 myDepartPos(departPos), myArrivalPos(arrivalPos), myDestinationBusStop(toBS),
127 myPedestrianState(0) {
132 if (walkingTime > 0) {
144 if (myCurrentInternalEdge != 0) {
145 return myCurrentInternalEdge;
154 return myRoute.front();
160 return myPedestrianState->getEdgePos(*
this, now);
166 return myPedestrianState->getPosition(*
this, now);
172 return myPedestrianState->getAngle(*
this, now);
178 return myPedestrianState->getWaitingTime(*
this, now);
184 return myPedestrianState->getSpeed(*
this);
192 myRouteStep = myRoute.begin();
193 if (myWalkingTime == 0) {
194 if (!person->
proceed(net, now)) {
202 if (myWalkingTime > 0) {
203 mySpeed = computeAverageSpeed();
207 ((
MSEdge*) *myRouteStep)->addPerson(person);
214 for (std::vector<const MSEdge*>::const_iterator i = myRoute.begin(); i != myRoute.end(); ++i) {
215 length += (*i)->getLength();
217 length -= myDepartPos;
218 length -= myRoute.back()->getLength() - myArrivalPos;
219 return length /
STEPS2TIME(myWalkingTime + 1);
232 if (myWalkingTime > 0) {
234 }
else if (mySpeed > 0) {
244 .
writeAttr(
"agent", p.
getID()).writeAttr(
"link", myRoute.front()->getID()).closeTag();
251 .
writeAttr(
"agent", p.
getID()).writeAttr(
"link", myRoute.back()->getID()).closeTag();
259 if (myRouteStep == myRoute.end() - 1) {
261 if (myDestinationBusStop != 0) {
262 myDestinationBusStop->addPerson(person);
270 if (nextInternal == 0) {
272 myCurrentInternalEdge = 0;
274 myCurrentInternalEdge = nextInternal;
287 MSBusStop* toBS,
const std::vector<std::string>& lines)
289 myVehicle(0), myDestinationBusStop(toBS) {}
297 if (myVehicle != 0) {
298 return myVehicle->getEdge();
300 return myWaitingEdge;
306 return myWaitingEdge;
312 if (myVehicle != 0) {
322 if (myVehicle != 0) {
324 return myVehicle->getEdge()->getLanes()[0]->getShape().positionAtOffset(myVehicle->getPositionOnLane());
332 if (myVehicle != 0) {
340 return getEdgeAngle(myWaitingEdge, myWaitingPos);
348 myWaitingEdge = previousEdge;
350 myWaitingSince = now;
352 if (myVehicle != 0 && myVehicle->getParameter().departProcedure ==
DEPART_TRIGGERED) {
354 myVehicle->addPerson(person);
367 return myLines.count(line) > 0;
373 return myVehicle == 0;
385 return myVehicle == 0 ? 0 : myVehicle->getSpeed();
427 myWaitingDuration(duration),
428 myWaitingUntil(until),
441 return &myDestination;
447 return &myDestination;
459 return myWaitingUntil;
471 return getEdgeAngle(&myDestination, myStartPos) + 45;
479 myWaitingStart = now;
480 const SUMOTime until =
MAX3(now, now + myWaitingDuration, myWaitingUntil);
494 if (myWaitingDuration >= 0) {
497 if (myWaitingUntil >= 0) {
520 return now - myWaitingStart;
542 for (MSPersonPlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
559 SUMOReal atPos = (*myStep)->getEdgePos(time);
561 (*myStep)->setArrived(time);
569 (*myStep)->proceed(net,
this, time, arrivedAt, atPos);
591 (*myStep)->setDeparted(now);
597 for (MSPersonPlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
598 (*i)->tripInfoOutput(os);
605 MSPersonPlan::const_iterator i =
myPlan->begin();
609 for (; i !=
myPlan->end(); ++i) {
610 (*i)->routeOutput(os);
637 return (*myStep)->getSpeed();
The departure is person triggered.
SUMOTime getUntil() const
SUMOReal getAngle(SUMOTime now) const
const std::string & getID() const
returns the person id
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
virtual void beginEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
Representation of a vehicle in the micro simulation.
const MSEdge * getFromEdge() const
SUMOTime getDesiredDepart() const
Returns the desired departure time.
virtual ~MSPerson()
destructor
const SUMOVehicleParameter * myParameter
the plan of the person
SUMOTime getWaitingTime(SUMOTime now) const
the time this person spent waiting
const MSEdge & getDestination() const
returns the destination edge
Position getLanePosition(const MSLane *lane, SUMOReal at, SUMOReal offset) const
get position on lane at length at with orthogonal offset
SUMOReal getSpeed() const
the time this person spent waiting
void setDeparted(SUMOTime now)
logs end of the step
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
virtual Position getPosition() const
return the Network coordinate of the person
MSPersonStage(const MSEdge &destination, StageType type)
constructor
const MSEdge * getEdge() const
Returns the current edge.
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
std::vector< const MSEdge * > myRoute
The route of the person.
const MSEdge * getEdge() const
Returns the current edge.
const MSEdge * getFromEdge() const
Returns the departure edge.
virtual bool isWaitingFor(const std::string &line) const
Whether the person waits for a vehicle of the line specified.
virtual void beginEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
void setDeparted(SUMOTime now)
logs end of the step
virtual SUMOReal getWaitingSeconds() const
the time this person spent waiting in seconds
Position getPosition(SUMOTime now) const
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
std::string time2string(SUMOTime t)
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
SUMOReal getEdgePos(SUMOTime now) const
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
const MSVehicleType * myVType
This Persons's type. (mainly used for drawing related information.
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
SUMOReal getEdgeAngle(const MSEdge *e, SUMOReal at) const
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
The simulated network and simulation perfomer.
The car-following model and parameter.
SUMOReal getEdgePos(SUMOTime now) const
const MSEdge & getDestination() const
Returns the current destination.
MSPersonStage_Walking(const std::vector< const MSEdge * > &route, MSBusStop *toBS, SUMOTime walkingTime, SUMOReal speed, SUMOReal departPos, SUMOReal arrivalPos)
constructor
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.
SUMOVehicle * getWaitingVehicle(const MSEdge *const edge, const std::set< std::string > &lines)
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
Position getEdgePosition(const MSEdge *e, SUMOReal at, SUMOReal offset) const
get position on edge e at length at with orthogonal offset
MSPersonPlan * myPlan
the plan of the person
void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
SUMOReal getLength() const
return the length of the edge
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the person arrived
SUMOReal getEdgePos(SUMOTime now) const
static MSPModel * getModel()
A point in 2D or 3D with translation and scaling methods.
SUMOReal getAngle(SUMOTime now) const
SUMOReal getSpeed() const
the time this person spent waiting
A lane area vehicles can halt at.
SUMOReal computeAverageSpeed() const
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
void addWaiting(const MSEdge *edge, MSPerson *person)
adds a person to the list of persons waiting for a vehicle on the specified edge
~MSPersonStage_Driving()
destructor
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
SUMOTime depart
The vehicle's departure time.
Position getPosition(SUMOTime now) const
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
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
virtual void removePerson(MSPerson *p) const
const MSEdge * getFromEdge() const
virtual SUMOReal getAngle() const
return the current angle of the person
void setWaitEnd(SUMOTime time, MSPerson *person)
sets the arrival time for a waiting or walking person
virtual void addPerson(MSPerson *p) const
void unsetWalking(MSPerson *p)
SUMOTime getWaitingTime(SUMOTime now) const
the time this person spent waiting
bool isWaitingFor(const std::string &line) const
Whether the person waits for a vehicle of the line specified.
MSPersonStage_Waiting(const MSEdge &destination, SUMOTime duration, SUMOTime until, SUMOReal pos, const std::string &actType)
constructor
void unregisterOneWaitingForPerson()
decreases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
SUMOReal getAngle(SUMOTime now) const
MSPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSPersonPlan *plan)
constructor
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.
const MSEdge * getEdge() const
Returns the current edge.
static const SUMOReal SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk ...
Structure representing possible vehicle parameter.
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
virtual MSPersonControl & getPersonControl()
Returns the person control.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
void setWalking(MSPerson *p)
MSPersonPlan::iterator myStep
the iterator over the route
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
~MSPersonStage_Walking()
destructor
~MSPersonStage_Waiting()
destructor
Position getPosition(SUMOTime now) const
std::string getStageDescription() const
return string representation of the current stage
bool proceed(MSNet *net, SUMOTime time)
MSPersonStage_Driving(const MSEdge &destination, MSBusStop *toBS, const std::vector< std::string > &lines)
constructor
virtual SUMOReal getSpeed() const
the current speed of the person
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
virtual void endEventOutput(const MSPerson &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
const MSEdge * getFromEdge() const
const PositionVector & getShape() const
Returns this lane's shape.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
virtual SUMOReal getEdgePos() const
return the offset from the start of the current edge
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
virtual void proceed(MSNet *net, MSPerson *person, SUMOTime now, MSEdge *previousEdge, const SUMOReal at)
proceeds to the next step
const MSEdge & myDestination
the next edge to reach (either by walking or driving)
virtual ~MSPersonStage()
destructor
SUMOReal myDepartPos
A vector of computed times an edge is reached.
SUMOReal getSpeed() const
the time this person spent waiting
void setArrived(SUMOTime now)
logs end of the step
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.
std::vector< MSPersonStage * > MSPersonPlan
the structure holding the plan of a person
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
virtual void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
std::string id
The vehicle's id.
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.