From d030b978aba30975bcfbcb9487246e3d16bfe622 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 5 Nov 2007 18:55:49 +0100 Subject: [PATCH] use dB instead of dbm where appropriate --- src/devices/wifi/wifi-default-parameters.cc | 12 ++++++------ src/devices/wifi/wifi-default-parameters.h | 4 ++-- src/devices/wifi/wifi-phy.cc | 11 ++++++----- src/devices/wifi/wifi-phy.h | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/devices/wifi/wifi-default-parameters.cc b/src/devices/wifi/wifi-default-parameters.cc index 78ebe8016..178b4a453 100644 --- a/src/devices/wifi/wifi-default-parameters.cc +++ b/src/devices/wifi/wifi-default-parameters.cc @@ -116,12 +116,12 @@ static NumericDefaultValue g_phyNTxPower 1); static NumericDefaultValue g_phyTxGain ("WifiPhyTxGain", - "Transmission gain (dbm).", - 1.0); + "Transmission gain (dB).", + 0.0); static NumericDefaultValue g_phyRxGain ("WifiPhyRxGain", - "Reception gain (dbm).", - 1.0); + "Reception gain (dB).", + 0.0); static StringDefaultValue g_ssid ("WifiSsid", "The ssid to use. \"\" is the broadcast ssid.", @@ -273,12 +273,12 @@ GetPhyTxPowerLevels (void) } double -GetPhyTxGainDbm (void) +GetPhyTxGainDb (void) { return g_phyTxGain.GetValue (); } double -GetPhyRxGainDbm (void) +GetPhyRxGainDb (void) { return g_phyRxGain.GetValue (); } diff --git a/src/devices/wifi/wifi-default-parameters.h b/src/devices/wifi/wifi-default-parameters.h index 519114009..8a013ff87 100644 --- a/src/devices/wifi/wifi-default-parameters.h +++ b/src/devices/wifi/wifi-default-parameters.h @@ -71,8 +71,8 @@ double GetPhyRxNoiseDb (void); double GetPhyTxPowerBaseDbm (void); double GetPhyTxPowerEndDbm (void); uint32_t GetPhyTxPowerLevels (void); -double GetPhyTxGainDbm (void); -double GetPhyRxGainDbm (void); +double GetPhyTxGainDb (void); +double GetPhyRxGainDb (void); Ssid GetSsid (void); diff --git a/src/devices/wifi/wifi-phy.cc b/src/devices/wifi/wifi-phy.cc index 95285a044..4fe0ec271 100644 --- a/src/devices/wifi/wifi-phy.cc +++ b/src/devices/wifi/wifi-phy.cc @@ -175,8 +175,8 @@ WifiPhy::NiChange::operator < (WifiPhy::NiChange const &o) const WifiPhy::WifiPhy (Ptr device) : m_edThresholdW (DbmToW (WifiDefaultParameters::GetPhyEnergyDetectionThresholdDbm ())), - m_txGainDbm (WifiDefaultParameters::GetPhyTxGainDbm ()), - m_rxGainDbm (WifiDefaultParameters::GetPhyRxGainDbm ()), + m_txGainDb (WifiDefaultParameters::GetPhyTxGainDb ()), + m_rxGainDb (WifiDefaultParameters::GetPhyRxGainDb ()), m_rxNoiseRatio (DbToRatio (WifiDefaultParameters::GetPhyRxNoiseDb ())), m_txPowerBaseDbm (WifiDefaultParameters::GetPhyTxPowerBaseDbm ()), m_txPowerEndDbm (WifiDefaultParameters::GetPhyTxPowerEndDbm ()), @@ -243,7 +243,7 @@ WifiPhy::ReceivePacket (Packet const packet, WifiMode txMode, enum WifiPreamble preamble) { - rxPowerDbm += m_rxGainDbm; + rxPowerDbm += m_rxGainDb; double rxPowerW = DbmToW (rxPowerDbm); Time rxDuration = CalculateTxDuration (packet.GetSize (), txMode, preamble); Time endRx = Simulator::Now () + rxDuration; @@ -276,6 +276,7 @@ WifiPhy::ReceivePacket (Packet const packet, case WifiPhy::IDLE: if (rxPowerW > m_edThresholdW) { + NS_LOG_DEBUG ("sync power="<Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDbm, txMode, preamble); + m_channel->Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble); } uint32_t diff --git a/src/devices/wifi/wifi-phy.h b/src/devices/wifi/wifi-phy.h index b630ee930..28502adff 100644 --- a/src/devices/wifi/wifi-phy.h +++ b/src/devices/wifi/wifi-phy.h @@ -304,8 +304,8 @@ private: Time m_maxPacketDuration; double m_edThresholdW; /* unit: W */ - double m_txGainDbm; - double m_rxGainDbm; + double m_txGainDb; + double m_rxGainDb; double m_rxNoiseRatio; double m_txPowerBaseDbm; double m_txPowerEndDbm;