SUMO - Simulation of Urban MObility
MSAbstractLaneChangeModel Class Referenceabstract

Interface for lane-change models. More...

#include <MSAbstractLaneChangeModel.h>

Inheritance diagram for MSAbstractLaneChangeModel:
Inheritance graph
Collaboration diagram for MSAbstractLaneChangeModel:
Collaboration graph

Data Structures

class  MSLCMessager
 A class responsible for exchanging messages between cars involved in lane-change interaction. More...
 

Public Member Functions

bool alreadyMoved () const
 reset the flag whether a vehicle already moved to false More...
 
virtual void changed (int dir)=0
 
void continueLaneChangeManeuver (bool moved)
 
void endLaneChangeManeuver (const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
 
SUMOReal getLaneChangeCompletion () const
 return whether the vehicle passed the midpoint of a continuous lane change maneuver More...
 
int getLaneChangeDirection () const
 return the direction of the current lane change maneuver More...
 
SUMOTime getLastLaneChangeOffset () const
 
int getOwnState () const
 
MSLanegetShadowLane () const
 Returns the lane the vehicles shadow is on during continuouss lane change. More...
 
MSLanegetShadowLane (const MSLane *lane) const
 return the shadow lane for the given lane More...
 
bool hasShadowVehicle () const
 return true if the vehicle currently has a shadow vehicle More...
 
virtual void * inform (void *info, MSVehicle *sender)=0
 
bool isChangingLanes () const
 return true if the vehicle currently performs a lane change maneuver More...
 
bool isLaneChangeMidpointPassed () const
 return whether the vehicle passed the midpoint of a continuous lane change maneuver More...
 
 MSAbstractLaneChangeModel (MSVehicle &v)
 Constructor. More...
 
virtual SUMOReal patchSpeed (const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel &cfModel)=0
 Called to adapt the speed in order to allow a lane change. More...
 
virtual void prepareStep ()
 
void removeLaneChangeShadow (const MSMoveReminder::Notification reason, bool notify=true)
 remove the shadow copy of a lane change maneuver More...
 
void resetMoved ()
 reset the flag whether a vehicle already moved to false More...
 
virtual void saveBlockerLength (SUMOReal length)
 reserve space at the end of the lane to avoid dead locks More...
 
void setNoShadowPartialOccupator (MSLane *lane)
 
void setOwnState (int state)
 
void setShadowPartialOccupator (MSLane *lane)
 
bool startLaneChangeManeuver (MSLane *source, MSLane *target, int direction)
 start the lane change maneuver and return whether it continues More...
 
void unchanged ()
 
virtual int wantsChange (int laneOffset, MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, SUMOReal > &leader, const std::pair< MSVehicle *, SUMOReal > &neighLead, const std::pair< MSVehicle *, SUMOReal > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)=0
 Called to examine whether the vehicle wants to change using the given laneOffset. This method gets the information about the surrounding vehicles and whether another lane may be more preferable. More...
 
virtual ~MSAbstractLaneChangeModel ()
 Destructor. More...
 

Static Public Member Functions

static MSAbstractLaneChangeModelbuild (LaneChangeModel lcm, MSVehicle &vehicle)
 Factory method for instantiating new lane changing models. More...
 
static void initGlobalOptions (const OptionsCont &oc)
 init global model parameters More...
 

Protected Member Functions

bool cancelRequest (int state)
 whether the influencer cancels the given request More...
 
virtual bool congested (const MSVehicle *const neighLeader)
 
void initLastLaneChangeOffset (int dir)
 
virtual bool predInteraction (const MSVehicle *const leader)
 

Protected Attributes

bool myAlreadyMoved
 whether the vehicle has already moved this step More...
 
const MSCFModelmyCarFollowModel
 The vehicle's car following model. More...
 
bool myHaveShadow
 Wether a vehicle shadow exists. More...
 
SUMOReal myLaneChangeCompletion
 progress of the lane change maneuver 0:started, 1:complete More...
 
int myLaneChangeDirection
 direction of the lane change maneuver -1 means right, 1 means left More...
 
bool myLaneChangeMidpointPassed
 whether myLane has already been set to the target of the lane-change maneuver More...
 
std::vector< MSLane * > myNoPartiallyOccupatedByShadow
 
int myOwnState
 The current state of the vehicle. More...
 
std::vector< MSLane * > myPartiallyOccupatedByShadow
 list of lanes where the shadow vehicle is partial occupator More...
 
MSLanemyShadowLane
 The lane the vehicle shadow is on during a continuous lane change. More...
 
MSVehiclemyVehicle
 The vehicle this lane-changer belongs to. More...
 

Static Protected Attributes

static bool myAllowOvertakingRight
 whether overtaking on the right is permitted More...
 

Private Member Functions

MSAbstractLaneChangeModeloperator= (const MSAbstractLaneChangeModel &s)
 Invalidated assignment operator. More...
 

Private Attributes

SUMOTime myLastLaneChangeOffset
 

Detailed Description

Interface for lane-change models.

Definition at line 118 of file MSAbstractLaneChangeModel.h.

Constructor & Destructor Documentation

MSAbstractLaneChangeModel::MSAbstractLaneChangeModel ( MSVehicle v)

Constructor.

Parameters
[in]vThe vehicle this lane-changer belongs to

Definition at line 74 of file MSAbstractLaneChangeModel.cpp.

MSAbstractLaneChangeModel::~MSAbstractLaneChangeModel ( )
virtual

Member Function Documentation

bool MSAbstractLaneChangeModel::alreadyMoved ( ) const
inline

reset the flag whether a vehicle already moved to false

Definition at line 293 of file MSAbstractLaneChangeModel.h.

References myAlreadyMoved.

Referenced by MSLane::executeMovements().

MSAbstractLaneChangeModel * MSAbstractLaneChangeModel::build ( LaneChangeModel  lcm,
MSVehicle vehicle 
)
static

Factory method for instantiating new lane changing models.

Parameters
[in]lcmThe type of model to build
[in]vehicleThe vehicle for which this model shall be built

Definition at line 60 of file MSAbstractLaneChangeModel.cpp.

References LCM_DK2008, LCM_JE2013, LCM_LC2013, and toString().

Referenced by MSVehicle::MSVehicle().

bool MSAbstractLaneChangeModel::cancelRequest ( int  state)
protected

whether the influencer cancels the given request

Definition at line 257 of file MSAbstractLaneChangeModel.cpp.

References MSVehicle::influenceChangeDecision(), and myVehicle.

Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), and setNoShadowPartialOccupator().

virtual void MSAbstractLaneChangeModel::changed ( int  dir)
pure virtual
bool MSAbstractLaneChangeModel::congested ( const MSVehicle *const  neighLeader)
protectedvirtual
SUMOReal MSAbstractLaneChangeModel::getLaneChangeCompletion ( ) const
inline

return whether the vehicle passed the midpoint of a continuous lane change maneuver

Definition at line 273 of file MSAbstractLaneChangeModel.h.

References myLaneChangeCompletion.

Referenced by MSVehicle::computeAngle(), and MSVehicle::getPosition().

int MSAbstractLaneChangeModel::getLaneChangeDirection ( ) const
inline

return the direction of the current lane change maneuver

Definition at line 288 of file MSAbstractLaneChangeModel.h.

References myLaneChangeDirection.

Referenced by MSVehicle::computeAngle().

SUMOTime MSAbstractLaneChangeModel::getLastLaneChangeOffset ( ) const
inline

Definition at line 262 of file MSAbstractLaneChangeModel.h.

References myLastLaneChangeOffset.

int MSAbstractLaneChangeModel::getOwnState ( ) const
inline
MSLane* MSAbstractLaneChangeModel::getShadowLane ( ) const
inline

Returns the lane the vehicles shadow is on during continuouss lane change.

Returns
The vehicle's shadow lane

Definition at line 254 of file MSAbstractLaneChangeModel.h.

References myShadowLane.

Referenced by MSVehicle::computeAngle(), continueLaneChangeManeuver(), MSLane::executeMovements(), MSVehicle::getPosition(), MSVehicle::planMoveInternal(), MSLane::resetPartialOccupation(), and MSLane::setPartialOccupation().

MSLane * MSAbstractLaneChangeModel::getShadowLane ( const MSLane lane) const

return the shadow lane for the given lane

Definition at line 166 of file MSAbstractLaneChangeModel.cpp.

References MSLane::getParallelLane(), myLaneChangeDirection, myLaneChangeMidpointPassed, and myNoPartiallyOccupatedByShadow.

bool MSAbstractLaneChangeModel::hasShadowVehicle ( ) const
inline

return true if the vehicle currently has a shadow vehicle

Definition at line 283 of file MSAbstractLaneChangeModel.h.

References myHaveShadow.

Referenced by MSLane::executeMovements(), and MSLane::setPartialOccupation().

void MSAbstractLaneChangeModel::initGlobalOptions ( const OptionsCont oc)
static

init global model parameters

Definition at line 54 of file MSAbstractLaneChangeModel.cpp.

References OptionsCont::getBool(), and myAllowOvertakingRight.

Referenced by MSFrame::setMSGlobals().

void MSAbstractLaneChangeModel::initLastLaneChangeOffset ( int  dir)
protected
bool MSAbstractLaneChangeModel::isChangingLanes ( ) const
inline
bool MSAbstractLaneChangeModel::isLaneChangeMidpointPassed ( ) const
inline

return whether the vehicle passed the midpoint of a continuous lane change maneuver

Definition at line 268 of file MSAbstractLaneChangeModel.h.

References myLaneChangeMidpointPassed.

Referenced by MSVehicle::computeAngle(), and MSVehicle::planMoveInternal().

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

Invalidated assignment operator.

virtual SUMOReal MSAbstractLaneChangeModel::patchSpeed ( const SUMOReal  min,
const SUMOReal  wanted,
const SUMOReal  max,
const MSCFModel cfModel 
)
pure virtual

Called to adapt the speed in order to allow a lane change.

It is guaranteed that min<=wanted<=max, but the implementation needs to make sure that the return value is between min and max.

Parameters
minThe minimum resulting speed
wantedThe aspired speed of the car following model
maxThe maximum resulting speed
cfModelThe model used
Returns
the new speed of the vehicle as proposed by the lane changer

Implemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.

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

virtual void MSAbstractLaneChangeModel::prepareStep ( )
inlinevirtual

Reimplemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.

Definition at line 208 of file MSAbstractLaneChangeModel.h.

References changed(), inform(), max, min, patchSpeed(), SUMOReal, and wantsChange().

Referenced by MSVehicle::executeMove().

void MSAbstractLaneChangeModel::removeLaneChangeShadow ( const MSMoveReminder::Notification  reason,
bool  notify = true 
)

remove the shadow copy of a lane change maneuver

Definition at line 235 of file MSAbstractLaneChangeModel.cpp.

References myHaveShadow, myShadowLane, myVehicle, and MSLane::removeVehicle().

Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), and resetMoved().

void MSAbstractLaneChangeModel::resetMoved ( )
inline
virtual void MSAbstractLaneChangeModel::saveBlockerLength ( SUMOReal  length)
inlinevirtual

reserve space at the end of the lane to avoid dead locks

Reimplemented in MSLCM_LC2013, and MSLCM_JE2013.

Definition at line 319 of file MSAbstractLaneChangeModel.h.

References UNUSED_PARAMETER.

Referenced by MSLCM_JE2013::saveBlockerLength(), and MSLCM_LC2013::saveBlockerLength().

void MSAbstractLaneChangeModel::setNoShadowPartialOccupator ( MSLane lane)
inline
void MSAbstractLaneChangeModel::setOwnState ( int  state)
inline

Definition at line 204 of file MSAbstractLaneChangeModel.h.

References myOwnState.

Referenced by MSLaneChanger::change().

void MSAbstractLaneChangeModel::setShadowPartialOccupator ( MSLane lane)
inline
void MSAbstractLaneChangeModel::unchanged ( )
inline

Definition at line 243 of file MSAbstractLaneChangeModel.h.

References DELTA_T, and myLastLaneChangeOffset.

Referenced by MSLaneChanger::registerUnchanged().

virtual int MSAbstractLaneChangeModel::wantsChange ( int  laneOffset,
MSAbstractLaneChangeModel::MSLCMessager msgPass,
int  blocked,
const std::pair< MSVehicle *, SUMOReal > &  leader,
const std::pair< MSVehicle *, SUMOReal > &  neighLead,
const std::pair< MSVehicle *, SUMOReal > &  neighFollow,
const MSLane neighLane,
const std::vector< MSVehicle::LaneQ > &  preb,
MSVehicle **  lastBlocked,
MSVehicle **  firstBlocked 
)
pure virtual

Called to examine whether the vehicle wants to change using the given laneOffset. This method gets the information about the surrounding vehicles and whether another lane may be more preferable.

Implemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.

Referenced by MSLaneChanger::checkChange(), and prepareStep().

Field Documentation

bool MSAbstractLaneChangeModel::myAllowOvertakingRight
staticprotected
bool MSAbstractLaneChangeModel::myAlreadyMoved
protected

whether the vehicle has already moved this step

Definition at line 357 of file MSAbstractLaneChangeModel.h.

Referenced by alreadyMoved(), continueLaneChangeManeuver(), and resetMoved().

bool MSAbstractLaneChangeModel::myHaveShadow
protected
SUMOReal MSAbstractLaneChangeModel::myLaneChangeCompletion
protected

progress of the lane change maneuver 0:started, 1:complete

Definition at line 348 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), getLaneChangeCompletion(), isChangingLanes(), and startLaneChangeManeuver().

int MSAbstractLaneChangeModel::myLaneChangeDirection
protected

direction of the lane change maneuver -1 means right, 1 means left

Definition at line 351 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), getLaneChangeDirection(), getShadowLane(), and startLaneChangeManeuver().

bool MSAbstractLaneChangeModel::myLaneChangeMidpointPassed
protected

whether myLane has already been set to the target of the lane-change maneuver

Definition at line 354 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), getShadowLane(), isLaneChangeMidpointPassed(), and startLaneChangeManeuver().

SUMOTime MSAbstractLaneChangeModel::myLastLaneChangeOffset
private
std::vector<MSLane*> MSAbstractLaneChangeModel::myNoPartiallyOccupatedByShadow
protected
std::vector<MSLane*> MSAbstractLaneChangeModel::myPartiallyOccupatedByShadow
protected

list of lanes where the shadow vehicle is partial occupator

Definition at line 369 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), and setShadowPartialOccupator().

MSLane* MSAbstractLaneChangeModel::myShadowLane
protected

The lane the vehicle shadow is on during a continuous lane change.

Definition at line 360 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), getShadowLane(), removeLaneChangeShadow(), startLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().


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