23 #include "ns3/assert.h"
24 #include "ns3/double.h"
53 .SetGroupName (
"Wifi")
55 .AddAttribute (
"BerThreshold",
56 "The maximum Bit Error Rate acceptable at any transmission mode",
59 MakeDoubleChecker<double> ())
60 .AddTraceSource (
"Rate",
61 "Traced value for rate changes (b/s)",
63 "ns3::TracedValueCallback::Uint64")
109 for (uint32_t i = 0; i < nModes; i++)
117 " nss " << (uint16_t) nss <<
126 for (uint32_t i = 0; i < nModes; i++)
140 " nss " << (uint16_t) nss <<
156 NS_LOG_DEBUG (
"Checking " << i->second.GetMode ().GetUniqueName () <<
157 " nss " << (uint16_t) i->second.GetNss () <<
158 " width " << i->second.GetChannelWidth ());
160 " nss " << (uint16_t) txVector.
GetNss () <<
162 if (txVector.
GetMode () == i->second.GetMode () &&
163 txVector.
GetNss () == i->second.GetNss () &&
178 m_thresholds.push_back (std::make_pair (snr, txVector));
212 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
216 station->m_lastSnrObserved = rtsSnr;
221 double ackSnr,
WifiMode ackMode,
double dataSnr)
227 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
230 station->m_lastSnrObserved = dataSnr;
236 NS_LOG_FUNCTION (
this << st << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr);
240 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
265 double maxThreshold = 0.0;
267 std::vector<WifiTxVector> candidateTxVectors;
278 nss = station->
m_nss;
304 " nss " << nss <<
" width " <<
320 " threshold " << threshold <<
" maxThreshold " <<
321 maxThreshold <<
" last snr observed " <<
324 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
327 " threshold " << threshold <<
328 " last snr observed " <<
330 maxThreshold = threshold;
347 " threshold " << threshold <<
348 " last snr observed " <<
350 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
353 " threshold " << threshold <<
354 " last snr observed " <<
356 maxThreshold = threshold;
364 station->
m_nss = nss;
367 NS_LOG_DEBUG (
"Found maxMode: " << maxMode <<
" channelWidth: " << channelWidth);
384 double maxThreshold = 0.0;
399 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
401 maxThreshold = threshold;
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
void SetShortGuardInterval(bool guardinterval)
Sets if short gurad interval is being used.
virtual bool IsLowLatency(void) const
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
virtual uint32_t GetNModes(void) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
virtual void SetupPhy(Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
enum WifiModulationClass GetModulationClass() const
virtual uint8_t GetNMcs(void) const =0
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
bool IsShortGuardInterval(void) const
virtual void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr)
This method is a pure virtual method that must be implemented by the sub-class.
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint32_t i) const
Return the WifiMode supported by the specified station at the specified index.
hold per-remote-station state for Ideal Wifi manager.
virtual void SetupPhy(Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
virtual void DoInitialize(void)
Initialize() implementation.
WifiMode GetSupported(const WifiRemoteStation *station, uint32_t i) const
Return whether mode associated with the specified station at the specified index. ...
virtual WifiMode GetMcs(uint8_t mcs) const =0
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
void SetChannelWidth(uint32_t channelWidth)
Sets the selected channelWidth (in MHz)
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
virtual void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
virtual uint32_t GetChannelWidth(void) const =0
double GetSnrThreshold(WifiTxVector txVector) const
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
static TypeId GetTypeId(void)
double m_ber
The maximum Bit Error Rate acceptable at any transmission mode.
WifiMode GetBasicMode(uint32_t i) const
Return a basic mode from the set of basic modes.
uint32_t GetChannelWidth(void) const
uint8_t GetMcsValue(void) const
std::string GetUniqueName(void) const
Thresholds m_thresholds
List of WifiTxVector and the minimum SNR pair.
double m_nss
SNR most recently used to select a rate.
double m_lastSnrObserved
SNR of most recently reported packet sent to the remote station.
virtual bool GetGuardInterval(void) const =0
hold a list of per-remote-station state.
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
virtual void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr)
This method is a pure virtual method that must be implemented by the sub-class.
virtual WifiRemoteStation * DoCreateStation(void) const
TracedValue< uint64_t > m_currentRate
Trace rate changes.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static bool IsValidTxVector(WifiTxVector txVector)
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
bool HasVhtSupported(void) const
Return whether the device has VHT capability support enabled.
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
virtual WifiMode GetMode(uint32_t mode) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
double m_lastSnrCached
SNR most recently used to select a rate.
bool HasHtSupported(void) const
Return whether the device has HT capability support enabled.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
uint8_t GetDefaultTxPowerLevel(void) const
uint8_t GetNss(void) const
uint32_t GetNBasicModes(void) const
Return the number of basic modes we support.
uint32_t GetLongRetryCount(const WifiRemoteStation *station) const
Return the long retry limit of the given station.
virtual void DoReportAmpduTxStatus(WifiRemoteStation *station, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus, double rxSnr, double dataSnr)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
uint32_t GetNMcsSupported(const WifiRemoteStation *station) const
Return the number of MCS supported by the given station.
WifiMode GetDefaultMode(void) const
Return the default transmission mode.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
uint32_t GetChannelWidthForMode(WifiMode mode) const
Convenience function for selecting a channel width for legacy mode.
bool GetVhtSupported(const WifiRemoteStation *station) const
Return whether the given station is VHT capable.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ideal rate control algorithmThis class implements an 'ideal' rate control algorithm similar to RBAR i...
uint32_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
WifiMode m_lastMode
Mode most recently used to the remote station.
uint32_t GetShortRetryCount(const WifiRemoteStation *station) const
Return the short retry limit of the given station.
virtual ~IdealWifiManager()
virtual void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
WifiMode GetMode(void) const
This class can be used to hold variables of floating point type such as 'double' or 'float'...
a unique identifier for an interface.
virtual void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual uint8_t GetSupportedTxSpatialStreams(void) const =0
hold per-remote-station state.
void AddSnrThreshold(WifiTxVector txVector, double snr)
Adds a pair of WifiTxVector and the minimum SNR for that given vector to the list.