24 #ifndef MSTrafficLightLogic_h 25 #define MSTrafficLightLogic_h 69 typedef std::vector<MSPhaseDefinition*>
Phases;
93 const std::string&
id,
94 const std::string& programID,
96 const std::map<std::string, std::string>& parameters);
232 virtual const Phases&
getPhases()
const = 0;
SUMOTime myCurrentDurationIncrement
A value for enlarge the current duration.
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
Builds detectors for microsim.
void initMesoTLSPenalties()
initialize optional meso penalties
MSTLLogicControl & myTLControl
The responsible traffic lights control.
virtual SUMOTime getOffsetFromIndex(int index) const =0
Returns the position (start of a phase during a cycle) from of a given step.
std::vector< SUMOTime > myOverridingTimes
A list of duration overrides.
SwitchCommand(MSTLLogicControl &tlcontrol, MSTrafficLightLogic *tlLogic, SUMOTime nextSwitch)
Constructor.
std::string myProgramID
The id of the logic.
SUMOTime myAssumedNextSwitch
Assumed switch time (may change in case of adaptive traffic lights)
virtual void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)=0
Changes the current phase and her duration.
static const LaneVector myEmptyLaneVector
An empty lane vector.
virtual SUMOTime getPhaseIndexAtTime(SUMOTime simStep) const =0
Returns the index of the logic at the given simulation step.
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
virtual const MSPhaseDefinition & getPhase(int givenstep) const =0
Returns the definition of the phase from the given position within the plan.
virtual int getCurrentPhaseIndex() const =0
Returns the current index within the program.
MSTrafficLightLogic(MSTLLogicControl &tlcontrol, const std::string &id, const std::string &programID, SUMOTime delay, const std::map< std::string, std::string > ¶meters)
Constructor.
SUMOTime getNextSwitchTime() const
Returns the assumed next switch time.
Base (microsim) event class.
bool setTrafficLightSignals(SUMOTime t) const
Applies the current signal states to controlled links.
void resetLinkStates(const std::map< MSLink *, LinkState > &vals) const
Resets the states of controlled links.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
int getLinkIndex(const MSLink *const link) const
Returns the index of the given link.
const LinkVector & getLinksAt(int i) const
Returns the list of links that are controlled by the signals at the given position.
The simulated network and simulation perfomer.
LaneVectorVector myLanes
The list of LaneVectors; each vector contains the incoming lanes that belong to the same link index...
const LaneVector & getLanesAt(int i) const
Returns the list of lanes that are controlled by the signals at the given position.
virtual ~MSTrafficLightLogic()
Destructor.
A class that stores and controls tls and switching of their programs.
SUMOTime getDefaultCycleTime() const
Returns the cycle time (in ms)
void deschedule(MSTrafficLightLogic *tlLogic)
Marks this swicth as invalid (if the phase duration has changed, f.e.)
Class realising the switch between the traffic light phases.
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
~SwitchCommand()
Destructor.
virtual int getPhaseNumber() const =0
Returns the number of phases.
SUMOTime myDefaultCycleTime
The cycle time (without changes)
const std::string & getProgramID() const
Returns this tl-logic's id.
MSTrafficLightLogic * myTLLogic
The logic to be executed on a switch.
virtual void init(NLDetectorBuilder &nb)
Initialises the tls with information about incoming lanes.
virtual void adaptLinkInformationFrom(const MSTrafficLightLogic &logic)
Applies information about controlled links and lanes from the given logic.
std::map< MSLink *, LinkState > collectLinkStates() const
Returns the (uncontrolled) states of the controlled links.
virtual const std::string getLogicType() const =0
Returns the type of the logic as a string.
An upper class for objects with additional parameters.
void setCurrentDurationIncrement(SUMOTime delay)
Delays current phase by the given delay.
Base class for objects which have an id.
std::vector< MSLink * > LinkVector
Definition of the list of links that participate in this tl-light.
SwitchCommand & operator=(const SwitchCommand &)
Invalidated assignment operator.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
virtual const Phases & getPhases() const =0
Returns the phases of this tls program.
void addOverridingDuration(SUMOTime duration)
Changes the duration of the next phase.
LinkVectorVector myLinks
The list of LinkVectors; each vector contains the links that belong to the same link index...
std::vector< MSLane * > LaneVector
Definition of the list of links that participate in this tl-light.
std::vector< LaneVector > LaneVectorVector
Definition of a list that holds lists of links that do have the same attribute.
SUMOTime getNextSwitchTime() const
Returns the assumed next switch time.
virtual void addLink(MSLink *link, MSLane *lane, int pos)
Adds a link on building.
SwitchCommand * mySwitchCommand
The current switch command.
The parent class for traffic light logics.
bool myAmValid
Information whether this switch command is still valid.
virtual SUMOTime trySwitch()=0
Switches to the next phase.
The definition of a single phase of a tls logic.
Representation of a lane in the micro simulation.
SUMOTime execute(SUMOTime currentTime)
Executes the regarded junction's "trySwitch"- method.
virtual int getIndexFromOffset(SUMOTime offset) const =0
Returns the step (the phasenumber) of a given position of the cycle.