src/devices/wifi/wifi-phy.cc
changeset 2071 122c95ffccdd
parent 2056 013fa0b61714
child 2077 8ff95ff1ed2e
--- a/src/devices/wifi/wifi-phy.cc	Mon Nov 05 18:55:14 2007 +0100
+++ b/src/devices/wifi/wifi-phy.cc	Mon Nov 05 18:55:49 2007 +0100
@@ -175,8 +175,8 @@
 
 WifiPhy::WifiPhy (Ptr<WifiNetDevice> 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 @@
                         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 @@
   case WifiPhy::IDLE:
     if (rxPowerW > m_edThresholdW) 
       {
+        NS_LOG_DEBUG ("sync power="<<rxPowerW<<"W)");
         // sync to signal
         NotifySyncStart (rxDuration);
         SwitchToSync (rxDuration);
@@ -283,7 +284,7 @@
         m_endSyncEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndSync, this, 
                                               packet,
                                               event);
-      } 
+      }
     else 
       {
         NS_LOG_DEBUG ("drop packet because signal power too Small ("<<
@@ -345,7 +346,7 @@
   Time txDuration = CalculateTxDuration (packet.GetSize (), txMode, preamble);
   NotifyTxStart (txDuration);
   SwitchToTx (txDuration);
-  m_channel->Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDbm, txMode, preamble);
+  m_channel->Send (m_device, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble);
 }
 
 uint32_t