[Positioning] Define PosUtil::LIGHT_SPEED

This constant will be used instead of a constant value "300000000", with
a more accurate value.
Make MultilaterationAlgorithm use it, and fix the unit test.
This commit is contained in:
Matteo Cypriani 2010-06-10 15:35:55 +02:00
parent 3dcf8bc88a
commit a05c61a3c1
3 changed files with 6 additions and 3 deletions

View File

@ -43,7 +43,7 @@ make_constant_term(const Measurement &measurement)
ap->get_trx_power() +
ap->get_antenna_gain() +
20 * log10(
300000000.0 /
static_cast<double>(PosUtil::LIGHT_SPEED) /
ap->get_frequency() /
(4 * M_PI)
) +

View File

@ -5,6 +5,9 @@
class PosUtil
{
public:
/// The speed of light, in m/s
static const unsigned long LIGHT_SPEED = 299792458 ;
/** @name Wi-Fi */
//@{
/// Converts a Wi-Fi channel to the corresponding frequency in Hz

View File

@ -24,11 +24,11 @@ public:
Measurement measurement(&ap, ss_list) ;
/* ** How to check ref_distance in Scilab? **
* C = 5 + 20 + 20 * log10(300000000 / 2412000000 / (4 * PI)) + 3
* C = 5 + 20 + 20 * log10(299792458 / 2412000000 / (4 * PI)) + 3
* L = -42
* ref_distance = 10^((C-L)/35)
*/
float ref_distance = 7.1547 ;
float ref_distance = 7.1519 ;
float computed_distance = algo->estimate_distance(measurement) ;
TS_ASSERT_DELTA(computed_distance, ref_distance, 0.0001) ;