57 .SetGroupName (
"Wifi")
59 .AddAttribute (
"BerThreshold",
60 "The maximum Bit Error Rate acceptable at any transmission mode",
63 MakeDoubleChecker<double> ())
64 .AddTraceSource (
"Rate",
65 "Traced value for rate changes (b/s)",
67 "ns3::TracedValueCallback::Uint64")
122 for (uint8_t i = 0; i < nModes; i++)
135 for (uint8_t i = 0; i < nModes; i++)
148 " channel width " << j <<
150 " GI " << guardInterval);
157 uint16_t guardInterval;
172 " channel width " << j <<
174 " GI " << guardInterval);
195 [&txVector] (
const std::pair<double, WifiTxVector>& p) ->
bool {
196 return ((txVector.
GetMode () == p.second.GetMode ()) && (txVector.
GetNss () == p.second.GetNss ()) && (txVector.
GetChannelWidth () == p.second.GetChannelWidth ()));
204 [&txVector] (
const std::pair<double, WifiTxVector>& p) ->
bool {
205 return ((txVector.
GetMode () == p.second.GetMode ()) && (txVector.
GetNss () == p.second.GetNss ()) && (txVector.
GetChannelWidth () == p.second.GetChannelWidth ()));
217 m_thresholds.push_back (std::make_pair (snr, txVector));
263 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
269 station->m_lastNssObserved = 1;
274 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
280 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
283 station->m_lastSnrObserved = dataSnr;
284 station->m_lastChannelWidthObserved = dataChannelWidth;
285 station->m_lastNssObserved = dataNss;
290 double rxSnr,
double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
292 NS_LOG_FUNCTION (
this << st << +nSuccessfulMpdus << +nFailedMpdus << rxSnr << dataSnr << dataChannelWidth << +dataNss);
296 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
329 uint64_t bestRate = 0;
330 uint8_t selectedNss = 1;
331 uint16_t guardInterval;
343 " nss " << +selectedNss);
381 " data rate " << dataRate <<
382 " threshold " << threshold <<
" last snr observed " <<
386 if (dataRate > bestRate && threshold < snr)
389 " data rate " << dataRate <<
390 " threshold " << threshold <<
391 " channel width " << channelWidth <<
425 " data rate " << dataRate <<
426 " threshold " << threshold <<
" last snr observed " <<
430 if (dataRate > bestRate && threshold < snr)
433 " data rate " << dataRate <<
434 " channel width " << channelWidth <<
464 " data rate " << dataRate <<
465 " threshold " << threshold <<
" last snr observed " <<
469 if (dataRate > bestRate && threshold < snr)
472 " data rate " << dataRate <<
473 " threshold " << threshold <<
474 " channel width " << channelWidth <<
492 txVector.
SetNss (selectedNss);
498 " threshold " << threshold <<
499 " last snr observed " <<
502 if (dataRate > bestRate && threshold < snr)
505 " data rate " << dataRate <<
506 " threshold " << threshold <<
518 NS_LOG_DEBUG (
"Found maxMode: " << maxMode <<
" channelWidth: " << channelWidth <<
" nss: " << +selectedNss);
537 return WifiTxVector (maxMode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (maxMode.
GetModulationClass (),
GetShortPreambleEnabled (),
UseGreenfieldForDestination (
GetAddress (station))), guardInterval,
GetNumberOfAntennas (), selectedNss, 0,
GetChannelWidthForTransmission (maxMode, channelWidth),
GetAggregation (station),
false);
548 double maxThreshold = 0.0;
561 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
563 maxThreshold = threshold;
567 return WifiTxVector (maxMode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (maxMode.
GetModulationClass (),
GetShortPreambleEnabled (),
UseGreenfieldForDestination (
GetAddress (station))), 800,
GetNumberOfAntennas (), nss, 0,
GetChannelWidthForNonHtMode (maxMode),
GetAggregation (station),
false);
585 "; computed SNR is " << snr <<
586 " for channel width " << channelWidth <<
587 " and nss " << +nss);
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static const double CACHE_INITIAL_VALUE
To avoid using the cache before a valid value has been cached.
WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
uint16_t m_lastNssObserved
Number of spatial streams of most recently reported packet sent to the remote station.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
uint8_t GetNumberOfAntennas(void) const
void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
uint8_t GetMaxNumberOfTransmitStreams(void) const
uint16_t m_lastChannelWidth
Channel width (in MHz) most recently used to the remote station.
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
#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.
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.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
uint16_t m_lastChannelWidthObserved
Channel width (in MHz) of most recently reported packet sent to the remote station.
uint16_t GetGuardInterval(void) const
hold per-remote-station state for Ideal Wifi manager.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble, bool useGreenfield)
Return the preamble to be used for the transmission.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index. ...
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
uint8_t m_lastNss
Number of spatial streams most recently used to the remote station.
void DoInitialize(void)
Initialize() implementation.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
uint16_t GetChannelWidth(void) const
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 ...
uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
static TypeId GetTypeId(void)
Get the type ID.
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.
bool IsValid(void) const
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
double GetSnrThreshold(WifiTxVector txVector)
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
void BuildSnrThresholds(void)
Construct the vector of minimum SNRs needed to successfully transmit for all possible combinations (r...
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
This method is a pure virtual method that must be implemented by the sub-class.
WifiMode GetMode(void) const
Thresholds m_thresholds
List of WifiTxVector and the minimum SNR pair.
double m_lastSnrObserved
SNR of most recently reported packet sent to the remote station.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
hold a list of per-remote-station state.
WifiModulationClass GetModulationClass() const
std::string GetUniqueName(void) const
WifiMode GetDefaultMode(void) const
Return the default transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY's default ...
bool UseGreenfieldForDestination(Mac48Address dest) const
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
WifiRemoteStation * DoCreateStation(void) const
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
double m_lastSnrCached
SNR most recently used to select a rate.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
uint8_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
void Reset(void)
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot. ...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint8_t GetDefaultTxPowerLevel(void) const
Ideal rate control algorithmThis class implements an 'ideal' rate control algorithm similar to RBAR i...
WifiMode m_lastMode
Mode most recently used to the remote station.
virtual ~IdealWifiManager()
uint16_t GetChannelWidth(void) const
void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
uint8_t GetMcsValue(void) const
uint8_t GetMaxSupportedTxSpatialStreams(void) const
a unique identifier for an interface.
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.
hold per-remote-station state.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
void AddSnrThreshold(WifiTxVector txVector, double snr)
Adds a pair of WifiTxVector and the minimum SNR for that given vector to the list.
uint8_t GetNss(void) const
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.