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:
Collaboration graph

Public Types

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

Public Member Functions

int getNextPhase () 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, int nextPhase)
 Constructor. More...
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg=-1, SUMOTime maxDurationArg=-1, int nextPhase=-1)
 Constructor In this phase the duration is constrained between min and max duration. More...
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, int nextPhase, bool transient_notdecisional, bool commit, LaneIdVector &targetLaneSetArg)
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, int nextPhase, bool transient_notdecisional, bool commit)
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, int nextPhase, bool transient_notdecisional, bool commit, LaneIdVector &targetLaneSetArg)
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, int nextPhase, bool transient_notdecisional, bool commit)
 
bool operator!= (const MSPhaseDefinition &pd)
 Comparison operator. More...
 
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...
 
int nextPhase
 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, int nextPhase)
 
void init (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg, int nextPhase, 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/6]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
int  nextPhase 
)
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 134 of file MSPhaseDefinition.h.

References COMMIT_BIT, init(), TARGET_BIT, TRANSIENT_NOTDECISIONAL_BIT, and UNDEFINED_BIT.

◆ MSPhaseDefinition() [2/6]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
SUMOTime  minDurationArg = -1,
SUMOTime  maxDurationArg = -1,
int  nextPhase = -1 
)
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 152 of file MSPhaseDefinition.h.

References COMMIT_BIT, init(), TARGET_BIT, TRANSIENT_NOTDECISIONAL_BIT, and UNDEFINED_BIT.

◆ MSPhaseDefinition() [3/6]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
int  nextPhase,
bool  transient_notdecisional,
bool  commit,
LaneIdVector targetLaneSetArg 
)
inline

◆ MSPhaseDefinition() [4/6]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
int  nextPhase,
bool  transient_notdecisional,
bool  commit 
)
inline

◆ MSPhaseDefinition() [5/6]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
int  nextPhase,
bool  transient_notdecisional,
bool  commit,
LaneIdVector targetLaneSetArg 
)
inline

◆ MSPhaseDefinition() [6/6]

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
const std::string &  stateArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
int  nextPhase,
bool  transient_notdecisional,
bool  commit 
)
inline

◆ ~MSPhaseDefinition()

virtual MSPhaseDefinition::~MSPhaseDefinition ( )
inlinevirtual

Destructor.

Definition at line 239 of file MSPhaseDefinition.h.

Member Function Documentation

◆ getNextPhase()

int MSPhaseDefinition::getNextPhase ( ) const
inline

Definition at line 257 of file MSPhaseDefinition.h.

References nextPhase.

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

◆ getState()

◆ getTargetLaneSet()

const LaneIdVector& MSPhaseDefinition::getTargetLaneSet ( ) const
inline

◆ init() [1/2]

void MSPhaseDefinition::init ( SUMOTime  durationArg,
const std::string &  stateArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
int  nextPhase 
)
inlineprivate

Definition at line 107 of file MSPhaseDefinition.h.

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

Referenced by init(), and MSPhaseDefinition().

◆ init() [2/2]

void MSPhaseDefinition::init ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg,
int  nextPhase,
LaneIdVector targetLaneSetArg 
)
inlineprivate

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

Referenced by MSDelayBasedTrafficLightLogic::trySwitch().

◆ isTarget()

◆ isTransient()

bool MSPhaseDefinition::isTransient ( ) const
inline

◆ isUndefined()

bool MSPhaseDefinition::isUndefined ( ) const
inline

Definition at line 302 of file MSPhaseDefinition.h.

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

References state.

◆ setState()

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

Definition at line 249 of file MSPhaseDefinition.h.

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

◆ nextPhase

int MSPhaseDefinition::nextPhase

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

Definition at line 86 of file MSPhaseDefinition.h.

Referenced by getNextPhase(), and init().

◆ phaseType

PhaseType MSPhaseDefinition::phaseType
private

Definition at line 95 of file MSPhaseDefinition.h.

◆ state

std::string MSPhaseDefinition::state
private

The phase definition.

Definition at line 90 of file MSPhaseDefinition.h.

Referenced by getState(), and operator!=().

◆ targetLaneSet

LaneIdVector MSPhaseDefinition::targetLaneSet
private

Definition at line 105 of file MSPhaseDefinition.h.

Referenced by getTargetLaneSet().


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