38 lines
1008 B
C++
38 lines
1008 B
C++
/*
|
|
* This file is part of the Owl Positioning System (OwlPS).
|
|
* OwlPS is a project of the University of Franche-Comté
|
|
* (Université de Franche-Comté), France.
|
|
*/
|
|
|
|
|
|
#include "fbcm.hh"
|
|
#include "stock.hh"
|
|
#include "configuration.hh"
|
|
|
|
|
|
|
|
Result FBCM::compute(const Request &_request)
|
|
{
|
|
// If the autocalibration is activated, we have to regenerate the
|
|
// Friis indexes each time we calculate a position
|
|
if (Configuration::bool_value("positioning.generate-reference-points"))
|
|
Stock::update_all_friis_indexes() ;
|
|
return MultilaterationAlgorithm::compute(_request) ;
|
|
}
|
|
|
|
|
|
float FBCM::estimate_distance(const Measurement &measurement)
|
|
{
|
|
double constant_term = make_constant_term(measurement) ;
|
|
const float &average_ss = measurement.get_average_ss() ;
|
|
const AccessPoint *ap = measurement.get_ap() ;
|
|
return pow(10, (constant_term - average_ss) /
|
|
(10 * friis_index(ap))) ;
|
|
}
|
|
|
|
|
|
inline float FBCM::friis_index(const AccessPoint *const ap) const
|
|
{
|
|
return ap->get_friis_index() ;
|
|
}
|