Eclipse SUMO - Simulation of Urban MObility
MSPhaseDefinition Class Reference

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

#include <MSPhaseDefinition.h>

Collaboration diagram for MSPhaseDefinition:

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

Member Typedef Documentation

◆ LaneIdVector

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

Definition at line 67 of file MSPhaseDefinition.h.

◆ PhaseType

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

Definition at line 65 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 142 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 160 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 194 of file MSPhaseDefinition.h.

Member Function Documentation

◆ getName()

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

◆ getNextPhases()

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

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

References state.

◆ getState()

◆ getTargetLaneSet()

const LaneIdVector& MSPhaseDefinition::getTargetLaneSet ( ) const
inline

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

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

Referenced by init(), and MSPhaseDefinition().

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

References init().

◆ isCommit()

◆ isDecisional()

bool MSPhaseDefinition::isDecisional ( ) const
inline

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

References state.

Referenced by MSDelayBasedTrafficLightLogic::trySwitch().

◆ isTarget()

◆ isTransient()

bool MSPhaseDefinition::isTransient ( ) const
inline

◆ isUndefined()

bool MSPhaseDefinition::isUndefined ( ) const
inline

Definition at line 265 of file MSPhaseDefinition.h.

References phaseType, and UNDEFINED_BIT.

Referenced by MSSOTLTrafficLightLogic::checkPhases().

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

References state.

◆ setName()

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

Definition at line 220 of file MSPhaseDefinition.h.

References name.

◆ setState()

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

Definition at line 204 of file MSPhaseDefinition.h.

References state.

Referenced by MSRailSignal::updateCurrentPhase().

Field Documentation

◆ duration

◆ lastDuration

SUMOTime MSPhaseDefinition::lastDuration

The previous duration of the phase.

Definition at line 74 of file MSPhaseDefinition.h.

Referenced by MSSOTLWaveTrafficLightLogic::canRelease().

◆ maxDuration

SUMOTime MSPhaseDefinition::maxDuration

◆ minDuration

◆ myLastSwitch

◆ name

std::string MSPhaseDefinition::name

Optional name or description for the current phase.

Definition at line 89 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 86 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 93 of file MSPhaseDefinition.h.

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

◆ targetLaneSet

LaneIdVector MSPhaseDefinition::targetLaneSet
private

Definition at line 108 of file MSPhaseDefinition.h.

Referenced by getTargetLaneSet().


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