24 #ifndef MSTLLogicControl_h 25 #define MSTLLogicControl_h 109 bool checkOriginalTLS()
const;
120 bool isNewDefault =
true);
127 void saveInitialStates();
135 const std::string& programID);
140 const std::string& state);
143 void executeOnSwitchActions()
const;
273 bool add(
const std::string&
id,
const std::string& programID,
282 bool knows(
const std::string&
id)
const;
300 void switchTo(
const std::string&
id,
const std::string& programID);
316 const std::string& startProg);
328 const std::string& to);
342 void addWAUTJunction(
const std::string& wautid,
const std::string& tls,
343 const std::string& proc,
bool synchron);
356 void closeWAUT(
const std::string& wautid);
375 std::pair<SUMOTime, MSPhaseDefinition>
getPhaseDef(
const std::string& tlid)
const;
398 : myParent(p), myWAUTID(wautid), myIndex(index) { }
424 return myParent.initWautSwitch(*
this);
535 : myFrom(from), myTo(to), mySwitchSynchron(synchron), myWAUT(waut), myControl(control) { }
546 virtual bool trySwitch(
SUMOTime step) = 0;
bool add(const std::string &id, const std::string &programID, MSTrafficLightLogic *logic, bool newDefault=true)
Adds a tls program to the container.
void switchOffAll()
switch all logic variants to 'off'
std::map< MSLink *, LinkState > myOriginalLinkStates
Originally loaded link states.
int & getIndex()
Returns a reference to the index.
SUMOReal end
The end of a stretch/cut area (time, in s)
std::map< std::string, TLSLogicVariants * > myLogics
A map from ids to the corresponding variants.
Storage for all programs of a single tls.
Base class for things to execute if a tls switches to a new phase.
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
std::map< std::string, MSTrafficLightLogic * > myVariants
A map of subkeys to programs.
SwitchInitCommand(MSTLLogicControl &p, const std::string &wautid, int index)
Constructor.
~MSTLLogicControl()
Destructor.
A definition of a stretch - Bereich.
std::string myWAUTID
The id of the WAUT that shall switch.
bool isActive(const MSTrafficLightLogic *tl) const
Returns whether the given tls program is the currently active for his tls.
std::string junction
The id of the junction to switch.
std::string procedure
The procedure to switch the junction with.
MSTLLogicControl & myParent
The control to call.
virtual ~OnSwitchAction()
Destructor.
MSTrafficLightLogic * myTo
The program to switch the tls to.
virtual ~WAUTSwitchProcedure()
Destructor.
MSTLLogicControl()
Constructor.
Base (microsim) event class.
WAUT & myWAUT
The WAUT responsible for switching.
void closeWAUT(const std::string &wautid)
Closes loading of a WAUT.
SUMOTime initWautSwitch(SwitchInitCommand &cmd)
Initialises switching a WAUT.
bool myNetWasLoaded
Information whether the net was completely loaded.
Storage for a junction assigned to a WAUT.
A class that stores and controls tls and switching of their programs.
bool mySwitchSynchron
Information whether to switch synchron (?)
MSTLLogicControl & myControl
The control the logic belongs to.
std::pair< SUMOTime, MSPhaseDefinition > getPhaseDef(const std::string &tlid) const
return the complete phase definition for a named traffic lights logic
MSTLLogicControl & operator=(const MSTLLogicControl &)
Invalidated assignment operator.
WAUTSwitchProcedure * proc
The used procedure.
WAUTSwitchProcedure(MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
Constructor.
SUMOReal fac
The weight factor of a stretch/cut area.
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
This class simply switches to the next program.
bool synchron
Information whether this junction shall be switched synchron.
MSTrafficLightLogic * to
The program to switch the tls to.
This class switches using the Stretch algorithm.
void check2Switch(SUMOTime step)
Checks whether any WAUT is trying to switch a tls into another program.
int myIndex
The current index within the WAUT switch table.
SUMOTime when
The time the WAUT shall switch the TLS.
SUMOReal begin
The begin of a stretch/cut area (time, in s)
std::vector< OnSwitchAction * > mySwitchActions
The list of actions/commands to execute on switch.
std::string startProg
The name of the start program.
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.
std::vector< WAUTJunction > junctions
The list of switches assigned to the WAUT.
bool knows(const std::string &id) const
Returns the information whether the named tls is stored.
std::vector< WAUTSwitchProcess > myCurrentlySwitched
A list of currently running switching procedures.
bool closeNetworkReading()
Lets MSTLLogicControl know that the network has been loaded.
An initialised switch process.
std::vector< WAUTSwitch > switches
The list of switches to be done by the WAUT.
virtual void execute()=0
Executes the action.
This event-class is used to initialise a WAUT switch at a certain time.
void addWAUT(SUMOTime refTime, const std::string &id, const std::string &startProg)
Adds a WAUT definition.
This class switches using the GSP algorithm.
SUMOTime refTime
The reference time (offset to the switch times)
This is the abstract base class for switching from one tls program to another.
const std::string & getWAUTID() const
Returns the WAUT-id.
std::string id
The id of the WAUT.
~SwitchInitCommand()
Destructor.
std::map< std::string, WAUT * > myWAUTs
A map of ids to corresponding WAUTs.
The parent class for traffic light logics.
Storage for a WAUTs switch point.
void addWAUTSwitch(const std::string &wautid, SUMOTime when, const std::string &to)
Adds a WAUT switch step to a previously built WAUT.
std::string to
The program name the WAUT shall switch the TLS to.
MSTrafficLightLogic * from
The current program of the tls.
std::vector< std::string > getAllTLIds() const
void setTrafficLightSignals(SUMOTime t) const
Lets all running (current) tls programs apply their current signal states to links they control...
MSTrafficLightLogic * myFrom
The current program of the tls to switch.
The definition of a single phase of a tls logic.
Representation of a lane in the micro simulation.
SUMOTime execute(SUMOTime)
Begins a WAUT switch by executing the command.
MSTrafficLightLogic * myCurrentProgram
The currently used program.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
std::string junction
The junction name.