Eclipse SUMO - Simulation of Urban MObility
MSTransportableControl Class Reference

#include <MSTransportableControl.h>

Inheritance diagram for MSTransportableControl:
Collaboration diagram for MSTransportableControl:

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 abortAnyWaitingForVehicle ()
 aborts the plan for any transportable that is still waiting for a ride More...
 
void abortWaiting (MSTransportable *t)
 aborts waiting stage of transportable More...
 
void abortWaitingForVehicle (MSTransportable *t)
 let the given transportable abort waiting for a vehicle (when removing stage via TraCI) More...
 
bool add (MSTransportable *transportable)
 Adds a single transportable, returns false if an id clash occurred. 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, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToBoardNextPerson, SUMOTime &stopDuration)
 board any applicable persons Boards any people who wait on that edge for the given vehicle and removes them from myWaiting More...
 
virtual MSTransportablebuildContainer (const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
 Builds a new container. More...
 
virtual MSTransportablebuildPerson (const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, std::mt19937 *rng) 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...
 
MSTransportableget (const std::string &id) const
 Returns the named transportable, if existing. More...
 
int getActiveCount ()
 return the number of active transportable objects 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, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToLoadNextContainer, SUMOTime &stopDuration)
 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...
 

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, TransportableVectormyWaiting4Departure
 Transportables waiting for departure. More...
 
std::map< const MSEdge *, TransportableVectormyWaiting4Vehicle
 the lists of waiting transportables More...
 
int myWaitingForVehicleNumber
 The number of transportables waiting for vehicles. More...
 
std::map< SUMOTime, TransportableVectormyWaitingUntil
 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 51 of file MSTransportableControl.h.

Member Typedef Documentation

◆ constVehIt

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

Definition of the internal transportables map iterator.

Definition at line 57 of file MSTransportableControl.h.

◆ TransportableVector

Definition of a list of transportables.

Definition at line 54 of file MSTransportableControl.h.

Constructor & Destructor Documentation

◆ MSTransportableControl()

MSTransportableControl::MSTransportableControl ( )

Constructor.

Definition at line 42 of file MSTransportableControl.cpp.

◆ ~MSTransportableControl()

MSTransportableControl::~MSTransportableControl ( )
virtual

Destructor.

Definition at line 51 of file MSTransportableControl.cpp.

References myTransportables, and myWaiting4Vehicle.

Member Function Documentation

◆ abortAnyWaitingForVehicle()

void MSTransportableControl::abortAnyWaitingForVehicle ( )

◆ abortWaiting()

void MSTransportableControl::abortWaiting ( MSTransportable t)

aborts waiting stage of transportable

Definition at line 291 of file MSTransportableControl.cpp.

References myWaiting4Departure, and myWaitingUntil.

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

◆ abortWaitingForVehicle()

void MSTransportableControl::abortWaitingForVehicle ( MSTransportable t)

let the given transportable abort waiting for a vehicle (when removing stage via TraCI)

Definition at line 278 of file MSTransportableControl.cpp.

References MSTransportable::getEdge(), and myWaiting4Vehicle.

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

◆ add()

bool MSTransportableControl::add ( MSTransportable transportable)

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

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

Definition at line 61 of file MSTransportableControl.cpp.

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

Referenced by libsumo::Person::add().

◆ addWaiting()

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 145 of file MSTransportableControl.cpp.

References myHaveNewWaiting, myWaiting4Vehicle, and myWaitingForVehicleNumber.

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

◆ boardAnyWaiting()

bool MSTransportableControl::boardAnyWaiting ( MSEdge edge,
SUMOVehicle vehicle,
const SUMOVehicleParameter::Stop stop,
SUMOTime timeToBoardNextPerson,
SUMOTime stopDuration 
)

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 153 of file MSTransportableControl.cpp.

References SUMOVehicle::addPerson(), DELTA_T, SUMOVehicleParameter::Stop::endPos, MSVehicleType::getBoardingDuration(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSVehicleType::getPersonCapacity(), SUMOVehicle::getPersonNumber(), SUMOTrafficObject::getVehicleType(), myWaiting4Vehicle, myWaitingForVehicleNumber, MSEdge::removePerson(), and SUMOVehicleParameter::Stop::startPos.

Referenced by MSVehicle::processNextStop(), and MEVehicle::processStop().

◆ buildContainer()

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 318 of file MSTransportableControl.cpp.

Referenced by MSRouteHandler::closeContainer().

◆ buildPerson()

MSTransportable * MSTransportableControl::buildPerson ( const SUMOVehicleParameter pars,
MSVehicleType vtype,
MSTransportable::MSTransportablePlan plan,
std::mt19937 *  rng 
) const
virtual

Builds a new person.

Parameters
[in]parsThe parameter
[in]vtypeThe type (reusing vehicle type container here)
[in]planThis person's plan
[in]rngThe RNG to compute the optional speed deviation

Reimplemented in GUITransportableControl.

Definition at line 310 of file MSTransportableControl.cpp.

References MSVehicleType::computeChosenSpeedDeviation().

Referenced by libsumo::Person::add(), MSRouteHandler::addFlowPerson(), and MSRouteHandler::closePerson().

◆ checkWaiting()

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

checks whether any transportables waiting time is over

Definition at line 117 of file MSTransportableControl.cpp.

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

Referenced by MSNet::simulationStep().

◆ erase()

◆ get()

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 75 of file MSTransportableControl.cpp.

References myTransportables.

Referenced by libsumo::Person::getPerson(), libsumo::Polygon::getTrafficObject(), TraCIServer::postProcessSimulationStep(), and TraCIServerAPI_Person::processSet().

◆ getActiveCount()

int MSTransportableControl::getActiveCount ( )

return the number of active transportable objects

Definition at line 249 of file MSTransportableControl.cpp.

References myRunningNumber, myWaiting4Departure, and myWaitingForVehicleNumber.

Referenced by libsumo::Simulation::getMinExpectedNumber().

◆ getJammedNumber()

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::generateStatistics(), and GUINet::getParameterWindow().

◆ getLoadedNumber()

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::generateStatistics(), and GUINet::getParameterWindow().

◆ getRunningNumber()

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::generateStatistics(), GUINet::getParameterWindow(), GUIApplicationWindow::handleEvent_SimulationStep(), and MSNet::simulationStep().

◆ getWaitingForVehicleNumber()

int MSTransportableControl::getWaitingForVehicleNumber ( ) const
inline

Returns the number of vehicles waiting for a ride.

Definition at line 201 of file MSTransportableControl.h.

References myWaitingForVehicleNumber.

Referenced by GUIApplicationWindow::checkGamingEventsDRT().

◆ hasNonWaiting()

bool MSTransportableControl::hasNonWaiting ( ) const

checks whether any transportable is still engaged in walking / stopping

Definition at line 243 of file MSTransportableControl.cpp.

References myHaveNewWaiting, myRunningNumber, myWaiting4Departure, and myWaitingForVehicleNumber.

Referenced by MSNet::simulationState().

◆ hasTransportables()

bool MSTransportableControl::hasTransportables ( ) const

checks whether any transportable waits to finish her plan

Definition at line 237 of file MSTransportableControl.cpp.

References myTransportables.

Referenced by MSNet::simulationStep().

◆ loadAnyWaiting()

bool MSTransportableControl::loadAnyWaiting ( MSEdge edge,
SUMOVehicle vehicle,
const SUMOVehicleParameter::Stop stop,
SUMOTime timeToLoadNextContainer,
SUMOTime stopDuration 
)

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 198 of file MSTransportableControl.cpp.

References SUMOVehicle::addContainer(), SUMOVehicleParameter::Stop::endPos, MSVehicleType::getContainerCapacity(), SUMOVehicle::getContainerNumber(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSVehicleType::getLoadingDuration(), SUMOTrafficObject::getVehicleType(), myWaiting4Vehicle, myWaitingForVehicleNumber, MSEdge::removeContainer(), and SUMOVehicleParameter::Stop::startPos.

Referenced by MSVehicle::processNextStop(), and MEVehicle::processStop().

◆ loadedBegin()

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 MSDevice_Tripinfo::generateOutputForUnfinished(), MSDevice_Vehroutes::generateOutputForUnfinished(), and libsumo::Person::getIDList().

◆ loadedEnd()

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 MSDevice_Tripinfo::generateOutputForUnfinished(), MSDevice_Vehroutes::generateOutputForUnfinished(), and libsumo::Person::getIDList().

◆ registerJammed()

void MSTransportableControl::registerJammed ( )
inline

register a jammed transportable

Definition at line 170 of file MSTransportableControl.h.

References myJammedNumber.

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

◆ setWaitEnd()

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

sets the arrival time for a waiting transportable

Definition at line 106 of file MSTransportableControl.cpp.

References DELTA_T, myWaiting4Departure, and myWaitingUntil.

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

◆ size()

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 libsumo::Person::getIDCount().

Field Documentation

◆ myHaveNewWaiting

bool MSTransportableControl::myHaveNewWaiting
protected

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

Definition at line 233 of file MSTransportableControl.h.

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

◆ myJammedNumber

int MSTransportableControl::myJammedNumber
protected

The number of jammed transportables.

Definition at line 227 of file MSTransportableControl.h.

Referenced by getJammedNumber(), and registerJammed().

◆ myLoadedNumber

int MSTransportableControl::myLoadedNumber
protected

The number of build transportables.

Definition at line 221 of file MSTransportableControl.h.

Referenced by add(), and getLoadedNumber().

◆ myRunningNumber

int MSTransportableControl::myRunningNumber
protected

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

Definition at line 224 of file MSTransportableControl.h.

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

◆ myTransportables

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

all currently created transportables by id

Definition at line 209 of file MSTransportableControl.h.

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

◆ myWaiting4Departure

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

Transportables waiting for departure.

Definition at line 212 of file MSTransportableControl.h.

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

◆ myWaiting4Vehicle

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

◆ myWaitingForVehicleNumber

int MSTransportableControl::myWaitingForVehicleNumber
protected

The number of transportables waiting for vehicles.

Definition at line 230 of file MSTransportableControl.h.

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

◆ myWaitingUntil

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

the lists of walking / stopping transportables

Definition at line 215 of file MSTransportableControl.h.

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


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