44 std::vector<std::string>
62 std::vector<TraCILogic>
64 std::vector<TraCILogic> result;
67 TraCILogic l(logic->getProgramID(), 0, logic->getCurrentPhaseIndex());
69 for (
int j = 0; j < logic->getPhaseNumber(); ++j) {
73 result.emplace_back(l);
79 std::vector<std::string>
81 std::set<std::string> junctionIDs;
84 for (
const MSLink* l : llinks) {
85 junctionIDs.insert(l->getJunction()->getID());
88 return std::vector<std::string>(junctionIDs.begin(), junctionIDs.end());
92 std::vector<std::string>
94 std::vector<std::string> laneIDs;
97 for (
const MSLane* l : llanes) {
98 laneIDs.push_back(l->getID());
105 std::vector<std::vector<TraCILink> >
107 std::vector<std::vector<TraCILink> > result;
110 for (
int i = 0; i < (int)lanes.size(); ++i) {
111 std::vector<TraCILink> subList;
115 for (
int j = 0; j < (int)llanes.size(); ++j) {
121 subList.emplace_back(
TraCILink(llanes[j]->getID(), via, to));
123 result.emplace_back(subList);
168 if (index < 0 || active->getPhaseNumber() <= index) {
202 throw TraCIException(
"set program: parameter index must be less than parameter phase number.");
204 std::vector<MSPhaseDefinition*> phases;
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
const std::string & getState() const
Returns the state within this phase.
Storage for all programs of a single tls.
static std::string getRedYellowGreenState(const std::string &tlsID)
virtual void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)=0
Changes the current phase and her duration.
MSLane * getViaLane() const
Returns the following inner lane.
static std::vector< std::string > getControlledJunctions(const std::string &tlsID)
static void setParameter(const std::string &tlsID, const std::string ¶mName, const std::string &value)
virtual const MSPhaseDefinition & getPhase(int givenstep) const =0
Returns the definition of the phase from the given position within the plan.
static std::vector< std::string > getIDList()
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::map< std::string, std::string > subParameter
std::vector< std::string > getAllTLIds() const
virtual int getCurrentPhaseIndex() const =0
Returns the current index within the program.
static std::vector< std::string > getControlledLanes(const std::string &tlsID)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSTrafficLightLogic * getLogic(const std::string &programID) const
std::vector< TraCIPhase > phases
A fixed traffic light logic.
static void setRedYellowGreenState(const std::string &tlsID, const std::string &state)
SUMOTime getNextSwitchTime() const
Returns the assumed next switch time.
std::vector< MSTrafficLightLogic * > getAllLogics() const
const std::string & getID() const
Returns the id.
SUMOTime duration
The duration of the phase.
static MSTLLogicControl::TLSLogicVariants & getTLS(const std::string &id)
bool addLogic(const std::string &programID, MSTrafficLightLogic *logic, bool netWasLoaded, bool isNewDefault=true)
Adds a logic (program)
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual int getPhaseNumber() const =0
Returns the number of phases.
MSTrafficLightLogic * getActive() const
MSLane * getLane() const
Returns the connected lane.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
static void setPhaseDuration(const std::string &tlsID, const SUMOTime phaseDuration)
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
void setStateInstantiatingOnline(MSTLLogicControl &tlc, const std::string &state)
static std::vector< TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID)
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
std::vector< MSLink * > LinkVector
Definition of the list of links that are subjected to this tls.
void switchTo(MSTLLogicControl &tlc, const std::string &programID)
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
std::vector< LaneVector > LaneVectorVector
Definition of a list that holds lists of lanes that do have the same attribute.
SUMOTime maxDuration
The maximum duration of the phase.
static SUMOTime getNextSwitch(const std::string &tlsID)
static void setPhase(const std::string &tlsID, const int index)
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
static SUMOTime getPhaseDuration(const std::string &tlsID)
static void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const TraCILogic &logic)
SUMOTime minDuration
The minimum duration of the phase.
The parent class for traffic light logics.
static void setProgram(const std::string &tlsID, const std::string &programID)
const std::string & getProgramID() const
Returns this tl-logic's id.
static std::string getProgram(const std::string &tlsID)
static int getPhase(const std::string &tlsID)
static std::string getParameter(const std::string &tlsID, const std::string ¶mName)
Representation of a lane in the micro simulation.
The definition of a single phase of a tls logic.
static std::vector< std::vector< TraCILink > > getControlledLinks(const std::string &tlsID)