|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #include "ns3/packet.h"
23 #include "ns3/simulator.h"
25 #include "ns3/wifi-phy.h"
26 #include "ns3/wifi-mac.h"
28 #define Min(a,b) ((a < b) ? a : b)
63 .SetGroupName (
"Wifi")
65 .AddAttribute (
"Basic",
66 "If true the RRAA-BASIC algorithm will be used, otherwise the RRAA will be used",
70 .AddAttribute (
"Timeout",
71 "Timeout for the RRAA BASIC loss estimation block",
75 .AddAttribute (
"FrameLength",
76 "The Data frame length (in bytes) used for calculating mode TxTime.",
79 MakeUintegerChecker <uint32_t> ())
80 .AddAttribute (
"AckFrameLength",
81 "The Ack frame length (in bytes) used for calculating mode TxTime.",
84 MakeUintegerChecker <uint32_t> ())
85 .AddAttribute (
"Alpha",
86 "Constant for calculating the MTL threshold.",
89 MakeDoubleChecker<double> (1))
90 .AddAttribute (
"Beta",
91 "Constant for calculating the ORI threshold.",
94 MakeDoubleChecker<double> (1))
96 "Constant for calculating the EWND size.",
99 MakeDoubleChecker<double> (0))
100 .AddTraceSource (
"Rate",
101 "Traced value for rate changes (b/s)",
103 "ns3::TracedValueCallback::Uint64")
126 for (
const auto & mode :
phy->GetModeList ())
134 NS_LOG_DEBUG (
"Calculating TX times: Mode= " << mode <<
" DataTxTime= " << dataTxTime <<
" AckTxTime= " << ackTxTime);
153 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HT rates");
157 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support VHT rates");
161 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HE rates");
171 if (mode == i->second)
192 for (RraaThresholdsTable::const_iterator i = station->
m_thresholds.begin (); i != station->
m_thresholds.end (); i++)
194 if (mode == i->second)
199 NS_ABORT_MSG (
"No thresholds for mode " << mode <<
" found");
242 double nextCritical = 0;
246 for (uint8_t i = 0; i < station->
m_nRate; i++)
259 nextMtl =
m_alpha * nextCritical;
270 station->
m_thresholds.push_back (std::make_pair (th, mode));
318 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
325 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
327 NS_LOG_FUNCTION (
this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
353 if (channelWidth > 20 && channelWidth != 22)
373 if (channelWidth > 20 && channelWidth != 22)
393 uint32_t size,
bool normally)
424 || ploss > thresholds.
m_mtl)
426 if (ploss > thresholds.
m_mtl)
431 && ploss < thresholds.
m_ori)
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.
Time m_difs
Value of DIFS configured in the device.
uint32_t m_counter
Counter for transmission attempts.
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void ARts(RraaWifiRemoteStation *station)
Activate the use of RTS for the given station if the conditions are met.
#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,...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
AttributeValue implementation for Boolean.
double m_mtl
Maximum Tolerable Loss threshold.
bool GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
uint32_t m_ewnd
Evaluation Window.
void DoInitialize(void) override
Initialize() implementation.
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
uint8_t m_rateIndex
Current rate index.
std::vector< std::pair< WifiRraaThresholds, WifiMode > > RraaThresholdsTable
List of thresholds for each mode.
uint32_t m_nFailed
Number of failed transmission attempts.
Robust Rate Adaptation Algorithm.
uint8_t GetMaxRate(RraaWifiRemoteStation *station) const
Return the index for the maximum transmission rate for the given station.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
WifiRraaThresholds GetThresholds(RraaWifiRemoteStation *station, WifiMode mode) const
Get the thresholds for the given station and mode.
WifiModulationClass GetModulationClass() const
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
hold a list of per-remote-station state.
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
bool m_lastFrameFail
Flag if the last frame sent has failed.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
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...
void CheckInit(RraaWifiRemoteStation *station)
Check for initializations.
uint32_t m_frameLength
Data frame length used for calculate mode TxTime.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
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.
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...
void SetupMac(const Ptr< WifiMac > mac) override
Set up MAC associated with this device since it is the object that knows the full set of timing param...
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Time m_sifs
Value of SIFS configured in the device.
TxTime m_calcTxTime
To hold all the calculated TxTime for all modes.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
WifiRraaThresholds structure.
represent a single transmission mode
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
void RunBasicAlgorithm(RraaWifiRemoteStation *station)
Find an appropriate rate for the given station, using a basic algorithm.
double m_alpha
Alpha value for RRAA (value for calculating MTL 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.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
uint32_t m_ackLength
Ack frame length used for calculate mode TxTime.
double m_ori
Opportunistic Rate Increase threshold.
virtual ~RraaWifiManager()
Simulation virtual time values and global simulation resolution.
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
bool DoNeedRts(WifiRemoteStation *st, uint32_t size, bool normally) 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...
Time GetCalcTxTime(WifiMode mode) const
Get the estimated TxTime of a packet with a given mode.
uint8_t m_nRate
Number of supported rates.
static TypeId GetTypeId(void)
Get the type ID.
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.
bool m_adaptiveRtsOn
Check if Adaptive RTS mechanism is on.
hold per-remote-station state for RRAA Wifi manager.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
double m_tau
Tau value for RRAA (value for calculating EWND size).
TracedValue< uint64_t > m_currentRate
Trace rate changes.
Time m_lastReset
Time of the last reset.
void AddCalcTxTime(WifiMode mode, Time t)
Add transmission time for the given mode to an internal list.
#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.
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
RraaThresholdsTable m_thresholds
RRAA thresholds for this station.
AttributeValue implementation for Time.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
void CheckTimeout(RraaWifiRemoteStation *station)
Check if the counter should be reset.
Hold an unsigned integer type.
WifiRemoteStation * DoCreateStation(void) const override
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
double m_beta
Beta value for RRAA (value for calculating ORI threshold).
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
void InitThresholds(RraaWifiRemoteStation *station)
Initialize the thresholds internal list for the given station.
virtual void SetupMac(const Ptr< WifiMac > mac)
Set up MAC associated with this device since it is the object that knows the full set of timing param...
uint32_t m_adaptiveRtsWnd
Window size for the Adaptive RTS mechanism.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
void ResetCountersBasic(RraaWifiRemoteStation *station)
Reset the counters of the given station.
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.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
uint32_t m_rtsCounter
Counter for RTS transmission attempts.
bool m_initialized
For initializing variables.