Eclipse SUMO - Simulation of Urban MObility
|
A signal for rails. More...
#include <MSRailSignalControl.h>
Public Member Functions | |
void | addGreenFlankSwitch (MSLink *link, int dwID) |
void | addSignal (MSRailSignal *signal) |
const std::vector< MSRailSignal * > & | getSignals () const |
const std::set< const MSEdge * > & | getUsedEdges () const |
void | recheckGreen () |
final check for driveway compatibility of signals that switched green in this step More... | |
void | registerProtectedDriveway (MSRailSignal *rs, int driveWayID, const MSEdge *protectedBidi) |
mark driveway that must receive additional checks if protectedBidi is ever used by a train route More... | |
void | vehicleStateChanged (const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="") |
Called if a vehicle changes its state. More... | |
~MSRailSignalControl () | |
Static Public Member Functions | |
static void | cleanup () |
static void | clearState () |
Perform resets events when quick-loading state. More... | |
static MSRailSignalControl & | getInstance () |
static bool | hasInstance () |
Private Member Functions | |
MSRailSignalControl () | |
Constructor. More... | |
void | updateDriveways (const MSEdge *used) |
compute additioanl deadlock-check requirements for registered driveways More... | |
Private Attributes | |
std::map< std::pair< int, int >, bool > | myDriveWayCompatibility |
std::map< const MSEdge *, std::vector< std::pair< MSRailSignal *, int > > > | myProtectedDriveways |
map of driveways that must perform additional checks if the key edge is used by a train route More... | |
std::vector< MSRailSignal * > | mySignals |
list of all rail signals More... | |
std::vector< std::pair< MSLink *, int > > | mySwitchedGreenFlanks |
list of signals that switched green along with driveway index More... | |
std::set< const MSEdge * > | myUsedEdges |
all rail edges that are part of a known route More... | |
Static Private Attributes | |
static MSRailSignalControl * | myInstance |
A signal for rails.
Definition at line 38 of file MSRailSignalControl.h.
MSRailSignalControl::~MSRailSignalControl | ( | ) |
Definition at line 73 of file MSRailSignalControl.cpp.
|
private |
Constructor.
Definition at line 45 of file MSRailSignalControl.cpp.
Referenced by getInstance().
|
inline |
Definition at line 73 of file MSRailSignalControl.h.
References mySwitchedGreenFlanks.
Referenced by MSRailSignal::updateCurrentPhase().
void MSRailSignalControl::addSignal | ( | MSRailSignal * | signal | ) |
Definition at line 116 of file MSRailSignalControl.cpp.
References mySignals.
Referenced by MSRailSignal::MSRailSignal().
|
static |
Definition at line 58 of file MSRailSignalControl.cpp.
References myInstance.
Referenced by MSNet::clearAll().
|
static |
Perform resets events when quick-loading state.
Definition at line 64 of file MSRailSignalControl.cpp.
References myDriveWayCompatibility, myInstance, myProtectedDriveways, and myUsedEdges.
Referenced by MSNet::clearState().
|
static |
Definition at line 49 of file MSRailSignalControl.cpp.
References MSNet::addVehicleStateListener(), MSNet::getInstance(), MSRailSignalControl(), and myInstance.
Referenced by MSRailSignal::LinkInfo::buildDriveWay(), MSRailSignal::DriveWay::buildRoute(), MSRailSignalConstraint::clearAll(), MSStateHandler::closeVehicle(), LIBSUMO_NAMESPACE::TrafficLight::findConstraintsDeadLocks(), MSRailSignal::MSRailSignal(), MSRailSignalConstraint::saveState(), MSNet::simulationStep(), LIBSUMO_NAMESPACE::TrafficLight::updateConstraints(), and MSRailSignal::updateCurrentPhase().
|
inline |
Definition at line 69 of file MSRailSignalControl.h.
References mySignals.
Referenced by LIBSUMO_NAMESPACE::TrafficLight::updateConstraints().
|
inline |
Definition at line 63 of file MSRailSignalControl.h.
References myUsedEdges.
Referenced by MSRailSignal::DriveWay::buildRoute().
|
inlinestatic |
Definition at line 44 of file MSRailSignalControl.h.
References myInstance.
Referenced by MSStateHandler::closeVehicle(), and MSNet::simulationStep().
void MSRailSignalControl::recheckGreen | ( | ) |
final check for driveway compatibility of signals that switched green in this step
Definition at line 122 of file MSRailSignalControl.cpp.
References DEBUG_HELPER, MSRailSignal::DriveWay::flankConflict(), MSRailSignal::getClosest(), MSRailSignal::getCurrentPhaseDef(), MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSPhaseDefinition::getState(), MSRailSignal::DriveWay::mustYield(), myDriveWayCompatibility, MSRailSignal::DriveWay::myRoute, mySwitchedGreenFlanks, MSRailSignal::retrieveDriveWay(), MSTrafficLightLogic::setTrafficLightSignals(), SIMTIME, and toString().
Referenced by MSNet::simulationStep().
void MSRailSignalControl::registerProtectedDriveway | ( | MSRailSignal * | rs, |
int | driveWayID, | ||
const MSEdge * | protectedBidi | ||
) |
mark driveway that must receive additional checks if protectedBidi is ever used by a train route
Definition at line 99 of file MSRailSignalControl.cpp.
References Named::getID(), and myProtectedDriveways.
Referenced by MSRailSignal::LinkInfo::buildDriveWay().
|
private |
compute additioanl deadlock-check requirements for registered driveways
Definition at line 107 of file MSRailSignalControl.cpp.
References myProtectedDriveways.
Referenced by vehicleStateChanged().
|
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 77 of file MSRailSignalControl.cpp.
References MSNet::BUILT, MSNet::DEPARTED, MSRoute::getEdges(), Named::getID(), SUMOVehicle::getRoute(), SUMOTrafficObject::getVClass(), SUMOVehicle::hasDeparted(), MSRailSignal::initDriveWays(), isRailway(), myProtectedDriveways, myUsedEdges, MSNet::NEWROUTE, and updateDriveways().
Referenced by MSStateHandler::closeVehicle().
|
private |
Definition at line 98 of file MSRailSignalControl.h.
Referenced by clearState(), and recheckGreen().
|
staticprivate |
Definition at line 100 of file MSRailSignalControl.h.
Referenced by cleanup(), clearState(), getInstance(), and hasInstance().
|
private |
map of driveways that must perform additional checks if the key edge is used by a train route
Definition at line 91 of file MSRailSignalControl.h.
Referenced by clearState(), registerProtectedDriveway(), updateDriveways(), and vehicleStateChanged().
|
private |
list of all rail signals
Definition at line 94 of file MSRailSignalControl.h.
Referenced by addSignal(), and getSignals().
|
private |
list of signals that switched green along with driveway index
Definition at line 97 of file MSRailSignalControl.h.
Referenced by addGreenFlankSwitch(), and recheckGreen().
|
private |
all rail edges that are part of a known route
Definition at line 88 of file MSRailSignalControl.h.
Referenced by clearState(), getUsedEdges(), and vehicleStateChanged().