Eclipse SUMO - Simulation of Urban MObility
MSPhaseDefinition Class Reference

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

#include <MSPhaseDefinition.h>

Public Types

typedef std::vector< std::string > LaneIdVector
 
typedef std::bitset< 4 > PhaseType
 

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 LaneIdVectorgetTargetLaneSet () const
 
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 durationArg, const std::string &stateArg, const std::vector< int > &nextPhases, const std::string &name="")
 Constructor. More...
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::vector< int > &nextPhases, const std::string &name, bool transient_notdecisional, bool commit, LaneIdVector *targetLaneSetArg=nullptr)
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg=-1, SUMOTime maxDurationArg=-1, const std::vector< int > &nextPhases=std::vector< int >(), const std::string &name="")
 Constructor In this phase the duration is constrained between min and max duration. 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 lastDuration
 The previous duration of the phase. More...
 
SUMOTime maxDuration
 The maximum duration of the phase. More...
 
SUMOTime minDuration
 The minimum duration of the phase. More...
 
SUMOTime myLastSwitch
 Stores the timestep of the last on-switched of the phase. 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...
 

Private Member Functions

void init (SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::vector< int > nextPhasesArg, const std::string &nameArg)
 
void init (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, const std::vector< int > &nextPhasesArg, const std::string &nameArg, LaneIdVector *targetLaneSetArg)
 

Private Attributes

PhaseType phaseType
 
std::string state
 The phase definition. More...
 
LaneIdVector targetLaneSet
 

Detailed Description

The definition of a single phase of a tls logic.

Definition at line 48 of file MSPhaseDefinition.h.

Member Typedef Documentation

◆ LaneIdVector

typedef std::vector<std::string> MSPhaseDefinition::LaneIdVector

Definition at line 63 of file MSPhaseDefinition.h.

◆ PhaseType

typedef std::bitset<4> MSPhaseDefinition::PhaseType

Definition at line 61 of file MSPhaseDefinition.h.

Constructor & Destructor Documentation

◆ MSPhaseDefinition() [1/3]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
const std::vector< int > &  nextPhases,
const std::string &  name = "" 
)
inline

Constructor.

minDuration and maxDuration are set to duration.

Parameters
[in]durationArgThe duration of the phase
[in]stateArgThe state in the phase

Definition at line 138 of file MSPhaseDefinition.h.

References COMMIT_BIT, init(), name, nextPhases, phaseType, TARGET_BIT, TRANSIENT_NOTDECISIONAL_BIT, and UNDEFINED_BIT.

◆ MSPhaseDefinition() [2/3]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
SUMOTime  minDurationArg = -1,
SUMOTime  maxDurationArg = -1,
const std::vector< int > &  nextPhases = std::vector<int>(),
const std::string &  name = "" 
)
inline

Constructor In this phase the duration is constrained between min and max duration.

Parameters
[in]durationArgThe duration of the phase
[in]stateArgThe state in the phase
[in]minDurationArgThe minimum duration of the phase
[in]maxDurationArgThe maximum duration of the phase

Definition at line 156 of file MSPhaseDefinition.h.

References COMMIT_BIT, init(), name, nextPhases, phaseType, TARGET_BIT, TRANSIENT_NOTDECISIONAL_BIT, and UNDEFINED_BIT.

◆ MSPhaseDefinition() [3/3]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::vector< int > &  nextPhases,
const std::string &  name,
bool  transient_notdecisional,
bool  commit,
LaneIdVector targetLaneSetArg = nullptr 
)
inline

◆ ~MSPhaseDefinition()

virtual MSPhaseDefinition::~MSPhaseDefinition ( )
inlinevirtual

Destructor.

Definition at line 190 of file MSPhaseDefinition.h.

Member Function Documentation

◆ getName()

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

Definition at line 212 of file MSPhaseDefinition.h.

References name.

Referenced by GUIJunctionWrapper::drawGL(), Command_SaveTLSProgram::execute(), GUITrafficLightLogicWrapper::getCurrentPhaseName(), and GUITrafficLightLogicWrapper::getPopUpMenu().

Here is the caller graph for this function:

◆ getNextPhases()

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

Definition at line 208 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 242 of file MSPhaseDefinition.h.

References state.

◆ getState()

◆ getTargetLaneSet()

const LaneIdVector& MSPhaseDefinition::getTargetLaneSet ( ) const
inline

Definition at line 204 of file MSPhaseDefinition.h.

References targetLaneSet.

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

Here is the caller graph for this function:

◆ init() [1/2]

void MSPhaseDefinition::init ( SUMOTime  durationArg,
const std::string &  stateArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::vector< int >  nextPhasesArg,
const std::string &  nameArg 
)
inlineprivate

Definition at line 106 of file MSPhaseDefinition.h.

References OptionsCont::getOptions(), and string2time().

Referenced by init(), and MSPhaseDefinition().

Here is the caller graph for this function:

◆ init() [2/2]

void MSPhaseDefinition::init ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg,
const std::vector< int > &  nextPhasesArg,
const std::string &  nameArg,
LaneIdVector targetLaneSetArg 
)
inlineprivate

Definition at line 120 of file MSPhaseDefinition.h.

References init().

◆ isCommit()

bool MSPhaseDefinition::isCommit ( ) const
inline

Definition at line 289 of file MSPhaseDefinition.h.

References COMMIT_BIT, and phaseType.

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 282 of file MSPhaseDefinition.h.

References phaseType, and TRANSIENT_NOTDECISIONAL_BIT.

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 227 of file MSPhaseDefinition.h.

References state.

Referenced by MSDelayBasedTrafficLightLogic::trySwitch().

Here is the caller graph for this function:

◆ isTarget()

bool MSPhaseDefinition::isTarget ( ) const
inline

Definition at line 268 of file MSPhaseDefinition.h.

References phaseType, and TARGET_BIT.

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

Here is the caller graph for this function:

◆ isTransient()

bool MSPhaseDefinition::isTransient ( ) const
inline

Definition at line 275 of file MSPhaseDefinition.h.

References phaseType, and TRANSIENT_NOTDECISIONAL_BIT.

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 261 of file MSPhaseDefinition.h.

References phaseType, and UNDEFINED_BIT.

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 253 of file MSPhaseDefinition.h.

References state.

◆ setName()

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

Definition at line 216 of file MSPhaseDefinition.h.

References name.

◆ setState()

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

Definition at line 200 of file MSPhaseDefinition.h.

References state.

Referenced by MSRailSignal::recheckGreen(), and MSRailSignal::updateCurrentPhase().

Here is the caller graph for this function:

Field Documentation

◆ duration

◆ lastDuration

SUMOTime MSPhaseDefinition::lastDuration

The previous duration of the phase.

Definition at line 70 of file MSPhaseDefinition.h.

Referenced by MSSOTLWaveTrafficLightLogic::canRelease().

◆ maxDuration

◆ minDuration

◆ myLastSwitch

◆ name

std::string MSPhaseDefinition::name

Optional name or description for the current phase.

Definition at line 85 of file MSPhaseDefinition.h.

Referenced by getName(), MSPhaseDefinition(), and setName().

◆ nextPhases

std::vector<int> MSPhaseDefinition::nextPhases

The index of the phase that suceeds this one (or -1)

Definition at line 82 of file MSPhaseDefinition.h.

Referenced by getNextPhases(), and MSPhaseDefinition().

◆ phaseType

PhaseType MSPhaseDefinition::phaseType
private

◆ state

std::string MSPhaseDefinition::state
private

The phase definition.

Definition at line 89 of file MSPhaseDefinition.h.

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

◆ targetLaneSet

LaneIdVector MSPhaseDefinition::targetLaneSet
private

Definition at line 104 of file MSPhaseDefinition.h.

Referenced by getTargetLaneSet().


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