43 std::vector<std::string>
61 std::vector<TraCILogic>
63 std::vector<TraCILogic> result;
66 TraCILogic l(logic->getProgramID(), 0, logic->getCurrentPhaseIndex());
68 for (
int j = 0; j < logic->getPhaseNumber(); ++j) {
72 result.emplace_back(l);
78 std::vector<std::string>
80 std::set<std::string> junctionIDs;
83 for (
const MSLink* l : llinks) {
84 junctionIDs.insert(l->getJunction()->getID());
87 return std::vector<std::string>(junctionIDs.begin(), junctionIDs.end());
91 std::vector<std::string>
93 std::vector<std::string> laneIDs;
96 for (
const MSLane* l : llanes) {
97 laneIDs.push_back(l->getID());
104 std::vector<std::vector<TraCILink> >
106 std::vector<std::vector<TraCILink> > result;
109 for (
int i = 0; i < (int)lanes.size(); ++i) {
110 std::vector<TraCILink> subList;
114 for (
int j = 0; j < (int)llanes.size(); ++j) {
120 subList.emplace_back(
TraCILink(llanes[j]->getID(), via, to));
122 result.emplace_back(subList);
167 if (index < 0 || active->getPhaseNumber() <= index) {
201 throw TraCIException(
"set program: parameter index must be less than parameter phase number.");
203 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 int getPhase(const std::string &tlsID)
static void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const TraCILogic &logic)
static void setPhaseDuration(const std::string &tlsID, const SUMOTime phaseDuration)
static void setPhase(const std::string &tlsID, const int index)
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.
std::map< std::string, std::string > subParameter
virtual const MSPhaseDefinition & getPhase(int givenstep) const =0
Returns the definition of the phase from the given position within the plan.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static std::vector< std::string > getControlledJunctions(const std::string &tlsID)
std::vector< std::string > getAllTLIds() const
virtual int getCurrentPhaseIndex() const =0
Returns the current index within the program.
static void setProgram(const std::string &tlsID, const std::string &programID)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSTrafficLightLogic * getLogic(const std::string &programID) const
A fixed traffic light logic.
SUMOTime getNextSwitchTime() const
Returns the assumed next switch time.
static MSTLLogicControl::TLSLogicVariants & getTLS(const std::string &id)
std::vector< MSTrafficLightLogic * > getAllLogics() const
const std::string & getID() const
Returns the id.
SUMOTime duration
The duration of the phase.
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
static SUMOTime getNextSwitch(const std::string &tlsID)
static std::vector< std::vector< TraCILink > > getControlledLinks(const std::string &tlsID)
MSLane * getLane() const
Returns the connected lane.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
static std::string getProgram(const std::string &tlsID)
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
static void setRedYellowGreenState(const std::string &tlsID, const std::string &state)
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)
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
static std::string getRedYellowGreenState(const std::string &tlsID)
std::vector< MSLink * > LinkVector
Definition of the list of links that are subjected to this tls.
static std::vector< TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID)
std::vector< TraCIPhase > phases
void switchTo(MSTLLogicControl &tlc, const std::string &programID)
static std::string getParameter(const std::string &tlsID, const std::string ¶mName)
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 std::vector< std::string > getControlledLanes(const std::string &tlsID)
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
SUMOTime minDuration
The minimum duration of the phase.
The parent class for traffic light logics.
const std::string & getProgramID() const
Returns this tl-logic's id.
static std::vector< std::string > getIDList()
Representation of a lane in the micro simulation.
The definition of a single phase of a tls logic.
static SUMOTime getPhaseDuration(const std::string &tlsID)
static void setParameter(const std::string &tlsID, const std::string ¶mName, const std::string &value)