author | Sébastien Deronne <sebastien.deronne@gmail.com> |
Thu, 03 Sep 2015 22:16:49 +0200 | |
changeset 11628 | 243b71de25a0 |
parent 11450 | 9f4ae69f12b7 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7141
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2351 | 2 |
/* |
3 |
* Copyright (c) 2005,2006 INRIA |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
2351 | 7 |
* published by the Free Software Foundation; |
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Federico Maguolo <maguolof@dei.unipd.it> |
|
19 |
*/ |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
20 |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
21 |
#ifndef RRAA_WIFI_MANAGER_H |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
22 |
#define RRAA_WIFI_MANAGER_H |
2351 | 23 |
|
24 |
#include "ns3/nstime.h" |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
25 |
#include "wifi-remote-station-manager.h" |
2351 | 26 |
|
27 |
namespace ns3 { |
|
28 |
||
6340 | 29 |
struct RraaWifiRemoteStation; |
2351 | 30 |
|
31 |
/** |
|
32 |
* \brief Robust Rate Adaptation Algorithm |
|
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
33 |
* \ingroup wifi |
2351 | 34 |
* |
35 |
* This is an implementation of RRAA as described in |
|
36 |
* "Robust rate adaptation for 802.11 wireless networks" |
|
37 |
* by "Starsky H. Y. Wong", "Hao Yang", "Songwu Lu", and, |
|
38 |
* "Vaduvur Bharghavan" published in Mobicom 06. |
|
39 |
*/ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
40 |
class RraaWifiManager : public WifiRemoteStationManager |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
41 |
{ |
2351 | 42 |
public: |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
43 |
static TypeId GetTypeId (void); |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
44 |
|
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
45 |
RraaWifiManager (); |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
46 |
virtual ~RraaWifiManager (); |
6065 | 47 |
|
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
48 |
|
2351 | 49 |
private: |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
50 |
struct ThresholdsItem |
6065 | 51 |
{ |
52 |
uint32_t datarate; |
|
53 |
double pori; |
|
54 |
double pmtl; |
|
55 |
uint32_t ewnd; |
|
56 |
}; |
|
57 |
||
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
58 |
//overriden from base class |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
59 |
virtual WifiRemoteStation * DoCreateStation (void) const; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
60 |
virtual void DoReportRxOk (WifiRemoteStation *station, |
6065 | 61 |
double rxSnr, WifiMode txMode); |
62 |
virtual void DoReportRtsFailed (WifiRemoteStation *station); |
|
63 |
virtual void DoReportDataFailed (WifiRemoteStation *station); |
|
64 |
virtual void DoReportRtsOk (WifiRemoteStation *station, |
|
65 |
double ctsSnr, WifiMode ctsMode, double rtsSnr); |
|
66 |
virtual void DoReportDataOk (WifiRemoteStation *station, |
|
67 |
double ackSnr, WifiMode ackMode, double dataSnr); |
|
68 |
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station); |
|
69 |
virtual void DoReportFinalDataFailed (WifiRemoteStation *station); |
|
10139 | 70 |
virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size); |
71 |
virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station); |
|
6065 | 72 |
virtual bool DoNeedRts (WifiRemoteStation *st, |
73 |
Ptr<const Packet> packet, bool normally); |
|
74 |
virtual bool IsLowLatency (void) const; |
|
75 |
||
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
76 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
77 |
* Return the index for the maximum transmission rate for |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
78 |
* the given station. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
79 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
80 |
* \param station |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
81 |
* |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
82 |
* \return the index for the maximum transmission rate |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
83 |
*/ |
6065 | 84 |
uint32_t GetMaxRate (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
85 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
86 |
* Return the index for the minimum transmission rate for |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
87 |
* the given station. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
88 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
89 |
* \param station |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
90 |
* |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
91 |
* \return the index for the minimum transmission rate |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
92 |
*/ |
6065 | 93 |
uint32_t GetMinRate (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
94 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
95 |
* Check if the counter should be resetted. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
96 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
97 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
98 |
*/ |
6065 | 99 |
void CheckTimeout (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
100 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
101 |
* Find an appropriate rate for the given station, using |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
102 |
* a basic algorithm. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
103 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
104 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
105 |
*/ |
6065 | 106 |
void RunBasicAlgorithm (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
107 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
108 |
* Activate the use of RTS for the given station if the conditions are met. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
109 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
110 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
111 |
*/ |
6065 | 112 |
void ARts (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
113 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
114 |
* Reset the counters of the given station. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
115 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
116 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
117 |
*/ |
6065 | 118 |
void ResetCountersBasic (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
119 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
120 |
* Get a threshold for the given mode. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
121 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
122 |
* \param mode |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11450
diff
changeset
|
123 |
* \param station |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
124 |
* |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
125 |
* \return threshold |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
126 |
*/ |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11450
diff
changeset
|
127 |
struct ThresholdsItem GetThresholds (WifiMode mode, RraaWifiRemoteStation *station) const; |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
128 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
129 |
* Get a threshold for the given station and mode index. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
130 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
131 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
132 |
* \param rate |
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
133 |
* |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
134 |
* \return threshold |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
135 |
*/ |
6065 | 136 |
struct ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const; |
137 |
||
2351 | 138 |
bool m_basic; |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
139 |
Time m_timeout; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
140 |
uint32_t m_ewndfor54; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
141 |
uint32_t m_ewndfor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
142 |
uint32_t m_ewndfor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
143 |
uint32_t m_ewndfor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
144 |
uint32_t m_ewndfor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
145 |
uint32_t m_ewndfor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
146 |
uint32_t m_ewndfor9; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
147 |
uint32_t m_ewndfor6; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
148 |
double m_porifor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
149 |
double m_porifor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
150 |
double m_porifor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
151 |
double m_porifor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
152 |
double m_porifor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
153 |
double m_porifor9; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
154 |
double m_porifor6; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
155 |
double m_pmtlfor54; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
156 |
double m_pmtlfor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
157 |
double m_pmtlfor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
158 |
double m_pmtlfor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
159 |
double m_pmtlfor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
160 |
double m_pmtlfor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
161 |
double m_pmtlfor9; |
2351 | 162 |
}; |
163 |
||
11450
9f4ae69f12b7
cleanup wifi module
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
10483
diff
changeset
|
164 |
} //namespace ns3 |
2351 | 165 |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
166 |
#endif /* RRAA_WIFI_MANAGER_H */ |