12#include "ns3/packet.h" 
   13#include "ns3/wifi-tx-vector.h" 
   15#define Min(a, b) ((a < b) ? a : b) 
   16#define Max(a, b) ((a > b) ? a : b) 
   51        TypeId(
"ns3::AarfcdWifiManager")
 
   55            .AddAttribute(
"SuccessK",
 
   56                          "Multiplication factor for the success threshold in the AARF algorithm.",
 
   60            .AddAttribute(
"TimerK",
 
   61                          "Multiplication factor for the timer threshold in the AARF algorithm.",
 
   65            .AddAttribute(
"MaxSuccessThreshold",
 
   66                          "Maximum value of the success threshold in the AARF algorithm.",
 
   70            .AddAttribute(
"MinTimerThreshold",
 
   71                          "The minimum value for the 'timer' threshold in the AARF algorithm.",
 
   75            .AddAttribute(
"MinSuccessThreshold",
 
   76                          "The minimum value for the success threshold in the AARF algorithm.",
 
   80            .AddAttribute(
"MinRtsWnd",
 
   81                          "Minimum value for RTS window of AARF-CD",
 
   85            .AddAttribute(
"MaxRtsWnd",
 
   86                          "Maximum value for RTS window of AARF-CD",
 
   91                "TurnOffRtsAfterRateDecrease",
 
   92                "If true the RTS mechanism will be turned off when the rate will be decreased",
 
   97                "TurnOnRtsAfterRateIncrease",
 
   98                "If true the RTS mechanism will be turned on when the rate will be increased",
 
  102            .AddTraceSource(
"Rate",
 
  103                            "Traced value for rate changes (b/s)",
 
  105                            "ns3::TracedValueCallback::Uint64");
 
 
  127        NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support HT rates");
 
  131        NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support VHT rates");
 
  135        NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support HE rates");
 
 
  149    station->m_success = 0;
 
  150    station->m_failed = 0;
 
  151    station->m_recovery = 
false;
 
  152    station->m_timer = 0;
 
  155    station->m_rtsOn = 
false;
 
  157    station->m_rtsCounter = 0;
 
  158    station->m_justModifyRate = 
true;
 
  159    station->m_haveASuccess = 
false;
 
 
  177    station->m_success = 0;
 
  179    if (!station->m_rtsOn)
 
  182        if (!station->m_justModifyRate && !station->m_haveASuccess)
 
  190        station->m_rtsCounter = station->m_rtsWnd;
 
  191        if (station->m_failed >= 2)
 
  193            station->m_timer = 0;
 
  196    else if (station->m_recovery)
 
  199        station->m_justModifyRate = 
false;
 
  200        station->m_rtsCounter = station->m_rtsWnd;
 
  201        if (station->m_failed == 1)
 
  208            station->m_justModifyRate = 
true;
 
  209            station->m_successThreshold =
 
  211            station->m_timerTimeout =
 
  213            if (station->m_rate != 0)
 
  218        station->m_timer = 0;
 
  223        station->m_justModifyRate = 
false;
 
  224        station->m_rtsCounter = station->m_rtsWnd;
 
  225        if (((station->m_failed - 1) % 2) == 1)
 
  232            station->m_justModifyRate = 
true;
 
  235            if (station->m_rate != 0)
 
  240        if (station->m_failed >= 2)
 
  242            station->m_timer = 0;
 
 
  263    station->m_rtsCounter--;
 
 
  271                                  MHz_u dataChannelWidth,
 
  274    NS_LOG_FUNCTION(
this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
 
  277    station->m_success++;
 
  278    station->m_failed = 0;
 
  279    station->m_recovery = 
false;
 
  280    station->m_justModifyRate = 
false;
 
  281    station->m_haveASuccess = 
true;
 
  282    NS_LOG_DEBUG(
"station=" << station << 
" data ok success=" << station->m_success
 
  283                            << 
", timer=" << station->m_timer);
 
  284    if ((station->m_success == station->m_successThreshold ||
 
  285         station->m_timer == station->m_timerTimeout) &&
 
  290        station->m_timer = 0;
 
  291        station->m_success = 0;
 
  292        station->m_recovery = 
true;
 
  293        station->m_justModifyRate = 
true;
 
  298            station->m_rtsCounter = station->m_rtsWnd;
 
 
  322    if (channelWidth > 
MHz_u{20} && channelWidth != 
MHz_u{22})
 
  324        channelWidth = 
MHz_u{20};
 
 
  353    if (channelWidth > 
MHz_u{20} && channelWidth != 
MHz_u{22})
 
  355        channelWidth = 
MHz_u{20};
 
 
  383    NS_LOG_INFO(
"" << station << 
" rate=" << station->m_rate
 
  384                   << 
" rts=" << (station->m_rtsOn ? 
"RTS" : 
"BASIC")
 
  385                   << 
" rtsCounter=" << station->m_rtsCounter);
 
  386    return station->m_rtsOn;
 
 
an implementation of the AARF-CD algorithm
void ResetRtsWnd(AarfcdWifiRemoteStation *station)
Reset the RTS window of the given station.
bool m_turnOnRtsAfterRateIncrease
turn on RTS after rate increase
double m_timerK
Multiplication factor for the timer threshold.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
uint32_t m_maxSuccessThreshold
maximum success threshold
bool DoNeedRts(WifiRemoteStation *station, uint32_t size, bool normally) override
WifiRemoteStation * DoCreateStation() const override
uint32_t m_minTimerThreshold
minimum timer threshold
uint32_t m_minSuccessThreshold
minimum success threshold
uint32_t m_minRtsWnd
minimum RTS window
bool m_turnOffRtsAfterRateDecrease
turn off RTS after rate decrease
uint32_t m_maxRtsWnd
maximum RTS window
void TurnOffRts(AarfcdWifiRemoteStation *station)
Turn off RTS for the given station.
double m_successK
Multiplication factor for the success threshold.
void DoInitialize() override
Initialize() implementation.
void TurnOnRts(AarfcdWifiRemoteStation *station)
Turn on RTS for the given station.
~AarfcdWifiManager() override
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportDataFailed(WifiRemoteStation *station) override
It is important to realize that "recovery" mode starts after failure of the first transmission after ...
static TypeId GetTypeId()
Get the type ID.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth) override
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
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.
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.
void CheckRts(AarfcdWifiRemoteStation *station)
Check if the use of RTS for the given station can be turned off.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void IncreaseRtsWnd(AarfcdWifiRemoteStation *station)
Increase the RTS window size of the given station.
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
represent a single transmission mode
WifiModulationClass GetModulationClass() const
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
hold a list of per-remote-station state.
uint8_t GetDefaultTxPowerLevel() const
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
MHz_u GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetHtSupported() const
Return whether the device has HT capability support enabled on the link this manager is associated wi...
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index.
bool GetUseNonErpProtection() const
Return whether the device supports protection of non-ERP stations.
bool GetVhtSupported() const
Return whether the device has VHT capability support enabled on the link this manager is associated w...
bool GetShortPreambleEnabled() const
Return whether the device uses short PHY preambles.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
bool GetHeSupported() const
Return whether the device has HE capability support enabled.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
hold per-remote-station state for AARF-CD Wifi manager.
uint32_t m_rtsCounter
RTS counter.
uint32_t m_successThreshold
success threshold
uint32_t m_success
success
uint32_t m_rtsWnd
RTS window.
bool m_haveASuccess
have a success
bool m_justModifyRate
just modify rate
uint32_t m_timerTimeout
timer timeout
hold per-remote-station state.