23 #include "ns3/wifi-tx-vector.h"
25 #define Min(a, b) ((a < b) ? a : b)
52 TypeId(
"ns3::CaraWifiManager")
58 "The number of consecutive transmissions failure to activate the RTS probe.",
61 MakeUintegerChecker<uint32_t>())
62 .AddAttribute(
"FailureThreshold",
63 "The number of consecutive transmissions failure to decrease the rate.",
66 MakeUintegerChecker<uint32_t>())
67 .AddAttribute(
"SuccessThreshold",
68 "The minimum number of successful transmissions to try a new rate.",
71 MakeUintegerChecker<uint32_t>())
72 .AddAttribute(
"Timeout",
73 "The 'timer' in the CARA algorithm",
76 MakeUintegerChecker<uint32_t>())
77 .AddTraceSource(
"Rate",
78 "Traced value for rate changes (b/s)",
80 "ns3::TracedValueCallback::Uint64");
102 NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support HT rates");
106 NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support VHT rates");
110 NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support HE rates");
120 station->m_success = 0;
121 station->m_failed = 0;
122 station->m_timer = 0;
139 station->m_success = 0;
143 if (station->m_rate != 0)
147 station->m_failed = 0;
148 station->m_timer = 0;
172 uint16_t dataChannelWidth,
175 NS_LOG_FUNCTION(
this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
178 station->m_success++;
179 station->m_failed = 0;
180 NS_LOG_DEBUG(
"self=" << station <<
" data ok success=" << station->m_success
181 <<
", timer=" << station->m_timer);
188 NS_LOG_DEBUG(
"self=" << station <<
" inc rate=" << +station->m_rate);
189 station->m_timer = 0;
190 station->m_success = 0;
212 if (channelWidth > 20 && channelWidth != 22)
243 if (channelWidth > 20 && channelWidth != 22)
implement the CARA rate control algorithm
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth) override
void DoInitialize() override
Initialize() implementation.
~CaraWifiManager() override
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 DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
static TypeId GetTypeId()
Get the type ID.
uint32_t m_failureThreshold
failure threshold
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
bool DoNeedRts(WifiRemoteStation *station, uint32_t size, bool normally) override
uint32_t m_timerTimeout
timer threshold
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiRemoteStation * DoCreateStation() const override
uint32_t m_successThreshold
success threshold
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.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
uint32_t m_probeThreshold
probe threshold
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(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
hold a list of per-remote-station state.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
uint8_t GetDefaultTxPowerLevel() const
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given 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.
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.
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_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_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
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.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
hold per-remote-station state for CARA Wifi manager.
uint32_t m_success
success count
uint32_t m_failed
failed count
uint32_t m_timer
timer count
uint8_t m_rate
rate in bps
hold per-remote-station state.