Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSTLLogicControl::WAUTSwitchProcedure_Stretch Class Reference

This class switches using the Stretch algorithm. More...

#include <MSTLLogicControl.h>

Inheritance diagram for MSTLLogicControl::WAUTSwitchProcedure_Stretch:
[legend]
Collaboration diagram for MSTLLogicControl::WAUTSwitchProcedure_Stretch:
[legend]

Data Structures

struct  StretchRange
 A definition of a stretch - Bereich. More...

Public Member Functions

virtual bool trySwitch (SUMOTime step)
 Determines whether a switch is possible.
 WAUTSwitchProcedure_Stretch (MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
 Constructor.
 ~WAUTSwitchProcedure_Stretch ()
 Destructor.

Protected Member Functions

void adaptLogic (SUMOTime step)
 Determines the destination program's changes and applies them.
void cutLogic (SUMOTime step, SUMOTime startPos, SUMOTime allCutTime)
 Cuts the logic to synchronize.
SUMOTime getDiffToStartOfPhase (MSTrafficLightLogic &logic, SUMOTime toTime)
 Returns the difference between a given time and the start of the phase.
SUMOTime getGSPTime (const MSTrafficLightLogic &logic) const
 Returns the GSP-value.
bool isPosAtGSP (SUMOTime currentTime, const MSTrafficLightLogic &logic)
 Checks, whether the position of a signal programm is at the GSP ("Good Switching Point").
void stretchLogic (SUMOTime step, SUMOTime startPos, SUMOTime allStretchTime)
 Stretches the logic to synchronize.
void switchToPos (SUMOTime simStep, MSTrafficLightLogic &logic, SUMOTime toTime)
 switches the given logic directly to the given position

Protected Attributes

MSTLLogicControlmyControl
 The control the logic belongs to.
MSTrafficLightLogicmyFrom
 The current program of the tls to switch.
std::vector< StretchRangemyStretchRanges
 the given Stretch-areas for the "to" program, this is 0-based indexed, while the input is 1-based
bool mySwitchSynchron
 Information whether to switch synchron (?).
MSTrafficLightLogicmyTo
 The program to switch the tls to.
WAUTmyWAUT
 The WAUT responsible for switching.

Detailed Description

This class switches using the Stretch algorithm.

Definition at line 671 of file MSTLLogicControl.h.

Constructor & Destructor Documentation

◆ WAUTSwitchProcedure_Stretch()

MSTLLogicControl::WAUTSwitchProcedure_Stretch::WAUTSwitchProcedure_Stretch ( MSTLLogicControl & control,
WAUT & waut,
MSTrafficLightLogic * from,
MSTrafficLightLogic * to,
bool synchron )

Constructor.

Parameters
[in]controlThe responsible tls control
[in]wautThe WAUT to switch
[in]fromThe original tls program
[in]toThe destination tls program
[in]synchronWhether the switch shall be done in synchronuous mode

Definition at line 373 of file MSTLLogicControl.cpp.

References MSTLLogicControl::WAUTSwitchProcedure_Stretch::StretchRange::begin, MSTLLogicControl::WAUTSwitchProcedure_Stretch::StretchRange::end, MSTLLogicControl::WAUTSwitchProcedure_Stretch::StretchRange::fac, MSTLLogicControl::MSTLLogicControl(), myStretchRanges, MSTLLogicControl::WAUTSwitchProcedure::myTo, string2time(), StringUtils::toDouble(), toString(), and MSTLLogicControl::WAUTSwitchProcedure::WAUTSwitchProcedure().

◆ ~WAUTSwitchProcedure_Stretch()

MSTLLogicControl::WAUTSwitchProcedure_Stretch::~WAUTSwitchProcedure_Stretch ( )

Destructor.

Definition at line 389 of file MSTLLogicControl.cpp.

Member Function Documentation

◆ adaptLogic()

void MSTLLogicControl::WAUTSwitchProcedure_Stretch::adaptLogic ( SUMOTime step)
protectedvirtual

Determines the destination program's changes and applies them.

Parameters
[in]stepThe current simulation step
See also
cutLogic
stretchLogic

Reimplemented from MSTLLogicControl::WAUTSwitchProcedure.

Definition at line 393 of file MSTLLogicControl.cpp.

References cutLogic(), MSTLLogicControl::WAUTSwitchProcedure::getGSPTime(), myStretchRanges, MSTLLogicControl::WAUTSwitchProcedure::myTo, stretchLogic(), and StringUtils::toDouble().

◆ cutLogic()

void MSTLLogicControl::WAUTSwitchProcedure_Stretch::cutLogic ( SUMOTime step,
SUMOTime startPos,
SUMOTime allCutTime )
protected

Cuts the logic to synchronize.

Parameters
[in]stepThe current simulation step
[in]startPosThe position in the destination program to switch to
[in]allCutTimeThe amount by which the logic shall be cut

Definition at line 423 of file MSTLLogicControl.cpp.

References MSTLLogicControl::WAUTSwitchProcedure::getDiffToStartOfPhase(), MIN2(), MSTLLogicControl::WAUTSwitchProcedure::myControl, myStretchRanges, and MSTLLogicControl::WAUTSwitchProcedure::myTo.

Referenced by adaptLogic().

Here is the caller graph for this function:

◆ getDiffToStartOfPhase()

SUMOTime MSTLLogicControl::WAUTSwitchProcedure::getDiffToStartOfPhase ( MSTrafficLightLogic & logic,
SUMOTime toTime )
protectedinherited

Returns the difference between a given time and the start of the phase.

Parameters
[in]logicThe logic to consider
[in]toTimeThe time to ask for
Returns
How much time elapsed between the last pahse start and the given time

Definition at line 305 of file MSTLLogicControl.cpp.

References MSTrafficLightLogic::getIndexFromOffset(), and MSTrafficLightLogic::getOffsetFromIndex().

Referenced by MSTLLogicControl::WAUTSwitchProcedure_GSP::adaptLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::cutLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic(), and switchToPos().

Here is the caller graph for this function:

◆ getGSPTime()

SUMOTime MSTLLogicControl::WAUTSwitchProcedure::getGSPTime ( const MSTrafficLightLogic & logic) const
protectedinherited

Returns the GSP-value.

The GSP must be given as a logic's parameter ("GSP").

Parameters
[in]logicThe logic to retrieve the GSP from
Returns
The GSP value; 0 if not given.
See also
MSTrafficLightLogic::getParameterValue

Definition at line 291 of file MSTLLogicControl.cpp.

References Parameterised::getParameter(), and string2time().

Referenced by MSTLLogicControl::WAUTSwitchProcedure_GSP::adaptLogic(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::adaptLogic(), isPosAtGSP(), and trySwitch().

Here is the caller graph for this function:

◆ isPosAtGSP()

bool MSTLLogicControl::WAUTSwitchProcedure::isPosAtGSP ( SUMOTime currentTime,
const MSTrafficLightLogic & logic )
protectedinherited

Checks, whether the position of a signal programm is at the GSP ("Good Switching Point").

The GSP must be given as a logic's parameter ("GSP"). Not the simulation second, but the phase the GSP lies within is used. If the phase the GSP lies within is the same as the logic's current phase, the result is true.

Parameters
[in]currentTimeThe current time step
[in]logicThe logic for which this should be examined
Returns
Whether the current step is the GSP
See also
getGSPValue

Definition at line 297 of file MSTLLogicControl.cpp.

References MSTrafficLightLogic::getCurrentPhaseIndex(), MSTrafficLightLogic::getDefaultCycleTime(), getGSPTime(), MSTrafficLightLogic::getOffsetFromIndex(), and MSTrafficLightLogic::getSpentDuration().

Referenced by trySwitch().

Here is the caller graph for this function:

◆ stretchLogic()

void MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic ( SUMOTime step,
SUMOTime startPos,
SUMOTime allStretchTime )
protected

Stretches the logic to synchronize.

Parameters
[in]stepThe current simulation step
[in]startPosThe position in the destination program to switch to
[in]allStretchTimeThe amount by which the logic shall be streched

Definition at line 464 of file MSTLLogicControl.cpp.

References MSTLLogicControl::WAUTSwitchProcedure::getDiffToStartOfPhase(), MSTLLogicControl::WAUTSwitchProcedure::myControl, myStretchRanges, MSTLLogicControl::WAUTSwitchProcedure::myTo, MSTLLogicControl::WAUTSwitchProcedure::myWAUT, STEPS2TIME, TIME2STEPS, TL, StringUtils::toDouble(), toString(), and WRITE_WARNINGF.

Referenced by adaptLogic().

Here is the caller graph for this function:

◆ switchToPos()

void MSTLLogicControl::WAUTSwitchProcedure::switchToPos ( SUMOTime simStep,
MSTrafficLightLogic & logic,
SUMOTime toTime )
protectedinherited

switches the given logic directly to the given position

Parameters
[in]simStepThe current simulation time
[in]logicThe logic to switch
[in]toTimeThe time offset within the logic's phases to switch to

Definition at line 314 of file MSTLLogicControl.cpp.

References MSTrafficLightLogic::changeStepAndDuration(), MSPhaseDefinition::duration, getDiffToStartOfPhase(), MSTrafficLightLogic::getIndexFromOffset(), MSTrafficLightLogic::getPhase(), and myControl.

Referenced by trySwitch().

Here is the caller graph for this function:

◆ trySwitch()

bool MSTLLogicControl::WAUTSwitchProcedure::trySwitch ( SUMOTime step)
virtualinherited

Determines whether a switch is possible.

Parameters
[in]stepThe current simulation step
Returns
If a switch shall be done, this method should return true.

Reimplemented in MSTLLogicControl::WAUTSwitchProcedure_JustSwitch.

Definition at line 273 of file MSTLLogicControl.cpp.

References adaptLogic(), getGSPTime(), isPosAtGSP(), myFrom, mySwitchSynchron, myTo, and switchToPos().

Referenced by MSTLLogicControl::check2Switch().

Here is the caller graph for this function:

Field Documentation

◆ myControl

MSTLLogicControl& MSTLLogicControl::WAUTSwitchProcedure::myControl
protectedinherited

◆ myFrom

MSTrafficLightLogic* MSTLLogicControl::WAUTSwitchProcedure::myFrom
protectedinherited

The current program of the tls to switch.

Definition at line 584 of file MSTLLogicControl.h.

Referenced by trySwitch(), and WAUTSwitchProcedure().

◆ myStretchRanges

std::vector<StretchRange> MSTLLogicControl::WAUTSwitchProcedure_Stretch::myStretchRanges
protected

the given Stretch-areas for the "to" program, this is 0-based indexed, while the input is 1-based

Definition at line 724 of file MSTLLogicControl.h.

Referenced by adaptLogic(), cutLogic(), stretchLogic(), and WAUTSwitchProcedure_Stretch().

◆ mySwitchSynchron

bool MSTLLogicControl::WAUTSwitchProcedure::mySwitchSynchron
protectedinherited

Information whether to switch synchron (?).

Definition at line 590 of file MSTLLogicControl.h.

Referenced by trySwitch(), and WAUTSwitchProcedure().

◆ myTo

◆ myWAUT

WAUT& MSTLLogicControl::WAUTSwitchProcedure::myWAUT
protectedinherited

The WAUT responsible for switching.

Definition at line 593 of file MSTLLogicControl.h.

Referenced by MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic(), and WAUTSwitchProcedure().


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