src/wifi/model/ideal-wifi-manager.cc
changeset 10139 17a71cd49da3
parent 9063 32755d0516f4
child 10410 4d4eb8097fa3
equal deleted inserted replaced
10138:2f8e35b43d11 10139:17a71cd49da3
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17  *
    17  *
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    19  */
    19  */
    20 
       
    21 #include "ideal-wifi-manager.h"
    20 #include "ideal-wifi-manager.h"
    22 #include "wifi-phy.h"
    21 #include "wifi-phy.h"
    23 #include "ns3/assert.h"
    22 #include "ns3/assert.h"
    24 #include "ns3/double.h"
    23 #include "ns3/double.h"
    25 #include <cmath>
    24 #include <cmath>
       
    25 
       
    26 #define Min(a,b) ((a < b) ? a : b)
    26 
    27 
    27 namespace ns3 {
    28 namespace ns3 {
    28 
    29 
    29 struct IdealWifiRemoteStation : public WifiRemoteStation
    30 struct IdealWifiRemoteStation : public WifiRemoteStation
    30 {
    31 {
   131 void
   132 void
   132 IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
   133 IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station)
   133 {
   134 {
   134 }
   135 }
   135 
   136 
   136 WifiMode
   137 WifiTxVector
   137 IdealWifiManager::DoGetDataMode (WifiRemoteStation *st, uint32_t size)
   138 IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st, uint32_t size)
   138 {
   139 {
   139   IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
   140   IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
   140   // We search within the Supported rate set the mode with the
   141   // We search within the Supported rate set the mode with the
   141   // highest snr threshold possible which is smaller than m_lastSnr
   142   // highest snr threshold possible which is smaller than m_lastSnr
   142   // to ensure correct packet delivery.
   143   // to ensure correct packet delivery.
   151         {
   152         {
   152           maxThreshold = threshold;
   153           maxThreshold = threshold;
   153           maxMode = mode;
   154           maxMode = mode;
   154         }
   155         }
   155     }
   156     }
   156   return maxMode;
   157   return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNumberOfTransmitAntennas (station), GetStbc (station));
   157 }
   158 }
   158 WifiMode
   159 WifiTxVector
   159 IdealWifiManager::DoGetRtsMode (WifiRemoteStation *st)
   160 IdealWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
   160 {
   161 {
   161   IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
   162   IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st;
   162   // We search within the Basic rate set the mode with the highest
   163   // We search within the Basic rate set the mode with the highest
   163   // snr threshold possible which is smaller than m_lastSnr to
   164   // snr threshold possible which is smaller than m_lastSnr to
   164   // ensure correct packet delivery.
   165   // ensure correct packet delivery.
   173         {
   174         {
   174           maxThreshold = threshold;
   175           maxThreshold = threshold;
   175           maxMode = mode;
   176           maxMode = mode;
   176         }
   177         }
   177     }
   178     }
   178   return maxMode;
   179   return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNumberOfTransmitAntennas (station), GetStbc (station));
   179 }
   180 }
   180 
   181 
   181 bool
   182 bool
   182 IdealWifiManager::IsLowLatency (void) const
   183 IdealWifiManager::IsLowLatency (void) const
   183 {
   184 {