From fe9c25cde5e239b006fc05287e0faadf2f57c842 Mon Sep 17 00:00:00 2001 From: kazu Date: Tue, 25 Apr 2017 14:48:04 +0200 Subject: [PATCH] TeX and helper code --- main.cpp | 62 +++++++++++++++++++++++++- tex/chapters/experiments.tex | 84 +++++++++++++++++++++++------------- tex/chapters/work.tex | 42 +++++++++--------- 3 files changed, 136 insertions(+), 52 deletions(-) diff --git a/main.cpp b/main.cpp index 6813501..ce76f7f 100644 --- a/main.cpp +++ b/main.cpp @@ -505,12 +505,67 @@ void plotAllWalks(Floorplan::IndoorMap* map) { } +void plotEstAndRealApPosDistance(Floorplan::IndoorMap* map) { + + WiFiModelLogDistCeiling mdl(map); + mdl.loadXML(Settings::wifiEachOptParPos); + + K::Statistics statsTxp; + K::Statistics statsExp; + K::Statistics statsWaf; + K::Statistics statsPosErr; + + + for (const AccessPoint& ap : mdl.getAllAPs()) { + + const WiFiModelLogDistCeiling::APEntry params = mdl.getAP(ap.getMAC()); + statsTxp.add(params.txp); + statsExp.add(params.exp); + statsWaf.add(params.waf); + + const Point3 mdlPos = params.position_m; + + const auto& it = FloorplanHelper::getAP(map, ap.getMAC()); + const Floorplan::AccessPoint* fap = it.first; + const Floorplan::Floor* floor = it.second; + + const Point3 realPos = fap->getPos(floor); + + const float posErr = mdlPos.getDistance(realPos); + statsPosErr.add(posErr); + + } + + PlotErrFunc pef("", "\\docAP{}s (%)"); + pef.getPlot().getAxisX().setTicsLabelFormat("%h m"); + pef.add("oo", &statsPosErr); + pef.plot(); + + const std::string file = Settings::fPathGFX + "/" + "wifiOptApPosDifference"; + pef.getGP().setOutput(file + ".tex"); + pef.getGP().setTerminal("epslatex", K::GnuplotSize(8.6, 2.8)); + pef.getPlot().getMargin().set(3.5, 0.2, 0.1, 2.0); + pef.writePlotToFile(file + ".gp"); + pef.getPlot().setStringMod(new K::GnuplotStringModLaTeX()); + pef.plot(); + + std::cout << "TXP:\t" << statsTxp.asString() << std::endl; + std::cout << "EXP:\t" << statsExp.asString() << std::endl; + std::cout << "WAF:\t" << statsWaf.asString() << std::endl; + std::cout << "Pos:\t" << statsPosErr.asString() << std::endl; + + int i = 0; (void) i; + +} + + // build plots for the paper void paperOutputs() { Floorplan::IndoorMap* map = Floorplan::Reader::readFromFile(Settings::fMap); + // show optimization behaviour if (1 == 0) { @@ -840,6 +895,11 @@ int main(void) { //showFingerprintsFor(Settings::fMap, Settings::fCalib, "D8:84:66:4A:4A:E0"); //showModelFor(Settings::fMap, Settings::wifiEachOptParPos_multimodel, "D8:84:66:4A:4A:E0"); + if (1 == 1) { + plotEstAndRealApPosDistance(map); + int i = 0; (void) i; + } + // calib error in/out if (1 == 0) { @@ -927,7 +987,7 @@ int main(void) { } // show wifi multimodalities - if (1 == 1) { + if (1 == 0) { Plotty::Settings settings; settings.maxZ = 8; diff --git a/tex/chapters/experiments.tex b/tex/chapters/experiments.tex index d5d307d..feb9b3f 100644 --- a/tex/chapters/experiments.tex +++ b/tex/chapters/experiments.tex @@ -4,7 +4,7 @@ alles im FHWS gebäude [korrekte groesse fuer beide gebaeude!] mit nem nexus 6 } - Within all \docWIFI{} observations we only consider the \docAP{}s that are permanently installed + Within all \docWIFI{} observations (offline and online) we only consider the \docAP{}s that are permanently installed within the building. Temporal and movable transmitters are ignored as they might cause estimation errors. @@ -51,14 +51,13 @@ % visible APs: % cnt(121) min(2.000000) max(22.000000) range(20.000000) med(8.000000) avg(9.322314) stdDev(4.386709) - As mentioned earlier we will look at various optimization strategies. + As mentioned in section \ref{sec:optimization}, we will look at various optimization strategies: - - {\bf\noOptEmpiric{}} uses the same three parameters \mTXP,\mPLE,\mWAF for each \docAPshort{} in combination - with its position, which is well known from the flooprlan. + {\bf\noOptEmpiric{}} uses the same three empiric parameters \mTXP{}, \mPLE{}, \mWAF{} for each \docAPshort{} in combination + with its position, which is well known from the floorplan. {\bf\optParamsAllAP{}} is the same as above, except that the three parameters are optimized - based on the reference measurements. + using the reference measurements. {\bf\optParamsEachAP{}} optimizes the three parameters per \docAP{} instead of using the same parameters for all. @@ -67,36 +66,59 @@ (3D position, \mTXP, \mPLE, \mWAF) based on the reference measurements. {\bf\optPerFloor{}} and {\bf\optPerRegion{}} are just like \optParamsPosEachAP{} except that - there are several instances that are optimized only for one floor / region instead of the whole building. + there are several sub-models that are optimized for one floor / region instead of the whole building. + Figure \ref{fig:wifiModelError} shows the optimization results for all strategies, which are as expected: + The estimation error is indirectly proportional to the number of optimized parameters. + However, even with \optPerRegion{} the maximal error is relatively high due to some locations that do + not fit the model at all. Looking at the optimization results for \mTXP{}, \mPLE{} and \mWAF{} supports + this finding. While the median for those values based on all optimized transmitters is totally sane + (-42, 2.4, 6.0), the minimum and maximum values are clearly outside of the physically possible range. + + \begin{figure} \input{gfx/wifi_model_error_0_95.tex} \input{gfx/wifi_model_error_95_100.tex} - \label{fig:wifiModelError}% - \caption{% - Comparison between different optimization strategies by examining the error (in \decibel) at each reference measurement.% - The higher the number of variable parameters, the better the model resembles real world conditions. % - }% + \label{fig:wifiModelError} + \caption{ + Comparison between different optimization strategies by examining the error (in \decibel) at each reference measurement. + The higher the number of variable parameters, the better the model resembles real world conditions. + } + \end{figure} + + + %TXP: cnt(34) min(-67.698959) max(4.299183) range(71.998146) med(-41.961170) avg(-41.659286) stdDev(17.742294) + %EXP: cnt(34) min(0.932817) max(4.699000) range(3.766183) med(2.380410) avg(2.546959) stdDev(1.074687) + %WAF: cnt(34) min(-27.764957) max(5.217187) range(32.982143) med(-5.921916) avg(-7.579522) stdDev(5.840527) + %Pos: cnt(34) min(3.032438) max(26.767128) range(23.734690) med(7.342710) avg(8.571227) stdDev(4.801449) + + Looking at figure \ref{fig:wifiIndoorOutdoor} indicates the strong attenuation imposed by the metallised + windows installed within our building. Even though the transmitter is only \SI{5}{\meter} away from the reference + measurement, the windows attenuate the signal as much as \SI{50}{\meter} of corridor. + While \optPerRegion{} is able to overcome some of those situations, it requires a profound prior knowledge + when selecting the regions that model should work with. + %Such issues can only be fixed using more appropriate models that consider walls and other obstacles. + + \begin{figure} + \centering + \input{gfx/compare-wifi-in-out.tex} + \label{fig:wifiIndoorOutdoor} + \caption{ + Measurable signal strengths of a testing \docAPshort{} (black dot). + While the signal diminishes slowly along the corridor (upper rectangle) + the metallised windows (dashed outline) attenuate the signal by over \SI{30}{\decibel} (lower rectangle). + } \end{figure} - - - \begin{figure} - \centering - \input{gfx/compare-wifi-in-out.tex} - \caption{ - Measurable signal strengths of a testing \docAPshort{} (black dot). - While the signal diminishes slowly along the corridor (upper rectangle) - the metallised windows (dashed outline) attenuate the signal by over \SI{30}{\decibel} (lower rectangle). - } - \end{figure} - - fenster sind metallbedampft und schirmen stark ab - siehe beispielgrafik - - \todo{ - distance between AP pos estimation and real position??? - } + + BESCHREIBEN + + \begin{figure} + \centering + \input{gfx/wifiOptApPosDifference.tex} + \caption{UNNÖTIG?} + \end{figure} + % -------------------------------- number of fingerprints -------------------------------- % @@ -193,7 +215,7 @@ - % -------------------------------- plots indicating optimization issues -------------------------------- % + % -------------------------------- plots indicating walk issues -------------------------------- % \begin{figure} \input{gfx/wifiMultimodality.tex} diff --git a/tex/chapters/work.tex b/tex/chapters/work.tex index cded682..c5ccc5c 100644 --- a/tex/chapters/work.tex +++ b/tex/chapters/work.tex @@ -62,7 +62,7 @@ Depending on the use case, this value describes the number and type of walls, ceilings, floors etc. between both positions. For obstacles, this requires an intersection-test of each obstacle with the line-of-sight, which is costly for larger buildings. For real-time use on a smartphone, a (discretized) model pre-computation might thus be necessary - \todo{cite competition}. Furthermore this requires a detailed floorplan, that includes material information + \cite{competition}. Furthermore this requires a detailed floorplan, that includes material information for walls, doors, floors and ceilings. Throughout this work, we thus use a tradeoff between both models, where walls are ignored and only floors/ceilings are considered. @@ -171,23 +171,33 @@ As the used model tradeoff does not consider walls, it is expected to provide erroneous values for regions that are heavily shrouded by e.g. steel-enforced concrete or metallised glass. + Instead of using only one optimized model per \docAP{}, we use several instances with different + parameters that are limited to some region within the building: + {\bf \optPerFloor{}} will use one model for each story, that is optimized using + only the fingerprints that belong to the corresponding floor. During evaluation, + the $z$-value from $\mPosVec{}$ in \refeq{eq:wifiProb} is used to select the model + for this location's signal strength estimation. + + {\bf \optPerRegion{}} works similar, except that the model is limited to a predefined, + axis-aligned bounding box. This approach allows a distinction between in- and outdoor-regions + or locations that are expected to highly differ from their surroundings. \subsection{\docWIFI{} quality factor} - Past evaluations showed, that there are many situations where the \docWIFI{} location estimation + Evaluations within previous works showed, that there are many situations where the \docWIFI{} location estimation is highly erroneous. Either when the signal strength prediction model does not match real world conditions or the received measurements are ambiguous and there is more than one location within the building that matches those readings. Both cases can occur e.g. in areas surrounded by concrete walls where the model does not match the real world conditions as those walls are not considered, - and the smartphone barely receives some \docAPshort{}s due to the high attenuation. + and the smartphone barely receives \docAPshort{}s due to the high attenuation. If such a sensor error occurs only for a short time period, the recursive density estimation - \refeq{eq:recursiveDensity} is able to compensate those errors using other sensors and the movement - model. However, if the error persists for a longer time period, the error will slowly distort + \refeq{eq:recursiveDensity} is able to compensate those errors using other observations and the transition + model. However, if the sensor-fault persists for a longer time period, such an error will slowly distort the posterior distribution. As our movement model depends on the actual floorplan, the density - might get trapped e.g. within a room if the other sensors are not able to compensate for + might get trapped e.g. within a room if the other sensors are unable to compensate for the \docWIFI{} error. Thus, we try to determine the quality of received \docWIFI{} measurements, which allows for @@ -196,8 +206,7 @@ In \refeq{eq:wifiQuality} we use the average signal strength of all \docAP{}s seen within one measurement and scale this value to match a region of $[0, 1]$ depending on an upper- and lower bound. - If the returned quality falls below a certain threshold, \docWIFI{} is ignored within - the evaluation. + If the returned quality is below a certain threshold, \docWIFI{} is ignored within the evaluation. \begin{equation} \newcommand{\leMin}{l_\text{min}} @@ -219,7 +228,7 @@ \subsection {VAP grouping} \label{sec:vap} - Assuming normal conditions, the received signal strength at one location will also (strongly) vary + Assuming normal conditions, the received signal strength at one location will also (strongly) vary over time due to environmental conditions like temperature, humidity, open/closed doors and RF interference. Fast variations can be addressed by averaging several consecutive measurements at the expense of a delay in time. @@ -227,24 +236,17 @@ where one physical hardware \docAP{} provides more than one virtual network to connect to. They can usually be identified, as only the last digit of the MAC-address is altered among the virtual networks. % - As those virtual networks normally share the same frequency, they are unable to transmit at the same time. + As those virtual networks normally share the same frequency, they are unable to transmit at the same instant in time. When scanning for \docAPshort{}s one will thus receive several responses from the same hardware, all with - a very small delay in time (micro- to milliseconds). Such measurements may be grouped using some aggregate + a very small delay (micro- to milliseconds). Such measurements may be grouped using some aggregate function like average, median or maximum. -wie wird optimiert -a) bekannte pos + empirische params -b) bekannte pos + opt params (fur alle APs gleich) [simplex] -c) bekannte pos + opt params (eigene je AP) [simplex] -d) alles opt: pos und params (je ap) [range-random] -optimierung ist tricky. auch wegen dem WAF der ja sprunghaft dazu kommt, sobald messung und AP in zwei unterschiedlichen -stockwerken liegen.. und das selbst wenn hier vlt sichtkontakt möglich wäre, da der test 2D ist und nicht 3D +\todo{??? aps sind (statistisch) unaebhaengig. d.h., jeder AP kann fuer sich optimiert werden. optimierung des gesamtsystems ist nicht notwendig. - -pro AP also 6 params. pos x/y/z, txp, exp, waf +}