42NamedRTree* InductionLoop::myTree(
nullptr);
48std::vector<std::string>
49InductionLoop::getIDList() {
50 std::vector<std::string> ids;
57InductionLoop::getIDCount() {
58 std::vector<std::string> ids;
87std::vector<std::string>
107 return getDetector(loopID)->getTimeSinceLastDetection();
110std::vector<libsumo::TraCIVehicleData>
112 const std::vector<MSInductLoop::VehicleData> vd =
getDetector(loopID)->collectVehiclesOnDet(
SIMSTEP -
DELTA_T,
true,
true);
113 std::vector<libsumo::TraCIVehicleData> tvd;
116 tvd.back().id = vdi.idM;
117 tvd.back().length = vdi.lengthM;
118 tvd.back().entryTime = vdi.entryTimeM;
119 tvd.back().leaveTime = vdi.leaveTimeM;
120 tvd.back().typeID = vdi.typeIDM;
133 return getDetector(loopID)->getIntervalOccupancy();
143 if (meanData.getSamples() != 0) {
144 return meanData.getTravelledDistance() / meanData.getSamples();
147 return meanData.getLaneLength() / defaultTravelTime;
150 return getDetector(loopID)->getIntervalMeanSpeed();
159 return meanData.nVehDeparted + meanData.nVehEntered;
161 return getDetector(loopID)->getIntervalVehicleNumber();
166std::vector<std::string>
169 WRITE_ERROR(
"getIntervalVehicleIDs not applicable for meso");
170 return std::vector<std::string>();
172 return getDetector(loopID)->getIntervalVehicleIDs();
179 WRITE_ERROR(
"getLastIntervalOccupancy not applicable for meso");
182 return getDetector(loopID)->getIntervalOccupancy(
true);
189 WRITE_ERROR(
"getLastIntervalMeanSpeed not applicable for meso");
192 return getDetector(loopID)->getIntervalMeanSpeed(
true);
199 WRITE_ERROR(
"getLastIntervalVehicleNumber not applicable for meso");
202 return getDetector(loopID)->getIntervalVehicleNumber(
true);
206std::vector<std::string>
209 WRITE_ERROR(
"getLastIntervalVehicleIDs not applicable for meso");
210 return std::vector<std::string>();
212 return getDetector(loopID)->getIntervalVehicleIDs(
true);
218 getDetector(loopID)->overrideTimeSinceDetection(time);
226 throw TraCIException(
"Induction loop '" +
id +
"' is not known");
236 throw TraCIException(
"Induction loop '" +
id +
"' is not known");
244InductionLoop::getParameter(
const std::string& loopID,
const std::string& param) {
253InductionLoop::setParameter(
const std::string& loopID,
const std::string& name,
const std::string&
value) {
254 getDetector(loopID)->setParameter(name,
value);
268 const float cmin[2] = {(float) p.
x(), (float) p.
y()};
269 const float cmax[2] = {(float) p.
x(), (float) p.
y()};
270 myTree->Insert(cmin, cmax, il);
289std::shared_ptr<VariableWrapper>
299 return wrapper->wrapStringList(objID, variable, getIDList());
301 return wrapper->wrapInt(objID, variable, getIDCount());
303 return wrapper->wrapDouble(objID, variable,
getPosition(objID));
305 return wrapper->wrapString(objID, variable,
getLaneID(objID));
335 return wrapper->wrapVehicleDataVector(objID, variable,
getVehicleData(objID));
338 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
341 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
const std::string invalid_return< std::string >::value
@ SUMO_TAG_INDUCTION_LOOP
alternative tag for e1 detector
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
C++ TraCI client API implementation.
static std::string getLaneID(const std::string &loopID)
static ContextSubscriptionResults myContextSubscriptionResults
static std::vector< std::string > getLastIntervalVehicleIDs(const std::string &loopID)
static std::shared_ptr< VariableWrapper > makeWrapper()
static std::vector< std::string > getIntervalVehicleIDs(const std::string &loopID)
static SubscriptionResults mySubscriptionResults
static int getIntervalVehicleNumber(const std::string &loopID)
static MEInductLoop * getMEDetector(const std::string &loopID)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static double getLastIntervalOccupancy(const std::string &loopID)
static MSInductLoop * getDetector(const std::string &loopID)
static double getTimeSinceDetection(const std::string &loopID)
static std::vector< std::string > getLastStepVehicleIDs(const std::string &loopID)
static NamedRTree * myTree
static double getLastStepOccupancy(const std::string &loopID)
static std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &loopID)
static int getLastStepVehicleNumber(const std::string &loopID)
static double getLastStepMeanSpeed(const std::string &loopID)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with inductive loop instances.
static double getLastIntervalMeanSpeed(const std::string &loopID)
static void overrideTimeSinceDetection(const std::string &loopID, double time)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static double getLastStepMeanLength(const std::string &loopID)
static double getIntervalOccupancy(const std::string &loopID)
static double getPosition(const std::string &loopID)
static int getLastIntervalVehicleNumber(const std::string &loopID)
static double getIntervalMeanSpeed(const std::string &loopID)
An induction loop for mesoscopic simulation.
const MSMeanData_Net::MSLaneMeanDataValues & getMeanData() const
const MSEdge & getEdge() const
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
double getLength() const
return the length of the edge
An unextended detector measuring at a fixed position on a fixed lane.
double getPosition() const
Returns the position of the detector on the lane.
virtual const PositionVector & getShape(bool) const
double getOccupancy(SUMOTime period, int numLanes) const
const MSLane * getLane() const
Returns the lane the reminder works on.
MSDetectorControl & getDetectorControl()
Returns the detector control.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
T get(const std::string &id) const
Retrieves an item.
void insertIDs(std::vector< std::string > &into) const
int size() const
Returns the number of stored items within the container.
A RT-tree for efficient storing of SUMO's Named objects.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
double y() const
Returns the y-position.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST double INVALID_DOUBLE_VALUE
TRACI_CONST int LAST_STEP_VEHICLE_ID_LIST
TRACI_CONST int VAR_INTERVAL_NUMBER
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int LAST_STEP_VEHICLE_DATA
TRACI_CONST int VAR_LAST_INTERVAL_IDS
TRACI_CONST int VAR_LAST_INTERVAL_NUMBER
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int LAST_STEP_LENGTH
TRACI_CONST int VAR_POSITION
TRACI_CONST int LAST_STEP_MEAN_SPEED
TRACI_CONST int VAR_LAST_INTERVAL_OCCUPANCY
TRACI_CONST int VAR_INTERVAL_IDS
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_LANE_ID
TRACI_CONST int LAST_STEP_OCCUPANCY
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int INVALID_INT_VALUE
TRACI_CONST int VAR_INTERVAL_SPEED
TRACI_CONST int VAR_LAST_INTERVAL_SPEED
TRACI_CONST int VAR_INTERVAL_OCCUPANCY
TRACI_CONST int LAST_STEP_TIME_SINCE_DETECTION
Struct to store the data of the counted vehicle internally.
mirrors MSInductLoop::VehicleData