Eclipse SUMO - Simulation of Urban MObility
|
#include <MSRailSignal.h>
Public Member Functions | |
void | buildRoute (MSLink *origin, double length, MSRouteIterator next, MSRouteIterator end, LaneVisitedMap &visited) |
void | checkCrossingFlanks (MSLink *dwLink, const LaneVisitedMap &visited, std::vector< MSLink * > &flankSwitches) const |
void | checkFlanks (const MSLink *originLink, const std::vector< const MSLane * > &lanes, const LaneVisitedMap &visited, bool allFoes, std::vector< MSLink * > &flankSwitches) const |
bool | conflictLaneOccupied (const std::string &joinVehicle="", bool store=true, const SUMOVehicle *ego=nullptr) const |
whether any of myConflictLanes is occupied (vehicles that are the target of a join must be ignored) More... | |
bool | conflictLinkApproached () const |
Whether any of the conflict links have approaching vehicles. More... | |
bool | deadlockLaneOccupied (bool store=true) const |
whether any of myBidiExtended is occupied by a vehicle that targets myBidi More... | |
DriveWay (bool temporary=false) | |
Constructor. More... | |
void | findFlankProtection (MSLink *link, double length, LaneVisitedMap &visited, MSLink *origLink, std::vector< const MSLane * > &flank) |
bool | findProtection (const Approaching &veh, MSLink *link) const |
find protection for the given vehicle starting at a switch More... | |
bool | flankConflict (const DriveWay &other) const |
Wether there is a flank conflict with the given driveway. More... | |
bool | hasLinkConflict (const Approaching &closest, MSLink *foeLink) const |
Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link. More... | |
bool | overlap (const DriveWay &other) const |
Wether this driveway (route) overlaps with the given one. More... | |
bool | reserve (const Approaching &closest, MSEdgeVector &occupied) |
attempt reserve this driveway for the given vehicle More... | |
void | writeBlocks (OutputDevice &od) const |
Write block items for this driveway. More... | |
Static Public Member Functions | |
static bool | mustYield (const Approaching &veh, const Approaching &foe) |
Whether veh must yield to the foe train. More... | |
Data Fields | |
const SUMOVehicle * | myActive |
whether the current signal is switched green for a train approaching this block More... | |
std::vector< const MSLane * > | myBidi |
std::vector< const MSLane * > | myBidiExtended |
std::vector< const MSLane * > | myConflictLanes |
the lanes that must be clear of trains before this signal can switch to green More... | |
std::vector< MSLink * > | myConflictLinks |
int | myCoreSize |
number of edges in myRoute where overlap with other driveways is forbidden More... | |
std::vector< const MSLane * > | myFlank |
std::vector< MSLink * > | myFlankSwitches |
std::vector< const MSLane * > | myForward |
bool | myFoundReversal |
bool | myFoundSignal |
whether this driveway ends its forward section with a rail signal (and thus comprises a full block) More... | |
double | myMaxFlankLength |
the maximum flank length searched while building this driveway More... | |
int | myNumericalID |
global driveway index More... | |
const MSEdge * | myProtectedBidi |
switch assumed safe from bidi-traffic More... | |
std::vector< MSLink * > | myProtectingSwitches |
std::vector< MSLink * > | myProtectingSwitchesBidi |
subset of myProtectingSwitches that protects from oncoming trains More... | |
std::vector< const MSEdge * > | myRoute |
list of edges for matching against train routes More... | |
Definition at line 265 of file MSRailSignal.h.
|
inline |
Constructor.
Definition at line 268 of file MSRailSignal.h.
void MSRailSignal::DriveWay::buildRoute | ( | MSLink * | origin, |
double | length, | ||
MSRouteIterator | next, | ||
MSRouteIterator | end, | ||
LaneVisitedMap & | visited | ||
) |
Definition at line 1187 of file MSRailSignal.cpp.
References MSRailSignal::appendMapIndex(), DEBUG_HELPER, MSRailSignal::formatVisitedMap(), gDebugFlag4, MSEdge::getBidiEdge(), MSLane::getBidiLane(), MSRailSignal::getClickableTLLinkID(), MSLane::getEdge(), Named::getID(), MSLane::getIncomingLanes(), MSRailSignalControl::getInstance(), MSLane::getLength(), MSLane::getLinkCont(), MSLane::getNextNormal(), MSRailSignal::getTLLinkID(), MSLink::getTLLogic(), MSRailSignalControl::getUsedEdges(), MSLink::getViaLaneOrLane(), MSEdge::isNormal(), isRailway(), MAX_BLOCK_LENGTH, MAX_SIGNAL_WARNINGS, MSRailSignal::myNumWarnings, TL, toString(), TURN, WRITE_WARNING, and WRITE_WARNINGF.
Referenced by MSRailSignal::LinkInfo::buildDriveWay().
void MSRailSignal::DriveWay::checkCrossingFlanks | ( | MSLink * | dwLink, |
const LaneVisitedMap & | visited, | ||
std::vector< MSLink * > & | flankSwitches | ||
) | const |
Definition at line 1408 of file MSRailSignal.cpp.
References MSRailSignal::formatVisitedMap(), MSLink::getDescription(), MSJunctionLogic::getFoesFor(), Named::getID(), MSJunction::getIncoming(), MSLink::getIndex(), MSLink::getJunction(), MSJunction::getLogic(), and isRailway().
void MSRailSignal::DriveWay::checkFlanks | ( | const MSLink * | originLink, |
const std::vector< const MSLane * > & | lanes, | ||
const LaneVisitedMap & | visited, | ||
bool | allFoes, | ||
std::vector< MSLink * > & | flankSwitches | ||
) | const |
Definition at line 1367 of file MSRailSignal.cpp.
References MSRailSignal::formatVisitedMap(), MSLane::getBidiLane(), MSLink::getCorrespondingExitLink(), MSLink::getDirection(), Named::getID(), Named::getIDSecure(), MSLane::getIncomingLanes(), MSLink::getLane(), MSLink::getLaneBefore(), MSLane::getLinkTo(), MSLane::isInternal(), toString(), TURN, and TURN_LEFTHAND.
Referenced by MSRailSignal::LinkInfo::buildDriveWay().
bool MSRailSignal::DriveWay::conflictLaneOccupied | ( | const std::string & | joinVehicle = "" , |
bool | store = true , |
||
const SUMOVehicle * | ego = nullptr |
||
) | const |
whether any of myConflictLanes is occupied (vehicles that are the target of a join must be ignored)
Definition at line 954 of file MSRailSignal.cpp.
References gDebugFlag4, Named::getID(), Named::getIDSecure(), MSBaseVehicle::getNextStopParameter(), MSBaseVehicle::isStopped(), SUMOVehicleParameter::Stop::join, MSRailSignal::myBlockingVehicles, MSRailSignal::myStoreVehicles, SIMTIME, and toString().
Referenced by hasLinkConflict(), and MSRailSignal::updateCurrentPhase().
bool MSRailSignal::DriveWay::conflictLinkApproached | ( | ) | const |
Whether any of the conflict links have approaching vehicles.
Definition at line 849 of file MSRailSignal.cpp.
References gDebugFlag4, and SIMTIME.
Referenced by MSRailSignal::updateCurrentPhase().
bool MSRailSignal::DriveWay::deadlockLaneOccupied | ( | bool | store = true | ) | const |
whether any of myBidiExtended is occupied by a vehicle that targets myBidi
Definition at line 1007 of file MSRailSignal.cpp.
References MSRoute::end(), gDebugFlag4, MSBaseVehicle::getCurrentRouteEdge(), Named::getID(), MSBaseVehicle::getRoute(), MSRailSignal::myBlockingVehicles, and MSRailSignal::myStoreVehicles.
Referenced by hasLinkConflict().
void MSRailSignal::DriveWay::findFlankProtection | ( | MSLink * | link, |
double | length, | ||
LaneVisitedMap & | visited, | ||
MSLink * | origLink, | ||
std::vector< const MSLane * > & | flank | ||
) |
Definition at line 1445 of file MSRailSignal.cpp.
References MSRailSignal::appendMapIndex(), MSLink::getDescription(), Named::getID(), MSLane::getIncomingLanes(), MSLink::getIndex(), MSLink::getJunction(), MSLink::getLane(), MSLink::getLaneBefore(), MSLane::getLength(), MSLane::getLinkCont(), MSLink::getTLLogic(), MSLane::isInternal(), MAX2(), MAX_BLOCK_LENGTH, MAX_SIGNAL_WARNINGS, MSRailSignal::myNumWarnings, toString(), TURN, and WRITE_WARNING.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), and findProtection().
bool MSRailSignal::DriveWay::findProtection | ( | const Approaching & | veh, |
MSLink * | link | ||
) | const |
find protection for the given vehicle starting at a switch
Definition at line 1050 of file MSRailSignal.cpp.
References MSRailSignal::describeLinks(), findFlankProtection(), gDebugFlag4, MSLink::getApproaching(), MSRailSignal::getClosest(), MSLink::getDescription(), Named::getIDSecure(), MSLane::getIncomingLanes(), MSLink::getLane(), MSLink::getLaneBefore(), MSLane::getLinkCont(), myConflictLanes, myConflictLinks, myCoreSize, myFlank, myProtectingSwitches, myRoute, reserve(), SIMTIME, and toString().
Referenced by MSRailSignal::hasOncomingRailTraffic().
bool MSRailSignal::DriveWay::flankConflict | ( | const DriveWay & | other | ) | const |
Wether there is a flank conflict with the given driveway.
Definition at line 1129 of file MSRailSignal.cpp.
References myBidi, and myForward.
Referenced by MSRailSignalControl::recheckGreen().
bool MSRailSignal::DriveWay::hasLinkConflict | ( | const Approaching & | closest, |
MSLink * | foeLink | ||
) | const |
Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link.
Definition at line 865 of file MSRailSignal.cpp.
References conflictLaneOccupied(), MSRailSignal::constraintsAllow(), deadlockLaneOccupied(), gDebugFlag4, MSLink::getApproaching(), MSRailSignal::getClosest(), MSLink::getTLIndex(), MSRailSignal::getTLLinkID(), MSLink::getTLLogic(), MSRailSignal::myLinkInfos, MSRailSignal::myPriorityVehicles, MSRailSignal::myRivalVehicles, and MSRailSignal::myStoreVehicles.
|
static |
Whether veh must yield to the foe train.
Definition at line 928 of file MSRailSignal.cpp.
Referenced by MSRailSignalControl::recheckGreen().
bool MSRailSignal::DriveWay::overlap | ( | const DriveWay & | other | ) | const |
Wether this driveway (route) overlaps with the given one.
Definition at line 1113 of file MSRailSignal.cpp.
References MSEdge::getFromJunction(), MSEdge::getToJunction(), myCoreSize, and myRoute.
bool MSRailSignal::DriveWay::reserve | ( | const Approaching & | closest, |
MSEdgeVector & | occupied | ||
) |
attempt reserve this driveway for the given vehicle
Definition at line 799 of file MSRailSignal.cpp.
References gDebugFlag4, Named::getIDSecure(), MSRailSignal::getTLLinkID(), MSGlobals::gUseMesoSim, SUMOVehicleParameter::Stop::join, MSRailSignal::myBlockingVehicles, and toString().
Referenced by findProtection(), MSRailSignal::storeTraCIVehicles(), and MSRailSignal::updateCurrentPhase().
void MSRailSignal::DriveWay::writeBlocks | ( | OutputDevice & | od | ) | const |
Write block items for this driveway.
Definition at line 1146 of file MSRailSignal.cpp.
References OutputDevice::closeTag(), MSRailSignal::getJunctionLinkID(), MSRailSignal::getTLLinkID(), joinToString(), OutputDevice::lf(), OutputDevice::openTag(), SUMO_ATTR_EDGES, SUMO_ATTR_LANES, toString(), and OutputDevice::writeAttr().
Referenced by MSRailSignal::writeBlocks().
const SUMOVehicle* MSRailSignal::DriveWay::myActive |
whether the current signal is switched green for a train approaching this block
Definition at line 285 of file MSRailSignal.h.
std::vector<const MSLane*> MSRailSignal::DriveWay::myBidi |
Definition at line 307 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), flankConflict(), and MSRailSignal::hasOncomingRailTraffic().
std::vector<const MSLane*> MSRailSignal::DriveWay::myBidiExtended |
Definition at line 311 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay().
std::vector<const MSLane*> MSRailSignal::DriveWay::myConflictLanes |
the lanes that must be clear of trains before this signal can switch to green
Definition at line 318 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), and findProtection().
std::vector<MSLink*> MSRailSignal::DriveWay::myConflictLinks |
Definition at line 335 of file MSRailSignal.h.
Referenced by findProtection(), and MSRailSignal::hasOncomingRailTraffic().
int MSRailSignal::DriveWay::myCoreSize |
number of edges in myRoute where overlap with other driveways is forbidden
Definition at line 294 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), findProtection(), and overlap().
std::vector<const MSLane*> MSRailSignal::DriveWay::myFlank |
Definition at line 315 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), findProtection(), MSRailSignal::hasOncomingRailTraffic(), and MSRailSignal::updateCurrentPhase().
std::vector<MSLink*> MSRailSignal::DriveWay::myFlankSwitches |
Definition at line 322 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay().
std::vector<const MSLane*> MSRailSignal::DriveWay::myForward |
Definition at line 302 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), and flankConflict().
bool MSRailSignal::DriveWay::myFoundReversal |
Definition at line 298 of file MSRailSignal.h.
bool MSRailSignal::DriveWay::myFoundSignal |
whether this driveway ends its forward section with a rail signal (and thus comprises a full block)
Definition at line 297 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::getDriveWay().
double MSRailSignal::DriveWay::myMaxFlankLength |
the maximum flank length searched while building this driveway
Definition at line 282 of file MSRailSignal.h.
int MSRailSignal::DriveWay::myNumericalID |
global driveway index
Definition at line 279 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), MSRailSignal::retrieveDriveWay(), MSRailSignal::updateCurrentPhase(), and MSRailSignal::updateDriveway().
const MSEdge* MSRailSignal::DriveWay::myProtectedBidi |
switch assumed safe from bidi-traffic
Definition at line 288 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay().
std::vector<MSLink*> MSRailSignal::DriveWay::myProtectingSwitches |
Definition at line 328 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), and findProtection().
std::vector<MSLink*> MSRailSignal::DriveWay::myProtectingSwitchesBidi |
subset of myProtectingSwitches that protects from oncoming trains
Definition at line 330 of file MSRailSignal.h.
Referenced by MSRailSignal::hasOncomingRailTraffic().
std::vector<const MSEdge*> MSRailSignal::DriveWay::myRoute |
list of edges for matching against train routes
Definition at line 291 of file MSRailSignal.h.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), findProtection(), MSRailSignal::LinkInfo::getDriveWay(), overlap(), MSRailSignalControl::recheckGreen(), MSRailSignal::updateCurrentPhase(), and MSRailSignal::updateDriveway().