some fixes [multithreading,..]
needed interface changes [new options] logger for android wifi-ap-optimization new test-cases
This commit is contained in:
@@ -18,23 +18,23 @@ class WiFiGridEstimator {
|
||||
public:
|
||||
|
||||
|
||||
/**
|
||||
* convenience method
|
||||
*/
|
||||
template <typename Node> static void estimate(Grid<Node>& grid, WiFiModel& mdl, const Floorplan::IndoorMap* im) {
|
||||
// /**
|
||||
// * convenience method
|
||||
// */
|
||||
// template <typename Node> static void estimate(Grid<Node>& grid, WiFiModel& mdl, const Floorplan::IndoorMap* im) {
|
||||
|
||||
// list of all APs
|
||||
std::vector<LocatedAccessPoint> aps;
|
||||
for (const Floorplan::Floor* f : im->floors) {
|
||||
for (const Floorplan::AccessPoint* ap : f->accesspoints) {
|
||||
aps.push_back(LocatedAccessPoint(*ap));
|
||||
}
|
||||
}
|
||||
// // list of all APs
|
||||
// std::vector<LocatedAccessPoint> aps;
|
||||
// for (const Floorplan::Floor* f : im->floors) {
|
||||
// for (const Floorplan::AccessPoint* ap : f->accesspoints) {
|
||||
// aps.push_back(LocatedAccessPoint(*ap));
|
||||
// }
|
||||
// }
|
||||
|
||||
// perform estimation
|
||||
estimate(grid, mdl, aps);
|
||||
// // perform estimation
|
||||
// estimate(grid, mdl, aps);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
/**
|
||||
* perform a signal-strength estimation for all of the given access points
|
||||
@@ -42,39 +42,50 @@ public:
|
||||
* store the estimated strength onto each node.
|
||||
* as nodes only provide a limited number of rssi-entries,
|
||||
* store only the strongest ones.
|
||||
*
|
||||
* as the smartphone is held above the ground, we do NOT want to estimate
|
||||
* the signal strength for the nodes (on the ground) but for the nodes
|
||||
* + the height the smartphone is held at
|
||||
*
|
||||
*/
|
||||
template <typename Node> static void estimate(Grid<Node>& grid, WiFiModel& mdl, const std::vector<AccessPoint> aps) {
|
||||
template <typename Node> static void estimate(Grid<Node>& grid, WiFiModel& mdl, const float smartphoneAtHeight) {
|
||||
|
||||
// sanity checks
|
||||
Assert::isTrue(Node::getMapAPs().empty(), "there are already some processed APs available!");
|
||||
Assert::isTrue(Node::getMapAPs().empty(), "there are already APs stored on the grid nodes!");
|
||||
|
||||
// attach the access-points to the shared node-vector
|
||||
// all APs known to the model
|
||||
std::vector<AccessPoint> aps = mdl.getAllAPs();
|
||||
|
||||
// attach each access-points to a vector shared for all grid-nodes
|
||||
for (const AccessPoint& ap : aps) {
|
||||
Node::getMapAPs().push_back(ap);
|
||||
}
|
||||
|
||||
// smartphone offset (meter above ground)
|
||||
const Point3 smartphoneOffset(0,0,smartphoneAtHeight);
|
||||
|
||||
// process each node
|
||||
for (Node& n : grid) {
|
||||
|
||||
// keep the strongest APs to attach to this node
|
||||
std::vector<WiFiGridNodeAP> nodeAPs;
|
||||
|
||||
// process each AP
|
||||
// process each AP known to the model
|
||||
for (int apIdx = 0; apIdx < (int) aps.size(); ++apIdx) {
|
||||
|
||||
// estimate the signal-strength
|
||||
const float rssi = mdl.getRSSI(aps[apIdx].getMAC(), n.inMeter());
|
||||
const float rssi = mdl.getRSSI(aps[apIdx].getMAC(), n.inMeter() + smartphoneOffset);
|
||||
|
||||
// keep it
|
||||
// (temporarily) keep it
|
||||
nodeAPs.push_back(WiFiGridNodeAP(apIdx, rssi));
|
||||
|
||||
}
|
||||
|
||||
// sort all APs by signal strength
|
||||
// now sort all the visible APs by signal strength
|
||||
auto comp = [] (const WiFiGridNodeAP& ap1, const WiFiGridNodeAP& ap2) {return ap1.getRSSI() > ap2.getRSSI();};
|
||||
std::sort(nodeAPs.begin(), nodeAPs.end(), comp);
|
||||
|
||||
// attach the strongest X to the node
|
||||
// and finally attach the strongest X to the node
|
||||
const int cnt = std::min( n.getMaxAPs(), (int) nodeAPs.size() );
|
||||
for (int i = 0; i < cnt; ++i) {
|
||||
n.strongestAPs[i] = nodeAPs[i];
|
||||
|
||||
Reference in New Issue
Block a user