34typedef Domain<libsumo::CMD_GET_TL_VARIABLE, libsumo::CMD_SET_TL_VARIABLE>
Dom;
39std::vector<std::string>
40TrafficLight::getIDList() {
46TrafficLight::getIDCount() {
52TrafficLight::getRedYellowGreenState(
const std::string& tlsID) {
57std::vector<libsumo::TraCILogic>
58TrafficLight::getAllProgramLogics(
const std::string& tlsID) {
61 std::vector<libsumo::TraCILogic> result;
63 while (numLogics-- > 0) {
66 result.emplace_back(logic);
72std::vector<std::string>
73TrafficLight::getControlledJunctions(
const std::string& tlsID) {
78std::vector<std::string>
79TrafficLight::getControlledLanes(
const std::string& tlsID) {
84std::vector<std::vector<libsumo::TraCILink> >
85TrafficLight::getControlledLinks(
const std::string& tlsID) {
88 std::vector< std::vector<libsumo::TraCILink> > result;
96TrafficLight::getProgram(
const std::string& tlsID) {
102TrafficLight::getPhase(
const std::string& tlsID) {
108TrafficLight::getPhaseName(
const std::string& tlsID) {
114TrafficLight::getPhaseDuration(
const std::string& tlsID) {
120TrafficLight::getNextSwitch(
const std::string& tlsID) {
126TrafficLight::getSpentDuration(
const std::string& tlsID) {
132TrafficLight::getServedPersonCount(
const std::string& tlsID,
int index) {
139std::vector<std::string>
140TrafficLight::getBlockingVehicles(
const std::string& tlsID,
int linkIndex) {
147std::vector<std::string>
148TrafficLight::getRivalVehicles(
const std::string& tlsID,
int linkIndex) {
155std::vector<std::string>
156TrafficLight::getPriorityVehicles(
const std::string& tlsID,
int linkIndex) {
163std::vector<libsumo::TraCISignalConstraint>
164TrafficLight::getConstraints(
const std::string& tlsID,
const std::string& tripId) {
165 std::vector<libsumo::TraCISignalConstraint> result;
175std::vector<libsumo::TraCISignalConstraint>
176TrafficLight::getConstraintsByFoe(
const std::string& foeSignal,
const std::string& foeId) {
177 std::vector<libsumo::TraCISignalConstraint> result;
190TrafficLight::setRedYellowGreenState(
const std::string& tlsID,
const std::string& state) {
196TrafficLight::setPhase(
const std::string& tlsID,
const int index) {
202TrafficLight::setPhaseName(
const std::string& tlsID,
const std::string& name) {
208TrafficLight::setProgram(
const std::string& tlsID,
const std::string& programID) {
214TrafficLight::setPhaseDuration(
const std::string& tlsID,
const double phaseDuration) {
227 for (
const std::shared_ptr<libsumo::TraCIPhase>& phase : logic.
phases) {
234 for (
int n : phase->next) {
248TrafficLight::addConstraint(
const std::string& tlsID,
const std::string& tripId,
const std::string& foeSignal,
const std::string& foeId,
const int type,
const int limit) {
260std::vector<libsumo::TraCISignalConstraint>
261TrafficLight::swapConstraints(
const std::string& tlsID,
const std::string& tripId,
const std::string& foeSignal,
const std::string& foeId) {
262 std::vector<libsumo::TraCISignalConstraint> result;
274 for (
int i = 0; i < n; ++i) {
285 for (
int j = 0; j < (int)paramItems.size(); j += 2) {
286 c.
param[paramItems[j]] = paramItems[j + 1];
295TrafficLight::removeConstraints(
const std::string& tlsID,
const std::string& tripId,
const std::string& foeSignal,
const std::string& foeId) {
305TrafficLight::updateConstraints(
const std::string& vehID, std::string tripId) {
311 std::ostringstream tmp;
312 for (
double d : value) {
315 std::string tmp2 = tmp.str();
322TrafficLight::setNemaSplits(
const std::string& tlsID,
const std::vector<double>& splits) {
323 setParameter(tlsID,
"NEMA.splits",
to_string(splits));
327TrafficLight::setNemaMaxGreens(
const std::string& tlsID,
const std::vector<double>& maxGreens) {
328 setParameter(tlsID,
"NEMA.maxGreens",
to_string(maxGreens));
332TrafficLight::setNemaCycleLength(
const std::string& tlsID,
double cycleLength) {
333 setParameter(tlsID,
"NEMA.cycleLength", std::to_string(cycleLength));
337TrafficLight::setNemaOffset(
const std::string& tlsID,
double offset) {
338 setParameter(tlsID,
"NEMA.offset", std::to_string(offset));
#define LIBTRACI_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
#define LIBTRACI_PARAMETER_IMPLEMENTATION(CLASS, DOMAIN)
C++ TraCI client API implementation.
static int readTypedByte(tcpip::Storage &ret, const std::string &error="")
static void writeTypedDouble(tcpip::Storage &content, double value)
static void readLogic(tcpip::Storage &inputStorage, libsumo::TraCILogic &logic, const std::string &error="")
static std::vector< std::string > readTypedStringList(tcpip::Storage &ret, const std::string &error="")
static void readConstraintVector(tcpip::Storage &inputStorage, std::vector< libsumo::TraCISignalConstraint > &result, const std::string &error="")
static int readTypedInt(tcpip::Storage &ret, const std::string &error="")
static void writeCompound(tcpip::Storage &content, int size)
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
static void writeTypedInt(tcpip::Storage &content, int value)
static void writeTypedStringList(tcpip::Storage &content, const std::vector< std::string > &value)
static void writeTypedString(tcpip::Storage &content, const std::string &value)
static void readLinkVectorVector(tcpip::Storage &inputStorage, std::vector< std::vector< libsumo::TraCILink > > &result, const std::string &error="")
static Connection & getActive()
std::mutex & getMutex() const
static void setDouble(int var, const std::string &id, double value)
static std::vector< std::string > getStringVector(int var, const std::string &id, tcpip::Storage *add=nullptr)
static std::string getString(int var, const std::string &id, tcpip::Storage *add=nullptr)
static int getInt(int var, const std::string &id, tcpip::Storage *add=nullptr)
static void set(int var, const std::string &id, tcpip::Storage *add)
static double getDouble(int var, const std::string &id, tcpip::Storage *add=nullptr)
static void setInt(int var, const std::string &id, int value)
static void setString(int var, const std::string &id, const std::string &value)
static tcpip::Storage & get(int var, const std::string &id, tcpip::Storage *add=nullptr, int expectedType=libsumo::TYPE_COMPOUND)
virtual void writeInt(int)
virtual int readUnsignedByte()
virtual void writeUnsignedByte(int)
StorageType::size_type size() const
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int TL_CONSTRAINT_REMOVE
TRACI_CONST int TL_BLOCKING_VEHICLES
TRACI_CONST int TL_CONSTRAINT_SWAP
TRACI_CONST int TL_PRIORITY_VEHICLES
TRACI_CONST int TL_CONTROLLED_LANES
TRACI_CONST int TL_SPENT_DURATION
TRACI_CONST int TL_COMPLETE_DEFINITION_RYG
TRACI_CONST int VAR_PERSON_NUMBER
TRACI_CONST int TL_CONSTRAINT_UPDATE
TRACI_CONST int TL_CONTROLLED_JUNCTIONS
TRACI_CONST int TL_CONTROLLED_LINKS
TRACI_CONST int TYPE_INTEGER
TRACI_CONST int TL_CONSTRAINT_BYFOE
TRACI_CONST int TL_CONSTRAINT
TRACI_CONST int TL_NEXT_SWITCH
TRACI_CONST int TL_PROGRAM
TRACI_CONST int TL_PHASE_DURATION
TRACI_CONST int TL_CONSTRAINT_ADD
TRACI_CONST int TL_PHASE_INDEX
TRACI_CONST int TL_CURRENT_PHASE
TRACI_CONST int TL_COMPLETE_PROGRAM_RYG
TRACI_CONST int TL_RED_YELLOW_GREEN_STATE
TRACI_CONST int TL_CURRENT_PROGRAM
TRACI_CONST int TL_RIVAL_VEHICLES
Domain< libsumo::CMD_GET_BUSSTOP_VARIABLE, libsumo::CMD_SET_BUSSTOP_VARIABLE > Dom
std::string to_string(const std::vector< double > &value)
std::map< std::string, std::string > subParameter
std::vector< std::shared_ptr< libsumo::TraCIPhase > > phases
std::string foeId
the tripId or vehicle id of the train that must pass first
std::string tripId
the tripId or vehicle id of the train that is constrained
std::string foeSignal
the tlsID of the rail signla that the foe must pass first
std::string signalId
the idea of the rail signal where this constraint is active
std::map< std::string, std::string > param
additional parameters
bool active
whether this constraint is active
int type
the type of constraint (predecessor:0, insertionPredecessor:1)
bool mustWait
whether tripId must still wait for foeId to pass foeSignal
int limit
the number of trains that must be recorded at the foeSignal