From a9fce22aa77086e4dae7ca35b76d4ec757656758 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Wed, 15 Apr 2009 13:56:01 +0200 Subject: [PATCH] noiseFloor -> noiseFigure (bug 543) --- src/devices/wifi/interference-helper.cc | 13 +++++++------ src/devices/wifi/interference-helper.h | 6 +++--- src/devices/wifi/yans-wifi-phy.cc | 24 +++++++++++++++--------- src/devices/wifi/yans-wifi-phy.h | 4 ++-- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/devices/wifi/interference-helper.cc b/src/devices/wifi/interference-helper.cc index fa50b5674..186e6c44d 100644 --- a/src/devices/wifi/interference-helper.cc +++ b/src/devices/wifi/interference-helper.cc @@ -137,15 +137,15 @@ InterferenceHelper::GetMaxPacketDuration (void) const } void -InterferenceHelper::SetNoiseFloorW (double noiseFloor) +InterferenceHelper::SetNoiseFigure (double value) { - m_noiseFloorW = noiseFloor; + m_noiseFigure = value; } double -InterferenceHelper::GetNoiseFloorW (void) const +InterferenceHelper::GetNoiseFigure (void) const { - return m_noiseFloorW; + return m_noiseFigure; } void @@ -260,9 +260,10 @@ InterferenceHelper::CalculateSnr (double signal, double noiseInterference, WifiM { // thermal noise at 290K in J/s = W static const double BOLTZMANN = 1.3803e-23; + // Nt is the power of thermal noise in W double Nt = BOLTZMANN * 290.0 * mode.GetBandwidth (); - // receiver noise Floor (W) - double noiseFloor = m_noiseFloorW * Nt; + // receiver noise Floor (W) which accounts for thermal noise and non-idealities of the receiver + double noiseFloor = m_noiseFigure * Nt; double noise = noiseFloor + noiseInterference; double snr = signal / noise; return snr; diff --git a/src/devices/wifi/interference-helper.h b/src/devices/wifi/interference-helper.h index 29d284501..8e6005031 100644 --- a/src/devices/wifi/interference-helper.h +++ b/src/devices/wifi/interference-helper.h @@ -50,10 +50,10 @@ public: ~InterferenceHelper (); void Configure80211aParameters (void); - void SetNoiseFloorW (double noiseFloor); + void SetNoiseFigure (double value); void SetErrorRateModel (Ptr rate); - double GetNoiseFloorW (void) const; + double GetNoiseFigure (void) const; Ptr GetErrorRateModel (void) const; @@ -99,7 +99,7 @@ private: WifiMode m_shortPlcpHeaderMode; uint32_t m_plcpHeaderLength; Time m_maxPacketDuration; - double m_noiseFloorW; + double m_noiseFigure; /**< noise figure (linear) */ Events m_events; bool m_80211a; Ptr m_errorRateModel; diff --git a/src/devices/wifi/yans-wifi-phy.cc b/src/devices/wifi/yans-wifi-phy.cc index 369bb589f..f57ebdfaf 100644 --- a/src/devices/wifi/yans-wifi-phy.cc +++ b/src/devices/wifi/yans-wifi-phy.cc @@ -93,11 +93,17 @@ YansWifiPhy::GetTypeId (void) MakeDoubleAccessor (&YansWifiPhy::SetTxPowerStart, &YansWifiPhy::GetTxPowerStart), MakeDoubleChecker ()) - .AddAttribute ("RxNoise", - "Ratio of energy lost by receiver (dB).", + .AddAttribute ("RxNoiseFigure", + "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver." + " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is " + "\"the difference in decibels (dB) between" + " the noise output of the actual receiver to the noise output of an " + " ideal receiver with the same overall gain and bandwidth when the receivers " + " are connected to sources at the standard noise temperature T0 (usually 290 K)\"." + " For", DoubleValue (7), - MakeDoubleAccessor (&YansWifiPhy::SetRxNoise, - &YansWifiPhy::GetRxNoise), + MakeDoubleAccessor (&YansWifiPhy::SetRxNoiseFigure, + &YansWifiPhy::GetRxNoiseFigure), MakeDoubleChecker ()) .AddAttribute ("Standard", "The standard chosen configures a set of transmission modes" " and some PHY-specific constants.", @@ -155,10 +161,10 @@ YansWifiPhy::SetStandard (enum WifiPhyStandard standard) void -YansWifiPhy::SetRxNoise (double db) +YansWifiPhy::SetRxNoiseFigure (double noiseFigureDb) { - NS_LOG_FUNCTION (this << db); - m_interference.SetNoiseFloorW (DbToRatio (db)); + NS_LOG_FUNCTION (this << noiseFigureDb); + m_interference.SetNoiseFigure (DbToRatio (noiseFigureDb)); } void YansWifiPhy::SetTxPowerStart (double start) @@ -219,9 +225,9 @@ YansWifiPhy::SetMobility (Ptr mobility) } double -YansWifiPhy::GetRxNoise (void) const +YansWifiPhy::GetRxNoiseFigure (void) const { - return RatioToDb (m_interference.GetNoiseFloorW ()); + return RatioToDb (m_interference.GetNoiseFigure ()); } double YansWifiPhy::GetTxPowerStart (void) const diff --git a/src/devices/wifi/yans-wifi-phy.h b/src/devices/wifi/yans-wifi-phy.h index faf6e85c4..49d5c2d85 100644 --- a/src/devices/wifi/yans-wifi-phy.h +++ b/src/devices/wifi/yans-wifi-phy.h @@ -75,7 +75,7 @@ public: WifiPreamble preamble); void SetStandard (enum WifiPhyStandard standard); - void SetRxNoise (double ratio); + void SetRxNoiseFigure (double noiseFigureDb); void SetTxPowerStart (double start); void SetTxPowerEnd (double end); void SetNTxPower (uint32_t n); @@ -86,7 +86,7 @@ public: void SetErrorRateModel (Ptr rate); void SetDevice (Ptr device); void SetMobility (Ptr mobility); - double GetRxNoise (void) const; + double GetRxNoiseFigure (void) const; double GetTxGain (void) const; double GetRxGain (void) const; double GetEdThreshold (void) const;