author | Daniel Lertpratchya <nikkipui@gmail.com> |
Tue, 10 Dec 2013 10:48:51 -0500 | |
changeset 10483 | e3a02ed14587 |
parent 10139 | 17a71cd49da3 |
child 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 |
*/ |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
20 |
#ifndef RRAA_WIFI_MANAGER_H |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
21 |
#define RRAA_WIFI_MANAGER_H |
2351 | 22 |
|
23 |
#include "ns3/nstime.h" |
|
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
24 |
#include "wifi-remote-station-manager.h" |
2351 | 25 |
|
26 |
namespace ns3 { |
|
27 |
||
6340 | 28 |
struct RraaWifiRemoteStation; |
2351 | 29 |
|
30 |
/** |
|
31 |
* \brief Robust Rate Adaptation Algorithm |
|
7139
79dd02ed46ec
doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents:
6852
diff
changeset
|
32 |
* \ingroup wifi |
2351 | 33 |
* |
34 |
* This is an implementation of RRAA as described in |
|
35 |
* "Robust rate adaptation for 802.11 wireless networks" |
|
36 |
* by "Starsky H. Y. Wong", "Hao Yang", "Songwu Lu", and, |
|
37 |
* "Vaduvur Bharghavan" published in Mobicom 06. |
|
38 |
*/ |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
39 |
class RraaWifiManager : public WifiRemoteStationManager |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
40 |
{ |
2351 | 41 |
public: |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
42 |
static TypeId GetTypeId (void); |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
43 |
|
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
44 |
RraaWifiManager (); |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
45 |
virtual ~RraaWifiManager (); |
6065 | 46 |
|
2351 | 47 |
private: |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
48 |
struct ThresholdsItem |
6065 | 49 |
{ |
50 |
uint32_t datarate; |
|
51 |
double pori; |
|
52 |
double pmtl; |
|
53 |
uint32_t ewnd; |
|
54 |
}; |
|
55 |
||
56 |
// overriden from base class |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
57 |
virtual WifiRemoteStation * DoCreateStation (void) const; |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
7139
diff
changeset
|
58 |
virtual void DoReportRxOk (WifiRemoteStation *station, |
6065 | 59 |
double rxSnr, WifiMode txMode); |
60 |
virtual void DoReportRtsFailed (WifiRemoteStation *station); |
|
61 |
virtual void DoReportDataFailed (WifiRemoteStation *station); |
|
62 |
virtual void DoReportRtsOk (WifiRemoteStation *station, |
|
63 |
double ctsSnr, WifiMode ctsMode, double rtsSnr); |
|
64 |
virtual void DoReportDataOk (WifiRemoteStation *station, |
|
65 |
double ackSnr, WifiMode ackMode, double dataSnr); |
|
66 |
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station); |
|
67 |
virtual void DoReportFinalDataFailed (WifiRemoteStation *station); |
|
10139 | 68 |
virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size); |
69 |
virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station); |
|
6065 | 70 |
virtual bool DoNeedRts (WifiRemoteStation *st, |
71 |
Ptr<const Packet> packet, bool normally); |
|
72 |
virtual bool IsLowLatency (void) const; |
|
73 |
||
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
74 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
75 |
* Return the index for the maximum transmission rate for |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
76 |
* the given station. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
77 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
78 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
79 |
* \return the index for the maximum transmission rate |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
80 |
*/ |
6065 | 81 |
uint32_t GetMaxRate (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
82 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
83 |
* Return the index for the minimum transmission rate for |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
84 |
* the given station. |
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 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
87 |
* \return the index for the minimum transmission rate |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
88 |
*/ |
6065 | 89 |
uint32_t GetMinRate (RraaWifiRemoteStation *station); |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
90 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
91 |
* Check if the counter should be resetted. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
92 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
93 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
94 |
*/ |
6065 | 95 |
void CheckTimeout (RraaWifiRemoteStation *station); |
10483
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 |
* Find an appropriate rate for the given station, using |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
98 |
* a basic algorithm. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
99 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
100 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
101 |
*/ |
6065 | 102 |
void RunBasicAlgorithm (RraaWifiRemoteStation *station); |
10483
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 |
* 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
|
105 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
106 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
107 |
*/ |
6065 | 108 |
void ARts (RraaWifiRemoteStation *station); |
10483
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 |
* Reset the counters of the given station. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
111 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
112 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
113 |
*/ |
6065 | 114 |
void ResetCountersBasic (RraaWifiRemoteStation *station); |
10483
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 |
* Get a threshold for the given mode. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
117 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
118 |
* \param mode |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
119 |
* \return threshold |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
120 |
*/ |
6065 | 121 |
struct ThresholdsItem GetThresholds (WifiMode mode) const; |
10483
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
122 |
/** |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
123 |
* Get a threshold for the given station and mode index. |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
124 |
* |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
125 |
* \param station |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
126 |
* \param rate |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
127 |
* \return threshold |
e3a02ed14587
[doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10139
diff
changeset
|
128 |
*/ |
6065 | 129 |
struct ThresholdsItem GetThresholds (RraaWifiRemoteStation *station, uint32_t rate) const; |
130 |
||
2351 | 131 |
bool m_basic; |
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
132 |
Time m_timeout; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
133 |
uint32_t m_ewndfor54; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
134 |
uint32_t m_ewndfor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
135 |
uint32_t m_ewndfor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
136 |
uint32_t m_ewndfor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
137 |
uint32_t m_ewndfor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
138 |
uint32_t m_ewndfor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
139 |
uint32_t m_ewndfor9; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
140 |
uint32_t m_ewndfor6; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
141 |
double m_porifor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
142 |
double m_porifor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
143 |
double m_porifor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
144 |
double m_porifor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
145 |
double m_porifor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
146 |
double m_porifor9; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
147 |
double m_porifor6; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
148 |
double m_pmtlfor54; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
149 |
double m_pmtlfor48; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
150 |
double m_pmtlfor36; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
151 |
double m_pmtlfor24; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
152 |
double m_pmtlfor18; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
153 |
double m_pmtlfor12; |
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
154 |
double m_pmtlfor9; |
2351 | 155 |
}; |
156 |
||
157 |
} // namespace ns3 |
|
158 |
||
2544
2e6e1a6e0d94
port last rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2351
diff
changeset
|
159 |
#endif /* RRAA_WIFI_MANAGER_H */ |