Eclipse SUMO - Simulation of Urban MObility
MSPhaseDefinition Class Reference

The definition of a single phase of a tls logic. More...

#include <MSPhaseDefinition.h>

Public Member Functions

const std::string & getName () const
 
const std::vector< int > & getNextPhases () const
 
LinkState getSignalState (int pos) const
 Returns the state of the tls signal at the given position. More...
 
const std::string & getState () const
 Returns the state within this phase. More...
 
const std::vector< std::string > & getTargetLaneSet () const
 
bool isActuated () const
 
bool isAllRedPhase () const
 Returns whether this phase is an "all red" phase. More...
 
bool isCommit () const
 
bool isDecisional () const
 
bool isGreenPhase () const
 Returns whether this phase is a pure "green" phase. More...
 
bool isTarget () const
 
bool isTransient () const
 
bool isUndefined () const
 
 MSPhaseDefinition (SUMOTime _duration, const std::string &state, const std::string &_name="")
 Constructor. More...
 
bool operator!= (const MSPhaseDefinition &pd)
 Comparison operator. More...
 
void setName (const std::string &_name)
 
void setState (const std::string &_state)
 
virtual ~MSPhaseDefinition ()
 Destructor. More...
 

Data Fields

SUMOTime duration
 The duration of the phase. More...
 
SUMOTime earliestEnd
 The minimum time within the cycle for switching (for coordinated actuation) More...
 
std::string earlyTarget
 The condition expression for an early switch into this phase. More...
 
std::string finalTarget
 The condition expression for switching into this phase when the active phase must end. More...
 
SUMOTime lastDuration
 The previous duration of the phase. More...
 
SUMOTime latestEnd
 The maximum time within the cycle for switching (for coordinated actuation) More...
 
SUMOTime maxDuration
 The maximum duration of the phase. More...
 
SUMOTime minDuration
 The minimum duration of the phase. More...
 
bool myCommit
 the phase is a commit, compulsory directive for SOTL policies More...
 
SUMOTime myLastEnd
 Stores the timestep when the previous instance of this phase was switched off. More...
 
SUMOTime myLastSwitch
 Stores the timestep of the last on-switched of the phase. More...
 
std::vector< std::string > myTargetLaneSet
 
bool myTransientNotDecisional
 the phase is a transient one or a decisional one, compulsory directive for SOTL policies More...
 
bool myUndefined
 Leaving the phase type as "undefined" lets SOTL policies malfunction. More...
 
std::string name
 Optional name or description for the current phase. More...
 
std::vector< int > nextPhases
 The index of the phase that suceeds this one (or -1) More...
 
SUMOTime red
 for NEMA phase More...
 
SUMOTime vehext
 for NEMA phase More...
 
SUMOTime yellow
 for NEMA phase More...
 

Static Public Attributes

static const SUMOTime OVERRIDE_DURATION = TIME2STEPS(-1)
 
static const SUMOTime UNSPECIFIED_DURATION = -1
 

Private Attributes

std::string myState
 The phase definition. More...
 

Detailed Description

The definition of a single phase of a tls logic.

Definition at line 51 of file MSPhaseDefinition.h.

Constructor & Destructor Documentation

◆ MSPhaseDefinition()

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  _duration,
const std::string &  state,
const std::string &  _name = "" 
)
inline

Constructor.

Definition at line 128 of file MSPhaseDefinition.h.

◆ ~MSPhaseDefinition()

virtual MSPhaseDefinition::~MSPhaseDefinition ( )
inlinevirtual

Destructor.

Definition at line 149 of file MSPhaseDefinition.h.

Member Function Documentation

◆ getName()

const std::string& MSPhaseDefinition::getName ( ) const
inline

Definition at line 171 of file MSPhaseDefinition.h.

References name.

Referenced by GUIJunctionWrapper::drawGL(), Command_SaveTLSProgram::execute(), Command_SaveTLSState::execute(), Command_SaveTLSSwitchStates::execute(), GUITrafficLightLogicWrapper::getCurrentPhaseName(), LIBSUMO_NAMESPACE::TrafficLight::getPhaseName(), and GUITrafficLightLogicWrapper::getPopUpMenu().

Here is the caller graph for this function:

◆ getNextPhases()

const std::vector<int>& MSPhaseDefinition::getNextPhases ( ) const
inline

Definition at line 167 of file MSPhaseDefinition.h.

References nextPhases.

◆ getSignalState()

LinkState MSPhaseDefinition::getSignalState ( int  pos) const
inline

Returns the state of the tls signal at the given position.

Parameters
[in]posThe position of the signal to return the state for
Returns
The state of the signal at the given position

Definition at line 212 of file MSPhaseDefinition.h.

References myState.

Referenced by MSActuatedTrafficLightLogic::evalAtomicExpression().

Here is the caller graph for this function:

◆ getState()

◆ getTargetLaneSet()

const std::vector<std::string>& MSPhaseDefinition::getTargetLaneSet ( ) const
inline

Definition at line 163 of file MSPhaseDefinition.h.

References myTargetLaneSet.

Referenced by MSSOTLTrafficLightLogic::countVehicles(), MSSwarmTrafficLightLogic::decideNextPhase(), and MSPedestrianPushButton::loadPushButtons().

Here is the caller graph for this function:

◆ isActuated()

bool MSPhaseDefinition::isActuated ( ) const
inline

Definition at line 216 of file MSPhaseDefinition.h.

References maxDuration, minDuration, and OVERRIDE_DURATION.

Referenced by MSActuatedTrafficLightLogic::getMinimumMinDuration().

Here is the caller graph for this function:

◆ isAllRedPhase()

bool MSPhaseDefinition::isAllRedPhase ( ) const
inline

Returns whether this phase is an "all red" phase.

"all red " means in this case that at all streams have red and no stream has yellow.

Returns
Whether this phase is an "all red" phase

Definition at line 203 of file MSPhaseDefinition.h.

References myState.

Referenced by GUIViewTraffic::onGamingClick().

Here is the caller graph for this function:

◆ isCommit()

bool MSPhaseDefinition::isCommit ( ) const
inline

Definition at line 262 of file MSPhaseDefinition.h.

References myCommit.

Referenced by MSDeterministicHiLevelTrafficLightLogic::decideNextPhase(), MSSOTLTrafficLightLogic::decideNextPhase(), MSSwarmTrafficLightLogic::decideNextPhase(), MSSOTLCongestionPolicy::decideNextPhase(), and MSSOTLPolicy::decideNextPhase().

Here is the caller graph for this function:

◆ isDecisional()

bool MSPhaseDefinition::isDecisional ( ) const
inline

Definition at line 255 of file MSPhaseDefinition.h.

References myTransientNotDecisional.

Referenced by MSSOTLTrafficLightLogic::decideNextPhase(), MSSOTLCongestionPolicy::decideNextPhase(), and MSSOTLPolicy::decideNextPhase().

Here is the caller graph for this function:

◆ isGreenPhase()

bool MSPhaseDefinition::isGreenPhase ( ) const
inline

Returns whether this phase is a pure "green" phase.

"pure green" means in this case that at least one stream has green and no stream has yellow. Such phases are meant to be candidates for being stretched by actuated or agentbased traffic light logics.

Returns
Whether this phase is a "pure green" phase

Definition at line 186 of file MSPhaseDefinition.h.

References myState.

Referenced by GUIViewTraffic::onGamingClick(), and MSDelayBasedTrafficLightLogic::trySwitch().

Here is the caller graph for this function:

◆ isTarget()

bool MSPhaseDefinition::isTarget ( ) const
inline

Definition at line 241 of file MSPhaseDefinition.h.

References myTargetLaneSet.

Referenced by MSSOTLTrafficLightLogic::countVehicles(), MSSOTLTrafficLightLogic::setToATargetPhase(), MSSOTLTrafficLightLogic::setupCTS(), and MSSOTLTrafficLightLogic::trySwitch().

Here is the caller graph for this function:

◆ isTransient()

bool MSPhaseDefinition::isTransient ( ) const
inline

Definition at line 248 of file MSPhaseDefinition.h.

References myTransientNotDecisional.

Referenced by MSSOTLTrafficLightLogic::decideNextPhase(), MSSOTLCongestionPolicy::decideNextPhase(), and MSSOTLPolicy::decideNextPhase().

Here is the caller graph for this function:

◆ isUndefined()

bool MSPhaseDefinition::isUndefined ( ) const
inline

Definition at line 234 of file MSPhaseDefinition.h.

References myUndefined.

Referenced by MSSOTLTrafficLightLogic::checkPhases().

Here is the caller graph for this function:

◆ operator!=()

bool MSPhaseDefinition::operator!= ( const MSPhaseDefinition pd)
inline

Comparison operator.

Note that only the state must differ, not the duration!

Parameters
[in]pdThe phase definition to compare against
Returns
Whether the given phase definition differs

Definition at line 226 of file MSPhaseDefinition.h.

References myState, and name.

◆ setName()

void MSPhaseDefinition::setName ( const std::string &  _name)
inline

Definition at line 175 of file MSPhaseDefinition.h.

References name.

Referenced by NEMALogic::constructTimingAndPhaseDefs(), and NEMALogic::trySwitch().

Here is the caller graph for this function:

◆ setState()

void MSPhaseDefinition::setState ( const std::string &  _state)
inline

Definition at line 159 of file MSPhaseDefinition.h.

References myState.

Referenced by NEMALogic::constructTimingAndPhaseDefs(), NEMALogic::trySwitch(), and MSRailSignal::updateCurrentPhase().

Here is the caller graph for this function:

Field Documentation

◆ duration

◆ earliestEnd

SUMOTime MSPhaseDefinition::earliestEnd

The minimum time within the cycle for switching (for coordinated actuation)

Definition at line 70 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), MSTrafficLightLogic::getEarliestEnd(), MSActuatedTrafficLightLogic::getEarliestEnd(), and MSActuatedTrafficLightLogic::initAttributeOverride().

◆ earlyTarget

std::string MSPhaseDefinition::earlyTarget

The condition expression for an early switch into this phase.

Definition at line 76 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), MSActuatedTrafficLightLogic::decideNextPhaseCustom(), and MSActuatedTrafficLightLogic::initSwitchingRules().

◆ finalTarget

std::string MSPhaseDefinition::finalTarget

The condition expression for switching into this phase when the active phase must end.

Definition at line 79 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), MSActuatedTrafficLightLogic::decideNextPhaseCustom(), and MSActuatedTrafficLightLogic::initSwitchingRules().

◆ lastDuration

SUMOTime MSPhaseDefinition::lastDuration

The previous duration of the phase.

Definition at line 61 of file MSPhaseDefinition.h.

Referenced by MSSOTLWaveTrafficLightLogic::canRelease().

◆ latestEnd

SUMOTime MSPhaseDefinition::latestEnd

The maximum time within the cycle for switching (for coordinated actuation)

Definition at line 73 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), MSTrafficLightLogic::getLatestEnd(), MSActuatedTrafficLightLogic::getLatestEnd(), and MSActuatedTrafficLightLogic::initAttributeOverride().

◆ maxDuration

◆ minDuration

◆ myCommit

bool MSPhaseDefinition::myCommit

the phase is a commit, compulsory directive for SOTL policies

Definition at line 106 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), and isCommit().

◆ myLastEnd

SUMOTime MSPhaseDefinition::myLastEnd

Stores the timestep when the previous instance of this phase was switched off.

Definition at line 85 of file MSPhaseDefinition.h.

◆ myLastSwitch

◆ myState

std::string MSPhaseDefinition::myState
private

The phase definition.

Definition at line 123 of file MSPhaseDefinition.h.

Referenced by getSignalState(), getState(), isAllRedPhase(), isGreenPhase(), operator!=(), and setState().

◆ myTargetLaneSet

std::vector<std::string> MSPhaseDefinition::myTargetLaneSet

Definition at line 119 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), getTargetLaneSet(), and isTarget().

◆ myTransientNotDecisional

bool MSPhaseDefinition::myTransientNotDecisional

the phase is a transient one or a decisional one, compulsory directive for SOTL policies

Definition at line 103 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), isDecisional(), and isTransient().

◆ myUndefined

bool MSPhaseDefinition::myUndefined

Leaving the phase type as "undefined" lets SOTL policies malfunction.

Definition at line 109 of file MSPhaseDefinition.h.

Referenced by isUndefined().

◆ name

std::string MSPhaseDefinition::name

Optional name or description for the current phase.

Definition at line 91 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), getName(), operator!=(), and setName().

◆ nextPhases

std::vector<int> MSPhaseDefinition::nextPhases

◆ OVERRIDE_DURATION

◆ red

SUMOTime MSPhaseDefinition::red

for NEMA phase

Definition at line 97 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), and NEMAPhase::recalculateTiming().

◆ UNSPECIFIED_DURATION

◆ vehext

SUMOTime MSPhaseDefinition::vehext

for NEMA phase

Definition at line 100 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), and NEMAPhase::recalculateTiming().

◆ yellow

SUMOTime MSPhaseDefinition::yellow

for NEMA phase

Definition at line 94 of file MSPhaseDefinition.h.

Referenced by NLHandler::addPhase(), and NEMAPhase::recalculateTiming().


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