Eclipse SUMO - Simulation of Urban MObility
MSRailSignalControl Class Reference

A signal for rails. More...

#include <MSRailSignalControl.h>

Inheritance diagram for MSRailSignalControl:
[legend]
Collaboration diagram for MSRailSignalControl:
[legend]

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 MSRailSignalControlgetInstance ()
 
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 MSRailSignalControlmyInstance
 

Detailed Description

A signal for rails.

Definition at line 38 of file MSRailSignalControl.h.

Constructor & Destructor Documentation

◆ ~MSRailSignalControl()

MSRailSignalControl::~MSRailSignalControl ( )

Definition at line 73 of file MSRailSignalControl.cpp.

◆ MSRailSignalControl()

MSRailSignalControl::MSRailSignalControl ( )
private

Constructor.

Definition at line 45 of file MSRailSignalControl.cpp.

Referenced by getInstance().

Here is the caller graph for this function:

Member Function Documentation

◆ addGreenFlankSwitch()

void MSRailSignalControl::addGreenFlankSwitch ( MSLink link,
int  dwID 
)
inline

Definition at line 73 of file MSRailSignalControl.h.

References mySwitchedGreenFlanks.

Referenced by MSRailSignal::updateCurrentPhase().

Here is the caller graph for this function:

◆ addSignal()

void MSRailSignalControl::addSignal ( MSRailSignal signal)

Definition at line 113 of file MSRailSignalControl.cpp.

References mySignals.

Referenced by MSRailSignal::MSRailSignal().

Here is the caller graph for this function:

◆ cleanup()

void MSRailSignalControl::cleanup ( )
static

Definition at line 58 of file MSRailSignalControl.cpp.

References myInstance.

Referenced by MSNet::clearAll().

Here is the caller graph for this function:

◆ clearState()

void MSRailSignalControl::clearState ( )
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().

Here is the caller graph for this function:

◆ getInstance()

◆ getSignals()

const std::vector<MSRailSignal*>& MSRailSignalControl::getSignals ( ) const
inline

Definition at line 69 of file MSRailSignalControl.h.

References mySignals.

Referenced by LIBSUMO_NAMESPACE::TrafficLight::updateConstraints().

Here is the caller graph for this function:

◆ getUsedEdges()

const std::set<const MSEdge*>& MSRailSignalControl::getUsedEdges ( ) const
inline

Definition at line 63 of file MSRailSignalControl.h.

References myUsedEdges.

Referenced by MSRailSignal::DriveWay::buildRoute().

Here is the caller graph for this function:

◆ hasInstance()

static bool MSRailSignalControl::hasInstance ( )
inlinestatic

Definition at line 44 of file MSRailSignalControl.h.

References myInstance.

Referenced by MSStateHandler::closeVehicle(), and MSNet::simulationStep().

Here is the caller graph for this function:

◆ recheckGreen()

void MSRailSignalControl::recheckGreen ( )

final check for driveway compatibility of signals that switched green in this step

Definition at line 119 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().

Here is the caller graph for this function:

◆ registerProtectedDriveway()

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 96 of file MSRailSignalControl.cpp.

References Named::getID(), and myProtectedDriveways.

Referenced by MSRailSignal::LinkInfo::buildDriveWay().

Here is the caller graph for this function:

◆ updateDriveways()

void MSRailSignalControl::updateDriveways ( const MSEdge used)
private

compute additioanl deadlock-check requirements for registered driveways

Definition at line 104 of file MSRailSignalControl.cpp.

References myProtectedDriveways.

Referenced by vehicleStateChanged().

Here is the caller graph for this function:

◆ vehicleStateChanged()

void MSRailSignalControl::vehicleStateChanged ( const SUMOVehicle *const  vehicle,
MSNet::VehicleState  to,
const std::string &  info = "" 
)
virtual

Called if a vehicle changes its state.

Parameters
[in]vehicleThe vehicle which changed its state
[in]toThe state the vehicle has changed to
[in]infoAdditional information on the state change

Implements MSNet::VehicleStateListener.

Definition at line 77 of file MSRailSignalControl.cpp.

References MSNet::BUILT, MSNet::DEPARTED, MSRoute::getEdges(), SUMOVehicle::getRoute(), SUMOTrafficObject::getVClass(), SUMOVehicle::hasDeparted(), MSRailSignal::initDriveWays(), isRailway(), myProtectedDriveways, myUsedEdges, MSNet::NEWROUTE, and updateDriveways().

Referenced by MSStateHandler::closeVehicle().

Here is the caller graph for this function:

Field Documentation

◆ myDriveWayCompatibility

std::map<std::pair<int, int>, bool> MSRailSignalControl::myDriveWayCompatibility
private

Definition at line 98 of file MSRailSignalControl.h.

Referenced by clearState(), and recheckGreen().

◆ myInstance

MSRailSignalControl * MSRailSignalControl::myInstance
staticprivate

Definition at line 100 of file MSRailSignalControl.h.

Referenced by cleanup(), clearState(), getInstance(), and hasInstance().

◆ myProtectedDriveways

std::map<const MSEdge*, std::vector<std::pair<MSRailSignal*, int> > > MSRailSignalControl::myProtectedDriveways
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().

◆ mySignals

std::vector<MSRailSignal*> MSRailSignalControl::mySignals
private

list of all rail signals

Definition at line 94 of file MSRailSignalControl.h.

Referenced by addSignal(), and getSignals().

◆ mySwitchedGreenFlanks

std::vector<std::pair<MSLink*, int> > MSRailSignalControl::mySwitchedGreenFlanks
private

list of signals that switched green along with driveway index

Definition at line 97 of file MSRailSignalControl.h.

Referenced by addGreenFlankSwitch(), and recheckGreen().

◆ myUsedEdges

std::set<const MSEdge*> MSRailSignalControl::myUsedEdges
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().


The documentation for this class was generated from the following files: