46std::vector<std::string>
47InductionLoop::getIDList() {
48 std::vector<std::string> ids;
55InductionLoop::getIDCount() {
56 std::vector<std::string> ids;
62InductionLoop::getPosition(
const std::string& detID) {
63 return getDetector(detID)->getPosition();
68InductionLoop::getLaneID(
const std::string& detID) {
69 return getDetector(detID)->getLane()->getID();
74InductionLoop::getLastStepVehicleNumber(
const std::string& detID) {
75 return (
int)getDetector(detID)->getEnteredNumber((
int)
DELTA_T);
80InductionLoop::getLastStepMeanSpeed(
const std::string& detID) {
81 return getDetector(detID)->getSpeed((
int)
DELTA_T);
85std::vector<std::string>
86InductionLoop::getLastStepVehicleIDs(
const std::string& detID) {
87 return getDetector(detID)->getVehicleIDs((
int)
DELTA_T);
92InductionLoop::getLastStepOccupancy(
const std::string& detID) {
93 return getDetector(detID)->getOccupancy();
98InductionLoop::getLastStepMeanLength(
const std::string& detID) {
99 return getDetector(detID)->getVehicleLength((
int)
DELTA_T);
104InductionLoop::getTimeSinceDetection(
const std::string& detID) {
105 return getDetector(detID)->getTimeSinceLastDetection();
108std::vector<libsumo::TraCIVehicleData>
109InductionLoop::getVehicleData(
const std::string& detID) {
110 const std::vector<MSInductLoop::VehicleData> vd = getDetector(detID)->collectVehiclesOnDet(
SIMSTEP -
DELTA_T,
true,
true);
111 std::vector<libsumo::TraCIVehicleData> tvd;
114 tvd.back().id = vdi.idM;
115 tvd.back().length = vdi.lengthM;
116 tvd.back().entryTime = vdi.entryTimeM;
117 tvd.back().leaveTime = vdi.leaveTimeM;
118 tvd.back().typeID = vdi.typeIDM;
125InductionLoop::getIntervalOccupancy(
const std::string& detID) {
126 return getDetector(detID)->getIntervalOccupancy();
131InductionLoop::getIntervalMeanSpeed(
const std::string& detID) {
132 return getDetector(detID)->getIntervalMeanSpeed();
137InductionLoop::getIntervalVehicleNumber(
const std::string& detID) {
138 return getDetector(detID)->getIntervalVehicleNumber();
142std::vector<std::string>
143InductionLoop::getIntervalVehicleIDs(
const std::string& detID) {
144 return getDetector(detID)->getIntervalVehicleIDs();
149InductionLoop::getLastIntervalOccupancy(
const std::string& detID) {
150 return getDetector(detID)->getIntervalOccupancy(
true);
155InductionLoop::getLastIntervalMeanSpeed(
const std::string& detID) {
156 return getDetector(detID)->getIntervalMeanSpeed(
true);
161InductionLoop::getLastIntervalVehicleNumber(
const std::string& detID) {
162 return getDetector(detID)->getIntervalVehicleNumber(
true);
166std::vector<std::string>
167InductionLoop::getLastIntervalVehicleIDs(
const std::string& detID) {
168 return getDetector(detID)->getIntervalVehicleIDs(
true);
173InductionLoop::overrideTimeSinceDetection(
const std::string& detID,
double time) {
174 getDetector(detID)->overrideTimeSinceDetection(time);
179InductionLoop::getDetector(
const std::string&
id) {
182 throw TraCIException(
"Induction loop '" +
id +
"' is not known");
189InductionLoop::getParameter(
const std::string& detID,
const std::string& param) {
198InductionLoop::setParameter(
const std::string& detID,
const std::string& name,
const std::string& value) {
199 getDetector(detID)->setParameter(name, value);
207InductionLoop::getTree() {
208 if (myTree ==
nullptr) {
213 const float cmin[2] = {(float) p.
x(), (float) p.
y()};
214 const float cmax[2] = {(float) p.
x(), (float) p.
y()};
215 myTree->Insert(cmin, cmax, il);
222InductionLoop::cleanup() {
234std::shared_ptr<VariableWrapper>
235InductionLoop::makeWrapper() {
236 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
241InductionLoop::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
244 return wrapper->wrapStringList(objID, variable, getIDList());
246 return wrapper->wrapInt(objID, variable, getIDCount());
248 return wrapper->wrapDouble(objID, variable, getPosition(objID));
250 return wrapper->wrapString(objID, variable, getLaneID(objID));
252 return wrapper->wrapInt(objID, variable, getLastStepVehicleNumber(objID));
254 return wrapper->wrapDouble(objID, variable, getLastStepMeanSpeed(objID));
256 return wrapper->wrapStringList(objID, variable, getLastStepVehicleIDs(objID));
258 return wrapper->wrapDouble(objID, variable, getLastStepOccupancy(objID));
260 return wrapper->wrapDouble(objID, variable, getLastStepMeanLength(objID));
262 return wrapper->wrapDouble(objID, variable, getTimeSinceDetection(objID));
264 return wrapper->wrapDouble(objID, variable, getIntervalOccupancy(objID));
266 return wrapper->wrapDouble(objID, variable, getIntervalMeanSpeed(objID));
268 return wrapper->wrapInt(objID, variable, getIntervalVehicleNumber(objID));
270 return wrapper->wrapStringList(objID, variable, getIntervalVehicleIDs(objID));
272 return wrapper->wrapDouble(objID, variable, getLastIntervalOccupancy(objID));
274 return wrapper->wrapDouble(objID, variable, getLastIntervalMeanSpeed(objID));
276 return wrapper->wrapInt(objID, variable, getLastIntervalVehicleNumber(objID));
278 return wrapper->wrapStringList(objID, variable, getLastIntervalVehicleIDs(objID));
281 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
284 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
@ 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.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
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
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 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 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 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