success heuristic was inverted.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 14 Dec 2007 17:42:16 +0100
changeset 2279 ff1d63db246d
parent 2278 4b05fbf5c6e3
child 2280 cb07eb75d520
success heuristic was inverted.
src/devices/wifi/amrr-mac-stations.cc
--- a/src/devices/wifi/amrr-mac-stations.cc	Fri Dec 14 15:43:52 2007 +0100
+++ b/src/devices/wifi/amrr-mac-stations.cc	Fri Dec 14 17:42:16 2007 +0100
@@ -38,7 +38,7 @@
  1.0/3.0);
 static NumericDefaultValue<double> g_successRatio
 ("WifiAmrrSuccessRatio",
- "Ratio of successful transmissions needed to switch to a higher rate",
+ "Ratio of erronous transmissions needed to switch to a higher rate",
  1.0/10.0);
 static NumericDefaultValue<uint32_t> g_maxSuccessThreshold
 ("WifiAmrrMaxSuccessThreshold",
@@ -122,7 +122,7 @@
 bool
 AmrrMacStation::IsSuccess (void) const
 {
-  return m_tx_ok > (m_tx_retr + m_tx_err) * m_stations->m_successRatio;
+  return (m_tx_retr + m_tx_err) < m_tx_ok * m_stations->m_successRatio;
 }
 bool
 AmrrMacStation::IsFailure (void) const
@@ -168,7 +168,8 @@
   if (IsSuccess () && IsEnough ()) 
     {
       m_success++;
-      NS_LOG_DEBUG ("success="<<m_success<<" successThreshold="<<m_successThreshold<<
+      NS_LOG_DEBUG ("++ success="<<m_success<<" successThreshold="<<m_successThreshold<<
+                    " tx_ok="<<m_tx_ok<<" tx_err="<<m_tx_err<<" tx_retr="<<m_tx_retr<<
                     " rate="<<m_txrate<<" n-supported-rates="<<GetNSupportedModes ());
       if (m_success >= m_successThreshold &&
           !IsMaxRate ()) 
@@ -186,6 +187,9 @@
   else if (IsFailure ()) 
     {
       m_success = 0;
+      NS_LOG_DEBUG ("-- success="<<m_success<<" successThreshold="<<m_successThreshold<<
+                    " tx_ok="<<m_tx_ok<<" tx_err="<<m_tx_err<<" tx_retr="<<m_tx_retr<<
+                    " rate="<<m_txrate<<" n-supported-rates="<<GetNSupportedModes ());
       if (!IsMinRate ()) 
         {
           if (m_recovery)