SUMO - Simulation of Urban MObility
MSLCM_LC2013 Class Reference

A lane change model developed by D. Krajzewicz, J. Erdmann et al. between 2004 and 2013. More...

#include <MSLCM_LC2013.h>

Inheritance diagram for MSLCM_LC2013:
Inheritance graph
Collaboration diagram for MSLCM_LC2013:
Collaboration graph

Public Types

enum  MyLCAEnum {
  LCA_AMBLOCKINGLEADER = 1 << 16, LCA_AMBLOCKINGFOLLOWER = 1 << 17, LCA_MRIGHT = 1 << 18, LCA_MLEFT = 1 << 19,
  LCA_AMBLOCKINGFOLLOWER_DONTBRAKE = 1 << 21, LCA_CHANGE_TO_HELP = 1 << 23, LCA_AMBACKBLOCKER = 1 << 26, LCA_AMBACKBLOCKER_STANDING = 1 << 27
}
 

Public Member Functions

SUMOReal _patchSpeed (const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel &cfModel)
 
bool alreadyMoved () const
 reset the flag whether a vehicle already moved to false More...
 
void changed (int dir)
 
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...
 
void * inform (void *info, MSVehicle *sender)
 
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...
 
 MSLCM_LC2013 (MSVehicle &v)
 
SUMOReal patchSpeed (const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel &cfModel)
 Called to adapt the speed in order to allow a lane change. More...
 
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...
 
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 ()
 
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)
 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 ~MSLCM_LC2013 ()
 

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 Types

typedef std::pair< SUMOReal, int > Info
 information regarding save velocity (unused) and state flags of the ego vehicle More...
 

Protected Member Functions

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)
 helper function for doing the actual work More...
 
bool amBlockingFollower ()
 
bool amBlockingFollowerNB ()
 
bool amBlockingFollowerPlusNB ()
 
bool amBlockingLeader ()
 
bool cancelRequest (int state)
 whether the influencer cancels the given request More...
 
virtual bool congested (const MSVehicle *const neighLeader)
 
bool currentDistAllows (SUMOReal dist, int laneOffset, SUMOReal lookForwardDist)
 
bool currentDistDisallows (SUMOReal dist, int laneOffset, SUMOReal lookForwardDist)
 
void informFollower (MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, int dir, const std::pair< MSVehicle *, SUMOReal > &neighFollow, SUMOReal remainingSeconds, SUMOReal plannedSpeed)
 decide whether we will try cut in before the follower or allow to be overtaken More...
 
SUMOReal informLeader (MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, int dir, const std::pair< MSVehicle *, SUMOReal > &neighLead, SUMOReal remainingSeconds)
 
void initLastLaneChangeOffset (int dir)
 
virtual bool predInteraction (const MSVehicle *const leader)
 
void saveBlockerLength (MSVehicle *blocker, int lcaCounter)
 save space for vehicles which need to counter-lane-change More...
 
void saveBlockerLength (SUMOReal length)
 reserve space at the end of the lane to avoid dead locks More...
 
int slowDownForBlocked (MSVehicle **blocked, int state)
 compute useful slowdowns for blocked vehicles More...
 

Protected Attributes

bool myAlreadyMoved
 whether the vehicle has already moved this step More...
 
const MSCFModelmyCarFollowModel
 The vehicle's car following model. More...
 
bool myDontBrake
 
bool myHaveShadow
 Wether a vehicle shadow exists. More...
 
SUMOReal myKeepRightProbability
 
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...
 
SUMOReal myLeadingBlockerLength
 
SUMOReal myLeftSpace
 
SUMOReal myLookAheadSpeed
 
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...
 
SUMOReal mySpeedGainProbability
 a value for tracking the probability that a change to the offset with the same sign is beneficial More...
 
MSVehiclemyVehicle
 The vehicle this lane-changer belongs to. More...
 
std::vector< SUMORealmyVSafes
 

Static Protected Attributes

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

Detailed Description

A lane change model developed by D. Krajzewicz, J. Erdmann et al. between 2004 and 2013.

Definition at line 49 of file MSLCM_LC2013.h.

Member Typedef Documentation

typedef std::pair<SUMOReal, int> MSLCM_LC2013::Info
protected

information regarding save velocity (unused) and state flags of the ego vehicle

Definition at line 171 of file MSLCM_LC2013.h.

Member Enumeration Documentation

Enumerator
LCA_AMBLOCKINGLEADER 
LCA_AMBLOCKINGFOLLOWER 
LCA_MRIGHT 
LCA_MLEFT 
LCA_AMBLOCKINGFOLLOWER_DONTBRAKE 
LCA_CHANGE_TO_HELP 
LCA_AMBACKBLOCKER 
LCA_AMBACKBLOCKER_STANDING 

Definition at line 52 of file MSLCM_LC2013.h.

Constructor & Destructor Documentation

MSLCM_LC2013::MSLCM_LC2013 ( MSVehicle v)

Definition at line 85 of file MSLCM_LC2013.cpp.

MSLCM_LC2013::~MSLCM_LC2013 ( )
virtual

Definition at line 94 of file MSLCM_LC2013.cpp.

References changed().

Member Function Documentation

int MSLCM_LC2013::_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 
)
protected

helper function for doing the actual work

we urgently need to change lanes to follow our route

Definition at line 387 of file MSLCM_LC2013.cpp.

References abs, amBlockingFollowerPlusNB(), MSVehicle::LaneQ::bestContinuations, MSVehicle::LaneQ::bestLaneOffset, MSCFModel::brakeGap(), MSAbstractLaneChangeModel::cancelRequest(), CHANGE_PROB_THRESHOLD_LEFT, CHANGE_PROB_THRESHOLD_RIGHT, MSVehicle::Influencer::changeRequestRemainingSeconds(), MSVehicle::congested(), currentDistAllows(), currentDistDisallows(), DELTA_T, MSEdge::EDGEFUNCTION_INTERNAL, MSCFModel::followSpeed(), gDebugFlag2, MSVehicle::getCarFollowModel(), MSNet::getCurrentTimeStep(), MSLane::getEdge(), MSBaseVehicle::getID(), MSVehicle::getInfluencer(), MSNet::getInstance(), MSVehicle::getLane(), MSVehicleType::getLengthWithGap(), MSLane::getLinkCont(), MSCFModel::getMaxDecel(), MSVehicleType::getMaxSpeed(), MSVehicle::getPositionOnLane(), MSEdge::getPurpose(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSLane::getSpeedLimit(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSVehicle::influenceChangeDecision(), informFollower(), informLeader(), JAM_FACTOR, KEEP_RIGHT_ACCEPTANCE, KEEP_RIGHT_TIME, LCA_COOPERATIVE, LCA_KEEPRIGHT, LCA_LEFT, LCA_MLEFT, LCA_MRIGHT, LCA_RIGHT, LCA_SPEEDGAIN, LCA_STAY, LCA_STRATEGIC, LCA_TRACI, LCA_URGENT, MSVehicle::LaneQ::length, LOOK_AHEAD_MIN_SPEED, LOOK_AHEAD_SPEED_MEMORY, LOOK_FORWARD_LEFT, LOOK_FORWARD_RIGHT, MAX2(), MIN2(), MSAbstractLaneChangeModel::myAllowOvertakingRight, MSAbstractLaneChangeModel::myCarFollowModel, myKeepRightProbability, myLeadingBlockerLength, myLeftSpace, myLookAheadSpeed, MSAbstractLaneChangeModel::myOwnState, mySpeedGainProbability, MSAbstractLaneChangeModel::myVehicle, myVSafes, NUMERICAL_EPS, MSVehicle::LaneQ::occupation, RELGAIN_NORMALIZATION_MIN_SPEED, ROUNDABOUT_DIST_BONUS, saveBlockerLength(), slowDownForBlocked(), STEPS2TIME, SUMO_const_haltingSpeed, SUMOReal, TS, and URGENCY.

Referenced by wantsChange().

bool MSAbstractLaneChangeModel::alreadyMoved ( ) const
inlineinherited

reset the flag whether a vehicle already moved to false

Definition at line 293 of file MSAbstractLaneChangeModel.h.

References MSAbstractLaneChangeModel::myAlreadyMoved.

Referenced by MSLane::executeMovements().

bool MSLCM_LC2013::amBlockingFollower ( )
inlineprotected
bool MSLCM_LC2013::amBlockingFollowerNB ( )
inlineprotected
bool MSLCM_LC2013::amBlockingFollowerPlusNB ( )
inlineprotected
bool MSLCM_LC2013::amBlockingLeader ( )
inlineprotected

Definition at line 151 of file MSLCM_LC2013.h.

References LCA_AMBLOCKINGLEADER, and MSAbstractLaneChangeModel::myOwnState.

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

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)
protectedinherited
bool MSAbstractLaneChangeModel::congested ( const MSVehicle *const  neighLeader)
protectedvirtualinherited
bool MSLCM_LC2013::currentDistAllows ( SUMOReal  dist,
int  laneOffset,
SUMOReal  lookForwardDist 
)
inlineprotected

Definition at line 166 of file MSLCM_LC2013.h.

References abs.

Referenced by _wantsChange().

bool MSLCM_LC2013::currentDistDisallows ( SUMOReal  dist,
int  laneOffset,
SUMOReal  lookForwardDist 
)
inlineprotected

Definition at line 163 of file MSLCM_LC2013.h.

References abs.

Referenced by _wantsChange().

SUMOReal MSAbstractLaneChangeModel::getLaneChangeCompletion ( ) const
inlineinherited

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

Definition at line 273 of file MSAbstractLaneChangeModel.h.

References MSAbstractLaneChangeModel::myLaneChangeCompletion.

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

int MSAbstractLaneChangeModel::getLaneChangeDirection ( ) const
inlineinherited

return the direction of the current lane change maneuver

Definition at line 288 of file MSAbstractLaneChangeModel.h.

References MSAbstractLaneChangeModel::myLaneChangeDirection.

Referenced by MSVehicle::computeAngle().

SUMOTime MSAbstractLaneChangeModel::getLastLaneChangeOffset ( ) const
inlineinherited
int MSAbstractLaneChangeModel::getOwnState ( ) const
inlineinherited
MSLane* MSAbstractLaneChangeModel::getShadowLane ( ) const
inlineinherited
MSLane * MSAbstractLaneChangeModel::getShadowLane ( const MSLane lane) const
inherited
bool MSAbstractLaneChangeModel::hasShadowVehicle ( ) const
inlineinherited

return true if the vehicle currently has a shadow vehicle

Definition at line 283 of file MSAbstractLaneChangeModel.h.

References MSAbstractLaneChangeModel::myHaveShadow.

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

void * MSLCM_LC2013::inform ( void *  info,
MSVehicle sender 
)
virtual

Implements MSAbstractLaneChangeModel.

Definition at line 192 of file MSLCM_LC2013.cpp.

References MSAbstractLaneChangeModel::myOwnState, myVSafes, and SUMOReal.

void MSAbstractLaneChangeModel::initGlobalOptions ( const OptionsCont oc)
staticinherited

init global model parameters

Definition at line 54 of file MSAbstractLaneChangeModel.cpp.

References OptionsCont::getBool(), and MSAbstractLaneChangeModel::myAllowOvertakingRight.

Referenced by MSFrame::setMSGlobals().

void MSAbstractLaneChangeModel::initLastLaneChangeOffset ( int  dir)
protectedinherited
bool MSAbstractLaneChangeModel::isChangingLanes ( ) const
inlineinherited
bool MSAbstractLaneChangeModel::isLaneChangeMidpointPassed ( ) const
inlineinherited

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

Definition at line 268 of file MSAbstractLaneChangeModel.h.

References MSAbstractLaneChangeModel::myLaneChangeMidpointPassed.

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

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

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

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

Implements MSAbstractLaneChangeModel.

Definition at line 117 of file MSLCM_LC2013.cpp.

References _patchSpeed(), and SUMOReal.

void MSAbstractLaneChangeModel::removeLaneChangeShadow ( const MSMoveReminder::Notification  reason,
bool  notify = true 
)
inherited
void MSLCM_LC2013::saveBlockerLength ( SUMOReal  length)
inlineprotectedvirtual

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

Reimplemented from MSAbstractLaneChangeModel.

Definition at line 147 of file MSLCM_LC2013.h.

References MAX2(), and myLeadingBlockerLength.

void MSAbstractLaneChangeModel::setOwnState ( int  state)
inlineinherited

Definition at line 204 of file MSAbstractLaneChangeModel.h.

References MSAbstractLaneChangeModel::myOwnState.

Referenced by MSLaneChanger::change().

void MSAbstractLaneChangeModel::setShadowPartialOccupator ( MSLane lane)
inlineinherited
void MSAbstractLaneChangeModel::unchanged ( )
inlineinherited
int MSLCM_LC2013::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 
)
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.

Implements MSAbstractLaneChangeModel.

Definition at line 100 of file MSLCM_LC2013.cpp.

References _wantsChange(), and SUMOReal.

Field Documentation

bool MSAbstractLaneChangeModel::myAllowOvertakingRight
staticprotectedinherited
bool MSAbstractLaneChangeModel::myAlreadyMoved
protectedinherited
bool MSLCM_LC2013::myDontBrake
protected

Definition at line 191 of file MSLCM_LC2013.h.

Referenced by _patchSpeed(), changed(), and prepareStep().

SUMOReal MSLCM_LC2013::myKeepRightProbability
protected

Definition at line 181 of file MSLCM_LC2013.h.

Referenced by _wantsChange(), changed(), and prepareStep().

int MSAbstractLaneChangeModel::myLaneChangeDirection
protectedinherited
bool MSAbstractLaneChangeModel::myLaneChangeMidpointPassed
protectedinherited
SUMOReal MSLCM_LC2013::myLeadingBlockerLength
protected
SUMOReal MSLCM_LC2013::myLeftSpace
protected
SUMOReal MSLCM_LC2013::myLookAheadSpeed
protected

Definition at line 188 of file MSLCM_LC2013.h.

Referenced by _wantsChange(), and changed().

std::vector<MSLane*> MSAbstractLaneChangeModel::myNoPartiallyOccupatedByShadow
protectedinherited
std::vector<MSLane*> MSAbstractLaneChangeModel::myPartiallyOccupatedByShadow
protectedinherited
SUMOReal MSLCM_LC2013::mySpeedGainProbability
protected

a value for tracking the probability that a change to the offset with the same sign is beneficial

Definition at line 177 of file MSLCM_LC2013.h.

Referenced by _wantsChange(), changed(), and prepareStep().

std::vector<SUMOReal> MSLCM_LC2013::myVSafes
protected

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