124 const double _arrivalSpeed,
const double _leaveSpeed,
125 const bool _willPass,
126 const double _arrivalSpeedBraking,
130 const double _latOffset
182 typedef std::map<const SUMOVehicle*, const ApproachingVehicleInformation, ComparatorNumericalIdLess>
ApproachInfos;
240 double foeVisibilityDistance,
260 const std::vector<MSLink*>& foeLinks,
const std::vector<MSLane*>& foeLanes,
261 MSLane* internalLaneBefore = 0);
286 const double arrivalSpeed,
const double leaveSpeed,
const bool setRequest,
287 const double arrivalSpeedBraking,
288 const SUMOTime waitingTime,
double dist,
double latOffset);
327 bool opened(
SUMOTime arrivalTime,
double arrivalSpeed,
double leaveSpeed,
double vehicleLength,
328 double impatience,
double decel,
SUMOTime waitingTime,
331 bool ignoreRed =
false,
333 double dist = -1)
const;
351 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime,
614 SUMOTime getLeaveTime(
const SUMOTime arrivalTime,
const double arrivalSpeed,
const double leaveSpeed,
const double vehicleLength)
const;
700 std::pair<const SUMOVehicle* const, const ApproachingVehicleInformation>
getClosest()
const;
712 static inline bool unsafeMergeSpeeds(
double leaderSpeed,
double followerSpeed,
double leaderDecel,
double followerDecel) {
714 return (leaderSpeed * leaderSpeed / leaderDecel) <= (followerSpeed * followerSpeed / followerDecel);
735 SUMOTime arrivalTime,
SUMOTime leaveTime,
double arrivalSpeed,
double leaveSpeed,
736 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime,
752 static bool lateralOverlap(
double posLat,
double width,
double posLat2,
double width2);
873 static std::set<std::pair<MSLink*, MSLink*> >
myRecheck;
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
@ TURN
The link is a 180 degree turn.
@ TURN_LEFTHAND
The link is a 180 degree turn (left-hand network)
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_TL_REDYELLOW
The link has red light (must brake) but indicates upcoming green.
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
@ LINKSTATE_STOP
This is an uncontrolled, minor link, has to stop.
@ LINKSTATE_TL_YELLOW_MAJOR
The link has yellow light, may pass.
@ LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
@ LINKSTATE_TL_YELLOW_MINOR
The link has yellow light, has to brake anyway.
@ LINKSTATE_TL_RED
The link has red light (must brake)
@ LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
The base class for an intersection.
Representation of a lane in the micro simulation.
bool fromInternalLane() const
return whether the fromLane of this link is an internal lane
void writeApproaching(OutputDevice &od, const std::string fromLaneID) const
write information about all approaching vehicles to the given output device
bool isIndirect() const
whether this link is the start of an indirect turn
double computeDistToDivergence(const MSLane *lane, const MSLane *sibling, double minDist, bool sameSource) const
compute point of divergence for geomatries with a common start or end
const std::vector< const MSLane * > & getFoeLanes() const
double getLengthBeforeCrossing(const MSLane *foeLane) const
Returns the internal length from the beginning of the link's internal lane before to the crossing wit...
const MSLane * getInternalLaneBefore() const
return myInternalLaneBefore (always 0 when compiled without internal lanes)
LinkState getState() const
Returns the current state of the link.
void setApproachingPerson(const MSPerson *approaching, const SUMOTime arrivalTime, const SUMOTime leaveTime)
Sets the information about an approaching person (only for a pedestrian crossing)
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
SUMOTime myMesoTLSPenalty
penalty time at tls for mesoscopic simulation
const MSLane * getWalkingAreaFoeExit()
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.
double myDistToFoePedCrossing
distance from the stop line to the first pedestrian crossing or maxdouble
bool isTLSControlled() const
const bool myAmIndirect
whether this connection is an indirect turning movement
std::vector< MSLink * > mySublaneFoeLinks
double myGreenFraction
green fraction at tls for mesoscopic simulation
static const SUMOTime myLookaheadTime
ApproachInfos myApproachingVehicles
void setMesoTLSPenalty(const SUMOTime penalty)
Sets the time penalty for passing a tls-controlled link (meso)
double myFoeVisibilityDistance
distance from which an approaching vehicle is able to see all relevant foes and may accelerate if the...
MSLink * computeParallelLink(int direction)
SVCPermissions myPermissions
who may drive on this link
int myIndex
The position within this respond.
bool myHasFoes
Whether any foe links exist.
const ApproachInfos & getApproaching() const
return all approaching vehicles
MSJunction * getJunction() const
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const bool setRequest, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist, double latOffset)
Sets the information about an approaching vehicle.
const MSLane * myInternalLaneBefore
LinkState myState
The state of the link.
bool lastWasContState(LinkState linkState) const
whether this is a link past an internal junction where the entry to the junction currently has the gi...
void initParallelLinks()
initialize parallel links (to be called after all links are loaded)
SUMOTime getLastStateChange() const
void setTLState(LinkState state, SUMOTime t)
Sets the current tl-state.
static const SUMOTime myLookaheadTimeZipper
void removeApproachingPerson(const MSPerson *person)
removes the person from myApproachingPersons
MSLane * getLane() const
Returns the connected lane.
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 SUMOTrafficObject *ego=nullptr, double dist=-1) const
Returns the information whether the link may be passed.
std::vector< MSLink * > * myOffFoeLinks
bool isConflictEntryLink() const
return whether this link enters the conflict area (not a continuation link)
double myRadius
the turning radius for this link or doublemax for straight links
int getIndex() const
Returns the respond index (for visualization)
bool havePriority() const
Returns whether this link is a major link.
MSLink(const MSLink &s)
invalidated copy constructor
double myLength
The length of the link.
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 SUMOTrafficObject *ego) const
const LinkState myOffState
The state of the link when switching of traffic light control.
const 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.
bool isTurnaround() const
static bool ignoreFoe(const SUMOTrafficObject *ego, const SUMOTrafficObject *foe)
std::map< const MSPerson *, ApproachingPersonInformation > PersonApproachInfos
int getTLIndex() const
Returns the TLS index.
bool isEntryLink() const
return whether the toLane of this link is an internal lane and fromLane is a normal lane
const MSLane * getLaneBefore() const
return the internalLaneBefore if it exists and the laneBefore otherwise
const MSTrafficLightLogic * myLogic
the controlling logic or 0
@ CONFLICT_NO_INTERSECTION
@ CONFLICT_STOP_AT_INTERNAL_JUNCTION
const std::vector< MSLink * > & getFoeLinks() const
static bool lateralOverlap(double posLat, double width, double posLat2, double width2)
check whether the given vehicle positions overlap laterally
std::vector< MSLink * > myFoeLinks
bool isInternalJunctionLink() const
return whether the fromLane and the toLane of this link are internal lanes
double getDistToFoePedCrossing() const
const PersonApproachInfos * getApproachingPersons() const
return all approaching vehicles
bool isExitLink() const
return whether the fromLane of this link is an internal lane and toLane is a normal lane
std::vector< const MSLane * > myFoeLanes
std::vector< LinkLeader > LinkLeaders
static std::set< std::pair< MSLink *, MSLink * > > myRecheck
links that need post processing after initialization (to deal with legacy networks)
void addWalkingAreaFoe(const MSLane *lane)
add walkingarea as foe (when entering the junction)
void clearState()
Remove all approaching vehicles before quick-loading state.
MSLane * myLane
The lane behind the junction approached by this link.
static const double NO_INTERSECTION
LinkState getOffState() const
Returns the off-state for the link.
bool isInFront(const MSVehicle *ego, const PositionVector &egoPath, const Position &pPos) const
whether the given person is in front of the car
MSLane * getViaLane() const
Returns the following inner lane.
const int myTLIndex
the traffic light index
double getInternalLengthsAfter() const
Returns the cumulative length of all internal lanes after this link.
std::string getDescription() const
get string description for this link
static void recheckSetRequestInformation()
post-processing for legacy networks
SUMOTime getMesoTLSPenalty() const
Returns the time penalty for passing a tls-controlled link (meso)
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
bool blockedAtTime(SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, BlockingFoes *collectFoes=nullptr, const SUMOTrafficObject *ego=nullptr, bool lastWasContRed=false, double dist=-1) const
Returns the information whether this link is blocked Valid after the vehicles have set their requests...
LinkState myLastGreenState
The last green state of the link (minor or major)
static SUMOTime computeFoeArrivalTimeBraking(SUMOTime arrivalTime, const SUMOVehicle *foe, SUMOTime foeArrivalTime, double impatience, double dist, double &fasb)
compute arrival time if foe vehicle is braking for ego
double isOnComingPed(const MSVehicle *ego, const MSPerson *p) const
whether the given person is walking towards the car returned as a factor in [0, 1]
std::pair< const SUMOVehicle *const, const ApproachingVehicleInformation > getClosest() const
get the closest vehicle approaching this link
void updateDistToFoePedCrossing(double dist)
add information about another pedestrian crossing
MSJunction * myJunction
the junction to which this link belongs
const MSLink * getCorrespondingEntryLink() const
returns the corresponding entry link for exitLinks to a junction.
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.
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
bool contIntersect(const MSLane *lane, const MSLane *foe)
check if the lane intersects with a foe cont-lane
MSLink & operator=(const MSLink &s)
invalidated assignment operator
bool isExitLinkAfterInternalJunction() const
return whether the fromLane of this link is an internal lane and its incoming lane is also an interna...
LinkState getLastGreenState() const
Returns the last green state of the link.
std::pair< const SUMOVehicle *, const MSLink * > getFirstApproachingFoe(const MSLink *wrapAround) const
get the foe vehicle that is closest to the intersection or nullptr along with the foe link This funct...
std::vector< MSLink * > mySublaneFoeLinks2
MSLink * getParallelLink(int direction) const
return the link that is parallel to this lane or 0
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
void addCustomConflict(const MSLane *from, const MSLane *to, double startPos, double endPos)
const CustomConflict * getCustomConflict(const MSLane *foeLane) const
return CustomConflict with foeLane if it is defined
MSLane *const myInternalLane
The following junction-internal lane if used.
std::vector< const SUMOTrafficObject * > BlockingFoes
double getLateralShift() const
return lateral shift that must be applied when passing this link
double myLateralShift
lateral shift to be applied when passing this link
std::vector< ConflictInfo > myConflicts
double getInternalLengthsBefore() const
Returns the cumulative length of all internal lanes before this link.
const MSLane * myWalkingAreaFoe
walkingArea that must be checked when entering the intersection
static bool couldBrakeForLeader(double followDist, double leaderDist, const MSVehicle *follow, const MSVehicle *leader)
whether follower could stay behind leader (possibly by braking)
bool haveOffPriority() const
std::map< const SUMOVehicle *, const ApproachingVehicleInformation, ComparatorNumericalIdLess > ApproachInfos
std::vector< CustomConflict > myCustomConflicts
Position getFuturePosition(const MSPerson *p, double timeHorizon=1) const
return extrapolated position of the given person after the given time
const MSLane * myWalkingAreaFoeExit
walkingArea that must be checked when leaving the intersection
MSLane * myLaneBefore
The lane approaching this link.
const MSLane * getWalkingAreaFoe()
get walkingarea as foes
double getFoeVisibilityDistance() const
Returns the distance on the approaching lane from which an approaching vehicle is able to see all rel...
LinkLeaderFlag
additional information for link leaders
@ LL_SAME_SOURCE
link leader is coming from the same (normal) lane
@ LL_SAME_TARGET
link leader is targeting the same outgoing lane
@ LL_IN_THE_WAY
vehicle is in the way
@ LL_FROM_LEFT
link leader is passing from left to right
void addWalkingAreaFoeExit(const MSLane *lane)
add walkingarea as foe (when leaving the junction)
SVCPermissions getPermissions() const
who may use this link
void setGreenFraction(const double fraction)
Sets the green fraction for passing a tls-controlled link (meso)
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
double getLengthsBeforeCrossing(const MSLane *foeLane) const
Returns the sum of the lengths along internal lanes following this link to the crossing with the give...
bool myHavePedestrianCrossingFoe
whether on of myFoeLanes is a crossing
SUMOTime myLastStateChange
The time of the last state change.
PersonApproachInfos * myApproachingPersons
double getGreenFraction() const
Returns the average proportion of green time to cycle time.
LinkDirection myDirection
An abstract (hopefully human readable) definition of the link's direction.
const MSTrafficLightLogic * getTLLogic() const
Returns the TLS index.
bool checkContOff() const
figure out whether the cont status remains in effect when switching off the tls
const MSLink * getCorrespondingExitLink() const
returns the corresponding exit link for entryLinks to a junction.
static bool unsafeMergeSpeeds(double leaderSpeed, double followerSpeed, double leaderDecel, double followerDecel)
return whether the given vehicles may NOT merge safely
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
const std::vector< ConflictInfo > & getConflicts() const
double getZipperSpeed(const MSVehicle *ego, const double dist, double vSafe, SUMOTime arrivalTime, const BlockingFoes *foes) const
return the speed at which ego vehicle must approach the zipper link
MSLink * getOppositeDirectionLink() const
return the link that is the opposite entry link to this one
std::vector< MSLane * > mySublaneFoeLanes
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
bool keepClear() const
whether the junction after this link must be kept clear
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
double getLength() const
Returns the length of this link.
void setTLLogic(const MSTrafficLightLogic *logic)
Sets the currently active tlLogic.
The parent class for traffic light logics.
Representation of a vehicle in the micro simulation.
Static storage of an output device and its base (abstract) implementation.
A point in 2D or 3D with translation and scaling methods.
Representation of a vehicle, person, or container.
Representation of a vehicle.
pre-computed information for conflict points
double getLengthBehindCrossing(const MSLink *exitLink) const
double getFoeConflictSize(const MSLink *foeExitLink) const
int foeConflictIndex
the conflict from the perspective of the foe
double conflictSize
the length of the conflict space
double getFoeLengthBehindCrossing(const MSLink *foeExitLink) const
double lengthBehindCrossing
length of internal lane after the crossing point
ConflictInfo(double lbc, double cs, ConflictFlag fl=CONFLICT_DEFAULT)
holds user defined conflict positions (must be interpreted for the correct exitLink)
CustomConflict(const MSLane *f, const MSLane *t, double s, double e)
LinkLeader(MSVehicle *_veh, double _gap, double _distToCrossing, int _llFlags=LL_FROM_LEFT, double _latOffst=0)
std::pair< MSVehicle *, double > vehAndGap