SUMO - Simulation of Urban MObility
MEVehicle Class Reference

A vehicle from the mesoscopic point of view. More...

#include <MEVehicle.h>

Inheritance diagram for MEVehicle:
Inheritance graph
Collaboration diagram for MEVehicle:
Collaboration graph

Public Member Functions

virtual void activateReminders (const MSMoveReminder::Notification reason)
 "Activates" all current move reminder More...
 
virtual void addContainer (MSTransportable *container)
 Adds a container to this vehicle. More...
 
virtual void addPerson (MSTransportable *person)
 Adds a person to this vehicle. More...
 
void addReminder (MSMoveReminder *rem)
 Adds a MoveReminder dynamically. More...
 
bool addStop (const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
 Adds a stop. More...
 
void addStops (const bool ignoreStopErrors)
 Adds stops to the built vehicle. More...
 
SUMOReal estimateLeaveSpeed (const MSLink *link) const
 Returns the vehicle's estimated speed after driving accross the link. More...
 
virtual SUMOReal getAcceleration () const
 Returns the vehicle's acceleration. More...
 
SUMOReal getAngle () const
 Returns the vehicle's direction in degrees. More...
 
virtual SUMOReal getArrivalPos () const
 Returns this vehicle's desired arrivalPos for its current route (may change on reroute) More...
 
SUMOReal getAverageSpeed () const
 Returns the vehicle's estimated average speed on the segment assuming no further delays. More...
 
SUMOTime getBlockTime () const
 Returns the time at which the vehicle was blocked. More...
 
SUMOReal getBlockTimeSeconds () const
 Returns the time at which the vehicle was blocked on the current segment. More...
 
SUMOReal getChosenSpeedFactor () const
 Returns the precomputed factor by which the driver wants to be faster than the speed limit. More...
 
SUMOReal getConservativeSpeed (SUMOTime &earliestArrival) const
 Returns the vehicle's estimated speed taking into account delays. More...
 
const MSRouteIteratorgetCurrentRouteEdge () const
 Returns an iterator pointing to the current edge in this vehicles route. More...
 
SUMOTime getDepartDelay () const
 Returns the depart delay. More...
 
SUMOReal getDepartPos () const
 Returns this vehicle's real departure position. 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...
 
const MSEdgegetEdge () const
 Returns the edge the vehicle is currently at. More...
 
SUMOTime getEventTime () const
 Returns the (planned) time at which the vehicle leaves his current cell. More...
 
SUMOReal getEventTimeSeconds () const
 Returns the earliest leave time for the current segment. More...
 
const std::string & getID () const
 Returns the name of the vehicle. More...
 
SUMOReal getImpatience () const
 Returns this vehicles impatience. More...
 
MSLanegetLane () const
 Returns the lane the vehicle is on. More...
 
SUMOTime getLastEntryTime () const
 Returns the time the vehicle entered the current segment. More...
 
SUMOReal getLastEntryTimeSeconds () const
 Returns the entry time for the current segment. More...
 
SUMOReal getMaxSpeed () const
 Returns the maximum speed. More...
 
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...
 
Position getPosition (const SUMOReal offset=0) const
 Return current position (x/y, cartesian) More...
 
SUMOReal getPositionOnLane () const
 Get the vehicle's position along the lane. More...
 
size_t getQueIndex () const
 Returns the index of the que the vehicle is in. More...
 
virtual const MSEdgegetRerouteOrigin () const
 Returns the starting point for reroutes (usually the current edge) More...
 
const MSRoutegetRoute () const
 Returns the current route. More...
 
MESegmentgetSegment () const
 Returns the current segment the vehicle is on. More...
 
SUMOReal getSlope () const
 Returns the slope of the road at vehicle's position. More...
 
SUMOReal getSpeed () const
 Returns the vehicle's estimated speed assuming no delays. More...
 
const ConstMSEdgeVector getStopEdges () const
 Returns the list of still pending stop edges. More...
 
SUMOTime getStoptime (const MESegment *const seg) const
 Returns how long to stop at the given segment. More...
 
SUMOVehicleClass getVClass () const
 Returns the vehicle's access class. More...
 
const MSVehicleTypegetVehicleType () const
 Returns the vehicle's type definition. More...
 
SUMOReal getWaitingSeconds () const
 Returns the number of seconds waited (speed was lesser than 0.1m/s) More...
 
SUMOTime getWaitingTime () const
 Returns the duration for which the vehicle was blocked. More...
 
bool hasArrived () const
 Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) More...
 
bool hasDeparted () const
 Returns whether this vehicle has already departed. More...
 
bool hasValidRoute (std::string &msg) const
 Validates the current route. More...
 
bool isOnRoad () const
 Returns the information whether the vehicle is on a road (is simulated) More...
 
bool isParking () const
 Returns whether the vehicle is parking. More...
 
bool isStopped () const
 Returns whether the vehicle is at a stop. More...
 
bool isStoppedTriggered () const
 Returns whether the vehicle is on a triggered stop. More...
 
bool mayProceed () const
 Returns whether the vehicle is allowed to pass the next junction. More...
 
 MEVehicle (SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
 Constructor. More...
 
bool moveRoutePointer ()
 Update when the vehicle enters a new edge in the move step. More...
 
void onDepart ()
 Called when the vehicle is inserted into the network. More...
 
void removeReminder (MSMoveReminder *rem)
 Removes a MoveReminder dynamically. More...
 
bool replaceRoute (const MSRoute *route, bool onInit=false, int offset=0)
 Replaces the current route by the given one. More...
 
bool replaceRouteEdges (ConstMSEdgeVector &edges, bool onInit=false)
 Replaces the current route by the given edges. 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...
 
virtual void setArrivalPos (SUMOReal arrivalPos)
 Sets this vehicle's desired arrivalPos for its current route. More...
 
void setBlockTime (const SUMOTime t)
 Sets the time at which the vehicle was blocked. More...
 
void setChosenSpeedFactor (const SUMOReal factor)
 Returns the precomputed factor by which the driver wants to be faster than the speed limit. More...
 
void setEventTime (SUMOTime t, bool hasDelay=true)
 Sets the (planned) time at which the vehicle leaves his current cell. More...
 
void setLastEntryTime (SUMOTime t)
 Sets the entry time for the current segment. More...
 
virtual void setSegment (MESegment *s, size_t idx=0)
 Sets the current segment the vehicle is at together with its que. More...
 
const MSEdgesuccEdge (unsigned int nSuccs) const
 Returns the nSuccs'th successor of edge the vehicle is currently at. More...
 
void updateDetectorForWriting (MSMoveReminder *rem, SUMOTime currentTime, SUMOTime exitTime)
 Updates a single vehicle detector if present. More...
 
void updateDetectors (SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
 Updates all vehicle detectors. 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...
 

Protected Member Functions

void calculateArrivalParams ()
 (Re-)Calculates the arrival position and lane from the vehicle parameters More...
 

Protected Attributes

int myArrivalLane
 The destination lane where the vehicle stops. More...
 
SUMOReal myArrivalPos
 The position on the destination lane where the vehicle stops. More...
 
SUMOTime myBlockTime
 The time at which the vehicle was blocked on its current segment. More...
 
SUMOReal myChosenSpeedFactor
 A precomputed factor by which the driver wants to be faster than the speed limit. More...
 
MSRouteIterator myCurrEdge
 Iterator to current route-edge. More...
 
SUMOReal myDepartPos
 The real depart position. More...
 
SUMOTime myDeparture
 The real departure time. More...
 
std::vector< MSDevice * > myDevices
 The devices this vehicle has. More...
 
SUMOTime myEventTime
 The (planned) time of leaving the segment (cell) More...
 
SUMOTime myLastEntryTime
 The time the vehicle entered its current segment. More...
 
unsigned int myNumberReroutes
 The number of reroutings. More...
 
const SUMOVehicleParametermyParameter
 This Vehicle's parameter. More...
 
size_t myQueIndex
 Index of the que the vehicle is in (important for multiqueue extension) More...
 
const MSRoutemyRoute
 This Vehicle's route. More...
 
MESegmentmySegment
 The segment the vehicle is at. More...
 
std::map< const MESegment *const, SUMOTimemyStops
 where to stop More...
 
const MSVehicleTypemyType
 This Vehicle's type. More...
 

Static Protected Attributes

static const SUMOTime NOT_YET_DEPARTED = SUMOTime_MAX
 

Move reminder structures

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

Detailed Description

A vehicle from the mesoscopic point of view.

Definition at line 52 of file MEVehicle.h.

Member Typedef Documentation

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

Definition of a move reminder container.

Definition at line 375 of file MSBaseVehicle.h.

Constructor & Destructor Documentation

MEVehicle::MEVehicle ( SUMOVehicleParameter pars,
const MSRoute route,
const MSVehicleType type,
const SUMOReal  speedFactor 
)

Constructor.

Parameters
[in]parsThe vehicle description
[in]routeThe vehicle's route
[in]typeThe vehicle's type
[in]speedFactorThe factor for driven lane's speed limits
Exceptions
ProcessErrorIf a value is wrong

Definition at line 57 of file MEVehicle.cpp.

References DEPART_SPEED_GIVEN, SUMOVehicleParameter::departSpeed, SUMOVehicleParameter::departSpeedProcedure, MSEdge::EDGEFUNCTION_DISTRICT, MSVehicleType::getID(), MSVehicleType::getMaxSpeed(), MSVehicleType::getVehicleClass(), SUMOVehicleParameter::id, and SUMOReal.

Member Function Documentation

void MSBaseVehicle::activateReminders ( const MSMoveReminder::Notification  reason)
virtualinherited

"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 in MSVehicle.

Definition at line 307 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myMoveReminders.

Referenced by MSBaseVehicle::getDevices(), MESegment::receive(), and MELoop::teleportVehicle().

void MSBaseVehicle::addContainer ( MSTransportable container)
virtualinherited

Adds a container to this vehicle.

The default implementation does nothing since containers are not supported by default

Parameters
[in]containerThe container to add

Implements SUMOVehicle.

Reimplemented in MSVehicle.

Definition at line 254 of file MSBaseVehicle.cpp.

Referenced by MSBaseVehicle::getDevices().

void MSBaseVehicle::addPerson ( MSTransportable person)
virtualinherited

Adds a person to this vehicle.

The default implementation does nothing since persons are not supported by default

Parameters
[in]personThe person to add

Implements SUMOVehicle.

Reimplemented in MSVehicle.

Definition at line 250 of file MSBaseVehicle.cpp.

Referenced by MSBaseVehicle::getDevices().

void MSBaseVehicle::addReminder ( MSMoveReminder rem)
inherited

Adds a MoveReminder dynamically.

Parameters
[in]remthe reminder to add
See also
MSMoveReminder

Definition at line 280 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myMoveReminders.

Referenced by MSVehicle::adaptLaneEntering2MoveReminder(), MESegment::addReminders(), MSVehicle::enterLaneAtInsertion(), MSVehicle::enterLaneAtLaneChange(), and MSBaseVehicle::getDevices().

bool MEVehicle::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 214 of file MEVehicle.cpp.

References MSEdge::dictionary(), SUMOVehicleParameter::Stop::duration, SUMOVehicleParameter::Stop::endPos, MELoop::getSegmentForEdge(), MSGlobals::gMesoNet, SUMOVehicleParameter::Stop::lane, and myStops.

Referenced by getLane().

void MSBaseVehicle::addStops ( const bool  ignoreStopErrors)
inherited
SUMOReal MEVehicle::estimateLeaveSpeed ( const MSLink link) const

Returns the vehicle's estimated speed after driving accross the link.

See also
MSVehicle.cpp::estimateLeaveSpeed

Definition at line 123 of file MEVehicle.cpp.

References MSVehicleType::getCarFollowModel(), MSLink::getLength(), MSCFModel::getMaxAccel(), getSpeed(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSLink::getViaLaneOrLane(), MIN2(), and SUMOReal.

Referenced by getLane(), and MESegment::isOpen().

SUMOReal MSBaseVehicle::getAcceleration ( ) const
virtualinherited

Returns the vehicle's acceleration.

This default implementation returns always 0.

Returns
The acceleration

Implements SUMOVehicle.

Reimplemented in MSVehicle.

Definition at line 219 of file MSBaseVehicle.cpp.

References SUMOReal.

Referenced by MSBaseVehicle::getCurrentRouteEdge().

SUMOReal MEVehicle::getAngle ( ) const
virtual

Returns the vehicle's direction in degrees.

Returns
The vehicle's current angle

Implements SUMOVehicle.

Definition at line 86 of file MEVehicle.cpp.

References MSBaseVehicle::getEdge(), MSEdge::getLanes(), getPositionOnLane(), MSLane::getShape(), MSLane::interpolateLanePosToGeometryPos(), PositionVector::rotationAtOffset(), and SUMOReal.

Referenced by GUIMEVehicle::getParameterWindow().

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 223 of file MSBaseVehicle.h.

References MSBaseVehicle::myArrivalPos.

SUMOReal MEVehicle::getAverageSpeed ( ) const

Returns the vehicle's estimated average speed on the segment assuming no further delays.

Returns
The vehicle's estimated average speed
Note
This is only an upper bound. The speed will be lower if the preceeding vehicle is delayed

Definition at line 117 of file MEVehicle.cpp.

References MESegment::getLength(), myEventTime, myLastEntryTime, mySegment, STEPS2TIME, and SUMOReal.

Referenced by getLane(), and getSpeed().

SUMOTime MEVehicle::getBlockTime ( ) const
inline

Returns the time at which the vehicle was blocked.

Returns
The blocking time

Definition at line 248 of file MEVehicle.h.

References myBlockTime.

Referenced by MELoop::checkCar(), and getBlockTimeSeconds().

SUMOReal MEVehicle::getBlockTimeSeconds ( ) const
inline

Returns the time at which the vehicle was blocked on the current segment.

Definition at line 281 of file MEVehicle.h.

References getBlockTime(), loadState(), mayProceed(), MSMoveReminder::NOTIFICATION_JUNCTION, replaceRoute(), saveState(), STEPS2TIME, updateDetectorForWriting(), and updateDetectors().

Referenced by GUIMEVehicle::getParameterWindow().

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 312 of file MSBaseVehicle.h.

References MSBaseVehicle::myChosenSpeedFactor.

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

SUMOReal MEVehicle::getConservativeSpeed ( SUMOTime earliestArrival) const

Returns the vehicle's estimated speed taking into account delays.

Returns
The vehicle's estimated speed
Parameters
[in,out]earliestArrivalA lower bound on leaveTime, modified to contain new lower bound on leave Time
Note
This is only an upper bound. The speed may be even lower if there are further delays downstream

Definition at line 132 of file MEVehicle.cpp.

References DELTA_T, MESegment::getLength(), MAX2(), myEventTime, myLastEntryTime, mySegment, and STEPS2TIME.

Referenced by getLane().

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 148 of file MSBaseVehicle.h.

References MSBaseVehicle::getAcceleration(), MSBaseVehicle::getSlope(), MSBaseVehicle::myCurrEdge, MSBaseVehicle::onDepart(), MSBaseVehicle::replaceRouteEdges(), MSBaseVehicle::reroute(), and SUMOReal.

Referenced by TraCIServerAPI_Vehicle::vtdMap_matchingRoutePosition().

SUMOTime MSBaseVehicle::getDepartDelay ( ) const
inlinevirtualinherited
SUMOReal MSBaseVehicle::getDepartPos ( ) const
inlinevirtualinherited

Returns this vehicle's real departure position.

Returns
This vehicle's real departure position

Implements SUMOVehicle.

Definition at line 215 of file MSBaseVehicle.h.

References MSBaseVehicle::myDepartPos.

Referenced by TraCIServerAPI_Vehicle::processGet().

SUMOTime MSBaseVehicle::getDeparture ( ) const
inlinevirtualinherited

Returns this vehicle's real departure time.

Returns
This vehicle's real departure time

Implements SUMOVehicle.

Definition at line 202 of file MSBaseVehicle.h.

References MSBaseVehicle::myDeparture.

Referenced by MSBaseVehicle::getDepartDelay().

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 377 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myDevices.

Referenced by GUIBaseVehicle::drawGL(), MSBaseVehicle::setChosenSpeedFactor(), and MSBatteryExport::write().

const std::vector<MSDevice*>& MSBaseVehicle::getDevices ( ) const
inlinevirtualinherited
SUMOTime MEVehicle::getEventTime ( ) const
inline

Returns the (planned) time at which the vehicle leaves his current cell.

Returns
The time the vehicle thinks he leaves his cell at

Definition at line 189 of file MEVehicle.h.

References myEventTime.

Referenced by MELoop::addLeaderCar(), MELoop::checkCar(), getEventTimeSeconds(), MESegment::isOpen(), MESegment::receive(), MELoop::removeLeaderCar(), MESegment::send(), MELoop::setApproaching(), MESegment::setSpeedForQueue(), MELoop::teleportVehicle(), and updateDetectors().

SUMOReal MEVehicle::getEventTimeSeconds ( ) const
inline

Returns the earliest leave time for the current segment.

Definition at line 271 of file MEVehicle.h.

References getEventTime(), and STEPS2TIME.

Referenced by GUIMEVehicle::getParameterWindow().

const std::string & MSBaseVehicle::getID ( ) const
virtualinherited

Returns the name of the vehicle.

Implements SUMOVehicle.

Definition at line 105 of file MSBaseVehicle.cpp.

References SUMOVehicleParameter::id, and MSBaseVehicle::myParameter.

Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSVehicleTransfer::add(), MSBaseVehicle::addStops(), MSVehicle::addTraciBusOrContainerStop(), MSBaseVehicle::calculateArrivalParams(), MSLaneChanger::change(), MELoop::changeSegment(), MSLane::checkFailure(), MSVehicleTransfer::checkInsertions(), MSVehicle::checkRewindLinkLanes(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), MSCalibrator::execute(), MSVehicle::executeMove(), MSLane::executeMovements(), MSE2Collector::getCurrentVehicleIDs(), MSE2Collector::getEstimateQueueLength(), GUIMEVehicle::getParameterWindow(), GUIVehicle::getParameterWindow(), MSLane::handleCollision(), MSLCM_JE2013::inform(), MSLCM_JE2013::informFollower(), MSLCM_JE2013::informLeader(), MESegment::initialise(), MSPedestrianPushButton::isActiveForEdge(), MSLane::isInsertionSuccess(), MSVehicle::leaveLane(), MSCFModel_Daniel1::moveHelper(), MSCFModel_SmartSK::moveHelper(), MSCalibrator::VehicleRemover::notifyEnter(), MSLCM_DK2008::patchSpeed(), MSLCM_JE2013::patchSpeed(), MSVehicle::planMoveInternal(), TraCIServerAPI_Vehicle::processSet(), MSBaseVehicle::replaceRouteEdges(), MSLCM_JE2013::saveBlockerLength(), MSCalibrator::scheduleRemoval(), TraCIServer::setVTDControlled(), MSLCM_JE2013::slowDownForBlocked(), MELoop::teleportVehicle(), METriggeredCalibrator::tryEmit(), tryID(), MSVehicle::updateBestLanes(), MSLCM_JE2013::wantsChange(), MSLCM_DK2008::wantsChangeToLeft(), MSLCM_DK2008::wantsChangeToRight(), MSBatteryExport::write(), and MSXMLRawOut::writeVehicle().

MSLane* MEVehicle::getLane ( ) const
inlinevirtual

Returns the lane the vehicle is on.

Returns
The vehicle's current lane

Implements SUMOVehicle.

Definition at line 85 of file MEVehicle.h.

References addStop(), estimateLeaveSpeed(), getAverageSpeed(), getConservativeSpeed(), getPosition(), getSpeed(), getStopEdges(), getStoptime(), hasArrived(), isOnRoad(), isParking(), isStopped(), isStoppedTriggered(), moveRoutePointer(), and SUMOReal.

SUMOTime MEVehicle::getLastEntryTime ( ) const
inline

Returns the time the vehicle entered the current segment.

Returns
The entry time

Definition at line 231 of file MEVehicle.h.

References myLastEntryTime.

Referenced by getLastEntryTimeSeconds(), MESegment::newArrival(), updateDetectorForWriting(), and updateDetectors().

SUMOReal MEVehicle::getLastEntryTimeSeconds ( ) const
inline

Returns the entry time for the current segment.

Definition at line 276 of file MEVehicle.h.

References getLastEntryTime(), and STEPS2TIME.

Referenced by GUIMEVehicle::getParameterWindow().

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 245 of file MSBaseVehicle.h.

References MSBaseVehicle::getImpatience(), MSBaseVehicle::myNumberReroutes, and SUMOReal.

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

Position MEVehicle::getPosition ( const SUMOReal  offset = 0) const
virtual

Return current position (x/y, cartesian)

If the vehicle's myLane is 0, Position::INVALID.

Parameters
[in]offsetoptional offset in longitudinal direction
Returns
The current position (in cartesian coordinates)
See also
myLane

Implements SUMOVehicle.

Definition at line 100 of file MEVehicle.cpp.

References MSLane::geometryPositionAtOffset(), MSBaseVehicle::getEdge(), MSEdge::getLanes(), getPositionOnLane(), and SUMOReal.

Referenced by getLane().

SUMOReal MEVehicle::getPositionOnLane ( ) const
virtual

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 78 of file MEVehicle.cpp.

References MESegment::getIndex(), MESegment::getLength(), mySegment, and SUMOReal.

Referenced by getAngle(), GUIMEVehicle::getParameterWindow(), GUIMEVehicle::getPosition(), getPosition(), getSlope(), and hasArrived().

size_t MEVehicle::getQueIndex ( ) const
inline

Returns the index of the que the vehicle is in.

Returns
The que index

Definition at line 215 of file MEVehicle.h.

References myQueIndex.

Referenced by MESegment::getLink(), MESegment::removeCar(), saveState(), and MESegment::send().

virtual const MSEdge* MSBaseVehicle::getRerouteOrigin ( ) const
inlinevirtualinherited

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

This differs from *myCurrEdge only if the vehicle is on an internal edge

Returns
The rerouting start point

Reimplemented in MSVehicle.

Definition at line 140 of file MSBaseVehicle.h.

References MSBaseVehicle::myCurrEdge.

Referenced by MSBaseVehicle::replaceRouteEdges(), and MSBaseVehicle::reroute().

MESegment* MEVehicle::getSegment ( ) const
inline

Returns the current segment the vehicle is on.

Returns
The segment the vehicle is on

Definition at line 207 of file MEVehicle.h.

References mySegment.

Referenced by MELoop::changeSegment(), MELoop::checkCar(), GUIMEVehicle::getColorValue(), GUIMEVehicle::getParameterWindow(), isOnRoad(), MESegment::loadState(), MELoop::setApproaching(), and MELoop::teleportVehicle().

SUMOReal MEVehicle::getSlope ( ) const
virtual

Returns the slope of the road at vehicle's position.

Returns
The slope

Reimplemented from MSBaseVehicle.

Definition at line 93 of file MEVehicle.cpp.

References MSBaseVehicle::getEdge(), MSEdge::getLanes(), getPositionOnLane(), MSLane::getShape(), MSLane::interpolateLanePosToGeometryPos(), and PositionVector::slopeDegreeAtOffset().

SUMOReal MEVehicle::getSpeed ( ) const
virtual

Returns the vehicle's estimated speed assuming no delays.

Returns
The vehicle's estimated speed
Note
This is only an upper bound. The speed will be lower if the preceeding vehicle is delayed

Implements SUMOVehicle.

Definition at line 107 of file MEVehicle.cpp.

References getAverageSpeed(), getWaitingTime(), and SUMOReal.

Referenced by estimateLeaveSpeed(), GUIMEVehicle::getColorValue(), getLane(), GUIMEVehicle::getParameterWindow(), MESegment::isOpen(), MESegment::newArrival(), MESegment::receive(), and MELoop::setApproaching().

const ConstMSEdgeVector MEVehicle::getStopEdges ( ) const
virtual

Returns the list of still pending stop edges.

Implements MSBaseVehicle.

Definition at line 245 of file MEVehicle.cpp.

References myStops.

Referenced by getLane().

SUMOTime MEVehicle::getStoptime ( const MESegment *const  seg) const

Returns how long to stop at the given segment.

Parameters
[in]segThe segment in question
Returns
stop time for the segment

Definition at line 236 of file MEVehicle.cpp.

References myStops.

Referenced by getLane(), and MESegment::receive().

SUMOVehicleClass MSBaseVehicle::getVClass ( ) const
inlinevirtualinherited

Returns the vehicle's access class.

Returns
The vehicle's access class

Implements SUMOVehicle.

Definition at line 101 of file MSBaseVehicle.h.

References MSBaseVehicle::getEdge(), MSBaseVehicle::getMaxSpeed(), MSVehicleType::getParameter(), MSBaseVehicle::myType, MSBaseVehicle::succEdge(), SUMOReal, and SUMOVTypeParameter::vehicleClass.

Referenced by MSPedestrianPushButton::isActiveForEdge().

const MSVehicleType& MSBaseVehicle::getVehicleType ( ) const
inlinevirtualinherited

Returns the vehicle's type definition.

Returns
The vehicle's type definition

Implements SUMOVehicle.

Definition at line 93 of file MSBaseVehicle.h.

References MSBaseVehicle::myType.

Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_LC2013::_patchSpeed(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSVehicle::addStop(), MSLane::basePos(), MSPersonControl::boardAnyWaiting(), MSLaneChanger::change(), MSLaneChanger::checkChange(), MSLane::checkFailure(), GUIApplicationWindow::checkGamingEvents(), MSVehicleTransfer::checkInsertions(), MSVehicle::checkRewindLinkLanes(), MSAbstractLaneChangeModel::continueLaneChangeManeuver(), MSE2Collector::detectorUpdate(), GUIVehicle::drawAction_drawLinkItems(), GUIVehicle::drawAction_drawRailCarriages(), GUIVehicle::drawAction_drawVehicleBlinker(), GUIVehicle::drawAction_drawVehicleBrakeLight(), GUIEdge::drawMesoVehicles(), MSLane::enteredByLaneChange(), MSVehicle::enterLaneAtLaneChange(), estimateLeaveSpeed(), MSVehicle::estimateLeaveSpeed(), MSVehicle::estimateSpeedAfterDistance(), MSVehicle::executeMove(), MSLane::executeMovements(), MSLane::freeInsertion(), MSLane::getBruttoOccupancy(), GUIBaseVehicle::getCenteringBoundary(), MSLane::getCriticalLeader(), MSEdge::getDepartLane(), MSE2Collector::getEstimatedCurrentVehicleNumber(), MSE2Collector::getEstimateQueueLength(), MSLane::getFollowerOnConsecutive(), MSBaseVehicle::getImpatience(), MSLane::getLastVehicleInformation(), MSLane::getLeader(), MSVehicle::getLeader(), MSLane::getLeaderOnConsecutive(), MSLane::getNettoOccupancy(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), MSVehicle::getTimeGap(), MSLink::getZipperSpeed(), MSLane::handleCollision(), MESegment::hasSpaceFor(), MSLane::incorporateVehicle(), MSLCM_JE2013::informFollower(), MSLCM_LC2013::informFollower(), MSLCM_JE2013::informLeader(), MSLCM_LC2013::informLeader(), MSLane::integrateNewVehicle(), MSLane::isInsertionSuccess(), MESegment::isOpen(), MSLane::lastInsertion(), MSLane::leftByLaneChange(), MSContainerControl::loadAnyWaiting(), MESegment::loadState(), MSLink::maybeOccupied(), MSVehicle::overlap(), MSLCM_DK2008::patchSpeed(), MSVehicle::planMoveInternal(), MSLane::planMovements(), MSAbstractLaneChangeModel::predInteraction(), TraCIServerAPI_Vehicle::processGet(), MSVehicle::processNextStop(), MESegment::receive(), MSLaneChanger::registerUnchanged(), MESegment::removeCar(), MSLane::removeVehicle(), MSLCM_JE2013::saveBlockerLength(), MSLCM_LC2013::saveBlockerLength(), GUIVehicle::selectBlockingFoes(), GUIBaseVehicle::setFunctionalColor(), MSLCM_JE2013::slowDownForBlocked(), MSLCM_LC2013::slowDownForBlocked(), MSLaneChanger::startChange(), MSAbstractLaneChangeModel::startLaneChangeManeuver(), MSVehicle::unsafeLinkAhead(), MSLCM_DK2008::wantsChangeToLeft(), MSLCM_DK2008::wantsChangeToRight(), MSBatteryExport::write(), MSLink::writeApproaching(), and MSQueueExport::writeLane().

SUMOReal MEVehicle::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 265 of file MEVehicle.h.

References getWaitingTime(), and STEPS2TIME.

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

SUMOTime MEVehicle::getWaitingTime ( ) const
inlinevirtual

Returns the duration for which the vehicle was blocked.

Implements SUMOVehicle.

Definition at line 254 of file MEVehicle.h.

References MAX2(), myBlockTime, and myEventTime.

Referenced by MELoop::checkCar(), getSpeed(), getWaitingSeconds(), MESegment::isOpen(), and MELoop::setApproaching().

bool MEVehicle::hasArrived ( ) const
virtual

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

Reimplemented from MSBaseVehicle.

Definition at line 153 of file MEVehicle.cpp.

References MSRoute::end(), getPositionOnLane(), MSBaseVehicle::myArrivalPos, MSBaseVehicle::myCurrEdge, myEventTime, MSBaseVehicle::myRoute, mySegment, POSITION_EPS, and SUMOTime_MIN.

Referenced by getLane(), moveRoutePointer(), and MESegment::receive().

bool MSBaseVehicle::hasDeparted ( ) const
virtualinherited
bool MSBaseVehicle::hasValidRoute ( std::string &  msg) const
virtualinherited

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

Implements SUMOVehicle.

Definition at line 258 of file MSBaseVehicle.cpp.

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

Referenced by MSBaseVehicle::getDevices(), MESegment::initialise(), and TraCIServerAPI_Vehicle::processGet().

bool MEVehicle::isOnRoad ( ) const
virtual

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

Returns
Whether the vehicle is simulated

Reimplemented from MSBaseVehicle.

Definition at line 162 of file MEVehicle.cpp.

References getSegment().

Referenced by getLane().

bool MEVehicle::isParking ( ) const
virtual

Returns whether the vehicle is parking.

Returns
whether the vehicle is parking

Implements SUMOVehicle.

Definition at line 168 of file MEVehicle.cpp.

Referenced by getLane(), and GUIMEVehicle::getStopInfo().

bool MEVehicle::isStopped ( ) const
virtual

Returns whether the vehicle is at a stop.

Returns
Whether it has stopped

Implements SUMOVehicle.

Definition at line 224 of file MEVehicle.cpp.

References mySegment, and myStops.

Referenced by MELoop::checkCar(), getLane(), and GUIMEVehicle::getStopInfo().

bool MEVehicle::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 230 of file MEVehicle.cpp.

Referenced by getLane().

bool MEVehicle::mayProceed ( ) const

Returns whether the vehicle is allowed to pass the next junction.

Returns
true iff the vehicle may drive over the next junction

Definition at line 255 of file MEVehicle.cpp.

References MESegment::isOpen(), and mySegment.

Referenced by MELoop::changeSegment(), MELoop::checkCar(), and getBlockTimeSeconds().

bool MEVehicle::moveRoutePointer ( )

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

Returns
Whether the vehicle's route has ended (due to vaporization, or because the destination was reached)

Definition at line 139 of file MEVehicle.cpp.

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

Referenced by METriggeredCalibrator::execute(), getLane(), MESegment::receive(), and MELoop::teleportVehicle().

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 231 of file MSBaseVehicle.cpp.

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

Referenced by MSVehicle::enterLaneAtInsertion(), MSBaseVehicle::getCurrentRouteEdge(), and MESegment::receive().

void MSBaseVehicle::removeReminder ( MSMoveReminder rem)
inherited

Removes a MoveReminder dynamically.

Parameters
[in]remthe reminder to remove
See also
MSMoveReminder

Definition at line 291 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myMoveReminders.

Referenced by MSBaseVehicle::getDevices().

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 171 of file MSBaseVehicle.cpp.

References MSRoute::addReference(), MSRoute::begin(), MSBaseVehicle::calculateArrivalParams(), 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(), MSRoute::size(), SUMOReal, toString(), and WRITE_WARNING.

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

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 139 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 MSBaseVehicle::getCurrentRouteEdge(), and TraCIServerAPI_Vehicle::processSet().

virtual void MSBaseVehicle::setArrivalPos ( SUMOReal  arrivalPos)
inlinevirtualinherited

Sets this vehicle's desired arrivalPos for its current route.

Implements SUMOVehicle.

Definition at line 229 of file MSBaseVehicle.h.

References MSBaseVehicle::hasArrived(), MSBaseVehicle::hasDeparted(), and MSBaseVehicle::myArrivalPos.

void MEVehicle::setBlockTime ( const SUMOTime  t)
inline

Sets the time at which the vehicle was blocked.

Parameters
[in]tThe blocking time

Definition at line 239 of file MEVehicle.h.

References myBlockTime, and myLastEntryTime.

Referenced by MELoop::checkCar(), and MESegment::receive().

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 319 of file MSBaseVehicle.h.

References MSBaseVehicle::addStops(), MSBaseVehicle::calculateArrivalParams(), MSBaseVehicle::getDevice(), MSBaseVehicle::getStopEdges(), MSBaseVehicle::myChosenSpeedFactor, and MSBaseVehicle::saveState().

Referenced by TraCIServerAPI_Vehicle::processSet().

void MEVehicle::setEventTime ( SUMOTime  t,
bool  hasDelay = true 
)
inline

Sets the (planned) time at which the vehicle leaves his current cell.

Parameters
[in]tThe leaving time

Definition at line 177 of file MEVehicle.h.

References MESegment::getEdge(), MSEdge::markDelayed(), myEventTime, myLastEntryTime, and mySegment.

Referenced by MELoop::checkCar(), METriggeredCalibrator::execute(), MESegment::receive(), MESegment::send(), MESegment::setSpeedForQueue(), and MELoop::teleportVehicle().

void MEVehicle::setLastEntryTime ( SUMOTime  t)
inline

Sets the entry time for the current segment.

Parameters
[in]tThe entry time

Definition at line 223 of file MEVehicle.h.

References myLastEntryTime.

Referenced by MESegment::receive().

virtual void MEVehicle::setSegment ( MESegment s,
size_t  idx = 0 
)
inlinevirtual

Sets the current segment the vehicle is at together with its que.

Parameters
[in]sThe current segment
[in]qThe current que

Reimplemented in GUIMEVehicle.

Definition at line 198 of file MEVehicle.h.

References myQueIndex, and mySegment.

Referenced by MELoop::changeSegment(), METriggeredCalibrator::execute(), loadState(), MESegment::receive(), GUIMEVehicle::setSegment(), and MELoop::teleportVehicle().

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 123 of file MSBaseVehicle.cpp.

References MSBaseVehicle::myCurrEdge.

Referenced by MSVehicleTransfer::add(), MSLane::appropriate(), MSVehicleTransfer::checkInsertions(), MESegment::getLink(), MSBaseVehicle::getVClass(), MSBaseVehicle::hasArrived(), MSPedestrianPushButton::isActiveForEdge(), MELoop::nextSegment(), TraCIServerAPI_Vehicle::processSet(), and MESegment::receive().

void MEVehicle::updateDetectorForWriting ( MSMoveReminder rem,
SUMOTime  currentTime,
SUMOTime  exitTime 
)

Updates a single vehicle detector if present.

Definition at line 261 of file MEVehicle.cpp.

References MESegment::getIndex(), getLastEntryTime(), MESegment::getLength(), MSBaseVehicle::myMoveReminders, mySegment, and MSMoveReminder::updateDetector().

Referenced by getBlockTimeSeconds().

Field Documentation

int MSBaseVehicle::myArrivalLane
protectedinherited

The destination lane where the vehicle stops.

Definition at line 394 of file MSBaseVehicle.h.

Referenced by MSBaseVehicle::calculateArrivalParams(), and MSVehicle::updateBestLanes().

SUMOReal MSBaseVehicle::myArrivalPos
protectedinherited
SUMOTime MEVehicle::myBlockTime
protected

The time at which the vehicle was blocked on its current segment.

Definition at line 329 of file MEVehicle.h.

Referenced by getBlockTime(), getWaitingTime(), loadState(), saveState(), and setBlockTime().

SUMOReal MSBaseVehicle::myChosenSpeedFactor
protectedinherited

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

Definition at line 368 of file MSBaseVehicle.h.

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

SUMOReal MSBaseVehicle::myDepartPos
protectedinherited

The real depart position.

Definition at line 388 of file MSBaseVehicle.h.

Referenced by MSBaseVehicle::getDepartPos(), and MSBaseVehicle::onDepart().

SUMOTime MEVehicle::myEventTime
protected

The (planned) time of leaving the segment (cell)

Definition at line 323 of file MEVehicle.h.

Referenced by getAverageSpeed(), getConservativeSpeed(), getEventTime(), getWaitingTime(), hasArrived(), loadState(), saveState(), and setEventTime().

SUMOTime MEVehicle::myLastEntryTime
protected

The time the vehicle entered its current segment.

Definition at line 326 of file MEVehicle.h.

Referenced by getAverageSpeed(), getConservativeSpeed(), getLastEntryTime(), loadState(), saveState(), setBlockTime(), setEventTime(), and setLastEntryTime().

unsigned int MSBaseVehicle::myNumberReroutes
protectedinherited

The number of reroutings.

Definition at line 397 of file MSBaseVehicle.h.

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

size_t MEVehicle::myQueIndex
protected

Index of the que the vehicle is in (important for multiqueue extension)

Definition at line 320 of file MEVehicle.h.

Referenced by getQueIndex(), and setSegment().

std::map<const MESegment* const, SUMOTime> MEVehicle::myStops
protected

where to stop

Definition at line 332 of file MEVehicle.h.

Referenced by addStop(), getStopEdges(), getStoptime(), and isStopped().

const SUMOTime MSBaseVehicle::NOT_YET_DEPARTED = SUMOTime_MAX
staticprotectedinherited

Definition at line 402 of file MSBaseVehicle.h.

Referenced by MSVehicle::enterLaneAtInsertion(), and MSBaseVehicle::hasDeparted().


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