A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rrpaa-wifi-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Universidad de la República - Uruguay
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Matías Richart <mrichart@fing.edu.uy>
18 */
19
20#ifndef RRPAA_WIFI_MANAGER_H
21#define RRPAA_WIFI_MANAGER_H
22
23#include "ns3/nstime.h"
24#include "ns3/random-variable-stream.h"
25#include "ns3/wifi-remote-station-manager.h"
26
27namespace ns3
28{
29
30struct RrpaaWifiRemoteStation;
31
32/**
33 * \ingroup wifi
34 * Robust Rate and Power Adaptation Algorithm
35 *
36 * This class implements the RRPAA algorithm as described in <i>Rate, Power and Carrier-Sense
37 * Threshold Coordinated Management for High-Density IEEE 802.11 Networks</i>
38 * by Matías Richart; Jorge Visca and Javier Baliosian in Integrated Network Management (IM),
39 * 2015 IFIP/IEEE International Symposium on (pp. 139-146). IEEE.
40 * https://ieeexplore.ieee.org/document/7140286
41 *
42 * RRPAA adds power control to the RRAA mechanism. RRAA is described in
43 * <i>Robust rate adaptation for 802.11 wireless networks</i> by Starsky H. Y. Wong;
44 * Hao Yang; Songwu Lu and Vaduvur Bharghavan in Proceedings of the 12th annual
45 * international conference on Mobile computing and networking (pp. 146-157). ACM.
46 * http://ocw.cs.pub.ro/courses/_media/isrm/articole/rrate_adapt_mobicom06.pdf
47 *
48 * This RAA does not support HT modes and will error
49 * exit if the user tries to configure this RAA with a Wi-Fi MAC
50 * that supports 802.11n or higher.
51 */
52
53/**
54 * For each rate there is a Opportunistic Rate Increase threshold,
55 * a Maximum Tolerable Loss threshold and an Evaluation Window.
56 */
58{
59 double m_ori; //!< The Opportunistic Rate Increase threshold.
60 double m_mtl; //!< The Maximum Tolerable Loss threshold.
61 uint32_t m_ewnd; //!< The Estimation Window size.
62};
63
64/**
65 * List of thresholds for each mode.
66 */
67typedef std::vector<std::pair<WifiRrpaaThresholds, WifiMode>> RrpaaThresholdsTable;
68
69/**
70 * List of probabilities.
71 */
72typedef std::vector<std::vector<double>> RrpaaProbabilitiesTable;
73
75{
76 public:
77 /**
78 * Register this type.
79 * \return The object TypeId.
80 */
81 static TypeId GetTypeId();
83 ~RrpaaWifiManager() override;
84
85 void SetupPhy(const Ptr<WifiPhy> phy) override;
86 void SetupMac(const Ptr<WifiMac> mac) override;
87
88 /**
89 * Assign a fixed random variable stream number to the random variables
90 * used by this model. Return the number of streams (possibly zero) that
91 * have been assigned.
92 *
93 * \param stream first stream index to use
94 *
95 * \return the number of stream indices assigned by this model
96 */
97 int64_t AssignStreams(int64_t stream) override;
98
99 private:
100 void DoInitialize() override;
101 WifiRemoteStation* DoCreateStation() const override;
102 void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) override;
103 void DoReportRtsFailed(WifiRemoteStation* station) override;
104 void DoReportDataFailed(WifiRemoteStation* station) override;
105 void DoReportRtsOk(WifiRemoteStation* station,
106 double ctsSnr,
107 WifiMode ctsMode,
108 double rtsSnr) override;
109 void DoReportDataOk(WifiRemoteStation* station,
110 double ackSnr,
111 WifiMode ackMode,
112 double dataSnr,
113 uint16_t dataChannelWidth,
114 uint8_t dataNss) override;
115 void DoReportFinalRtsFailed(WifiRemoteStation* station) override;
116 void DoReportFinalDataFailed(WifiRemoteStation* station) override;
117 WifiTxVector DoGetDataTxVector(WifiRemoteStation* station, uint16_t allowedWidth) override;
119 bool DoNeedRts(WifiRemoteStation* st, uint32_t size, bool normally) override;
120
121 /**
122 * Check for initializations.
123 * \param station the remote station.
124 */
125 void CheckInit(RrpaaWifiRemoteStation* station);
126
127 /**
128 * Check if the counter should be reset.
129 *
130 * \param station the remote station
131 */
133 /**
134 * Find an appropriate rate and power for the given station, using
135 * a basic algorithm.
136 *
137 * \param station the remote station
138 */
140 /**
141 * Run an enhanced algorithm which activates the use of RTS
142 * for the given station if the conditions are met.
143 *
144 * \param station the remote station
145 */
147 /**
148 * Reset the counters of the given station.
149 *
150 * \param station the remote station
151 */
153
154 /**
155 * Initialize the thresholds internal list for the given station.
156 *
157 * \param station the remote station
158 */
160
161 /**
162 * Get the thresholds for the given station and mode.
163 *
164 * \param station the remote station
165 * \param mode the WifiMode
166 *
167 * \return the RRPAA thresholds
168 */
170
171 /**
172 * Get the thresholds for the given station and mode index.
173 *
174 * \param station the remote station
175 * \param index the mode index in the supported rates
176 *
177 * \return the RRPAA thresholds
178 */
179 WifiRrpaaThresholds GetThresholds(RrpaaWifiRemoteStation* station, uint8_t index) const;
180
181 /**
182 * Get the estimated TxTime of a packet with a given mode.
183 *
184 * \param mode the WifiMode
185 *
186 * \return the estimated TX time
187 */
188 Time GetCalcTxTime(WifiMode mode) const;
189 /**
190 * Add transmission time for the given mode to an internal list.
191 *
192 * \param mode the WifiMode
193 * \param t transmission time
194 */
195 void AddCalcTxTime(WifiMode mode, Time t);
196
197 /**
198 * typedef for a vector of a pair of Time, WifiMode.
199 * Essentially a list for WifiMode and its corresponding transmission time
200 * to transmit a reference packet.
201 */
202 typedef std::vector<std::pair<Time, WifiMode>> TxTime;
203
204 TxTime m_calcTxTime; //!< To hold all the calculated TxTime for all modes.
205 Time m_sifs; //!< Value of SIFS configured in the device.
206 Time m_difs; //!< Value of DIFS configured in the device.
207
208 uint32_t m_frameLength; //!< Data frame length used to calculate mode TxTime (in bytes).
209 uint32_t m_ackLength; //!< Ack frame length used to calculate mode TxTime (in bytes).
210
211 bool m_basic; //!< If using the basic algorithm (without RTS/CTS).
212 Time m_timeout; //!< Timeout for the RRAA BASIC loss estimation block.
213 double m_alpha; //!< Alpha value for RRPAA (value for calculating MTL threshold)
214 double m_beta; //!< Beta value for RRPAA (value for calculating ORI threshold).
215 double m_tau; //!< Tau value for RRPAA (value for calculating EWND size).
216 double m_gamma; //!< Gamma value for RRPAA (value for pdTable decrements).
217 double m_delta; //!< Delta value for RRPAA (value for pdTable increments).
218
219 /**
220 * Differently form rate, power levels do not depend on the remote station.
221 * The levels depend only on the physical layer of the device.
222 */
223 uint8_t m_minPowerLevel; //!< Minimal power level.
224 uint8_t m_maxPowerLevel; //!< Maximal power level.
225 uint8_t m_nPowerLevels; //!< Number of power levels.
226
227 /**
228 * The trace source fired when the transmission power change
229 */
231 /**
232 * The trace source fired when the transmission rate change
233 */
235
237 m_uniformRandomVariable; //!< Provides uniform random variables for probabilistic changes.
238};
239
240} // namespace ns3
241
242#endif /* RRPAA__WIFI_MANAGER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Time m_sifs
Value of SIFS configured in the device.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables for probabilistic changes.
uint8_t m_maxPowerLevel
Maximal power level.
void ResetCountersBasic(RrpaaWifiRemoteStation *station)
Reset the counters of the given station.
double m_beta
Beta value for RRPAA (value for calculating ORI threshold).
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Time m_difs
Value of DIFS configured in the device.
WifiRemoteStation * DoCreateStation() const override
bool m_basic
If using the basic algorithm (without RTS/CTS).
void DoInitialize() override
Initialize() implementation.
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void SetupPhy(const Ptr< WifiPhy > phy) override
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
TxTime m_calcTxTime
To hold all the calculated TxTime for all modes.
void CheckInit(RrpaaWifiRemoteStation *station)
Check for initializations.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth) override
std::vector< std::pair< Time, WifiMode > > TxTime
typedef for a vector of a pair of Time, WifiMode.
TracedCallback< double, double, Mac48Address > m_powerChange
The trace source fired when the transmission power change.
uint8_t m_minPowerLevel
Differently form rate, power levels do not depend on the remote station.
void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr) override
This method is a pure virtual method that must be implemented by the sub-class.
void SetupMac(const Ptr< WifiMac > mac) override
Set up MAC associated with this device since it is the object that knows the full set of timing param...
void RunAdaptiveRtsAlgorithm(RrpaaWifiRemoteStation *station)
Run an enhanced algorithm which activates the use of RTS for the given station if the conditions are ...
TracedCallback< DataRate, DataRate, Mac48Address > m_rateChange
The trace source fired when the transmission rate change.
Time m_timeout
Timeout for the RRAA BASIC loss estimation block.
uint32_t m_ackLength
Ack frame length used to calculate mode TxTime (in bytes).
uint8_t m_nPowerLevels
Number of power levels.
WifiRrpaaThresholds GetThresholds(RrpaaWifiRemoteStation *station, WifiMode mode) const
Get the thresholds for the given station and mode.
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
double m_tau
Tau value for RRPAA (value for calculating EWND size).
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
double m_gamma
Gamma value for RRPAA (value for pdTable decrements).
Time GetCalcTxTime(WifiMode mode) const
Get the estimated TxTime of a packet with a given mode.
double m_delta
Delta value for RRPAA (value for pdTable increments).
void CheckTimeout(RrpaaWifiRemoteStation *station)
Check if the counter should be reset.
double m_alpha
Alpha value for RRPAA (value for calculating MTL threshold)
bool DoNeedRts(WifiRemoteStation *st, uint32_t size, bool normally) override
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t m_frameLength
Data frame length used to calculate mode TxTime (in bytes).
void AddCalcTxTime(WifiMode mode, Time t)
Add transmission time for the given mode to an internal list.
void InitThresholds(RrpaaWifiRemoteStation *station)
Initialize the thresholds internal list for the given station.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
static TypeId GetTypeId()
Register this type.
void RunBasicAlgorithm(RrpaaWifiRemoteStation *station)
Find an appropriate rate and power for the given station, using a basic algorithm.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
represent a single transmission mode
Definition: wifi-mode.h:51
hold a list of per-remote-station state.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< std::vector< double > > RrpaaProbabilitiesTable
List of probabilities.
std::vector< std::pair< WifiRrpaaThresholds, WifiMode > > RrpaaThresholdsTable
List of thresholds for each mode.
Hold per-remote-station state for RRPAA Wifi manager.
hold per-remote-station state.
Robust Rate and Power Adaptation Algorithm.
double m_ori
The Opportunistic Rate Increase threshold.
uint32_t m_ewnd
The Estimation Window size.
double m_mtl
The Maximum Tolerable Loss threshold.