SUMO - Simulation of Urban MObility
|
#include <MSLink.h>
Data Structures | |
struct | ApproachingVehicleInformation |
A structure holding the information about vehicles approaching a link. More... | |
class | vehicle_in_request_finder |
Public Member Functions | |
void | addBlockedLink (MSLink *link) |
bool | blockedAtTime (SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, bool sameTargetLane) const |
Returns the information whether this link is blocked Valid after the vehicles have set their requests. | |
const std::vector < ApproachingVehicleInformation > & | getApproaching () const |
ApproachingVehicleInformation | getApproaching (const SUMOVehicle *veh) const |
LinkDirection | getDirection () const |
Returns the direction the vehicle passing this link take. | |
MSLane * | getLane () const |
Returns the connected lane. | |
SUMOTime | getLeaveTime (SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength) const |
return the expected time at which the given vehicle will clear the link | |
SUMOReal | getLength () const |
Returns the length of this link. | |
unsigned int | getRespondIndex () const |
Returns the respond index (for visualization) | |
LinkState | getState () const |
Returns the current state of the link. | |
MSLane * | getViaLaneOrLane () const |
return the via lane if it exists and the lane otherwise | |
bool | hasApproachingFoe (SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal speed) const |
Returns the information whether a vehicle is approaching on one of the link's foe streams. | |
bool | havePriority () const |
Returns whether this link is a major link. | |
bool | isBlockingAnyone () const |
bool | isCont () const |
bool | isCrossing () const |
Returns whether this link belongs to a junction where more than one edge is incoming. | |
MSLink (MSLane *succLane, LinkDirection dir, LinkState state, SUMOReal length) | |
Constructor for simulation not using internal lanes. | |
bool | opened (SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength) const |
Returns the information whether the link may be passed. | |
void | removeApproaching (SUMOVehicle *veh) |
removes the vehicle from myApproachingVehicles | |
void | setApproaching (SUMOVehicle *approaching, SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, bool setRequest) |
Sets the information about an approaching vehicle. | |
void | setRequestInformation (unsigned int requestIdx, unsigned int respondIdx, bool isCrossing, bool isCont, const std::vector< MSLink * > &foeLinks, const std::vector< MSLane * > &foeLanes) |
Sets the request information. | |
void | setTLState (LinkState state, SUMOTime t) |
Sets the current tl-state. | |
bool | willHaveBlockedFoe () const |
~MSLink () | |
Destructor. |
Private Types | |
typedef std::vector < ApproachingVehicleInformation > | LinkApproachingVehicles |
Private Member Functions | |
MSLink (const MSLink &s) | |
invalidated copy constructor | |
MSLink & | operator= (const MSLink &s) |
invalidated assignment operator |
Static Private Member Functions | |
static bool | maybeOccupied (MSLane *lane) |
returns whether the given lane may still be occupied by a vehicle currently on it | |
static SUMOTime | unsafeHeadwayTime (SUMOTime headwayTime, SUMOReal leaderSpeed, SUMOReal followerSpeed) |
return whether the given headwayTime is unsafe |
Private Attributes | |
bool | myAmCont |
LinkApproachingVehicles | myApproachingVehicles |
std::set< MSLink * > | myBlockedFoeLinks |
LinkDirection | myDirection |
An abstract (hopefully human readable) definition of the link's direction. | |
std::vector< MSLane * > | myFoeLanes |
std::vector< MSLink * > | myFoeLinks |
bool | myIsCrossing |
Whether any foe links exist. | |
MSLane * | myLane |
The lane approached by this link. | |
SUMOReal | myLength |
The length of the link. | |
unsigned int | myRequestIdx |
The position of the link within this request. | |
unsigned int | myRespondIdx |
The position within this respond. | |
LinkState | myState |
The state of the link. |
Static Private Attributes | |
static SUMOTime | myLookaheadTime = TIME2STEPS(1) |
|
private |
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 55 of file MSLink.cpp.
MSLink::~MSLink | ( | ) |
Destructor.
Definition at line 73 of file MSLink.cpp.
|
private |
invalidated copy constructor
void MSLink::addBlockedLink | ( | MSLink * | link | ) |
Definition at line 99 of file MSLink.cpp.
References myBlockedFoeLinks.
bool MSLink::blockedAtTime | ( | SUMOTime | arrivalTime, |
SUMOTime | leaveTime, | ||
SUMOReal | arrivalSpeed, | ||
SUMOReal | leaveSpeed, | ||
bool | sameTargetLane | ||
) | 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 |
Definition at line 168 of file MSLink.cpp.
References myApproachingVehicles, and unsafeHeadwayTime().
|
inline |
Definition at line 150 of file MSLink.h.
References myApproachingVehicles.
MSLink::ApproachingVehicleInformation MSLink::getApproaching | ( | const SUMOVehicle * | veh | ) | const |
Definition at line 126 of file MSLink.cpp.
References myApproachingVehicles.
LinkDirection MSLink::getDirection | ( | ) | const |
Returns the direction the vehicle passing this link take.
Definition at line 249 of file MSLink.cpp.
References myDirection.
MSLane * MSLink::getLane | ( | ) | const |
Returns the connected lane.
Definition at line 261 of file MSLink.cpp.
References myLane.
Referenced by MSVehicle::checkRewindLinkLanes(), Command_SaveTLSSwitches::execute(), MSLinkContHelper::getConnectingLink(), TraCIServerAPI_TLS::processGet(), and TraCIServerAPI_Lane::processGet().
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 137 of file MSLink.cpp.
References getLength(), and TIME2STEPS.
Referenced by opened(), and setApproaching().
|
inline |
Returns the length of this link.
Definition at line 247 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 321 of file MSLink.cpp.
References myRespondIdx.
|
inline |
Returns the current state of the link.
Definition at line 202 of file MSLink.h.
References myState.
Referenced by GUILaneWrapper::drawLinkRules(), Command_SaveTLCoupledLaneDet::execute(), and MSVehicle::executeMove().
MSLane * MSLink::getViaLaneOrLane | ( | ) | const |
return the via lane if it exists and the lane otherwise
Definition at line 307 of file MSLink.cpp.
References myLane.
Referenced by GUIVehicle::drawGLAdditional(), MSVehicle::estimateLeaveSpeed(), and MSVehicle::executeMove().
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 |
Definition at line 233 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 238 of file MSLink.h.
References myState.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::executeMove(), and TraCIServerAPI_Lane::processGet().
|
inline |
Definition at line 179 of file MSLink.h.
References myApproachingVehicles.
|
inline |
Definition at line 260 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 255 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 212 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 | ||
) | const |
Returns the information whether the link may be passed.
Valid after the junctions have set their reponds
Definition at line 143 of file MSLink.cpp.
References getLeaveTime(), MSGlobals::gUseMesoSim, MSGlobals::gUsingInternalLanes, LINKSTATE_TL_RED, myAmCont, myFoeLinks, myLane, and myState.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::executeMove(), and TraCIServerAPI_Lane::processGet().
void MSLink::removeApproaching | ( | SUMOVehicle * | veh | ) |
removes the vehicle from myApproachingVehicles
Definition at line 117 of file MSLink.cpp.
References myApproachingVehicles.
Referenced by MSVehicle::executeMove(), and setApproaching().
void MSLink::setApproaching | ( | SUMOVehicle * | approaching, |
SUMOTime | arrivalTime, | ||
SUMOReal | arrivalSpeed, | ||
SUMOReal | leaveSpeed, | ||
bool | setRequest | ||
) |
Sets the information about an approaching vehicle.
The information is stored in myApproachingVehicles.
Definition at line 90 of file MSLink.cpp.
References getLeaveTime(), MSVehicleType::getLengthWithGap(), SUMOVehicle::getVehicleType(), myApproachingVehicles, and removeApproaching().
void MSLink::setRequestInformation | ( | unsigned int | requestIdx, |
unsigned int | respondIdx, | ||
bool | isCrossing, | ||
bool | isCont, | ||
const std::vector< MSLink * > & | foeLinks, | ||
const std::vector< MSLane * > & | foeLanes | ||
) |
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 77 of file MSLink.cpp.
References isCont(), isCrossing(), myAmCont, myFoeLanes, myFoeLinks, myIsCrossing, myRequestIdx, and myRespondIdx.
Referenced by MSRightOfWayJunction::postloadInit().
Sets the current tl-state.
[in] | state | The current state of the link |
Definition at line 255 of file MSLink.cpp.
References myState.
Referenced by MSTrafficLightLogic::addLink().
|
staticprivate |
return whether the given headwayTime is unsafe
Definition at line 194 of file MSLink.cpp.
References DEFAULT_VEH_DECEL, myLookaheadTime, and STEPS2TIME.
Referenced by blockedAtTime().
bool MSLink::willHaveBlockedFoe | ( | ) | const |
Definition at line 106 of file MSLink.cpp.
References myBlockedFoeLinks.
|
private |
Definition at line 339 of file MSLink.h.
Referenced by isCont(), opened(), and setRequestInformation().
|
private |
Definition at line 318 of file MSLink.h.
Referenced by blockedAtTime(), getApproaching(), isBlockingAnyone(), removeApproaching(), and setApproaching().
|
private |
Definition at line 319 of file MSLink.h.
Referenced by addBlockedLink(), and willHaveBlockedFoe().
|
private |
An abstract (hopefully human readable) definition of the link's direction.
Definition at line 331 of file MSLink.h.
Referenced by getDirection().
|
private |
Definition at line 348 of file MSLink.h.
Referenced by hasApproachingFoe(), and setRequestInformation().
|
private |
Definition at line 347 of file MSLink.h.
Referenced by hasApproachingFoe(), opened(), and setRequestInformation().
|
private |
Whether any foe links exist.
Definition at line 337 of file MSLink.h.
Referenced by isCrossing(), and setRequestInformation().
|
private |
The lane approached by this link.
Definition at line 316 of file MSLink.h.
Referenced by getLane(), getViaLaneOrLane(), hasApproachingFoe(), and opened().
|
private |
|
staticprivate |
Definition at line 349 of file MSLink.h.
Referenced by unsafeHeadwayTime().
|
private |
The position of the link within this request.
Definition at line 322 of file MSLink.h.
Referenced by setRequestInformation().
|
private |
The position within this respond.
Definition at line 325 of file MSLink.h.
Referenced by getRespondIndex(), and setRequestInformation().
|
private |
The state of the link.
Definition at line 328 of file MSLink.h.
Referenced by getState(), havePriority(), opened(), and setTLState().