author | Duy Nguyen <duy@soe.ucsc.edu> |
Fri, 25 Sep 2009 22:25:58 -0700 | |
changeset 5260 | a9154b34d4d5 |
parent 5235 | ca04d8e6cb2e |
child 6065 | 0f012e7d9128 |
permissions | -rw-r--r-- |
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; -*- */ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
2 |
/* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 Duy Nguyen |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
4 |
* |
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 |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
17 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
18 |
* Author: Duy Nguyen <duy@soe.ucsc.edu> |
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 |
* Some Comments: |
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 |
* 1) Segment Size is declared for completeness but not used because it has |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
23 |
* to do more with the requirement of the specific hardware. |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
24 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
25 |
* 2) By default, Minstrel applies the multi-rate retry(the core of Minstrel |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
26 |
* algorithm). Otherwise, please use ConstantRateWifiManager instead. |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
27 |
* |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
28 |
* http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
29 |
*/ |
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
32 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
33 |
#include "minstrel-wifi-manager.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
34 |
#include "wifi-phy.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
35 |
#include "ns3/random-variable.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
36 |
#include "ns3/simulator.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
37 |
#include "ns3/log.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
38 |
#include "ns3/uinteger.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
39 |
#include "ns3/double.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
40 |
#include "ns3/wifi-mac.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
41 |
#include "ns3/assert.h" |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
42 |
#include <vector> |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
43 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
44 |
NS_LOG_COMPONENT_DEFINE ("MinstrelWifiManager"); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
45 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
46 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
47 |
namespace ns3 { |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
48 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
49 |
NS_OBJECT_ENSURE_REGISTERED (MinstrelWifiManager); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
50 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
51 |
TypeId |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
52 |
MinstrelWifiManager::GetTypeId (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
53 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
54 |
static TypeId tid = TypeId ("ns3::MinstrelWifiManager") |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
55 |
.SetParent<WifiRemoteStationManager> () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
56 |
.AddConstructor<MinstrelWifiManager> () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
57 |
.AddAttribute ("UpdateStatistics", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
58 |
"The interval between updating statistics table ", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
59 |
TimeValue (Seconds (0.1)), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
60 |
MakeTimeAccessor (&MinstrelWifiManager::m_updateStats), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
61 |
MakeTimeChecker ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
62 |
.AddAttribute ("LookAroundRate", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
63 |
"the percentage to try other rates", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
64 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
65 |
MakeDoubleAccessor (&MinstrelWifiManager::m_lookAroundRate), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
66 |
MakeDoubleChecker<double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
67 |
.AddAttribute ("EWMA", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
68 |
"EWMA level", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
69 |
DoubleValue (75), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
70 |
MakeDoubleAccessor (&MinstrelWifiManager::m_ewmaLevel), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
71 |
MakeDoubleChecker<double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
72 |
.AddAttribute ("SegmentSize", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
73 |
"The largest allowable segment size packet", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
74 |
DoubleValue (6000), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
75 |
MakeDoubleAccessor (&MinstrelWifiManager::m_segmentSize), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
76 |
MakeDoubleChecker <double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
77 |
.AddAttribute ("SampleColumn", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
78 |
"The number of columns used for sampling", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
79 |
DoubleValue (10), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
80 |
MakeDoubleAccessor (&MinstrelWifiManager::m_sampleCol), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
81 |
MakeDoubleChecker <double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
82 |
.AddAttribute ("PacketLength", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
83 |
"The packet length used for calculating mode TxTime", |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
84 |
DoubleValue (1200), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
85 |
MakeDoubleAccessor (&MinstrelWifiManager::m_pktLen), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
86 |
MakeDoubleChecker <double> ()) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
87 |
; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
88 |
return tid; |
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
91 |
MinstrelWifiManager::MinstrelWifiManager () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
92 |
{} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
93 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
94 |
MinstrelWifiManager::~MinstrelWifiManager () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
95 |
{} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
96 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
97 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
98 |
MinstrelWifiManager::SetupPhy (Ptr<WifiPhy> phy) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
99 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
100 |
uint32_t nModes = phy->GetNModes (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
101 |
for (uint32_t i = 0; i < nModes; i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
102 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
103 |
WifiMode mode = phy->GetMode (i); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
104 |
AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, mode, WIFI_PREAMBLE_LONG)); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
105 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
106 |
WifiRemoteStationManager::SetupPhy (phy); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
107 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
108 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
109 |
WifiRemoteStation * |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
110 |
MinstrelWifiManager::CreateStation (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
111 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
112 |
return new MinstrelWifiRemoteStation (this); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
113 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
114 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
115 |
Time |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
116 |
MinstrelWifiManager::GetCalcTxTime (WifiMode mode) const |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
117 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
118 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
119 |
for (TxTime::const_iterator i = m_calcTxTime.begin (); i != m_calcTxTime.end (); i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
120 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
121 |
if (mode == i->second) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
122 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
123 |
return i->first; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
124 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
125 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
126 |
NS_ASSERT (false); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
127 |
return Seconds (0); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
128 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
129 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
130 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
131 |
MinstrelWifiManager::AddCalcTxTime (WifiMode mode, Time t) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
132 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
133 |
m_calcTxTime.push_back (std::make_pair (t, mode)); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
134 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
135 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
136 |
MinstrelWifiRemoteStation::MinstrelWifiRemoteStation (Ptr<MinstrelWifiManager> stations) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
137 |
:m_stations (stations), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
138 |
m_nextStatsUpdate (Simulator::Now () + stations->m_updateStats), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
139 |
m_col (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
140 |
m_index (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
141 |
m_maxTpRate (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
142 |
m_maxTpRate2 (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
143 |
m_maxProbRate (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
144 |
m_packetCount (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
145 |
m_sampleCount (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
146 |
m_isSampling (false), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
147 |
m_sampleRate (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
148 |
m_sampleRateSlower (false), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
149 |
m_currentRate (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
150 |
m_shortRetry (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
151 |
m_longRetry (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
152 |
m_retry (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
153 |
m_err (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
154 |
m_txrate (0), |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
155 |
m_initialized (false) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
156 |
{} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
157 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
158 |
MinstrelWifiRemoteStation::~MinstrelWifiRemoteStation () |
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 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
161 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
162 |
MinstrelWifiRemoteStation::CheckInit(void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
163 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
164 |
if (!m_initialized) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
165 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
166 |
m_minstrelTable = MinstrelRate(GetNSupportedModes ()); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
167 |
m_sampleTable = SampleRate(GetNSupportedModes (), std::vector<uint32_t> (m_stations->m_sampleCol)); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
168 |
InitSampleTable (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
169 |
RateInit (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
170 |
m_initialized = true; |
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 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
173 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
174 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
175 |
MinstrelWifiRemoteStation::DoReportRxOk (double rxSnr, WifiMode txMode) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
176 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
177 |
NS_LOG_DEBUG("DoReportRxOk m_txrate=" << m_txrate); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
178 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
179 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
180 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
181 |
MinstrelWifiRemoteStation::DoReportRtsFailed (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
182 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
183 |
NS_LOG_DEBUG("DoReportRtsFailed m_txrate=" << m_txrate); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
184 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
185 |
m_shortRetry++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
186 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
187 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
188 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
189 |
MinstrelWifiRemoteStation::DoReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
190 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
191 |
NS_LOG_DEBUG ("self="<<this<<" rts ok"); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
192 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
193 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
194 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
195 |
MinstrelWifiRemoteStation::DoReportFinalRtsFailed (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
196 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
197 |
UpdateRetry (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
198 |
m_err++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
199 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
200 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
201 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
202 |
MinstrelWifiRemoteStation::DoReportDataFailed (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
203 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
204 |
CheckInit(); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
205 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
206 |
m_longRetry++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
207 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
208 |
NS_LOG_DEBUG ("DoReportDataFailed " << this << "\t rate " << m_txrate << "\tlongRetry \t" << m_longRetry); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
209 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
210 |
/// for normal rate, we're not currently sampling random rates |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
211 |
if (!m_isSampling) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
212 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
213 |
/// use best throughput rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
214 |
if( m_longRetry < m_minstrelTable[m_txrate].adjustedRetryCount) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
215 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
216 |
; ///< there's still a few retries left |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
217 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
218 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
219 |
/// use second best throughput rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
220 |
else if (m_longRetry <= (m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
221 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
222 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
223 |
m_txrate = m_maxTpRate2; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
224 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
225 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
226 |
/// use best probability rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
227 |
else if (m_longRetry <= (m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
228 |
m_minstrelTable[m_maxTpRate2].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
229 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
230 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
231 |
m_txrate = m_maxProbRate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
232 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
233 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
234 |
/// use lowest base rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
235 |
else if (m_longRetry > (m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
236 |
m_minstrelTable[m_maxTpRate2].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
237 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
238 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
239 |
m_txrate = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
240 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
241 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
242 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
243 |
/// for look-around rate, we're currently sampling random rates |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
244 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
245 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
246 |
/// current sampling rate is slower than the current best rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
247 |
if (m_sampleRateSlower) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
248 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
249 |
/// use best throughput rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
250 |
if (m_longRetry < m_minstrelTable[m_txrate].adjustedRetryCount) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
251 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
252 |
; ///< there are a few retries left |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
253 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
254 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
255 |
/// use random rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
256 |
else if (m_longRetry <= (m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
257 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
258 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
259 |
m_txrate = m_sampleRate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
260 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
261 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
262 |
/// use max probability rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
263 |
else if (m_longRetry <= (m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
264 |
m_minstrelTable[m_sampleRate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
265 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount )) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
266 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
267 |
m_txrate = m_maxProbRate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
268 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
269 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
270 |
/// use lowest base rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
271 |
else if (m_longRetry > (m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
272 |
m_minstrelTable[m_sampleRate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
273 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
274 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
275 |
m_txrate = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
276 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
277 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
278 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
279 |
/// current sampling rate is better than current best rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
280 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
281 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
282 |
/// use random rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
283 |
if (m_longRetry < m_minstrelTable[m_txrate].adjustedRetryCount) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
284 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
285 |
; ///< keep using it |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
286 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
287 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
288 |
/// use the best rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
289 |
else if (m_longRetry <= m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
290 |
m_minstrelTable[m_sampleRate].adjustedRetryCount) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
291 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
292 |
m_txrate = m_maxTpRate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
293 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
294 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
295 |
/// use the best probability rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
296 |
else if (m_longRetry <= m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
297 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
298 |
m_minstrelTable[m_sampleRate].adjustedRetryCount) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
299 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
300 |
m_txrate = m_maxProbRate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
301 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
302 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
303 |
/// use the lowest base rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
304 |
else if (m_longRetry > m_minstrelTable[m_txrate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
305 |
m_minstrelTable[m_maxTpRate].adjustedRetryCount + |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
306 |
m_minstrelTable[m_sampleRate].adjustedRetryCount) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
307 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
308 |
m_txrate = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
309 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
310 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
311 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
312 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
313 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
314 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
315 |
MinstrelWifiRemoteStation::DoReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
316 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
317 |
m_isSampling = false; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
318 |
m_sampleRateSlower=false; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
319 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
320 |
CheckInit (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
321 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
322 |
m_minstrelTable[m_txrate].numRateSuccess++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
323 |
m_minstrelTable[m_txrate].numRateAttempt++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
324 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
325 |
UpdateRetry (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
326 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
327 |
m_minstrelTable[m_txrate].numRateAttempt += m_retry; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
328 |
m_packetCount++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
329 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
330 |
if (GetNSupportedModes () >= 1) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
331 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
332 |
m_txrate = FindRate (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
333 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
334 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
335 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
336 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
337 |
MinstrelWifiRemoteStation::DoReportFinalDataFailed (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
338 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
339 |
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate=" << m_txrate); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
340 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
341 |
m_isSampling = false; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
342 |
m_sampleRateSlower=false; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
343 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
344 |
UpdateRetry (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
345 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
346 |
m_minstrelTable[m_txrate].numRateAttempt += m_retry; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
347 |
m_err++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
348 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
349 |
if (GetNSupportedModes () >= 1) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
350 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
351 |
m_txrate = FindRate (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
352 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
353 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
354 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
355 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
356 |
MinstrelWifiRemoteStation::UpdateRetry (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
357 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
358 |
m_retry = m_shortRetry + m_longRetry; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
359 |
m_shortRetry = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
360 |
m_longRetry = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
361 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
362 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
363 |
Ptr<WifiRemoteStationManager> |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
364 |
MinstrelWifiRemoteStation::GetManager (void) const |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
365 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
366 |
return m_stations; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
367 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
368 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
369 |
WifiMode |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
370 |
MinstrelWifiRemoteStation::DoGetDataMode (uint32_t size) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
371 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
372 |
if (!m_initialized) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
373 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
374 |
CheckInit (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
375 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
376 |
/// start the rate at half way |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
377 |
m_txrate = GetNSupportedModes () / 2; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
378 |
} |
5235
ca04d8e6cb2e
Fixed Minstrel rate potential seg fault due to calling UpdateStats before being initialized
Duy Nguyen <duy@soe.ucsc.edu>
parents:
4725
diff
changeset
|
379 |
UpdateStats (); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
380 |
return GetSupportedMode (m_txrate); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
381 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
382 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
383 |
WifiMode |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
384 |
MinstrelWifiRemoteStation::DoGetRtsMode (void) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
385 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
386 |
NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << m_txrate); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
387 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
388 |
return GetSupportedMode (0); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
389 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
390 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
391 |
uint32_t |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
392 |
MinstrelWifiRemoteStation::GetNextSample () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
393 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
394 |
uint32_t bitrate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
395 |
bitrate = m_sampleTable[m_index][m_col]; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
396 |
m_index++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
397 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
398 |
/// bookeeping for m_index and m_col variables |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
399 |
if (m_index > (GetNSupportedModes () -2)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
400 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
401 |
m_index =0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
402 |
m_col++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
403 |
if (m_col >= m_stations->m_sampleCol) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
404 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
405 |
m_col = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
406 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
407 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
408 |
return bitrate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
409 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
410 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
411 |
uint32_t |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
412 |
MinstrelWifiRemoteStation::FindRate () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
413 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
414 |
NS_LOG_DEBUG ("FindRate " << "packet=" << m_packetCount ); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
415 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
416 |
if ((m_sampleCount + m_packetCount) == 0) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
417 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
418 |
return 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
419 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
420 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
421 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
422 |
uint32_t idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
423 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
424 |
/// for determining when to try a sample rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
425 |
UniformVariable coinFlip (0, 100); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
426 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
427 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
428 |
* if we are below the target of look around rate percentage, look around |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
429 |
* note: do it randomly by flipping a coin instead sampling |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
430 |
* all at once until it reaches the look around rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
431 |
*/ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
432 |
if ( (((100* m_sampleCount) / (m_sampleCount + m_packetCount )) < m_stations->m_lookAroundRate) && |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
433 |
((int)coinFlip.GetValue ()) % 2 == 1 ) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
434 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
435 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
436 |
/// now go through the table and find an index rate |
5235
ca04d8e6cb2e
Fixed Minstrel rate potential seg fault due to calling UpdateStats before being initialized
Duy Nguyen <duy@soe.ucsc.edu>
parents:
4725
diff
changeset
|
437 |
idx = GetNextSample(); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
438 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
439 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
440 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
441 |
* This if condition is used to make sure that we don't need to use |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
442 |
* the sample rate it is the same as our current rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
443 |
*/ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
444 |
if (idx != m_maxTpRate && idx != m_txrate) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
445 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
446 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
447 |
/// start sample count |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
448 |
m_sampleCount++; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
449 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
450 |
/// set flag that we are currently sampling |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
451 |
m_isSampling = true; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
452 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
453 |
/// bookeeping for resetting stuff |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
454 |
if (m_packetCount >= 10000) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
455 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
456 |
m_sampleCount = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
457 |
m_packetCount = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
458 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
459 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
460 |
/// error check |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
461 |
if (idx >= GetNSupportedModes () || idx < 0 ) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
462 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
463 |
NS_LOG_DEBUG ("ALERT!!! ERROR"); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
464 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
465 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
466 |
/// set the rate that we're currently sampling |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
467 |
m_sampleRate = idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
468 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
469 |
if (m_sampleRate == m_maxTpRate) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
470 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
471 |
m_sampleRate = m_maxTpRate2; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
472 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
473 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
474 |
/// is this rate slower than the current best rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
475 |
m_sampleRateSlower = (m_minstrelTable[idx].perfectTxTime > m_minstrelTable[m_maxTpRate].perfectTxTime); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
476 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
477 |
/// using the best rate instead |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
478 |
if (m_sampleRateSlower) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
479 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
480 |
idx = m_maxTpRate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
481 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
482 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
483 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
484 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
485 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
486 |
/// continue using the best rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
487 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
488 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
489 |
idx = m_maxTpRate; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
490 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
491 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
492 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
493 |
NS_LOG_DEBUG ("FindRate " << "sample rate=" << idx); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
494 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
495 |
return idx; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
496 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
497 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
498 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
499 |
MinstrelWifiRemoteStation::UpdateStats () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
500 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
501 |
if (Simulator::Now () < m_nextStatsUpdate) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
502 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
503 |
return; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
504 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
505 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
506 |
NS_LOG_DEBUG ("Updating stats="<<this); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
507 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
508 |
m_nextStatsUpdate = Simulator::Now () + m_stations->m_updateStats; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
509 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
510 |
Time txTime; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
511 |
uint32_t tempProb; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
512 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
513 |
for (uint32_t i =0; i < GetNSupportedModes (); i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
514 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
515 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
516 |
/// calculate the perfect tx time for this rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
517 |
txTime = m_minstrelTable[i].perfectTxTime; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
518 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
519 |
/// just for initialization |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
520 |
if (txTime.GetMicroSeconds () == 0) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
521 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
522 |
txTime = Seconds (1); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
523 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
524 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
525 |
NS_LOG_DEBUG ("m_txrate=" << m_txrate << "\t attempt=" << m_minstrelTable[i].numRateAttempt << "\t success=" << m_minstrelTable[i].numRateSuccess); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
526 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
527 |
/// if we've attempted something |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
528 |
if (m_minstrelTable[i].numRateAttempt) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
529 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
530 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
531 |
* calculate the probability of success |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
532 |
* assume probability scales from 0 to 18000 |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
533 |
*/ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
534 |
tempProb = (m_minstrelTable[i].numRateSuccess * 18000) / m_minstrelTable[i].numRateAttempt; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
535 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
536 |
/// bookeeping |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
537 |
m_minstrelTable[i].successHist += m_minstrelTable[i].numRateSuccess; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
538 |
m_minstrelTable[i].attemptHist += m_minstrelTable[i].numRateAttempt; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
539 |
m_minstrelTable[i].prob = tempProb; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
540 |
|
4725
4e068296f09f
fix build for gcc 3.4
Craig Dowell <craigdo@ee.washington.edu>
parents:
4703
diff
changeset
|
541 |
/// ewma probability (cast for gcc 3.4 compatibility) |
4e068296f09f
fix build for gcc 3.4
Craig Dowell <craigdo@ee.washington.edu>
parents:
4703
diff
changeset
|
542 |
tempProb = static_cast<uint32_t>(((tempProb * (100 - m_stations->m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_stations->m_ewmaLevel) )/100); |
4703
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
543 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
544 |
m_minstrelTable[i].ewmaProb = tempProb; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
545 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
546 |
/// calculating throughput |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
547 |
m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds()); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
548 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
549 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
550 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
551 |
/// bookeeping |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
552 |
m_minstrelTable[i].prevNumRateAttempt= m_minstrelTable[i].numRateAttempt; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
553 |
m_minstrelTable[i].prevNumRateSuccess = m_minstrelTable[i].numRateSuccess; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
554 |
m_minstrelTable[i].numRateSuccess = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
555 |
m_minstrelTable[i].numRateAttempt = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
556 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
557 |
/// Sample less often below 10% and above 95% of success |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
558 |
if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
559 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
560 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
561 |
* retry count denotes the number of retries permitted for each rate |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
562 |
* # retry_count/2 |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
563 |
*/ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
564 |
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount >> 1; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
565 |
if (m_minstrelTable[i].adjustedRetryCount > 2) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
566 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
567 |
m_minstrelTable[i].adjustedRetryCount = 2 ; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
568 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
569 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
570 |
else |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
571 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
572 |
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
573 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
574 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
575 |
/// if it's 0 allow one retry limit |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
576 |
if (m_minstrelTable[i].adjustedRetryCount == 0) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
577 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
578 |
m_minstrelTable[i].adjustedRetryCount = 1; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
579 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
580 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
581 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
582 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
583 |
uint32_t max_prob = 0, index_max_prob =0, max_tp =0, index_max_tp=0, index_max_tp2=0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
584 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
585 |
/// go find max throughput, second maximum throughput, high probability succ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
586 |
for (uint32_t i =0; i < GetNSupportedModes (); i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
587 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
588 |
NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput << "\n ewma" << m_minstrelTable[i].ewmaProb); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
589 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
590 |
if (max_tp < m_minstrelTable[i].throughput) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
591 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
592 |
index_max_tp = i; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
593 |
max_tp = m_minstrelTable[i].throughput; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
594 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
595 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
596 |
if (max_prob < m_minstrelTable[i].ewmaProb) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
597 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
598 |
index_max_prob = i; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
599 |
max_prob = m_minstrelTable[i].ewmaProb; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
600 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
601 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
602 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
603 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
604 |
max_tp = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
605 |
/// find the second highest max |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
606 |
for (uint32_t i =0; i < GetNSupportedModes (); i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
607 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
608 |
if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput)) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
609 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
610 |
index_max_tp2 = i; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
611 |
max_tp = m_minstrelTable[i].throughput; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
612 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
613 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
614 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
615 |
m_maxTpRate = index_max_tp; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
616 |
m_maxTpRate2 = index_max_tp2; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
617 |
m_maxProbRate = index_max_prob; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
618 |
m_currentRate = index_max_tp; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
619 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
620 |
if (index_max_tp > m_txrate) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
621 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
622 |
m_txrate= index_max_tp; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
623 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
624 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
625 |
NS_LOG_DEBUG ("max tp="<< index_max_tp << "\nmax tp2="<< index_max_tp2<< "\nmax prob="<< index_max_prob); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
626 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
627 |
/// reset it |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
628 |
RateInit (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
629 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
630 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
631 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
632 |
MinstrelWifiRemoteStation::RateInit () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
633 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
634 |
NS_LOG_DEBUG ("RateInit="<<this); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
635 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
636 |
for (uint32_t i = 0; i < GetNSupportedModes (); i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
637 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
638 |
m_minstrelTable[i].numRateAttempt = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
639 |
m_minstrelTable[i].numRateSuccess = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
640 |
m_minstrelTable[i].prob = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
641 |
m_minstrelTable[i].ewmaProb = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
642 |
m_minstrelTable[i].prevNumRateAttempt = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
643 |
m_minstrelTable[i].prevNumRateSuccess = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
644 |
m_minstrelTable[i].successHist = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
645 |
m_minstrelTable[i].attemptHist = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
646 |
m_minstrelTable[i].throughput = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
647 |
m_minstrelTable[i].perfectTxTime = m_stations->GetCalcTxTime (GetSupportedMode (i)); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
648 |
m_minstrelTable[i].retryCount =1; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
649 |
m_minstrelTable[i].adjustedRetryCount =1; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
650 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
651 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
652 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
653 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
654 |
MinstrelWifiRemoteStation::InitSampleTable () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
655 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
656 |
NS_LOG_DEBUG ("InitSampleTable="<<this); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
657 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
658 |
m_col = m_index = 0; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
659 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
660 |
/// for off-seting to make rates fall between 0 and numrates |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
661 |
uint32_t numSampleRates= GetNSupportedModes () - 1; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
662 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
663 |
uint32_t newIndex; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
664 |
for (uint32_t col = 0; col < m_stations->m_sampleCol; col++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
665 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
666 |
for (uint32_t i = 0; i < numSampleRates; i++ ) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
667 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
668 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
669 |
/** |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
670 |
* The next two lines basically tries to generate a random number |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
671 |
* between 0 and the number of available rates |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
672 |
*/ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
673 |
UniformVariable uv (0, numSampleRates); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
674 |
newIndex = (i + (uint32_t)uv.GetValue ()) % numSampleRates; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
675 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
676 |
/// this loop is used for filling in other uninitilized places |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
677 |
while (m_sampleTable[newIndex][col] != 0) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
678 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
679 |
newIndex = (newIndex + 1)%GetNSupportedModes (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
680 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
681 |
m_sampleTable[newIndex][col] = i+1; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
682 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
683 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
684 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
685 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
686 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
687 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
688 |
MinstrelWifiRemoteStation::PrintSampleTable () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
689 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
690 |
NS_LOG_DEBUG ("PrintSampleTable="<<this ); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
691 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
692 |
uint32_t numSampleRates= GetNSupportedModes (); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
693 |
for (uint32_t i=0; i < numSampleRates; i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
694 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
695 |
for (uint32_t j=0; j < m_stations->m_sampleCol; j++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
696 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
697 |
std::cout << m_sampleTable[i][j] << "\t"; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
698 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
699 |
std::cout << std::endl; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
700 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
701 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
702 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
703 |
void |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
704 |
MinstrelWifiRemoteStation::PrintTable () |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
705 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
706 |
NS_LOG_DEBUG ("PrintTable="<<this); |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
707 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
708 |
for (uint32_t i=0; i < GetNSupportedModes (); i++) |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
709 |
{ |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
710 |
std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime<< "\n"; |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
711 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
712 |
} |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
713 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
714 |
} //namespace ns3 |
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
715 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
716 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
717 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
718 |
|
e1259e2fdaad
add an implementation of the minstrel rate control algorithm
Duy Nguyen <duy@soe.ucsc.edu>
parents:
diff
changeset
|
719 |