src/wifi/model/onoe-wifi-manager.cc
changeset 11450 9f4ae69f12b7
parent 11245 5c781d7e5a25
child 11479 a3dcf66928f3
equal deleted inserted replaced
11449:99300a162f1c 11450:9f4ae69f12b7
    44   uint32_t m_tx_err;
    44   uint32_t m_tx_err;
    45   uint32_t m_tx_retr;
    45   uint32_t m_tx_retr;
    46   uint32_t m_tx_upper;
    46   uint32_t m_tx_upper;
    47   uint32_t m_txrate;
    47   uint32_t m_txrate;
    48 };
    48 };
    49 
       
    50 
    49 
    51 NS_OBJECT_ENSURE_REGISTERED (OnoeWifiManager);
    50 NS_OBJECT_ENSURE_REGISTERED (OnoeWifiManager);
    52 
    51 
    53 TypeId
    52 TypeId
    54 OnoeWifiManager::GetTypeId (void)
    53 OnoeWifiManager::GetTypeId (void)
    75 }
    74 }
    76 
    75 
    77 OnoeWifiManager::OnoeWifiManager ()
    76 OnoeWifiManager::OnoeWifiManager ()
    78 {
    77 {
    79 }
    78 }
       
    79 
    80 WifiRemoteStation *
    80 WifiRemoteStation *
    81 OnoeWifiManager::DoCreateStation (void) const
    81 OnoeWifiManager::DoCreateStation (void) const
    82 {
    82 {
    83   OnoeWifiRemoteStation *station = new OnoeWifiRemoteStation ();
    83   OnoeWifiRemoteStation *station = new OnoeWifiRemoteStation ();
    84   station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod;
    84   station->m_nextModeUpdate = Simulator::Now () + m_updatePeriod;
    89   station->m_tx_retr = 0;
    89   station->m_tx_retr = 0;
    90   station->m_tx_upper = 0;
    90   station->m_tx_upper = 0;
    91   station->m_txrate = 0;
    91   station->m_txrate = 0;
    92   return station;
    92   return station;
    93 }
    93 }
       
    94 
    94 void
    95 void
    95 OnoeWifiManager::DoReportRxOk (WifiRemoteStation *station,
    96 OnoeWifiManager::DoReportRxOk (WifiRemoteStation *station,
    96                                double rxSnr, WifiMode txMode)
    97                                double rxSnr, WifiMode txMode)
    97 {
    98 {
    98 }
    99 }
       
   100 
    99 void
   101 void
   100 OnoeWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
   102 OnoeWifiManager::DoReportRtsFailed (WifiRemoteStation *st)
   101 {
   103 {
   102   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   104   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   103   station->m_shortRetry++;
   105   station->m_shortRetry++;
   104 }
   106 }
       
   107 
   105 void
   108 void
   106 OnoeWifiManager::DoReportDataFailed (WifiRemoteStation *st)
   109 OnoeWifiManager::DoReportDataFailed (WifiRemoteStation *st)
   107 {
   110 {
   108   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   111   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   109   station->m_longRetry++;
   112   station->m_longRetry++;
   110 }
   113 }
       
   114 
   111 void
   115 void
   112 OnoeWifiManager::DoReportRtsOk (WifiRemoteStation *station,
   116 OnoeWifiManager::DoReportRtsOk (WifiRemoteStation *station,
   113                                 double ctsSnr, WifiMode ctsMode, double rtsSnr)
   117                                 double ctsSnr, WifiMode ctsMode, double rtsSnr)
   114 {
   118 {
   115 }
   119 }
       
   120 
   116 void
   121 void
   117 OnoeWifiManager::DoReportDataOk (WifiRemoteStation *st,
   122 OnoeWifiManager::DoReportDataOk (WifiRemoteStation *st,
   118                                  double ackSnr, WifiMode ackMode, double dataSnr)
   123                                  double ackSnr, WifiMode ackMode, double dataSnr)
   119 {
   124 {
   120   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   125   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   121   UpdateRetry (station);
   126   UpdateRetry (station);
   122   station->m_tx_ok++;
   127   station->m_tx_ok++;
   123 }
   128 }
       
   129 
   124 void
   130 void
   125 OnoeWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
   131 OnoeWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
   126 {
   132 {
   127   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   133   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   128   UpdateRetry (station);
   134   UpdateRetry (station);
   129   station->m_tx_err++;
   135   station->m_tx_err++;
   130 }
   136 }
       
   137 
   131 void
   138 void
   132 OnoeWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
   139 OnoeWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
   133 {
   140 {
   134   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   141   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   135   UpdateRetry (station);
   142   UpdateRetry (station);
   136   station->m_tx_err++;
   143   station->m_tx_err++;
   137 }
   144 }
       
   145 
   138 void
   146 void
   139 OnoeWifiManager::UpdateRetry (OnoeWifiRemoteStation *station)
   147 OnoeWifiManager::UpdateRetry (OnoeWifiRemoteStation *station)
   140 {
   148 {
   141   station->m_tx_retr += station->m_shortRetry + station->m_longRetry;
   149   station->m_tx_retr += station->m_shortRetry + station->m_longRetry;
   142   station->m_shortRetry = 0;
   150   station->m_shortRetry = 0;
   143   station->m_longRetry = 0;
   151   station->m_longRetry = 0;
   144 }
   152 }
       
   153 
   145 void
   154 void
   146 OnoeWifiManager::UpdateMode (OnoeWifiRemoteStation *station)
   155 OnoeWifiManager::UpdateMode (OnoeWifiRemoteStation *station)
   147 {
   156 {
   148   if (Simulator::Now () < station->m_nextModeUpdate)
   157   if (Simulator::Now () < station->m_nextModeUpdate)
   149     {
   158     {
   224 
   233 
   225 }
   234 }
   226 
   235 
   227 WifiTxVector
   236 WifiTxVector
   228 OnoeWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
   237 OnoeWifiManager::DoGetDataTxVector (WifiRemoteStation *st,
   229                                 uint32_t size)
   238                                     uint32_t size)
   230 {
   239 {
   231   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   240   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   232   UpdateMode (station);
   241   UpdateMode (station);
   233   NS_ASSERT (station->m_txrate < GetNSupported (station));
   242   NS_ASSERT (station->m_txrate < GetNSupported (station));
   234   uint32_t rateIndex;
   243   uint32_t rateIndex;
   267       else
   276       else
   268         {
   277         {
   269           rateIndex = station->m_txrate;
   278           rateIndex = station->m_txrate;
   270         }
   279         }
   271     }
   280     }
   272   return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
   281   return WifiTxVector (GetSupported (station, rateIndex), GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
   273 }
   282 }
       
   283 
   274 WifiTxVector
   284 WifiTxVector
   275 OnoeWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
   285 OnoeWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
   276 {
   286 {
   277   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   287   OnoeWifiRemoteStation *station = (OnoeWifiRemoteStation *)st;
   278   UpdateMode (station);
   288   UpdateMode (station);
   279   /// \todo can we implement something smarter ?
   289   /// \todo can we implement something smarter ?
   280   return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station),GetNumberOfTransmitAntennas()), GetNess (station), GetStbc (station));
   290   return WifiTxVector (GetSupported (station, 0), GetDefaultTxPowerLevel (), GetShortRetryCount (station), GetShortGuardInterval (station), Min (GetNumberOfReceiveAntennas (station), GetNumberOfTransmitAntennas ()), GetNess (station), GetStbc (station));
   281 }
   291 }
   282 
   292 
   283 bool
   293 bool
   284 OnoeWifiManager::IsLowLatency (void) const
   294 OnoeWifiManager::IsLowLatency (void) const
   285 {
   295 {
   286   return false;
   296   return false;
   287 }
   297 }
   288 
   298 
   289 } // namespace ns3
   299 } //namespace ns3