22 #include "ns3/uinteger.h" 23 #include "ns3/data-rate.h" 27 #define Min(a,b) ((a < b) ? a : b) 62 .SetGroupName (
"Wifi")
64 .AddAttribute (
"AttemptThreshold",
65 "The minimum number of transmission attempts to try a new power or rate.",
68 MakeUintegerChecker<uint32_t> ())
69 .AddAttribute (
"SuccessThreshold",
70 "The minimum number of successful transmissions to try a new power or rate.",
73 MakeUintegerChecker<uint32_t> ())
74 .AddTraceSource (
"PowerChange",
75 "The transmission power has change",
77 "ns3::WifiRemoteStationManager::PowerChangeTracedCallback")
78 .AddTraceSource (
"RateChange",
79 "The transmission rate has change",
81 "ns3::WifiRemoteStationManager::RateChangeTracedCallback")
111 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HT rates");
115 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support VHT rates");
119 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HE rates");
224 if (((station->
m_nRetry - 1) % 2) == 1)
256 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
262 double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
264 NS_LOG_FUNCTION (
this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
316 if (channelWidth > 20 && channelWidth != 22)
336 return WifiTxVector (mode, station->
m_powerLevel,
GetPreambleForTransmission (mode.
GetModulationClass (),
GetShortPreambleEnabled (),
UseGreenfieldForDestination (
GetAddress (station))), 800, 1, 1, 0, channelWidth,
GetAggregation (station));
347 if (channelWidth > 20 && channelWidth != 22)
361 rtsTxVector =
WifiTxVector (mode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (mode.
GetModulationClass (),
GetShortPreambleEnabled (),
UseGreenfieldForDestination (
GetAddress (station))), 800, 1, 1, 0, channelWidth,
GetAggregation (station));
uint8_t m_powerLevel
Current power level used by the remote station.
bool GetVhtSupported(void) const
Return whether the device has VHT capability support enabled.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
Hold per-remote-station state for PARF Wifi manager.
uint8_t m_maxPower
Maximal power level.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
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.
bool GetHeSupported(void) const
Return whether the device has HE capability support enabled.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
void CheckInit(ParfWifiRemoteStation *station)
Check for initializations.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_nAttempt
Number of transmission attempts.
Mac48Address m_address
Mac48Address of the remote station.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
TracedCallback< double, double, Mac48Address > m_powerChange
The trace source fired when the transmission power changes.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble, bool useGreenfield)
Return the preamble to be used for the transmission.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index. ...
uint8_t m_nSupported
Number of supported rates by the remote station.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
virtual ~ParfWifiManager()
void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
WifiRemoteStationState * m_state
Remote station state.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Class for representing data rates.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
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.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t m_successThreshold
The minimum number of successful transmissions to try a new power or rate.
Hold an unsigned integer type.
uint8_t m_rateIndex
Current rate index used by the remote station.
void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
bool GetHtSupported(void) const
Return whether the device has HT capability support enabled.
void DoInitialize(void)
Initialize() implementation.
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.
WifiModulationClass GetModulationClass() const
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool m_initialized
For initializing variables.
WifiModeList m_operationalRateSet
This member is the list of WifiMode objects that comprise the OperationalRateSet parameter for this r...
PARF Rate control algorithm.
uint8_t m_minPower
Minimal power level.
bool UseGreenfieldForDestination(Mac48Address dest) const
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...
uint32_t m_nRetry
Number of transmission retries.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
uint8_t m_prevRateIndex
Rate index of the previous transmission.
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
WifiRemoteStation * DoCreateStation(void) const
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...
static TypeId GetTypeId(void)
Register this type.
bool GetUseNonErpProtection(void) const
Return whether the device supports protection of non-ERP stations.
uint32_t m_nFail
Number of failed transmission attempts.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint8_t GetDefaultTxPowerLevel(void) const
uint32_t m_nSuccess
Number of successful transmission attempts.
bool m_usingRecoveryRate
If using recovery rate.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
bool m_usingRecoveryPower
If using recovery power.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
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.
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
hold per-remote-station state.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
uint32_t m_attemptThreshold
The minimum number of transmission attempts to try a new power or rate.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
uint8_t m_prevPowerLevel
Power level of the previous transmission.