Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
Command_SaveTLSSwitches Class Reference

Writes information about the green durations of a tls. More...

#include <Command_SaveTLSSwitches.h>

Inheritance diagram for Command_SaveTLSSwitches:
[legend]
Collaboration diagram for Command_SaveTLSSwitches:
[legend]

Public Member Functions

 Command_SaveTLSSwitches (const MSTLLogicControl::TLSLogicVariants &logics, OutputDevice &od)
 Constructor.
 
virtual SUMOTime shiftTime (SUMOTime, SUMOTime, SUMOTime)
 Reschedule or deschedule the command when quick-loading state.
 
 ~Command_SaveTLSSwitches ()
 Destructor.
 
Derived from Command
SUMOTime execute (SUMOTime currentTime)
 Writes the output if a change occurred.
 

Data Fields

int priority = 0
 

Private Member Functions

 Command_SaveTLSSwitches (const Command_SaveTLSSwitches &)
 Invalidated copy constructor.
 
Command_SaveTLSSwitchesoperator= (const Command_SaveTLSSwitches &)
 Invalidated assignment operator.
 

Private Attributes

const MSTLLogicControl::TLSLogicVariantsmyLogics
 The traffic light logic to use.
 
OutputDevicemyOutputDevice
 The device to write to.
 
std::map< int, SUMOTimemyPreviousLinkStates
 Storage for prior states; map from signal group to last green time begin.
 

Detailed Description

Writes information about the green durations of a tls.

Todo:
Revalidate this - as tls are not seting the link information directly ater being switched, the computed information may be delayed

Definition at line 46 of file Command_SaveTLSSwitches.h.

Constructor & Destructor Documentation

◆ Command_SaveTLSSwitches() [1/2]

Command_SaveTLSSwitches::Command_SaveTLSSwitches ( const MSTLLogicControl::TLSLogicVariants logics,
OutputDevice od 
)

Constructor.

Parameters
[in]tllsThe logic to write state of
[in]odThe output device to write the state into

Definition at line 38 of file Command_SaveTLSSwitches.cpp.

References MSEventControl::addEvent(), MSNet::getEndOfTimestepEvents(), MSNet::getInstance(), myOutputDevice, and OutputDevice::writeXMLHeader().

◆ ~Command_SaveTLSSwitches()

Command_SaveTLSSwitches::~Command_SaveTLSSwitches ( )

Destructor.

Definition at line 46 of file Command_SaveTLSSwitches.cpp.

◆ Command_SaveTLSSwitches() [2/2]

Command_SaveTLSSwitches::Command_SaveTLSSwitches ( const Command_SaveTLSSwitches )
private

Invalidated copy constructor.

Member Function Documentation

◆ execute()

SUMOTime Command_SaveTLSSwitches::execute ( SUMOTime  currentTime)
virtual

Writes the output if a change occurred.

Called in each tme step, this class computes which link have red since the last tls switch and writes the information about their green duration into the given stream.

Information whether a link had green and since when is stored in "myPreviousLinkStates".

Parameters
[in]currentTimeThe current simulation time
Returns
Always DELTA_T (will be executed in next time step)
See also
Command

Implements Command.

Definition at line 51 of file Command_SaveTLSSwitches.cpp.

References DELTA_T, MSTLLogicControl::TLSLogicVariants::getActive(), MSTrafficLightLogic::getCurrentPhaseDef(), Named::getID(), MSLink::getLane(), MSTrafficLightLogic::getLanesAt(), MSTrafficLightLogic::getLinks(), MSTrafficLightLogic::getProgramID(), MSPhaseDefinition::getState(), LINKSTATE_TL_GREEN_MAJOR, LINKSTATE_TL_GREEN_MINOR, myLogics, myOutputDevice, myPreviousLinkStates, and time2string().

◆ operator=()

Command_SaveTLSSwitches & Command_SaveTLSSwitches::operator= ( const Command_SaveTLSSwitches )
private

Invalidated assignment operator.

◆ shiftTime()

virtual SUMOTime Command::shiftTime ( SUMOTime  ,
SUMOTime  ,
SUMOTime   
)
inlinevirtualinherited

Reschedule or deschedule the command when quick-loading state.

The implementations should return -1 if the command shall not be re-scheduled, or a value >= 0 that describe the new time at which the command shall be executed again.

Parameters
[in]currentTimeThe current simulation time
[in]execTimeThe time at which the command would have been executed
[in]newTimeThe simulation time at which the simulation is restarted
Returns
The time at which the command shall be executed again

Reimplemented in MSTrafficLightLogic::SwitchCommand, and MSCalibrator::CalibratorCommand.

Definition at line 83 of file Command.h.

Field Documentation

◆ myLogics

const MSTLLogicControl::TLSLogicVariants& Command_SaveTLSSwitches::myLogics
private

The traffic light logic to use.

Definition at line 86 of file Command_SaveTLSSwitches.h.

Referenced by execute().

◆ myOutputDevice

OutputDevice& Command_SaveTLSSwitches::myOutputDevice
private

The device to write to.

Definition at line 83 of file Command_SaveTLSSwitches.h.

Referenced by Command_SaveTLSSwitches(), and execute().

◆ myPreviousLinkStates

std::map<int, SUMOTime> Command_SaveTLSSwitches::myPreviousLinkStates
private

Storage for prior states; map from signal group to last green time begin.

Definition at line 89 of file Command_SaveTLSSwitches.h.

Referenced by execute().

◆ priority

int Command::priority = 0
inherited

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