A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rraa-wifi-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
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: Federico Maguolo <maguolof@dei.unipd.it>
18 */
19
20#ifndef RRAA_WIFI_MANAGER_H
21#define RRAA_WIFI_MANAGER_H
22
23#include "ns3/nstime.h"
24#include "ns3/traced-value.h"
25#include "ns3/wifi-remote-station-manager.h"
26
27namespace ns3
28{
29
30struct RraaWifiRemoteStation;
31
32/// WifiRraaThresholds structure
34{
35 double m_ori; ///< Opportunistic Rate Increase threshold
36 double m_mtl; ///< Maximum Tolerable Loss threshold
37 uint32_t m_ewnd; ///< Evaluation Window
38};
39
40/**
41 * List of thresholds for each mode.
42 */
43typedef std::vector<std::pair<WifiRraaThresholds, WifiMode>> RraaThresholdsTable;
44
45/**
46 * \brief Robust Rate Adaptation Algorithm
47 * \ingroup wifi
48 *
49 * This is an implementation of RRAA as described in
50 * "Robust rate adaptation for 802.11 wireless networks"
51 * by "Starsky H. Y. Wong", "Hao Yang", "Songwu Lu", and,
52 * "Vaduvur Bharghavan" published in Mobicom 06.
53 *
54 * This RAA does not support HT modes and will error
55 * exit if the user tries to configure this RAA with a Wi-Fi MAC
56 * that supports 802.11n or higher.
57 */
59{
60 public:
61 /**
62 * \brief Get the type ID.
63 * \return the object TypeId
64 */
65 static TypeId GetTypeId();
66
68 ~RraaWifiManager() override;
69
70 void SetupPhy(const Ptr<WifiPhy> phy) override;
71 void SetupMac(const Ptr<WifiMac> mac) override;
72
73 private:
74 void DoInitialize() override;
75 WifiRemoteStation* DoCreateStation() const override;
76 void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) override;
77 void DoReportRtsFailed(WifiRemoteStation* station) override;
78 void DoReportDataFailed(WifiRemoteStation* station) override;
79 void DoReportRtsOk(WifiRemoteStation* station,
80 double ctsSnr,
81 WifiMode ctsMode,
82 double rtsSnr) override;
84 double ackSnr,
85 WifiMode ackMode,
86 double dataSnr,
87 uint16_t dataChannelWidth,
88 uint8_t dataNss) override;
89 void DoReportFinalRtsFailed(WifiRemoteStation* station) override;
90 void DoReportFinalDataFailed(WifiRemoteStation* station) override;
91 WifiTxVector DoGetDataTxVector(WifiRemoteStation* station, uint16_t allowedWidth) override;
93 bool DoNeedRts(WifiRemoteStation* st, uint32_t size, bool normally) override;
94
95 /**
96 * Check for initializations.
97 * \param station The remote station.
98 */
99 void CheckInit(RraaWifiRemoteStation* station);
100 /**
101 * Return the index for the maximum transmission rate for
102 * the given station.
103 *
104 * \param station the remote station
105 *
106 * \return the index for the maximum transmission rate
107 */
108 uint8_t GetMaxRate(RraaWifiRemoteStation* station) const;
109 /**
110 * Check if the counter should be reset.
111 *
112 * \param station the remote station
113 */
114 void CheckTimeout(RraaWifiRemoteStation* station);
115 /**
116 * Find an appropriate rate for the given station, using
117 * a basic algorithm.
118 *
119 * \param station the remote station
120 */
122 /**
123 * Activate the use of RTS for the given station if the conditions are met.
124 *
125 * \param station the remote station
126 */
127 void ARts(RraaWifiRemoteStation* station);
128 /**
129 * Reset the counters of the given station.
130 *
131 * \param station the remote station
132 */
134 /**
135 * Initialize the thresholds internal list for the given station.
136 *
137 * \param station the remote station
138 */
140 /**
141 * Get the thresholds for the given station and mode.
142 *
143 * \param station the remote station
144 * \param mode the WifiMode
145 *
146 * \return the RRAA thresholds
147 */
149 /**
150 * Get the thresholds for the given station and mode index.
151 *
152 * \param station the remote station
153 * \param index the mode index in the supported rates
154 *
155 * \return the RRAA thresholds
156 */
157 WifiRraaThresholds GetThresholds(RraaWifiRemoteStation* station, uint8_t index) const;
158 /**
159 * Get the estimated TxTime of a packet with a given mode.
160 *
161 * \param mode the WifiMode
162 *
163 * \return the estimated TX time
164 */
165 Time GetCalcTxTime(WifiMode mode) const;
166 /**
167 * Add transmission time for the given mode to an internal list.
168 *
169 * \param mode the WifiMode
170 * \param t transmission time
171 */
172 void AddCalcTxTime(WifiMode mode, Time t);
173 /**
174 * typedef for a vector of a pair of Time, WifiMode.
175 * Essentially a list for WifiMode and its corresponding transmission time
176 * to transmit a reference packet.
177 */
178 typedef std::vector<std::pair<Time, WifiMode>> TxTime;
179
180 TxTime m_calcTxTime; //!< To hold all the calculated TxTime for all modes.
181 Time m_sifs; //!< Value of SIFS configured in the device.
182 Time m_difs; //!< Value of DIFS configured in the device.
183
184 uint32_t m_frameLength; //!< Data frame length used to calculate mode TxTime.
185 uint32_t m_ackLength; //!< Ack frame length used to calculate mode TxTime.
186
187 bool m_basic; ///< basic
188 Time m_timeout; ///< timeout
189 double m_alpha; //!< Alpha value for RRAA (value for calculating MTL threshold)
190 double m_beta; //!< Beta value for RRAA (value for calculating ORI threshold).
191 double m_tau; //!< Tau value for RRAA (value for calculating EWND size).
192
193 TracedValue<uint64_t> m_currentRate; //!< Trace rate changes
194};
195
196} // namespace ns3
197
198#endif /* RRAA_WIFI_MANAGER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Robust Rate Adaptation Algorithm.
WifiRemoteStation * DoCreateStation() const override
double m_tau
Tau value for RRAA (value for calculating EWND size).
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
void ARts(RraaWifiRemoteStation *station)
Activate the use of RTS for the given station if the conditions are met.
void CheckInit(RraaWifiRemoteStation *station)
Check for initializations.
void DoReportDataFailed(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...
TracedValue< uint64_t > m_currentRate
Trace rate changes.
static TypeId GetTypeId()
Get the type ID.
uint32_t m_frameLength
Data frame length used to calculate mode TxTime.
bool DoNeedRts(WifiRemoteStation *st, uint32_t size, bool normally) override
Time m_difs
Value of DIFS configured in the device.
void AddCalcTxTime(WifiMode mode, Time t)
Add transmission time for the given mode to an internal list.
void DoReportFinalRtsFailed(WifiRemoteStation *station) 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...
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth) override
void RunBasicAlgorithm(RraaWifiRemoteStation *station)
Find an appropriate rate for the given station, using a basic algorithm.
std::vector< std::pair< Time, WifiMode > > TxTime
typedef for a vector of a pair of Time, WifiMode.
Time GetCalcTxTime(WifiMode mode) const
Get the estimated TxTime of a packet with a given mode.
void ResetCountersBasic(RraaWifiRemoteStation *station)
Reset the counters of the given station.
TxTime m_calcTxTime
To hold all the calculated TxTime for all modes.
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
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_beta
Beta value for RRAA (value for calculating ORI threshold).
void CheckTimeout(RraaWifiRemoteStation *station)
Check if the counter should be reset.
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 DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
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.
WifiRraaThresholds GetThresholds(RraaWifiRemoteStation *station, WifiMode mode) const
Get the thresholds for the given station and mode.
void DoInitialize() override
Initialize() implementation.
uint32_t m_ackLength
Ack frame length used to calculate mode TxTime.
double m_alpha
Alpha value for RRAA (value for calculating MTL threshold)
Time m_sifs
Value of SIFS configured in the device.
void InitThresholds(RraaWifiRemoteStation *station)
Initialize the thresholds internal list for the given station.
uint8_t GetMaxRate(RraaWifiRemoteStation *station) const
Return the index for the maximum transmission rate for the given station.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Trace classes with value semantics.
Definition: traced-value.h:116
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::pair< WifiRraaThresholds, WifiMode > > RraaThresholdsTable
List of thresholds for each mode.
hold per-remote-station state for RRAA Wifi manager.
hold per-remote-station state.
WifiRraaThresholds structure.
double m_mtl
Maximum Tolerable Loss threshold.
uint32_t m_ewnd
Evaluation Window.
double m_ori
Opportunistic Rate Increase threshold.