diff --git a/src/wifi/model/aparf-wifi-manager.cc b/src/wifi/model/aparf-wifi-manager.cc index 3aac7afbc..01650c7ee 100644 --- a/src/wifi/model/aparf-wifi-manager.cc +++ b/src/wifi/model/aparf-wifi-manager.cc @@ -127,7 +127,8 @@ AparfWifiManager::~AparfWifiManager () void AparfWifiManager::SetupPhy (Ptr phy) { - m_nPower = phy->GetNTxPower (); + m_minPower = phy->GetTxPowerStart(); + m_maxPower = phy->GetTxPowerEnd(); WifiRemoteStationManager::SetupPhy (phy); } @@ -158,7 +159,7 @@ AparfWifiManager::CheckInit (AparfWifiRemoteStation *station) { station->m_nSupported = GetNSupported (station); station->m_rate = station->m_nSupported - 1; - station->m_power = m_nPower - 1; + station->m_power = m_maxPower; station->m_rateCrit = 0; m_powerChange (station->m_power, station->m_state->m_address); m_rateChange (station->m_rate, station->m_state->m_address); @@ -197,7 +198,7 @@ void AparfWifiManager::DoReportDataFailed (WifiRemoteStation *st) station->m_nFailed = 0; station->m_nSuccess = 0; station->m_pCount = 0; - if (station->m_power == (m_nPower - 1)) + if (station->m_power == m_maxPower) { station->m_rateCrit = station->m_rate; if (station->m_rate != 0) @@ -261,7 +262,7 @@ AparfWifiManager::DoReportDataOk (WifiRemoteStation *st, double ackSnr, station->m_nFailed = 0; if (station->m_rate == (station->m_state->m_operationalRateSet.size () - 1)) { - if (station->m_power != 0) + if (station->m_power != m_minPower) { NS_LOG_DEBUG ("station=" << station << " dec power"); station->m_power -= m_powerDec; @@ -283,7 +284,7 @@ AparfWifiManager::DoReportDataOk (WifiRemoteStation *st, double ackSnr, { if (station->m_pCount == m_powerMax) { - station->m_power = (m_nPower - 1); + station->m_power = m_maxPower; m_powerChange (station->m_power, station->m_state->m_address); station->m_rate = station->m_rateCrit; m_rateChange (station->m_rate, station->m_state->m_address); @@ -292,7 +293,7 @@ AparfWifiManager::DoReportDataOk (WifiRemoteStation *st, double ackSnr, } else { - if (station->m_power != 0) + if (station->m_power != m_minPower) { station->m_power -= m_powerDec; m_powerChange (station->m_power, station->m_state->m_address); diff --git a/src/wifi/model/aparf-wifi-manager.h b/src/wifi/model/aparf-wifi-manager.h index cabfc7833..f65f96886 100644 --- a/src/wifi/model/aparf-wifi-manager.h +++ b/src/wifi/model/aparf-wifi-manager.h @@ -110,12 +110,18 @@ private: uint32_t m_powerDec; //!< Step size for decrement the power. uint32_t m_rateInc; //!< Step size for increment the rate. uint32_t m_rateDec; //!< Step size for decrement the rate. + /** - * Number of power levels. + * Minimal power level. * Differently form rate, power levels do not depend on the remote station. * The levels depend only on the physical layer of the device. */ - uint32_t m_nPower; + uint32_t m_minPower; + + /** + * Maximal power level. + */ + uint32_t m_maxPower; /** * The trace source fired when the transmission power change diff --git a/src/wifi/model/parf-wifi-manager.cc b/src/wifi/model/parf-wifi-manager.cc index 2ba4a13a2..a0ea97bdc 100644 --- a/src/wifi/model/parf-wifi-manager.cc +++ b/src/wifi/model/parf-wifi-manager.cc @@ -95,7 +95,8 @@ ParfWifiManager::~ParfWifiManager () void ParfWifiManager::SetupPhy (Ptr phy) { - m_nPower = phy->GetNTxPower (); + m_minPower = phy->GetTxPowerStart (); + m_maxPower = phy->GetTxPowerEnd (); WifiRemoteStationManager::SetupPhy (phy); } @@ -126,7 +127,7 @@ ParfWifiManager::CheckInit (ParfWifiRemoteStation *station) { station->m_nSupported = GetNSupported (station); station->m_currentRate = station->m_nSupported - 1; - station->m_currentPower = m_nPower - 1; + station->m_currentPower = m_maxPower; m_powerChange (station->m_currentPower, station->m_state->m_address); m_rateChange (station->m_currentRate, station->m_state->m_address); station->m_initialized = true; @@ -184,7 +185,7 @@ ParfWifiManager::DoReportDataFailed (WifiRemoteStation *st) if (station->m_nRetry == 1) { //need recovery fallback - if (station->m_currentPower < m_nPower - 1) + if (station->m_currentPower < m_maxPower) { NS_LOG_DEBUG ("station=" << station << " inc power"); station->m_currentPower++; @@ -200,7 +201,7 @@ ParfWifiManager::DoReportDataFailed (WifiRemoteStation *st) if (((station->m_nRetry - 1) % 2) == 1) { //need normal fallback - if (station->m_currentPower == m_nPower - 1) + if (station->m_currentPower == m_maxPower) { if (station->m_currentRate != 0) { @@ -264,7 +265,7 @@ void ParfWifiManager::DoReportDataOk (WifiRemoteStation *st, else if (station->m_nSuccess == m_successThreshold || station->m_nAttempt == m_attemptThreshold) { //we are at the maximum rate, we decrease power - if (station->m_currentPower != 0) + if (station->m_currentPower != m_minPower) { NS_LOG_DEBUG ("station=" << station << " dec power"); station->m_currentPower--; diff --git a/src/wifi/model/parf-wifi-manager.h b/src/wifi/model/parf-wifi-manager.h index 960050239..8abd2f5df 100644 --- a/src/wifi/model/parf-wifi-manager.h +++ b/src/wifi/model/parf-wifi-manager.h @@ -91,12 +91,18 @@ private: uint32_t m_attemptThreshold; //!< The minimum number of transmission attempts to try a new power or rate. The 'timer' threshold in the ARF algorithm. uint32_t m_successThreshold; //!< The minimum number of successful transmissions to try a new power or rate. + /** - * Number of power levels. + * Minimal power level. * In contrast to rate, power levels do not depend on the remote station. * The levels depend only on the physical layer of the device. */ - uint32_t m_nPower; + uint32_t m_minPower; + + /** + * Maximal power level. + */ + uint32_t m_maxPower; /** * The trace source fired when the transmission power changes....