25 lines
547 B
C++
25 lines
547 B
C++
|
#include "interlinknetworks.hh"
|
||
|
#include "mobile.hh"
|
||
|
|
||
|
using std::tr1::unordered_map ;
|
||
|
|
||
|
|
||
|
|
||
|
float InterlinkNetworks::estimate_distance(const Measurement &measurement)
|
||
|
{
|
||
|
const AccessPoint &ap = *measurement.get_ap() ;
|
||
|
assert(&ap) ;
|
||
|
|
||
|
double constant_term =
|
||
|
ap.get_trx_power() +
|
||
|
ap.get_antenna_gain() +
|
||
|
20 * log10(
|
||
|
300000000.0 /
|
||
|
ap.get_frequency() /
|
||
|
(4 * M_PI)
|
||
|
) +
|
||
|
mobile->get_antenna_gain() ;
|
||
|
const float &average_ss = measurement.get_average_ss() ;
|
||
|
return pow(10, (constant_term - average_ss) / 35) ;
|
||
|
}
|