SUMO - Simulation of Urban MObility
MSTransportableControl Class Reference

#include <MSTransportableControl.h>

Inheritance diagram for MSTransportableControl:
Inheritance graph
Collaboration diagram for MSTransportableControl:
Collaboration graph

Public Types

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

Public Member Functions

void abortWaiting (MSTransportable *t)
 aborts waiting stage of transportable More...
 
void abortWaitingForVehicle ()
 aborts the plan for any transportable that is still waiting for a ride More...
 
bool add (MSTransportable *transportable)
 Adds a single transportable, returns false if an id clash occured. More...
 
void addWaiting (const MSEdge *edge, MSTransportable *person)
 adds a transportable to the list of transportables 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 MSTransportable * buildContainer (const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
 Builds a new container. More...
 
virtual MSTransportable * buildPerson (const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
 Builds a new person. More...
 
void checkWaiting (MSNet *net, const SUMOTime time)
 checks whether any transportables waiting time is over More...
 
virtual void erase (MSTransportable *transportable)
 removes a single transportable More...
 
MSTransportable * get (const std::string &id) const
 Returns the named transportable, if existing. More...
 
bool hasNonWaiting () const
 checks whether any transportable is still engaged in walking / stopping More...
 
bool hasTransportables () const
 checks whether any transportable waits to finish her plan More...
 
bool loadAnyWaiting (MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
 load any applicable containers Loads any container that is waiting on that edge for the given vehicle and removes them from myWaiting More...
 
constVehIt loadedBegin () const
 Returns the begin of the internal transportables map. More...
 
constVehIt loadedEnd () const
 Returns the end of the internal transportables map. More...
 
 MSTransportableControl ()
 Constructor. More...
 
void registerJammed ()
 register a jammed transportable More...
 
void setWaitEnd (SUMOTime time, MSTransportable *transportable)
 sets the arrival time for a waiting transportable More...
 
int size () const
 Returns the number of known transportables. More...
 
virtual ~MSTransportableControl ()
 Destructor. More...
 
Retrieval of transportable statistics (always accessable)
int getLoadedNumber () const
 Returns the number of build transportables. More...
 
int getRunningNumber () const
 Returns the number of build and inserted, but not yet deleted transportables. More...
 
int getJammedNumber () const
 Returns the number of times a transportables was jammed. More...
 

Protected Attributes

bool myHaveNewWaiting
 whether a new transportable waiting for a vehicle has been added in the last step More...
 
int myJammedNumber
 The number of jammed transportables. More...
 
int myLoadedNumber
 The number of build transportables. More...
 
int myRunningNumber
 The number of transportables within the network (build and inserted but not removed) More...
 
std::map< std::string, MSTransportable * > myTransportables
 all currently created transportables by id More...
 
std::map< SUMOTime, TransportableVector > myWaiting4Departure
 Transportables waiting for departure. More...
 
std::map< const MSEdge *, TransportableVector > myWaiting4Vehicle
 the lists of waiting transportables More...
 
int myWaitingForVehicleNumber
 The number of transportables waiting for vehicles. More...
 
std::map< SUMOTime, TransportableVector > myWaitingUntil
 the lists of walking / stopping transportables More...
 

Detailed Description

The class is used to handle transportables (persons and containers) who are not using a transportation system but are walking or waiting. This includes waiting for the arrival or departure time / the time the waiting is over.

Definition at line 59 of file MSTransportableControl.h.

Member Typedef Documentation

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

Definition of the internal transportables map iterator.

Definition at line 65 of file MSTransportableControl.h.

Definition of a list of transportables.

Definition at line 62 of file MSTransportableControl.h.

Constructor & Destructor Documentation

MSTransportableControl::MSTransportableControl ( )

Constructor.

Definition at line 50 of file MSTransportableControl.cpp.

MSTransportableControl::~MSTransportableControl ( )
virtual

Destructor.

Definition at line 59 of file MSTransportableControl.cpp.

References myTransportables, and myWaiting4Vehicle.

Member Function Documentation

void MSTransportableControl::abortWaiting ( MSTransportable *  t)

aborts waiting stage of transportable

Definition at line 271 of file MSTransportableControl.cpp.

References myWaiting4Departure.

Referenced by MSTransportable::Stage_Waiting::abort().

void MSTransportableControl::abortWaitingForVehicle ( )

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

Definition at line 251 of file MSTransportableControl.cpp.

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

Referenced by MSNet::simulationState().

bool MSTransportableControl::add ( MSTransportable *  transportable)

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

Parameters
[in]transportableThe transportable to add
Returns
Whether the transportable could be added (none with the same id existed before)

Definition at line 69 of file MSTransportableControl.cpp.

References DELTA_T, SUMOVehicleParameter::depart, MSTransportable::getParameter(), SUMOVehicleParameter::id, myLoadedNumber, myTransportables, and myWaiting4Departure.

Referenced by TraCIServerAPI_Person::processSet().

void MSTransportableControl::addWaiting ( const MSEdge *  edge,
MSTransportable *  person 
)

adds a transportable to the list of transportables waiting for a vehicle on the specified edge

Definition at line 153 of file MSTransportableControl.cpp.

References myHaveNewWaiting, myWaiting4Vehicle, and myWaitingForVehicleNumber.

Referenced by MSContainer::MSContainerStage_Driving::proceed(), and MSPerson::MSPersonStage_Driving::proceed().

bool MSTransportableControl::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 / goods
[in]thestop at which the vehicle is stopping
Returns
Whether any transportables have been boarded

Definition at line 161 of file MSTransportableControl.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, myWaitingForVehicleNumber, MSEdge::removePerson(), MSVehicle::Stop::startPos, and MSVehicle::Stop::timeToBoardNextPerson.

Referenced by MSVehicle::processNextStop().

MSTransportable * MSTransportableControl::buildContainer ( const SUMOVehicleParameter *  pars,
MSVehicleType *  vtype,
MSTransportable::MSTransportablePlan *  plan 
) const
virtual

Builds a new container.

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

Reimplemented in GUITransportableControl.

Definition at line 296 of file MSTransportableControl.cpp.

Referenced by MSRouteHandler::closeContainer().

MSTransportable * MSTransportableControl::buildPerson ( const SUMOVehicleParameter *  pars,
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 GUITransportableControl.

Definition at line 290 of file MSTransportableControl.cpp.

Referenced by MSRouteHandler::closePerson(), and TraCIServerAPI_Person::processSet().

void MSTransportableControl::checkWaiting ( MSNet *  net,
const SUMOTime  time 
)

checks whether any transportables waiting time is over

Definition at line 125 of file MSTransportableControl.cpp.

References erase(), myHaveNewWaiting, myRunningNumber, myWaiting4Departure, and myWaitingUntil.

Referenced by MSNet::simulationStep().

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

Returns the named transportable, if existing.

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

Definition at line 83 of file MSTransportableControl.cpp.

References myTransportables.

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

int MSTransportableControl::getJammedNumber ( ) const
inline

Returns the number of times a transportables was jammed.

Returns
The number of times transportables were jammed

Definition at line 195 of file MSTransportableControl.h.

References myJammedNumber.

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

int MSTransportableControl::getLoadedNumber ( ) const
inline

Returns the number of build transportables.

Returns
The number of loaded (build) transportables

Definition at line 180 of file MSTransportableControl.h.

References myLoadedNumber.

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

int MSTransportableControl::getRunningNumber ( ) const
inline

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

Returns
The number of simulated transportables

Definition at line 188 of file MSTransportableControl.h.

References myRunningNumber.

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

bool MSTransportableControl::hasNonWaiting ( ) const

checks whether any transportable is still engaged in walking / stopping

Definition at line 245 of file MSTransportableControl.cpp.

References myHaveNewWaiting, myRunningNumber, myWaiting4Departure, and myWaitingForVehicleNumber.

Referenced by MSNet::simulationState().

bool MSTransportableControl::hasTransportables ( ) const

checks whether any transportable waits to finish her plan

Definition at line 239 of file MSTransportableControl.cpp.

References myTransportables.

Referenced by MSNet::simulationStep(), and MSFCDExport::write().

bool MSTransportableControl::loadAnyWaiting ( MSEdge *  edge,
MSVehicle *  vehicle,
MSVehicle::Stop *  stop 
)

load any applicable containers Loads any container that is waiting on that edge for the given vehicle and removes them from myWaiting

Parameters
[in]theedge on which the loading should take place
[in]thevehicle which is taking on containers
Returns
Whether any containers have been loaded

Definition at line 201 of file MSTransportableControl.cpp.

References MSVehicle::addContainer(), MSVehicle::Stop::duration, MSVehicle::Stop::endPos, MSVehicleType::getContainerCapacity(), MSVehicle::getContainerNumber(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSVehicleType::getLoadingDuration(), MSBaseVehicle::getParameter(), MSBaseVehicle::getVehicleType(), SUMOVehicleParameter::id, SUMOVehicleParameter::line, myWaiting4Vehicle, myWaitingForVehicleNumber, MSEdge::removeContainer(), MSVehicle::Stop::startPos, and MSVehicle::Stop::timeToLoadNextContainer.

Referenced by MSVehicle::processNextStop().

constVehIt MSTransportableControl::loadedBegin ( ) const
inline

Returns the begin of the internal transportables map.

Returns
The begin of the internal transportables map

Definition at line 149 of file MSTransportableControl.h.

References myTransportables.

Referenced by TraCIServerAPI_Person::processGet().

constVehIt MSTransportableControl::loadedEnd ( ) const
inline

Returns the end of the internal transportables map.

Returns
The end of the internal transportables map

Definition at line 157 of file MSTransportableControl.h.

References myTransportables.

Referenced by TraCIServerAPI_Person::processGet().

void MSTransportableControl::registerJammed ( )
inline

register a jammed transportable

Definition at line 170 of file MSTransportableControl.h.

References myJammedNumber.

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

void MSTransportableControl::setWaitEnd ( SUMOTime  time,
MSTransportable *  transportable 
)

sets the arrival time for a waiting transportable

Definition at line 114 of file MSTransportableControl.cpp.

References DELTA_T, myWaiting4Departure, and myWaitingUntil.

Referenced by MSTransportable::Stage_Waiting::proceed().

int MSTransportableControl::size ( ) const
inline

Returns the number of known transportables.

Returns
The number of stored transportables

Definition at line 165 of file MSTransportableControl.h.

References myTransportables.

Referenced by TraCIServerAPI_Person::processGet().

Field Documentation

bool MSTransportableControl::myHaveNewWaiting
protected

whether a new transportable waiting for a vehicle has been added in the last step

Definition at line 227 of file MSTransportableControl.h.

Referenced by addWaiting(), checkWaiting(), and hasNonWaiting().

int MSTransportableControl::myJammedNumber
protected

The number of jammed transportables.

Definition at line 221 of file MSTransportableControl.h.

Referenced by getJammedNumber(), and registerJammed().

int MSTransportableControl::myLoadedNumber
protected

The number of build transportables.

Definition at line 215 of file MSTransportableControl.h.

Referenced by add(), and getLoadedNumber().

int MSTransportableControl::myRunningNumber
protected

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

Definition at line 218 of file MSTransportableControl.h.

Referenced by checkWaiting(), erase(), getRunningNumber(), and hasNonWaiting().

std::map<std::string, MSTransportable*> MSTransportableControl::myTransportables
protected

all currently created transportables by id

Definition at line 203 of file MSTransportableControl.h.

Referenced by add(), erase(), get(), hasTransportables(), GUITransportableControl::insertPersonIDs(), loadedBegin(), loadedEnd(), size(), and ~MSTransportableControl().

std::map<SUMOTime, TransportableVector> MSTransportableControl::myWaiting4Departure
protected

Transportables waiting for departure.

Definition at line 206 of file MSTransportableControl.h.

Referenced by abortWaiting(), add(), checkWaiting(), hasNonWaiting(), and setWaitEnd().

std::map<const MSEdge*, TransportableVector> MSTransportableControl::myWaiting4Vehicle
protected

the lists of waiting transportables

Definition at line 212 of file MSTransportableControl.h.

Referenced by abortWaitingForVehicle(), addWaiting(), boardAnyWaiting(), loadAnyWaiting(), and ~MSTransportableControl().

int MSTransportableControl::myWaitingForVehicleNumber
protected

The number of transportables waiting for vehicles.

Definition at line 224 of file MSTransportableControl.h.

Referenced by addWaiting(), boardAnyWaiting(), hasNonWaiting(), and loadAnyWaiting().

std::map<SUMOTime, TransportableVector> MSTransportableControl::myWaitingUntil
protected

the lists of walking / stopping transportables

Definition at line 209 of file MSTransportableControl.h.

Referenced by checkWaiting(), and setWaitEnd().


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