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 () |
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 |
A signal for rails.
Definition at line 39 of file MSRailSignalControl.h.
MSRailSignalControl::~MSRailSignalControl | ( | ) |
Definition at line 77 of file MSRailSignalControl.cpp.
|
private |
Constructor.
Definition at line 46 of file MSRailSignalControl.cpp.
Referenced by getInstance().
void MSRailSignalControl::addDeadlockCheck | ( | std::vector< const MSRailSignal * > | signals | ) |
Definition at line 195 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 210 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 218 of file MSRailSignalControl.cpp.
References findDeadlockFoes(), getDeadlockChecks(), and getInstance().
Referenced by MSRailSignal::initDriveWays().
void MSRailSignalControl::addSignal | ( | MSRailSignal * | signal | ) |
Definition at line 96 of file MSRailSignalControl.cpp.
References mySignals.
Referenced by MSRailSignal::MSRailSignal().
void MSRailSignalControl::addWaitRelation | ( | const SUMOVehicle * | waits, |
const MSRailSignal * | rs, | ||
const SUMOVehicle * | reason, | ||
MSRailSignalConstraint * | constraint = nullptr |
||
) |
Definition at line 102 of file MSRailSignalControl.cpp.
References myWaitRelations.
Referenced by MSRailSignal::constraintsAllow(), MSDriveWay::foeDriveWayOccupied(), and MSRailSignal::hasInsertionConstraint().
|
static |
Definition at line 59 of file MSRailSignalControl.cpp.
References myInstance.
Referenced by MSNet::clearAll().
|
static |
Perform resets events when quick-loading state.
Definition at line 65 of file MSRailSignalControl.cpp.
References myDeadlockChecks, myDriveWayCompatibility, myDriveWayPred, myDriveWaySucc, myInstance, and myWrittenDeadlocks.
Referenced by MSNet::clearState().
|
protected |
Definition at line 231 of file MSRailSignalControl.cpp.
References findDeadlockFoes(), Named::getID(), myDriveWayPred, myDriveWaySucc, and toString().
Referenced by addDWDeadlockChecks(), and findDeadlockFoes().
|
inline |
Definition at line 85 of file MSRailSignalControl.h.
References myDeadlockChecks.
Referenced by addDWDeadlockChecks().
|
static |
Definition at line 50 of file MSRailSignalControl.cpp.
References MSNet::addVehicleStateListener(), MSNet::getInstance(), MSRailSignalControl(), and myInstance.
Referenced by NLHandler::addDeadlock(), addDWDeadlockChecks(), MSRailSignalConstraint::clearAll(), MSStateHandler::closeVehicle(), MSRailSignal::constraintsAllow(), MSLane::executeMovements(), LIBSUMO_NAMESPACE::TrafficLight::findConstraintsDeadLocks(), MSDriveWay::foeDriveWayOccupied(), MSRailSignal::hasInsertionConstraint(), MSRailSignal::initDriveWays(), MSRailSignal::MSRailSignal(), MSStateHandler::myStartElement(), MSDriveWay::notifyEnter(), MSVehicle::registerInsertionApproach(), MSRailSignalConstraint::saveState(), MSVehicle::setApproachingForAllLinks(), MSNet::simulationStep(), and LIBSUMO_NAMESPACE::TrafficLight::updateConstraints().
|
inline |
Definition at line 81 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 45 of file MSRailSignalControl.h.
References myInstance.
Referenced by MSStateHandler::closeVehicle(), MSLane::executeMovements(), 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 109 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().
void MSRailSignalControl::notifyApproach | ( | const MSLink * | link | ) |
switch rail signal to active
Definition at line 273 of file MSRailSignalControl.cpp.
References MSLink::getTLLogic(), and myActiveSignals.
Referenced by MSRailSignal::initDriveWays(), MSDriveWay::notifyEnter(), MSVehicle::registerInsertionApproach(), and MSVehicle::setApproachingForAllLinks().
|
inline |
reset all waiting-for relationships at the start of the simulation step
Definition at line 55 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 281 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 81 of file MSRailSignalControl.cpp.
References MSNet::BUILT, CONNECTOR, SUMOTrafficObject::getEdge(), MSEdge::getFunction(), SUMOTrafficObject::getParameter(), SUMOTrafficObject::getVClass(), SUMOVehicle::hasDeparted(), SUMOVehicle::hasValidRoute(), MSRailSignal::initDriveWays(), isRailway(), MSNet::NEWROUTE, VEHPARS_FORCE_REROUTE, and SUMOVehicleParameter::wasSet().
Referenced by MSStateHandler::closeVehicle().
|
private |
Definition at line 133 of file MSRailSignalControl.h.
Referenced by notifyApproach(), and updateSignals().
|
private |
Definition at line 123 of file MSRailSignalControl.h.
Referenced by addDeadlockCheck(), clearState(), and getDeadlockChecks().
|
private |
Definition at line 132 of file MSRailSignalControl.h.
Referenced by clearState().
|
private |
Definition at line 125 of file MSRailSignalControl.h.
Referenced by addDrivewayFollower(), clearState(), and findDeadlockFoes().
|
private |
Definition at line 124 of file MSRailSignalControl.h.
Referenced by addDrivewayFollower(), clearState(), and findDeadlockFoes().
|
staticprivate |
Definition at line 135 of file MSRailSignalControl.h.
Referenced by cleanup(), clearState(), getInstance(), and hasInstance().
|
private |
list of all rail signals
Definition at line 128 of file MSRailSignalControl.h.
Referenced by addSignal(), and getSignals().
|
private |
list of signals that switched green along with driveway index
Definition at line 131 of file MSRailSignalControl.h.
|
private |
all rail edges that are part of a known route
Definition at line 109 of file MSRailSignalControl.h.
|
private |
Definition at line 119 of file MSRailSignalControl.h.
Referenced by addWaitRelation(), haveDeadlock(), and resetWaitRelations().
|
mutableprivate |
Definition at line 121 of file MSRailSignalControl.h.
Referenced by clearState(), haveDeadlock(), and resetWaitRelations().