added wifi per-floor optimization
added plot to wifi-quality-analyzer changes to per-floor wifi models minor fixes
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
*/
|
||||
class WiFiModelPerFloor : public WiFiModel {
|
||||
|
||||
public:
|
||||
|
||||
struct ModelForFloor {
|
||||
|
||||
float fromZ;
|
||||
@@ -30,6 +32,8 @@ class WiFiModelPerFloor : public WiFiModel {
|
||||
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::IndoorMap* map;
|
||||
|
||||
/** all contained models [one per floor] */
|
||||
@@ -46,6 +50,10 @@ public:
|
||||
|
||||
}
|
||||
|
||||
/** get a list of all models for the distinct floors */
|
||||
std::vector<ModelForFloor>& getFloorModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
/** get a list of all APs known to the model */
|
||||
std::vector<AccessPoint> getAllAPs() const override {
|
||||
@@ -70,11 +78,70 @@ public:
|
||||
|
||||
float getRSSI(const MACAddress& accessPoint, const Point3 position_m) const override {
|
||||
|
||||
for (const ModelForFloor& mff : models) {
|
||||
if (mff.matches(position_m.z)) {return mff.mdl->getRSSI(accessPoint, position_m);}
|
||||
}
|
||||
#if (1==0)
|
||||
|
||||
return -120;
|
||||
float res = -120;
|
||||
|
||||
// find the best matching one
|
||||
for (const ModelForFloor& mff : models) {
|
||||
if (mff.matches(position_m.z)) {
|
||||
const float rssi = mff.mdl->getRSSI(accessPoint, position_m);
|
||||
if (rssi > res) {res = rssi;}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
|
||||
#elif (1==0)
|
||||
|
||||
// nearest matching model
|
||||
float nearest = 9999;
|
||||
float res = -120;
|
||||
|
||||
for (const ModelForFloor& mff : models) {
|
||||
const float distToFloor = std::abs(position_m.z - mff.fromZ);
|
||||
if (distToFloor < nearest) {
|
||||
const float rssi = mff.mdl->getRSSI(accessPoint, position_m);
|
||||
if (rssi == rssi) {
|
||||
res = rssi;
|
||||
nearest = distToFloor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert::isNotNaN(res, "detected NaN");
|
||||
return res;
|
||||
|
||||
#elif (1==1)
|
||||
|
||||
// average of all matching models
|
||||
|
||||
float sum = 0;
|
||||
int cnt = 0;
|
||||
|
||||
// find the best matching one
|
||||
for (const ModelForFloor& mff : models) {
|
||||
if (mff.matches(position_m.z)) {
|
||||
const float rssi = mff.mdl->getRSSI(accessPoint, position_m);
|
||||
if (rssi == rssi) {
|
||||
sum += rssi; ++cnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert::isNotNaN(sum, "detected NaN");
|
||||
|
||||
return (cnt > 0) ? (sum/cnt) : (-120);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// for (const ModelForFloor& mff : models) {
|
||||
// if (mff.matches(position_m.z)) {return mff.mdl->getRSSI(accessPoint, position_m);}
|
||||
// }
|
||||
|
||||
// return -120;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef WIFIMODELS_H
|
||||
#define WIFIMODELS_H
|
||||
|
||||
/** umbrella header for WiFiModel and factory */
|
||||
#include "WiFiModel.h"
|
||||
#include "WiFiModelFactory.h"
|
||||
#include "WiFiModelFactoryImpl.h"
|
||||
|
||||
Reference in New Issue
Block a user