![]() |
Eclipse SUMO - Simulation of Urban MObility
|
A signal for rails. More...
#include <MSRailSignalControl.h>
Data Structures | |
| struct | WaitRelation |
Public Member Functions | |
| void | addDeadlockCheck (std::vector< const MSRailSignal * > signals) |
| void | addDrivewayFollower (const MSDriveWay *dw, const MSDriveWay *dw2) |
| void | addDWDeadlockChecks (const MSRailSignal *rs, MSDriveWay *dw) |
| check whether the given signal and driveway are part of a deadlock circle | |
| void | addSignal (MSRailSignal *signal) |
| void | addWaitRelation (const SUMOVehicle *waits, const MSRailSignal *rs, const SUMOVehicle *reason, MSRailSignalConstraint *constraint=nullptr) |
| const std::map< const MSRailSignal *, std::vector< const MSRailSignal * > > & | getDeadlockChecks () const |
| const std::vector< MSRailSignal * > & | getSignals () const |
| bool | haveDeadlock (const SUMOVehicle *veh) const |
| whether there is a circle in the waiting-for relationships that contains the given vehicle | |
| void | notifyApproach (const MSLink *link) |
| switch rail signal to active | |
| void | resetWaitRelations () |
| reset all waiting-for relationships at the start of the simulation step | |
| void | updateSignals (SUMOTime t) |
| update active rail signals | |
| void | vehicleStateChanged (const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="") |
| Called if a vehicle changes its state. | |
| ~MSRailSignalControl () | |
Static Public Member Functions | |
| static void | cleanup () |
| static void | clearState () |
| Perform resets events when quick-loading state. | |
| static MSRailSignalControl & | getInstance () |
| static bool | hasInstance () |
| static void | initSignalized (SVCPermissions svc) |
| static bool | isSignalized (SUMOVehicleClass svc) |
Protected Member Functions | |
| void | findDeadlockFoes (const MSDriveWay *dw, const std::vector< const MSRailSignal * > &others, std::vector< const MSDriveWay * > deadlockFoes) |
Private Member Functions | |
| MSRailSignalControl () | |
| Constructor. | |
| void | updateDriveways (const MSEdge *used) |
| compute additioanl deadlock-check requirements for registered driveways | |
Private Attributes | |
| std::set< MSRailSignal *, ComparatorNumericalIdLess > | myActiveSignals |
| std::map< const MSRailSignal *, std::vector< const MSRailSignal * > > | myDeadlockChecks |
| std::map< std::pair< int, int >, bool > | myDriveWayCompatibility |
| std::map< const MSDriveWay *, std::set< const MSDriveWay * > > | myDriveWayPred |
| std::map< const MSDriveWay *, std::set< const MSDriveWay * > > | myDriveWaySucc |
| std::vector< MSRailSignal * > | mySignals |
| list of all rail signals | |
| std::vector< std::pair< MSLink *, int > > | mySwitchedGreenFlanks |
| list of signals that switched green along with driveway index | |
| std::set< const MSEdge * > | myUsedEdges |
| all rail edges that are part of a known route | |
| std::map< const SUMOVehicle *, WaitRelation > | myWaitRelations |
| std::set< std::set< const SUMOVehicle * > > | myWrittenDeadlocks |
Static Private Attributes | |
| static MSRailSignalControl * | myInstance |
| static SVCPermissions | mySignalizedClasses |
| signalized classes | |
A signal for rails.
Definition at line 40 of file MSRailSignalControl.h.
| MSRailSignalControl::~MSRailSignalControl | ( | ) |
Definition at line 78 of file MSRailSignalControl.cpp.
|
private |
Constructor.
Definition at line 47 of file MSRailSignalControl.cpp.
Referenced by getInstance().
| void MSRailSignalControl::addDeadlockCheck | ( | std::vector< const MSRailSignal * > | signals | ) |
Definition at line 201 of file MSRailSignalControl.cpp.
References MSDriveWay::haveDriveWays(), myDeadlockChecks, and WRITE_WARNING.
Referenced by NLHandler::addDeadlock().
| void MSRailSignalControl::addDrivewayFollower | ( | const MSDriveWay * | dw, |
| const MSDriveWay * | dw2 | ||
| ) |
Definition at line 216 of file MSRailSignalControl.cpp.
References myDriveWayPred, and myDriveWaySucc.
Referenced by MSRailSignal::initDriveWays().
| void MSRailSignalControl::addDWDeadlockChecks | ( | const MSRailSignal * | rs, |
| MSDriveWay * | dw | ||
| ) |
check whether the given signal and driveway are part of a deadlock circle
Definition at line 224 of file MSRailSignalControl.cpp.
References findDeadlockFoes(), getDeadlockChecks(), and getInstance().
Referenced by MSRailSignal::initDriveWays().
| void MSRailSignalControl::addSignal | ( | MSRailSignal * | signal | ) |
Definition at line 97 of file MSRailSignalControl.cpp.
References MSTrafficLightLogic::getLinks(), mySignalizedClasses, and mySignals.
Referenced by MSRailSignal::init().
| void MSRailSignalControl::addWaitRelation | ( | const SUMOVehicle * | waits, |
| const MSRailSignal * | rs, | ||
| const SUMOVehicle * | reason, | ||
| MSRailSignalConstraint * | constraint = nullptr |
||
| ) |
Definition at line 108 of file MSRailSignalControl.cpp.
References myWaitRelations.
Referenced by MSRailSignal::constraintsAllow(), MSDriveWay::foeDriveWayOccupied(), and MSRailSignal::hasInsertionConstraint().
|
static |
Definition at line 60 of file MSRailSignalControl.cpp.
References myInstance.
Referenced by MSNet::clearAll().
|
static |
Perform resets events when quick-loading state.
Definition at line 66 of file MSRailSignalControl.cpp.
References myDeadlockChecks, myDriveWayCompatibility, myDriveWayPred, myDriveWaySucc, myInstance, and myWrittenDeadlocks.
Referenced by MSNet::clearState().
|
protected |
Definition at line 237 of file MSRailSignalControl.cpp.
References findDeadlockFoes(), Named::getID(), myDriveWayPred, myDriveWaySucc, and toString().
Referenced by addDWDeadlockChecks(), and findDeadlockFoes().
|
inline |
Definition at line 86 of file MSRailSignalControl.h.
References myDeadlockChecks.
Referenced by addDWDeadlockChecks().
|
static |
Definition at line 51 of file MSRailSignalControl.cpp.
References MSNet::addVehicleStateListener(), MSNet::getInstance(), MSRailSignalControl(), and myInstance.
Referenced by NLHandler::addDeadlock(), addDWDeadlockChecks(), MSRailSignalConstraint::clearAll(), MSStateHandler::closeVehicle(), MSRailSignal::constraintsAllow(), MSDriveWay::enterDriveWay(), MSLane::executeMovements(), LIBSUMO_NAMESPACE::TrafficLight::findConstraintsDeadLocks(), MSDriveWay::foeDriveWayOccupied(), MSRailSignal::hasInsertionConstraint(), MSRailSignal::init(), MSRailSignal::initDriveWays(), MSStateHandler::myStartElement(), MSVehicle::registerInsertionApproach(), MSRailSignalConstraint::saveState(), MSVehicle::setApproachingForAllLinks(), MSNet::simulationStep(), and LIBSUMO_NAMESPACE::TrafficLight::updateConstraints().
|
inline |
Definition at line 82 of file MSRailSignalControl.h.
References mySignals.
Referenced by MSRailSignalConstraint::clearAll(), LIBSUMO_NAMESPACE::TrafficLight::findConstraintsDeadLocks(), MSRailSignalConstraint::saveState(), and LIBSUMO_NAMESPACE::TrafficLight::updateConstraints().
|
inlinestatic |
Definition at line 46 of file MSRailSignalControl.h.
References myInstance.
Referenced by MSStateHandler::closeVehicle(), MSLane::executeMovements(), MSBaseVehicle::replaceRoute(), and MSNet::simulationStep().
| bool MSRailSignalControl::haveDeadlock | ( | const SUMOVehicle * | veh | ) | const |
whether there is a circle in the waiting-for relationships that contains the given vehicle
Definition at line 115 of file MSRailSignalControl.cpp.
References OutputDevice::closeTag(), OptionsCont::getBool(), OutputDevice::getDeviceByOption(), Named::getID(), OptionsCont::getOptions(), SUMOTrafficObject::getParameter(), Parameterised::getParameter(), OptionsCont::isSet(), myWaitRelations, myWrittenDeadlocks, OutputDevice::openTag(), MSRailSignalConstraint::setActive(), SIMSTEP, SUMO_ATTR_ID, SUMO_ATTR_SIGNALS, SUMO_ATTR_TIME, SUMO_TAG_DEADLOCK, time2string(), toString(), MSRailSignalConstraint::write(), WRITE_WARNINGF, and OutputDevice::writeAttr().
Referenced by MSLane::executeMovements().
|
inlinestatic |
Definition at line 101 of file MSRailSignalControl.h.
References mySignalizedClasses.
Referenced by MSFrame::setMSGlobals().
|
inlinestatic |
Definition at line 97 of file MSRailSignalControl.h.
References mySignalizedClasses.
Referenced by MSLane::isInsertionSuccess().
| void MSRailSignalControl::notifyApproach | ( | const MSLink * | link | ) |
switch rail signal to active
Definition at line 279 of file MSRailSignalControl.cpp.
References MSLink::getTLLogic(), and myActiveSignals.
Referenced by MSDriveWay::enterDriveWay(), MSRailSignal::initDriveWays(), MSVehicle::registerInsertionApproach(), and MSVehicle::setApproachingForAllLinks().
|
inline |
reset all waiting-for relationships at the start of the simulation step
Definition at line 56 of file MSRailSignalControl.h.
References myWaitRelations, and myWrittenDeadlocks.
Referenced by MSNet::simulationStep().
|
private |
compute additioanl deadlock-check requirements for registered driveways
| void MSRailSignalControl::updateSignals | ( | SUMOTime | t | ) |
update active rail signals
Definition at line 287 of file MSRailSignalControl.cpp.
References MSTrafficLightLogic::isActive(), myActiveSignals, MSTrafficLightLogic::setTrafficLightSignals(), UNUSED_PARAMETER, and MSRailSignal::updateCurrentPhase().
Referenced by MSNet::simulationStep().
|
virtual |
Called if a vehicle changes its state.
| [in] | vehicle | The vehicle which changed its state |
| [in] | to | The state the vehicle has changed to |
| [in] | info | Additional information on the state change |
Implements MSNet::VehicleStateListener.
Definition at line 82 of file MSRailSignalControl.cpp.
References MSNet::BUILT, CONNECTOR, SUMOTrafficObject::getEdge(), MSEdge::getFunction(), SUMOTrafficObject::getParameter(), MSEdge::getPermissions(), SUMOVehicle::hasValidRoute(), MSRailSignal::initDriveWays(), SUMOVehicle::isRail(), isRailwayOrShared(), MSNet::NEWROUTE, VEHPARS_FORCE_REROUTE, and SUMOVehicleParameter::wasSet().
Referenced by MSStateHandler::closeVehicle().
|
private |
Definition at line 142 of file MSRailSignalControl.h.
Referenced by notifyApproach(), and updateSignals().
|
private |
Definition at line 132 of file MSRailSignalControl.h.
Referenced by addDeadlockCheck(), clearState(), and getDeadlockChecks().
|
private |
Definition at line 141 of file MSRailSignalControl.h.
Referenced by clearState().
|
private |
Definition at line 134 of file MSRailSignalControl.h.
Referenced by addDrivewayFollower(), clearState(), and findDeadlockFoes().
|
private |
Definition at line 133 of file MSRailSignalControl.h.
Referenced by addDrivewayFollower(), clearState(), and findDeadlockFoes().
|
staticprivate |
Definition at line 147 of file MSRailSignalControl.h.
Referenced by cleanup(), clearState(), getInstance(), and hasInstance().
|
staticprivate |
signalized classes
Definition at line 145 of file MSRailSignalControl.h.
Referenced by addSignal(), initSignalized(), and isSignalized().
|
private |
list of all rail signals
Definition at line 137 of file MSRailSignalControl.h.
Referenced by addSignal(), and getSignals().
|
private |
list of signals that switched green along with driveway index
Definition at line 140 of file MSRailSignalControl.h.
|
private |
all rail edges that are part of a known route
Definition at line 118 of file MSRailSignalControl.h.
|
private |
Definition at line 128 of file MSRailSignalControl.h.
Referenced by addWaitRelation(), haveDeadlock(), and resetWaitRelations().
|
mutableprivate |
Definition at line 130 of file MSRailSignalControl.h.
Referenced by clearState(), haveDeadlock(), and resetWaitRelations().