22 #include "ns3/uinteger.h" 23 #include "ns3/data-rate.h" 27 #define Min(a,b) ((a < b) ? a : b) 64 .SetGroupName (
"Wifi")
66 .AddAttribute (
"SuccessThreshold1",
67 "The minimum number of successful transmissions in \"High\" state to try a new power or rate.",
70 MakeUintegerChecker<uint32_t> ())
71 .AddAttribute (
"SuccessThreshold2",
72 "The minimum number of successful transmissions in \"Low\" state to try a new power or rate.",
75 MakeUintegerChecker<uint32_t> ())
76 .AddAttribute (
"FailThreshold",
77 "The minimum number of failed transmissions to try a new power or rate.",
80 MakeUintegerChecker<uint32_t> ())
81 .AddAttribute (
"PowerThreshold",
82 "The maximum number of power changes.",
85 MakeUintegerChecker<uint32_t> ())
86 .AddAttribute (
"PowerDecrementStep",
87 "Step size for decrement the power.",
90 MakeUintegerChecker<uint8_t> ())
91 .AddAttribute (
"PowerIncrementStep",
92 "Step size for increment the power.",
95 MakeUintegerChecker<uint8_t> ())
96 .AddAttribute (
"RateDecrementStep",
97 "Step size for decrement the rate.",
100 MakeUintegerChecker<uint8_t> ())
101 .AddAttribute (
"RateIncrementStep",
102 "Step size for increment the rate.",
105 MakeUintegerChecker<uint8_t> ())
106 .AddTraceSource (
"PowerChange",
107 "The transmission power has change",
109 "ns3::WifiRemoteStationManager::PowerChangeTracedCallback")
110 .AddTraceSource (
"RateChange",
111 "The transmission rate has change",
113 "ns3::WifiRemoteStationManager::RateChangeTracedCallback")
326 if (channelWidth > 20 && channelWidth != 22)
347 return WifiTxVector (mode, station->
m_powerLevel,
GetPreambleForTransmission (mode,
GetAddress (st)), 800, 1, 1, 0, channelWidth,
GetAggregation (station),
false);
358 if (channelWidth > 20 && channelWidth != 22)
373 rtsTxVector =
WifiTxVector (mode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (mode,
GetAddress (st)), 800, 1, 1, 0, channelWidth,
GetAggregation (station),
false);
389 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HT rates");
399 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support VHT rates");
409 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HE rates");
uint32_t m_succesMax2
The minimum number of successful transmissions in "Low" state to try a new power or rate...
uint32_t m_nSuccess
Number of successful transmission attempts.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
uint8_t m_powerDec
Step size for decrement the power.
uint8_t m_rateInc
Step size for increment the rate.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
APARF Power and rate control algorithm.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
static TypeId GetTypeId(void)
Register this type.
uint8_t m_critRateIndex
Critical rate.
uint8_t m_powerLevel
Current power level.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Mac48Address m_address
Mac48Address of the remote station.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
AparfWifiManager::State m_aparfState
The estimated state of the channel.
uint32_t m_failThreshold
The minimum number of failed transmissions to try a new power or rate.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index. ...
uint32_t m_successThreshold
The minimum number of successful transmissions to try a new power or rate.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
State
Enumeration of the possible states of the channel.
WifiRemoteStation * DoCreateStation(void) const
void SetHeSupported(bool enable)
Enable or disable HE capability support.
WifiRemoteStationState * m_state
Remote station state.
bool m_initialized
For initializing variables.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Class for representing data rates.
uint8_t m_maxPower
Maximal power level.
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.
uint8_t m_powerInc
Step size for increment the power.
TracedCallback< double, double, Mac48Address > m_powerChange
The trace source fired when the transmission power changes.
Hold an unsigned integer type.
WifiPreamble GetPreambleForTransmission(WifiMode mode, Mac48Address dest)
Return the preamble to be used for the transmission.
uint32_t m_nFailed
Number of failed transmission attempts.
void CheckInit(AparfWifiRemoteStation *station)
Check for initializations.
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.
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...
hold a list of per-remote-station state.
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
uint8_t m_rateDec
Step size for decrement the rate.
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...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiModeList m_operationalRateSet
This member is the list of WifiMode objects that comprise the OperationalRateSet parameter for this r...
Hold per-remote-station state for APARF Wifi manager.
uint32_t m_failMax
The minimum number of failed transmissions to try a new power or rate.
uint8_t m_nSupported
Number of supported rates by the remote station.
uint8_t m_prevPowerLevel
Power level of the previous transmission.
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index...
void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
TracedCallback< DataRate, DataRate, Mac48Address > m_rateChange
The trace source fired when the transmission rate changes.
void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t m_succesMax1
The minimum number of successful transmissions in "High" state to try a new power or rate...
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
uint32_t m_powerMax
The maximum number of power changes.
bool IsLowLatency(void) const
uint8_t m_minPower
Minimal power level.
bool GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint32_t m_pCount
Number of power changes.
void SetHtSupported(bool enable)
Enable or disable HT capability support.
uint8_t GetDefaultTxPowerLevel(void) const
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.
uint8_t m_prevRateIndex
Rate index of the previous transmission.
hold per-remote-station state.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
virtual ~AparfWifiManager()
void SetVhtSupported(bool enable)
Enable or disable VHT capability support.
uint8_t m_rateIndex
Current rate index.