Skip to content

Commit

Permalink
Implemented getIntervalVehicleNumber in InductionLoopScope for the Tr…
Browse files Browse the repository at this point in the history
…aci-API on the client-side.
  • Loading branch information
Enough7 authored and behrisch committed Apr 10, 2024
1 parent 7d945fb commit 9b599c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libsumo/TraCIConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,9 @@ TRACI_CONST int AUTOMATIC_CONTEXT_SUBSCRIPTION = 0x03;
// generic attributes (get/set: all)
TRACI_CONST int GENERIC_ATTRIBUTE = 0x03;

// The number of vehicles (or persons, if so configured) that passed the detector during the current interval
TRACI_CONST int INTERVAL_NUMBER = 0x25;

// last step vehicle number (get: induction loops, multi-entry/multi-exit detector, lanes, edges)
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER = 0x10;

Expand Down
5 changes: 5 additions & 0 deletions src/utils/traci/TraCIAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,11 @@ TraCIAPI::GUIScope::trackVehicle(const std::string& viewID, const std::string& v
// ---------------------------------------------------------------------------
// TraCIAPI::InductionLoopScope-methods
// ---------------------------------------------------------------------------

int TraCIAPI::InductionLoopScope::getIntervalVehicleNumber(const std::string &loopID) const {
return getInt(libsumo::INTERVAL_NUMBER, loopID);
}

double
TraCIAPI::InductionLoopScope::getPosition(const std::string& loopID) const {
return getDouble(libsumo::VAR_POSITION, loopID);
Expand Down
5 changes: 5 additions & 0 deletions src/utils/traci/TraCIAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ class TraCIAPI {
InductionLoopScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, -1, libsumo::CMD_SUBSCRIBE_INDUCTIONLOOP_VARIABLE, libsumo::CMD_SUBSCRIBE_INDUCTIONLOOP_CONTEXT) {}
virtual ~InductionLoopScope() {}

/**
* @param loopID The ID of the Induction Loop
* @return the number of vehicles that passed the detector during the current interval
*/
int getIntervalVehicleNumber(const std::string& loopID) const;
double getPosition(const std::string& loopID) const;
std::string getLaneID(const std::string& loopID) const;
int getLastStepVehicleNumber(const std::string& loopID) const;
Expand Down

0 comments on commit 9b599c9

Please sign in to comment.