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 ()
 
static void initSignalized (SVCPermissions svc, SVCPermissions mbSvc)
 
static bool isMovingBlock (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 *, 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
 
static SVCPermissions myMBClasses
 
static SVCPermissions mySignalizedClasses
 signalized classes
 

Detailed Description

A signal for rails.

Definition at line 40 of file MSRailSignalControl.h.

Constructor & Destructor Documentation

◆ ~MSRailSignalControl()

MSRailSignalControl::~MSRailSignalControl ( )

Definition at line 79 of file MSRailSignalControl.cpp.

◆ MSRailSignalControl()

MSRailSignalControl::MSRailSignalControl ( )
private

Constructor.

Definition at line 48 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 202 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 217 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 225 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 98 of file MSRailSignalControl.cpp.

References MSTrafficLightLogic::getLinks(), mySignalizedClasses, and mySignals.

Referenced by MSRailSignal::init().

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 109 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 61 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 67 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 238 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 86 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 82 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 46 of file MSRailSignalControl.h.

References myInstance.

Referenced by MSStateHandler::closeVehicle(), MSLane::executeMovements(), MSBaseVehicle::replaceRoute(), 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 116 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:

◆ initSignalized()

static void MSRailSignalControl::initSignalized ( SVCPermissions  svc,
SVCPermissions  mbSvc 
)
inlinestatic

Definition at line 105 of file MSRailSignalControl.h.

References myMBClasses, and mySignalizedClasses.

Referenced by MSFrame::setMSGlobals().

Here is the caller graph for this function:

◆ isMovingBlock()

static bool MSRailSignalControl::isMovingBlock ( SVCPermissions  svc)
inlinestatic

Definition at line 101 of file MSRailSignalControl.h.

References myMBClasses.

Referenced by MSDriveWay::buildDriveWay(), and MSRailSignal::init().

Here is the caller graph for this function:

◆ isSignalized()

static bool MSRailSignalControl::isSignalized ( SUMOVehicleClass  svc)
inlinestatic

Definition at line 97 of file MSRailSignalControl.h.

References mySignalizedClasses.

Referenced by MSLane::isInsertionSuccess().

Here is the caller graph for this function:

◆ notifyApproach()

void MSRailSignalControl::notifyApproach ( const MSLink link)

switch rail signal to active

Definition at line 280 of file MSRailSignalControl.cpp.

References MSLink::getTLLogic(), and myActiveSignals.

Referenced by MSDriveWay::enterDriveWay(), MSRailSignal::initDriveWays(), 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 56 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 288 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 83 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().

Here is the caller graph for this function:

Field Documentation

◆ myActiveSignals

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

Definition at line 147 of file MSRailSignalControl.h.

Referenced by notifyApproach(), and updateSignals().

◆ myDeadlockChecks

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

Definition at line 137 of file MSRailSignalControl.h.

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

◆ myDriveWayCompatibility

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

Definition at line 146 of file MSRailSignalControl.h.

Referenced by clearState().

◆ myDriveWayPred

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

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

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

◆ myInstance

MSRailSignalControl * MSRailSignalControl::myInstance
staticprivate

Definition at line 153 of file MSRailSignalControl.h.

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

◆ myMBClasses

SVCPermissions MSRailSignalControl::myMBClasses
staticprivate

Definition at line 151 of file MSRailSignalControl.h.

Referenced by initSignalized(), and isMovingBlock().

◆ mySignalizedClasses

SVCPermissions MSRailSignalControl::mySignalizedClasses
staticprivate

signalized classes

Definition at line 150 of file MSRailSignalControl.h.

Referenced by addSignal(), initSignalized(), and isSignalized().

◆ mySignals

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

list of all rail signals

Definition at line 142 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 145 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 123 of file MSRailSignalControl.h.

◆ myWaitRelations

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

Definition at line 133 of file MSRailSignalControl.h.

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

◆ myWrittenDeadlocks

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

Definition at line 135 of file MSRailSignalControl.h.

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


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