Eclipse SUMO - Simulation of Urban MObility
GUIVehicleControl Class Reference

The class responsible for building and deletion of vehicles (gui-version) More...

#include <GUIVehicleControl.h>

Inheritance diagram for GUIVehicleControl:
Collaboration diagram for GUIVehicleControl:

Public Types

typedef std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
 Definition of the internal vehicles map iterator. More...
 

Public Member Functions

void abortWaiting ()
 informes about all waiting vehicles (deletion in destructor) More...
 
void adaptIntermodalRouter (MSNet::MSIntermodalRouter &router) const
 
bool addVehicle (const std::string &id, SUMOVehicle *v)
 Tries to insert the vehicle into the internal vehicle container. More...
 
void deleteVehicle (SUMOVehicle *v, bool discard=false)
 Deletes the vehicle. More...
 
void discountStateLoaded (bool removed=false)
 avoid counting a vehicle twice if it was loaded from state and route input More...
 
virtual int getHaltingVehicleNo () const
 Returns the number of halting vehicles. More...
 
double getMaxSpeedFactor () const
 return the maximum speed factor for all vehicles that ever entered the network More...
 
double getMinDeceleration () const
 return the minimum deceleration capability for all vehicles that ever entered the network More...
 
virtual std::pair< double, double > getVehicleMeanSpeeds () const
 get current absolute and relative mean vehicle speed in the network More...
 
 GUIVehicleControl ()
 Constructor. More...
 
void insertVehicleIDs (std::vector< GUIGlID > &into, bool listParking, bool listTeleporting)
 Returns the list of all known vehicles by gl-id. More...
 
void registerCollision ()
 registers one collision-related teleport More...
 
void registerEmergencyStop ()
 register emergency stop More...
 
void registerOneWaiting (const bool isPerson)
 increases the count of vehicles waiting for a transport to allow recognition of person / container related deadlocks More...
 
void registerTeleportJam ()
 register one non-collision-related teleport More...
 
void registerTeleportWrongLane ()
 register one non-collision-related teleport More...
 
void registerTeleportYield ()
 register one non-collision-related teleport More...
 
void releaseVehicles ()
 unlock access to vehicle removal/additions for thread synchronization More...
 
void secureVehicles ()
 lock access to vehicle removal/additions for thread synchronization More...
 
void setScale (double scale)
 sets the demand scaling factor More...
 
void unregisterOneWaiting (const bool isPerson)
 decreases the count of vehicles waiting for a transport to allow recognition of person / container related deadlocks More...
 
 ~GUIVehicleControl ()
 Destructor. More...
 
Vehicle creation
SUMOVehiclebuildVehicle (SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
 Builds a vehicle, increases the number of built vehicles. More...
 
Insertion, deletion and retrieval of vehicles
SUMOVehiclegetVehicle (const std::string &id) const
 Returns the vehicle with the given id. More...
 
void scheduleVehicleRemoval (SUMOVehicle *veh, bool checkDuplicate=false)
 Removes a vehicle after it has ended. More...
 
void removePending ()
 Removes a vehicle after it has ended. More...
 
constVehIt loadedVehBegin () const
 Returns the begin of the internal vehicle map. More...
 
constVehIt loadedVehEnd () const
 Returns the end of the internal vehicle map. More...
 
Setting vehicle statistics
void vehicleDeparted (const SUMOVehicle &v)
 Informs this control about a vehicle's departure. More...
 
Retrieval of vehicle statistics (always accessable)
int getLoadedVehicleNo () const
 Returns the number of build vehicles. More...
 
double getVehicleMeanSpeed () const
 
double getVehicleMeanSpeedRelative () const
 
int getEndedVehicleNo () const
 Returns the number of removed vehicles. More...
 
int getArrivedVehicleNo () const
 Returns the number of arrived vehicles. More...
 
int getDiscardedVehicleNo () const
 Returns the number of discarded vehicles. More...
 
int getRunningVehicleNo () const
 Returns the number of build and inserted, but not yet deleted vehicles. More...
 
int getDepartedVehicleNo () const
 Returns the number of inserted vehicles. More...
 
int getQuota (double frac=-1) const
 Returns the number of instances of the current vehicle that shall be emitted considering that "frac" of all vehicles shall be emitted overall if a negative fraction is given the demand scaling factor is used (–scale) More...
 
int getActiveVehicleCount () const
 Returns the number of build vehicles that have not been removed or need to wait for a passenger or a container. More...
 
int getCollisionCount () const
 return the number of collisions More...
 
int getTeleportsJam () const
 return the number of teleports due to jamming More...
 
int getTeleportsYield () const
 return the number of teleports due to vehicles stuck on a minor road More...
 
int getTeleportsWrongLane () const
 return the number of teleports due to vehicles stuck on the wrong lane More...
 
int getTeleportCount () const
 return the number of teleports (including collisions) More...
 
int getEmergencyStops () const
 return the number of emergency stops More...
 
double getTotalDepartureDelay () const
 Returns the total departure delay. More...
 
double getTotalTravelTime () const
 Returns the total travel time. More...
 
Insertion and retrieval of vehicle types
bool addVType (MSVehicleType *vehType)
 Adds a vehicle type. More...
 
void removeVType (const MSVehicleType *vehType)
 
bool addVTypeDistribution (const std::string &id, RandomDistributor< MSVehicleType * > *vehTypeDistribution)
 Adds a vehicle type distribution. More...
 
bool hasVType (const std::string &id) const
 Asks for existence of a vehicle type. More...
 
bool hasVTypeDistribution (const std::string &id) const
 Asks for a vehicle type distribution. More...
 
MSVehicleTypegetVType (const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
 Returns the named vehicle type or a sample from the named distribution. More...
 
void insertVTypeIDs (std::vector< std::string > &into) const
 Inserts ids of all known vehicle types and vehicle type distributions to the given vector. More...
 
const std::set< std::string > getVTypeDistributionMembership (const std::string &id) const
 Return the distribution IDs the vehicle type is a member of. More...
 
State I/O
void setState (int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime)
 Sets the current state variables as loaded from the stream. More...
 
void saveState (OutputDevice &out)
 Saves the current state into the given stream. More...
 

Private Member Functions

bool checkVType (const std::string &id)
 Checks whether the vehicle type (distribution) may be added. More...
 
 GUIVehicleControl (const GUIVehicleControl &s)
 invalidated copy constructor More...
 
bool isPendingRemoval (SUMOVehicle *veh)
 whether the given vehicle is scheduled for removal More...
 
GUIVehicleControloperator= (const GUIVehicleControl &s)
 invalidated assignment operator More...
 

Private Attributes

FXMutex myLock
 The mutex used to avoid concurrent updates of the vehicle buffer. More...
 
Vehicle statistics
double myTotalDepartureDelay
 The aggregated time vehicles had to wait for departure (in seconds) More...
 
double myTotalTravelTime
 The aggregated time vehicles needed to aacomplish their route (in seconds) More...
 

Vehicle statistics (always accessible)

int myRunningVehNo
 The number of vehicles within the network (build and inserted but not removed) More...
 
int myEndedVehNo
 The number of removed vehicles. More...
 
int myDiscarded
 The number of vehicles which were discarded while loading. More...
 
int myCollisions
 The number of collisions. More...
 
int myTeleportsJam
 The number of teleports due to jam. More...
 
int myTeleportsYield
 The number of teleports due to vehicles stuck on a minor road. More...
 
int myTeleportsWrongLane
 The number of teleports due to vehicles stuck on the wrong lane. More...
 
int myEmergencyStops
 The number of emergency stops. More...
 
int myLoadedVehNo
 The number of build vehicles. More...
 

Vehicle container

typedef std::map< std::string, SUMOVehicle * > VehicleDictType
 Vehicle dictionary type. More...
 
VehicleDictType myVehicleDict
 Dictionary of vehicles. More...
 

Vehicle type container

VTypeDictType myVTypeDict
 Dictionary of vehicle types. More...
 
VTypeDistDictType myVTypeDistDict
 A distribution of vehicle types (probability->vehicle type) More...
 
std::map< std::string, std::set< std::string > > myVTypeToDist
 Inverse lookup from vehicle type to distributions it is a member of. More...
 
bool myDefaultVTypeMayBeDeleted
 Whether the default vehicle type was already used or can still be replaced. More...
 
bool myDefaultPedTypeMayBeDeleted
 Whether the default pedestrian type was already used or can still be replaced. More...
 
bool myDefaultBikeTypeMayBeDeleted
 Whether the default bicycle type was already used or can still be replaced. More...
 
int myWaitingForPerson
 the number of vehicles wainting for persons contained in myWaiting which can only continue by being triggered More...
 
int myWaitingForContainer
 the number of vehicles wainting for containers contained in myWaiting which can only continue by being triggered More...
 
double myScale
 The scaling factor (especially for inc-dua) More...
 
double myMaxSpeedFactor
 The maximum speed factor for all vehicles in the network. More...
 
double myMinDeceleration
 The minimum deceleration capability for all vehicles in the network. More...
 
std::vector< SUMOVehicle * > myPTVehicles
 List of vehicles which belong to public transport. More...
 
std::vector< SUMOVehicle * > myPendingRemovals
 List of vehicles which are going to be removed. More...
 
typedef std::map< std::string, MSVehicleType * > VTypeDictType
 Vehicle type dictionary type. More...
 
typedef std::map< std::string, RandomDistributor< MSVehicleType * > * > VTypeDistDictType
 Vehicle type distribution dictionary type. More...
 

Detailed Description

The class responsible for building and deletion of vehicles (gui-version)

Builds GUIVehicle instances instead of MSVehicle.

See also
MSVehicleControl
Todo:

This is partially unsecure due to concurrent access...

Recheck vehicle deletion

Definition at line 46 of file GUIVehicleControl.h.

Member Typedef Documentation

◆ constVehIt

typedef std::map<std::string, SUMOVehicle*>::const_iterator MSVehicleControl::constVehIt
inherited

Definition of the internal vehicles map iterator.

Definition at line 74 of file MSVehicleControl.h.

◆ VehicleDictType

typedef std::map< std::string, SUMOVehicle* > MSVehicleControl::VehicleDictType
protectedinherited

Vehicle dictionary type.

Definition at line 567 of file MSVehicleControl.h.

◆ VTypeDictType

typedef std::map< std::string, MSVehicleType* > MSVehicleControl::VTypeDictType
privateinherited

Vehicle type dictionary type.

Definition at line 578 of file MSVehicleControl.h.

◆ VTypeDistDictType

typedef std::map< std::string, RandomDistributor<MSVehicleType*>* > MSVehicleControl::VTypeDistDictType
privateinherited

Vehicle type distribution dictionary type.

Definition at line 583 of file MSVehicleControl.h.

Constructor & Destructor Documentation

◆ GUIVehicleControl() [1/2]

GUIVehicleControl::GUIVehicleControl ( )

Constructor.

Definition at line 36 of file GUIVehicleControl.cpp.

◆ ~GUIVehicleControl()

GUIVehicleControl::~GUIVehicleControl ( )

Destructor.

Definition at line 40 of file GUIVehicleControl.cpp.

References myLock.

◆ GUIVehicleControl() [2/2]

GUIVehicleControl::GUIVehicleControl ( const GUIVehicleControl s)
private

invalidated copy constructor

Member Function Documentation

◆ abortWaiting()

void MSVehicleControl::abortWaiting ( )
inherited

informes about all waiting vehicles (deletion in destructor)

Definition at line 394 of file MSVehicleControl.cpp.

References MSVehicleControl::myVehicleDict, and WRITE_WARNING.

Referenced by MSNet::simulationState().

◆ adaptIntermodalRouter()

◆ addVehicle()

bool GUIVehicleControl::addVehicle ( const std::string &  id,
SUMOVehicle v 
)
virtual

Tries to insert the vehicle into the internal vehicle container.

Identical to the MSVehicleControl implementation except for locking.

Parameters
[in]idThe id of the vehicle
[in]vThe vehicle
Returns
Whether the vehicle could be inserted (no other vehicle with the same id was inserted before)

Reimplemented from MSVehicleControl.

Definition at line 61 of file GUIVehicleControl.cpp.

References MSVehicleControl::addVehicle(), and myLock.

◆ addVType()

bool MSVehicleControl::addVType ( MSVehicleType vehType)
inherited

Adds a vehicle type.

If another vehicle type (or distribution) with the same id exists, false is returned. Otherwise, the vehicle type is added to the internal vehicle type container "myVTypeDict".

This control get responsible for deletion of the added vehicle type.

Parameters
[in]vehTypeThe vehicle type to add
Returns
Whether the vehicle type could be added

Definition at line 301 of file MSVehicleControl.cpp.

References MSVehicleControl::checkVType(), MSVehicleType::getID(), and MSVehicleControl::myVTypeDict.

◆ addVTypeDistribution()

bool MSVehicleControl::addVTypeDistribution ( const std::string &  id,
RandomDistributor< MSVehicleType * > *  vehTypeDistribution 
)
inherited

Adds a vehicle type distribution.

If another vehicle type (or distribution) with the same id exists, false is returned. Otherwise, the vehicle type distribution is added to the internal vehicle type distribution container "myVTypeDistDict".

This control get responsible for deletion of the added vehicle type distribution.

Parameters
[in]idThe id of the distribution to add
[in]vehTypeDistributionThe vehicle type distribution to add
Returns
Whether the vehicle type could be added

Definition at line 323 of file MSVehicleControl.cpp.

References MSVehicleControl::checkVType(), RandomDistributor< T >::getVals(), MSVehicleControl::myVTypeDistDict, and MSVehicleControl::myVTypeToDist.

◆ buildVehicle()

SUMOVehicle * GUIVehicleControl::buildVehicle ( SUMOVehicleParameter defs,
const MSRoute route,
MSVehicleType type,
const bool  ignoreStopErrors,
const bool  fromRouteFile = true 
)
virtual

Builds a vehicle, increases the number of built vehicles.

Instead of a MSVehicle, a GUIVehicle is built

Parameters
[in]defsThe parameter defining the vehicle
[in]routeThe route of this vehicle
[in]typeThe type of this vehicle
[in]ignoreStopErrorswhether invalid stops trigger a warning only
[in]fromRouteFilewhether we are just reading the route file or creating via trigger, traci, ...
Returns
The built vehicle (GUIVehicle instance)
See also
MSVehicleControl::buildVehicle

Reimplemented from MSVehicleControl.

Definition at line 49 of file GUIVehicleControl.cpp.

References MSBaseVehicle::addStops(), MSVehicleType::computeChosenSpeedDeviation(), MSNet::getInstance(), MSRouteHandler::getParsingRNG(), MSNet::informVehicleStateListener(), MSVehicleControl::myLoadedVehNo, and MSNet::VEHICLE_STATE_BUILT.

◆ checkVType()

bool MSVehicleControl::checkVType ( const std::string &  id)
privateinherited

Checks whether the vehicle type (distribution) may be added.

This method checks also whether the default type may still be replaced

Parameters
[in]idThe id of the vehicle type (distribution) to add
Returns
Whether the type (distribution) may be added

Definition at line 267 of file MSVehicleControl.cpp.

References DEFAULT_BIKETYPE_ID, DEFAULT_PEDTYPE_ID, DEFAULT_VTYPE_ID, MSVehicleControl::myDefaultBikeTypeMayBeDeleted, MSVehicleControl::myDefaultPedTypeMayBeDeleted, MSVehicleControl::myDefaultVTypeMayBeDeleted, MSVehicleControl::myVTypeDict, and MSVehicleControl::myVTypeDistDict.

Referenced by MSVehicleControl::addVType(), and MSVehicleControl::addVTypeDistribution().

◆ deleteVehicle()

void GUIVehicleControl::deleteVehicle ( SUMOVehicle v,
bool  discard = false 
)
virtual

Deletes the vehicle.

Identical to the MSVehicleControl implementation except for locking.

Parameters
[in]vThe vehicle to delete
[discard]Whether the vehicle is discard during loading (scale < 1)

Reimplemented from MSVehicleControl.

Definition at line 68 of file GUIVehicleControl.cpp.

References MSVehicleControl::deleteVehicle(), and myLock.

◆ discountStateLoaded()

void MSVehicleControl::discountStateLoaded ( bool  removed = false)
inlineinherited

avoid counting a vehicle twice if it was loaded from state and route input

Definition at line 472 of file MSVehicleControl.h.

References MSVehicleControl::myDiscarded, MSVehicleControl::myEndedVehNo, MSVehicleControl::myLoadedVehNo, and MSVehicleControl::myRunningVehNo.

Referenced by MSStateHandler::closeVehicle(), and MSInsertionControl::determineCandidates().

◆ getActiveVehicleCount()

int MSVehicleControl::getActiveVehicleCount ( ) const
inlineinherited

Returns the number of build vehicles that have not been removed or need to wait for a passenger or a container.

Returns
Number of active vehicles

Definition at line 283 of file MSVehicleControl.h.

References MSVehicleControl::myEndedVehNo, MSVehicleControl::myLoadedVehNo, MSVehicleControl::myWaitingForContainer, and MSVehicleControl::myWaitingForPerson.

Referenced by libsumo::Simulation::getMinExpectedNumber(), and MSNet::simulationState().

◆ getArrivedVehicleNo()

int MSVehicleControl::getArrivedVehicleNo ( ) const
inlineinherited

Returns the number of arrived vehicles.

Returns
The number of vehicles that have arrived at their destination

Definition at line 242 of file MSVehicleControl.h.

References MSVehicleControl::myDiscarded, and MSVehicleControl::myEndedVehNo.

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

◆ getCollisionCount()

int MSVehicleControl::getCollisionCount ( ) const
inlineinherited

◆ getDepartedVehicleNo()

int MSVehicleControl::getDepartedVehicleNo ( ) const
inlineinherited

Returns the number of inserted vehicles.

Returns
The number of vehicles that have entered the simulation so far

Definition at line 265 of file MSVehicleControl.h.

References MSVehicleControl::myDiscarded, MSVehicleControl::myEndedVehNo, and MSVehicleControl::myRunningVehNo.

Referenced by MSNet::generateStatistics(), GUINet::getParameterWindow(), MSNet::postSimStepOutput(), and MSNet::writeOutput().

◆ getDiscardedVehicleNo()

int MSVehicleControl::getDiscardedVehicleNo ( ) const
inlineinherited

Returns the number of discarded vehicles.

Returns
The number of vehicles that could not be inserted and were permantently discarded

Definition at line 249 of file MSVehicleControl.h.

References MSVehicleControl::myDiscarded.

Referenced by GUINet::getParameterWindow().

◆ getEmergencyStops()

int MSVehicleControl::getEmergencyStops ( ) const
inlineinherited

return the number of emergency stops

Definition at line 312 of file MSVehicleControl.h.

References MSVehicleControl::myEmergencyStops.

Referenced by MSNet::generateStatistics().

◆ getEndedVehicleNo()

int MSVehicleControl::getEndedVehicleNo ( ) const
inlineinherited

Returns the number of removed vehicles.

Returns
The number of vehicles that have left the simulation

Definition at line 235 of file MSVehicleControl.h.

References MSVehicleControl::myEndedVehNo.

Referenced by MSNet::writeOutput().

◆ getHaltingVehicleNo()

int GUIVehicleControl::getHaltingVehicleNo ( ) const
virtual

Returns the number of halting vehicles.

Returns
The number of halting vehicles

Reimplemented from MSVehicleControl.

Definition at line 75 of file GUIVehicleControl.cpp.

References MSVehicleControl::getHaltingVehicleNo(), and myLock.

◆ getLoadedVehicleNo()

int MSVehicleControl::getLoadedVehicleNo ( ) const
inlineinherited

Returns the number of build vehicles.

Returns
The number of loaded (build) vehicles

Definition at line 213 of file MSVehicleControl.h.

References MSVehicleControl::myLoadedVehNo.

Referenced by MSNet::generateStatistics(), GUINet::getParameterWindow(), and MSNet::writeOutput().

◆ getMaxSpeedFactor()

double MSVehicleControl::getMaxSpeedFactor ( ) const
inlineinherited

return the maximum speed factor for all vehicles that ever entered the network

Definition at line 488 of file MSVehicleControl.h.

References MSVehicleControl::myMaxSpeedFactor.

Referenced by MSLane::getMaximumBrakeDist().

◆ getMinDeceleration()

double MSVehicleControl::getMinDeceleration ( ) const
inlineinherited

return the minimum deceleration capability for all vehicles that ever entered the network

Definition at line 493 of file MSVehicleControl.h.

References MSVehicleControl::myMinDeceleration.

Referenced by MSLane::getMaximumBrakeDist().

◆ getQuota()

int MSVehicleControl::getQuota ( double  frac = -1) const
inherited

Returns the number of instances of the current vehicle that shall be emitted considering that "frac" of all vehicles shall be emitted overall if a negative fraction is given the demand scaling factor is used (–scale)

Returns
the number of vehicles to create (something between 0 and ceil(frac))

Definition at line 437 of file MSVehicleControl.cpp.

References MSVehicleControl::myLoadedVehNo, and MSVehicleControl::myScale.

Referenced by MSRouteHandler::closeVehicle(), MSInsertionControl::determineCandidates(), and MSDevice::equippedByDefaultAssignmentOptions().

◆ getRunningVehicleNo()

int MSVehicleControl::getRunningVehicleNo ( ) const
inlineinherited

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

Returns
The number simulated vehicles (including those in teleporter)

Definition at line 257 of file MSVehicleControl.h.

References MSVehicleControl::myRunningVehNo.

Referenced by MSNet::generateStatistics(), GUINet::getParameterWindow(), GUIApplicationWindow::handleEvent_SimulationStep(), MSNet::postSimStepOutput(), GUINet::setSimDuration(), MSNet::simulationStep(), and MSNet::writeOutput().

◆ getTeleportCount()

int MSVehicleControl::getTeleportCount ( ) const
inherited

◆ getTeleportsJam()

int MSVehicleControl::getTeleportsJam ( ) const
inlineinherited

return the number of teleports due to jamming

Definition at line 294 of file MSVehicleControl.h.

References MSVehicleControl::myTeleportsJam.

Referenced by MSNet::generateStatistics().

◆ getTeleportsWrongLane()

int MSVehicleControl::getTeleportsWrongLane ( ) const
inlineinherited

return the number of teleports due to vehicles stuck on the wrong lane

Definition at line 304 of file MSVehicleControl.h.

References MSVehicleControl::myTeleportsWrongLane.

Referenced by MSNet::generateStatistics().

◆ getTeleportsYield()

int MSVehicleControl::getTeleportsYield ( ) const
inlineinherited

return the number of teleports due to vehicles stuck on a minor road

Definition at line 299 of file MSVehicleControl.h.

References MSVehicleControl::myTeleportsYield.

Referenced by MSNet::generateStatistics().

◆ getTotalDepartureDelay()

double MSVehicleControl::getTotalDepartureDelay ( ) const
inlineinherited

Returns the total departure delay.

Returns
Sum of steps vehicles had to wait until being inserted

Definition at line 319 of file MSVehicleControl.h.

References MSVehicleControl::myTotalDepartureDelay.

Referenced by MSNet::writeOutput().

◆ getTotalTravelTime()

double MSVehicleControl::getTotalTravelTime ( ) const
inlineinherited

Returns the total travel time.

Returns
Sum of travel times of arrived vehicles

Definition at line 327 of file MSVehicleControl.h.

References MSVehicleControl::myTotalTravelTime.

Referenced by MSNet::writeOutput().

◆ getVehicle()

◆ getVehicleMeanSpeed()

double MSVehicleControl::getVehicleMeanSpeed ( ) const
inlineinherited

Definition at line 225 of file MSVehicleControl.h.

References MSVehicleControl::getVehicleMeanSpeeds().

Referenced by GUINet::getParameterWindow().

◆ getVehicleMeanSpeedRelative()

double MSVehicleControl::getVehicleMeanSpeedRelative ( ) const
inlineinherited

Definition at line 228 of file MSVehicleControl.h.

References MSVehicleControl::getVehicleMeanSpeeds().

Referenced by GUINet::getParameterWindow().

◆ getVehicleMeanSpeeds()

std::pair< double, double > GUIVehicleControl::getVehicleMeanSpeeds ( ) const
virtual

get current absolute and relative mean vehicle speed in the network

Reimplemented from MSVehicleControl.

Definition at line 82 of file GUIVehicleControl.cpp.

References MSVehicleControl::getVehicleMeanSpeeds(), and myLock.

◆ getVType()

MSVehicleType * MSVehicleControl::getVType ( const std::string &  id = DEFAULT_VTYPE_ID,
std::mt19937 *  rng = nullptr 
)
inherited

◆ getVTypeDistributionMembership()

const std::set< std::string > MSVehicleControl::getVTypeDistributionMembership ( const std::string &  id) const
inherited

Return the distribution IDs the vehicle type is a member of.

Parameters
[in]vehTypeThe vehicle type to look for membership in distributions

Definition at line 384 of file MSVehicleControl.cpp.

References MSVehicleControl::myVTypeToDist.

Referenced by MSDevice_ToC::MSDevice_ToC(), MSDetectorFileOutput::vehicleApplies(), and MSTriggeredRerouter::vehicleApplies().

◆ hasVType()

bool MSVehicleControl::hasVType ( const std::string &  id) const
inherited

Asks for existence of a vehicle type.

If vehicle type or distribution with the id exists, true is returned, false otherwise.

Parameters
[in]idThe id of the type or distribution
Returns
Whether the vehicle type or distribution exists

Definition at line 341 of file MSVehicleControl.cpp.

References MSVehicleControl::myVTypeDict, and MSVehicleControl::myVTypeDistDict.

Referenced by libsumo::Simulation::findIntermodalRoute(), and MSDevice_ToC::MSDevice_ToC().

◆ hasVTypeDistribution()

bool MSVehicleControl::hasVTypeDistribution ( const std::string &  id) const
inherited

Asks for a vehicle type distribution.

If vehicle type distribution with the id exists, true is returned, false otherwise.

Parameters
[in]idThe id of the distribution
Returns
Whether the vehicle type distribution exists

Definition at line 347 of file MSVehicleControl.cpp.

References MSVehicleControl::myVTypeDistDict.

Referenced by MSDevice_ToC::MSDevice_ToC().

◆ insertVehicleIDs()

void GUIVehicleControl::insertVehicleIDs ( std::vector< GUIGlID > &  into,
bool  listParking,
bool  listTeleporting 
)

Returns the list of all known vehicles by gl-id.

Parameters
[fill]into The list to fill with vehicle ids
[listParking]Whether parking vehicles shall be listed as well
[listTeleporting]Whether teleporting vehicles shall be listed as well
Todo:
Well, what about concurrent modifications?

Definition at line 89 of file GUIVehicleControl.cpp.

References SUMOVehicle::isOnRoad(), SUMOVehicle::isParking(), myLock, and MSVehicleControl::myVehicleDict.

◆ insertVTypeIDs()

void MSVehicleControl::insertVTypeIDs ( std::vector< std::string > &  into) const
inherited

Inserts ids of all known vehicle types and vehicle type distributions to the given vector.

Parameters
[in]intoThe vector to fill with ids

Definition at line 372 of file MSVehicleControl.cpp.

References MSVehicleControl::myVTypeDict, and MSVehicleControl::myVTypeDistDict.

Referenced by libsumo::VehicleType::getIDList().

◆ isPendingRemoval()

bool MSVehicleControl::isPendingRemoval ( SUMOVehicle veh)
privateinherited

whether the given vehicle is scheduled for removal

Definition at line 126 of file MSVehicleControl.cpp.

References MSVehicleControl::myPendingRemovals.

Referenced by MSVehicleControl::scheduleVehicleRemoval().

◆ loadedVehBegin()

◆ loadedVehEnd()

◆ operator=()

GUIVehicleControl& GUIVehicleControl::operator= ( const GUIVehicleControl s)
private

invalidated assignment operator

◆ registerCollision()

void MSVehicleControl::registerCollision ( )
inlineinherited

◆ registerEmergencyStop()

void MSVehicleControl::registerEmergencyStop ( )
inlineinherited

register emergency stop

Definition at line 455 of file MSVehicleControl.h.

References MSVehicleControl::myEmergencyStops.

Referenced by MSVehicle::executeMove().

◆ registerOneWaiting()

void MSVehicleControl::registerOneWaiting ( const bool  isPerson)
inlineinherited

increases the count of vehicles waiting for a transport to allow recognition of person / container related deadlocks

Definition at line 416 of file MSVehicleControl.h.

References MSVehicleControl::myWaitingForContainer, and MSVehicleControl::myWaitingForPerson.

Referenced by MSVehicleControl::addVehicle(), and MSVehicle::processNextStop().

◆ registerTeleportJam()

void MSVehicleControl::registerTeleportJam ( )
inlineinherited

register one non-collision-related teleport

Definition at line 440 of file MSVehicleControl.h.

References MSVehicleControl::myTeleportsJam.

Referenced by MSLane::executeMovements(), and MELoop::teleportVehicle().

◆ registerTeleportWrongLane()

void MSVehicleControl::registerTeleportWrongLane ( )
inlineinherited

register one non-collision-related teleport

Definition at line 450 of file MSVehicleControl.h.

References MSVehicleControl::myTeleportsWrongLane.

Referenced by MSLane::executeMovements().

◆ registerTeleportYield()

void MSVehicleControl::registerTeleportYield ( )
inlineinherited

register one non-collision-related teleport

Definition at line 445 of file MSVehicleControl.h.

References MSVehicleControl::myTeleportsYield.

Referenced by MSLane::executeMovements().

◆ releaseVehicles()

void GUIVehicleControl::releaseVehicles ( )

unlock access to vehicle removal/additions for thread synchronization

Definition at line 108 of file GUIVehicleControl.cpp.

References myLock.

Referenced by GUIViewTraffic::getVehicleParamKeys().

◆ removePending()

void MSVehicleControl::removePending ( )
inherited

Removes a vehicle after it has ended.

Writes output to tripinfos and vehroutes if wished; decrements the number of running vehicles and increments the number of ended vehicles. Then deletes the vehicle using "deleteVehicle".

This method should be called for each vehicle that was inserted into the network and quits its ride.

Parameters
[in]vehThe vehicle to remove

Definition at line 135 of file MSVehicleControl.cpp.

References OutputDevice::closeTag(), MSVehicleControl::deleteVehicle(), OutputDevice::flush(), OutputDevice::getDeviceByOption(), MSNet::getInstance(), OptionsCont::getOptions(), MSNet::informVehicleStateListener(), OptionsCont::isSet(), MSVehicleControl::myPendingRemovals, MSVehicleControl::myRunningVehNo, MSVehicleControl::myTotalTravelTime, STEPS2TIME, and MSNet::VEHICLE_STATE_ARRIVED.

Referenced by MSEdgeControl::executeMovements(), and MSNet::simulationStep().

◆ removeVType()

◆ saveState()

◆ scheduleVehicleRemoval()

void MSVehicleControl::scheduleVehicleRemoval ( SUMOVehicle veh,
bool  checkDuplicate = false 
)
inherited

Removes a vehicle after it has ended.

Writes output to tripinfos and vehroutes if wished; decrements the number of running vehicles and increments the number of ended vehicles. Then deletes the vehicle using "deleteVehicle".

This method should be called for each vehicle that was inserted into the network and quits its ride.

Parameters
[in]vehThe vehicle to remove

Definition at line 117 of file MSVehicleControl.cpp.

References MSVehicleControl::isPendingRemoval(), MSVehicleControl::myPendingRemovals, and MSVehicleControl::myRunningVehNo.

Referenced by MSVehicleTransfer::add(), MELoop::changeSegment(), MSVehicleTransfer::checkInsertions(), MSLane::detectCollisions(), MSLane::executeMovements(), GUIBaseVehicle::GUIBaseVehiclePopupMenu::onCmdRemoveObject(), MESegment::receive(), libsumo::Vehicle::remove(), and MSCalibrator::removePending().

◆ secureVehicles()

void GUIVehicleControl::secureVehicles ( )

lock access to vehicle removal/additions for thread synchronization

Definition at line 102 of file GUIVehicleControl.cpp.

References myLock.

Referenced by GUIViewTraffic::getVehicleParamKeys().

◆ setScale()

void MSVehicleControl::setScale ( double  scale)
inlineinherited

sets the demand scaling factor

Definition at line 500 of file MSVehicleControl.h.

References MSVehicleControl::myScale.

Referenced by GUIApplicationWindow::onCmdDemandScale().

◆ setState()

void MSVehicleControl::setState ( int  runningVehNo,
int  loadedVehNo,
int  endedVehNo,
double  totalDepartureDelay,
double  totalTravelTime 
)
inherited

◆ unregisterOneWaiting()

void MSVehicleControl::unregisterOneWaiting ( const bool  isPerson)
inlineinherited

decreases the count of vehicles waiting for a transport to allow recognition of person / container related deadlocks

Definition at line 426 of file MSVehicleControl.h.

References MSVehicleControl::myWaitingForContainer, and MSVehicleControl::myWaitingForPerson.

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

◆ vehicleDeparted()

void MSVehicleControl::vehicleDeparted ( const SUMOVehicle v)
inherited

Field Documentation

◆ myCollisions

int MSVehicleControl::myCollisions
privateinherited

◆ myDefaultBikeTypeMayBeDeleted

bool MSVehicleControl::myDefaultBikeTypeMayBeDeleted
privateinherited

Whether the default bicycle type was already used or can still be replaced.

Definition at line 597 of file MSVehicleControl.h.

Referenced by MSVehicleControl::checkVType().

◆ myDefaultPedTypeMayBeDeleted

bool MSVehicleControl::myDefaultPedTypeMayBeDeleted
privateinherited

Whether the default pedestrian type was already used or can still be replaced.

Definition at line 594 of file MSVehicleControl.h.

Referenced by MSVehicleControl::checkVType(), and MSVehicleControl::getVType().

◆ myDefaultVTypeMayBeDeleted

bool MSVehicleControl::myDefaultVTypeMayBeDeleted
privateinherited

Whether the default vehicle type was already used or can still be replaced.

Definition at line 591 of file MSVehicleControl.h.

Referenced by MSVehicleControl::checkVType(), and MSVehicleControl::getVType().

◆ myDiscarded

int MSVehicleControl::myDiscarded
privateinherited

◆ myEmergencyStops

int MSVehicleControl::myEmergencyStops
privateinherited

The number of emergency stops.

Definition at line 546 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getEmergencyStops(), and MSVehicleControl::registerEmergencyStop().

◆ myEndedVehNo

◆ myLoadedVehNo

◆ myLock

FXMutex GUIVehicleControl::myLock
mutableprivate

The mutex used to avoid concurrent updates of the vehicle buffer.

Definition at line 124 of file GUIVehicleControl.h.

Referenced by addVehicle(), deleteVehicle(), getHaltingVehicleNo(), getVehicleMeanSpeeds(), insertVehicleIDs(), releaseVehicles(), secureVehicles(), and ~GUIVehicleControl().

◆ myMaxSpeedFactor

double MSVehicleControl::myMaxSpeedFactor
privateinherited

The maximum speed factor for all vehicles in the network.

Definition at line 609 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getMaxSpeedFactor(), and MSVehicleControl::vehicleDeparted().

◆ myMinDeceleration

double MSVehicleControl::myMinDeceleration
privateinherited

The minimum deceleration capability for all vehicles in the network.

Definition at line 612 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getMinDeceleration(), and MSVehicleControl::vehicleDeparted().

◆ myPendingRemovals

std::vector<SUMOVehicle*> MSVehicleControl::myPendingRemovals
privateinherited

List of vehicles which are going to be removed.

Definition at line 621 of file MSVehicleControl.h.

Referenced by MSVehicleControl::isPendingRemoval(), MSVehicleControl::removePending(), and MSVehicleControl::scheduleVehicleRemoval().

◆ myPTVehicles

std::vector<SUMOVehicle*> MSVehicleControl::myPTVehicles
privateinherited

List of vehicles which belong to public transport.

Definition at line 615 of file MSVehicleControl.h.

Referenced by MSVehicleControl::adaptIntermodalRouter(), MSVehicleControl::addVehicle(), and MSVehicleControl::deleteVehicle().

◆ myRunningVehNo

◆ myScale

double MSVehicleControl::myScale
privateinherited

The scaling factor (especially for inc-dua)

Definition at line 606 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getQuota(), MSVehicleControl::MSVehicleControl(), and MSVehicleControl::setScale().

◆ myTeleportsJam

int MSVehicleControl::myTeleportsJam
privateinherited

The number of teleports due to jam.

Definition at line 537 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getTeleportCount(), MSVehicleControl::getTeleportsJam(), and MSVehicleControl::registerTeleportJam().

◆ myTeleportsWrongLane

int MSVehicleControl::myTeleportsWrongLane
privateinherited

The number of teleports due to vehicles stuck on the wrong lane.

Definition at line 543 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getTeleportCount(), MSVehicleControl::getTeleportsWrongLane(), and MSVehicleControl::registerTeleportWrongLane().

◆ myTeleportsYield

int MSVehicleControl::myTeleportsYield
privateinherited

The number of teleports due to vehicles stuck on a minor road.

Definition at line 540 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getTeleportCount(), MSVehicleControl::getTeleportsYield(), and MSVehicleControl::registerTeleportYield().

◆ myTotalDepartureDelay

double MSVehicleControl::myTotalDepartureDelay
privateinherited

The aggregated time vehicles had to wait for departure (in seconds)

Definition at line 555 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getTotalDepartureDelay(), MSVehicleControl::saveState(), MSVehicleControl::setState(), and MSVehicleControl::vehicleDeparted().

◆ myTotalTravelTime

double MSVehicleControl::myTotalTravelTime
privateinherited

The aggregated time vehicles needed to aacomplish their route (in seconds)

Definition at line 558 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getTotalTravelTime(), MSVehicleControl::removePending(), MSVehicleControl::saveState(), and MSVehicleControl::setState().

◆ myVehicleDict

◆ myVTypeDict

◆ myVTypeDistDict

◆ myVTypeToDist

std::map<std::string, std::set<std::string> > MSVehicleControl::myVTypeToDist
privateinherited

Inverse lookup from vehicle type to distributions it is a member of.

Definition at line 588 of file MSVehicleControl.h.

Referenced by MSVehicleControl::addVTypeDistribution(), MSVehicleControl::getVTypeDistributionMembership(), and MSVehicleControl::removeVType().

◆ myWaitingForContainer

int MSVehicleControl::myWaitingForContainer
privateinherited

the number of vehicles wainting for containers contained in myWaiting which can only continue by being triggered

Definition at line 603 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getActiveVehicleCount(), MSVehicleControl::registerOneWaiting(), and MSVehicleControl::unregisterOneWaiting().

◆ myWaitingForPerson

int MSVehicleControl::myWaitingForPerson
privateinherited

the number of vehicles wainting for persons contained in myWaiting which can only continue by being triggered

Definition at line 600 of file MSVehicleControl.h.

Referenced by MSVehicleControl::getActiveVehicleCount(), MSVehicleControl::registerOneWaiting(), and MSVehicleControl::unregisterOneWaiting().


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