A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ideal-wifi-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19
20#ifndef IDEAL_WIFI_MANAGER_H
21#define IDEAL_WIFI_MANAGER_H
22
23#include "ns3/traced-value.h"
24#include "ns3/wifi-remote-station-manager.h"
25
26namespace ns3
27{
28
29struct IdealWifiRemoteStation;
30
31/**
32 * \brief Ideal rate control algorithm
33 * \ingroup wifi
34 *
35 * This class implements an 'ideal' rate control algorithm
36 * similar to RBAR in spirit (see <i>A rate-adaptive MAC
37 * protocol for multihop wireless networks</i> by G. Holland,
38 * N. Vaidya, and P. Bahl.): every station keeps track of the
39 * SNR of every packet received and sends back this SNR to the
40 * original transmitter by an out-of-band mechanism. Each
41 * transmitter keeps track of the last SNR sent back by a receiver
42 * and uses it to pick a transmission mode based on a set
43 * of SNR thresholds built from a target BER and transmission
44 * mode-specific SNR/BER curves.
45 */
47{
48 public:
49 /**
50 * \brief Get the type ID.
51 * \return the object TypeId
52 */
53 static TypeId GetTypeId();
55 ~IdealWifiManager() override;
56
57 void SetupPhy(const Ptr<WifiPhy> phy) override;
58
59 private:
60 void DoInitialize() override;
61 WifiRemoteStation* DoCreateStation() const override;
62 void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) override;
63 void DoReportRtsFailed(WifiRemoteStation* station) override;
64 void DoReportDataFailed(WifiRemoteStation* station) override;
65 void DoReportRtsOk(WifiRemoteStation* station,
66 double ctsSnr,
67 WifiMode ctsMode,
68 double rtsSnr) override;
70 double ackSnr,
71 WifiMode ackMode,
72 double dataSnr,
73 uint16_t dataChannelWidth,
74 uint8_t dataNss) override;
76 uint16_t nSuccessfulMpdus,
77 uint16_t nFailedMpdus,
78 double rxSnr,
79 double dataSnr,
80 uint16_t dataChannelWidth,
81 uint8_t dataNss) override;
82 void DoReportFinalRtsFailed(WifiRemoteStation* station) override;
83 void DoReportFinalDataFailed(WifiRemoteStation* station) override;
84 WifiTxVector DoGetDataTxVector(WifiRemoteStation* station, uint16_t allowedWidth) override;
86
87 /**
88 * Reset the station, invoked if the maximum amount of retries has failed.
89 *
90 * \param station the station for which statistics should be reset
91 */
92 void Reset(WifiRemoteStation* station) const;
93
94 /**
95 * Construct the vector of minimum SNRs needed to successfully transmit for
96 * all possible combinations (rate, channel width, nss) based on PHY capabilities.
97 * This is called at initialization and if PHY capabilities changed.
98 */
99 void BuildSnrThresholds();
100
101 /**
102 * Return the minimum SNR needed to successfully transmit
103 * data with this WifiTxVector at the specified BER.
104 *
105 * \param txVector WifiTxVector (containing valid mode, width, and Nss)
106 *
107 * \return the minimum SNR for the given WifiTxVector in linear scale
108 */
109 double GetSnrThreshold(WifiTxVector txVector);
110 /**
111 * Adds a pair of WifiTxVector and the minimum SNR for that given vector
112 * to the list.
113 *
114 * \param txVector the WifiTxVector storing mode, channel width, and Nss
115 * \param snr the minimum SNR for the given txVector in linear scale
116 */
117 void AddSnrThreshold(WifiTxVector txVector, double snr);
118
119 /**
120 * Convenience function for selecting a channel width for non-HT mode
121 * \param mode non-HT WifiMode
122 * \return the channel width (MHz) for the selected mode
123 */
124 uint16_t GetChannelWidthForNonHtMode(WifiMode mode) const;
125
126 /**
127 * Convenience function to get the last observed SNR from a given station for a given channel
128 * width and a given NSS. Since the previously received SNR information might be related to a
129 * different channel width than the requested one, and/or a different NSS, the function does
130 * some computations to get the corresponding SNR.
131 *
132 * \param station the station being queried
133 * \param channelWidth the channel width (in MHz)
134 * \param nss the number of spatial streams
135 * \return the SNR in linear scale
136 */
138 uint16_t channelWidth,
139 uint8_t nss) const;
140
141 /**
142 * Check whether a given modulation class is supported by both the node and the peer
143 * \param mc the modulation class
144 * \param station the peer station
145 * \return true if the modulation class can be used, false otherwise
146 */
148
149 /**
150 * Check whether a given modulation class is supported and that there are no higher modulation
151 * classes that should instead be candidates
152 * \param mc the modulation class
153 * \param station the peer station
154 * \return true if the modulation class is a candidate, false otherwise
155 */
157
158 /**
159 * A vector of <snr, WifiTxVector> pair holding the minimum SNR for the
160 * WifiTxVector
161 */
162 typedef std::vector<std::pair<double, WifiTxVector>> Thresholds;
163
164 double m_ber; //!< The maximum Bit Error Rate acceptable at any transmission mode
165 Thresholds m_thresholds; //!< List of WifiTxVector and the minimum SNR pair
166
167 TracedValue<uint64_t> m_currentRate; //!< Trace rate changes
168};
169
170} // namespace ns3
171
172#endif /* IDEAL_WIFI_MANAGER_H */
Ideal rate control algorithm.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void AddSnrThreshold(WifiTxVector txVector, double snr)
Adds a pair of WifiTxVector and the minimum SNR for that given vector to the list.
void BuildSnrThresholds()
Construct the vector of minimum SNRs needed to successfully transmit for all possible combinations (r...
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth) override
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
void DoInitialize() override
Initialize() implementation.
uint16_t GetChannelWidthForNonHtMode(WifiMode mode) const
Convenience function for selecting a channel width for non-HT mode.
double m_ber
The maximum Bit Error Rate acceptable at any transmission mode.
WifiRemoteStation * DoCreateStation() const override
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
static TypeId GetTypeId()
Get the type ID.
bool IsModulationClassSupported(WifiModulationClass mc, IdealWifiRemoteStation *station)
Check whether a given modulation class is supported by both the node and the peer.
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.
bool IsCandidateModulationClass(WifiModulationClass mc, IdealWifiRemoteStation *station)
Check whether a given modulation class is supported and that there are no higher modulation classes t...
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
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.
double GetLastObservedSnr(IdealWifiRemoteStation *station, uint16_t channelWidth, uint8_t nss) const
Convenience function to get the last observed SNR from a given station for a given channel width and ...
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.
Thresholds m_thresholds
List of WifiTxVector and the minimum SNR pair.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
std::vector< std::pair< double, WifiTxVector > > Thresholds
A vector of <snr, WifiTxVector> pair holding the minimum SNR for the WifiTxVector.
double GetSnrThreshold(WifiTxVector txVector)
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
void DoReportDataFailed(WifiRemoteStation *station) 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.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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.
void Reset()
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
Every class exported by the ns3 library is enclosed in the ns3 namespace.
hold per-remote-station state for Ideal Wifi manager.
hold per-remote-station state.