40 :
MSTrafficLightLogic(tlcontrol, id, programID, offset, logicType, delay, parameters), myPhases(phases),
42 for (
int i = 0; i < (int)
myPhases.size(); i++) {
117 assert((
int)
myPhases.size() > givenStep);
148 assert(index < (
int)
myPhases.size());
150 for (
int i = 0; i < index; i++) {
165 for (
int i = 0; i < (int)
myPhases.size(); i++) {
170 if (testPos == pos) {
171 assert((
int)
myPhases.size() > (i + 1));
197 assert(step < (
int)phases.size());
206 for (
int i = 0; i < (int)
myPhases.size(); i++) {
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
The definition of a single phase of a tls logic.
SUMOTime myLastSwitch
Stores the timestep of the last on-switched of the phase.
SUMOTime duration
The duration of the phase.
Phases myPhases
The list of phases this logic uses.
int getIndexFromOffset(SUMOTime offset) const
Returns the step (the phasenumber) of a given position of the cycle.
void proceedToNextStep()
Proceed to the next step.
void deletePhases()
frees memory responsibilities
void setPhases(const Phases &phases, int index)
Replaces the phases and set the phase index.
const Phases & getPhases() const
Returns the phases of this tls program.
int getCurrentPhaseIndex() const
Returns the current index within the program.
SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const
Returns the index of the logic at the given simulation step.
SUMOTime getOffsetFromIndex(int index) const
Returns the position (start of a phase during a cycle) from of a given step.
int getPhaseNumber() const
Returns the number of phases.
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
void setStep(int step)
Forces a specific step.
~MSPhasedTrafficLightLogic()
Destructor.
int myStep
The current step.
MSPhasedTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, const SUMOTime offset, const TrafficLightType logicType, const Phases &phases, int step, SUMOTime delay, const Parameterised::Map ¶meters)
Constructor.
const MSPhaseDefinition & getCurrentPhaseDef() const
Returns the definition of the current phase.
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
A class that stores and controls tls and switching of their programs.
Class realising the switch between the traffic light phases.
void deschedule(MSTrafficLightLogic *tlLogic)
Marks this swicth as invalid (if the phase duration has changed, f.e.)
The parent class for traffic light logics.
SUMOTime myDefaultCycleTime
The cycle time (without changes)
SwitchCommand * mySwitchCommand
The current switch command.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
std::map< std::string, std::string > Map
parameters map