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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Federico Maguolo <maguolof@dei.unipd.it>
7 */
8
9#ifndef RRAA_WIFI_MANAGER_H
10#define RRAA_WIFI_MANAGER_H
11
12#include "ns3/nstime.h"
13#include "ns3/traced-value.h"
14#include "ns3/wifi-remote-station-manager.h"
15
16namespace ns3
17{
18
19struct RraaWifiRemoteStation;
20
21/// WifiRraaThresholds structure
23{
24 double m_ori; ///< Opportunistic Rate Increase threshold
25 double m_mtl; ///< Maximum Tolerable Loss threshold
26 uint32_t m_ewnd; ///< Evaluation Window
27};
28
29/**
30 * List of thresholds for each mode.
31 */
32typedef std::vector<std::pair<WifiRraaThresholds, WifiMode>> RraaThresholdsTable;
33
34/**
35 * @brief Robust Rate Adaptation Algorithm
36 * @ingroup wifi
37 *
38 * This is an implementation of RRAA as described in
39 * "Robust rate adaptation for 802.11 wireless networks"
40 * by "Starsky H. Y. Wong", "Hao Yang", "Songwu Lu", and,
41 * "Vaduvur Bharghavan" published in Mobicom 06.
42 *
43 * This RAA does not support HT modes and will error
44 * exit if the user tries to configure this RAA with a Wi-Fi MAC
45 * that supports 802.11n or higher.
46 */
48{
49 public:
50 /**
51 * @brief Get the type ID.
52 * @return the object TypeId
53 */
54 static TypeId GetTypeId();
55
57 ~RraaWifiManager() override;
58
59 void SetupPhy(const Ptr<WifiPhy> phy) override;
60 void SetupMac(const Ptr<WifiMac> mac) override;
61
62 private:
63 void DoInitialize() override;
64 WifiRemoteStation* DoCreateStation() const override;
65 void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) override;
69 double ctsSnr,
71 double rtsSnr) override;
73 double ackSnr,
75 double dataSnr,
77 uint8_t dataNss) override;
82 bool DoNeedRts(WifiRemoteStation* st, uint32_t size, bool normally) override;
83
84 /**
85 * Check for initializations.
86 * @param station The remote station.
87 */
89 /**
90 * Return the index for the maximum transmission rate for
91 * the given station.
92 *
93 * @param station the remote station
94 *
95 * @return the index for the maximum transmission rate
96 */
98 /**
99 * Check if the counter should be reset.
100 *
101 * @param station the remote station
102 */
104 /**
105 * Find an appropriate rate for the given station, using
106 * a basic algorithm.
107 *
108 * @param station the remote station
109 */
111 /**
112 * Activate the use of RTS for the given station if the conditions are met.
113 *
114 * @param station the remote station
115 */
117 /**
118 * Reset the counters of the given station.
119 *
120 * @param station the remote station
121 */
123 /**
124 * Initialize the thresholds internal list for the given station.
125 *
126 * @param station the remote station
127 */
129 /**
130 * Get the thresholds for the given station and mode.
131 *
132 * @param station the remote station
133 * @param mode the WifiMode
134 *
135 * @return the RRAA thresholds
136 */
138 /**
139 * Get the thresholds for the given station and mode index.
140 *
141 * @param station the remote station
142 * @param index the mode index in the supported rates
143 *
144 * @return the RRAA thresholds
145 */
147 /**
148 * Get the estimated TxTime of a packet with a given mode.
149 *
150 * @param mode the WifiMode
151 *
152 * @return the estimated TX time
153 */
154 Time GetCalcTxTime(WifiMode mode) const;
155 /**
156 * Add transmission time for the given mode to an internal list.
157 *
158 * @param mode the WifiMode
159 * @param t transmission time
160 */
161 void AddCalcTxTime(WifiMode mode, Time t);
162 /**
163 * typedef for a vector of a pair of Time, WifiMode.
164 * Essentially a list for WifiMode and its corresponding transmission time
165 * to transmit a reference packet.
166 */
167 typedef std::vector<std::pair<Time, WifiMode>> TxTime;
168
169 TxTime m_calcTxTime; //!< To hold all the calculated TxTime for all modes.
170 Time m_sifs; //!< Value of SIFS configured in the device.
171 Time m_difs; //!< Value of DIFS configured in the device.
172
173 uint32_t m_frameLength; //!< Data frame length used to calculate mode TxTime.
174 uint32_t m_ackLength; //!< Ack frame length used to calculate mode TxTime.
175
176 bool m_basic; ///< basic
177 Time m_timeout; ///< timeout
178 double m_alpha; //!< Alpha value for RRAA (value for calculating MTL threshold)
179 double m_beta; //!< Beta value for RRAA (value for calculating ORI threshold).
180 double m_tau; //!< Tau value for RRAA (value for calculating EWND size).
181
182 TracedValue<uint64_t> m_currentRate; //!< Trace rate changes
183};
184
185} // namespace ns3
186
187#endif /* RRAA_WIFI_MANAGER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
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, MHz_u 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.
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.
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.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Trace classes with value semantics.
a unique identifier for an interface.
Definition type-id.h:49
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...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
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.