|
SUMO - Simulation of Urban MObility
|
#include <MSLink.h>
Data Structures | |
| struct | ApproachingVehicleInformation |
| A structure holding the information about vehicles approaching a link. More... | |
Public Types | |
| typedef std::vector< std::pair < MSVehicle *, SUMOReal > > | 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 |
| LinkDirection | getDirection () const |
| Returns the direction the vehicle passing this link take. More... | |
| MSLane * | getLane () const |
| Returns the connected lane. More... | |
| SUMOTime | getLeaveTime (SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, 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... | |
| unsigned int | getRespondIndex () const |
| Returns the respond index (for visualization) 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... | |
| bool | hasApproachingFoe (SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal speed, SUMOReal decel=DEFAULT_VEH_DECEL) const |
| Returns the information whether a vehicle is approaching on one of the link's foe streams. More... | |
| bool | havePriority () const |
| Returns whether this link is a major link. More... | |
| bool | isBlockingAnyone () const |
| bool | isCont () const |
| bool | isCrossing () const |
| Returns whether this link belongs to a junction where more than one edge is incoming. More... | |
| MSLink (MSLane *succLane, LinkDirection dir, LinkState state, SUMOReal length) | |
| 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 | 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) |
| Sets the information about an approaching vehicle. More... | |
| void | setRequestInformation (unsigned int requestIdx, unsigned int respondIdx, bool isCrossing, 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 | 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< MSLane * > | myFoeLanes |
| std::vector< MSLink * > | myFoeLinks |
| bool | myIsCrossing |
| Whether any foe links exist. More... | |
| MSLane * | myLane |
| The lane approached by this link. More... | |
| SUMOReal | myLength |
| The length of the link. More... | |
| unsigned int | myRequestIdx |
| The position of the link within this request. More... | |
| unsigned int | myRespondIdx |
| The position within this respond. More... | |
| LinkState | myState |
| The state of the link. More... | |
Static Private Attributes | |
| static SUMOTime | myLookaheadTime = TIME2STEPS(1) |
| typedef std::vector<std::pair<MSVehicle*, SUMOReal> > MSLink::LinkLeaders |
| MSLink::MSLink | ( | MSLane * | succLane, |
| LinkDirection | dir, | ||
| LinkState | state, | ||
| SUMOReal | length | ||
| ) |
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 |
Definition at line 58 of file MSLink.cpp.
| MSLink::~MSLink | ( | ) |
Destructor.
Definition at line 77 of file MSLink.cpp.
|
private |
invalidated copy constructor
| void MSLink::addBlockedLink | ( | MSLink * | link | ) |
Definition at line 144 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 216 of file MSLink.cpp.
References LINKSTATE_ALLWAY_STOP, myApproachingVehicles, myLookaheadTime, myState, and unsafeMergeSpeeds().
| MSLink::ApproachingVehicleInformation MSLink::getApproaching | ( | const SUMOVehicle * | veh | ) | const |
Definition at line 168 of file MSLink.cpp.
References myApproachingVehicles.
| LinkDirection MSLink::getDirection | ( | ) | const |
Returns the direction the vehicle passing this link take.
Definition at line 306 of file MSLink.cpp.
References myDirection.
Referenced by MSVehicle::executeMove(), and TraCIServerAPI_Lane::processGet().
| MSLane * MSLink::getLane | ( | ) | const |
Returns the connected lane.
Definition at line 318 of file MSLink.cpp.
References myLane.
Referenced by MSVehicle::checkRewindLinkLanes(), Command_SaveTLSSwitches::execute(), MSLinkContHelper::getConnectingLink(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Lane::processGet(), and writeApproaching().
| SUMOTime MSLink::getLeaveTime | ( | SUMOTime | arrivalTime, |
| SUMOReal | arrivalSpeed, | ||
| SUMOReal | leaveSpeed, | ||
| SUMOReal | vehicleLength | ||
| ) | const |
return the expected time at which the given vehicle will clear the link
Definition at line 179 of file MSLink.cpp.
References getLength(), and TIME2STEPS.
Referenced by opened(), and setApproaching().
|
inline |
Returns the length of this link.
Definition at line 283 of file MSLink.h.
References myLength.
Referenced by MSVehicle::estimateLeaveSpeed(), getLeaveTime(), and TraCIServerAPI_Lane::processGet().
| unsigned int MSLink::getRespondIndex | ( | ) | const |
Returns the respond index (for visualization)
Definition at line 453 of file MSLink.cpp.
References myRespondIdx.
|
inline |
Returns the current state of the link.
Definition at line 238 of file MSLink.h.
References myState.
Referenced by GUILane::drawLinkRules(), Command_SaveTLCoupledLaneDet::execute(), MSVehicle::executeMove(), and TraCIServerAPI_Lane::processGet().
| MSLane * MSLink::getViaLaneOrLane | ( | ) | const |
return the via lane if it exists and the lane otherwise
Definition at line 442 of file MSLink.cpp.
References myLane.
Referenced by GUIVehicle::drawGLAdditional(), MSVehicle::estimateLeaveSpeed(), MSVehicle::executeMove(), and MSLinkContHelper::getConnectingLink().
| bool MSLink::hasApproachingFoe | ( | SUMOTime | arrivalTime, |
| SUMOTime | leaveTime, | ||
| SUMOReal | speed, | ||
| SUMOReal | decel = DEFAULT_VEH_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 290 of file MSLink.cpp.
References myFoeLanes, myFoeLinks, and myLane.
Referenced by TraCIServerAPI_Lane::processGet().
|
inline |
Returns whether this link is a major link.
Definition at line 274 of file MSLink.h.
References myState.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::executeMove(), MSEdge::laneChangeAllowed(), and TraCIServerAPI_Lane::processGet().
|
inline |
Definition at line 213 of file MSLink.h.
References myApproachingVehicles.
|
inline |
Definition at line 296 of file MSLink.h.
References myAmCont.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::executeMove(), and setRequestInformation().
|
inline |
Returns whether this link belongs to a junction where more than one edge is incoming.
Definition at line 291 of file MSLink.h.
References myIsCrossing.
Referenced by MSVehicle::checkRewindLinkLanes(), and setRequestInformation().
returns whether the given lane may still be occupied by a vehicle currently on it
Definition at line 269 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 185 of file MSLink.cpp.
References getLeaveTime(), MSGlobals::gUseMesoSim, MSGlobals::gUsingInternalLanes, LINKSTATE_ALLWAY_STOP, LINKSTATE_STOP, LINKSTATE_TL_RED, myAmCont, myFoeLinks, myLane, and myState.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::executeMove(), TraCIServerAPI_Lane::processGet(), and GUIVehicle::selectBlockingFoes().
| void MSLink::removeApproaching | ( | const SUMOVehicle * | veh | ) |
removes the vehicle from myApproachingVehicles
Definition at line 162 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 | ||
| ) |
Sets the information about an approaching vehicle.
The information is stored in myApproachingVehicles.
Definition at line 134 of file MSLink.cpp.
References getLeaveTime(), MSVehicleType::getLengthWithGap(), SUMOVehicle::getVehicleType(), and myApproachingVehicles.
| void MSLink::setRequestInformation | ( | unsigned int | requestIdx, |
| unsigned int | respondIdx, | ||
| bool | isCrossing, | ||
| 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 81 of file MSLink.cpp.
References MSLane::getLength(), MSLane::getLinkCont(), MSLane::getShape(), PositionVector::intersectsAtLengths2D(), isCont(), isCrossing(), myAmCont, myFoeLanes, myFoeLinks, myIsCrossing, myLane, myRequestIdx, myRespondIdx, and UNUSED_PARAMETER.
Referenced by MSRightOfWayJunction::postloadInit().
Sets the current tl-state.
| [in] | state | The current state of the link |
Definition at line 312 of file MSLink.cpp.
References myState.
Referenced by MSTrafficLightLogic::addLink().
|
inlinestaticprivate |
return whether the given vehicles may NOT merge safely
Definition at line 330 of file MSLink.h.
Referenced by blockedAtTime().
| bool MSLink::willHaveBlockedFoe | ( | ) | const |
Definition at line 151 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 324 of file MSLink.cpp.
References MSLink::ApproachingVehicleInformation::arrivalSpeed, MSLink::ApproachingVehicleInformation::arrivalTime, OutputDevice::closeTag(), getLane(), MSLink::ApproachingVehicleInformation::leaveSpeed, MSLink::ApproachingVehicleInformation::leavingTime, myApproachingVehicles, OutputDevice::openTag(), SUMO_ATTR_FROM, SUMO_ATTR_ID, SUMO_ATTR_TO, SUMO_ATTR_VIA, time2string(), toString(), MSLink::ApproachingVehicleInformation::willPass, and OutputDevice::writeAttr().
|
private |
Definition at line 363 of file MSLink.h.
Referenced by isCont(), opened(), and setRequestInformation().
|
private |
Definition at line 342 of file MSLink.h.
Referenced by blockedAtTime(), getApproaching(), isBlockingAnyone(), removeApproaching(), setApproaching(), and writeApproaching().
|
private |
Definition at line 343 of file MSLink.h.
Referenced by addBlockedLink(), and willHaveBlockedFoe().
|
private |
An abstract (hopefully human readable) definition of the link's direction.
Definition at line 355 of file MSLink.h.
Referenced by getDirection().
|
private |
Definition at line 378 of file MSLink.h.
Referenced by hasApproachingFoe(), and setRequestInformation().
|
private |
Definition at line 377 of file MSLink.h.
Referenced by hasApproachingFoe(), opened(), and setRequestInformation().
|
private |
Whether any foe links exist.
Definition at line 361 of file MSLink.h.
Referenced by isCrossing(), and setRequestInformation().
|
private |
The lane approached by this link.
Definition at line 340 of file MSLink.h.
Referenced by getLane(), getViaLaneOrLane(), hasApproachingFoe(), opened(), and setRequestInformation().
|
private |
|
staticprivate |
Definition at line 379 of file MSLink.h.
Referenced by blockedAtTime().
|
private |
The position of the link within this request.
Definition at line 346 of file MSLink.h.
Referenced by setRequestInformation().
|
private |
The position within this respond.
Definition at line 349 of file MSLink.h.
Referenced by getRespondIndex(), and setRequestInformation().
|
private |
The state of the link.
Definition at line 352 of file MSLink.h.
Referenced by blockedAtTime(), getState(), havePriority(), opened(), and setTLState().