22 #include "ns3/simulator.h"
24 #include "ns3/uinteger.h"
25 #include "ns3/double.h"
27 #define Min(a,b) ((a < b) ? a : b)
60 .SetGroupName (
"Wifi")
62 .AddAttribute (
"UpdatePeriod",
63 "The interval between decisions about rate control changes",
67 .AddAttribute (
"FailureRatio",
68 "Ratio of minimum erroneous transmissions needed to switch to a lower rate",
71 MakeDoubleChecker<double> (0.0, 1.0))
72 .AddAttribute (
"SuccessRatio",
73 "Ratio of maximum erroneous transmissions needed to switch to a higher rate",
76 MakeDoubleChecker<double> (0.0, 1.0))
77 .AddAttribute (
"MaxSuccessThreshold",
78 "Maximum number of consecutive success periods needed to switch to a higher rate",
81 MakeUintegerChecker<uint32_t> ())
82 .AddAttribute (
"MinSuccessThreshold",
83 "Minimum number of consecutive success periods needed to switch to a higher rate",
86 MakeUintegerChecker<uint32_t> ())
87 .AddTraceSource (
"Rate",
88 "Traced value for rate changes (b/s)",
90 "ns3::TracedValueCallback::Uint64")
148 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
155 double ackSnr,
WifiMode ackMode,
double dataSnr)
249 bool needChange =
false;
297 if (
IsEnough (station) || needChange)
350 if (channelWidth > 20 && channelWidth != 22)
361 return WifiTxVector (mode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (mode,
GetAddress (station)), 800, 1, 1, 0, channelWidth,
GetAggregation (station),
false);
370 if (channelWidth > 20 && channelWidth != 22)
386 rtsTxVector =
WifiTxVector (mode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (mode,
GetAddress (station)), 800, 1, 1, 0, channelWidth,
GetAggregation (station),
false);
402 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HT rates");
412 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support VHT rates");
422 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HE rates");
uint32_t m_minSuccessThreshold
mnimum success threshold
bool IsMinRate(AmrrWifiRemoteStation *station) const
Check if the current rate for the given station is the minimum rate.
Simulation virtual time values and global simulation resolution.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AMRR Rate control algorithmThis class implements the AMRR rate control algorithm which was initially ...
WifiRemoteStation * DoCreateStation(void) const
uint32_t m_successThreshold
success threshold
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Time m_nextModeUpdate
next mode update time
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
bool GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
void ResetCnt(AmrrWifiRemoteStation *station)
Reset transmission statistics of the given station.
hold per-remote-station state for AMRR Wifi manager.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
#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 SetHeSupported(bool enable)
Enable or disable HE capability support.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint32_t m_tx_err
transmit error
Time m_updatePeriod
update period
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
TracedValue< uint64_t > m_currentRate
Trace rate changes.
bool IsLowLatency(void) const
bool IsFailure(AmrrWifiRemoteStation *station) const
Check if the number of retransmission and transmission error is greater than the number of successful...
AttributeValue implementation for Time.
Hold an unsigned integer type.
WifiPreamble GetPreambleForTransmission(WifiMode mode, Mac48Address dest)
Return the preamble to be used for the transmission.
uint8_t m_txrate
transmit rate
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
uint8_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
void SetHtSupported(bool enable)
Enable or disable HT capability support.
void DecreaseRate(AmrrWifiRemoteStation *station)
Decrease the transmission rate to the given station.
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
hold a list of per-remote-station state.
uint32_t m_tx_ok
transmit ok
virtual ~AmrrWifiManager()
void IncreaseRate(AmrrWifiRemoteStation *station)
Increase the transmission rate to the given station.
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_success
success
double m_successRatio
success ratio
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static TypeId GetTypeId(void)
Get the type ID.
static Time Now(void)
Return the current simulation virtual time.
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.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index. ...
uint32_t m_tx_retr
transmit retry
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
bool IsSuccess(AmrrWifiRemoteStation *station) const
Check if the number of retransmission and transmission error is less than the number of successful tr...
uint8_t GetDefaultTxPowerLevel(void) const
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index...
double m_failureRatio
failure ratio
uint32_t m_maxSuccessThreshold
maximum success threshold
void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
void UpdateMode(AmrrWifiRemoteStation *station)
Update the mode used to send to the given station.
bool IsMaxRate(AmrrWifiRemoteStation *station) const
Check if the current rate for the given station is the maximum rate.
bool IsEnough(AmrrWifiRemoteStation *station) const
Check if the number of retransmission, transmission error, and successful transmission are greater th...
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
void SetVhtSupported(bool enable)
Enable or disable VHT capability support.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
hold per-remote-station state.