|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
24 #include "ns3/wifi-phy.h"
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")
121 for (
const auto & mode :
GetPhy ()->GetModeList ())
132 for (
const auto & mode :
GetPhy ()->GetMcsList ())
144 " channel width " << j <<
146 " GI " << guardInterval);
153 uint16_t guardInterval;
168 " channel width " << j <<
170 " GI " << guardInterval);
191 [&txVector] (
const std::pair<double, WifiTxVector>& p) ->
bool {
192 return ((txVector.GetMode () == p.second.GetMode ()) && (txVector.GetNss () == p.second.GetNss ()) && (txVector.GetChannelWidth () == p.second.GetChannelWidth ()));
200 [&txVector] (
const std::pair<double, WifiTxVector>& p) ->
bool {
201 return ((txVector.GetMode () == p.second.GetMode ()) && (txVector.GetNss () == p.second.GetNss ()) && (txVector.GetChannelWidth () == p.second.GetChannelWidth ()));
213 m_thresholds.push_back (std::make_pair (snr, txVector));
259 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
270 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
276 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
286 double rxSnr,
double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
288 NS_LOG_FUNCTION (
this << st << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr << dataChannelWidth << +dataNss);
292 NS_LOG_WARN (
"DataSnr reported to be zero; not saving this report.");
325 uint64_t bestRate = 0;
326 uint8_t selectedNss = 1;
327 uint16_t guardInterval;
339 " nss " << +selectedNss);
377 " data rate " << dataRate <<
378 " threshold " << threshold <<
" last snr observed " <<
382 if (dataRate > bestRate && threshold < snr)
385 " data rate " << dataRate <<
386 " threshold " << threshold <<
387 " channel width " << channelWidth <<
421 " data rate " << dataRate <<
422 " threshold " << threshold <<
" last snr observed " <<
426 if (dataRate > bestRate && threshold < snr)
429 " data rate " << dataRate <<
430 " channel width " << channelWidth <<
460 " data rate " << dataRate <<
461 " threshold " << threshold <<
" last snr observed " <<
465 if (dataRate > bestRate && threshold < snr)
468 " data rate " << dataRate <<
469 " threshold " << threshold <<
470 " channel width " << channelWidth <<
488 txVector.
SetNss (selectedNss);
494 " threshold " << threshold <<
495 " last snr observed " <<
498 if (dataRate > bestRate && threshold < snr)
501 " data rate " << dataRate <<
502 " threshold " << threshold <<
514 NS_LOG_DEBUG (
"Found maxMode: " << maxMode <<
" channelWidth: " << channelWidth <<
" nss: " << +selectedNss);
533 return WifiTxVector (maxMode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (maxMode.
GetModulationClass (),
GetShortPreambleEnabled ()), guardInterval,
GetNumberOfAntennas (), selectedNss, 0,
GetChannelWidthForTransmission (maxMode, channelWidth),
GetAggregation (station));
544 double maxThreshold = 0.0;
557 if (threshold > maxThreshold && threshold < station->m_lastSnrObserved)
559 maxThreshold = threshold;
581 "; computed SNR is " << snr <<
582 " for channel width " << channelWidth <<
583 " and nss " << +nss);
a unique identifier for an interface.
uint8_t GetDefaultTxPowerLevel(void) const
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
double m_ber
The maximum Bit Error Rate acceptable at any transmission mode.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void DoInitialize(void) override
Initialize() implementation.
virtual ~IdealWifiManager()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
WifiRemoteStation * DoCreateStation(void) const override
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
@ WIFI_MOD_CLASS_HT
HT (Clause 19)
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
@ WIFI_MOD_CLASS_HE
HE (Clause 27)
bool IsValid(void) const
The standard disallows certain combinations of WifiMode, number of spatial streams,...
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
Thresholds m_thresholds
List of WifiTxVector and the minimum SNR pair.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
WifiModulationClass GetModulationClass() const
void SetNss(uint8_t nss)
Sets the number of Nss.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
hold a list of per-remote-station state.
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
uint16_t m_lastNssObserved
Number of spatial streams of most recently reported packet sent to the remote station.
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
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...
uint8_t m_lastNss
Number of spatial streams most recently used to the remote station.
double m_lastSnrObserved
SNR of most recently reported packet sent to the remote station.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
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...
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
double GetSnrThreshold(WifiTxVector txVector)
Return the minimum SNR needed to successfully transmit data with this WifiTxVector at the specified B...
@ WIFI_MOD_CLASS_HR_DSSS
HR/DSSS (Clause 16)
uint16_t m_lastChannelWidth
Channel width (in MHz) most recently used to the remote station.
uint8_t GetMaxSupportedTxSpatialStreams(void) const
uint16_t GetChannelWidthForNonHtMode(WifiMode mode) const
Convenience function for selecting a channel width for non-HT mode.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
represent a single transmission mode
void Reset(void)
Reset the station, invoked in a STA upon dis-association or in an AP upon reboot.
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void BuildSnrThresholds(void)
Construct the vector of minimum SNRs needed to successfully transmit for all possible combinations (r...
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
std::string GetUniqueName(void) const
WifiMode GetDefaultMode(void) const
Return the default transmission mode.
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 ...
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
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...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
uint16_t GetChannelWidth(void) const
void AddSnrThreshold(WifiTxVector txVector, double snr)
Adds a pair of WifiTxVector and the minimum SNR for that given vector to the list.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
hold per-remote-station state.
uint16_t GetGuardInterval(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 ...
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
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...
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint8_t GetNumberOfAntennas(void) const
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
static const double CACHE_INITIAL_VALUE
To avoid using the cache before a valid value has been cached.
uint16_t GetChannelWidth(void) const
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
WifiMode m_lastMode
Mode most recently used to the remote station.
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
Ideal rate control algorithm.
uint8_t GetMaxNumberOfTransmitStreams(void) const
hold per-remote-station state for Ideal Wifi manager.
double m_lastSnrCached
SNR most recently used to select a rate.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
TracedValue< uint64_t > m_currentRate
Trace rate changes.
bool IsAllowed(uint16_t channelWidth, uint8_t nss) const
static TypeId GetTypeId(void)
Get the type ID.
uint16_t m_lastChannelWidthObserved
Channel width (in MHz) of most recently reported packet sent to the remote station.
@ WIFI_MOD_CLASS_DSSS
DSSS (Clause 15)
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
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.
uint8_t GetMcsValue(void) const
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.