huge commit
- worked on about everything - grid walker using plugable modules - wifi models - new distributions - worked on geometric data-structures - added typesafe timestamps - worked on grid-building - added sensor-classes - added sensor analysis (step-detection, turn-detection) - offline data reader - many test-cases
This commit is contained in:
65
sensors/radio/model/WiFiModelLogDistCeiling.h
Normal file
65
sensors/radio/model/WiFiModelLogDistCeiling.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef WIFIMODELLOGDISTCEILING_H
|
||||
#define WIFIMODELLOGDISTCEILING_H
|
||||
|
||||
#include "../../../floorplan/v2/Floorplan.h"
|
||||
|
||||
#include "WiFiModel.h"
|
||||
#include "LogDistanceModel.h"
|
||||
|
||||
/**
|
||||
* signal-strength estimation using log-distance model
|
||||
* including ceilings between AP and position
|
||||
*/
|
||||
class WiFiModelLogDistCeiling : public WiFiModel {
|
||||
|
||||
private:
|
||||
|
||||
float txp; // sending power (-40)
|
||||
float exp; // path-loss-exponent (~2.0 - 4.0)
|
||||
float waf; // attenuation per ceiling/floor (~-8.0)
|
||||
|
||||
/** position (height) of all ceilings (in meter) */
|
||||
std::vector<float> ceilingsAtHeight_m;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
WiFiModelLogDistCeiling(const float txp, const float exp, const float waf, const Floorplan::IndoorMap* map) : txp(txp), exp(exp), waf(waf) {
|
||||
|
||||
Assert::isTrue(waf <= 0, "WAF must be a negative number!");
|
||||
|
||||
// position of all ceilings
|
||||
for (Floorplan::Floor* f : map->floors) {
|
||||
ceilingsAtHeight_m.push_back(f->atHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** get the given access-point's RSSI at the provided location */
|
||||
float getRSSI(const LocatedAccessPoint& ap, const Point3 p) override {
|
||||
const int numCeilings = numCeilingsBetween(ap.z, p.z);
|
||||
const float rssi = LogDistanceModel::distanceToRssi(txp, exp, ap.getDistance(p));
|
||||
return rssi + (numCeilings * waf);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/** get the number of ceilings between z1 and z2 */
|
||||
int numCeilingsBetween(const float z1, const float z2) const {
|
||||
|
||||
int cnt = 0;
|
||||
const float zMin = std::min(z1, z2);
|
||||
const float zMax = std::max(z1, z2);
|
||||
|
||||
for (float z : ceilingsAtHeight_m) {
|
||||
if (zMin < z && zMax > z) {++cnt;}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // WIFIMODELLOGDISTCEILING_H
|
||||
Reference in New Issue
Block a user