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