 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
21 #ifndef MSTLLogicControl_h
22 #define MSTLLogicControl_h
113 bool isNewDefault =
true);
128 const std::string& programID);
133 const std::string& state);
267 bool add(
const std::string&
id,
const std::string& programID,
276 bool knows(
const std::string&
id)
const;
294 void switchTo(
const std::string&
id,
const std::string& programID);
310 const std::string& startProg);
322 const std::string& to);
336 void addWAUTJunction(
const std::string& wautid,
const std::string& tls,
337 const std::string& proc,
bool synchron);
350 void closeWAUT(
const std::string& wautid);
369 std::pair<SUMOTime, MSPhaseDefinition>
getPhaseDef(
const std::string& tlid)
const;
std::pair< SUMOTime, MSPhaseDefinition > getPhaseDef(const std::string &tlid) const
return the complete phase definition for a named traffic lights logic
void addWAUTSwitch(const std::string &wautid, SUMOTime when, const std::string &to)
Adds a WAUT switch step to a previously built WAUT.
WAUT & myWAUT
The WAUT responsible for switching.
bool trySwitch(SUMOTime step)
Determines whether a switch is possible.
std::vector< WAUTSwitchProcess > myCurrentlySwitched
A list of currently running switching procedures.
SUMOTime getDiffToStartOfPhase(MSTrafficLightLogic &logic, SUMOTime toTime)
Returns the difference between a given time and the start of the phase.
void stretchLogic(SUMOTime step, SUMOTime startPos, SUMOTime allStretchTime)
Stretches the logic to synchronize.
std::string junction
The id of the junction to switch.
SwitchInitCommand(MSTLLogicControl &p, const std::string &wautid, int index)
Constructor.
bool addLogic(const std::string &programID, MSTrafficLightLogic *logic, bool netWasLoaded, bool isNewDefault=true)
Adds a logic (program)
bool isActive(const MSTrafficLightLogic *tl) const
Returns whether the given tls program is the currently active for his tls.
Representation of a lane in the micro simulation.
Storage for a junction assigned to a WAUT.
virtual void execute()=0
Executes the action.
~TLSLogicVariants()
Destructor.
WAUTSwitchProcedure_GSP(MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
Constructor.
void adaptLogic(SUMOTime step)
Determines the destination program's changes and applies them.
bool checkOriginalTLS() const
Verifies traffic lights loaded from the network.
SUMOTime when
The time the WAUT shall switch the TLS.
MSTLLogicControl()
Constructor.
std::vector< std::string > getAllTLIds() const
WAUTSwitchProcedure * proc
The used procedure.
MSTLLogicControl & operator=(const MSTLLogicControl &)
Invalidated assignment operator.
void addWAUTJunction(const std::string &wautid, const std::string &tls, const std::string &proc, bool synchron)
Adds a tls to the list of tls to be switched by the named WAUT.
MSTrafficLightLogic * myFrom
The current program of the tls to switch.
std::map< MSLink *, LinkState > myOriginalLinkStates
Originally loaded link states.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
This class switches using the GSP algorithm.
StretchBereichDef getStretchBereichDef(MSTrafficLightLogic *from, int index) const
Returns the numbered Stretch-area for the given program.
void switchToPos(SUMOTime simStep, MSTrafficLightLogic &logic, SUMOTime toTime)
switches the given logic directly to the given position
MSTrafficLightLogic * myTo
The program to switch the tls to.
int & getIndex()
Returns a reference to the index.
MSTLLogicControl & myControl
The control the logic belongs to.
~WAUTSwitchProcedure_JustSwitch()
Destructor.
std::map< std::string, TLSLogicVariants * > myLogics
A map from ids to the corresponding variants.
std::string to
The program name the WAUT shall switch the TLS to.
double fac
The weight factor of a stretch/cut area.
void setTrafficLightSignals(SUMOTime t) const
Lets all running (current) tls programs apply their current signal states to links they control.
bool add(const std::string &id, const std::string &programID, MSTrafficLightLogic *logic, bool newDefault=true)
Adds a tls program to the container.
int getStretchAreaNo(MSTrafficLightLogic *from) const
Returns the number of given Stretch-areas for the given program.
virtual ~OnSwitchAction()
Destructor.
void switchOffAll()
switch all logic variants to 'off'
bool knows(const std::string &id) const
Returns the information whether the named tls is stored.
MSTrafficLightLogic * getActive() const
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
MSTrafficLightLogic * getLogic(const std::string &programID) const
This is the abstract base class for switching from one tls program to another.
MSTrafficLightLogic * from
The current program of the tls.
virtual ~WAUTSwitchProcedure()
Destructor.
WAUTSwitchProcedure_Stretch & operator=(const WAUTSwitchProcedure_Stretch &)
Invalidated assignment operator.
std::vector< MSTrafficLightLogic * > getAllLogics() const
WAUTSwitchProcedure_GSP & operator=(const WAUTSwitchProcedure_GSP &)
Invalidated assignment operator.
WAUTSwitchProcedure_Stretch(MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
Constructor.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
Storage for a WAUTs switch point.
An initialised switch process.
void addLink(MSLink *link, MSLane *lane, int pos)
std::map< std::string, WAUT * > myWAUTs
A map of ids to corresponding WAUTs.
bool myNetWasLoaded
Information whether the net was completely loaded.
void addWAUT(SUMOTime refTime, const std::string &id, const std::string &startProg)
Adds a WAUT definition.
SUMOTime execute(SUMOTime)
Begins a WAUT switch by executing the command.
bool trySwitch(SUMOTime step)
Determines whether a switch is possible.
WAUTSwitchProcedure(MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
Constructor.
void switchTo(MSTLLogicControl &tlc, const std::string &programID)
The parent class for traffic light logics.
std::vector< WAUTJunction > junctions
The list of switches assigned to the WAUT.
void addSwitchCommand(OnSwitchAction *c)
bool isActive(const MSTrafficLightLogic *tl) const
SUMOTime initWautSwitch(SwitchInitCommand &cmd)
Initialises switching a WAUT.
This class switches using the Stretch algorithm.
MSTrafficLightLogic * getLogicInstantiatingOff(MSTLLogicControl &tlc, const std::string &programID)
double end
The end of a stretch/cut area (time, in s)
std::vector< WAUTSwitch > switches
The list of switches to be done by the WAUT.
SwitchInitCommand & operator=(const SwitchInitCommand &)
Invalidated assignment operator.
std::vector< OnSwitchAction * > mySwitchActions
The list of actions/commands to execute on switch.
std::map< std::string, MSTrafficLightLogic * > myVariants
A map of subkeys to programs.
std::string id
The id of the WAUT.
SUMOTime refTime
The reference time (offset to the switch times)
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
void closeWAUT(const std::string &wautid)
Closes loading of a WAUT.
void setStateInstantiatingOnline(MSTLLogicControl &tlc, const std::string &state)
WAUTSwitchProcedure_JustSwitch(MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
Constructor.
bool isPosAtGSP(SUMOTime currentTime, const MSTrafficLightLogic &logic)
Checks, whether the position of a signal programm is at the GSP ("GuenstigerUmschaltPunkt")
std::string startProg
The name of the start program.
int getGSPValue(const MSTrafficLightLogic &logic) const
Returns the GSP-value.
void ignoreLinkIndex(int pos)
This class simply switches to the next program.
std::string myWAUTID
The id of the WAUT that shall switch.
~MSTLLogicControl()
Destructor.
Base (microsim) event class.
~SwitchInitCommand()
Destructor.
bool synchron
Information whether this junction shall be switched synchron.
~WAUTSwitchProcedure_GSP()
Destructor.
std::string junction
The junction name.
Storage for all programs of a single tls.
This event-class is used to initialise a WAUT switch at a certain time.
int myIndex
The current index within the WAUT switch table.
MSTrafficLightLogic * to
The program to switch the tls to.
virtual bool trySwitch(SUMOTime step)=0
Determines whether a switch is possible.
void cutLogic(SUMOTime step, SUMOTime startPos, SUMOTime allCutTime)
Cuts the logic to synchronize.
void adaptLogic(SUMOTime step)
Stretches the destination program's phase to which the tls was switched.
A class that stores and controls tls and switching of their programs.
void executeOnSwitchActions() const
TLSLogicVariants & operator=(const TLSLogicVariants &)
Invalidated assignment operator.
bool trySwitch(SUMOTime step)
Determines whether a switch is possible.
A definition of a stretch - Bereich.
std::string procedure
The procedure to switch the junction with.
The definition of a single phase of a tls logic.
Base class for things to execute if a tls switches to a new phase.
TLSLogicVariants()
Constructor.
bool mySwitchSynchron
Information whether to switch synchron (?)
MSTLLogicControl & myParent
The control to call.
void check2Switch(SUMOTime step)
Checks whether any WAUT is trying to switch a tls into another program.
WAUTSwitchProcedure & operator=(const WAUTSwitchProcedure &)
Invalidated assignment operator.
~WAUTSwitchProcedure_Stretch()
Destructor.
WAUTSwitchProcedure_JustSwitch & operator=(const WAUTSwitchProcedure_JustSwitch &)
Invalidated assignment operator.
double begin
The begin of a stretch/cut area (time, in s)
MSTrafficLightLogic * myCurrentProgram
The currently used program.
const std::string & getWAUTID() const
Returns the WAUT-id.
bool closeNetworkReading()
Lets MSTLLogicControl know that the network has been loaded.