Eclipse SUMO - Simulation of Urban MObility
MSLink Class Reference

#include <MSLink.h>

Collaboration diagram for MSLink:

Data Structures

struct  ApproachingVehicleInformation
 A structure holding the information about vehicles approaching a link. More...
 
struct  LinkLeader
 

Public Types

typedef std::map< const SUMOVehicle *, const ApproachingVehicleInformation, ComparatorNumericalIdLessApproachInfos
 
typedef std::vector< const SUMOVehicle * > BlockingFoes
 
typedef std::vector< LinkLeaderLinkLeaders
 

Public Member Functions

void addBlockedLink (MSLink *link)
 
void addWalkingAreaFoe (const MSLane *lane)
 add walkingarea as foe (when entering the junction) More...
 
void addWalkingAreaFoeExit (const MSLane *lane)
 add walkingarea as foe (when leaving the junction) More...
 
bool blockedAtTime (SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, BlockingFoes *collectFoes=nullptr, const SUMOVehicle *ego=nullptr) const
 Returns the information whether this link is blocked Valid after the vehicles have set their requests. More...
 
void checkWalkingAreaFoe (const MSVehicle *ego, const MSLane *foeLane, std::vector< const MSPerson * > *collectBlockers, LinkLeaders &result) const
 check for persons on walkingarea in the path of ego vehicle More...
 
bool fromInternalLane () const
 return whether the fromLane of this link is an internal lane More...
 
const ApproachInfosgetApproaching () const
 return all approaching vehicles More...
 
ApproachingVehicleInformation getApproaching (const SUMOVehicle *veh) const
 
MSLinkgetCorrespondingExitLink () const
 returns the corresponding exit link for entryLinks to a junction. More...
 
std::string getDescription () const
 get string description for this link More...
 
LinkDirection getDirection () const
 Returns the direction the vehicle passing this link take. More...
 
std::pair< const SUMOVehicle *, const MSLink * > getFirstApproachingFoe () const
 get the foe vehicle that is closest to the intersection or nullptr along with the foe link More...
 
const std::vector< const MSLane * > & getFoeLanes () const
 
const std::vector< MSLink * > & getFoeLinks () const
 
double getFoeVisibilityDistance () const
 Returns the distance on the approaching lane from which an approaching vehicle is able to see all relevant foes and may accelerate if the link is minor and no foe is approaching. More...
 
double getGreenFraction () const
 Returns the average proportion of green time to cycle time. More...
 
int getIndex () const
 Returns the respond index (for visualization) More...
 
const MSLanegetInternalLaneBefore () const
 return myInternalLaneBefore (always 0 when compiled without internal lanes) More...
 
double getInternalLengthsAfter () const
 Returns the cumulative length of all internal lanes after this link. More...
 
double getInternalLengthsBefore () const
 Returns the cumulative length of all internal lanes before this link. More...
 
MSJunctiongetJunction () const
 
MSLanegetLane () const
 Returns the connected lane. More...
 
const MSLanegetLaneBefore () const
 return the internalLaneBefore if it exists and the laneBefore otherwise More...
 
SUMOTime getLastStateChange () const
 
double getLateralShift ()
 return lateral shift that must be applied when passing this link More...
 
LinkLeaders getLeaderInfo (const MSVehicle *ego, double dist, std::vector< const MSPerson * > *collectBlockers=0, bool isShadowLink=false) const
 Returns all potential link leaders (vehicles on foeLanes) Valid during the planMove() phase. More...
 
SUMOTime getLeaveTime (const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const double vehicleLength) const
 return the expected time at which the given vehicle will clear the link More...
 
double getLength () const
 Returns the length of this link. More...
 
double getLengthBeforeCrossing (const MSLane *foeLane) const
 Returns the internal length from the beginning of the link's internal lane before to the crossing with the given foe lane if applicable, if the lane is no foe lane to the link, INVALID_DOUBLE is returned. More...
 
double getLengthsBeforeCrossing (const MSLane *foeLane) const
 Returns the sum of the lengths along internal lanes following this link to the crossing with the given foe lane, if the lane is no foe lane to any of the internal lanes, INVALID_DOUBLE is returned. More...
 
const std::vector< std::pair< double, double > > & getLengthsBehindCrossing () const
 
SUMOTime getMesoTLSPenalty () const
 Returns the time penalty for passing a tls-controlled link (meso) More...
 
LinkState getOffState () const
 Returns the off-state for the link. More...
 
MSLinkgetParallelLink (int direction) const
 return the link that is parallel to this lane or 0 More...
 
LinkState getState () const
 Returns the current state of the link. More...
 
int getTLIndex () const
 Returns the TLS index. More...
 
const MSTrafficLightLogicgetTLLogic () const
 Returns the TLS index. More...
 
MSLanegetViaLane () const
 Returns the following inner lane. More...
 
MSLanegetViaLaneOrLane () const
 return the via lane if it exists and the lane otherwise More...
 
const MSLanegetWalkingAreaFoe ()
 get walkingarea as foes More...
 
const MSLanegetWalkingAreaFoeExit ()
 
double getZipperSpeed (const MSVehicle *ego, const double dist, double vSafe, SUMOTime arrivalTime, BlockingFoes *collectFoes) const
 return the speed at which ego vehicle must approach the zipper link More...
 
bool hasApproachingFoe (SUMOTime arrivalTime, SUMOTime leaveTime, double speed, double decel) const
 Returns the information whether a vehicle is approaching on one of the link's foe streams. More...
 
bool hasFoes () const
 Returns whether this link belongs to a junction where more than one edge is incoming. More...
 
bool havePriority () const
 Returns whether this link is a major link. More...
 
bool haveRed () const
 Returns whether this link is blocked by a red (or redyellow) traffic light. More...
 
bool haveYellow () const
 
void initParallelLinks ()
 initialize parallel links (to be called after all links are loaded) More...
 
bool isBlockingAnyone () const
 
bool isConflictEntryLink () const
 return whether this link enters the conflict area (not a continuation link) More...
 
bool isCont () const
 
bool isEntryLink () const
 return whether the toLane of this link is an internal lane and fromLane is a normal lane More...
 
bool isExitLink () const
 return whether the fromLane of this link is an internal lane and toLane is a normal lane More...
 
bool isExitLinkAfterInternalJunction () const
 return whether the fromLane of this link is an internal lane and its incoming lane is also an internal lane More...
 
bool isInternalJunctionLink () const
 return whether the fromLane and the toLane of this link are internal lanes More...
 
bool isTLSControlled () const
 
bool keepClear () const
 whether the junction after this link must be kept clear More...
 
bool lastWasContMajor () const
 whether this is a link past an internal junction which currently has priority More...
 
 MSLink (MSLane *predLane, MSLane *succLane, MSLane *via, LinkDirection dir, LinkState state, double length, double foeVisibilityDistance, bool keepClear, MSTrafficLightLogic *logic, int tlLinkIdx)
 Constructor for simulation which uses internal lanes. More...
 
bool opened (SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, double impatience, double decel, SUMOTime waitingTime, double posLat=0, BlockingFoes *collectFoes=nullptr, bool ignoreRed=false, const SUMOVehicle *ego=nullptr) const
 Returns the information whether the link may be passed. More...
 
void removeApproaching (const SUMOVehicle *veh)
 removes the vehicle from myApproachingVehicles More...
 
void setApproaching (const SUMOVehicle *approaching, ApproachingVehicleInformation ai)
 Sets the information about an approaching vehicle. More...
 
void setApproaching (const SUMOVehicle *approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist)
 Sets the information about an approaching vehicle. More...
 
void setGreenFraction (const double fraction)
 Sets the green fraction for passing a tls-controlled link (meso) More...
 
void setMesoTLSPenalty (const SUMOTime penalty)
 Sets the time penalty for passing a tls-controlled link (meso) More...
 
void setRequestInformation (int index, bool hasFoes, bool isCont, const std::vector< MSLink * > &foeLinks, const std::vector< MSLane * > &foeLanes, MSLane *internalLaneBefore=0)
 Sets the request information. More...
 
void setTLState (LinkState state, SUMOTime t)
 Sets the current tl-state. More...
 
bool willHaveBlockedFoe () const
 
void writeApproaching (OutputDevice &od, const std::string fromLaneID) const
 write information about all approaching vehicles to the given output device More...
 
 ~MSLink ()
 Destructor. More...
 

Static Public Attributes

static const double ZIPPER_ADAPT_DIST
 

Private Member Functions

bool blockedByFoe (const SUMOVehicle *veh, const ApproachingVehicleInformation &avi, SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, const SUMOVehicle *ego) const
 
bool checkContOff () const
 figure out whether the cont status remains in effect when switching off the tls More...
 
MSLinkcomputeParallelLink (int direction)
 
bool contIntersect (const MSLane *lane, const MSLane *foe)
 check if the lane intersects with a foe cont-lane More...
 
 MSLink (const MSLink &s)
 invalidated copy constructor More...
 
MSLinkoperator= (const MSLink &s)
 invalidated assignment operator More...
 

Static Private Member Functions

static bool couldBrakeForLeader (double followDist, double leaderDist, const MSVehicle *follow, const MSVehicle *leader)
 whether follower could stay behind leader (possibly by braking) More...
 
static bool unsafeMergeSpeeds (double leaderSpeed, double followerSpeed, double leaderDecel, double followerDecel)
 return whether the given vehicles may NOT merge safely More...
 

Private Attributes

bool myAmCont
 
bool myAmContOff
 
ApproachInfos myApproachingVehicles
 
std::set< MSLink * > myBlockedFoeLinks
 
LinkDirection myDirection
 An abstract (hopefully human readable) definition of the link's direction. More...
 
std::vector< const MSLane * > myFoeLanes
 
std::vector< MSLink * > myFoeLinks
 
double myFoeVisibilityDistance
 distance from which an approaching vehicle is able to see all relevant foes and may accelerate if the link is minor and no foe is approaching. Defaults to 4.5m. More...
 
double myGreenFraction
 green fraction at tls for mesoscopic simulation More...
 
bool myHasFoes
 Whether any foe links exist. More...
 
bool myHavePedestrianCrossingFoe
 whether on of myFoeLanes is a crossing More...
 
int myIndex
 The position within this respond. More...
 
MSLane *const myInternalLane
 The following junction-internal lane if used. More...
 
const MSLanemyInternalLaneBefore
 
MSJunctionmyJunction
 the junction to which this link belongs More...
 
bool myKeepClear
 
MSLanemyLane
 The lane behind the junction approached by this link. More...
 
MSLanemyLaneBefore
 The lane approaching this link. More...
 
SUMOTime myLastStateChange
 The time of the last state change. More...
 
double myLateralShift
 lateral shift to be applied when passing this link More...
 
double myLength
 The length of the link. More...
 
std::vector< std::pair< double, double > > myLengthsBehindCrossing
 
const MSTrafficLightLogicmyLogic
 the controlling logic or 0 More...
 
SUMOTime myMesoTLSPenalty
 penalty time at tls for mesoscopic simulation More...
 
const LinkState myOffState
 The state of the link when switching of traffic light control. More...
 
MSLinkmyParallelLeft
 
MSLinkmyParallelRight
 
LinkState myState
 The state of the link. More...
 
std::vector< MSLane * > mySublaneFoeLanes
 
std::vector< MSLink * > mySublaneFoeLinks
 
std::vector< MSLink * > mySublaneFoeLinks2
 
const int myTLIndex
 the traffic light index More...
 
const MSLanemyWalkingAreaFoe
 walkingArea that must be checked when entering the intersection More...
 
const MSLanemyWalkingAreaFoeExit
 walkingArea that must be checked when leaving the intersection More...
 

Static Private Attributes

static const SUMOTime myLookaheadTime = TIME2STEPS(1)
 
static const SUMOTime myLookaheadTimeZipper = TIME2STEPS(4)
 

Detailed Description

Definition at line 69 of file MSLink.h.

Member Typedef Documentation

◆ ApproachInfos

Definition at line 144 of file MSLink.h.

◆ BlockingFoes

typedef std::vector<const SUMOVehicle*> MSLink::BlockingFoes

Definition at line 145 of file MSLink.h.

◆ LinkLeaders

typedef std::vector<LinkLeader> MSLink::LinkLeaders

Definition at line 87 of file MSLink.h.

Constructor & Destructor Documentation

◆ MSLink() [1/2]

MSLink::MSLink ( MSLane predLane,
MSLane succLane,
MSLane via,
LinkDirection  dir,
LinkState  state,
double  length,
double  foeVisibilityDistance,
bool  keepClear,
MSTrafficLightLogic logic,
int  tlLinkIdx 
)

Constructor for simulation which uses internal lanes.

Parameters
[in]succLaneThe lane approached by this link
[in]viaThe lane to use within the junction
[in]dirThe direction of this link
[in]stateThe state of this link
[in]lengthThe length of this link

Definition at line 73 of file MSLink.cpp.

References MSLane::getShape(), getViaLaneOrLane(), MSGlobals::gLateralResolution, MSLane::isInternal(), PositionVector::move2side(), myInternalLane, myLaneBefore, and myLateralShift.

◆ ~MSLink()

MSLink::~MSLink ( )

Destructor.

Definition at line 121 of file MSLink.cpp.

◆ MSLink() [2/2]

MSLink::MSLink ( const MSLink s)
private

invalidated copy constructor

Member Function Documentation

◆ addBlockedLink()

void MSLink::addBlockedLink ( MSLink link)

Definition at line 398 of file MSLink.cpp.

References myBlockedFoeLinks.

◆ addWalkingAreaFoe()

void MSLink::addWalkingAreaFoe ( const MSLane lane)
inline

add walkingarea as foe (when entering the junction)

Definition at line 174 of file MSLink.h.

References myWalkingAreaFoe.

Referenced by MSRightOfWayJunction::postloadInit().

◆ addWalkingAreaFoeExit()

void MSLink::addWalkingAreaFoeExit ( const MSLane lane)
inline

add walkingarea as foe (when leaving the junction)

Definition at line 179 of file MSLink.h.

References myWalkingAreaFoeExit.

◆ blockedAtTime()

bool MSLink::blockedAtTime ( SUMOTime  arrivalTime,
SUMOTime  leaveTime,
double  arrivalSpeed,
double  leaveSpeed,
bool  sameTargetLane,
double  impatience,
double  decel,
SUMOTime  waitingTime,
BlockingFoes collectFoes = nullptr,
const SUMOVehicle ego = nullptr 
) const

Returns the information whether this link is blocked Valid after the vehicles have set their requests.

Parameters
[in]arrivalTimeThe arrivalTime of the vehicle who checks for an approaching foe
[in]leaveTimeThe leaveTime of the vehicle who checks for an approaching foe
[in]arrivalSpeedThe speed with which the checking vehicle plans to arrive at the link
[in]leaveSpeedThe speed with which the checking vehicle plans to leave the link
[in]sameTargetLaneWhether the link that calls this method has the same target lane as this link
[in]impatienceThe impatience of the checking vehicle
[in]decelThe maximum deceleration of the checking vehicle
[in]waitingTimeThe waiting time of the checking vehicle
[in]collectFoesIf a vector is passed the return value is always False, instead all blocking foes are collected and inserted into this vector
Returns
Whether this link is blocked
Note
Since this needs to be called without a SUMOVehicle (TraCI), we cannot simply pass the checking vehicle itself

Definition at line 568 of file MSLink.cpp.

References blockedByFoe(), gDebugFlag1, Named::getID(), SUMOVTypeParameter::getJMParam(), MSVehicleType::getParameter(), SUMOVehicle::getRNG(), SUMOTrafficObject::getVehicleType(), getViaLaneOrLane(), myApproachingVehicles, RandHelper::rand(), SIMTIME, SUMO_ATTR_JM_IGNORE_FOE_PROB, and SUMO_ATTR_JM_IGNORE_FOE_SPEED.

◆ blockedByFoe()

◆ checkContOff()

bool MSLink::checkContOff ( ) const
private

figure out whether the cont status remains in effect when switching off the tls

Definition at line 1388 of file MSLink.cpp.

References MSLane::getEdge(), MSEdge::getLanes(), LINKSTATE_TL_OFF_NOSIGNAL, and myLaneBefore.

Referenced by setRequestInformation().

◆ checkWalkingAreaFoe()

void MSLink::checkWalkingAreaFoe ( const MSVehicle ego,
const MSLane foeLane,
std::vector< const MSPerson * > *  collectBlockers,
LinkLeaders result 
) const

◆ computeParallelLink()

MSLink * MSLink::computeParallelLink ( int  direction)
private

◆ contIntersect()

bool MSLink::contIntersect ( const MSLane lane,
const MSLane foe 
)
private

check if the lane intersects with a foe cont-lane

Definition at line 355 of file MSLink.cpp.

References MSLane::getLinkCont(), MSLane::getShape(), and PositionVector::intersectsAtLengths2D().

Referenced by setRequestInformation().

◆ couldBrakeForLeader()

bool MSLink::couldBrakeForLeader ( double  followDist,
double  leaderDist,
const MSVehicle follow,
const MSVehicle leader 
)
staticprivate

whether follower could stay behind leader (possibly by braking)

Definition at line 1373 of file MSLink.cpp.

References MSVehicle::getCarFollowModel(), MSCFModel::getMaxDecel(), and MSVehicle::getSpeed().

Referenced by getZipperSpeed().

◆ fromInternalLane()

bool MSLink::fromInternalLane ( ) const

return whether the fromLane of this link is an internal lane

Definition at line 944 of file MSLink.cpp.

References myInternalLaneBefore.

Referenced by getLeaderInfo(), MSVehicle::isLeader(), and setRequestInformation().

◆ getApproaching() [1/2]

const ApproachInfos& MSLink::getApproaching ( ) const
inline

return all approaching vehicles

Definition at line 214 of file MSLink.h.

References myApproachingVehicles.

◆ getApproaching() [2/2]

◆ getCorrespondingExitLink()

MSLink * MSLink::getCorrespondingExitLink ( ) const

returns the corresponding exit link for entryLinks to a junction.

Definition at line 927 of file MSLink.cpp.

References MSLane::getLinkCont(), getViaLane(), and myInternalLane.

Referenced by MSDevice_SSM::classifyEncounter().

◆ getDescription()

std::string MSLink::getDescription ( ) const

◆ getDirection()

LinkDirection MSLink::getDirection ( ) const

Returns the direction the vehicle passing this link take.

Returns
The direction of this link

Definition at line 720 of file MSLink.cpp.

References myDirection.

Referenced by MSLaneChanger::changeOpposite(), MSInternalJunction::indirectBicycleTurn(), and MSVehicle::processLaneAdvances().

◆ getFirstApproachingFoe()

std::pair< const SUMOVehicle *, const MSLink * > MSLink::getFirstApproachingFoe ( ) const

get the foe vehicle that is closest to the intersection or nullptr along with the foe link

Definition at line 700 of file MSLink.cpp.

References myFoeLinks.

◆ getFoeLanes()

const std::vector<const MSLane*>& MSLink::getFoeLanes ( ) const
inline

◆ getFoeLinks()

const std::vector<MSLink*>& MSLink::getFoeLinks ( ) const
inline

◆ getFoeVisibilityDistance()

double MSLink::getFoeVisibilityDistance ( ) const
inline

Returns the distance on the approaching lane from which an approaching vehicle is able to see all relevant foes and may accelerate if the link is minor and no foe is approaching.

Returns
The foe-visibility-distance

Definition at line 379 of file MSLink.h.

References myFoeVisibilityDistance.

Referenced by MSVehicle::passingMinor(), and MSVehicle::processLinkApproaches().

◆ getGreenFraction()

double MSLink::getGreenFraction ( ) const
inline

Returns the average proportion of green time to cycle time.

Definition at line 499 of file MSLink.h.

References myGreenFraction.

Referenced by MESegment::getTLSCapacity().

◆ getIndex()

int MSLink::getIndex ( ) const
inline

Returns the respond index (for visualization)

Returns
The respond index for this link

Definition at line 328 of file MSLink.h.

References myIndex.

Referenced by MSRailSignal::DriveWay::checkCrossingFlanks(), GUILane::drawLinkNo(), MSRailSignal::DriveWay::findFlankProtection(), getLeaderInfo(), and MSVehicle::isLeader().

◆ getInternalLaneBefore()

const MSLane * MSLink::getInternalLaneBefore ( ) const

return myInternalLaneBefore (always 0 when compiled without internal lanes)

Definition at line 1231 of file MSLink.cpp.

References myInternalLaneBefore.

Referenced by MSVehicle::checkLinkLeader(), MSDevice_SSM::classifyEncounter(), isExitLinkAfterInternalJunction(), isInternalJunctionLink(), MSVehicle::isLeader(), and MSVehicle::processLinkApproaches().

◆ getInternalLengthsAfter()

double MSLink::getInternalLengthsAfter ( ) const

Returns the cumulative length of all internal lanes after this link.

Returns
sum of the lengths of all internal lanes following this link

Definition at line 799 of file MSLink.cpp.

References MSLane::getLength(), MSLane::getLinkCont(), MSLane::isInternal(), and myInternalLane.

Referenced by MSDevice_SSM::classifyEncounter(), MSDevice_SSM::findFoeConflictLane(), MSDevice_SSM::findSurroundingVehicles(), and MSLane::getUpcomingLinks().

◆ getInternalLengthsBefore()

double MSLink::getInternalLengthsBefore ( ) const

Returns the cumulative length of all internal lanes before this link.

Returns
sum of the lengths of all internal lanes before this link

Definition at line 811 of file MSLink.cpp.

References MSLane::getIncomingLanes(), MSLane::getLength(), MSLane::isInternal(), and myInternalLane.

◆ getJunction()

◆ getLane()

◆ getLaneBefore()

◆ getLastStateChange()

SUMOTime MSLink::getLastStateChange ( ) const
inline

Definition at line 297 of file MSLink.h.

References myLastStateChange.

Referenced by MSPModel_Striping::PState::ignoreRed(), and MSVehicle::ignoreRed().

◆ getLateralShift()

double MSLink::getLateralShift ( )
inline

return lateral shift that must be applied when passing this link

Definition at line 529 of file MSLink.h.

References myLateralShift.

Referenced by MSVehicle::enterLaneAtMove().

◆ getLeaderInfo()

MSLink::LinkLeaders MSLink::getLeaderInfo ( const MSVehicle ego,
double  dist,
std::vector< const MSPerson * > *  collectBlockers = 0,
bool  isShadowLink = false 
) const

Returns all potential link leaders (vehicles on foeLanes) Valid during the planMove() phase.

Parameters
[in]egoThe ego vehicle that is looking for leaders
[in]distThe distance of the vehicle who is asking about the leader to this link
[out]blockingReturn blocking pedestrians if a vector is given
[in]isShadowLinkwhether this link is a shadowLink for ego
Returns
The all vehicles on foeLanes and their (virtual) distances to the asking vehicle
Todo:
consider lateral position (depending on whether the crossing is encountered on the way in or out)

Definition at line 949 of file MSLink.cpp.

References MSLane::anyVehiclesBegin(), MSLane::anyVehiclesEnd(), MSPModel::blockedAtDist(), checkWalkingAreaFoe(), fromInternalLane(), MSGlobals::gComputeLC, gDebugFlag1, MSVehicle::getBackPositionOnLane(), Named::getID(), MSBaseVehicle::getID(), MSLane::getIncomingLanes(), getIndex(), MSLane::getIndex(), MSNet::getInstance(), SUMOVTypeParameter::getJMParam(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicle::getLateralPositionOnLane(), MSVehicle::getLatOffset(), MSVehicleType::getLength(), getLength(), MSBaseVehicle::getLength(), MSLane::getLength(), MSLane::getLinkCont(), MSLane::getLogicalPredecessorLane(), MSVehicleType::getMinGap(), MSPModel::getModel(), MSVehicleType::getParameter(), MSVehicleType::getVehicleClass(), MSBaseVehicle::getVehicleType(), getViaLaneOrLane(), MSVehicle::getWaitingTime(), MSVehicleType::getWidth(), MSLane::getWidth(), MSGlobals::gIgnoreJunctionBlocker, MSGlobals::gLateralResolution, isExitLinkAfterInternalJunction(), MSVehicle::isFrontOnLane(), isInternalJunctionLink(), MSAbstractLaneChangeModel::isOpposite(), MSVehicle::isStopped(), MSAbstractLaneChangeModel::isStrategicBlocked(), JM_CROSSING_GAP_DEFAULT, LINKDIR_LEFT, MAX2(), myFoeLanes, myInternalLaneBefore, myLane, myLaneBefore, myLengthsBehindCrossing, mySublaneFoeLanes, myWalkingAreaFoe, myWalkingAreaFoeExit, POSITION_EPS, MSPModel::SAFETY_GAP, SIMTIME, SUMO_ATTR_JM_CROSSING_GAP, SVC_BICYCLE, and MSVehicle::willStop().

Referenced by MSPModel_Striping::addCrossingVehs(), and MSVehicle::checkLinkLeader().

◆ getLeaveTime()

SUMOTime MSLink::getLeaveTime ( const SUMOTime  arrivalTime,
const double  arrivalSpeed,
const double  leaveSpeed,
const double  vehicleLength 
) const

return the expected time at which the given vehicle will clear the link

Definition at line 443 of file MSLink.cpp.

References getLength(), MAX2(), NUMERICAL_EPS, and TIME2STEPS.

Referenced by opened(), and setApproaching().

◆ getLength()

double MSLink::getLength ( ) const
inline

◆ getLengthBeforeCrossing()

double MSLink::getLengthBeforeCrossing ( const MSLane foeLane) const

Returns the internal length from the beginning of the link's internal lane before to the crossing with the given foe lane if applicable, if the lane is no foe lane to the link, INVALID_DOUBLE is returned.

See also
getLengthsBeforeCrossing()

Definition at line 854 of file MSLink.cpp.

References MSLane::getEntryLink(), Named::getID(), getLaneBefore(), MSLane::getLength(), INVALID_DOUBLE, myFoeLanes, myInternalLaneBefore, and myLengthsBehindCrossing.

Referenced by getLengthsBeforeCrossing().

◆ getLengthsBeforeCrossing()

double MSLink::getLengthsBeforeCrossing ( const MSLane foeLane) const

Returns the sum of the lengths along internal lanes following this link to the crossing with the given foe lane, if the lane is no foe lane to any of the internal lanes, INVALID_DOUBLE is returned.

See also
getLengthBeforeCrossing()

Definition at line 828 of file MSLink.cpp.

References MSLane::getLength(), getLengthBeforeCrossing(), MSLane::getLinkCont(), getViaLane(), INVALID_DOUBLE, and myInternalLane.

Referenced by MSDevice_SSM::classifyEncounter().

◆ getLengthsBehindCrossing()

const std::vector<std::pair<double, double> >& MSLink::getLengthsBehindCrossing ( ) const
inline

Definition at line 517 of file MSLink.h.

References myLengthsBehindCrossing.

Referenced by GUILane::debugDrawFoeIntersections().

◆ getMesoTLSPenalty()

SUMOTime MSLink::getMesoTLSPenalty ( ) const
inline

Returns the time penalty for passing a tls-controlled link (meso)

Definition at line 494 of file MSLink.h.

References myMesoTLSPenalty.

Referenced by MESegment::getLinkPenalty(), MESegment::getMaxPenaltySeconds(), and MSEdge::recalcCache().

◆ getOffState()

LinkState MSLink::getOffState ( ) const
inline

Returns the off-state for the link.

Returns
The current state of this link

Definition at line 291 of file MSLink.h.

References myOffState.

◆ getParallelLink()

MSLink * MSLink::getParallelLink ( int  direction) const

◆ getState()

◆ getTLIndex()

int MSLink::getTLIndex ( ) const
inline

◆ getTLLogic()

◆ getViaLane()

◆ getViaLaneOrLane()

◆ getWalkingAreaFoe()

const MSLane* MSLink::getWalkingAreaFoe ( )
inline

get walkingarea as foes

Definition at line 184 of file MSLink.h.

References myWalkingAreaFoe.

◆ getWalkingAreaFoeExit()

const MSLane* MSLink::getWalkingAreaFoeExit ( )
inline

Definition at line 187 of file MSLink.h.

References myWalkingAreaFoeExit.

◆ getZipperSpeed()

◆ hasApproachingFoe()

bool MSLink::hasApproachingFoe ( SUMOTime  arrivalTime,
SUMOTime  leaveTime,
double  speed,
double  decel 
) const

Returns the information whether a vehicle is approaching on one of the link's foe streams.

Valid after the vehicles have set their requests

Parameters
[in]arrivalTimeThe arrivalTime of the vehicle who checks for an approaching foe
[in]leaveTimeThe leaveTime of the vehicle who checks for an approaching foe
[in]speedThe speed with which the checking vehicle plans to leave the link
[in]decelThe maximum deceleration of the checking vehicle
Returns
Whether a foe of this link is approaching

Definition at line 684 of file MSLink.cpp.

References myFoeLanes, myFoeLinks, and myLane.

◆ hasFoes()

bool MSLink::hasFoes ( ) const
inline

Returns whether this link belongs to a junction where more than one edge is incoming.

Returns
Whether any foe links exist

Definition at line 388 of file MSLink.h.

References myHasFoes.

Referenced by MSVehicle::keepClear(), and setRequestInformation().

◆ havePriority()

◆ haveRed()

bool MSLink::haveRed ( ) const
inline

Returns whether this link is blocked by a red (or redyellow) traffic light.

Returns
Whether the link has a red light

Definition at line 352 of file MSLink.h.

References LINKSTATE_TL_RED, LINKSTATE_TL_REDYELLOW, and myState.

Referenced by MSLaneChanger::changeOpposite(), MSVehicle::checkRewindLinkLanes(), MSPModel_Striping::PState::ignoreRed(), MSVehicle::ignoreRed(), opened(), and MSVehicle::processLaneAdvances().

◆ haveYellow()

bool MSLink::haveYellow ( ) const
inline

◆ initParallelLinks()

void MSLink::initParallelLinks ( )

initialize parallel links (to be called after all links are loaded)

Definition at line 1382 of file MSLink.cpp.

References computeParallelLink(), myParallelLeft, and myParallelRight.

◆ isBlockingAnyone()

bool MSLink::isBlockingAnyone ( ) const
inline

Definition at line 251 of file MSLink.h.

References myApproachingVehicles.

◆ isConflictEntryLink()

bool MSLink::isConflictEntryLink ( ) const

return whether this link enters the conflict area (not a continuation link)

Definition at line 900 of file MSLink.cpp.

References isEntryLink(), myAmCont, myInternalLane, and myInternalLaneBefore.

Referenced by MSVehicle::processLaneAdvances().

◆ isCont()

bool MSLink::isCont ( ) const

◆ isEntryLink()

bool MSLink::isEntryLink ( ) const

return whether the toLane of this link is an internal lane and fromLane is a normal lane

Definition at line 891 of file MSLink.cpp.

References MSGlobals::gUsingInternalLanes, myInternalLane, and myInternalLaneBefore.

Referenced by isConflictEntryLink(), and MSVehicle::processLaneAdvances().

◆ isExitLink()

bool MSLink::isExitLink ( ) const

return whether the fromLane of this link is an internal lane and toLane is a normal lane

Definition at line 906 of file MSLink.cpp.

References MSGlobals::gUsingInternalLanes, myInternalLane, and myInternalLaneBefore.

Referenced by MSVehicle::processLaneAdvances().

◆ isExitLinkAfterInternalJunction()

bool MSLink::isExitLinkAfterInternalJunction ( ) const

return whether the fromLane of this link is an internal lane and its incoming lane is also an internal lane

Definition at line 915 of file MSLink.cpp.

References MSLane::getIncomingLanes(), getInternalLaneBefore(), MSGlobals::gUsingInternalLanes, and myInternalLaneBefore.

Referenced by getLeaderInfo().

◆ isInternalJunctionLink()

bool MSLink::isInternalJunctionLink ( ) const

return whether the fromLane and the toLane of this link are internal lanes

Definition at line 939 of file MSLink.cpp.

References getInternalLaneBefore(), and myInternalLane.

Referenced by MSVehicle::checkRewindLinkLanes(), MSDevice_SSM::classifyEncounter(), and getLeaderInfo().

◆ isTLSControlled()

bool MSLink::isTLSControlled ( ) const
inline

Definition at line 360 of file MSLink.h.

References myLogic.

Referenced by MESegment::getLinkPenalty(), MESegment::getTLSCapacity(), and MSEdge::recalcCache().

◆ keepClear()

bool MSLink::keepClear ( ) const
inline

whether the junction after this link must be kept clear

Definition at line 397 of file MSLink.h.

References myKeepClear.

Referenced by MSVehicle::keepClear().

◆ lastWasContMajor()

bool MSLink::lastWasContMajor ( ) const

whether this is a link past an internal junction which currently has priority

Definition at line 748 of file MSLink.cpp.

References MSLinkContHelper::getConnectingLink(), MSLane::getEdge(), MSLane::getLogicalPredecessorLane(), havePriority(), haveYellow(), MSEdge::isInternal(), myAmCont, myHavePedestrianCrossingFoe, and myInternalLane.

Referenced by MSVehicle::processLinkApproaches().

◆ opened()

bool MSLink::opened ( SUMOTime  arrivalTime,
double  arrivalSpeed,
double  leaveSpeed,
double  vehicleLength,
double  impatience,
double  decel,
SUMOTime  waitingTime,
double  posLat = 0,
BlockingFoes collectFoes = nullptr,
bool  ignoreRed = false,
const SUMOVehicle ego = nullptr 
) const

◆ operator=()

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

invalidated assignment operator

◆ removeApproaching()

void MSLink::removeApproaching ( const SUMOVehicle veh)

removes the vehicle from myApproachingVehicles

Definition at line 416 of file MSLink.cpp.

References DEBUG_COND2, SUMOTrafficObject::getID(), Named::getID(), myApproachingVehicles, myLane, myLaneBefore, and SIMTIME.

Referenced by MEVehicle::replaceRoute(), and MSVehicle::updateDriveItems().

◆ setApproaching() [1/2]

void MSLink::setApproaching ( const SUMOVehicle approaching,
ApproachingVehicleInformation  ai 
)

Sets the information about an approaching vehicle.

Definition at line 383 of file MSLink.cpp.

References DEBUG_COND2, SUMOTrafficObject::getID(), Named::getID(), myApproachingVehicles, myLane, myLaneBefore, and SIMTIME.

◆ setApproaching() [2/2]

void MSLink::setApproaching ( const SUMOVehicle approaching,
const SUMOTime  arrivalTime,
const double  arrivalSpeed,
const double  leaveSpeed,
const bool  setRequest,
const SUMOTime  arrivalTimeBraking,
const double  arrivalSpeedBraking,
const SUMOTime  waitingTime,
double  dist 
)

◆ setGreenFraction()

void MSLink::setGreenFraction ( const double  fraction)
inline

Sets the green fraction for passing a tls-controlled link (meso)

Definition at line 509 of file MSLink.h.

References myGreenFraction.

◆ setMesoTLSPenalty()

void MSLink::setMesoTLSPenalty ( const SUMOTime  penalty)
inline

Sets the time penalty for passing a tls-controlled link (meso)

Definition at line 504 of file MSLink.h.

References myMesoTLSPenalty.

◆ setRequestInformation()

void MSLink::setRequestInformation ( int  index,
bool  hasFoes,
bool  isCont,
const std::vector< MSLink * > &  foeLinks,
const std::vector< MSLane * > &  foeLanes,
MSLane internalLaneBefore = 0 
)

◆ setTLState()

void MSLink::setTLState ( LinkState  state,
SUMOTime  t 
)

Sets the current tl-state.

Parameters
[in]stateThe current state of the link
[in]tThe time of the state change

Definition at line 726 of file MSLink.cpp.

References myLastStateChange, and myState.

Referenced by MSTrafficLightLogic::addLink().

◆ unsafeMergeSpeeds()

static bool MSLink::unsafeMergeSpeeds ( double  leaderSpeed,
double  followerSpeed,
double  leaderDecel,
double  followerDecel 
)
inlinestaticprivate

return whether the given vehicles may NOT merge safely

Definition at line 538 of file MSLink.h.

Referenced by blockedByFoe().

◆ willHaveBlockedFoe()

bool MSLink::willHaveBlockedFoe ( ) const

Definition at line 405 of file MSLink.cpp.

References myBlockedFoeLinks.

◆ writeApproaching()

Field Documentation

◆ myAmCont

bool MSLink::myAmCont
private

Definition at line 602 of file MSLink.h.

Referenced by isConflictEntryLink(), isCont(), lastWasContMajor(), and setRequestInformation().

◆ myAmContOff

bool MSLink::myAmContOff
private

Definition at line 604 of file MSLink.h.

Referenced by isCont(), and setRequestInformation().

◆ myApproachingVehicles

ApproachInfos MSLink::myApproachingVehicles
private

◆ myBlockedFoeLinks

std::set<MSLink*> MSLink::myBlockedFoeLinks
private

Definition at line 567 of file MSLink.h.

Referenced by addBlockedLink(), and willHaveBlockedFoe().

◆ myDirection

LinkDirection MSLink::myDirection
private

An abstract (hopefully human readable) definition of the link's direction.

Definition at line 587 of file MSLink.h.

Referenced by getDirection(), opened(), and setRequestInformation().

◆ myFoeLanes

std::vector<const MSLane*> MSLink::myFoeLanes
private

◆ myFoeLinks

std::vector<MSLink*> MSLink::myFoeLinks
private

◆ myFoeVisibilityDistance

double MSLink::myFoeVisibilityDistance
private

distance from which an approaching vehicle is able to see all relevant foes and may accelerate if the link is minor and no foe is approaching. Defaults to 4.5m.

Definition at line 596 of file MSLink.h.

Referenced by getFoeVisibilityDistance().

◆ myGreenFraction

double MSLink::myGreenFraction
private

green fraction at tls for mesoscopic simulation

Definition at line 621 of file MSLink.h.

Referenced by getGreenFraction(), and setGreenFraction().

◆ myHasFoes

bool MSLink::myHasFoes
private

Whether any foe links exist.

Definition at line 599 of file MSLink.h.

Referenced by hasFoes(), and setRequestInformation().

◆ myHavePedestrianCrossingFoe

bool MSLink::myHavePedestrianCrossingFoe
private

whether on of myFoeLanes is a crossing

Definition at line 643 of file MSLink.h.

Referenced by lastWasContMajor(), and setRequestInformation().

◆ myIndex

int MSLink::myIndex
private

The position within this respond.

Definition at line 570 of file MSLink.h.

Referenced by getIndex(), and setRequestInformation().

◆ myInternalLane

◆ myInternalLaneBefore

◆ myJunction

MSJunction* MSLink::myJunction
private

the junction to which this link belongs

Definition at line 663 of file MSLink.h.

Referenced by getJunction(), getZipperSpeed(), and setRequestInformation().

◆ myKeepClear

bool MSLink::myKeepClear
private

Definition at line 607 of file MSLink.h.

Referenced by keepClear().

◆ myLane

MSLane* MSLink::myLane
private

The lane behind the junction approached by this link.

Definition at line 561 of file MSLink.h.

Referenced by getLane(), getLeaderInfo(), getViaLaneOrLane(), hasApproachingFoe(), opened(), removeApproaching(), setApproaching(), and setRequestInformation().

◆ myLaneBefore

MSLane* MSLink::myLaneBefore
private

The lane approaching this link.

Definition at line 564 of file MSLink.h.

Referenced by checkContOff(), getDescription(), getLaneBefore(), getLeaderInfo(), MSLink(), removeApproaching(), setApproaching(), and setRequestInformation().

◆ myLastStateChange

SUMOTime MSLink::myLastStateChange
private

The time of the last state change.

Definition at line 584 of file MSLink.h.

Referenced by getLastStateChange(), and setTLState().

◆ myLateralShift

double MSLink::myLateralShift
private

lateral shift to be applied when passing this link

Definition at line 624 of file MSLink.h.

Referenced by getLateralShift(), and MSLink().

◆ myLength

double MSLink::myLength
private

The length of the link.

Note
This is not equal to the result of getInternalLengthsAfter for links with more than one internal lane.

Definition at line 591 of file MSLink.h.

Referenced by getLength().

◆ myLengthsBehindCrossing

std::vector<std::pair<double, double> > MSLink::myLengthsBehindCrossing
private

◆ myLogic

const MSTrafficLightLogic* MSLink::myLogic
private

the controlling logic or 0

Definition at line 576 of file MSLink.h.

Referenced by getTLLogic(), isTLSControlled(), and setRequestInformation().

◆ myLookaheadTime

const SUMOTime MSLink::myLookaheadTime = TIME2STEPS(1)
staticprivate

Definition at line 656 of file MSLink.h.

Referenced by blockedByFoe().

◆ myLookaheadTimeZipper

const SUMOTime MSLink::myLookaheadTimeZipper = TIME2STEPS(4)
staticprivate

Definition at line 657 of file MSLink.h.

Referenced by blockedByFoe().

◆ myMesoTLSPenalty

SUMOTime MSLink::myMesoTLSPenalty
private

penalty time at tls for mesoscopic simulation

Definition at line 619 of file MSLink.h.

Referenced by getMesoTLSPenalty(), and setMesoTLSPenalty().

◆ myOffState

const LinkState MSLink::myOffState
private

The state of the link when switching of traffic light control.

Definition at line 581 of file MSLink.h.

Referenced by getOffState().

◆ myParallelLeft

MSLink* MSLink::myParallelLeft
private

Definition at line 660 of file MSLink.h.

Referenced by getParallelLink(), and initParallelLinks().

◆ myParallelRight

MSLink* MSLink::myParallelRight
private

Definition at line 659 of file MSLink.h.

Referenced by getParallelLink(), and initParallelLinks().

◆ myState

LinkState MSLink::myState
private

The state of the link.

Definition at line 579 of file MSLink.h.

Referenced by blockedByFoe(), getState(), havePriority(), haveRed(), haveYellow(), isCont(), opened(), and setTLState().

◆ mySublaneFoeLanes

std::vector<MSLane*> MSLink::mySublaneFoeLanes
private

Definition at line 654 of file MSLink.h.

Referenced by getLeaderInfo(), and setRequestInformation().

◆ mySublaneFoeLinks

std::vector<MSLink*> MSLink::mySublaneFoeLinks
private

Definition at line 647 of file MSLink.h.

Referenced by opened(), and setRequestInformation().

◆ mySublaneFoeLinks2

std::vector<MSLink*> MSLink::mySublaneFoeLinks2
private

Definition at line 650 of file MSLink.h.

Referenced by opened(), and setRequestInformation().

◆ myTLIndex

const int MSLink::myTLIndex
private

the traffic light index

Definition at line 573 of file MSLink.h.

Referenced by getTLIndex().

◆ myWalkingAreaFoe

const MSLane* MSLink::myWalkingAreaFoe
private

walkingArea that must be checked when entering the intersection

Definition at line 638 of file MSLink.h.

Referenced by addWalkingAreaFoe(), getLeaderInfo(), and getWalkingAreaFoe().

◆ myWalkingAreaFoeExit

const MSLane* MSLink::myWalkingAreaFoeExit
private

walkingArea that must be checked when leaving the intersection

Definition at line 640 of file MSLink.h.

Referenced by addWalkingAreaFoeExit(), getLeaderInfo(), and getWalkingAreaFoeExit().

◆ ZIPPER_ADAPT_DIST

const double MSLink::ZIPPER_ADAPT_DIST
static

Definition at line 73 of file MSLink.h.

Referenced by getZipperSpeed(), and MSVehicle::unsafeLinkAhead().


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