SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSPhaseDefinition Class Reference

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

#include <MSPhaseDefinition.h>

Public Member Functions

LinkState getSignalState (unsigned 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...
 
bool isGreenPhase () const
 Returns whether this phase is a pure "green" phase. More...
 
 MSPhaseDefinition (SUMOTime durationArg, const std::string &stateArg)
 Constructor. More...
 
 MSPhaseDefinition (SUMOTime durationArg, SUMOTime minDurationArg, SUMOTime maxDurationArg, const std::string &stateArg)
 Constructor. More...
 
bool operator!= (const MSPhaseDefinition &pd)
 Comparison operator. More...
 
virtual ~MSPhaseDefinition ()
 Destructor. More...
 

Data Fields

SUMOTime duration
 The 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...
 

Private Attributes

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

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

MSPhaseDefinition::MSPhaseDefinition ( SUMOTime  durationArg,
SUMOTime  minDurationArg,
SUMOTime  maxDurationArg,
const std::string &  stateArg 
)
inline

Constructor.

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

Definition at line 88 of file MSPhaseDefinition.h.

References OptionsCont::getOptions(), maxDuration, minDuration, myLastSwitch, and string2time().

virtual MSPhaseDefinition::~MSPhaseDefinition ( )
inlinevirtual

Destructor.

Definition at line 99 of file MSPhaseDefinition.h.

Member Function Documentation

LinkState MSPhaseDefinition::getSignalState ( unsigned 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 132 of file MSPhaseDefinition.h.

References state.

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

References state.

Referenced by MSActuatedTrafficLightLogic::duration(), and MSActuatedTrafficLightLogic::gapControl().

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

References state.

Field Documentation

SUMOTime MSPhaseDefinition::maxDuration

The maximum duration of the phase.

Definition at line 60 of file MSPhaseDefinition.h.

Referenced by MSActuatedTrafficLightLogic::duration(), MSPhaseDefinition(), and TraCIServerAPI_TLS::processGet().

SUMOTime MSPhaseDefinition::minDuration

The minimum duration of the phase.

Definition at line 57 of file MSPhaseDefinition.h.

Referenced by MSActuatedTrafficLightLogic::duration(), MSPhaseDefinition(), and TraCIServerAPI_TLS::processGet().

SUMOTime MSPhaseDefinition::myLastSwitch

Stores the timestep of the last on-switched of the phase.

Definition at line 63 of file MSPhaseDefinition.h.

Referenced by MSSimpleTrafficLightLogic::getPhaseIndexAtTime(), and MSPhaseDefinition().

std::string MSPhaseDefinition::state
private

The phase definition.

Definition at line 150 of file MSPhaseDefinition.h.

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


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