Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSRailSignalControl Class Reference

A signal for rails. More...

#include <MSRailSignalControl.h>

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

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 MSRailSignalControlgetInstance ()
 
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 *, ComparatorNumericalIdLessmyActiveSignals
 
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 *, WaitRelationmyWaitRelations
 
std::set< std::set< const SUMOVehicle * > > myWrittenDeadlocks
 

Static Private Attributes

static MSRailSignalControlmyInstance
 

Detailed Description

A signal for rails.

Definition at line 39 of file MSRailSignalControl.h.

Constructor & Destructor Documentation

◆ ~MSRailSignalControl()

MSRailSignalControl::~MSRailSignalControl ( )

Definition at line 77 of file MSRailSignalControl.cpp.

◆ MSRailSignalControl()

MSRailSignalControl::MSRailSignalControl ( )
private

Constructor.

Definition at line 46 of file MSRailSignalControl.cpp.

Referenced by getInstance().

Here is the caller graph for this function:

Member Function Documentation

◆ addDeadlockCheck()

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().

Here is the caller graph for this function:

◆ addDrivewayFollower()

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().

Here is the caller graph for this function:

◆ addDWDeadlockChecks()

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().

Here is the caller graph for this function:

◆ addSignal()

void MSRailSignalControl::addSignal ( MSRailSignal signal)

Definition at line 96 of file MSRailSignalControl.cpp.

References mySignals.

Referenced by MSRailSignal::MSRailSignal().

Here is the caller graph for this function:

◆ addWaitRelation()

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().

Here is the caller graph for this function:

◆ cleanup()

void MSRailSignalControl::cleanup ( )
static

Definition at line 59 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 65 of file MSRailSignalControl.cpp.

References myDeadlockChecks, myDriveWayCompatibility, myDriveWayPred, myDriveWaySucc, myInstance, and myWrittenDeadlocks.

Referenced by MSNet::clearState().

Here is the caller graph for this function:

◆ findDeadlockFoes()

void MSRailSignalControl::findDeadlockFoes ( const MSDriveWay dw,
const std::vector< const MSRailSignal * > &  others,
std::vector< const MSDriveWay * >  deadlockFoes 
)
protected

Definition at line 231 of file MSRailSignalControl.cpp.

References findDeadlockFoes(), Named::getID(), myDriveWayPred, myDriveWaySucc, and toString().

Referenced by addDWDeadlockChecks(), and findDeadlockFoes().

Here is the caller graph for this function:

◆ getDeadlockChecks()

const std::map< const MSRailSignal *, std::vector< const MSRailSignal * > > & MSRailSignalControl::getDeadlockChecks ( ) const
inline

Definition at line 85 of file MSRailSignalControl.h.

References myDeadlockChecks.

Referenced by addDWDeadlockChecks().

Here is the caller graph for this function:

◆ getInstance()

◆ getSignals()

const std::vector< MSRailSignal * > & MSRailSignalControl::getSignals ( ) const
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().

Here is the caller graph for this function:

◆ hasInstance()

static bool MSRailSignalControl::hasInstance ( )
inlinestatic

Definition at line 45 of file MSRailSignalControl.h.

References myInstance.

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

Here is the caller graph for this function:

◆ haveDeadlock()

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().

Here is the caller graph for this function:

◆ notifyApproach()

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().

Here is the caller graph for this function:

◆ resetWaitRelations()

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

Here is the caller graph for this function:

◆ updateDriveways()

void MSRailSignalControl::updateDriveways ( const MSEdge used)
private

compute additioanl deadlock-check requirements for registered driveways

◆ updateSignals()

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().

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

References MSNet::BUILT, CONNECTOR, SUMOTrafficObject::getEdge(), MSEdge::getFunction(), SUMOTrafficObject::getParameter(), SUMOVehicle::hasDeparted(), SUMOVehicle::hasValidRoute(), MSRailSignal::initDriveWays(), SUMOVehicle::isRail(), MSNet::NEWROUTE, VEHPARS_FORCE_REROUTE, and SUMOVehicleParameter::wasSet().

Referenced by MSStateHandler::closeVehicle().

Here is the caller graph for this function:

Field Documentation

◆ myActiveSignals

std::set<MSRailSignal*, ComparatorNumericalIdLess> MSRailSignalControl::myActiveSignals
private

Definition at line 133 of file MSRailSignalControl.h.

Referenced by notifyApproach(), and updateSignals().

◆ myDeadlockChecks

std::map<const MSRailSignal*, std::vector<const MSRailSignal*> > MSRailSignalControl::myDeadlockChecks
private

Definition at line 123 of file MSRailSignalControl.h.

Referenced by addDeadlockCheck(), clearState(), and getDeadlockChecks().

◆ myDriveWayCompatibility

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

Definition at line 132 of file MSRailSignalControl.h.

Referenced by clearState().

◆ myDriveWayPred

std::map<const MSDriveWay*, std::set<const MSDriveWay*> > MSRailSignalControl::myDriveWayPred
private

Definition at line 125 of file MSRailSignalControl.h.

Referenced by addDrivewayFollower(), clearState(), and findDeadlockFoes().

◆ myDriveWaySucc

std::map<const MSDriveWay*, std::set<const MSDriveWay*> > MSRailSignalControl::myDriveWaySucc
private

Definition at line 124 of file MSRailSignalControl.h.

Referenced by addDrivewayFollower(), clearState(), and findDeadlockFoes().

◆ myInstance

MSRailSignalControl * MSRailSignalControl::myInstance
staticprivate

Definition at line 135 of file MSRailSignalControl.h.

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

◆ mySignals

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

list of all rail signals

Definition at line 128 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 131 of file MSRailSignalControl.h.

◆ myUsedEdges

std::set<const MSEdge*> MSRailSignalControl::myUsedEdges
private

all rail edges that are part of a known route

Definition at line 109 of file MSRailSignalControl.h.

◆ myWaitRelations

std::map<const SUMOVehicle*, WaitRelation> MSRailSignalControl::myWaitRelations
private

Definition at line 119 of file MSRailSignalControl.h.

Referenced by addWaitRelation(), haveDeadlock(), and resetWaitRelations().

◆ myWrittenDeadlocks

std::set<std::set<const SUMOVehicle*> > MSRailSignalControl::myWrittenDeadlocks
mutableprivate

Definition at line 121 of file MSRailSignalControl.h.

Referenced by clearState(), haveDeadlock(), and resetWaitRelations().


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