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")
111 for (uint8_t i = 0; i < nModes; i++)
124 for (uint8_t i = 0; i < nModes; i++)
137 " channel width " << j <<
139 " GI " << guardInterval);
147 uint16_t guardInterval;
160 " channel width " << j <<
162 " GI " << guardInterval);
187 NS_LOG_DEBUG (
"Checking " << i->second.GetMode ().GetUniqueName () <<
188 " nss " << +i->second.GetNss () <<
189 " GI " << i->second.GetGuardInterval () <<
190 " width " << i->second.GetChannelWidth ());
192 " nss " << +txVector.
GetNss () <<
195 if (txVector.
GetMode () == i->second.GetMode ()
196 && txVector.
GetNss () == i->second.GetNss ()
210 m_thresholds.push_back (std::make_pair (snr, txVector));
246 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
250 station->m_lastSnrObserved = rtsSnr;
255 double ackSnr,
WifiMode ackMode,
double dataSnr)
261 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
264 station->m_lastSnrObserved = dataSnr;
270 NS_LOG_FUNCTION (
this << st << +nSuccessfulMpdus << +nFailedMpdus << rxSnr << dataSnr);
274 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
304 uint64_t bestRate = 0;
305 uint8_t selectedNss = 1;
306 uint16_t guardInterval;
314 selectedNss = station->
m_nss;
318 " nss " << +selectedNss);
357 " data rate " << dataRate <<
358 " threshold " << threshold <<
" last snr observed " <<
361 if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
364 " data rate " << dataRate <<
365 " threshold " << threshold <<
366 " last snr observed " <<
400 " data rate " << dataRate <<
401 " threshold " << threshold <<
" last snr observed " <<
404 if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
407 " data rate " << dataRate <<
408 " threshold " << threshold <<
409 " last snr observed " <<
439 " data rate " << dataRate <<
440 " threshold " << threshold <<
" last snr observed " <<
443 if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
446 " data rate " << dataRate <<
447 " threshold " << threshold <<
448 " last snr observed " <<
466 txVector.
SetNss (selectedNss);
471 " threshold " << threshold <<
472 " last snr observed " <<
474 if (dataRate > bestRate && threshold < station->m_lastSnrObserved)
477 " data rate " << dataRate <<
478 " threshold " << threshold <<
479 " last snr observed " <<
489 station->
m_nss = selectedNss;
491 NS_LOG_DEBUG (
"Found maxMode: " << maxMode <<
" channelWidth: " << channelWidth);
509 return WifiTxVector (maxMode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (maxMode.
GetModulationClass (),
GetShortPreambleEnabled (),
UseGreenfieldForDestination (
GetAddress (station))), guardInterval,
GetNumberOfAntennas (), selectedNss, 0,
GetChannelWidthForTransmission (maxMode, channelWidth),
GetAggregation (station),
false);
520 double maxThreshold = 0.0;
534 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
536 maxThreshold = threshold;
540 return WifiTxVector (maxMode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (maxMode.
GetModulationClass (),
GetShortPreambleEnabled (),
UseGreenfieldForDestination (
GetAddress (station))), 800,
GetNumberOfAntennas (), nss, 0,
GetChannelWidthForMode (maxMode),
GetAggregation (station),
false);
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...
#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
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 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...
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
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 PLCP preambles.
static TypeId GetTypeId(void)
Get the type ID.
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.
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
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.
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.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
uint16_t GetChannelWidthForMode(WifiMode mode) const
Convenience function for selecting a channel width for legacy mode.
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...
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.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint8_t m_nss
Number of spatial streams.
uint8_t GetDefaultTxPowerLevel(void) const
bool IsLowLatency(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'...
double GetSnrThreshold(WifiTxVector txVector) const
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
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.