SUMO - Simulation of Urban MObility
MSPersonControl Class Reference

#include <MSPersonControl.h>

Inheritance diagram for MSPersonControl:
Inheritance graph
Collaboration diagram for MSPersonControl:
Collaboration graph

Public Types

typedef std::map< std::string, MSTransportable * >::const_iterator constVehIt
 Definition of the internal persons map iterator. More...
 
typedef std::vector< MSTransportable * > PersonVector
 Definition of a list of persons. More...
 

Public Member Functions

void abortWaiting ()
 aborts the plan for any person that is still waiting for a ride More...
 
bool add (const std::string &id, MSPerson *person)
 Adds a single person, returns false if an id clash occured. More...
 
void addWaiting (const MSEdge *edge, MSTransportable *person)
 adds a person to the list of persons waiting for a vehicle on the specified edge More...
 
bool boardAnyWaiting (MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
 board any applicable persons Boards any people who wait on that edge for the given vehicle and removes them from myWaiting More...
 
virtual MSPersonbuildPerson (const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
 Builds a new person. More...
 
void checkWaitingPersons (MSNet *net, const SUMOTime time)
 checks whether any persons waiting or walking time is over More...
 
virtual void erase (MSTransportable *person)
 removes a single person More...
 
MSTransportableget (const std::string &id) const
 Returns the named person, if existing. More...
 
bool hasNonWaiting () const
 checks whether any person is still engaged in walking / stopping More...
 
bool hasPersons () const
 checks whether any person waits to finish her plan More...
 
bool isWaiting4Vehicle (const MSEdge *const edge, MSPerson *p) const
 returns whether the the given person is waiting for a vehicle on the given edge More...
 
constVehIt loadedPersonsBegin () const
 Returns the begin of the internal persons map. More...
 
constVehIt loadedPersonsEnd () const
 Returns the end of the internal persons map. More...
 
 MSPersonControl ()
 Constructor. More...
 
void registerJammed ()
 register a jammed person More...
 
void setDeparture (SUMOTime time, MSPerson *person)
 sets the arrival time for a waiting or walking person More...
 
void setWaitEnd (SUMOTime time, MSTransportable *person)
 sets the arrival time for a waiting or walking person More...
 
void setWalking (MSTransportable *p)
 
unsigned int size () const
 Returns the number of known persons. More...
 
void unsetWalking (MSTransportable *p)
 
virtual ~MSPersonControl ()
 Destructor. More...
 
Retrieval of Person statistics (always accessable)
unsigned int getLoadedPersonNumber () const
 Returns the number of build Persons. More...
 
unsigned int getRunningPersonNumber () const
 Returns the number of build and inserted, but not yet deleted Persons. More...
 
unsigned int getJammedPersonNumber () const
 Returns the number of times a person was jammed. More...
 

Protected Attributes

unsigned int myJammedPersonNumber
 The number of jammed persons. More...
 
unsigned int myLoadedPersonNumber
 The number of build persons. More...
 
std::map< std::string, MSTransportable * > myPersons
 all persons by id More...
 
unsigned int myRunningPersonNumber
 The number of persons within the network (build and inserted but not removed) More...
 
std::map< SUMOTime, PersonVectormyWaiting4Departure
 Persons waiting for departure. More...
 
std::map< const MSEdge *, PersonVectormyWaiting4Vehicle
 the lists of waiting persons More...
 
std::map< SUMOTime, PersonVectormyWaitingUntil
 the lists of walking / stopping persons More...
 
std::map< std::string, MSTransportable * > myWalking
 all persons by id More...
 

Detailed Description

The class is used to handle persons who are not using a transportation system but are walking or waiting. Both is processed by waiting for the arrival time / the time the waiting is over.

Definition at line 59 of file MSPersonControl.h.

Member Typedef Documentation

typedef std::map<std::string, MSTransportable*>::const_iterator MSPersonControl::constVehIt

Definition of the internal persons map iterator.

Definition at line 65 of file MSPersonControl.h.

Definition of a list of persons.

Definition at line 62 of file MSPersonControl.h.

Constructor & Destructor Documentation

MSPersonControl::MSPersonControl ( )

Constructor.

Definition at line 52 of file MSPersonControl.cpp.

MSPersonControl::~MSPersonControl ( )
virtual

Destructor.

Definition at line 59 of file MSPersonControl.cpp.

References myPersons, and myWaiting4Vehicle.

Member Function Documentation

void MSPersonControl::abortWaiting ( )

aborts the plan for any person that is still waiting for a ride

Definition at line 241 of file MSPersonControl.cpp.

References erase(), MSTransportable::getID(), myWaiting4Vehicle, MSEdge::removePerson(), and WRITE_WARNING.

Referenced by MSNet::simulationState().

bool MSPersonControl::add ( const std::string &  id,
MSPerson person 
)

Adds a single person, returns false if an id clash occured.

Parameters
[in]idThe id of the person
[in]personThe person to add
Returns
Whether the person could be added (none with the same id existed before)

Definition at line 69 of file MSPersonControl.cpp.

References myLoadedPersonNumber, myPersons, and myRunningPersonNumber.

void MSPersonControl::addWaiting ( const MSEdge edge,
MSTransportable person 
)

adds a person to the list of persons waiting for a vehicle on the specified edge

Definition at line 161 of file MSPersonControl.cpp.

References myWaiting4Vehicle.

Referenced by MSPerson::MSPersonStage_Driving::proceed().

bool MSPersonControl::boardAnyWaiting ( MSEdge edge,
MSVehicle vehicle,
MSVehicle::Stop stop 
)

board any applicable persons Boards any people who wait on that edge for the given vehicle and removes them from myWaiting

Parameters
[in]theedge on which the boarding should take place
[in]thevehicle which is taking on passengers
[in]thestop at which the vehicle is stopping
Returns
Whether any persons have been boarded

Definition at line 176 of file MSPersonControl.cpp.

References MSVehicle::addPerson(), DELTA_T, MSVehicle::Stop::duration, MSVehicle::Stop::endPos, MSVehicleType::getBoardingDuration(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSBaseVehicle::getParameter(), MSVehicleType::getPersonCapacity(), MSVehicle::getPersonNumber(), MSBaseVehicle::getVehicleType(), SUMOVehicleParameter::id, SUMOVehicleParameter::line, myWaiting4Vehicle, MSEdge::removePerson(), MSVehicle::Stop::startPos, and MSVehicle::Stop::timeToBoardNextPerson.

Referenced by MSVehicle::processNextStop().

MSPerson * MSPersonControl::buildPerson ( const SUMOVehicleParameter pars,
const MSVehicleType vtype,
MSTransportable::MSTransportablePlan plan 
) const
virtual

Builds a new person.

Parameters
[in]parsThe parameter
[in]vtypeThe type (reusing vehicle type container here)
[in]planThis person's plan

Reimplemented in GUIPersonControl.

Definition at line 256 of file MSPersonControl.cpp.

Referenced by MSRouteHandler::closePerson().

void MSPersonControl::checkWaitingPersons ( MSNet net,
const SUMOTime  time 
)

checks whether any persons waiting or walking time is over

Definition at line 136 of file MSPersonControl.cpp.

References erase(), myWaiting4Departure, and myWaitingUntil.

Referenced by MSNet::simulationStep().

MSTransportable * MSPersonControl::get ( const std::string &  id) const

Returns the named person, if existing.

Parameters
[in]idThe id of the person
Returns
The named person, if existing, otherwise 0

Definition at line 81 of file MSPersonControl.cpp.

References myPersons.

Referenced by TraCIServerAPI_Person::getPosition(), TraCIServerAPI_Person::processGet(), and TraCIServerAPI_Person::processSet().

unsigned int MSPersonControl::getJammedPersonNumber ( ) const
inline

Returns the number of times a person was jammed.

Returns
The number of times persons were jammed

Definition at line 189 of file MSPersonControl.h.

References myJammedPersonNumber.

Referenced by MSNet::closeSimulation(), and GUINet::getParameterWindow().

unsigned int MSPersonControl::getLoadedPersonNumber ( ) const
inline

Returns the number of build Persons.

Returns
The number of loaded (build) Persons

Definition at line 174 of file MSPersonControl.h.

References myLoadedPersonNumber.

Referenced by MSNet::closeSimulation(), and GUINet::getParameterWindow().

unsigned int MSPersonControl::getRunningPersonNumber ( ) const
inline

Returns the number of build and inserted, but not yet deleted Persons.

Returns
The number simulated Persons

Definition at line 182 of file MSPersonControl.h.

References myRunningPersonNumber.

Referenced by MSNet::closeSimulation(), and GUINet::getParameterWindow().

bool MSPersonControl::hasNonWaiting ( ) const

checks whether any person is still engaged in walking / stopping

Definition at line 220 of file MSPersonControl.cpp.

References myWaiting4Departure, myWaitingUntil, and myWalking.

Referenced by MSNet::simulationState().

bool MSPersonControl::hasPersons ( ) const

checks whether any person waits to finish her plan

Definition at line 214 of file MSPersonControl.cpp.

References myPersons.

Referenced by MSNet::simulationStep().

bool MSPersonControl::isWaiting4Vehicle ( const MSEdge *const  edge,
MSPerson p 
) const

returns whether the the given person is waiting for a vehicle on the given edge

Definition at line 170 of file MSPersonControl.cpp.

References myWaiting4Vehicle.

constVehIt MSPersonControl::loadedPersonsBegin ( ) const
inline

Returns the begin of the internal persons map.

Returns
The begin of the internal persons map

Definition at line 143 of file MSPersonControl.h.

References myPersons.

Referenced by TraCIServerAPI_Person::processGet().

constVehIt MSPersonControl::loadedPersonsEnd ( ) const
inline

Returns the end of the internal persons map.

Returns
The end of the internal persons map

Definition at line 151 of file MSPersonControl.h.

References myPersons.

Referenced by TraCIServerAPI_Person::processGet().

void MSPersonControl::registerJammed ( )
inline

register a jammed person

Definition at line 164 of file MSPersonControl.h.

References myJammedPersonNumber.

Referenced by MSPModel_Striping::PState::walk().

void MSPersonControl::setDeparture ( SUMOTime  time,
MSPerson person 
)

sets the arrival time for a waiting or walking person

Definition at line 116 of file MSPersonControl.cpp.

References DELTA_T, and myWaiting4Departure.

Referenced by MSRouteHandler::closePerson().

void MSPersonControl::setWaitEnd ( SUMOTime  time,
MSTransportable person 
)

sets the arrival time for a waiting or walking person

Definition at line 126 of file MSPersonControl.cpp.

References DELTA_T, and myWaitingUntil.

Referenced by MSPerson::MSPersonStage_Waiting::proceed().

void MSPersonControl::setWalking ( MSTransportable p)

Definition at line 226 of file MSPersonControl.cpp.

References MSTransportable::getID(), and myWalking.

Referenced by MSPerson::MSPersonStage_Walking::proceed().

unsigned int MSPersonControl::size ( ) const
inline

Returns the number of known persons.

Returns
The number of stored persons

Definition at line 159 of file MSPersonControl.h.

References myPersons.

Referenced by TraCIServerAPI_Person::processGet().

void MSPersonControl::unsetWalking ( MSTransportable p)

Field Documentation

unsigned int MSPersonControl::myJammedPersonNumber
protected

The number of jammed persons.

Definition at line 218 of file MSPersonControl.h.

Referenced by getJammedPersonNumber(), and registerJammed().

unsigned int MSPersonControl::myLoadedPersonNumber
protected

The number of build persons.

Definition at line 212 of file MSPersonControl.h.

Referenced by add(), and getLoadedPersonNumber().

std::map<std::string, MSTransportable*> MSPersonControl::myPersons
protected
unsigned int MSPersonControl::myRunningPersonNumber
protected

The number of persons within the network (build and inserted but not removed)

Definition at line 215 of file MSPersonControl.h.

Referenced by add(), erase(), and getRunningPersonNumber().

std::map<SUMOTime, PersonVector> MSPersonControl::myWaiting4Departure
protected

Persons waiting for departure.

Definition at line 203 of file MSPersonControl.h.

Referenced by checkWaitingPersons(), hasNonWaiting(), and setDeparture().

std::map<const MSEdge*, PersonVector> MSPersonControl::myWaiting4Vehicle
protected

the lists of waiting persons

Definition at line 209 of file MSPersonControl.h.

Referenced by abortWaiting(), addWaiting(), boardAnyWaiting(), isWaiting4Vehicle(), and ~MSPersonControl().

std::map<SUMOTime, PersonVector> MSPersonControl::myWaitingUntil
protected

the lists of walking / stopping persons

Definition at line 206 of file MSPersonControl.h.

Referenced by checkWaitingPersons(), hasNonWaiting(), and setWaitEnd().

std::map<std::string, MSTransportable*> MSPersonControl::myWalking
protected

all persons by id

Definition at line 200 of file MSPersonControl.h.

Referenced by hasNonWaiting(), setWalking(), and unsetWalking().


The documentation for this class was generated from the following files: