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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Matías Richart <mrichart@fing.edu.uy>
7 */
8
9#ifndef RRPAA_WIFI_MANAGER_H
10#define RRPAA_WIFI_MANAGER_H
11
12#include "ns3/nstime.h"
13#include "ns3/random-variable-stream.h"
14#include "ns3/wifi-remote-station-manager.h"
15
16namespace ns3
17{
18
19struct RrpaaWifiRemoteStation;
20
21/**
22 * \ingroup wifi
23 * Robust Rate and Power Adaptation Algorithm
24 *
25 * This class implements the RRPAA algorithm as described in <i>Rate, Power and Carrier-Sense
26 * Threshold Coordinated Management for High-Density IEEE 802.11 Networks</i>
27 * by Matías Richart; Jorge Visca and Javier Baliosian in Integrated Network Management (IM),
28 * 2015 IFIP/IEEE International Symposium on (pp. 139-146). IEEE.
29 * https://ieeexplore.ieee.org/document/7140286
30 *
31 * RRPAA adds power control to the RRAA mechanism. RRAA is described in
32 * <i>Robust rate adaptation for 802.11 wireless networks</i> by Starsky H. Y. Wong;
33 * Hao Yang; Songwu Lu and Vaduvur Bharghavan in Proceedings of the 12th annual
34 * international conference on Mobile computing and networking (pp. 146-157). ACM.
35 * http://ocw.cs.pub.ro/courses/_media/isrm/articole/rrate_adapt_mobicom06.pdf
36 *
37 * This RAA does not support HT modes and will error
38 * exit if the user tries to configure this RAA with a Wi-Fi MAC
39 * that supports 802.11n or higher.
40 */
41
42/**
43 * For each rate there is a Opportunistic Rate Increase threshold,
44 * a Maximum Tolerable Loss threshold and an Evaluation Window.
45 */
47{
48 double m_ori; //!< The Opportunistic Rate Increase threshold.
49 double m_mtl; //!< The Maximum Tolerable Loss threshold.
50 uint32_t m_ewnd; //!< The Estimation Window size.
51};
52
53/**
54 * List of thresholds for each mode.
55 */
56typedef std::vector<std::pair<WifiRrpaaThresholds, WifiMode>> RrpaaThresholdsTable;
57
58/**
59 * List of probabilities.
60 */
61typedef std::vector<std::vector<double>> RrpaaProbabilitiesTable;
62
64{
65 public:
66 /**
67 * Register this type.
68 * \return The object TypeId.
69 */
70 static TypeId GetTypeId();
72 ~RrpaaWifiManager() override;
73
74 void SetupPhy(const Ptr<WifiPhy> phy) override;
75 void SetupMac(const Ptr<WifiMac> mac) override;
76
77 /**
78 * Assign a fixed random variable stream number to the random variables
79 * used by this model. Return the number of streams (possibly zero) that
80 * have been assigned.
81 *
82 * \param stream first stream index to use
83 *
84 * \return the number of stream indices assigned by this model
85 */
86 int64_t AssignStreams(int64_t stream) override;
87
88 private:
89 void DoInitialize() override;
90 WifiRemoteStation* DoCreateStation() const override;
91 void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) override;
92 void DoReportRtsFailed(WifiRemoteStation* station) override;
93 void DoReportDataFailed(WifiRemoteStation* station) override;
94 void DoReportRtsOk(WifiRemoteStation* station,
95 double ctsSnr,
96 WifiMode ctsMode,
97 double rtsSnr) override;
99 double ackSnr,
100 WifiMode ackMode,
101 double dataSnr,
102 MHz_u dataChannelWidth,
103 uint8_t dataNss) override;
104 void DoReportFinalRtsFailed(WifiRemoteStation* station) override;
105 void DoReportFinalDataFailed(WifiRemoteStation* station) override;
106 WifiTxVector DoGetDataTxVector(WifiRemoteStation* station, MHz_u allowedWidth) override;
108 bool DoNeedRts(WifiRemoteStation* st, uint32_t size, bool normally) override;
109
110 /**
111 * Check for initializations.
112 * \param station the remote station.
113 */
114 void CheckInit(RrpaaWifiRemoteStation* station);
115
116 /**
117 * Check if the counter should be reset.
118 *
119 * \param station the remote station
120 */
122 /**
123 * Find an appropriate rate and power for the given station, using
124 * a basic algorithm.
125 *
126 * \param station the remote station
127 */
129 /**
130 * Run an enhanced algorithm which activates the use of RTS
131 * for the given station if the conditions are met.
132 *
133 * \param station the remote station
134 */
136 /**
137 * Reset the counters of the given station.
138 *
139 * \param station the remote station
140 */
142
143 /**
144 * Initialize the thresholds internal list for the given station.
145 *
146 * \param station the remote station
147 */
149
150 /**
151 * Get the thresholds for the given station and mode.
152 *
153 * \param station the remote station
154 * \param mode the WifiMode
155 *
156 * \return the RRPAA thresholds
157 */
159
160 /**
161 * Get the thresholds for the given station and mode index.
162 *
163 * \param station the remote station
164 * \param index the mode index in the supported rates
165 *
166 * \return the RRPAA thresholds
167 */
168 WifiRrpaaThresholds GetThresholds(RrpaaWifiRemoteStation* station, uint8_t index) const;
169
170 /**
171 * Get the estimated TxTime of a packet with a given mode.
172 *
173 * \param mode the WifiMode
174 *
175 * \return the estimated TX time
176 */
177 Time GetCalcTxTime(WifiMode mode) const;
178 /**
179 * Add transmission time for the given mode to an internal list.
180 *
181 * \param mode the WifiMode
182 * \param t transmission time
183 */
184 void AddCalcTxTime(WifiMode mode, Time t);
185
186 /**
187 * typedef for a vector of a pair of Time, WifiMode.
188 * Essentially a list for WifiMode and its corresponding transmission time
189 * to transmit a reference packet.
190 */
191 typedef std::vector<std::pair<Time, WifiMode>> TxTime;
192
193 TxTime m_calcTxTime; //!< To hold all the calculated TxTime for all modes.
194 Time m_sifs; //!< Value of SIFS configured in the device.
195 Time m_difs; //!< Value of DIFS configured in the device.
196
197 uint32_t m_frameLength; //!< Data frame length used to calculate mode TxTime (in bytes).
198 uint32_t m_ackLength; //!< Ack frame length used to calculate mode TxTime (in bytes).
199
200 bool m_basic; //!< If using the basic algorithm (without RTS/CTS).
201 Time m_timeout; //!< Timeout for the RRAA BASIC loss estimation block.
202 double m_alpha; //!< Alpha value for RRPAA (value for calculating MTL threshold)
203 double m_beta; //!< Beta value for RRPAA (value for calculating ORI threshold).
204 double m_tau; //!< Tau value for RRPAA (value for calculating EWND size).
205 double m_gamma; //!< Gamma value for RRPAA (value for pdTable decrements).
206 double m_delta; //!< Delta value for RRPAA (value for pdTable increments).
207
208 /**
209 * Differently form rate, power levels do not depend on the remote station.
210 * The levels depend only on the physical layer of the device.
211 */
212 uint8_t m_minPowerLevel; //!< Minimal power level.
213 uint8_t m_maxPowerLevel; //!< Maximal power level.
214 uint8_t m_nPowerLevels; //!< Number of power levels.
215
216 /**
217 * The trace source fired when the transmission power change
218 */
220 /**
221 * The trace source fired when the transmission rate change
222 */
224
226 m_uniformRandomVariable; //!< Provides uniform random variables for probabilistic changes.
227};
228
229} // namespace ns3
230
231#endif /* RRPAA__WIFI_MANAGER_H */
Smart pointer class similar to boost::intrusive_ptr.
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.
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 DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
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.
double m_tau
Tau value for RRPAA (value for calculating EWND size).
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth) override
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:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:48
represent a single transmission mode
Definition wifi-mode.h:40
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.