[Positioner] Measurement: use floats, not doubles
Use floats variables for the average and variance.
This commit is contained in:
parent
e687aac741
commit
dcd902c9f0
|
@ -123,10 +123,10 @@ void Measurement::recalculate_average()
|
|||
void Measurement::update_average(ss_t ss_dbm)
|
||||
{
|
||||
// Convert the new SS in mW:
|
||||
double ss_mw = pow(10, static_cast<double>(ss_dbm) / 10.0) ;
|
||||
float ss_mw = pow(10, static_cast<float>(ss_dbm) / 10.0) ;
|
||||
|
||||
// Update the average:
|
||||
double delta = ss_mw - average_mw ;
|
||||
float delta = ss_mw - average_mw ;
|
||||
average_mw += delta / ss_list.size() ;
|
||||
average_dbm = 10.0 * log10(average_mw) ;
|
||||
|
||||
|
|
|
@ -26,15 +26,15 @@ protected:
|
|||
/// List of signal strengths captured (in dBm)
|
||||
std::map<pkt_id_t, ss_t> ss_list ;
|
||||
/// Average of all the captured signal strengths (dBm)
|
||||
double average_dbm ;
|
||||
float average_dbm ;
|
||||
/// Average of all the captured signal strengths (mW)
|
||||
double average_mw ;
|
||||
float average_mw ;
|
||||
/// Variance of all the captured signal strengths
|
||||
double variance ;
|
||||
float variance ;
|
||||
|
||||
private:
|
||||
/// Intermediate variable used to compute the variance
|
||||
double variance_m2 ;
|
||||
float variance_m2 ;
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -62,8 +62,8 @@ public:
|
|||
/** @name Read accessors */
|
||||
//@{
|
||||
AccessPoint* get_ap() const ;
|
||||
double get_average_dbm() const ;
|
||||
double get_variance() const ;
|
||||
float get_average_dbm() const ;
|
||||
float get_variance() const ;
|
||||
int get_nb_ss() const ;
|
||||
//@}
|
||||
|
||||
|
@ -116,13 +116,13 @@ inline AccessPoint* Measurement::get_ap() const
|
|||
}
|
||||
|
||||
|
||||
inline double Measurement::get_average_dbm() const
|
||||
inline float Measurement::get_average_dbm() const
|
||||
{
|
||||
return average_dbm ;
|
||||
}
|
||||
|
||||
|
||||
inline double Measurement::get_variance() const
|
||||
inline float Measurement::get_variance() const
|
||||
{
|
||||
return variance ;
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ float ReferencePoint::friis_indexes_for_ap(
|
|||
measurements.find(ap_mac) ;
|
||||
if (measurement != measurements.end())
|
||||
{
|
||||
double ss = measurement->second.get_average_dbm() ;
|
||||
float ss = measurement->second.get_average_dbm() ;
|
||||
assert((*request)->get_mobile()) ;
|
||||
float mobile_gain =
|
||||
(*request)->get_mobile()->get_antenna_gain() ;
|
||||
|
|
Loading…
Reference in New Issue