[Positioning] Use AccessPoint::friis_constant_term()

Use AccessPoint::friis_constant_term() wherever possible.
Fix MultilaterationAlgorithm::make_constant_term() and
ReferencePoint::friis_indexes_for_ap(), where the AP's trx
power was used instead of the mobile's power.
This commit is contained in:
Matteo Cypriani 2011-08-01 18:22:53 +02:00
parent dde917485a
commit 6167f664e8
4 changed files with 12 additions and 33 deletions

2
TODO
View File

@ -73,8 +73,6 @@
° Cannot compute the error (Real) with autocalibration requests.
- Algorithms
° Check MultilaterationAlgorithm::make_constant_term().
Hint: mobile.trx_power() vs. ap.trx_power().
° MinMax: use a different step for X, Y and Z?
- Autocalibration

View File

@ -47,19 +47,15 @@ double MultilaterationAlgorithm::
make_constant_term(const Measurement &measurement)
{
assert(request) ;
assert(request->get_mobile()) ;
const Mobile *mobile = request->get_mobile() ;
assert(mobile) ;
const AccessPoint *ap = measurement.get_ap() ;
assert(ap) ;
return
ap->get_trx_power() +
ap->get_antenna_gain() +
20 * log10(
static_cast<double>(PosUtil::LIGHT_SPEED) /
ap->get_frequency() /
(4 * M_PI)
) +
request->get_mobile()->get_antenna_gain() ;
ap->friis_constant_term() +
mobile->get_antenna_gain() +
mobile->get_trx_power() ;
}

View File

@ -204,13 +204,7 @@ float ReferencePoint::
friis_index_for_ap(const string &ap_mac) const
{
const AccessPoint &ap = Stock::get_ap(ap_mac) ;
double ap_freq = ap.get_frequency() ;
double const_term =
ap.get_antenna_gain()
- 20 * log10(4 * M_PI)
+ 20 * log10(PosUtil::LIGHT_SPEED / ap_freq)
+ ap.get_trx_power() ;
double const_term = ap.friis_constant_term() ;
int nb_friis_idx = 0 ;
double friis_idx_sum =
@ -258,8 +252,10 @@ float ReferencePoint::friis_indexes_for_ap(
assert((*request)->get_mobile()) ;
float mobile_gain =
(*request)->get_mobile()->get_antenna_gain() ;
float mobile_pow =
(*request)->get_mobile()->get_trx_power() ;
friis_idx_sum +=
(const_term + mobile_gain - ss)
(const_term + mobile_gain + mobile_pow - ss)
/ (10 * log10(distance)) ;
++nb_indexes ;
}

View File

@ -281,12 +281,7 @@ void Stock::update_all_friis_indexes()
int nb_friis_idx = 0 ;
// Compute main general term, independant from scans
double ap_freq = ap->second.get_frequency() ;
double const_term =
ap->second.get_antenna_gain()
- 20 * log10(4 * M_PI)
+ 20 * log10(PosUtil::LIGHT_SPEED / ap_freq)
+ ap->second.get_trx_power() ;
double const_term = ap->second.friis_constant_term() ;
/*
* Compute indexes for each ReferencePoint. The Friis index for an
@ -566,14 +561,8 @@ void Stock::generate_reference_point(const Point3D &point)
// Distance RX-P
float point_dst =
rx_coord.distance(point) ;
// Constants & common data
double wavelength =
static_cast<double>(PosUtil::LIGHT_SPEED) /
rx->second.get_frequency() ;
double common_ss =
rx->second.get_antenna_gain() +
20 * log10(wavelength) -
20 * log10(4 * M_PI) ;
// Constant term
double common_ss = rx->second.friis_constant_term() ;
// SS for REF1
const ReferencePoint &ref1_rp =
get_reference_point(ref1_coord) ;