12#include "ns3/simulator.h"
13#include "ns3/wifi-tx-vector.h"
45 TypeId(
"ns3::OnoeWifiManager")
49 .AddAttribute(
"UpdatePeriod",
50 "The interval between decisions about rate control changes",
54 .AddAttribute(
"RaiseThreshold",
55 "Attempt to raise the rate if we hit that threshold",
59 .AddAttribute(
"AddCreditThreshold",
60 "Add credit threshold",
64 .AddTraceSource(
"Rate",
65 "Traced value for rate changes (b/s)",
67 "ns3::TracedValueCallback::Uint64");
89 NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support HT rates");
93 NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support VHT rates");
97 NS_FATAL_ERROR(
"WifiRemoteStationManager selected does not support HE rates");
107 station->m_rateBlocked =
false;
108 station->m_shortRetry = 0;
109 station->m_longRetry = 0;
110 station->m_tx_ok = 0;
111 station->m_tx_err = 0;
112 station->m_tx_retr = 0;
113 station->m_tx_upper = 0;
114 station->m_txrate = 0;
130 station->m_rateBlocked =
true;
139 station->m_rateBlocked =
true;
158 MHz_u dataChannelWidth,
161 NS_LOG_FUNCTION(
this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
165 station->m_rateBlocked =
false;
175 station->m_rateBlocked =
false;
185 station->m_rateBlocked =
false;
228 if (enough && station->
m_tx_err == 0 &&
287 if (station->m_longRetry < 4)
289 rateIndex = station->m_txrate;
291 else if (station->m_longRetry < 6)
293 if (station->m_txrate > 0)
295 rateIndex = station->m_txrate - 1;
299 rateIndex = station->m_txrate;
302 else if (station->m_longRetry < 8)
304 if (station->m_txrate > 1)
306 rateIndex = station->m_txrate - 2;
310 rateIndex = station->m_txrate;
315 if (station->m_txrate > 2)
317 rateIndex = station->m_txrate - 3;
321 rateIndex = station->m_txrate;
325 if (channelWidth >
MHz_u{20} && channelWidth !=
MHz_u{22})
327 channelWidth =
MHz_u{20};
354 if (channelWidth >
MHz_u{20} && channelWidth !=
MHz_u{22})
356 channelWidth =
MHz_u{20};
an implementation of the rate control algorithm developed by Atsushi Onoe
WifiRemoteStation * DoCreateStation() const override
void DoInitialize() override
Initialize() implementation.
void UpdateRetry(OnoeWifiRemoteStation *station)
Update the number of retry (both short and long).
Time m_updatePeriod
update period
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.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
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
void DoReportRtsFailed(WifiRemoteStation *station) 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.
uint32_t m_addCreditThreshold
add credit threshold
uint32_t m_raiseThreshold
raise threshold
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth) override
static TypeId GetTypeId()
Get the type ID.
void DoReportDataFailed(WifiRemoteStation *station) 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.
~OnoeWifiManager() override
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 UpdateMode(OnoeWifiRemoteStation *station)
Update the mode.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
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
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.
WifiRemoteStationManager()
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 AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
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_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double 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.
double MHz_u
MHz weak type.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
hold per-remote-station state for ONOE Wifi manager.
uint32_t m_tx_retr
transmit retry
uint32_t m_shortRetry
short retry
uint8_t m_txrate
transmit rate
bool m_rateBlocked
whether the rate cannot be changed
Time m_nextModeUpdate
next mode update
uint32_t m_longRetry
long retry
uint32_t m_tx_ok
transmit OK
uint32_t m_tx_upper
transmit upper
uint32_t m_tx_err
transmit error
hold per-remote-station state.