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