SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSVehicle Class Reference

Representation of a vehicle in the micro simulation. More...

#include <MSVehicle.h>

Inheritance diagram for MSVehicle:
MSBaseVehicle SUMOVehicle GUIVehicle

Data Structures

struct  DriveProcessItem
 
class  Influencer
 Changes the wished vehicle speed / lanes. More...
 
struct  LaneQ
 A structure representing the best lanes for continuing the route. More...
 
class  State
 Container that holds the vehicles driving state (position+speed). More...
 
struct  Stop
 Definition of vehicle stop (position and duration) More...
 

Public Types

enum  ChangeRequest { REQUEST_NONE, REQUEST_LEFT, REQUEST_RIGHT, REQUEST_HOLD }
 Requests set via TraCI. More...
 

Public Member Functions

void activateReminders (const MSMoveReminder::Notification reason)
 "Activates" all current move reminder More...
 
void addReminder (MSMoveReminder *rem)
 Adds a MoveReminder dynamically. More...
 
void addStops (const bool ignoreStopErrors)
 Adds stops to the built vehicle. More...
 
bool addTraciStop (MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered, bool containerTriggered, std::string &errorMsg)
 
bool congested () const
 
void enterLaneAtInsertion (MSLane *enteredLane, SUMOReal pos, SUMOReal speed, MSMoveReminder::Notification notification)
 Update when the vehicle enters a new lane in the emit step. More...
 
void enterLaneAtLaneChange (MSLane *enteredLane)
 Update when the vehicle enters a new lane in the laneChange step. More...
 
bool enterLaneAtMove (MSLane *enteredLane, bool onTeleporting=false)
 Update when the vehicle enters a new lane in the move step. More...
 
bool executeMove ()
 Executes planned vehicle movements with regards to right-of-way. More...
 
bool fixPosition ()
 repair errors in vehicle position after changing between internal edges More...
 
virtual SUMOReal getArrivalPos () const
 Returns this vehicle's desired arrivalPos for its current route (may change on reroute) More...
 
const MSCFModelgetCarFollowModel () const
 Returns the vehicle's car following model definition. More...
 
MSCFModel::VehicleVariablesgetCarFollowVariables () const
 Returns the vehicle's car following model variables. More...
 
SUMOReal getChosenSpeedFactor () const
 Returns the precomputed factor by which the driver wants to be faster than the speed limit. More...
 
const MSRouteIteratorgetCurrentRouteEdge () const
 Returns an iterator pointing to the current edge in this vehicles route. More...
 
SUMOTime getDeparture () const
 Returns this vehicle's real departure time. More...
 
MSDevicegetDevice (const std::type_info &type) const
 Returns a device of the given type if it exists or 0. More...
 
const std::vector< MSDevice * > & getDevices () const
 Returns this vehicle's devices. More...
 
SUMOReal getDistanceToPosition (SUMOReal destPos, const MSEdge *destEdge)
 
const MSEdgegetEdge () const
 Returns the edge the vehicle is currently at. More...
 
const std::string & getID () const
 Returns the name of the vehicle. More...
 
SUMOReal getImpatience () const
 Returns this vehicles impatience. More...
 
InfluencergetInfluencer ()
 Returns the velocity/lane influencer. More...
 
MSAbstractLaneChangeModelgetLaneChangeModel ()
 
const MSAbstractLaneChangeModelgetLaneChangeModel () const
 
unsigned int getLaneIndex () const
 
std::pair< const MSVehicle
*const, SUMOReal
getLeader (SUMOReal dist=0) const
 Returns the leader of the vehicle looking for a fixed distance. More...
 
SUMOReal getMaxSpeed () const
 Returns the maximum speed. More...
 
StopgetNextStop ()
 
unsigned int getNumberReroutes () const
 Returns the number of new routes this vehicle got. More...
 
const SUMOVehicleParametergetParameter () const
 Returns the vehicle's parameter (including departure definition) More...
 
const MSRoutegetRoute () const
 Returns the current route. More...
 
SUMOReal getSafeFollowSpeed (const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, const MSLane *const lane, SUMOReal distToCrossing) const
 compute safe speed for following the given leader More...
 
SUMOReal getSpeedWithoutTraciInfluence () const
 Returns the uninfluenced velocity. More...
 
SUMOReal getTimeGap () const
 Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance. More...
 
SUMOVehicleClass getVClass () const
 Returns the vehicle's access class. More...
 
const MSVehicleTypegetVehicleType () const
 Returns the vehicle's type definition. More...
 
bool hasDeparted () const
 Returns whether this vehicle has already departed. More...
 
bool hasInfluencer () const
 
bool hasValidRoute (std::string &msg) const
 Validates the current route. More...
 
int influenceChangeDecision (int state)
 allow TraCI to influence a lane change decision More...
 
bool knowsEdgeTest (MSEdge &edge) const
 
void leaveLane (const MSMoveReminder::Notification reason)
 Update of members if vehicle leaves a new lane in the lane change step or at arrival. More...
 
 MSVehicle (SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
 Constructor. More...
 
void onDepart ()
 Called when the vehicle is inserted into the network. More...
 
void planMove (const SUMOTime t, const MSVehicle *pred, const SUMOReal lengthsInFront)
 Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step. Also registers ApproachingVehicleInformation for all links. More...
 
SUMOReal processNextStop (SUMOReal currentVelocity)
 Processes stops, returns the velocity needed to reach the stop. More...
 
void removeReminder (MSMoveReminder *rem)
 Removes a MoveReminder dynamically. More...
 
bool replaceRouteEdges (ConstMSEdgeVector &edges, bool onInit=false)
 Replaces the current route by the given edges. More...
 
void replaceVehicleType (MSVehicleType *type)
 Replaces the current vehicle type by the one given. More...
 
void reroute (SUMOTime t, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false)
 Performs a rerouting using the given router. More...
 
bool resumeFromStopping ()
 
void setChosenSpeedFactor (const SUMOReal factor)
 Returns the precomputed factor by which the driver wants to be faster than the speed limit. More...
 
void setTentativeLaneAndPosition (MSLane *lane, const SUMOReal pos)
 set tentative lane and position during insertion to ensure that all cfmodels work (some of them require veh->getLane() to return a valid lane) Once the vehicle is sucessfully inserted the lane is set again (see enterLaneAtInsertion) More...
 
const MSEdgesuccEdge (unsigned int nSuccs) const
 Returns the nSuccs'th successor of edge the vehicle is currently at. More...
 
virtual ~MSVehicle ()
 Destructor. More...
 
insertion/removal
void onRemovalFromNet (const MSMoveReminder::Notification reason)
 Called when the vehicle is removed from the network. More...
 
interaction with the route
bool hasArrived () const
 Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) More...
 
bool replaceRoute (const MSRoute *route, bool onInit=false, int offset=0)
 Replaces the current route by the given one. More...
 
bool willPass (const MSEdge *const edge) const
 Returns whether the vehicle wil pass the given edge. More...
 
unsigned int getRoutePosition () const
 
void resetRoutePosition (unsigned int index)
 
const MSEdgeWeightsStoragegetWeightsStorage () const
 Returns the vehicle's internal edge travel times/efforts container. More...
 
MSEdgeWeightsStoragegetWeightsStorage ()
 
state setter/getter
SUMOReal getPositionOnLane () const
 Get the vehicle's position along the lane. More...
 
SUMOReal getSpeed () const
 Returns the vehicle's current speed. More...
 
SUMOReal getAcceleration () const
 Returns the vehicle's acceleration in m/s. More...
 
Other getter methods
SUMOReal getSlope () const
 Returns the slope of the road at vehicle's position. More...
 
Position getPosition (const SUMOReal offset=0) const
 Return current position (x/y, cartesian) More...
 
MSLanegetLane () const
 Returns the lane the vehicle is on. More...
 
bool isOnRoad () const
 Returns the information whether the vehicle is on a road (is simulated) More...
 
const MSEdgegetRerouteOrigin () const
 Returns the starting point for reroutes (usually the current edge) More...
 
SUMOTime getWaitingTime () const
 Returns the SUMOTime waited (speed was lesser than 0.1m/s) More...
 
SUMOReal getWaitingSeconds () const
 Returns the number of seconds waited (speed was lesser than 0.1m/s) More...
 
SUMOReal getAngle () const
 Returns the vehicle's direction in degrees. More...
 
strategical/tactical lane choosing methods
const std::vector< LaneQ > & getBestLanes () const
 Returns the description of best lanes to use in order to continue the route. More...
 
void updateBestLanes (bool forceRebuild=false, const MSLane *startLane=0)
 computes the best lanes to use in order to continue the route More...
 
const std::vector< MSLane * > & getBestLanesContinuation () const
 Returns the subpart of best lanes that describes the vehicle's current lane and their successors. More...
 
const std::vector< MSLane * > & getBestLanesContinuation (const MSLane *const l) const
 Returns the subpart of best lanes that describes the given lane and their successors. More...
 
int getBestLaneOffset () const
 returns the current offset from the best lane More...
 
void adaptBestLanesOccupation (int laneIndex, SUMOReal density)
 update occupation from MSLaneChanger More...
 
vehicle stops definitions and i/o
bool addStop (const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
 Adds a stop. More...
 
bool hasStops () const
 Returns whether the vehicle has to stop somewhere. More...
 
bool isStopped () const
 Returns whether the vehicle is at a stop. More...
 
bool isParking () const
 Returns whether the vehicle is parking. More...
 
bool isStoppedTriggered () const
 Returns whether the vehicle is on a triggered stop. More...
 
bool isStoppedInRange (SUMOReal pos) const
 return whether the given position is within range of the current stop More...
 
Emission retrieval
SUMOReal getCO2Emissions () const
 Returns CO2 emission of the current state. More...
 
SUMOReal getCOEmissions () const
 Returns CO emission of the current state. More...
 
SUMOReal getHCEmissions () const
 Returns HC emission of the current state. More...
 
SUMOReal getNOxEmissions () const
 Returns NOx emission of the current state. More...
 
SUMOReal getPMxEmissions () const
 Returns PMx emission of the current state. More...
 
SUMOReal getFuelConsumption () const
 Returns fuel consumption of the current state. More...
 
SUMOReal getHarmonoise_NoiseEmissions () const
 Returns noise emissions of the current state. More...
 
Interaction with persons
void addPerson (MSPerson *person)
 Adds a passenger. More...
 
Interaction with containers
void addContainer (MSContainer *container)
 Adds a container. More...
 
unsigned int getPersonNumber () const
 Returns the number of persons. More...
 
unsigned int getContainerNumber () const
 Returns the number of containers. More...
 
state io
void saveState (OutputDevice &out)
 Saves the states of a vehicle. More...
 
void loadState (const SUMOSAXAttributes &attrs, const SUMOTime offset)
 Loads the state of this vehicle from the given description. More...
 

Static Public Member Functions

static SUMOReal gap (SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
 Uses the given values to compute the brutto-gap. More...
 
static bool overlap (const MSVehicle *veh1, const MSVehicle *veh2)
 

Protected Types

typedef std::vector
< DriveProcessItem
DriveItemVector
 

Protected Member Functions

void adaptToLeader (const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass, SUMOReal distToCrossing=-1) const
 
void calculateArrivalPos ()
 (Re-)Calculates the arrival position from the vehicle parameters More...
 
void checkRewindLinkLanes (const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
 
SUMOReal estimateLeaveSpeed (const MSLink *const link, const SUMOReal vLinkPass) const
 estimate leaving speed when accelerating across a link More...
 
SUMOReal estimateSpeedAfterDistance (const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
 
SUMOReal getSpaceTillLastStanding (const MSLane *l, bool &foundStopped) const
 
const ConstMSEdgeVector getStopEdges () const
 Returns the list of still pending stop edges. More...
 
void planMoveInternal (const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
 
void setBlinkerInformation ()
 
void updateOccupancyAndCurrentBestLane (const MSLane *startLane)
 updates LaneQ::nextOccupation and myCurrentLaneInBestLanes More...
 

Protected Attributes

SUMOReal myAcceleration
 The current acceleration after dawdling in m/s. More...
 
bool myAmOnNet
 Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) More...
 
bool myAmRegisteredAsWaitingForContainer
 Whether this vehicle is registered as waiting for a container (for deadlock-recognition) More...
 
bool myAmRegisteredAsWaitingForPerson
 Whether this vehicle is registered as waiting for a person (for deadlock-recognition) More...
 
SUMOReal myArrivalPos
 the position on the destination lane where the vehicle stops More...
 
std::vector< std::vector< LaneQ > > myBestLanes
 
Position myCachedPosition
 
SUMOReal myChosenSpeedFactor
 A precomputed factor by which the driver wants to be faster than the speed limit. More...
 
MSDevice_ContainermyContainerDevice
 The containers this vehicle may have. More...
 
MSRouteIterator myCurrEdge
 Iterator to current route-edge. More...
 
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
 
SUMOTime myDeparture
 The real departure time. More...
 
std::vector< MSDevice * > myDevices
 The devices this vehicle has. More...
 
std::vector< MSLane * > myFurtherLanes
 The information into which lanes the vehicle laps into. More...
 
bool myHaveToWaitOnNextLink
 
MSLanemyLane
 The lane the vehicle is on. More...
 
MSAbstractLaneChangeModelmyLaneChangeModel
 
const MSEdgemyLastBestLanesEdge
 
const MSLanemyLastBestLanesInternalLane
 
DriveItemVector myLFLinkLanes
 Container for used Links/visited Lanes during lookForward. More...
 
unsigned int myNumberReroutes
 The number of reroutings. More...
 
const SUMOVehicleParametermyParameter
 This Vehicle's parameter. More...
 
MSDevice_PersonmyPersonDevice
 The passengers this vehicle may have. More...
 
const MSRoutemyRoute
 This Vehicle's route. More...
 
int mySignals
 State of things of the vehicle that can be on or off. More...
 
State myState
 This Vehicles driving state (pos and speed) More...
 
std::list< StopmyStops
 The vehicle's list of stops. More...
 
const MSVehicleTypemyType
 This Vehicle's type. More...
 
SUMOTime myWaitingTime
 The time the vehicle waits (is not faster than 0.1m/s) in seconds. More...
 

Static Protected Attributes

static std::vector< MSLane * > myEmptyLaneVector
 

Private Member Functions

MSEdgeWeightsStorage_getWeightsStorage () const
 
 MSVehicle ()
 invalidated default constructor More...
 
 MSVehicle (const MSVehicle &)
 invalidated copy constructor More...
 
MSVehicleoperator= (const MSVehicle &)
 invalidated assignment operator More...
 

Private Attributes

MSCFModel::VehicleVariablesmyCFVariables
 The per vehicle variables of the car following model. More...
 
MSEdgeWeightsStoragemyEdgeWeights
 
InfluencermyInfluencer
 An instance of a velocity/lane influencing instance; built in "getInfluencer". More...
 

Friends

class MSLaneChanger
 the lane changer sets myLastLaneChangeOffset More...
 

Move reminder structures

typedef std::vector< std::pair
< MSMoveReminder *, SUMOReal > > 
MoveReminderCont
 Definition of a move reminder container. More...
 
MoveReminderCont myMoveReminders
 Current lane's move reminder. More...
 

Interaction with move reminders

void workOnMoveReminders (SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
 Processes active move reminder. More...
 
void adaptLaneEntering2MoveReminder (const MSLane &enteredLane)
 Adapts the vehicle's entering of a new lane. More...
 

Access to bool signals

enum  Signalling {
  VEH_SIGNAL_NONE = 0, VEH_SIGNAL_BLINKER_RIGHT = 1, VEH_SIGNAL_BLINKER_LEFT = 2, VEH_SIGNAL_BLINKER_EMERGENCY = 4,
  VEH_SIGNAL_BRAKELIGHT = 8, VEH_SIGNAL_FRONTLIGHT = 16, VEH_SIGNAL_FOGLIGHT = 32, VEH_SIGNAL_HIGHBEAM = 64,
  VEH_SIGNAL_BACKDRIVE = 128, VEH_SIGNAL_WIPER = 256, VEH_SIGNAL_DOOR_OPEN_LEFT = 512, VEH_SIGNAL_DOOR_OPEN_RIGHT = 1024,
  VEH_SIGNAL_EMERGENCY_BLUE = 2048, VEH_SIGNAL_EMERGENCY_RED = 4096, VEH_SIGNAL_EMERGENCY_YELLOW = 8192
}
 Some boolean values which describe the state of some vehicle parts. More...
 
enum  LaneChangeMode { LC_NEVER = 0, LC_NOCONFLICT = 1, LC_ALWAYS = 2 }
 modes for resolving conflicts between external control (traci) and vehicle control over lane changing. Each level of the lane-changing hierarchy (strategic, cooperative, speedGain, keepRight) can be controlled separately More...
 
enum  TraciLaneChangePriority { LCP_ALWAYS = 0, LCP_NOOVERLAP = 1, LCP_URGENT = 2, LCP_OPPORTUNISTIC = 3 }
 modes for prioritizing traci lane change requests More...
 
void switchOnSignal (int signal)
 Switches the given signal on. More...
 
void switchOffSignal (int signal)
 Switches the given signal off. More...
 
int getSignals () const
 Returns the signals. More...
 
bool signalSet (int which) const
 Returns whether the given signal is on. More...
 

Detailed Description

Representation of a vehicle in the micro simulation.

Definition at line 80 of file MSVehicle.h.

Member Typedef Documentation

typedef std::vector< DriveProcessItem > MSVehicle::DriveItemVector
protected

Definition at line 1249 of file MSVehicle.h.

typedef std::vector< std::pair<MSMoveReminder*, SUMOReal> > MSBaseVehicle::MoveReminderCont
protectedinherited

Definition of a move reminder container.

Definition at line 353 of file MSBaseVehicle.h.

Member Enumeration Documentation

Requests set via TraCI.

Enumerator
REQUEST_NONE 

vehicle doesn't want to change

REQUEST_LEFT 

vehicle want's to change to left lane

REQUEST_RIGHT 

vehicle want's to change to right lane

REQUEST_HOLD 

vehicle want's to keep the current lane

Definition at line 128 of file MSVehicle.h.

modes for resolving conflicts between external control (traci) and vehicle control over lane changing. Each level of the lane-changing hierarchy (strategic, cooperative, speedGain, keepRight) can be controlled separately

Enumerator
LC_NEVER 
LC_NOCONFLICT 
LC_ALWAYS 

Definition at line 794 of file MSVehicle.h.

Some boolean values which describe the state of some vehicle parts.

Enumerator
VEH_SIGNAL_NONE 

Everything is switched off.

VEH_SIGNAL_BLINKER_RIGHT 

Right blinker lights are switched on.

VEH_SIGNAL_BLINKER_LEFT 

Left blinker lights are switched on.

VEH_SIGNAL_BLINKER_EMERGENCY 

Blinker lights on both sides are switched on.

VEH_SIGNAL_BRAKELIGHT 

The brake lights are on.

VEH_SIGNAL_FRONTLIGHT 

The front lights are on (no visualisation)

VEH_SIGNAL_FOGLIGHT 

The fog lights are on (no visualisation)

VEH_SIGNAL_HIGHBEAM 

The high beam lights are on (no visualisation)

VEH_SIGNAL_BACKDRIVE 

The backwards driving lights are on (no visualisation)

VEH_SIGNAL_WIPER 

The wipers are on.

VEH_SIGNAL_DOOR_OPEN_LEFT 

One of the left doors is opened.

VEH_SIGNAL_DOOR_OPEN_RIGHT 

One of the right doors is opened.

VEH_SIGNAL_EMERGENCY_BLUE 

A blue emergency light is on.

VEH_SIGNAL_EMERGENCY_RED 

A red emergency light is on.

VEH_SIGNAL_EMERGENCY_YELLOW 

A yellow emergency light is on.

Definition at line 756 of file MSVehicle.h.

modes for prioritizing traci lane change requests

Enumerator
LCP_ALWAYS 
LCP_NOOVERLAP 
LCP_URGENT 
LCP_OPPORTUNISTIC 

Definition at line 802 of file MSVehicle.h.

Constructor & Destructor Documentation

MSVehicle::MSVehicle ( SUMOVehicleParameter pars,
const MSRoute route,
const MSVehicleType type,
const SUMOReal  speedFactor 
)
MSVehicle::~MSVehicle ( )
virtual
MSVehicle::MSVehicle ( )
private

invalidated default constructor

MSVehicle::MSVehicle ( const MSVehicle )
private

invalidated copy constructor

Member Function Documentation

MSEdgeWeightsStorage & MSVehicle::_getWeightsStorage ( ) const
private

Definition at line 538 of file MSVehicle.cpp.

References myEdgeWeights.

Referenced by getWeightsStorage().

void MSVehicle::activateReminders ( const MSMoveReminder::Notification  reason)
virtual

"Activates" all current move reminder

For all move reminder stored in "myMoveReminders", their method "MSMoveReminder::notifyEnter" is called.

Parameters
[in]reasonThe reason for changing the reminders' states
See also
MSMoveReminder
MSMoveReminder::notifyEnter
MSMoveReminder::Notification

Reimplemented from MSBaseVehicle.

Definition at line 1696 of file MSVehicle.cpp.

References getLane(), and MSBaseVehicle::myMoveReminders.

Referenced by enterLaneAtInsertion(), enterLaneAtLaneChange(), and enterLaneAtMove().

void MSVehicle::adaptBestLanesOccupation ( int  laneIndex,
SUMOReal  density 
)

update occupation from MSLaneChanger

Definition at line 2206 of file MSVehicle.cpp.

References myBestLanes.

Referenced by MSLaneChanger::change().

void MSVehicle::adaptLaneEntering2MoveReminder ( const MSLane enteredLane)
protected

Adapts the vehicle's entering of a new lane.

All offsets already stored in "myOldLaneMoveReminderOffsets" are increased by the length that has been left. All still active move reminders from "myMoveReminders" are put into "myOldLaneMoveReminders" and the offset to the last lane is added to "myOldLaneMoveReminderOffsets" for each of these.

Move reminder from the given lane are set into "myMoveReminders".

"myLane" must still be the left lane!

Parameters
[in]enteredLane
See also
MSMoveReminder
MSLane::getMoveReminder

Definition at line 572 of file MSVehicle.cpp.

References MSBaseVehicle::addReminder(), MSLane::getLength(), MSLane::getMoveReminders(), myLane, MSBaseVehicle::myMoveReminders, and SUMOReal.

Referenced by enterLaneAtMove().

void MSVehicle::adaptToLeader ( const std::pair< const MSVehicle *, SUMOReal leaderInfo,
const SUMOReal  seen,
DriveProcessItem *const  lastLink,
const MSLane *const  lane,
SUMOReal v,
SUMOReal vLinkPass,
SUMOReal  distToCrossing = -1 
) const
protected
void MSVehicle::addContainer ( MSContainer container)
virtual

Adds a container.

Parameters
[in]containerThe container to add

Reimplemented from MSBaseVehicle.

Definition at line 2344 of file MSVehicle.cpp.

References MSDevice_Container::addContainer(), MSDevice_Container::buildVehicleDevices(), MSContainer::getID(), myContainerDevice, MSBaseVehicle::myDevices, MSBaseVehicle::myMoveReminders, and myStops.

Referenced by MSContainerControl::loadAnyWaiting().

void MSVehicle::addPerson ( MSPerson person)
virtual

Adds a passenger.

Parameters
[in]personThe person to add

Reimplemented from MSBaseVehicle.

Definition at line 2322 of file MSVehicle.cpp.

References MSDevice_Person::addPerson(), MSDevice_Person::buildVehicleDevices(), MSPerson::getID(), MSBaseVehicle::myDevices, MSBaseVehicle::myMoveReminders, myPersonDevice, and myStops.

Referenced by MSPersonControl::boardAnyWaiting().

void MSBaseVehicle::addReminder ( MSMoveReminder rem)
inherited

Adds a MoveReminder dynamically.

Parameters
[in]remthe reminder to add
See also
MSMoveReminder

Definition at line 285 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myMoveReminders.

Referenced by adaptLaneEntering2MoveReminder(), enterLaneAtInsertion(), and enterLaneAtLaneChange().

bool MSVehicle::addStop ( const SUMOVehicleParameter::Stop stopPar,
std::string &  errorMsg,
SUMOTime  untilOffset = 0 
)
virtual

Adds a stop.

The stop is put into the sorted list.

Parameters
[in]stopThe stop to add
Returns
Whether the stop could be added

Implements SUMOVehicle.

Definition at line 679 of file MSVehicle.cpp.

References MSLane::allowsVehicleClass(), SUMOVehicleParameter::Stop::awaitedContainers, MSVehicle::Stop::awaitedContainers, SUMOVehicleParameter::Stop::awaitedPersons, MSVehicle::Stop::awaitedPersons, SUMOVehicleParameter::Stop::busstop, MSVehicle::Stop::busstop, SUMOVehicleParameter::Stop::containerstop, MSVehicle::Stop::containerstop, SUMOVehicleParameter::Stop::containerTriggered, MSVehicle::Stop::containerTriggered, DEPART_POS_BASE, DEPART_POS_DEFAULT, DEPART_POS_GIVEN, SUMOVehicleParameter::departPos, SUMOVehicleParameter::departPosProcedure, MSLane::dictionary(), SUMOVehicleParameter::Stop::duration, MSVehicle::Stop::duration, MSVehicle::Stop::edge, MSRoute::end(), SUMOVehicleParameter::Stop::endPos, MSVehicle::Stop::endPos, MSNet::getBusStop(), getCarFollowModel(), MSNet::getContainerStop(), MSLane::getEdge(), Named::getID(), MSNet::getInstance(), MSVehicleType::getLength(), MSLane::getLength(), MSVehicleType::getVehicleClass(), MSBaseVehicle::getVehicleType(), MSBaseVehicle::hasDeparted(), SUMOVehicleParameter::id, SUMOVehicleParameter::Stop::index, SUMOVehicleParameter::Stop::lane, MSVehicle::Stop::lane, MIN2(), MSBaseVehicle::myCurrEdge, MSBaseVehicle::myParameter, MSVehicle::State::myPos, MSBaseVehicle::myRoute, MSVehicle::State::mySpeed, myState, myStops, MSBaseVehicle::myType, SUMOVehicleParameter::Stop::parking, MSVehicle::Stop::parking, POSITION_EPS, MSVehicle::Stop::reached, SUMOVehicleParameter::Stop::startPos, MSVehicle::Stop::startPos, STOP_INDEX_END, STOP_INDEX_FIT, SUMOReal, MSVehicle::Stop::timeToBoardNextPerson, MSVehicle::Stop::timeToLoadNextContainer, SUMOVehicleParameter::Stop::triggered, MSVehicle::Stop::triggered, SUMOVehicleParameter::Stop::until, and MSVehicle::Stop::until.

Referenced by addTraciStop(), and replaceRoute().

void MSBaseVehicle::addStops ( const bool  ignoreStopErrors)
inherited

Adds stops to the built vehicle.

This code needs to be separated from the MSBaseVehicle constructor since it is not allowed to call virtual functions from a constructor

Parameters
[in]ignoreStopErrorswhether invalid stops trigger a warning only

Definition at line 387 of file MSBaseVehicle.cpp.

References SUMOVehicle::addStop(), MSRoute::getStops(), MSBaseVehicle::myParameter, MSBaseVehicle::myRoute, SUMOVehicleParameter::stops, and WRITE_WARNING.

Referenced by GUIVehicleControl::buildVehicle(), and MSVehicleControl::buildVehicle().

bool MSVehicle::addTraciStop ( MSLane lane,
SUMOReal  pos,
SUMOReal  radius,
SUMOTime  duration,
bool  parking,
bool  triggered,
bool  containerTriggered,
std::string &  errorMsg 
)

schedule a new stop for the vehicle; each time a stop is reached, the vehicle will wait for the given duration before continuing on its route

Parameters
lanelane on wich to stop
posposition on the given lane at wich to stop
radiusthe vehicle will stop if it is within the range [pos-radius, pos+radius]
durationafter waiting for the time period duration, the vehicle will
parkinga flag indicating whether the traci stop is used for parking or not
triggereda flag indicating whether the traci stop is triggered or not
containerTriggereda flag indicating whether the traci stop is triggered by a container or not

Definition at line 2432 of file MSVehicle.cpp.

References addStop(), SUMOVehicleParameter::Stop::busstop, SUMOVehicleParameter::Stop::containerstop, SUMOVehicleParameter::Stop::containerTriggered, SUMOVehicleParameter::Stop::duration, SUMOVehicleParameter::Stop::endPos, MSNet::getBusStopID(), MSNet::getContainerStopID(), Named::getID(), MSNet::getInstance(), SUMOVehicleParameter::Stop::index, SUMOVehicleParameter::Stop::lane, myLane, myStops, SUMOVehicleParameter::Stop::parking, POSITION_EPS, SUMOVehicleParameter::Stop::startPos, STOP_INDEX_FIT, SUMOVehicleParameter::Stop::triggered, SUMOVehicleParameter::Stop::until, and updateBestLanes().

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::checkRewindLinkLanes ( const SUMOReal  lengthsInFront,
DriveItemVector lfLinks 
) const
protected
bool MSVehicle::congested ( ) const
inline

Returns true if vehicle's speed is below 60km/h. This is only relevant on highways. Overtaking on the right is allowed then.

Definition at line 393 of file MSVehicle.h.

References MSVehicle::State::mySpeed, myState, and SUMOReal.

Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSAbstractLaneChangeModel::congested(), MSLCM_JE2013::informFollower(), MSLCM_JE2013::informLeader(), and MSLCM_LC2013::informLeader().

void MSVehicle::enterLaneAtInsertion ( MSLane enteredLane,
SUMOReal  pos,
SUMOReal  speed,
MSMoveReminder::Notification  notification 
)

Update when the vehicle enters a new lane in the emit step.

Parameters
[in]enteredLaneThe lane the vehicle enters
[in]posThe position the vehicle was inserted into the lane
[in]speedThe speed with which the vehicle was inserted into the lane
[in]notificationThe cause of insertion (i.e. departure, teleport, parking)

Definition at line 1812 of file MSVehicle.cpp.

References activateReminders(), MSBaseVehicle::addReminder(), MSGlobals::gCheckRoutes, MSBaseVehicle::getID(), MSVehicleType::getLength(), MSLane::getLogicalPredecessorLane(), MSLane::getMoveReminders(), MSBaseVehicle::hasValidRoute(), Position::INVALID, myAmOnNet, myCachedPosition, myFurtherLanes, myLane, MSVehicle::State::myPos, MSVehicle::State::mySpeed, myState, MSBaseVehicle::myType, myWaitingTime, and SUMOReal.

Referenced by MSLane::incorporateVehicle().

bool MSVehicle::enterLaneAtMove ( MSLane enteredLane,
bool  onTeleporting = false 
)

Update when the vehicle enters a new lane in the move step.

Parameters
[in]enteredLaneThe lane the vehicle enters
[in]onTeleportingWhether the lane was entered while being teleported
Returns
Whether the vehicle's route has ended (due to vaporization, or because the destination was reached)

Definition at line 1727 of file MSVehicle.cpp.

References activateReminders(), adaptLaneEntering2MoveReminder(), MSEdge::EDGEFUNCTION_INTERNAL, MSLane::getEdge(), MSEdge::getPurpose(), hasArrived(), Position::INVALID, myAmOnNet, myCachedPosition, MSBaseVehicle::myCurrEdge, myLane, MSVehicle::State::myPos, myState, MSMoveReminder::NOTIFICATION_JUNCTION, and MSMoveReminder::NOTIFICATION_TELEPORT.

Referenced by MSVehicleTransfer::add(), MSVehicleTransfer::checkInsertions(), executeMove(), and TraCIServerAPI_Vehicle::processSet().

SUMOReal MSVehicle::estimateLeaveSpeed ( const MSLink *const  link,
const SUMOReal  vLinkPass 
) const
inlineprotected
SUMOReal MSVehicle::estimateSpeedAfterDistance ( const SUMOReal  dist,
const SUMOReal  v,
const SUMOReal  accel 
) const
inlineprotected
bool MSVehicle::executeMove ( )

Executes planned vehicle movements with regards to right-of-way.

This method goes through all DriveProcessItems in myLFLinkLanes in order to find a speed that is safe for all upcoming links.

Using this speed the position is updated and the vehicle is moved to the next lane (myLane is updated) if the end of the current lane is reached (this may happen multiple times in this method)

The vehicle also sets the lanes it is in-lapping into and informs them about it.

Returns
Whether the vehicle has moved to the next edge

Definition at line 1250 of file MSVehicle.cpp.

References ACCEL2SPEED, bla, MSCFModel::brakeGap(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), DELTA_T, DIST2SPEED, MSRoute::end(), MSAbstractLaneChangeModel::endLaneChangeManeuver(), enterLaneAtMove(), MSVehicleType::getCarFollowModel(), getCarFollowModel(), MSLink::getDirection(), MSLane::getEdge(), MSVehicle::Influencer::getEmergencyBrakeRedLight(), MSCFModel::getHeadwayTime(), Named::getID(), MSBaseVehicle::getID(), MSBaseVehicle::getImpatience(), MSNet::getInstance(), MSLink::getJunction(), getLaneChangeModel(), MSVehicleType::getLength(), MSLane::getLength(), MSCFModel::getMaxDecel(), getPositionOnLane(), MSVehicle::Influencer::getRespectJunctionPriority(), getSpeed(), MSLink::getState(), MSNet::getVehicleControl(), MSBaseVehicle::getVehicleType(), MSLink::getViaLaneOrLane(), getWaitingTime(), GLO_VEHICLE, gSelected, hasArrived(), MSLink::havePriority(), MSVehicle::Influencer::influenceSpeed(), Position::INVALID, MSLink::isCont(), MSEdge::isRoundabout(), GUISelectedStorage::isSelected(), MSEdge::isVaporizing(), MSVehicle::Influencer::isVTDControlled(), MSLink::lastWasContMajor(), leaveLane(), LINKDIR_LEFT, LINKDIR_RIGHT, LINKSTATE_EQUAL, LINKSTATE_TL_RED, LINKSTATE_TL_YELLOW_MAJOR, LINKSTATE_TL_YELLOW_MINOR, MAX2(), MSCFModel::maxNextSpeed(), MIN2(), myAcceleration, myCachedPosition, MSBaseVehicle::myCurrEdge, myFurtherLanes, myHaveToWaitOnNextLink, myInfluencer, myLane, myLFLinkLanes, MSVehicle::State::myPos, MSBaseVehicle::myRoute, MSVehicle::State::mySpeed, myState, myWaitingTime, MSMoveReminder::NOTIFICATION_JUNCTION, MSMoveReminder::NOTIFICATION_VAPORIZED, NUMERICAL_EPS, MSLink::opened(), POSITION_EPS, MSAbstractLaneChangeModel::prepareStep(), MSVehicleControl::registerEmergencyStop(), MSLink::removeApproaching(), setBlinkerInformation(), SPEED2ACCEL, SPEED2DIST, SUMO_const_haltingSpeed, SUMOReal, switchOffSignal(), switchOnSignal(), time2string(), toString(), updateBestLanes(), VEH_SIGNAL_BRAKELIGHT, workOnMoveReminders(), and WRITE_WARNING.

Referenced by MSLane::executeMovements().

bool MSVehicle::fixPosition ( )

repair errors in vehicle position after changing between internal edges

Definition at line 2214 of file MSVehicle.cpp.

References MSLane::getLength(), getPositionOnLane(), Position::INVALID, myCachedPosition, myLane, MSVehicle::State::myPos, and myState.

Referenced by MSAbstractLaneChangeModel::continueLaneChangeManeuver().

static SUMOReal MSVehicle::gap ( SUMOReal  predPos,
SUMOReal  predLength,
SUMOReal  pos 
)
inlinestatic

Uses the given values to compute the brutto-gap.

Parameters
[in]predPosPosition of the leader
[in]predLengthLength of the leader
[in]posPosition of the follower
Returns
The gap between the leader and the follower

Definition at line 215 of file MSVehicle.h.

Referenced by MSLane::isInsertionSuccess(), and planMoveInternal().

SUMOReal MSVehicle::getAcceleration ( ) const
inlinevirtual

Returns the vehicle's acceleration in m/s.

Returns
The acceleration

Reimplemented from MSBaseVehicle.

Definition at line 302 of file MSVehicle.h.

References myAcceleration.

Referenced by GUIVehicle::getColorValue().

virtual SUMOReal MSBaseVehicle::getArrivalPos ( ) const
inlinevirtualinherited

Returns this vehicle's desired arrivalPos for its current route (may change on reroute)

Returns
This vehicle's real arrivalPos

Implements SUMOVehicle.

Definition at line 207 of file MSBaseVehicle.h.

References MSBaseVehicle::myArrivalPos.

int MSVehicle::getBestLaneOffset ( ) const

returns the current offset from the best lane

Definition at line 2196 of file MSVehicle.cpp.

References myBestLanes.

Referenced by MSLCM_JE2013::changed(), MSLCM_LC2013::changed(), and GUIVehicle::getColorValue().

const std::vector< MSVehicle::LaneQ > & MSVehicle::getBestLanes ( ) const

Returns the description of best lanes to use in order to continue the route.

Returns
The best lanes structure holding matching the current vehicle position and state ahead

Definition at line 1896 of file MSVehicle.cpp.

References myBestLanes.

Referenced by MSLane::appropriate(), MSLaneChanger::change(), MSEdge::getDepartLane(), TraCIServerAPI_Vehicle::processGet(), and TraCIServerAPI_Vehicle::processSet().

const std::vector< MSLane * > & MSVehicle::getBestLanesContinuation ( ) const

Returns the subpart of best lanes that describes the vehicle's current lane and their successors.

Returns
The best lane information for the vehicle's current lane
Todo:
Describe better

Definition at line 2168 of file MSVehicle.cpp.

References myBestLanes, and myEmptyLaneVector.

Referenced by MSLane::appropriate(), GUIVehicle::drawRouteHelper(), MSLane::executeMovements(), MSLane::getCriticalLeader(), getLeader(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), MSLane::isInsertionSuccess(), planMoveInternal(), MSLane::pWagGenericInsertion(), MSLane::pWagSimpleInsertion(), and setBlinkerInformation().

const std::vector< MSLane * > & MSVehicle::getBestLanesContinuation ( const MSLane *const  l) const

Returns the subpart of best lanes that describes the given lane and their successors.

Returns
The best lane information for the given lane
Todo:
Describe better

Definition at line 2177 of file MSVehicle.cpp.

References MSEdge::EDGEFUNCTION_INTERNAL, MSLane::getEdge(), MSLane::getLinkCont(), MSEdge::getPurpose(), myBestLanes, and myEmptyLaneVector.

SUMOReal MSBaseVehicle::getChosenSpeedFactor ( ) const
inlinevirtualinherited

Returns the precomputed factor by which the driver wants to be faster than the speed limit.

Returns
Speed limit factor

Implements SUMOVehicle.

Definition at line 290 of file MSBaseVehicle.h.

References MSBaseVehicle::myChosenSpeedFactor.

Referenced by GUIVehicle::getParameterWindow(), and TraCIServerAPI_Vehicle::processGet().

SUMOReal MSVehicle::getCO2Emissions ( ) const
SUMOReal MSVehicle::getCOEmissions ( ) const
unsigned int MSVehicle::getContainerNumber ( ) const

Returns the number of containers.

Returns
The number of contaiers on-board

Definition at line 2370 of file MSVehicle.cpp.

References SUMOVehicleParameter::containerNumber, myContainerDevice, MSBaseVehicle::myParameter, and MSDevice_Container::size().

Referenced by MSContainerControl::loadAnyWaiting().

const MSRouteIterator& MSBaseVehicle::getCurrentRouteEdge ( ) const
inlinevirtualinherited

Returns an iterator pointing to the current edge in this vehicles route.

Returns
The current route pointer

Implements SUMOVehicle.

Definition at line 145 of file MSBaseVehicle.h.

References MSBaseVehicle::myCurrEdge.

SUMOTime MSBaseVehicle::getDeparture ( ) const
inlinevirtualinherited

Returns this vehicle's real departure time.

Returns
This vehicle's real departure time

Implements SUMOVehicle.

Definition at line 199 of file MSBaseVehicle.h.

References MSBaseVehicle::myDeparture.

MSDevice * MSBaseVehicle::getDevice ( const std::type_info &  type) const
virtualinherited

Returns a device of the given type if it exists or 0.

Implements SUMOVehicle.

Definition at line 365 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myDevices.

Referenced by GUIVehicle::drawGL().

const std::vector<MSDevice*>& MSBaseVehicle::getDevices ( ) const
inlinevirtualinherited

Returns this vehicle's devices.

Returns
This vehicle's devices

Implements SUMOVehicle.

Definition at line 234 of file MSBaseVehicle.h.

References MSBaseVehicle::myDevices.

SUMOReal MSVehicle::getDistanceToPosition ( SUMOReal  destPos,
const MSEdge destEdge 
)

Compute distance that will be covered, if the vehicle moves to a given position on its route, starting at its current position.

Parameters
destPosposition on the destination edge that shall be reached
destEdgedestination edge that shall be reached
Returns
distance from the vehicles current position to the destination position, or a near infinite real value if the destination position is not contained within the vehicles route or the vehicle is not active

Definition at line 2225 of file MSVehicle.cpp.

References MSRoute::getDistanceBetween(), MSLane::getEdge(), MSLane::getLength(), getPositionOnLane(), isOnRoad(), max, MSBaseVehicle::myCurrEdge, myLane, MSBaseVehicle::myRoute, and SUMOReal.

const MSEdge * MSBaseVehicle::getEdge ( ) const
virtualinherited
SUMOReal MSVehicle::getFuelConsumption ( ) const
SUMOReal MSVehicle::getHarmonoise_NoiseEmissions ( ) const
SUMOReal MSVehicle::getHCEmissions ( ) const
MSVehicle::Influencer & MSVehicle::getInfluencer ( )

Returns the velocity/lane influencer.

If no influencer was existing before, one is built, first

Returns
Reference to this vehicle's speed influencer

Definition at line 2510 of file MSVehicle.cpp.

References myInfluencer.

Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSLaneChanger::change(), MSLane::executeMovements(), influenceChangeDecision(), TraCIServerAPI_Vehicle::processSet(), and TraCIServer::setVTDControlled().

MSLane* MSVehicle::getLane ( ) const
inline

Returns the lane the vehicle is on.

Returns
The vehicle's current lane

Definition at line 331 of file MSVehicle.h.

References myLane.

Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_LC2013::_patchSpeed(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), activateReminders(), MSVehicleTransfer::add(), MSLaneChanger::change(), MSVehicleTransfer::checkInsertions(), MSAbstractLaneChangeModel::congested(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), MSCFModel_IDM::desiredSpeed(), MSE2Collector::detectorUpdate(), MSVTypeProbe::execute(), MSLane::executeMovements(), GUIVehicle::getColorValue(), MSVTKExport::getSpeed(), MSLane::handleCollision(), MSCFModel::interactionGap(), MSCFModel_KraussAccelBound::maxNextSpeed(), MSCFModel_Daniel1::moveHelper(), MSCFModel_SmartSK::moveHelper(), MSCFModel_KraussOrig1::moveHelper(), MSCFModel::moveHelper(), MSDevice_BTsender::notifyEnter(), MSDevice_BTreceiver::notifyEnter(), MSDevice_BTsender::notifyLeave(), MSDevice_BTreceiver::notifyLeave(), MSDevice_BTsender::notifyMove(), MSDevice_BTreceiver::notifyMove(), MSLCM_DK2008::patchSpeed(), MSLCM_JE2013::patchSpeed(), planMoveInternal(), MSVehicle::Influencer::postProcessVTD(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Vehicle::processSet(), MSCalibrator::removePending(), setBlinkerInformation(), TraCIServerAPI_Vehicle::vtdMap(), MSLCM_JE2013::wantsChange(), MSLCM_DK2008::wantsChangeToLeft(), MSLCM_DK2008::wantsChangeToRight(), MSFCDExport::write(), MSEmissionExport::write(), MSQueueExport::writeLane(), and MSFullExport::writeVehicles().

const MSAbstractLaneChangeModel & MSVehicle::getLaneChangeModel ( ) const

Definition at line 1890 of file MSVehicle.cpp.

References myLaneChangeModel.

unsigned int MSVehicle::getLaneIndex ( ) const

Definition at line 2416 of file MSVehicle.cpp.

References MSLane::getEdge(), MSEdge::getLanes(), and myLane.

Referenced by MSLane::appropriate(), and influenceChangeDecision().

std::pair< const MSVehicle *const, SUMOReal > MSVehicle::getLeader ( SUMOReal  dist = 0) const

Returns the leader of the vehicle looking for a fixed distance.

If the distance is not given it is calculated from the brake gap. The gap returned does not include the minGap.

Parameters
distup to which distance to look for a leader
Returns
The leading vehicle together with the gap; (0, -1) if no leader was found.

Definition at line 2246 of file MSVehicle.cpp.

References MSCFModel::brakeGap(), getBestLanesContinuation(), getCarFollowModel(), MSLane::getLeaderOnConsecutive(), MSVehicleType::getLength(), MSLane::getLength(), MSVehicleType::getMinGap(), getPositionOnLane(), getSpeed(), MSLane::getVehiclesSecure(), MSBaseVehicle::getVehicleType(), myLane, MSLane::releaseVehicles(), and SUMOReal.

Referenced by getTimeGap(), and TraCIServerAPI_Vehicle::processGet().

SUMOReal MSBaseVehicle::getMaxSpeed ( ) const
virtualinherited
MSVehicle::Stop & MSVehicle::getNextStop ( )

returns the next imminent stop in the stop queue

Returns
the upcoming stop

Definition at line 2504 of file MSVehicle.cpp.

References myStops.

SUMOReal MSVehicle::getNOxEmissions ( ) const
unsigned int MSBaseVehicle::getNumberReroutes ( ) const
inlinevirtualinherited

Returns the number of new routes this vehicle got.

Returns
the number of new routes this vehicle got

Implements SUMOVehicle.

Definition at line 223 of file MSBaseVehicle.h.

References MSBaseVehicle::myNumberReroutes.

Referenced by GUIVehicle::drawGLAdditional(), GUIVehicle::getColorValue(), and MSBaseVehicle::replaceRouteEdges().

const SUMOVehicleParameter & MSBaseVehicle::getParameter ( ) const
virtualinherited
unsigned int MSVehicle::getPersonNumber ( ) const

Returns the number of persons.

Returns
The number of passengers on-board

Definition at line 2364 of file MSVehicle.cpp.

References MSBaseVehicle::myParameter, myPersonDevice, SUMOVehicleParameter::personNumber, and MSDevice_Person::size().

Referenced by MSPersonControl::boardAnyWaiting(), and TraCIServerAPI_Vehicle::processGet().

SUMOReal MSVehicle::getPMxEmissions ( ) const
SUMOReal MSVehicle::getPositionOnLane ( ) const
inlinevirtual

Get the vehicle's position along the lane.

Returns
The position of the vehicle (in m from the lane's begin)

Implements SUMOVehicle.

Definition at line 286 of file MSVehicle.h.

References MSVehicle::State::myPos, and myState.

Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSLaneChanger::change(), MSLaneChanger::checkChange(), MSVehicleTransfer::checkInsertions(), checkRewindLinkLanes(), TraCIServerAPI_Vehicle::commandDistanceRequest(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), MSE2Collector::detectorUpdate(), executeMove(), MSLane::executeMovements(), fixPosition(), MSLane::freeInsertion(), getAngle(), MSLane::getBruttoOccupancy(), MSLane::getCriticalLeader(), getDistanceToPosition(), MSLane::getFollowerOnConsecutive(), MSLane::getLastVehicleInformation(), getLeader(), MSLane::getLeaderOnConsecutive(), MSLane::getNettoOccupancy(), GUIVehicle::getParameterWindow(), getPosition(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), getSlope(), MSVTKExport::getSpeed(), MSLane::isInsertionSuccess(), MSLane::loadState(), MSCFModel_KraussAccelBound::maxNextSpeed(), MSLane::maxSpeedGapInsertion(), MSLink::maybeOccupied(), MSLane::VehPosition::operator()(), MSLane::vehicle_position_sorter::operator()(), MSLCM_JE2013::patchSpeed(), planMoveInternal(), MSAbstractLaneChangeModel::predInteraction(), TraCIServerAPI_Vehicle::processGet(), MSLane::pWagGenericInsertion(), MSLane::pWagSimpleInsertion(), MSCalibrator::remainingVehicleCapacity(), GUIVehicle::selectBlockingFoes(), setBlinkerInformation(), MSLCM_JE2013::slowDownForBlocked(), MSLCM_LC2013::slowDownForBlocked(), TraCIServerAPI_Vehicle::vtdMap(), MSLCM_JE2013::wantsChange(), MSLCM_DK2008::wantsChangeToLeft(), MSLCM_DK2008::wantsChangeToRight(), and MSQueueExport::writeLane().

const MSEdge * MSVehicle::getRerouteOrigin ( ) const
virtual

Returns the starting point for reroutes (usually the current edge)

This differs from *myCurrEdge only if the vehicle is on an internal edge or very close to the junction

Returns
The rerouting start point

Reimplemented from MSBaseVehicle.

Definition at line 630 of file MSVehicle.cpp.

References MSCFModel::brakeGap(), MSRoute::end(), getCarFollowModel(), MSLane::getInternalFollower(), MSLane::getLength(), MSBaseVehicle::myCurrEdge, myLane, MSVehicle::State::myPos, MSBaseVehicle::myRoute, MSVehicle::State::mySpeed, and myState.

Referenced by TraCIServerAPI_Vehicle::processSet().

const MSRoute& MSBaseVehicle::getRoute ( ) const
inlinevirtualinherited
SUMOReal MSVehicle::getSafeFollowSpeed ( const std::pair< const MSVehicle *, SUMOReal leaderInfo,
const SUMOReal  seen,
const MSLane *const  lane,
SUMOReal  distToCrossing 
) const

compute safe speed for following the given leader

Definition at line 1229 of file MSVehicle.cpp.

References MSCFModel::followSpeed(), getCarFollowModel(), MSLane::getLength(), getSpeed(), MAX2(), POSITION_EPS, MSCFModel::stopSpeed(), and SUMOReal.

Referenced by adaptToLeader(), and MSLane::getCriticalLeader().

int MSVehicle::getSignals ( ) const
inline

Returns the signals.

Returns
The signals' states

Definition at line 829 of file MSVehicle.h.

References mySignals.

Referenced by TraCIServerAPI_Vehicle::processGet(), and MSFCDExport::write().

SUMOReal MSVehicle::getSlope ( ) const
virtual
SUMOReal MSVehicle::getSpaceTillLastStanding ( const MSLane l,
bool foundStopped 
) const
protected
SUMOReal MSVehicle::getSpeed ( ) const
inlinevirtual

Returns the vehicle's current speed.

Returns
The vehicle's speed

Implements SUMOVehicle.

Definition at line 294 of file MSVehicle.h.

References MSVehicle::State::mySpeed, and myState.

Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_LC2013::_patchSpeed(), MSCFModel_Wiedemann::_v(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSLaneChanger::change(), MSLaneChanger::checkChange(), GUIApplicationWindow::checkGamingEvents(), checkRewindLinkLanes(), MSE2Collector::detectorUpdate(), executeMove(), MSLane::executeMovements(), MSLane::forceVehicleInsertion(), MSLane::freeInsertion(), GUIVehicle::getColorValue(), MSLane::getCriticalLeader(), getLeader(), MSLane::getMissingRearGap(), GUIVehicle::getParameterWindow(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), getSafeFollowSpeed(), MSVTKExport::getSpeed(), getTimeGap(), MSLCM_DK2008::informBlocker(), MSLCM_JE2013::informFollower(), MSLCM_LC2013::informFollower(), MSLCM_JE2013::informLeader(), MSLCM_LC2013::informLeader(), MSCFModel_IDM::interactionGap(), MSCFModel::interactionGap(), MSLane::isInsertionSuccess(), MSLane::loadState(), MSLane::maxSpeedGapInsertion(), MSLink::maybeOccupied(), MSCFModel_Daniel1::moveHelper(), MSCFModel_KraussOrig1::moveHelper(), MSCFModel_PWag2009::moveHelper(), MSCFModel_SmartSK::moveHelper(), MSCFModel_Wiedemann::moveHelper(), MSCFModel::moveHelper(), MSLCM_DK2008::patchSpeed(), MSLCM_JE2013::patchSpeed(), planMoveInternal(), MSAbstractLaneChangeModel::predInteraction(), TraCIServerAPI_Vehicle::processGet(), processNextStop(), TraCIServerAPI_Vehicle::processSet(), MSLane::pWagGenericInsertion(), MSLane::pWagSimpleInsertion(), MSLCM_JE2013::saveBlockerLength(), MSLCM_LC2013::saveBlockerLength(), MSLCM_JE2013::slowDownForBlocked(), MSLCM_LC2013::slowDownForBlocked(), MSLCM_JE2013::wantsChange(), MSLCM_DK2008::wantsChangeToLeft(), MSLCM_DK2008::wantsChangeToRight(), and MSQueueExport::writeLane().

SUMOReal MSVehicle::getSpeedWithoutTraciInfluence ( ) const

Returns the uninfluenced velocity.

If no influencer exists (myInfluencer==0) the vehicle's current speed is returned. Otherwise the speed returned from myInfluencer->getOriginalSpeed().

Returns
The vehicle's velocity as it would without an influence
See also
Influencer::getOriginalSpeed

Definition at line 2519 of file MSVehicle.cpp.

References MSVehicle::Influencer::getOriginalSpeed(), myInfluencer, MSVehicle::State::mySpeed, and myState.

Referenced by TraCIServerAPI_Vehicle::processGet().

const ConstMSEdgeVector MSVehicle::getStopEdges ( ) const
protectedvirtual

Returns the list of still pending stop edges.

Implements MSBaseVehicle.

Definition at line 946 of file MSVehicle.cpp.

References myStops.

SUMOReal MSVehicle::getTimeGap ( ) const

Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.

If the distance is too big -1 is returned. The gap returned takes the minGap into account.

Returns
The time gap in seconds; -1 if no leader was found or speed is 0.

Definition at line 2270 of file MSVehicle.cpp.

References getLeader(), getSpeed(), and MSBaseVehicle::getVehicleType().

Referenced by GUIVehicle::getColorValue(), and GUIVehicle::getParameterWindow().

SUMOVehicleClass MSBaseVehicle::getVClass ( ) const
inlinevirtualinherited

Returns the vehicle's access class.

Returns
The vehicle's access class

Implements SUMOVehicle.

Definition at line 98 of file MSBaseVehicle.h.

References MSVehicleType::getParameter(), MSBaseVehicle::myType, and SUMOVTypeParameter::vehicleClass.

const MSVehicleType& MSBaseVehicle::getVehicleType ( ) const
inlinevirtualinherited

Returns the vehicle's type definition.

Returns
The vehicle's type definition

Implements SUMOVehicle.

Definition at line 90 of file MSBaseVehicle.h.

References MSBaseVehicle::myType.

Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_LC2013::_patchSpeed(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), addStop(), MSPersonControl::boardAnyWaiting(), MSLaneChanger::change(), MSLaneChanger::checkChange(), MSLane::checkFailure(), GUIApplicationWindow::checkGamingEvents(), MSVehicleTransfer::checkInsertions(), checkRewindLinkLanes(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), MSE2Collector::detectorUpdate(), GUIVehicle::drawAction_drawRailCarriages(), GUIVehicle::drawAction_drawVehicleAsBoxPlus(), GUIVehicle::drawAction_drawVehicleAsImage(), GUIVehicle::drawAction_drawVehicleAsPoly(), GUIVehicle::drawAction_drawVehicleAsTrianglePlus(), drawAction_drawVehicleBlinker(), drawAction_drawVehicleBrakeLight(), GUIVehicle::drawGL(), GUIVehicle::drawGLAdditional(), MSLane::enteredByLaneChange(), enterLaneAtLaneChange(), estimateLeaveSpeed(), estimateSpeedAfterDistance(), executeMove(), MSLane::executeMovements(), MSLane::freeInsertion(), MSLane::getBruttoOccupancy(), MSLane::getCriticalLeader(), MSEdge::getDepartLane(), MSLane::getFollowerOnConsecutive(), MSBaseVehicle::getImpatience(), MSLane::getLastVehicleInformation(), getLeader(), MSLane::getLeaderOnConsecutive(), MSLane::getNettoOccupancy(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), getTimeGap(), MSLane::handleCollision(), MSLane::incorporateVehicle(), MSLCM_JE2013::informFollower(), MSLCM_LC2013::informFollower(), MSLCM_JE2013::informLeader(), MSLCM_LC2013::informLeader(), MSLane::insertVehicle(), MSLane::integrateNewVehicle(), MSLane::isInsertionSuccess(), MSLane::leftByLaneChange(), MSContainerControl::loadAnyWaiting(), MSCFModel_KraussAccelBound::maxNextSpeed(), MSLane::maxSpeedGapInsertion(), MSLink::maybeOccupied(), overlap(), MSLCM_DK2008::patchSpeed(), planMoveInternal(), MSLane::planMovements(), MSAbstractLaneChangeModel::predInteraction(), TraCIServerAPI_Vehicle::processGet(), processNextStop(), MSLane::pWagGenericInsertion(), MSLane::pWagSimpleInsertion(), MSLaneChanger::registerUnchanged(), MSLane::removeVehicle(), MSLCM_JE2013::saveBlockerLength(), MSLCM_LC2013::saveBlockerLength(), GUIVehicle::selectBlockingFoes(), GUIVehicle::setFunctionalColor(), MSLCM_JE2013::slowDownForBlocked(), MSLCM_LC2013::slowDownForBlocked(), MSLaneChanger::startChange(), MSLCM_DK2008::wantsChangeToLeft(), MSLCM_DK2008::wantsChangeToRight(), and MSQueueExport::writeLane().

SUMOReal MSVehicle::getWaitingSeconds ( ) const
inline

Returns the number of seconds waited (speed was lesser than 0.1m/s)

The value is reset if the vehicle moves faster than 0.1m/s Intentional stopping does not count towards this time.

Returns
The time the vehicle is standing

Definition at line 370 of file MSVehicle.h.

References myWaitingTime, and STEPS2TIME.

Referenced by GUIVehicle::getColorValue(), GUIVehicle::getParameterWindow(), MSLCM_JE2013::informFollower(), MSLCM_LC2013::informFollower(), TraCIServerAPI_Vehicle::processGet(), MSEmissionExport::write(), MSQueueExport::writeLane(), and MSFullExport::writeVehicles().

SUMOTime MSVehicle::getWaitingTime ( ) const
inlinevirtual

Returns the SUMOTime waited (speed was lesser than 0.1m/s)

The value is reset if the vehicle moves faster than 0.1m/s Intentional stopping does not count towards this time.

Returns
The time the vehicle is standing

Implements SUMOVehicle.

Definition at line 359 of file MSVehicle.h.

References myWaitingTime.

Referenced by checkRewindLinkLanes(), executeMove(), MSLane::executeMovements(), and GUIVehicle::selectBlockingFoes().

const MSEdgeWeightsStorage & MSVehicle::getWeightsStorage ( ) const

Returns the vehicle's internal edge travel times/efforts container.

If the vehicle does not have such a container, it is built.

Returns
The vehicle's knowledge about edge weights

Definition at line 526 of file MSVehicle.cpp.

References _getWeightsStorage().

Referenced by MSNet::getEffort(), MSNet::getTravelTime(), TraCIServerAPI_Vehicle::processGet(), and TraCIServerAPI_Vehicle::processSet().

MSEdgeWeightsStorage & MSVehicle::getWeightsStorage ( )

Definition at line 532 of file MSVehicle.cpp.

References _getWeightsStorage().

bool MSVehicle::hasArrived ( ) const
virtual

Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)

Reimplemented from MSBaseVehicle.

Definition at line 450 of file MSVehicle.cpp.

References MSRoute::end(), MSBaseVehicle::myArrivalPos, MSBaseVehicle::myCurrEdge, MSVehicle::State::myPos, MSBaseVehicle::myRoute, myState, myStops, and POSITION_EPS.

Referenced by enterLaneAtMove(), executeMove(), and MSLane::executeMovements().

bool MSBaseVehicle::hasDeparted ( ) const
virtualinherited

Returns whether this vehicle has already departed.

Implements SUMOVehicle.

Definition at line 244 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myDeparture, and MSBaseVehicle::NOT_YET_DEPARTED.

Referenced by addStop(), loadState(), and TraCIServerAPI_Vehicle::processSet().

bool MSVehicle::hasInfluencer ( ) const
inline

Definition at line 1087 of file MSVehicle.h.

References myInfluencer.

Referenced by MSLaneChanger::change(), MSLane::executeMovements(), and influenceChangeDecision().

bool MSVehicle::hasStops ( ) const
inline

Returns whether the vehicle has to stop somewhere.

Returns
Whether the vehicle has to stop somewhere

Definition at line 609 of file MSVehicle.h.

References myStops.

bool MSBaseVehicle::hasValidRoute ( std::string &  msg) const
inherited

Validates the current route.

Parameters
[out]msgDescription why the route is not valid (if it is the case)
Returns
Whether the vehicle's current route is valid

Definition at line 263 of file MSBaseVehicle.cpp.

References MSRoute::end(), MSVehicleType::getVehicleClass(), MSBaseVehicle::myCurrEdge, MSBaseVehicle::myRoute, and MSBaseVehicle::myType.

Referenced by enterLaneAtInsertion(), and TraCIServerAPI_Vehicle::processGet().

int MSVehicle::influenceChangeDecision ( int  state)
bool MSVehicle::isOnRoad ( ) const
inlinevirtual

Returns the information whether the vehicle is on a road (is simulated)

Returns
Whether the vehicle is simulated

Reimplemented from MSBaseVehicle.

Definition at line 339 of file MSVehicle.h.

References myAmOnNet.

Referenced by GUIApplicationWindow::checkGamingEvents(), TraCIServerAPI_Vehicle::commandDistanceRequest(), getDistanceToPosition(), MSVTKExport::getPositions(), MSVTKExport::getSpeed(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Vehicle::processSet(), and MSQueueExport::writeLane().

bool MSVehicle::isParking ( ) const

Returns whether the vehicle is parking.

Returns
whether the vehicle is parking

Definition at line 813 of file MSVehicle.cpp.

References isStopped(), and myStops.

Referenced by MSVehicleTransfer::add(), MSLane::executeMovements(), getAngle(), getPosition(), GUIVehicle::getStopInfo(), and TraCIServerAPI_Vehicle::processGet().

bool MSVehicle::isStopped ( ) const
virtual

Returns whether the vehicle is at a stop.

Returns
Whether the vehicle has stopped

Implements SUMOVehicle.

Definition at line 807 of file MSVehicle.cpp.

References myStops.

Referenced by MSLane::executeMovements(), GUIVehicle::getStopInfo(), isParking(), isStoppedInRange(), isStoppedTriggered(), TraCIServerAPI_Vehicle::processGet(), and resumeFromStopping().

bool MSVehicle::isStoppedInRange ( SUMOReal  pos) const

return whether the given position is within range of the current stop

Definition at line 825 of file MSVehicle.cpp.

References isStopped(), and myStops.

Referenced by MSVehicleControl::getWaitingVehicle().

bool MSVehicle::isStoppedTriggered ( ) const
virtual

Returns whether the vehicle is on a triggered stop.

Returns
whether the vehicle is on a triggered stop

Implements SUMOVehicle.

Definition at line 819 of file MSVehicle.cpp.

References isStopped(), and myStops.

Referenced by TraCIServerAPI_Vehicle::processGet().

bool MSVehicle::knowsEdgeTest ( MSEdge edge) const
void MSBaseVehicle::onDepart ( )
virtualinherited

Called when the vehicle is inserted into the network.

Sets optional information about departure time, informs the vehicle control about a further running vehicle.

Implements SUMOVehicle.

Definition at line 237 of file MSBaseVehicle.cpp.

References MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSNet::getVehicleControl(), MSBaseVehicle::myDeparture, and MSVehicleControl::vehicleDeparted().

Referenced by MSCalibrator::execute().

void MSVehicle::onRemovalFromNet ( const MSMoveReminder::Notification  reason)

Called when the vehicle is removed from the network.

Moves along work reminders and informs all devices about quitting. Calls "leaveLane" then.

Parameters
[in]reasonwhy the vehicle leaves (reached its destination, parking, teleport)

Definition at line 436 of file MSVehicle.cpp.

References MSVehicleTransfer::getInstance(), leaveLane(), myLFLinkLanes, MSVehicle::State::myPos, MSVehicle::State::mySpeed, myState, MSVehicleTransfer::remove(), SPEED2DIST, and workOnMoveReminders().

Referenced by MSVehicleTransfer::add(), MSLane::executeMovements(), MSVehicle::Influencer::postProcessVTD(), TraCIServerAPI_Vehicle::processSet(), and MSCalibrator::removePending().

MSVehicle& MSVehicle::operator= ( const MSVehicle )
private

invalidated assignment operator

static bool MSVehicle::overlap ( const MSVehicle veh1,
const MSVehicle veh2 
)
inlinestatic

Returns true if the two vehicles overlap.

Definition at line 383 of file MSVehicle.h.

References MSVehicleType::getLengthWithGap(), MSBaseVehicle::getVehicleType(), MSVehicle::State::myPos, and myState.

void MSVehicle::planMove ( const SUMOTime  t,
const MSVehicle pred,
const SUMOReal  lengthsInFront 
)

Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step. Also registers ApproachingVehicleInformation for all links.

This method goes through the best continuation lanes of the current lane and computes the safe velocities for passing/stopping at the next link as a DriveProcessItem

Afterwards it checks if any DriveProcessItem should be discared to avoid blocking a junction (checkRewindLinkLanes).

Finally the ApproachingVehicleInformation is registered for all links that shall be passed

Parameters
[in]tThe current timeStep
[in]predThe leader (may be 0)
[in]lengthsInFrontSum of vehicle lengths in front of the vehicle

Definition at line 956 of file MSVehicle.cpp.

References checkRewindLinkLanes(), getLaneChangeModel(), myLFLinkLanes, planMoveInternal(), and MSAbstractLaneChangeModel::resetMoved().

void MSVehicle::planMoveInternal ( const SUMOTime  t,
const MSVehicle pred,
DriveItemVector lfLinks 
) const
protected

Definition at line 964 of file MSVehicle.cpp.

References MSVehicle::DriveProcessItem::adaptLeaveSpeed(), adaptToLeader(), ARRIVAL_SPEED_GIVEN, SUMOVehicleParameter::arrivalSpeed, SUMOVehicleParameter::arrivalSpeedProcedure, bla, MSCFModel::brakeGap(), MSVehicle::Stop::busstop, CRLL_LOOK_AHEAD, DELTA_T, DIST_TO_STOPLINE_EXPECT_PRIORITY, MSEdge::EDGEFUNCTION_INTERNAL, MSRoute::end(), MSVehicle::Stop::endPos, estimateLeaveSpeed(), estimateSpeedAfterDistance(), MSCFModel::freeSpeed(), gap(), getBestLanesContinuation(), MSVehicleType::getCarFollowModel(), getCarFollowModel(), MSLane::getEdge(), MSCFModel::getHeadwayTime(), MSBaseVehicle::getID(), MSNet::getInstance(), getLane(), getLaneChangeModel(), MSBusStop::getLastFreePos(), MSLane::getLastVehicleInformation(), MSVehicleType::getLength(), MSLane::getLength(), MSLane::getLogicalPredecessorLane(), MSCFModel::getMaxAccel(), MSCFModel::getMaxDecel(), MSVehicleType::getMinGap(), MSLane::getPartialOccupator(), MSLane::getPartialOccupatorEnd(), getPositionOnLane(), MSEdge::getPurpose(), getSpeed(), MSCFModel::getSpeedAfterMaxDecel(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSGlobals::gLaneChangeDuration, GLO_VEHICLE, gSelected, MSVehicle::Influencer::influenceSpeed(), MSAbstractLaneChangeModel::isLaneChangeMidpointPassed(), MSLane::isLinkEnd(), GUISelectedStorage::isSelected(), MSVehicle::Influencer::isVTDControlled(), LINKDIR_LEFT, LINKDIR_RIGHT, LINKSTATE_TL_RED, LINKSTATE_TL_REDYELLOW, LINKSTATE_TL_YELLOW_MAJOR, LINKSTATE_TL_YELLOW_MINOR, MAX2(), MAX3(), MSCFModel::maxNextSpeed(), MIN2(), MSBaseVehicle::myArrivalPos, MSBaseVehicle::myCurrEdge, myInfluencer, myLane, MSBaseVehicle::myParameter, MSVehicle::State::myPos, MSBaseVehicle::myRoute, MSVehicle::State::mySpeed, myState, myStops, MSVehicle::DriveProcessItem::myVLinkWait, NUMERICAL_EPS, POSITION_EPS, SPEED2DIST, STEPS2TIME, MSCFModel::stopSpeed(), MSLane::succLinkSec(), SUMO_const_haltingSpeed, SUMOReal, SUMOTime_MAX, and TIME2STEPS.

Referenced by planMove().

SUMOReal MSVehicle::processNextStop ( SUMOReal  currentVelocity)

Processes stops, returns the velocity needed to reach the stop.

Returns
The velocity in dependance to the next/current stop
Todo:
Describe more detailed
See also
Stop
MSBusStop
MSContainerStop

Definition at line 831 of file MSVehicle.cpp.

References MSVehicleControl::addWaiting(), MSVehicle::Stop::awaitedContainers, MSVehicle::Stop::awaitedPersons, MSPersonControl::boardAnyWaiting(), BUS_STOP_OFFSET, MSVehicle::Stop::busstop, MSVehicle::Stop::containerstop, MSVehicle::Stop::containerTriggered, DELTA_T, MSVehicle::Stop::duration, MSVehicle::Stop::edge, MSVehicle::Stop::endPos, MSBusStop::enter(), MSContainerStop::enter(), MSBusStop::getBeginLanePosition(), MSContainerStop::getBeginLanePosition(), getCarFollowModel(), MSNet::getContainerControl(), MSDevice_Container::getContainers(), MSNet::getCurrentTimeStep(), MSLane::getEdge(), MSBusStop::getEndLanePosition(), MSContainerStop::getEndLanePosition(), MSNet::getInstance(), MSBusStop::getLastFreePos(), MSContainerStop::getLastFreePos(), MSVehicleType::getLength(), MSVehicleType::getMinGap(), MSNet::getPersonControl(), MSDevice_Person::getPersons(), getSpeed(), MSNet::getVehicleControl(), MSBaseVehicle::getVehicleType(), MSNet::informVehicleStateListener(), MSVehicle::Stop::lane, MSContainerControl::loadAnyWaiting(), MAX2(), myAmRegisteredAsWaitingForContainer, myAmRegisteredAsWaitingForPerson, myContainerDevice, MSBaseVehicle::myCurrEdge, myLane, myPersonDevice, myState, myStops, MSBaseVehicle::myType, MSVehicle::State::pos(), MSVehicle::Stop::reached, MSVehicleControl::registerOneWaitingForContainer(), MSVehicleControl::registerOneWaitingForPerson(), MSContainerStop::removeContainer(), MSBusStop::removePerson(), resumeFromStopping(), MSCFModel::stopSpeed(), SUMOReal, MSVehicle::Stop::triggered, MSVehicleControl::unregisterOneWaitingForContainer(), MSVehicleControl::unregisterOneWaitingForPerson(), MSVehicle::Stop::until, and MSNet::VEHICLE_STATE_STARTING_STOP.

Referenced by MSVehicleTransfer::checkInsertions(), MSCFModel_Daniel1::moveHelper(), MSCFModel_KraussOrig1::moveHelper(), MSCFModel_SmartSK::moveHelper(), and MSCFModel::moveHelper().

void MSBaseVehicle::removeReminder ( MSMoveReminder rem)
inherited

Removes a MoveReminder dynamically.

Parameters
[in]remthe reminder to remove
See also
MSMoveReminder

Definition at line 296 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myMoveReminders.

bool MSVehicle::replaceRoute ( const MSRoute route,
bool  onInit = false,
int  offset = 0 
)
virtual

Replaces the current route by the given one.

It is possible that the new route is not accepted, if it does not contain the vehicle's current edge.

Parameters
[in]routeThe new route to pass
Returns
Whether the new route was accepted

Implements SUMOVehicle.

Definition at line 457 of file MSVehicle.cpp.

References MSRoute::addReference(), addStop(), MSRoute::begin(), MSBaseVehicle::calculateArrivalPos(), MSRoute::contains(), MSRoute::getEdges(), MSNet::getInstance(), MSRoute::getStops(), MSNet::informVehicleStateListener(), MSBaseVehicle::myCurrEdge, myLastBestLanesEdge, myLastBestLanesInternalLane, MSBaseVehicle::myNumberReroutes, MSBaseVehicle::myRoute, myStops, MSRoute::release(), updateBestLanes(), MSNet::VEHICLE_STATE_NEWROUTE, and WRITE_WARNING.

Referenced by TraCIServerAPI_Vehicle::processSet().

bool MSBaseVehicle::replaceRouteEdges ( ConstMSEdgeVector edges,
bool  onInit = false 
)
virtualinherited

Replaces the current route by the given edges.

It is possible that the new route is not accepted, if a) it does not contain the vehicle's current edge, or b) something fails on insertion into the routes container (see in-line comments).

Parameters
[in]edgesThe new list of edges to pass
[in]simTimeThe time at which the route was replaced
Returns
Whether the new route was accepted

Implements SUMOVehicle.

Definition at line 170 of file MSBaseVehicle.cpp.

References MSRoute::addReference(), MSRoute::begin(), RGBColor::DEFAULT_COLOR, MSRoute::dictionary(), MSRoute::getColor(), MSRoute::getEdges(), Named::getID(), MSBaseVehicle::getID(), MSBaseVehicle::getNumberReroutes(), MSBaseVehicle::getRerouteOrigin(), MSRoute::getStops(), MSBaseVehicle::myCurrEdge, MSBaseVehicle::myRoute, MSRoute::release(), SUMOVehicle::replaceRoute(), toString(), and WRITE_WARNING.

Referenced by MSVehicle::Influencer::postProcessVTD(), TraCIServerAPI_Vehicle::processSet(), and MSBaseVehicle::reroute().

void MSVehicle::replaceVehicleType ( MSVehicleType type)

Replaces the current vehicle type by the one given.

If the currently used vehicle type is marked as being used by this vehicle only, it is deleted, first. The new, given type is then assigned to "myType".

Parameters
[in]typeThe new vehicle type
See also
MSVehicle::myType

Definition at line 2408 of file MSVehicle.cpp.

References MSVehicleType::amVehicleSpecific(), and MSBaseVehicle::myType.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSBaseVehicle::reroute ( SUMOTime  t,
SUMOAbstractRouter< MSEdge, SUMOVehicle > &  router,
const bool  onInit = false,
const bool  withTaz = false 
)
virtualinherited

Performs a rerouting using the given router.

Tries to find a new route between the current edge and the destination edge, first. Tries to replace the current route by the new one using replaceRoute.

Parameters
[in]tThe time for which the route is computed
[in]routerThe router to use
See also
replaceRoute

Implements SUMOVehicle.

Definition at line 138 of file MSBaseVehicle.cpp.

References SUMOAbstractRouter< E, V >::compute(), MSEdge::dictionary(), MSEdge::EDGEFUNCTION_DISTRICT, SUMOVehicleParameter::fromTaz, MSRoute::getLastEdge(), MSBaseVehicle::getRerouteOrigin(), MSBaseVehicle::getStopEdges(), MSBaseVehicle::myParameter, MSBaseVehicle::myRoute, MSBaseVehicle::replaceRouteEdges(), and SUMOVehicleParameter::toTaz.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::resetRoutePosition ( unsigned int  index)
void MSBaseVehicle::setChosenSpeedFactor ( const SUMOReal  factor)
inlinevirtualinherited

Returns the precomputed factor by which the driver wants to be faster than the speed limit.

Returns
Speed limit factor

Implements SUMOVehicle.

Definition at line 297 of file MSBaseVehicle.h.

References MSBaseVehicle::myChosenSpeedFactor.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::setTentativeLaneAndPosition ( MSLane lane,
const SUMOReal  pos 
)

set tentative lane and position during insertion to ensure that all cfmodels work (some of them require veh->getLane() to return a valid lane) Once the vehicle is sucessfully inserted the lane is set again (see enterLaneAtInsertion)

Definition at line 2423 of file MSVehicle.cpp.

References myLane, MSVehicle::State::myPos, and myState.

Referenced by MSLane::isInsertionSuccess(), MSLane::pWagGenericInsertion(), and MSLane::pWagSimpleInsertion().

bool MSVehicle::signalSet ( int  which) const
inline

Returns whether the given signal is on.

Parameters
[in]signalThe signal to return the value of
Returns
Whether the given signal is on

Definition at line 838 of file MSVehicle.h.

References mySignals.

Referenced by checkRewindLinkLanes(), drawAction_drawVehicleBlinker(), and drawAction_drawVehicleBrakeLight().

const MSEdge * MSBaseVehicle::succEdge ( unsigned int  nSuccs) const
virtualinherited

Returns the nSuccs'th successor of edge the vehicle is currently at.

If the rest of the route (counted from the current edge) has less than nSuccs edges, 0 is returned.

Parameters
[in]nSuccsThe number of edge to look forward
Returns
The nSuccs'th following edge in the vehicle's route

Implements SUMOVehicle.

Definition at line 122 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myCurrEdge.

Referenced by MSVehicleTransfer::add(), MSLane::appropriate(), MSVehicleTransfer::checkInsertions(), MSBaseVehicle::hasArrived(), and TraCIServerAPI_Vehicle::processSet().

void MSVehicle::switchOffSignal ( int  signal)
inline

Switches the given signal off.

Parameters
[in]signalThe signal to mark as being switched off

Definition at line 821 of file MSVehicle.h.

References mySignals.

Referenced by executeMove(), TraCIServerAPI_Vehicle::processSet(), and setBlinkerInformation().

void MSVehicle::switchOnSignal ( int  signal)
inline

Switches the given signal on.

Parameters
[in]signalThe signal to mark as being switched on

Definition at line 813 of file MSVehicle.h.

References mySignals.

Referenced by executeMove(), TraCIServerAPI_Vehicle::processSet(), and setBlinkerInformation().

void MSVehicle::updateBestLanes ( bool  forceRebuild = false,
const MSLane startLane = 0 
)

computes the best lanes to use in order to continue the route

The information is rebuilt if the vehicle is on a different edge than the one stored in "myLastBestLanesEdge" or "forceRebuild" is true.

Otherwise, only the density changes on the stored lanes are adapted to the container only.

A rebuild must be done if the vehicle leaves a stop; then, another lane may become the best one.

If no starting lane ("startLane") is given, the vehicle's current lane ("myLane") is used as start of bect lanes building.

Parameters
[in]forceRebuildWhether the best lanes container shall be rebuilt even if the vehicle's edge has not changed
[in]startLaneThe lane the process shall start at ("myLane" will be used if ==0)

Definition at line 1902 of file MSVehicle.cpp.

References abs, MSEdge::allowedLanes(), MSVehicle::LaneQ::allowsContinuation, MSLane::allowsVehicleClass(), ARRIVAL_LANE_GIVEN, SUMOVehicleParameter::arrivalLane, SUMOVehicleParameter::arrivalLaneProcedure, MSVehicle::LaneQ::bestContinuations, MSVehicle::LaneQ::bestLaneOffset, bla, MSEdge::clear(), MSEdge::EDGEFUNCTION_INTERNAL, MSRoute::end(), MSLane::getEdge(), MSLane::getInternalFollower(), MSEdge::getLanes(), MSLane::getLength(), MSEdge::getLength(), MSLane::getLinkCont(), MSLane::getLogicalPredecessorLane(), MSEdge::getPurpose(), MSVehicleType::getVehicleClass(), GLO_VEHICLE, gSelected, GUISelectedStorage::isSelected(), MSVehicle::LaneQ::lane, MSVehicle::Stop::lane, MSVehicle::LaneQ::length, MAX2(), MIN2(), MSBaseVehicle::myArrivalPos, myBestLanes, MSBaseVehicle::myCurrEdge, myCurrentLaneInBestLanes, myLane, myLastBestLanesEdge, myLastBestLanesInternalLane, MSBaseVehicle::myParameter, MSBaseVehicle::myRoute, myStops, MSBaseVehicle::myType, POSITION_EPS, MSVehicle::Stop::startPos, SUMOReal, and updateOccupancyAndCurrentBestLane().

Referenced by addTraciStop(), MSLaneChanger::change(), enterLaneAtLaneChange(), executeMove(), MSLane::forceVehicleInsertion(), MSEdge::getDepartLane(), MSLane::isInsertionSuccess(), MSLane::loadState(), MSVehicle::Influencer::postProcessVTD(), MSLane::pWagGenericInsertion(), MSLane::pWagSimpleInsertion(), replaceRoute(), and resumeFromStopping().

void MSVehicle::updateOccupancyAndCurrentBestLane ( const MSLane startLane)
protected

updates LaneQ::nextOccupation and myCurrentLaneInBestLanes

Definition at line 2151 of file MSVehicle.cpp.

References myBestLanes, myCurrentLaneInBestLanes, and SUMOReal.

Referenced by updateBestLanes().

bool MSVehicle::willPass ( const MSEdge *const  edge) const

Returns whether the vehicle wil pass the given edge.

Parameters
[in]Theedge to find in the vehicle's current route
Returns
Whether the given edge will be passed by the vehicle
Todo:
Move to MSRoute?

Definition at line 505 of file MSVehicle.cpp.

References MSRoute::end(), MSBaseVehicle::myCurrEdge, and MSBaseVehicle::myRoute.

Referenced by TraCIServerAPI_Vehicle::processSet().

void MSVehicle::workOnMoveReminders ( SUMOReal  oldPos,
SUMOReal  newPos,
SUMOReal  newSpeed 
)

Processes active move reminder.

This method goes through all active move reminder, both those for the current lane, stored in "myMoveReminders" and those of prior lanes stored in "myOldLaneMoveReminders" calling "MSMoveReminder::notifyMove".

When processing move reminder from "myOldLaneMoveReminders", the offsets (prior lane lengths) are used, which are stored in "myOldLaneMoveReminderOffsets".

Each move reminder which is no longer active is removed from the container.

Parameters
[in]oldPosThe position the vehicle had before it has moved
[in]newPosThe position the vehicle has after it has moved
[in]newSpeedThe vehicle's speed within this move
See also
MSMoveReminder

Definition at line 548 of file MSVehicle.cpp.

References MSBaseVehicle::myMoveReminders.

Referenced by executeMove(), MSLane::executeMovements(), and onRemovalFromNet().

Friends And Related Function Documentation

friend class MSLaneChanger
friend

the lane changer sets myLastLaneChangeOffset

Definition at line 84 of file MSVehicle.h.

Field Documentation

SUMOReal MSVehicle::myAcceleration
protected
bool MSVehicle::myAmOnNet
protected

Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived)

Definition at line 1185 of file MSVehicle.h.

Referenced by enterLaneAtInsertion(), enterLaneAtLaneChange(), enterLaneAtMove(), isOnRoad(), and leaveLane().

bool MSVehicle::myAmRegisteredAsWaitingForContainer
protected

Whether this vehicle is registered as waiting for a container (for deadlock-recognition)

Definition at line 1191 of file MSVehicle.h.

Referenced by processNextStop(), and resumeFromStopping().

bool MSVehicle::myAmRegisteredAsWaitingForPerson
protected

Whether this vehicle is registered as waiting for a person (for deadlock-recognition)

Definition at line 1188 of file MSVehicle.h.

Referenced by processNextStop(), and resumeFromStopping().

SUMOReal MSBaseVehicle::myArrivalPos
protectedinherited

the position on the destination lane where the vehicle stops

Definition at line 366 of file MSBaseVehicle.h.

Referenced by MSBaseVehicle::calculateArrivalPos(), MSBaseVehicle::getArrivalPos(), hasArrived(), planMoveInternal(), resetRoutePosition(), and updateBestLanes().

std::vector<std::vector<LaneQ> > MSVehicle::myBestLanes
protected
Position MSVehicle::myCachedPosition
mutableprotected
MSCFModel::VehicleVariables* MSVehicle::myCFVariables
private

The per vehicle variables of the car following model.

Definition at line 1306 of file MSVehicle.h.

Referenced by getCarFollowVariables(), and MSVehicle().

SUMOReal MSBaseVehicle::myChosenSpeedFactor
protectedinherited

A precomputed factor by which the driver wants to be faster than the speed limit.

Definition at line 346 of file MSBaseVehicle.h.

Referenced by MSBaseVehicle::getChosenSpeedFactor(), and MSBaseVehicle::setChosenSpeedFactor().

MSDevice_Container* MSVehicle::myContainerDevice
protected

The containers this vehicle may have.

Definition at line 1173 of file MSVehicle.h.

Referenced by addContainer(), GUIVehicle::drawGL(), getContainerNumber(), and processNextStop().

std::vector<LaneQ>::iterator MSVehicle::myCurrentLaneInBestLanes
protected

Definition at line 1163 of file MSVehicle.h.

Referenced by updateBestLanes(), and updateOccupancyAndCurrentBestLane().

SUMOTime MSBaseVehicle::myDeparture
protectedinherited

The real departure time.

Definition at line 363 of file MSBaseVehicle.h.

Referenced by MSBaseVehicle::getDeparture(), MSBaseVehicle::hasDeparted(), loadState(), MSBaseVehicle::onDepart(), and saveState().

std::vector<MSDevice*> MSBaseVehicle::myDevices
protectedinherited
MSEdgeWeightsStorage* MSVehicle::myEdgeWeights
mutableprivate

Definition at line 1303 of file MSVehicle.h.

Referenced by _getWeightsStorage(), and ~MSVehicle().

std::vector< MSLane * > MSVehicle::myEmptyLaneVector
staticprotected

Definition at line 1164 of file MSVehicle.h.

Referenced by getBestLanesContinuation().

std::vector<MSLane*> MSVehicle::myFurtherLanes
protected

The information into which lanes the vehicle laps into.

Definition at line 1179 of file MSVehicle.h.

Referenced by enterLaneAtInsertion(), enterLaneAtLaneChange(), executeMove(), getAngle(), GUIVehicle::getPreviousLane(), leaveLane(), and ~MSVehicle().

bool MSVehicle::myHaveToWaitOnNextLink
protected

Definition at line 1193 of file MSVehicle.h.

Referenced by checkRewindLinkLanes(), and executeMove().

Influencer* MSVehicle::myInfluencer
private

An instance of a velocity/lane influencing instance; built in "getInfluencer".

Definition at line 1310 of file MSVehicle.h.

Referenced by checkRewindLinkLanes(), executeMove(), getInfluencer(), getSpeedWithoutTraciInfluence(), hasInfluencer(), planMoveInternal(), and ~MSVehicle().

MSAbstractLaneChangeModel* MSVehicle::myLaneChangeModel
protected

Definition at line 1157 of file MSVehicle.h.

Referenced by getLaneChangeModel(), MSVehicle(), and ~MSVehicle().

const MSEdge* MSVehicle::myLastBestLanesEdge
protected

Definition at line 1159 of file MSVehicle.h.

Referenced by replaceRoute(), and updateBestLanes().

const MSLane* MSVehicle::myLastBestLanesInternalLane
protected

Definition at line 1160 of file MSVehicle.h.

Referenced by replaceRoute(), and updateBestLanes().

DriveItemVector MSVehicle::myLFLinkLanes
protected

Container for used Links/visited Lanes during lookForward.

Definition at line 1252 of file MSVehicle.h.

Referenced by GUIVehicle::drawGLAdditional(), executeMove(), onRemovalFromNet(), planMove(), GUIVehicle::selectBlockingFoes(), and ~MSVehicle().

unsigned int MSBaseVehicle::myNumberReroutes
protectedinherited

The number of reroutings.

Definition at line 369 of file MSBaseVehicle.h.

Referenced by MSBaseVehicle::getNumberReroutes(), and replaceRoute().

MSDevice_Person* MSVehicle::myPersonDevice
protected

The passengers this vehicle may have.

Definition at line 1170 of file MSVehicle.h.

Referenced by addPerson(), GUIVehicle::drawGL(), GUIVehicle::getNumPassengers(), getPersonNumber(), and processNextStop().

int MSVehicle::mySignals
protected

State of things of the vehicle that can be on or off.

Definition at line 1182 of file MSVehicle.h.

Referenced by getSignals(), signalSet(), switchOffSignal(), and switchOnSignal().

SUMOTime MSVehicle::myWaitingTime
protected

The time the vehicle waits (is not faster than 0.1m/s) in seconds.

Definition at line 1149 of file MSVehicle.h.

Referenced by enterLaneAtInsertion(), executeMove(), getWaitingSeconds(), getWaitingTime(), and resumeFromStopping().


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