This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/sensors/radio/model/WiFiModelLogDistCeiling.h
FrankE a2c9e575a2 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
2016-08-29 08:18:44 +02:00

66 lines
1.6 KiB
C++

#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