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  Deadlock
 storage for loaded deadlocks More...
 
struct  WaitRelation
 

Public Member Functions

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::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 loadDeadlockCheck (std::vector< const MSRailSignal * > signals)
 
void loadDeadlockRoute (const ConstMSEdgeVector &edges)
 
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 ()
 
static void initSignalized (SVCPermissions svc, SVCPermissions mbSvc)
 
static bool isMovingBlock (SVCPermissions svc)
 
static bool isSignalized (SUMOVehicleClass svc)
 
static bool isUsingDriveWays (SVCPermissions svc)
 

Protected Member Functions

void findDeadlockFoes (const MSDriveWay *dw, const Deadlock &dl, int signalIndex, std::vector< const MSDriveWay * > deadlockFoes)
 
void findDeadlockFoesFromRoutes (const MSDriveWay *dw, const Deadlock &dl, int signalIndex, 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< std::pair< int, int >, bool > myDriveWayCompatibility
 
std::map< const MSDriveWay *, std::set< const MSDriveWay * > > myDriveWayPred
 
std::map< const MSDriveWay *, std::set< const MSDriveWay *, ComparatorNumericalIdLess > > myDriveWaySucc
 
std::vector< Deadlock > myLoadedDeadlocks
 
double myMaxTrainLength
 
std::map< const MSRailSignal *, std::vector< std::pair< int, int > > > mySignalDeadlocks
 
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
 
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 81 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

◆ addDrivewayFollower()

void MSRailSignalControl::addDrivewayFollower ( const MSDriveWay *  dw,
const MSDriveWay *  dw2 
)

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

References MSRailSignalControl::Deadlock::edges, findDeadlockFoes(), findDeadlockFoesFromRoutes(), MSRailSignalControl::Deadlock::forwardEnds, MSDriveWay::getEndingDriveWays(), MSDriveWay::getForward(), Named::getID(), myLoadedDeadlocks, and mySignalDeadlocks.

Referenced by MSRailSignal::initDriveWays().

Here is the caller graph for this function:

◆ addSignal()

void MSRailSignalControl::addSignal ( MSRailSignal *  signal)

Definition at line 103 of file MSRailSignalControl.cpp.

References MSTrafficLightLogic::getLinks(), myMBClasses, 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 114 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 62 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 68 of file MSRailSignalControl.cpp.

References myDriveWayCompatibility, myDriveWayPred, myDriveWaySucc, myInstance, myLoadedDeadlocks, mySignalDeadlocks, and myWrittenDeadlocks.

Referenced by MSNet::clearState().

Here is the caller graph for this function:

◆ findDeadlockFoes()

void MSRailSignalControl::findDeadlockFoes ( const MSDriveWay *  dw,
const Deadlock &  dl,
int  signalIndex,
std::vector< const MSDriveWay * >  deadlockFoes 
)
protected

Definition at line 310 of file MSRailSignalControl.cpp.

References findDeadlockFoes(), Named::getID(), MSRailSignal::getJunction(), myDriveWaySucc, myMaxTrainLength, MSRailSignalControl::Deadlock::signals, and toString().

Referenced by addDWDeadlockChecks(), findDeadlockFoes(), and findDeadlockFoesFromRoutes().

Here is the caller graph for this function:

◆ findDeadlockFoesFromRoutes()

void MSRailSignalControl::findDeadlockFoesFromRoutes ( const MSDriveWay *  dw,
const Deadlock &  dl,
int  signalIndex,
std::vector< const MSDriveWay * >  deadlockFoes 
)
protected

Definition at line 358 of file MSRailSignalControl.cpp.

References MSRailSignalControl::Deadlock::edges, findDeadlockFoes(), findDeadlockFoesFromRoutes(), MSRailSignalControl::Deadlock::forwardEnds, MSDriveWay::getEndingDriveWays(), Named::getID(), MSDriveWay::getRoute(), MIN2(), MSRailSignalControl::Deadlock::signals, and toString().

Referenced by addDWDeadlockChecks(), and findDeadlockFoesFromRoutes().

Here is the caller graph for this function:

◆ getInstance()

◆ getSignals()

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

Definition at line 84 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 47 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()

◆ initSignalized()

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

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

References myMBClasses, and SVC_RAIL_CLASSES.

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 95 of file MSRailSignalControl.h.

References mySignalizedClasses.

Referenced by MESegment::initialise(), and MSLane::isInsertionSuccess().

Here is the caller graph for this function:

◆ isUsingDriveWays()

static bool MSRailSignalControl::isUsingDriveWays ( SVCPermissions  svc)
inlinestatic

Definition at line 103 of file MSRailSignalControl.h.

References myMBClasses, and mySignalizedClasses.

Referenced by MSDriveWay::notifyEnter(), MSDriveWay::notifyLeave(), MSDriveWay::notifyLeaveBack(), and MSDriveWay::notifyReroute().

Here is the caller graph for this function:

◆ loadDeadlockCheck()

void MSRailSignalControl::loadDeadlockCheck ( std::vector< const MSRailSignal * >  signals)

Definition at line 221 of file MSRailSignalControl.cpp.

References MSDriveWay::haveDriveWays(), myLoadedDeadlocks, mySignalDeadlocks, toString(), and WRITE_WARNING.

Referenced by NLHandler::addDeadlock().

Here is the caller graph for this function:

◆ loadDeadlockRoute()

void MSRailSignalControl::loadDeadlockRoute ( const ConstMSEdgeVector &  edges)

Definition at line 239 of file MSRailSignalControl.cpp.

References MSRailSignalControl::Deadlock::edges, MSRailSignalControl::Deadlock::forwardEnds, Named::getID(), MSRailSignal::getJunction(), MSLink::isTLSControlled(), myLoadedDeadlocks, RAIL_SIGNAL, MSRailSignalControl::Deadlock::signals, and toString().

Referenced by NLHandler::addDeadlockRoute().

Here is the caller graph for this function:

◆ notifyApproach()

void MSRailSignalControl::notifyApproach ( const MSLink *  link)

switch rail signal to active

Definition at line 385 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 57 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 393 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 85 of file MSRailSignalControl.cpp.

References MSNet::BUILT, CONNECTOR, SUMOTrafficObject::getEdge(), MSEdge::getFunction(), SUMOVehicle::getLength(), SUMOTrafficObject::getParameter(), MSEdge::getPermissions(), SUMOVehicle::hasValidRoute(), MSRailSignal::initDriveWays(), SUMOVehicle::isRail(), isRailwayOrShared(), MAX2(), myMaxTrainLength, 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 160 of file MSRailSignalControl.h.

Referenced by notifyApproach(), and updateSignals().

◆ myDriveWayCompatibility

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

Definition at line 159 of file MSRailSignalControl.h.

Referenced by clearState().

◆ myDriveWayPred

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

Definition at line 152 of file MSRailSignalControl.h.

Referenced by addDrivewayFollower(), and clearState().

◆ myDriveWaySucc

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

Definition at line 151 of file MSRailSignalControl.h.

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

◆ myInstance

MSRailSignalControl * MSRailSignalControl::myInstance
staticprivate

Definition at line 167 of file MSRailSignalControl.h.

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

◆ myLoadedDeadlocks

std::vector<Deadlock> MSRailSignalControl::myLoadedDeadlocks
private

◆ myMaxTrainLength

double MSRailSignalControl::myMaxTrainLength
private

Definition at line 161 of file MSRailSignalControl.h.

Referenced by findDeadlockFoes(), and vehicleStateChanged().

◆ myMBClasses

SVCPermissions MSRailSignalControl::myMBClasses
staticprivate

Definition at line 165 of file MSRailSignalControl.h.

Referenced by addSignal(), initSignalized(), isMovingBlock(), and isUsingDriveWays().

◆ mySignalDeadlocks

std::map<const MSRailSignal*, std::vector<std::pair<int, int> > > MSRailSignalControl::mySignalDeadlocks
private

Definition at line 149 of file MSRailSignalControl.h.

Referenced by addDWDeadlockChecks(), clearState(), and loadDeadlockCheck().

◆ mySignalizedClasses

SVCPermissions MSRailSignalControl::mySignalizedClasses
staticprivate

signalized classes

Definition at line 164 of file MSRailSignalControl.h.

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

◆ mySignals

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

list of all rail signals

Definition at line 155 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 158 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 133 of file MSRailSignalControl.h.

◆ myWaitRelations

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

Definition at line 143 of file MSRailSignalControl.h.

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

◆ myWrittenDeadlocks

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

Definition at line 145 of file MSRailSignalControl.h.

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


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