109 bool isNewDefault =
true);
127 const std::string& programID);
132 const std::string& state);
257 bool add(
const std::string&
id,
const std::string& programID,
264 bool knows(
const std::string&
id)
const;
280 void switchTo(
const std::string&
id,
const std::string& programID);
295 const std::string& startProg,
SUMOTime period);
307 const std::string& to);
321 void addWAUTJunction(
const std::string& wautid,
const std::string& tls,
322 const std::string& proc,
bool synchron);
335 void closeWAUT(
const std::string& wautid);
354 std::pair<SUMOTime, MSPhaseDefinition>
getPhaseDef(
const std::string& tlid)
const;
#define UNUSED_PARAMETER(x)
Base (microsim) event class.
Representation of a lane in the micro simulation.
The definition of a single phase of a tls logic.
Base class for things to execute if a tls switches to a new phase.
virtual void execute()=0
Executes the action.
virtual ~OnSwitchAction()
Destructor.
This event-class is used to initialise a WAUT switch at a certain time.
MSTLLogicControl & myParent
The control to call.
const std::string & getWAUTID() const
Returns the WAUT-id.
SwitchInitCommand & operator=(const SwitchInitCommand &)
Invalidated assignment operator.
int myIndex
The current index within the WAUT switch table.
~SwitchInitCommand()
Destructor.
SwitchInitCommand(MSTLLogicControl &p, const std::string &wautid, int index)
Constructor.
int & getIndex()
Returns a reference to the index.
SwitchInitCommand(const SwitchInitCommand &)
Invalidated copy constructor.
SUMOTime execute(SUMOTime)
Begins a WAUT switch by executing the command.
std::string myWAUTID
The id of the WAUT that shall switch.
Storage for all programs of a single tls.
void addLink(MSLink *link, MSLane *lane, int pos)
void switchTo(MSTLLogicControl &tlc, const std::string &programID)
void addSwitchCommand(OnSwitchAction *c)
TLSLogicVariants & operator=(const TLSLogicVariants &)
Invalidated assignment operator.
void ignoreLinkIndex(int pos)
void setStateInstantiatingOnline(MSTLLogicControl &tlc, const std::string &state)
bool checkOriginalTLS() const
Verifies traffic lights loaded from the network.
std::vector< OnSwitchAction * > mySwitchActions
The list of actions/commands to execute on switch.
std::map< MSLink *, LinkState > myOriginalLinkStates
Originally loaded link states.
TLSLogicVariants(const TLSLogicVariants &)
Invalidated copy constructor.
std::vector< MSTrafficLightLogic * > getAllLogics() const
void saveState(OutputDevice &out)
MSTrafficLightLogic * getLogic(const std::string &programID) const
TLSLogicVariants()
Constructor.
void executeOnSwitchActions() const
std::map< std::string, MSTrafficLightLogic * > myVariants
A map of subkeys to programs.
MSTrafficLightLogic * myDefaultProgram
The program that would be used in the absence of TraCI.
bool addLogic(const std::string &programID, MSTrafficLightLogic *logic, bool netWasLoaded, bool isNewDefault=true)
Adds a logic (program). In case of an error the logic gets deleted.
~TLSLogicVariants()
Destructor.
MSTrafficLightLogic * myCurrentProgram
The currently used program.
MSTrafficLightLogic * getActive() const
MSTrafficLightLogic * getDefault() const
return the default program (that last used program except TRACI_PROGRAM)
MSTrafficLightLogic * getLogicInstantiatingOff(MSTLLogicControl &tlc, const std::string &programID)
bool isActive(const MSTrafficLightLogic *tl) const
This class switches using the GSP algorithm.
~WAUTSwitchProcedure_GSP()
Destructor.
void adaptLogic(SUMOTime step)
Stretches the destination program's phase to which the tls was switched.
This class simply switches to the next program.
bool trySwitch(SUMOTime step)
Determines whether a switch is possible.
~WAUTSwitchProcedure_JustSwitch()
Destructor.
This class switches using the Stretch algorithm.
~WAUTSwitchProcedure_Stretch()
Destructor.
void adaptLogic(SUMOTime step)
Determines the destination program's changes and applies them.
std::vector< StretchRange > myStretchRanges
the given Stretch-areas for the "to" program, this is 0-based indexed, while the input is 1-based
void cutLogic(SUMOTime step, SUMOTime startPos, SUMOTime allCutTime)
Cuts the logic to synchronize.
void stretchLogic(SUMOTime step, SUMOTime startPos, SUMOTime allStretchTime)
Stretches the logic to synchronize.
This is the abstract base class for switching from one tls program to another.
virtual bool trySwitch(SUMOTime step)
Determines whether a switch is possible.
MSTrafficLightLogic * myTo
The program to switch the tls to.
WAUTSwitchProcedure(const WAUTSwitchProcedure &)
Invalidated copy constructor.
bool isPosAtGSP(SUMOTime currentTime, const MSTrafficLightLogic &logic)
Checks, whether the position of a signal programm is at the GSP ("Good Switching Point")
bool mySwitchSynchron
Information whether to switch synchron (?)
virtual ~WAUTSwitchProcedure()
Destructor.
WAUTSwitchProcedure & operator=(const WAUTSwitchProcedure &)
Invalidated assignment operator.
WAUTSwitchProcedure(MSTLLogicControl &control, WAUT &waut, MSTrafficLightLogic *from, MSTrafficLightLogic *to, bool synchron)
Constructor.
MSTLLogicControl & myControl
The control the logic belongs to.
MSTrafficLightLogic * myFrom
The current program of the tls to switch.
SUMOTime getGSPTime(const MSTrafficLightLogic &logic) const
Returns the GSP-value.
SUMOTime getDiffToStartOfPhase(MSTrafficLightLogic &logic, SUMOTime toTime)
Returns the difference between a given time and the start of the phase.
virtual void adaptLogic(SUMOTime step)
Changes the destination program's phase to which the tls was switched.
void switchToPos(SUMOTime simStep, MSTrafficLightLogic &logic, SUMOTime toTime)
switches the given logic directly to the given position
WAUT & myWAUT
The WAUT responsible for switching.
A class that stores and controls tls and switching of their programs.
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.
MSTLLogicControl & operator=(const MSTLLogicControl &)
Invalidated assignment operator.
void clearState(SUMOTime time, bool quickReload=false)
Clear all tls states before quick-loading state.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
std::vector< WAUTSwitchProcess > myCurrentlySwitched
A list of currently running switching procedures.
std::pair< SUMOTime, MSPhaseDefinition > getPhaseDef(const std::string &tlid) const
return the complete phase definition for a named traffic lights logic
std::map< std::string, TLSLogicVariants * > myLogics
A map from ids to the corresponding variants.
void addWAUT(SUMOTime refTime, const std::string &id, const std::string &startProg, SUMOTime period)
Adds a WAUT definition.
std::vector< std::string > getAllTLIds() const
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
bool closeNetworkReading()
Lets MSTLLogicControl know that the network has been loaded.
void setTrafficLightSignals(SUMOTime t) const
Lets all running (current) tls programs apply their current signal states to links they control.
bool knows(const std::string &id) const
Returns the information whether the named tls is stored.
MSTLLogicControl(const MSTLLogicControl &)
Invalidated copy constructor.
void saveState(OutputDevice &out)
Saves the current tls states into the given stream.
bool myNetWasLoaded
Information whether the net was completely loaded.
void switchOffAll()
switch all logic variants to 'off'
void addWAUTSwitch(const std::string &wautid, SUMOTime when, const std::string &to)
Adds a WAUT switch step to a previously built WAUT.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
MSTLLogicControl()
Constructor.
SUMOTime initWautSwitch(SwitchInitCommand &cmd)
Initialises switching a WAUT.
~MSTLLogicControl()
Destructor.
void check2Switch(SUMOTime step)
Checks whether any WAUT is trying to switch a tls into another program.
std::map< std::string, WAUT * > myWAUTs
A map of ids to corresponding WAUTs.
bool isActive(const MSTrafficLightLogic *tl) const
Returns whether the given tls program is the currently active for his tls.
bool add(const std::string &id, const std::string &programID, MSTrafficLightLogic *logic, bool newDefault=true)
Adds a tls program to the container.
void closeWAUT(const std::string &wautid)
Closes loading of a WAUT.
The parent class for traffic light logics.
Static storage of an output device and its base (abstract) implementation.
std::string startProg
The name of the start program.
std::vector< WAUTSwitch > switches
The list of switches to be done by the WAUT.
std::vector< WAUTJunction > junctions
The list of switches assigned to the WAUT.
SUMOTime period
The period with which to repeat switches.
std::string id
The id of the WAUT.
SUMOTime refTime
The reference time (offset to the switch times)
Storage for a junction assigned to a WAUT.
std::string procedure
The procedure to switch the junction with.
bool synchron
Information whether this junction shall be switched synchron.
std::string junction
The junction name.
Storage for a WAUTs switch point.
SUMOTime when
The time the WAUT shall switch the TLS.
std::string to
The program name the WAUT shall switch the TLS to.
A definition of a stretch - Bereich.
double fac
The weight factor of a stretch/cut area.
SUMOTime end
The end of a stretch/cut area.
SUMOTime begin
The begin of a stretch/cut area.
An initialised switch process.
MSTrafficLightLogic * to
The program to switch the tls to.
std::string junction
The id of the junction to switch.
MSTrafficLightLogic * from
The current program of the tls.
WAUTSwitchProcedure * proc
The used procedure.