 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
43 const std::string&
id,
const std::string& programID,
const TrafficLightType logicType,
const Phases& phases,
45 const std::map<std::string, std::string>& parameters) :
49 for (
int i = 0; i < (int)
myPhases.size(); i++) {
116 assert((
int)
myPhases.size() > givenStep);
139 for (
int i = 0; i <
myStep; i++) {
152 assert(index < (
int)
myPhases.size());
157 for (
int i = 0; i < index; i++) {
171 for (
int i = 0; i < (int)
myPhases.size(); i++) {
173 if (testPos > offset) {
176 if (testPos == offset) {
177 assert((
int)
myPhases.size() > (i + 1));
203 assert(step < (
int)phases.size());
212 for (
int i = 0; i < (int)
myPhases.size(); i++) {
void setPhases(const Phases &phases, int index)
Replaces the phases and set the phase index.
bool setTrafficLightSignals(SUMOTime t) const
Applies the current signal states to controlled links.
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
int getPhaseNumber() const
Returns the number of phases.
SUMOTime myLastSwitch
Stores the timestep of the last on-switched of the phase.
std::vector< SUMOTime > myOverridingTimes
A list of duration overrides.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
int getCurrentPhaseIndex() const
Returns the current index within the program.
MSSimpleTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const TrafficLightType logicType, const Phases &phases, int step, SUMOTime delay, const std::map< std::string, std::string > ¶meters)
Constructor.
Class realising the switch between the traffic light phases.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
void deschedule(MSTrafficLightLogic *tlLogic)
Marks this swicth as invalid (if the phase duration has changed, f.e.)
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
SwitchCommand * mySwitchCommand
The current switch command.
SUMOTime myCurrentDurationIncrement
A value for enlarge the current duration.
SUMOTime duration
The duration of the phase.
virtual SUMOTime trySwitch()
Switches to the next phase.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
SUMOTime getOffsetFromIndex(int index) const
Returns the position (start of a phase during a cycle) from of a given step.
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
The parent class for traffic light logics.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
void deletePhases()
frees memory responsibilities
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
~MSSimpleTrafficLightLogic()
Destructor.
Phases myPhases
The list of phases this logic uses.
const Phases & getPhases() const
Returns the phases of this tls program.
SUMOTime myDefaultCycleTime
The cycle time (without changes)
A class that stores and controls tls and switching of their programs.
void executeOnSwitchActions() const
The definition of a single phase of a tls logic.
int myStep
The current step.
const std::string & getID() const
Returns the id.