A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::MinstrelWifiManager Class Reference

Implementation of Minstrel Rate Control AlgorithmPorting Minstrel from Madwifi and Linux Kernel http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel. More...

#include <minstrel-wifi-manager.h>

+ Inheritance diagram for ns3::MinstrelWifiManager:

Public Member Functions

int64_t AssignStreams (int64_t stream)
 
virtual void SetupPhy (Ptr< WifiPhy > phy)
 
- Public Member Functions inherited from ns3::WifiRemoteStationManager
void AddBasicMode (WifiMode mode)
 
void AddSupportedMode (Mac48Address address, WifiMode mode)
 
WifiMode GetAckMode (Mac48Address address, WifiMode dataMode)
 
WifiMode GetBasicMode (uint32_t i) const
 
WifiMode GetCtsMode (Mac48Address address, WifiMode rtsMode)
 
WifiMode GetDataMode (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fullPacketSize)
 
WifiMode GetDefaultMode (void) const
 
uint32_t GetFragmentationThreshold (void) const
 
uint32_t GetFragmentOffset (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
 
uint32_t GetFragmentSize (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
 
WifiRemoteStationInfo GetInfo (Mac48Address address)
 
uint32_t GetMaxSlrc (void) const
 
uint32_t GetMaxSsrc (void) const
 
uint32_t GetNBasicModes (void) const
 
WifiMode GetNonUnicastMode (void) const
 
uint32_t GetRtsCtsThreshold (void) const
 
WifiMode GetRtsMode (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
 
bool IsAssociated (Mac48Address address) const
 
bool IsBrandNew (Mac48Address address) const
 
bool IsLastFragment (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fragmentNumber)
 
bool IsWaitAssocTxOk (Mac48Address address) const
 
bool NeedDataRetransmission (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
 
bool NeedFragmentation (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
 
bool NeedRts (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
 
bool NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet)
 
void PrepareForQueue (Mac48Address address, const WifiMacHeader *header, Ptr< const Packet > packet, uint32_t fullPacketSize)
 
void RecordDisassociated (Mac48Address address)
 
void RecordGotAssocTxFailed (Mac48Address address)
 
void RecordGotAssocTxOk (Mac48Address address)
 
void RecordWaitAssocTxOk (Mac48Address address)
 
void ReportDataFailed (Mac48Address address, const WifiMacHeader *header)
 
void ReportDataOk (Mac48Address address, const WifiMacHeader *header, double ackSnr, WifiMode ackMode, double dataSnr)
 
void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header)
 
void ReportFinalRtsFailed (Mac48Address address, const WifiMacHeader *header)
 
void ReportRtsFailed (Mac48Address address, const WifiMacHeader *header)
 
void ReportRtsOk (Mac48Address address, const WifiMacHeader *header, double ctsSnr, WifiMode ctsMode, double rtsSnr)
 
void ReportRxOk (Mac48Address address, const WifiMacHeader *header, double rxSnr, WifiMode txMode)
 
void Reset (void)
 
void Reset (Mac48Address address)
 
void SetFragmentationThreshold (uint32_t threshold)
 
void SetMaxSlrc (uint32_t maxSlrc)
 
void SetMaxSsrc (uint32_t maxSsrc)
 
void SetRtsCtsThreshold (uint32_t threshold)
 
- Public Member Functions inherited from ns3::Object
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount (const SimpleRefCount &o)
 
uint32_t GetReferenceCount (void) const
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 
void Ref (void) const
 
void Unref (void) const
 
- Public Member Functions inherited from ns3::ObjectBase
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::WifiRemoteStationManager
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 

Private Types

typedef std::vector< std::pair
< Time, WifiMode > > 
TxTime
 

Private Member Functions

void AddCalcTxTime (WifiMode mode, Time t)
 
void CheckInit (MinstrelWifiRemoteStation *station)
 check for initializations
 
virtual WifiRemoteStationDoCreateStation (void) const
 
virtual WifiMode DoGetDataMode (WifiRemoteStation *station, uint32_t size)
 
virtual WifiMode DoGetRtsMode (WifiRemoteStation *station)
 
virtual void DoReportDataFailed (WifiRemoteStation *station)
 
virtual void DoReportDataOk (WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr)
 
virtual void DoReportFinalDataFailed (WifiRemoteStation *station)
 
virtual void DoReportFinalRtsFailed (WifiRemoteStation *station)
 
virtual void DoReportRtsFailed (WifiRemoteStation *station)
 
virtual void DoReportRtsOk (WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr)
 
virtual void DoReportRxOk (WifiRemoteStation *station, double rxSnr, WifiMode txMode)
 
uint32_t FindRate (MinstrelWifiRemoteStation *station)
 find a rate to use from Minstrel Table More...
 
Time GetCalcTxTime (WifiMode mode) const
 for estimating the TxTime of a packet with a given mode
 
uint32_t GetNextSample (MinstrelWifiRemoteStation *station)
 getting the next sample from Sample Table More...
 
void InitSampleTable (MinstrelWifiRemoteStation *station)
 initialize Sample Table More...
 
virtual bool IsLowLatency (void) const
 
void PrintSampleTable (MinstrelWifiRemoteStation *station)
 printing Sample Table
 
void PrintTable (MinstrelWifiRemoteStation *station)
 printing Minstrel Table
 
void RateInit (MinstrelWifiRemoteStation *station)
 initialize Minstrel Table
 
void UpdateRetry (MinstrelWifiRemoteStation *station)
 update the number of retries and reset accordingly
 
void UpdateStats (MinstrelWifiRemoteStation *station)
 updating the Minstrel Table every 1/10 seconds More...
 

Private Attributes

TxTime m_calcTxTime
 to hold all the calculated TxTime for all modes
 
double m_ewmaLevel
 exponential weighted moving average
 
double m_lookAroundRate
 the % to try other rates than our current rate
 
MinstrelRate m_minstrelTable
 minstrel table
 
uint32_t m_nsupported
 modes supported
 
uint32_t m_pktLen
 packet length used for calculate mode TxTime
 
uint32_t m_sampleCol
 number of sample columns
 
SampleRate m_sampleTable
 sample table
 
uint32_t m_segmentSize
 largest allowable segment size
 
Ptr< UniformRandomVariablem_uniformRandomVariable
 Provides uniform random variables.
 
Time m_updateStats
 how frequent do we calculate the stats(1/10 seconds)
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::WifiRemoteStationManager
virtual void DoDispose (void)
 
uint32_t GetNSupported (const WifiRemoteStation *station) const
 
WifiMode GetSupported (const WifiRemoteStation *station, uint32_t i) const
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void DoInitialize (void)
 
virtual void NotifyNewAggregate (void)
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 

Detailed Description

Implementation of Minstrel Rate Control Algorithm

Porting Minstrel from Madwifi and Linux Kernel http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/minstrel.

Author
Duy Nguyen

Config Paths

ns3::MinstrelWifiManager is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3::WifiNetDevice/RemoteStationManager/$ns3::MinstrelWifiManager

Attributes

  • UpdateStatistics: The interval between updating statistics table
    • Set with class: TimeValue
    • Underlying type: Time
    • Initial value: +100000000.0ns
    • Flags: construct write read
  • LookAroundRate: the percentage to try other rates
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 10
    • Flags: construct write read
  • EWMA: EWMA level
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 75
    • Flags: construct write read
  • SegmentSize: The largest allowable segment size packet
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 6000
    • Flags: construct write read
  • SampleColumn: The number of columns used for sampling
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 10
    • Flags: construct write read
  • PacketLength: The packet length used for calculating mode TxTime
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1200
    • Flags: construct write read

Attributes defined in parent class ns3::WifiRemoteStationManager

  • IsLowLatency: If true, we attempt to modelize a so-called low-latency device: a device where decisions about tx parameters can be made on a per-packet basis and feedback about the transmission of each packet is obtained before sending the next. Otherwise, we modelize a high-latency device, that is a device where we cannot update our decision about tx parameters after every packet transmission.
  • MaxSsrc: The maximum number of retransmission attempts for an RTS. This value will not have any effect on some rate control algorithms.
  • MaxSlrc: The maximum number of retransmission attempts for a DATA packet. This value will not have any effect on some rate control algorithms.
  • RtsCtsThreshold: If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2007, Section 9.2.6. This value will not have any effect on some rate control algorithms.
  • FragmentationThreshold: If the size of the data packet + LLC header + MAC header + FCS trailer is biggerthan this value, we fragment it such that the size of the fragments are equal or smaller than this value, as per IEEE Std. 802.11-2007, Section 9.4. This value will not have any effect on some rate control algorithms.
  • NonUnicastMode: Wifi mode used for non-unicast transmissions.
    • Set with class: WifiModeValue
    • Underlying type: WifiMode
    • Initial value: Invalid-WifiMode
    • Flags: construct write read

No TraceSources are defined for this type.

TraceSources defined in parent class ns3::WifiRemoteStationManager

  • MacTxRtsFailed: The transmission of a RTS by the MAC layer has failed
  • MacTxDataFailed: The transmission of a data packet by the MAC layer has failed
  • MacTxFinalRtsFailed: The transmission of a RTS has exceeded the maximum number of attempts
  • MacTxFinalDataFailed: The transmission of a data packet has exceeded the maximum number of attempts

Definition at line 87 of file minstrel-wifi-manager.h.

Member Function Documentation

int64_t ns3::MinstrelWifiManager::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model. Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 145 of file minstrel-wifi-manager.cc.

References m_uniformRandomVariable, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

WifiMode ns3::MinstrelWifiManager::DoGetDataMode ( WifiRemoteStation station,
uint32_t  size 
)
privatevirtual
Parameters
stationthe station with which we need to communicate
sizesize of the packet or fragment we want to send
Returns
the transmission mode to use to send a packet to the station

Note: This method is called before sending a unicast packet or a fragment of a unicast packet to decide which transmission mode to use.

start the rate at half way

Implements ns3::WifiRemoteStationManager.

Definition at line 439 of file minstrel-wifi-manager.cc.

References CheckInit(), ns3::MinstrelWifiRemoteStation::m_initialized, m_nsupported, ns3::MinstrelWifiRemoteStation::m_txrate, and UpdateStats().

WifiMode ns3::MinstrelWifiManager::DoGetRtsMode ( WifiRemoteStation station)
privatevirtual
Parameters
stationthe station with which we need to communicate
Returns
the transmission mode to use to send an rts to the station

Note: This method is called before sending an rts to a station to decide which transmission mode to use for the rts.

Implements ns3::WifiRemoteStationManager.

Definition at line 455 of file minstrel-wifi-manager.cc.

References ns3::MinstrelWifiRemoteStation::m_txrate, and NS_LOG_DEBUG.

void ns3::MinstrelWifiManager::DoReportDataFailed ( WifiRemoteStation station)
privatevirtual

Retry Chain table is implemented here

Try | LOOKAROUND RATE | NORMAL RATE

| random < best | random > best |

1 | Best throughput | Random rate | Best throughput 2 | Random rate | Best throughput | Next best throughput 3 | Best probability | Best probability | Best probability 4 | Lowest Baserate | Lowest baserate | Lowest baserate

Note: For clarity, multiple blocks of if's and else's are used After a failing 7 times, DoReportFinalDataFailed will be called

for normal rate, we're not currently sampling random rates

use best throughput rate

< there's still a few retries left

use second best throughput rate

use best probability rate

use lowest base rate

for look-around rate, we're currently sampling random rates

current sampling rate is slower than the current best rate

use best throughput rate

< there are a few retries left

use random rate

use max probability rate

use lowest base rate

current sampling rate is better than current best rate

use random rate

< keep using it

use the best rate

use the best probability rate

use the lowest base rate

Implements ns3::WifiRemoteStationManager.

Definition at line 248 of file minstrel-wifi-manager.cc.

References CheckInit(), ns3::MinstrelWifiRemoteStation::m_initialized, ns3::MinstrelWifiRemoteStation::m_isSampling, ns3::MinstrelWifiRemoteStation::m_longRetry, ns3::MinstrelWifiRemoteStation::m_maxProbRate, ns3::MinstrelWifiRemoteStation::m_maxTpRate, ns3::MinstrelWifiRemoteStation::m_maxTpRate2, m_minstrelTable, ns3::MinstrelWifiRemoteStation::m_sampleRate, ns3::MinstrelWifiRemoteStation::m_sampleRateSlower, ns3::MinstrelWifiRemoteStation::m_txrate, and NS_LOG_DEBUG.

uint32_t ns3::MinstrelWifiManager::FindRate ( MinstrelWifiRemoteStation station)
private

find a rate to use from Minstrel Table

for determining when to try a sample rate

if we are below the target of look around rate percentage, look around note: do it randomly by flipping a coin instead sampling all at once until it reaches the look around rate

now go through the table and find an index rate

This if condition is used to make sure that we don't need to use the sample rate it is the same as our current rate

start sample count

set flag that we are currently sampling

bookeeping for resetting stuff

error check

set the rate that we're currently sampling

is this rate slower than the current best rate

using the best rate instead

continue using the best rate

Definition at line 489 of file minstrel-wifi-manager.cc.

References ns3::UniformRandomVariable::GetInteger(), GetNextSample(), ns3::MinstrelWifiRemoteStation::m_isSampling, m_lookAroundRate, ns3::MinstrelWifiRemoteStation::m_maxTpRate, ns3::MinstrelWifiRemoteStation::m_maxTpRate2, m_minstrelTable, m_nsupported, ns3::MinstrelWifiRemoteStation::m_packetCount, ns3::MinstrelWifiRemoteStation::m_sampleCount, ns3::MinstrelWifiRemoteStation::m_sampleRate, ns3::MinstrelWifiRemoteStation::m_sampleRateSlower, ns3::MinstrelWifiRemoteStation::m_txrate, m_uniformRandomVariable, and NS_LOG_DEBUG.

uint32_t ns3::MinstrelWifiManager::GetNextSample ( MinstrelWifiRemoteStation station)
private

getting the next sample from Sample Table

bookeeping for m_index and m_col variables

Definition at line 469 of file minstrel-wifi-manager.cc.

References ns3::MinstrelWifiRemoteStation::m_col, m_nsupported, m_sampleCol, and m_sampleTable.

Referenced by FindRate().

void ns3::MinstrelWifiManager::InitSampleTable ( MinstrelWifiRemoteStation station)
private

initialize Sample Table

for off-seting to make rates fall between 0 and numrates

The next two lines basically tries to generate a random number between 0 and the number of available rates

this loop is used for filling in other uninitilized places

Definition at line 739 of file minstrel-wifi-manager.cc.

References ns3::UniformRandomVariable::GetInteger(), ns3::MinstrelWifiRemoteStation::m_col, m_nsupported, m_sampleCol, m_sampleTable, m_uniformRandomVariable, and NS_LOG_DEBUG.

Referenced by CheckInit().

bool ns3::MinstrelWifiManager::IsLowLatency ( void  ) const
privatevirtual
Returns
whether this manager is a manager designed to work in low-latency environments.

Note: In this context, low vs high latency is defined in IEEE 802.11 Rate Adaptation: A Practical Approach, by M. Lacage, M.H. Manshaei, and T. Turletti.

Implements ns3::WifiRemoteStationManager.

Definition at line 464 of file minstrel-wifi-manager.cc.

void ns3::MinstrelWifiManager::UpdateStats ( MinstrelWifiRemoteStation station)
private

updating the Minstrel Table every 1/10 seconds

calculate the perfect tx time for this rate

just for initialization

if we've attempted something

calculate the probability of success assume probability scales from 0 to 18000

bookeeping

ewma probability (cast for gcc 3.4 compatibility)

calculating throughput

bookeeping

Sample less often below 10% and above 95% of success

retry count denotes the number of retries permitted for each rate

retry_count/2

if it's 0 allow one retry limit

go find max throughput, second maximum throughput, high probability succ

find the second highest max

reset it

Definition at line 577 of file minstrel-wifi-manager.cc.

References ns3::Time::GetMicroSeconds(), ns3::MinstrelWifiRemoteStation::m_currentRate, m_ewmaLevel, ns3::MinstrelWifiRemoteStation::m_initialized, ns3::MinstrelWifiRemoteStation::m_maxProbRate, ns3::MinstrelWifiRemoteStation::m_maxTpRate, ns3::MinstrelWifiRemoteStation::m_maxTpRate2, m_minstrelTable, ns3::MinstrelWifiRemoteStation::m_nextStatsUpdate, m_nsupported, ns3::MinstrelWifiRemoteStation::m_txrate, m_updateStats, ns3::Simulator::Now(), NS_LOG_DEBUG, RateInit(), and ns3::Seconds().

Referenced by DoGetDataMode().


The documentation for this class was generated from the following files: