Dynamical system model
Loading...
Searching...
No Matches
dsm::TrafficLightCycle Class Reference

Public Member Functions

 TrafficLightCycle (Delay greenTime, Delay phase)
 Construct a new TrafficLightCycle object.
 
Delay greenTime () const
 
Delay phase () const
 
bool isDefault () const
 Returns true if the cycle has its default values.
 
bool isGreenTimeIncreased () const
 Returns true if the current green time is greater than the default one.
 
bool isRedTimeIncreased () const
 Returns true if the current green time is smaller than the default one.
 
bool isGreen (Delay const cycleTime, Delay const counter) const
 Returns true if the traffic light is green.
 
void reset ()
 Reset the green and phase values to the default values.
 

Constructor & Destructor Documentation

◆ TrafficLightCycle()

dsm::TrafficLightCycle::TrafficLightCycle ( Delay greenTime,
Delay phase )
inline

Construct a new TrafficLightCycle object.

Parameters
greenTimeDelay, the green time
phaseDelay, the phase

Member Function Documentation

◆ isGreen()

bool dsm::TrafficLightCycle::isGreen ( Delay const cycleTime,
Delay const counter ) const

Returns true if the traffic light is green.

Parameters
cycleTimeDelay, the total time of a red-green cycle
counterDelay, the current counter
Returns
true if counter < m_phase || (counter >= m_phase + m_greenTime && counter < cycleTime)

◆ reset()

void dsm::TrafficLightCycle::reset ( )

Reset the green and phase values to the default values.

The default values are the values that the cycle had when it was created


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