46 std::vector<std::string>
64 std::vector<TraCILogic>
66 std::vector<TraCILogic> result;
69 TraCILogic l(logic->getProgramID(), (int)logic->getLogicType(), logic->getCurrentPhaseIndex());
74 result.emplace_back(l);
80 std::vector<std::string>
82 std::set<std::string> junctionIDs;
85 for (
const MSLink* l : llinks) {
86 junctionIDs.insert(l->getJunction()->getID());
89 return std::vector<std::string>(junctionIDs.begin(), junctionIDs.end());
93 std::vector<std::string>
95 std::vector<std::string> laneIDs;
98 for (
const MSLane* l : llanes) {
99 laneIDs.push_back(l->getID());
106 std::vector<std::vector<TraCILink> >
108 std::vector<std::vector<TraCILink> > result;
111 for (
int i = 0; i < (int)lanes.size(); ++i) {
112 std::vector<TraCILink> subList;
116 for (
int j = 0; j < (int)llanes.size(); ++j) {
122 subList.emplace_back(
TraCILink(llanes[j]->getID(), via, to));
124 result.emplace_back(subList);
144 return STEPS2TIME(
getTLS(tlsID).getActive()->getCurrentPhaseDef().duration);
169 if (index < 0 || active->getPhaseNumber() <= index) {
203 throw TraCIException(
"set program: parameter index must be less than parameter phase number.");
205 std::vector<MSPhaseDefinition*> phases;
236 std::shared_ptr<VariableWrapper>
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
virtual const MSPhaseDefinition & getCurrentPhaseDef() const =0
Returns the definition of the current phase.
const std::string & getState() const
Returns the state within this phase.
static double getPhaseDuration(const std::string &tlsID)
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
Storage for all programs of a single tls.
MSLane * getLane() const
Returns the connected lane.
static void setPhaseDuration(const std::string &tlsID, const double phaseDuration)
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.
const LaneVectorVector & getLaneVectors() const
Returns the list of lists of all lanes controlled by this tls.
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::map< std::string, SubscriptionResults > ContextSubscriptionResults
virtual int getCurrentPhaseIndex() const =0
Returns the current index within the program.
const std::string & getID() const
Returns the id.
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
#define TL_CONTROLLED_JUNCTIONS
static std::vector< std::string > getControlledLanes(const std::string &tlsID)
std::vector< TraCIPhase > phases
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
A fixed traffic light logic.
#define TL_PHASE_DURATION
static void setRedYellowGreenState(const std::string &tlsID, const std::string &state)
#define TL_CURRENT_PROGRAM
SUMOTime duration
The duration of the phase.
std::vector< MSTrafficLightLogic * > getAllLogics() const
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.
MSLane * getViaLane() const
Returns the following inner lane.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual int getPhaseNumber() const =0
Returns the number of phases.
const std::string & getProgramID() const
Returns this tl-logic's id.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
static double getNextSwitch(const std::string &tlsID)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static SubscriptionResults mySubscriptionResults
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
static LIBSUMO_SUBSCRIPTION_API std::shared_ptr< VariableWrapper > makeWrapper()
void setStateInstantiatingOnline(MSTLLogicControl &tlc, const std::string &state)
static std::vector< TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID)
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
#define TL_RED_YELLOW_GREEN_STATE
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.
static void setPhase(const std::string &tlsID, const int index)
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const TraCILogic &logic)
The parent class for traffic light logics.
static void setProgram(const std::string &tlsID, const std::string &programID)
#define TL_CONTROLLED_LANES
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
static std::string getProgram(const std::string &tlsID)
MSTrafficLightLogic * getActive() const
static int getPhase(const std::string &tlsID)
std::vector< std::string > getAllTLIds() const
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
static std::string getParameter(const std::string &tlsID, const std::string ¶mName)
MSTrafficLightLogic * getLogic(const std::string &programID) const
static ContextSubscriptionResults myContextSubscriptionResults
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)