View | Details | Raw Unified | Return to bug 2820
Collapse All | Expand All

(-)a/src/wifi/model/rrpaa-wifi-manager.cc (-15 / +15 lines)
 Lines 154-162   void Link Here 
154
RrpaaWifiManager::SetupPhy (const Ptr<WifiPhy> phy)
154
RrpaaWifiManager::SetupPhy (const Ptr<WifiPhy> phy)
155
{
155
{
156
  NS_LOG_FUNCTION (this);
156
  NS_LOG_FUNCTION (this);
157
  m_minPower = phy->GetTxPowerStart ();
157
  m_nPowerLevels = phy->GetNTxPower ();
158
  m_maxPower = phy->GetTxPowerEnd ();
158
  m_maxPowerLevel = m_nPowerLevels  - 1;
159
  m_nPower = m_maxPower - m_minPower + 1;
159
  m_minPowerLevel = 0;
160
  uint32_t nModes = phy->GetNModes ();
160
  uint32_t nModes = phy->GetNModes ();
161
  for (uint32_t i = 0; i < nModes; i++)
161
  for (uint32_t i = 0; i < nModes; i++)
162
    {
162
    {
 Lines 246-265   RrpaaWifiManager::CheckInit (RrpaaWifiRemoteStation *station) Link Here 
246
      //Initialize at minimal rate and maximal power.
246
      //Initialize at minimal rate and maximal power.
247
      station->m_prevRateIndex = 0;
247
      station->m_prevRateIndex = 0;
248
      station->m_rateIndex = 0;
248
      station->m_rateIndex = 0;
249
      station->m_prevPowerLevel = m_maxPower;
249
      station->m_prevPowerLevel = m_maxPowerLevel;
250
      station->m_powerLevel = m_maxPower;
250
      station->m_powerLevel = m_maxPowerLevel;
251
      WifiMode mode = GetSupported (station, 0);
251
      WifiMode mode = GetSupported (station, 0);
252
      uint8_t channelWidth = GetChannelWidth (station);
252
      uint8_t channelWidth = GetChannelWidth (station);
253
      DataRate rate = DataRate (mode.GetDataRate (channelWidth));
253
      DataRate rate = DataRate (mode.GetDataRate (channelWidth));
254
      double power = GetPhy ()->GetPowerDbm (m_maxPower);
254
      double power = GetPhy ()->GetPowerDbm (station->m_powerLevel);
255
      m_rateChange (rate, rate, station->m_state->m_address);
255
      m_rateChange (rate, rate, station->m_state->m_address);
256
      m_powerChange (power, power, station->m_state->m_address);
256
      m_powerChange (power, power, station->m_state->m_address);
257
257
258
      station->m_pdTable = RrpaaProbabilitiesTable (station->m_nRate, std::vector<double> (m_nPower));
258
      station->m_pdTable = RrpaaProbabilitiesTable (station->m_nRate, std::vector<double> (m_nPowerLevels));
259
      NS_LOG_DEBUG ("Initializing pdTable");
259
      NS_LOG_DEBUG ("Initializing pdTable");
260
      for (uint32_t i = 0; i < station->m_nRate; i++)
260
      for (uint32_t i = 0; i < station->m_nRate; i++)
261
        {
261
        {
262
          for (uint8_t j = 0; j < m_nPower; j++)
262
          for (uint8_t j = 0; j < m_nPowerLevels; j++)
263
            {
263
            {
264
              station->m_pdTable[i][j] = 1;
264
              station->m_pdTable[i][j] = 1;
265
            }
265
            }
 Lines 470-476   RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station) Link Here 
470
  NS_LOG_DEBUG ("Worst loss prob= " << wploss);
470
  NS_LOG_DEBUG ("Worst loss prob= " << wploss);
471
  if (bploss >= thresholds.m_mtl)
471
  if (bploss >= thresholds.m_mtl)
472
    {
472
    {
473
      if (station->m_powerLevel < m_maxPower)
473
      if (station->m_powerLevel < m_maxPowerLevel)
474
        {
474
        {
475
          NS_LOG_DEBUG ("bploss >= MTL and power < maxPower => Increase Power");
475
          NS_LOG_DEBUG ("bploss >= MTL and power < maxPower => Increase Power");
476
          station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
476
          station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
 Lines 505-511   RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station) Link Here 
505
                {
505
                {
506
                  station->m_pdTable[i][station->m_powerLevel] = 1;
506
                  station->m_pdTable[i][station->m_powerLevel] = 1;
507
                }
507
                }
508
              NS_LOG_DEBUG ("pdTable[" << i << "][" << station->m_powerLevel << "] = " << station->m_pdTable[i][station->m_powerLevel]);
508
              NS_LOG_DEBUG ("pdTable[" << i << "][" << (int)station->m_powerLevel << "] = " << station->m_pdTable[i][station->m_powerLevel]);
509
            }
509
            }
510
          double rand = m_uniformRandomVariable->GetValue (0,1);
510
          double rand = m_uniformRandomVariable->GetValue (0,1);
511
          if (rand < station->m_pdTable[station->m_rateIndex + 1][station->m_powerLevel])
511
          if (rand < station->m_pdTable[station->m_rateIndex + 1][station->m_powerLevel])
 Lines 514-525   RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station) Link Here 
514
              station->m_rateIndex++;
514
              station->m_rateIndex++;
515
            }
515
            }
516
        }
516
        }
517
      else if (station->m_powerLevel > m_minPower)
517
      else if (station->m_powerLevel > m_minPowerLevel)
518
        {
518
        {
519
          NS_LOG_DEBUG ("wploss <= ORI and rate = maxRate => Probabilistic Power Decrease");
519
          NS_LOG_DEBUG ("wploss <= ORI and rate = maxRate => Probabilistic Power Decrease");
520
520
521
          // Recalculate probabilities of higher powers.
521
          // Recalculate probabilities of higher powers.
522
          for (uint32_t i = m_maxPower; i > station->m_powerLevel; i--)
522
          for (uint32_t i = m_maxPowerLevel; i > station->m_powerLevel; i--)
523
            {
523
            {
524
              station->m_pdTable[station->m_rateIndex][i] *= m_delta;
524
              station->m_pdTable[station->m_rateIndex][i] *= m_delta;
525
              if (station->m_pdTable[station->m_rateIndex][i] > 1)
525
              if (station->m_pdTable[station->m_rateIndex][i] > 1)
 Lines 539-550   RrpaaWifiManager::RunBasicAlgorithm (RrpaaWifiRemoteStation *station) Link Here 
539
    }
539
    }
540
  else if (bploss > thresholds.m_ori && wploss < thresholds.m_mtl)
540
  else if (bploss > thresholds.m_ori && wploss < thresholds.m_mtl)
541
    {
541
    {
542
      if (station->m_powerLevel > m_minPower)
542
      if (station->m_powerLevel > m_minPowerLevel)
543
        {
543
        {
544
          NS_LOG_DEBUG ("loss between ORI and MTL and power > minPower => Probabilistic Power Decrease");
544
          NS_LOG_DEBUG ("loss between ORI and MTL and power > minPowerLevel => Probabilistic Power Decrease");
545
545
546
          // Recalculate probabilities of higher powers.
546
          // Recalculate probabilities of higher powers.
547
          for (uint32_t i = m_maxPower; i >= station->m_powerLevel; i--)
547
          for (uint32_t i = m_maxPowerLevel; i >= station->m_powerLevel; i--)
548
            {
548
            {
549
              station->m_pdTable[station->m_rateIndex][i] *= m_delta;
549
              station->m_pdTable[station->m_rateIndex][i] *= m_delta;
550
              if (station->m_pdTable[station->m_rateIndex][i] > 1)
550
              if (station->m_pdTable[station->m_rateIndex][i] > 1)
(-)a/src/wifi/model/rrpaa-wifi-manager.h (-3 / +3 lines)
 Lines 218-226   private: Link Here 
218
   * Differently form rate, power levels do not depend on the remote station.
218
   * Differently form rate, power levels do not depend on the remote station.
219
   * The levels depend only on the physical layer of the device.
219
   * The levels depend only on the physical layer of the device.
220
   */
220
   */
221
  uint32_t m_minPower;     //!< Minimal power level.
221
  uint32_t m_minPowerLevel;     //!< Minimal power level.
222
  uint32_t m_maxPower;     //!< Maximal power level.
222
  uint32_t m_maxPowerLevel;     //!< Maximal power level.
223
  uint32_t m_nPower;       //!< Number of power levels.
223
  uint32_t m_nPowerLevels;      //!< Number of power levels.
224
224
225
  /**
225
  /**
226
   * The trace source fired when the transmission power change
226
   * The trace source fired when the transmission power change

Return to bug 2820