added wifi per-floor optimization

added plot to wifi-quality-analyzer
changes to per-floor wifi models
minor fixes
This commit is contained in:
k-a-z-u
2018-05-16 13:02:06 +02:00
parent 5bec3a5c0d
commit a8123d532d
9 changed files with 304 additions and 24 deletions

View File

@@ -4,6 +4,12 @@
#include "WiFiMeasurements.h"
#include <unordered_set>
#ifdef WITH_DEBUG_PLOT
#include <KLib/misc/gnuplot/Gnuplot.h>
#include <KLib/misc/gnuplot/GnuplotPlot.h>
#include <KLib/misc/gnuplot/GnuplotPlotElementLines.h>
#endif
class WiFiQualityAnalyzer {
private:
@@ -12,8 +18,25 @@ private:
std::vector<WiFiMeasurements> history;
float quality = 0;
#ifdef WITH_DEBUG_PLOT
K::Gnuplot gp;
K::GnuplotPlot plot;
K::GnuplotPlotElementLines line1;
K::GnuplotPlotElementLines line2;
int gpX = 0;
#endif
public:
WiFiQualityAnalyzer() {
#ifdef WITH_DEBUG_PLOT
plot.add(&line1);
plot.add(&line2);
plot.setTitle("WiFi Quality");
#endif
}
/** attach the current measurement and infer the quality */
void add(const WiFiMeasurements& mes) {
@@ -43,6 +66,16 @@ private:
quality = qAvgdB;
#ifdef WITH_DEBUG_PLOT
line1.add(K::GnuplotPoint2(gpX,qAvgdB)); line1.setTitle("dB"); line1.getStroke().setWidth(2);
line2.add(K::GnuplotPoint2(gpX,qCnt)); line2.setTitle("visible");
while(line1.size() > 50) {line1.remove(0);}
while(line2.size() > 50) {line2.remove(0);}
++gpX;
gp.draw(plot);
gp.flush();
#endif
}
/** score [0:1] based on the average sig-strength. the higher the better */