|
SUMO - Simulation of Urban MObility
|
#include <MSLink.h>

Data Structures | |
| struct | ApproachingVehicleInformation |
| A structure holding the information about vehicles approaching a link. More... | |
| struct | LinkLeader |
Public Types | |
| typedef std::vector< LinkLeader > | LinkLeaders |
Public Member Functions | |
| void | addBlockedLink (MSLink *link) |
| bool | blockedAtTime (SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, bool sameTargetLane, SUMOReal impatience, SUMOReal 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. More... | |
| ApproachingVehicleInformation | getApproaching (const SUMOVehicle *veh) const |
| MSLane * | getApproachingLane () const |
| Returns the lane leading to this link. More... | |
| LinkDirection | getDirection () const |
| Returns the direction the vehicle passing this link take. More... | |
| int | getIndex () const |
| Returns the respond index (for visualization) More... | |
| const MSLane * | getInternalLaneBefore () const |
| return myInternalLaneBefore (always 0 when compiled without internal lanes) More... | |
| MSLane * | getLane () const |
| Returns the connected lane. More... | |
| SUMOTime | getLastStateChange () const |
| SUMOTime | getLeaveTime (const SUMOTime arrivalTime, const SUMOReal arrivalSpeed, const SUMOReal leaveSpeed, const SUMOReal vehicleLength) const |
| return the expected time at which the given vehicle will clear the link More... | |
| SUMOReal | getLength () const |
| Returns the length of this link. More... | |
| LinkState | getState () const |
| Returns the current state of the link. More... | |
| MSLane * | getViaLaneOrLane () const |
| return the via lane if it exists and the lane otherwise More... | |
| SUMOReal | getZipperSpeed (const MSVehicle *ego, const SUMOReal dist, SUMOReal vSafe, SUMOTime arrivalTime, std::vector< const SUMOVehicle * > *collectFoes) const |
| return the speed at which ego vehicle must approach the zipper link More... | |
| bool | hasApproachingFoe (SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal speed, SUMOReal 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 | isBlockingAnyone () const |
| bool | isCont () const |
| bool | isLeader (const MSVehicle *ego, const MSVehicle *foe) |
| 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 *succLane, LinkDirection dir, LinkState state, SUMOReal length, bool keepClear) | |
| Constructor for simulation not using internal lanes. More... | |
| bool | opened (SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, std::vector< const SUMOVehicle * > *collectFoes=0) const |
| Returns the information whether the link may be passed. More... | |
| void | passedJunction (const MSVehicle *vehicle) |
| erase vehicle from myLinkLeaders of this links junction More... | |
| void | removeApproaching (const SUMOVehicle *veh) |
| removes the vehicle from myApproachingVehicles More... | |
| void | setApproaching (const SUMOVehicle *approaching, const SUMOTime arrivalTime, const SUMOReal arrivalSpeed, const SUMOReal leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const SUMOReal arrivalSpeedBraking, const SUMOTime waitingTime, SUMOReal dist) |
| Sets the information about an approaching vehicle. 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... | |
Private Member Functions | |
| MSLink (const MSLink &s) | |
| invalidated copy constructor More... | |
| MSLink & | operator= (const MSLink &s) |
| invalidated assignment operator More... | |
Static Private Member Functions | |
| static bool | couldBrakeForLeader (SUMOReal followDist, SUMOReal leaderDist, const MSVehicle *follow, const MSVehicle *leader) |
| whether fllower could stay behind leader (possibly by braking) More... | |
| static bool | maybeOccupied (MSLane *lane) |
| returns whether the given lane may still be occupied by a vehicle currently on it More... | |
| static bool | unsafeMergeSpeeds (SUMOReal leaderSpeed, SUMOReal followerSpeed, SUMOReal leaderDecel, SUMOReal followerDecel) |
| return whether the given vehicles may NOT merge safely More... | |
Private Attributes | |
| bool | myAmCont |
| std::map< const SUMOVehicle *, ApproachingVehicleInformation > | 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 |
| bool | myHasFoes |
| Whether any foe links exist. More... | |
| int | myIndex |
| The position within this respond. More... | |
| MSJunction * | myJunction |
| the junction to which this link belongs More... | |
| bool | myKeepClear |
| MSLane * | myLane |
| The lane (but the internal one) approached by this link. More... | |
| SUMOTime | myLastStateChange |
| The time of the last state change. More... | |
| SUMOReal | myLength |
| The length of the link. More... | |
| LinkState | myState |
| The state of the link. More... | |
Static Private Attributes | |
| static const SUMOTime | myLookaheadTime = TIME2STEPS(1) |
| static const SUMOTime | myLookaheadTimeZipper = TIME2STEPS(4) |
| typedef std::vector<LinkLeader> MSLink::LinkLeaders |
| MSLink::MSLink | ( | MSLane * | succLane, |
| LinkDirection | dir, | ||
| LinkState | state, | ||
| SUMOReal | length, | ||
| bool | keepClear | ||
| ) |
Constructor for simulation not using internal lanes.
| [in] | succLane | The lane approached by this link |
| [in] | dir | The direction of this link |
| [in] | state | The state of this link |
| [in] | length | The length of this link |
| [in] | keepClear | Whether the junction after this link must be kept clear |
Definition at line 69 of file MSLink.cpp.
| MSLink::~MSLink | ( | ) |
Destructor.
Definition at line 98 of file MSLink.cpp.
|
private |
invalidated copy constructor
| void MSLink::addBlockedLink | ( | MSLink * | link | ) |
Definition at line 251 of file MSLink.cpp.
References myBlockedFoeLinks.
| bool MSLink::blockedAtTime | ( | SUMOTime | arrivalTime, |
| SUMOTime | leaveTime, | ||
| SUMOReal | arrivalSpeed, | ||
| SUMOReal | leaveSpeed, | ||
| bool | sameTargetLane, | ||
| SUMOReal | impatience, | ||
| SUMOReal | 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.
| [in] | arrivalTime | The arrivalTime of the vehicle who checks for an approaching foe |
| [in] | leaveTime | The leaveTime of the vehicle who checks for an approaching foe |
| [in] | arrivalSpeed | The speed with which the checking vehicle plans to arrive at the link |
| [in] | leaveSpeed | The speed with which the checking vehicle plans to leave the link |
| [in] | sameTargetLane | Whether the link that calls this method has the same target lane as this link |
| [in] | impatience | The impatience of the checking vehicle |
| [in] | decel | The maximum deceleration of the checking vehicle |
| [in] | waitingTime | The waiting time of the checking vehicle |
| [in] | collectFoes | If a vector is passed the return value is always False, instead all blocking foes are collected and inserted into this vector |
Definition at line 331 of file MSLink.cpp.
References LINKSTATE_ALLWAY_STOP, LINKSTATE_ZIPPER, myApproachingVehicles, myLookaheadTime, myLookaheadTimeZipper, myState, and unsafeMergeSpeeds().
|
staticprivate |
whether fllower could stay behind leader (possibly by braking)
Definition at line 736 of file MSLink.cpp.
References MSVehicle::getCarFollowModel(), MSCFModel::getMaxDecel(), and MSVehicle::getSpeed().
Referenced by getZipperSpeed().
| MSLink::ApproachingVehicleInformation MSLink::getApproaching | ( | const SUMOVehicle * | veh | ) | const |
Definition at line 275 of file MSLink.cpp.
References myApproachingVehicles.
Referenced by getZipperSpeed().
| MSLane * MSLink::getApproachingLane | ( | ) | const |
Returns the lane leading to this link.
Definition at line 442 of file MSLink.cpp.
References MSLane::getIncomingLanes(), getIndex(), MSLane::getLinkCont(), myLane, toString(), and WRITE_WARNING.
Referenced by MSRailSignal::init().
| LinkDirection MSLink::getDirection | ( | ) | const |
Returns the direction the vehicle passing this link take.
Definition at line 422 of file MSLink.cpp.
References myDirection.
Referenced by MSVehicle::executeMove(), and TraCIServerAPI_Lane::processGet().
|
inline |
Returns the respond index (for visualization)
Definition at line 298 of file MSLink.h.
References myIndex.
Referenced by GUILane::drawLinkNo(), and getApproachingLane().
| const MSLane * MSLink::getInternalLaneBefore | ( | ) | const |
return myInternalLaneBefore (always 0 when compiled without internal lanes)
Definition at line 657 of file MSLink.cpp.
| MSLane * MSLink::getLane | ( | ) | const |
Returns the connected lane.
Definition at line 437 of file MSLink.cpp.
References myLane.
Referenced by MSVehicle::checkRewindLinkLanes(), Command_SaveTLSSwitches::execute(), MSLinkContHelper::getConnectingLink(), MSPModel_Striping::getNextWalkingArea(), MSRailSignal::init(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Lane::processGet(), and writeApproaching().
|
inline |
Definition at line 260 of file MSLink.h.
References myLastStateChange.
| SUMOTime MSLink::getLeaveTime | ( | const SUMOTime | arrivalTime, |
| const SUMOReal | arrivalSpeed, | ||
| const SUMOReal | leaveSpeed, | ||
| const SUMOReal | vehicleLength | ||
| ) | const |
return the expected time at which the given vehicle will clear the link
Definition at line 286 of file MSLink.cpp.
References getLength(), MAX2(), NUMERICAL_EPS, SUMOReal, and TIME2STEPS.
Referenced by opened(), and setApproaching().
|
inline |
Returns the length of this link.
Definition at line 322 of file MSLink.h.
References myLength.
Referenced by MSVehicle::estimateLeaveSpeed(), getLeaveTime(), and TraCIServerAPI_Lane::processGet().
|
inline |
Returns the current state of the link.
Definition at line 254 of file MSLink.h.
References myState.
Referenced by MSEdge::changeLanes(), GUILane::drawLinkRule(), Command_SaveTLCoupledLaneDet::execute(), MSVehicle::executeMove(), MSLane::getIncomingLinkState(), and TraCIServerAPI_Lane::processGet().
| MSLane * MSLink::getViaLaneOrLane | ( | ) | const |
return the via lane if it exists and the lane otherwise
Definition at line 628 of file MSLink.cpp.
References myLane.
Referenced by GUIVehicle::drawAction_drawLinkItems(), MSVehicle::estimateLeaveSpeed(), MSVehicle::executeMove(), MSLinkContHelper::getConnectingLink(), MSPModel_Striping::getNextLane(), GUIVehicle::selectBlockingFoes(), and setRequestInformation().
| SUMOReal MSLink::getZipperSpeed | ( | const MSVehicle * | ego, |
| const SUMOReal | dist, | ||
| SUMOReal | vSafe, | ||
| SUMOTime | arrivalTime, | ||
| std::vector< const SUMOVehicle * > * | collectFoes | ||
| ) | const |
return the speed at which ego vehicle must approach the zipper link
Definition at line 666 of file MSLink.cpp.
References MSLink::ApproachingVehicleInformation::arrivalTime, couldBrakeForLeader(), MSLink::ApproachingVehicleInformation::dist, MSCFModel::followSpeed(), getApproaching(), MSVehicle::getCarFollowModel(), MSNet::getCurrentTimeStep(), Named::getID(), MSNet::getInstance(), MSVehicleType::getLength(), MSCFModel::getMaxDecel(), MSVehicleType::getMinGap(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MAX2(), MIN2(), myFoeLinks, myJunction, STEPS2TIME, SUMOReal, TS, ZIPPER_ADAPT_DIST, and ZIPPER_ADAPT_TIME.
Referenced by MSVehicle::executeMove().
| bool MSLink::hasApproachingFoe | ( | SUMOTime | arrivalTime, |
| SUMOTime | leaveTime, | ||
| SUMOReal | speed, | ||
| SUMOReal | 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
| [in] | arrivalTime | The arrivalTime of the vehicle who checks for an approaching foe |
| [in] | leaveTime | The leaveTime of the vehicle who checks for an approaching foe |
| [in] | speed | The speed with which the checking vehicle plans to leave the link |
| [in] | decel | The maximum deceleration of the checking vehicle |
Definition at line 406 of file MSLink.cpp.
References myFoeLanes, myFoeLinks, and myLane.
Referenced by TraCIServerAPI_Lane::processGet().
|
inline |
Returns whether this link belongs to a junction where more than one edge is incoming.
Definition at line 330 of file MSLink.h.
References myHasFoes.
Referenced by MSVehicle::checkRewindLinkLanes(), and setRequestInformation().
|
inline |
Returns whether this link is a major link.
Definition at line 306 of file MSLink.h.
References myState.
Referenced by MSVehicle::checkRewindLinkLanes(), GUILane::drawGL(), MSVehicle::executeMove(), lastWasContMajor(), opened(), and TraCIServerAPI_Lane::processGet().
|
inline |
Returns whether this link is blocked by a red (or redyellow) traffic light.
Definition at line 313 of file MSLink.h.
References LINKSTATE_TL_RED, LINKSTATE_TL_REDYELLOW, and myState.
Referenced by opened().
|
inline |
Definition at line 230 of file MSLink.h.
References myApproachingVehicles.
|
inline |
Definition at line 335 of file MSLink.h.
References myAmCont.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::executeMove(), and setRequestInformation().
Definition at line 647 of file MSLink.cpp.
References MSJunction::isLeader(), and myJunction.
Referenced by GUIVehicle::selectBlockingFoes().
|
inline |
whether the junction after this link must be kept clear
Definition at line 341 of file MSLink.h.
References myKeepClear.
Referenced by MSVehicle::checkRewindLinkLanes().
| bool MSLink::lastWasContMajor | ( | ) | const |
whether this is a link past an internal junction which currently has priority
Definition at line 470 of file MSLink.cpp.
References MSEdge::EDGEFUNCTION_INTERNAL, MSLinkContHelper::getConnectingLink(), MSLane::getEdge(), MSLane::getLogicalPredecessorLane(), MSEdge::getPurpose(), havePriority(), and myAmCont.
Referenced by MSVehicle::executeMove().
|
staticprivate |
returns whether the given lane may still be occupied by a vehicle currently on it
Definition at line 385 of file MSLink.cpp.
References MSVehicle::getCarFollowModel(), MSLane::getLastVehicle(), MSVehicleType::getLength(), MSLane::getLength(), MSCFModel::getMaxDecel(), MSLane::getPartialOccupator(), MSLane::getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), and SUMOReal.
| bool MSLink::opened | ( | SUMOTime | arrivalTime, |
| SUMOReal | arrivalSpeed, | ||
| SUMOReal | leaveSpeed, | ||
| SUMOReal | vehicleLength, | ||
| SUMOReal | impatience, | ||
| SUMOReal | decel, | ||
| SUMOTime | waitingTime, | ||
| std::vector< const SUMOVehicle * > * | collectFoes = 0 |
||
| ) | const |
Returns the information whether the link may be passed.
Valid after the junctions have set their reponds
| [in] | collectFoes | If a vector is passed, all blocking foes are collected and inserted into this vector |
Definition at line 293 of file MSLink.cpp.
References getLeaveTime(), MSGlobals::gUseMesoSim, MSGlobals::gUsingInternalLanes, havePriority(), haveRed(), LINKSTATE_ALLWAY_STOP, LINKSTATE_STOP, LINKSTATE_ZIPPER, myAmCont, myFoeLinks, myLane, and myState.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::executeMove(), MSPModel_Striping::moveInDirectionOnLane(), TraCIServerAPI_Lane::processGet(), and GUIVehicle::selectBlockingFoes().
| void MSLink::passedJunction | ( | const MSVehicle * | vehicle | ) |
erase vehicle from myLinkLeaders of this links junction
Definition at line 639 of file MSLink.cpp.
References myJunction, and MSJunction::passedJunction().
Referenced by MSVehicle::executeMove().
| void MSLink::removeApproaching | ( | const SUMOVehicle * | veh | ) |
removes the vehicle from myApproachingVehicles
Definition at line 269 of file MSLink.cpp.
References myApproachingVehicles.
Referenced by MSVehicle::executeMove().
| void MSLink::setApproaching | ( | const SUMOVehicle * | approaching, |
| const SUMOTime | arrivalTime, | ||
| const SUMOReal | arrivalSpeed, | ||
| const SUMOReal | leaveSpeed, | ||
| const bool | setRequest, | ||
| const SUMOTime | arrivalTimeBraking, | ||
| const SUMOReal | arrivalSpeedBraking, | ||
| const SUMOTime | waitingTime, | ||
| SUMOReal | dist | ||
| ) |
Sets the information about an approaching vehicle.
The information is stored in myApproachingVehicles.
Definition at line 241 of file MSLink.cpp.
References getLeaveTime(), MSVehicleType::getLength(), SUMOVehicle::getVehicleType(), and myApproachingVehicles.
| void MSLink::setRequestInformation | ( | int | index, |
| bool | hasFoes, | ||
| bool | isCont, | ||
| const std::vector< MSLink * > & | foeLinks, | ||
| const std::vector< MSLane * > & | foeLanes, | ||
| MSLane * | internalLaneBefore = 0 |
||
| ) |
Sets the request information.
Because traffic lights and junction logics are loaded after links, we have to assign the information about the right-of-way requests and responses after the initialisation.
Definition at line 102 of file MSLink.cpp.
References MSLane::getEdge(), MSEdge::getFromJunction(), Named::getID(), MSLane::getIncomingLanes(), MSLane::getLength(), MSLane::getLinkCont(), MSLane::getLogicalPredecessorLane(), MSLane::getShape(), getViaLaneOrLane(), MSLane::getWidth(), hasFoes(), MSLane::interpolateGeometryPosToLanePos(), PositionVector::intersectsAtLengths2D(), isCont(), MSEdge::isInternal(), myAmCont, myFoeLanes, myFoeLinks, myHasFoes, myIndex, myJunction, myLane, NUMERICAL_EPS, toString(), and UNUSED_PARAMETER.
Referenced by MSRightOfWayJunction::postloadInit().
Sets the current tl-state.
| [in] | state | The current state of the link |
| [in] | t | The time of the state change |
Definition at line 428 of file MSLink.cpp.
References myLastStateChange, and myState.
Referenced by MSTrafficLightLogic::addLink().
|
inlinestaticprivate |
return whether the given vehicles may NOT merge safely
Definition at line 392 of file MSLink.h.
Referenced by blockedAtTime().
| bool MSLink::willHaveBlockedFoe | ( | ) | const |
Definition at line 258 of file MSLink.cpp.
References myBlockedFoeLinks.
| void MSLink::writeApproaching | ( | OutputDevice & | od, |
| const std::string | fromLaneID | ||
| ) | const |
write information about all approaching vehicles to the given output device
Definition at line 493 of file MSLink.cpp.
References MSLink::ApproachingVehicleInformation::arrivalSpeed, MSLink::ApproachingVehicleInformation::arrivalSpeedBraking, MSLink::ApproachingVehicleInformation::arrivalTime, MSLink::ApproachingVehicleInformation::arrivalTimeBraking, OutputDevice::closeTag(), getLane(), MSLink::ApproachingVehicleInformation::leaveSpeed, MSLink::ApproachingVehicleInformation::leavingTime, myApproachingVehicles, OutputDevice::openTag(), SUMO_ATTR_FROM, SUMO_ATTR_ID, SUMO_ATTR_IMPATIENCE, SUMO_ATTR_TO, SUMO_ATTR_VIA, time2string(), toString(), MSLink::ApproachingVehicleInformation::willPass, and OutputDevice::writeAttr().
|
private |
Definition at line 428 of file MSLink.h.
Referenced by isCont(), lastWasContMajor(), opened(), and setRequestInformation().
|
private |
Definition at line 407 of file MSLink.h.
Referenced by blockedAtTime(), getApproaching(), isBlockingAnyone(), removeApproaching(), setApproaching(), and writeApproaching().
|
private |
Definition at line 408 of file MSLink.h.
Referenced by addBlockedLink(), and willHaveBlockedFoe().
|
private |
An abstract (hopefully human readable) definition of the link's direction.
Definition at line 420 of file MSLink.h.
Referenced by getDirection().
|
private |
Definition at line 451 of file MSLink.h.
Referenced by hasApproachingFoe(), and setRequestInformation().
|
private |
Definition at line 450 of file MSLink.h.
Referenced by getZipperSpeed(), hasApproachingFoe(), opened(), and setRequestInformation().
|
private |
Whether any foe links exist.
Definition at line 426 of file MSLink.h.
Referenced by hasFoes(), and setRequestInformation().
|
private |
The position within this respond.
Definition at line 411 of file MSLink.h.
Referenced by getIndex(), and setRequestInformation().
|
private |
the junction to which this link belongs
Definition at line 448 of file MSLink.h.
Referenced by getZipperSpeed(), isLeader(), passedJunction(), and setRequestInformation().
|
private |
Definition at line 430 of file MSLink.h.
Referenced by keepClear().
|
private |
The lane (but the internal one) approached by this link.
Definition at line 405 of file MSLink.h.
Referenced by getApproachingLane(), getLane(), getViaLaneOrLane(), hasApproachingFoe(), opened(), and setRequestInformation().
|
private |
The time of the last state change.
Definition at line 417 of file MSLink.h.
Referenced by getLastStateChange(), and setTLState().
|
private |
|
staticprivate |
Definition at line 453 of file MSLink.h.
Referenced by blockedAtTime().
|
staticprivate |
Definition at line 454 of file MSLink.h.
Referenced by blockedAtTime().
|
private |
The state of the link.
Definition at line 414 of file MSLink.h.
Referenced by blockedAtTime(), getState(), havePriority(), haveRed(), opened(), and setTLState().