src/wifi/model/minstrel-wifi-manager.h
author Ghada Badawy <gbadawy@gmail.com>
Tue, 13 Aug 2013 22:05:25 -0700
changeset 10139 17a71cd49da3
parent 8981 7e1c95c4d1a7
child 10218 97da49da2d6c
permissions -rw-r--r--
partial 802.11n support
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
     2
/*
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
     3
 * Copyright (c) 2009 Duy Nguyen
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
     4
 *
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
     8
 *
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    13
 *
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    17
 *
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    18
 * Author: Duy Nguyen <duy@soe.ucsc.edu>
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    19
 */
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    20
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    21
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    22
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    23
#ifndef MINSTREL_WIFI_MANAGER_H
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    24
#define MINSTREL_WIFI_MANAGER_H
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    25
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    26
#include "wifi-remote-station-manager.h"
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    27
#include "wifi-mode.h"
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    28
#include "ns3/nstime.h"
8981
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
    29
#include "ns3/random-variable-stream.h"
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    30
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    31
namespace ns3 {
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    32
6340
fe24c9edacb6 fixed bug 924
Quincy Tse <quincy.tse@gmail.com>
parents: 6339
diff changeset
    33
struct MinstrelWifiRemoteStation;
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    34
6337
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    35
/**
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    36
 * A struct to contain all information related to a data rate
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    37
 */
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    38
struct RateInfo
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    39
{
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    40
  /**
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    41
   * Perfect transmission time calculation, or frame calculation
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    42
   * Given a bit rate and a packet length n bytes
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    43
   */
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    44
  Time perfectTxTime;
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    45
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    46
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    47
  uint32_t retryCount;  ///< retry limit
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    48
  uint32_t adjustedRetryCount;  ///< adjust the retry limit for this rate
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    49
  uint32_t numRateAttempt;  ///< how many number of attempts so far
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    50
  uint32_t numRateSuccess;    ///< number of successful pkts
6337
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    51
  uint32_t prob;  ///< (# pkts success )/(# total pkts)
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    52
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    53
  /**
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    54
   * EWMA calculation
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    55
   * ewma_prob =[prob *(100 - ewma_level) + (ewma_prob_old * ewma_level)]/100
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    56
   */
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    57
  uint32_t ewmaProb;
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    58
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    59
  uint32_t prevNumRateAttempt;  ///< from last rate
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    60
  uint32_t prevNumRateSuccess;  ///< from last rate
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    61
  uint64_t successHist;  ///< aggregate of all successes
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    62
  uint64_t attemptHist;  ///< aggregate of all attempts
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    63
  uint32_t throughput;  ///< throughput of a rate
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    64
};
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    65
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    66
/**
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    67
 * Data structure for a Minstrel Rate table
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    68
 * A vector of a struct RateInfo
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    69
 */
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    70
typedef std::vector<struct RateInfo> MinstrelRate;
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    71
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    72
/**
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    73
 * Data structure for a Sample Rate table
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    74
 * A vector of a vector uint32_t
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    75
 */
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    76
typedef std::vector<std::vector<uint32_t> > SampleRate;
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    77
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
    78
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    79
/**
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    80
 * \author Duy Nguyen
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    81
 * \brief Implementation of Minstrel Rate Control Algorithm
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    82
 * \ingroup wifi
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    83
 *
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    84
 * Porting Minstrel from Madwifi and Linux Kernel
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    85
 * http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    86
 */
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    87
class MinstrelWifiManager : public WifiRemoteStationManager
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    88
{
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    89
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    90
public:
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    91
  static TypeId GetTypeId (void);
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    92
  MinstrelWifiManager ();
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    93
  virtual ~MinstrelWifiManager ();
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    94
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    95
  virtual void SetupPhy (Ptr<WifiPhy> phy);
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
    96
8981
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
    97
 /**
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
    98
  * Assign a fixed random variable stream number to the random variables
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
    99
  * used by this model.  Return the number of streams (possibly zero) that
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   100
  * have been assigned.
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   101
  *
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   102
  * \param stream first stream index to use
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   103
  * \return the number of stream indices assigned by this model
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   104
  */
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   105
  int64_t AssignStreams (int64_t stream);
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   106
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   107
private:
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   108
  // overriden from base class
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   109
  virtual WifiRemoteStation * DoCreateStation (void) const;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   110
  virtual void DoReportRxOk (WifiRemoteStation *station,
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   111
                             double rxSnr, WifiMode txMode);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   112
  virtual void DoReportRtsFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   113
  virtual void DoReportDataFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   114
  virtual void DoReportRtsOk (WifiRemoteStation *station,
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   115
                              double ctsSnr, WifiMode ctsMode, double rtsSnr);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   116
  virtual void DoReportDataOk (WifiRemoteStation *station,
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   117
                               double ackSnr, WifiMode ackMode, double dataSnr);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   118
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   119
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 8981
diff changeset
   120
 virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 8981
diff changeset
   121
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   122
  virtual bool IsLowLatency (void) const;
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   123
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   124
  /// for estimating the TxTime of a packet with a given mode
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   125
  Time GetCalcTxTime (WifiMode mode) const;
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   126
  void AddCalcTxTime (WifiMode mode, Time t);
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   127
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   128
  /// update the number of retries and reset accordingly
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   129
  void UpdateRetry (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   130
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   131
  /// getting the next sample from Sample Table
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   132
  uint32_t GetNextSample (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   133
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   134
  /// find a rate to use from Minstrel Table
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   135
  uint32_t FindRate (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   136
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   137
  /// updating the Minstrel Table every 1/10 seconds
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   138
  void UpdateStats (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   139
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   140
  /// initialize Minstrel Table
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   141
  void RateInit (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   142
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   143
  /// initialize Sample Table
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   144
  void InitSampleTable (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   145
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   146
  /// printing Sample Table
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   147
  void PrintSampleTable (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   148
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   149
  /// printing Minstrel Table
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   150
  void PrintTable (MinstrelWifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   151
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   152
  void CheckInit (MinstrelWifiRemoteStation *station);  ///< check for initializations
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4703
diff changeset
   153
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   154
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   155
  typedef std::vector<std::pair<Time,WifiMode> > TxTime;
6337
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
   156
  MinstrelRate m_minstrelTable;  ///< minstrel table
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
   157
  SampleRate m_sampleTable;  ///< sample table
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
   158
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   159
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   160
  TxTime m_calcTxTime;  ///< to hold all the calculated TxTime for all modes
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   161
  Time m_updateStats;  ///< how frequent do we calculate the stats(1/10 seconds)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   162
  double m_lookAroundRate;  ///< the % to try other rates than our current rate
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   163
  double m_ewmaLevel;  ///< exponential weighted moving average
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   164
  uint32_t m_segmentSize;  ///< largest allowable segment size
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   165
  uint32_t m_sampleCol;  ///< number of sample columns
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   166
  uint32_t m_pktLen;  ///< packet length used  for calculate mode TxTime
6337
92c95748a915 Fixed Bug 802 and Bug 919
Duy Nguyen <duy@soe.ucsc.edu>
parents: 6065
diff changeset
   167
  uint32_t m_nsupported;  ///< modes supported
8981
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   168
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   169
  /// Provides uniform random variables.
7e1c95c4d1a7 Replace src/wifi usage of RandomVariable with RandomVariableStream
Mitch Watrous
parents: 7141
diff changeset
   170
  Ptr<UniformRandomVariable> m_uniformRandomVariable;
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   171
};
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   172
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   173
} // namespace ns3
4703
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   174
e1259e2fdaad add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff changeset
   175
#endif /* MINSTREL_WIFI_MANAGER_H */