104 const double _arrivalSpeed,
const double _leaveSpeed,
105 const bool _willPass,
107 const double _arrivalSpeedBraking,
111 arrivalTime(_arrivalTime), leavingTime(_leavingTime),
112 arrivalSpeed(_arrivalSpeed), leaveSpeed(_leaveSpeed),
114 arrivalTimeBraking(_arrivalTimeBraking),
115 arrivalSpeedBraking(_arrivalSpeedBraking),
116 waitingTime(_waitingTime),
169 const std::vector<MSLink*>& foeLinks,
const std::vector<MSLane*>& foeLanes,
170 MSLane* internalLaneBefore = 0);
178 const double arrivalSpeed,
const double leaveSpeed,
const bool setRequest,
179 const SUMOTime arrivalTimeBraking,
const double arrivalSpeedBraking,
180 const SUMOTime waitingTime,
double dist);
193 const std::map<const SUMOVehicle*, ApproachingVehicleInformation>&
getApproaching()
const {
204 bool opened(
SUMOTime arrivalTime,
double arrivalSpeed,
double leaveSpeed,
double vehicleLength,
205 double impatience,
double decel,
SUMOTime waitingTime,
207 std::vector<const SUMOVehicle*>* collectFoes = 0)
const;
224 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime,
225 std::vector<const SUMOVehicle*>* collectFoes = 0)
const;
390 LinkLeaders
getLeaderInfo(
const MSVehicle* ego,
double dist, std::vector<const MSPerson*>* collectBlockers = 0)
const;
395 std::vector<const SUMOVehicle*>* collectFoes)
const;
407 SUMOTime getLeaveTime(
const SUMOTime arrivalTime,
const double arrivalSpeed,
const double leaveSpeed,
const double vehicleLength)
const;
463 static inline bool unsafeMergeSpeeds(
double leaderSpeed,
double followerSpeed,
double leaderDecel,
double followerDecel) {
465 return (leaderSpeed * leaderSpeed / leaderDecel) <= (followerSpeed * followerSpeed / followerDecel);
477 bool sameTargetLane,
double impatience,
double decel,
SUMOTime waitingTime)
const;
int myIndex
The position within this respond.
Representation of a vehicle in the micro simulation.
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
bool isLeader(const MSVehicle *ego, const MSVehicle *foe) const
MSLane * myLane
The lane behind the junction approached by this link.
const MSLane * getInternalLaneBefore() const
return myInternalLaneBefore (always 0 when compiled without internal lanes)
void addBlockedLink(MSLink *link)
SUMOTime myMesoTLSPenalty
penalty time at tls for mesoscopic simulation
LinkState myState
The state of the link.
MSLink * getParallelLink(int direction) const
return the link that is parallel to this lane or 0
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.
const std::map< const SUMOVehicle *, ApproachingVehicleInformation > & getApproaching() const
return all approaching vehicles
bool keepClear() const
whether the junction after this link must be kept clear
const int myTLIndex
the traffic light index
SUMOTime getMesoTLSPenalty() const
Returns the time penalty for passing a tls-controlled link (meso)
MSJunction * getJunction() const
double getLength() const
Returns the length of this link.
bool myHasFoes
Whether any foe links exist.
The base class for an intersection.
std::vector< MSLink * > mySublaneFoeLinks
MSLane * getViaLane() const
Returns the following inner lane.
SUMOTime myLastStateChange
The time of the last state change.
std::vector< MSLink * > myFoeLinks
void setTLState(LinkState state, SUMOTime t)
Sets the current tl-state.
LinkDirection myDirection
An abstract (hopefully human readable) definition of the link's direction.
void setMesoTLSPenalty(const SUMOTime penalty)
Sets the time penalty for passing a tls-controlled link (meso)
static const double ZIPPER_ADAPT_DIST
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
static const SUMOTime myLookaheadTime
std::vector< std::pair< double, double > > myLengthsBehindCrossing
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
std::map< const SUMOVehicle *, ApproachingVehicleInformation > myApproachingVehicles
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
bool fromInternalLane() const
return whether the fromLane of this link is an internal lane
double myGreenFraction
green fraction at tls for mesoscopic simulation
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.
MSLink * computeParallelLink(int direction)
void setGreenFraction(const double fraction)
Sets the green fraction for passing a tls-controlled link (meso)
double getFoeVisibilityDistance() const
Returns the distance on the approaching lane from which an approaching vehicle is able to see all rel...
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
const MSLane * myInternalLaneBefore
double getGreenFraction() const
Returns the average proportion of green time to cycle time.
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...
bool blockedAtTime(SUMOTime arrivalTime, SUMOTime leaveTime, double arrivalSpeed, double leaveSpeed, bool sameTargetLane, double impatience, double decel, SUMOTime waitingTime, std::vector< const SUMOVehicle * > *collectFoes=0) const
Returns the information whether this link is blocked Valid after the vehicles have set their requests...
int getIndex() const
Returns the respond index (for visualization)
MSLink & operator=(const MSLink &s)
invalidated assignment operator
double getZipperSpeed(const MSVehicle *ego, const double dist, double vSafe, SUMOTime arrivalTime, std::vector< const SUMOVehicle * > *collectFoes) const
return the speed at which ego vehicle must approach the zipper link
Representation of a vehicle.
static bool unsafeMergeSpeeds(double leaderSpeed, double followerSpeed, double leaderDecel, double followerDecel)
return whether the given vehicles may NOT merge safely
int getTLIndex() const
Returns the TLS index.
bool isInternalJunctionLink() const
return whether the fromLane and the toLane of this link are internal lanes
MSLane * getLane() const
Returns the connected lane.
bool isTLSControlled() const
static const SUMOTime myLookaheadTimeZipper
static bool couldBrakeForLeader(double followDist, double leaderDist, const MSVehicle *follow, const MSVehicle *leader)
whether fllower could stay behind leader (possibly by braking)
double myLength
The length of the link.
const std::vector< const MSLane * > & getFoeLanes()
double myFoeVisibilityDistance
distance from which an approaching vehicle is able to see all relevant foes and may accelerate if the...
std::set< MSLink * > myBlockedFoeLinks
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
std::vector< LinkLeader > LinkLeaders
std::pair< MSVehicle *, double > vehAndGap
void initParallelLinks()
initialize parallel links (to be called after all links are loaded)
bool isBlockingAnyone() const
SUMOTime getLastStateChange() const
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.
double getLengthBeforeCrossing(const MSLink *foeEntryLink) const
Returns the complete internal lengths from the link until the crossing point with the given foe link'...
static bool maybeOccupied(MSLane *lane)
returns whether the given lane may still be occupied by a vehicle currently on it ...
bool opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, double impatience, double decel, SUMOTime waitingTime, double posLat=0, std::vector< const SUMOVehicle * > *collectFoes=0) const
Returns the information whether the link may be passed.
bool havePriority() const
Returns whether this link is a major link.
bool willHaveBlockedFoe() const
LinkLeader(MSVehicle *_veh, double _gap, double _distToCrossing)
const MSTrafficLightLogic * myLogic
the controlling logic or 0
const std::vector< MSLink * > & getFoeLinks()
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
MSLane * myLaneBefore
The lane approaching this link.
const MSTrafficLightLogic * getTLLogic() const
Returns the TLS index.
The link has red light (must brake)
MSJunction * myJunction
the junction to which this link belongs
double getInternalLengthsAfter() const
Returns the cumulative length of all internal lanes after this link.
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
void writeApproaching(OutputDevice &od, const std::string fromLaneID) const
write information about all approaching vehicles to the given output device
The parent class for traffic light logics.
LinkLeaders getLeaderInfo(const MSVehicle *ego, double dist, std::vector< const MSPerson * > *collectBlockers=0) const
Returns all potential link leaders (vehicles on foeLanes) Valid during the planMove() phase...
LinkState getState() const
Returns the current state of the link.
Static storage of an output device and its base (abstract) implementation.
MSLane *const myInternalLane
The following junction-internal lane if used.
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
const MSLane * getLaneBefore() const
return the internalLaneBefore if it exists and the laneBefore otherwise
Representation of a lane in the micro simulation.
The link has red light (must brake) but indicates upcoming green.
void passedJunction(const MSVehicle *vehicle)
erase vehicle from myLinkLeaders of this links junction
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
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