38 #include "ns3/simulator.h"
40 #include "ns3/double.h"
41 #include "ns3/boolean.h"
46 #define Min(a,b) ((a < b) ? a : b)
47 #define Max(a,b) ((a > b) ? a : b)
78 static TypeId tid =
TypeId (
"ns3::MinstrelHtWifiManager")
80 .AddConstructor<MinstrelHtWifiManager> ()
81 .SetGroupName (
"Wifi")
82 .AddAttribute (
"UpdateStatistics",
83 "The interval between updating statistics table ",
87 .AddAttribute (
"LookAroundRate",
88 "The percentage to try other rates (for legacy Minstrel)",
91 MakeDoubleChecker<double> (0, 100))
92 .AddAttribute (
"EWMA",
96 MakeDoubleChecker<double> (0, 100))
97 .AddAttribute (
"SampleColumn",
98 "The number of columns used for sampling",
101 MakeUintegerChecker <uint32_t> ())
102 .AddAttribute (
"PacketLength",
103 "The packet length used for calculating mode TxTime",
106 MakeUintegerChecker <uint32_t> ())
107 .AddAttribute (
"UseVhtOnly",
108 "Use only VHT MCSs (and not HT) when VHT is available",
112 .AddAttribute (
"PrintStats",
113 "Control the printing of the statistics table",
117 .AddTraceSource (
"RateChange",
118 "The transmission rate has changed",
120 "ns3::MinstrelHtWifiManager::RateChangeTracedCallback")
155 int64_t numStreamsAssigned = 0;
157 numStreamsAssigned++;
159 return numStreamsAssigned;
208 for (uint8_t chWidth = 20; chWidth <=
MAX_HT_WIDTH; chWidth *= 2)
234 WifiMode mode = htMcsList[deviceIndex];
238 NS_LOG_DEBUG (
"Initialized group " << groupId <<
": (" << +streams <<
"," << +sgi <<
"," << +chWidth <<
")");
247 for (uint16_t chWidth = 20; chWidth <=
MAX_VHT_WIDTH; chWidth *= 2)
280 NS_LOG_DEBUG (
"Initialized group " << groupId <<
": (" << +streams <<
"," << +sgi <<
"," << +chWidth <<
")");
302 txvector.
SetNss (streams);
313 txvector.
SetNss (streams);
328 txvector.
SetNss (streams);
342 for (TxTime::const_iterator i =
m_minstrelGroups[groupId].ratesFirstMpduTxTimeTable.begin (); i !=
m_minstrelGroups[groupId].ratesFirstMpduTxTimeTable.end (); i++)
344 if (mode == i->second)
357 m_minstrelGroups[groupId].ratesFirstMpduTxTimeTable.push_back (std::make_pair (t, mode));
366 if (mode == i->second)
379 m_minstrelGroups[groupId].ratesTxTimeTable.push_back (std::make_pair (t, mode));
471 std::ostringstream tmp;
473 station->
m_statsFile.open (tmp.str ().c_str (), std::ios::out);
542 station->
m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt++;
582 station->
m_groupsTable[groupId].m_ratesTable[rateId].numRateSuccess++;
583 station->
m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt++;
657 NS_LOG_FUNCTION (
this << st << +nSuccessfulMpdus << +nFailedMpdus << rxSnr << dataSnr);
668 NS_ASSERT_MSG (
false,
"A-MPDU Tx Status called but no HT or VHT supported.");
672 +nSuccessfulMpdus <<
" FailedMpdus= " << +nFailedMpdus);
675 station->
m_ampduLen += nSuccessfulMpdus + nFailedMpdus;
681 station->
m_groupsTable[groupId].m_ratesTable[rateId].numRateSuccess += nSuccessfulMpdus;
682 station->
m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt += nSuccessfulMpdus + nFailedMpdus;
763 station->
m_groupsTable[maxTp2GroupId].m_ratesTable[maxTp2RateId].retryCount))
771 station->
m_groupsTable[maxTp2GroupId].m_ratesTable[maxTp2RateId].retryCount +
772 station->
m_groupsTable[maxProbGroupId].m_ratesTable[maxProbRateId].retryCount))
779 NS_ASSERT_MSG (
false,
"Max retries reached and m_longRetry not cleared properly. longRetry= " << station->
m_longRetry);
796 station->
m_groupsTable[maxProbGroupId].m_ratesTable[maxProbRateId].retryCount)
803 NS_ASSERT_MSG (
false,
"Max retries reached and m_longRetry not cleared properly. longRetry= " << station->
m_longRetry);
820 NS_LOG_FUNCTION (
this << station << +nSuccessfulMpdus << +nFailedMpdus);
870 uint32_t mcsIndex = station->
m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex;
880 "," << +group.
sgi <<
"," << +group.
chWidth <<
")" <<
891 return WifiTxVector (mode,
GetDefaultTxPowerLevel (),
GetPreambleForTransmission (mode,
GetAddress (station)), group.
sgi ? 400 : 800,
GetNumberOfAntennas (), group.
streams,
GetNess (station),
GetChannelWidthForTransmission (mode, group.
chWidth),
GetAggregation (station) && !station->
m_isSampling,
false);
930 uint32_t mcsIndex = station->
m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex;
937 bool rateFound =
false;
939 for (uint8_t i = 0; i < nBasicRates; i++)
942 if (rate <= lastDataRate)
952 uint8_t nSupportRates = phy->
GetNModes ();
953 for (uint8_t i = 0; i < nSupportRates; i++)
956 if (rate <= lastDataRate)
997 NS_LOG_DEBUG (
"No re-transmission allowed. Retries: " << station->
m_longRetry <<
" Max retries: " << maxRetries);
1019 return station->
m_groupsTable[maxTpGroupId].m_ratesTable[maxTpRateId].retryCount +
1020 station->
m_groupsTable[maxTp2GroupId].m_ratesTable[maxTp2RateId].retryCount +
1021 station->
m_groupsTable[maxProbGroupId].m_ratesTable[maxProbRateId].retryCount;
1025 return 1 + station->
m_groupsTable[maxTpGroupId].m_ratesTable[maxTp2RateId].retryCount +
1026 station->
m_groupsTable[maxProbGroupId].m_ratesTable[maxProbRateId].retryCount;
1043 uint32_t index = station->
m_groupsTable[sampleGroup].m_index;
1048 uint32_t rateIndex =
GetIndex (sampleGroup, sampleIndex);
1108 uint32_t sampleGroupId =
GetGroupId (sampleIdx);
1109 uint32_t sampleRateId =
GetRateId (sampleIdx);
1112 if (station->
m_groupsTable[sampleGroupId].m_supported && station->
m_groupsTable[sampleGroupId].m_ratesTable[sampleRateId].supported)
1124 " SampleRate= " << sampleIdx <<
" SampleProb= " << sampleRateInfo.
ewmaProb);
1145 Time maxTp2Duration = station->
m_groupsTable[maxTp2GroupId].m_ratesTable[maxTp2RateId].perfectTxTime;
1146 Time maxProbDuration = station->
m_groupsTable[maxProbGroupId].m_ratesTable[maxProbRateId].perfectTxTime;
1148 NS_LOG_DEBUG (
"Use sample rate? SampleDuration= " << sampleDuration <<
" maxTp2Duration= " << maxTp2Duration <<
1149 " maxProbDuration= " << maxProbDuration <<
" sampleStreams= " << +sampleStreams <<
1150 " maxTpStreams= " << +maxTpStreams);
1151 if (sampleDuration < maxTp2Duration || (sampleStreams < maxTpStreams && sampleDuration < maxProbDuration))
1159 NS_LOG_DEBUG (
"FindRate " <<
"sampleRate=" << sampleIdx);
1174 NS_LOG_DEBUG (
"FindRate " <<
"sampleRate=" << sampleIdx);
1233 station->
m_groupsTable[j].m_ratesTable[i].retryUpdated =
false;
1236 "\t attempt=" << station->
m_groupsTable[j].m_ratesTable[i].numRateAttempt <<
1237 "\t success=" << station->
m_groupsTable[j].m_ratesTable[i].numRateSuccess);
1240 if (station->
m_groupsTable[j].m_ratesTable[i].numRateAttempt > 0)
1242 station->
m_groupsTable[j].m_ratesTable[i].numSamplesSkipped = 0;
1247 tempProb = (100 * station->
m_groupsTable[j].m_ratesTable[i].numRateSuccess) / station->
m_groupsTable[j].m_ratesTable[i].numRateAttempt;
1254 station->
m_groupsTable[j].m_ratesTable[i].ewmaProb = tempProb;
1259 tempProb, station->
m_groupsTable[j].m_ratesTable[i].ewmaProb,
1263 station->
m_groupsTable[j].m_ratesTable[i].ewmaProb = tempProb;
1273 station->
m_groupsTable[j].m_ratesTable[i].numSamplesSkipped++;
1279 station->
m_groupsTable[j].m_ratesTable[i].numRateSuccess = 0;
1280 station->
m_groupsTable[j].m_ratesTable[i].numRateAttempt = 0;
1282 if (station->
m_groupsTable[j].m_ratesTable[i].throughput != 0)
1326 Time txTime = station->
m_groupsTable[groupId].m_ratesTable[rateId].perfectTxTime;
1343 uint32_t tmpGroupId, tmpRateId;
1344 double tmpTh, tmpProb;
1345 uint32_t groupId, rateId;
1348 uint32_t maxGPGroupId, maxGPRateId;
1358 tmpProb = station->
m_groupsTable[tmpGroupId].m_ratesTable[tmpRateId].ewmaProb;
1359 tmpTh = station->
m_groupsTable[tmpGroupId].m_ratesTable[tmpRateId].throughput;
1363 currentTh = station->
m_groupsTable[groupId].m_ratesTable[rateId].throughput;
1364 if (currentTh > tmpTh)
1371 maxGPTh = station->
m_groupsTable[maxGPGroupId].m_ratesTable[maxGPRateId].throughput;
1373 if (currentTh > maxGPTh)
1402 uint32_t groupId, rateId;
1404 uint32_t maxTpGroupId, maxTpRateId;
1405 uint32_t maxTp2GroupId, maxTp2RateId;
1406 double maxTpTh, maxTpProb;
1407 double maxTp2Th, maxTp2Prob;
1411 prob = station->
m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb;
1412 th = station->
m_groupsTable[groupId].m_ratesTable[rateId].throughput;
1416 maxTpProb = station->
m_groupsTable[maxTpGroupId].m_ratesTable[maxTpRateId].ewmaProb;
1417 maxTpTh = station->
m_groupsTable[maxTpGroupId].m_ratesTable[maxTpRateId].throughput;
1421 maxTp2Prob = station->
m_groupsTable[maxTp2GroupId].m_ratesTable[maxTp2RateId].ewmaProb;
1422 maxTp2Th = station->
m_groupsTable[maxTp2GroupId].m_ratesTable[maxTp2RateId].throughput;
1424 if (th > maxTpTh || (th == maxTpTh && prob > maxTpProb))
1429 else if (th > maxTp2Th || (th == maxTp2Th && prob > maxTp2Prob))
1440 maxTpTh = station->
m_groupsTable[maxTpGroupId].m_ratesTable[maxTpRateId].throughput;
1444 maxTp2Prob = group->
m_ratesTable[maxTp2RateId].ewmaProb;
1445 maxTp2Th = station->
m_groupsTable[maxTp2GroupId].m_ratesTable[maxTp2RateId].throughput;
1447 if (th > maxTpTh || (th == maxTpTh && prob > maxTpProb))
1452 else if (th > maxTp2Th || (th == maxTp2Th && prob > maxTp2Prob))
1469 for (uint8_t groupId = 0; groupId <
m_numGroups; groupId++)
1490 station->
m_groupsTable[groupId].m_ratesTable[i].supported =
false;
1494 for (uint8_t i = 0; i < station->
m_nModes; i++)
1514 station->
m_groupsTable[groupId].m_ratesTable[rateId].supported =
true;
1515 station->
m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex = i;
1516 station->
m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt = 0;
1517 station->
m_groupsTable[groupId].m_ratesTable[rateId].numRateSuccess = 0;
1518 station->
m_groupsTable[groupId].m_ratesTable[rateId].prob = 0;
1519 station->
m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb = 0;
1520 station->
m_groupsTable[groupId].m_ratesTable[rateId].prevNumRateAttempt = 0;
1521 station->
m_groupsTable[groupId].m_ratesTable[rateId].prevNumRateSuccess = 0;
1522 station->
m_groupsTable[groupId].m_ratesTable[rateId].numSamplesSkipped = 0;
1523 station->
m_groupsTable[groupId].m_ratesTable[rateId].successHist = 0;
1524 station->
m_groupsTable[groupId].m_ratesTable[rateId].attemptHist = 0;
1525 station->
m_groupsTable[groupId].m_ratesTable[rateId].throughput = 0;
1527 station->
m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 0;
1528 station->
m_groupsTable[groupId].m_ratesTable[rateId].adjustedRetryCount = 0;
1546 if (!station->
m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated)
1559 uint32_t cwMax = 1023;
1560 Time cwTime, txTime, dataTxTime;
1562 Time ackTime =
GetMac ()->GetBasicBlockAckTimeout ();
1564 if (station->
m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb < 1)
1566 station->
m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 1;
1570 station->
m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 2;
1571 station->
m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated =
true;
1577 cwTime = (cw / 2) * slotTime;
1578 cw =
Min ((cw + 1) * 2, cwMax);
1579 cwTime += (cw / 2) * slotTime;
1580 cw =
Min ((cw + 1) * 2, cwMax);
1583 txTime = cwTime + 2 * (dataTxTime + ackTime);
1589 cwTime = (cw / 2) * slotTime;
1590 cw =
Min ((cw + 1) * 2, cwMax);
1593 txTime += cwTime + ackTime + dataTxTime;
1596 && (++station->
m_groupsTable[groupId].m_ratesTable[rateId].retryCount < 7));
1603 double diff, incr, tmp;
1606 diff = currentProb - ewmaProb;
1607 incr = (100 - weight) * diff / 100;
1608 tmp = oldEwmsd * oldEwmsd;
1609 tmp = weight * (tmp + diff * incr) / 100;
1628 for (uint32_t i = 0; i < numSampleRates; i++ )
1635 newIndex = (i + uv) % numSampleRates;
1653 station->
m_statsFile <<
" best ____________rate__________ ________statistics________ ________last_______ ______sum-of________\n" <<
1654 " mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n";
1682 for (uint8_t i = 0; i < numRates; i++)
1688 of <<
"HT" << group.
chWidth <<
" " << giMode <<
"GI " << (int)group.
streams <<
" ";
1692 of <<
"VHT" << group.
chWidth <<
" " << giMode <<
"GI " << (int)group.
streams <<
" ";
1699 uint32_t idx =
GetIndex (groupId, i);
1700 if (idx == maxTpRate)
1708 if (idx == maxTpRate2)
1716 if (idx == maxProbRate)
1727 of << std::setw (4) <<
" MCS" << (group.
streams - 1) * 8 + i;
1731 of << std::setw (7) <<
" MCS" << i <<
"/" << (int) group.
streams;
1734 of <<
" " << std::setw (3) << idx <<
" ";
1741 std::setw (7) << station->
m_groupsTable[groupId].m_ratesTable[i].throughput / 100 <<
" " <<
1742 std::setw (7) << station->
m_groupsTable[groupId].m_ratesTable[i].ewmaProb <<
" " <<
1743 std::setw (7) << station->
m_groupsTable[groupId].m_ratesTable[i].ewmsdProb <<
" " <<
1744 std::setw (7) << station->
m_groupsTable[groupId].m_ratesTable[i].prob <<
" " <<
1745 std::setw (2) << station->
m_groupsTable[groupId].m_ratesTable[i].retryCount <<
" " <<
1746 std::setw (3) << station->
m_groupsTable[groupId].m_ratesTable[i].prevNumRateSuccess <<
" " <<
1747 std::setw (3) << station->
m_groupsTable[groupId].m_ratesTable[i].prevNumRateAttempt <<
" " <<
1748 std::setw (9) << station->
m_groupsTable[groupId].m_ratesTable[i].successHist <<
" " <<
1749 std::setw (9) << station->
m_groupsTable[groupId].m_ratesTable[i].attemptHist <<
"\n";
1797 uint32_t groupId = 0;
1798 uint32_t rateId = 0;
1799 while (groupId < m_numGroups && !station->m_groupsTable[groupId].m_supported)
1803 while (rateId < m_numRates && !station->m_groupsTable[groupId].m_ratesTable[rateId].supported)
1816 uint32_t rateId = 0;
1817 while (rateId < m_numRates && !station->m_groupsTable[groupId].m_ratesTable[rateId].supported)
1830 for (uint8_t i = 0; i < phy->
GetNMcs (); i++)
1835 vhtMcsList.push_back (mode);
1846 for (uint8_t i = 0; i < phy->
GetNMcs (); i++)
1851 htMcsList.push_back (mode);
1863 NS_FATAL_ERROR (
"WifiRemoteStationManager selected does not support HE rates");
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.
bool GetVhtSupported(Mac48Address address) const
Return whether the station supports VHT or not.
Simulation virtual time values and global simulation resolution.
bool GetShortGuardInterval(Mac48Address address) const
Return whether the station supports HT/VHT short guard interval.
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr)
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
A struct to contain information of a group.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
AttributeValue implementation for Boolean.
double CalculateThroughput(MinstrelHtWifiRemoteStation *station, uint32_t groupId, uint32_t rateId, double ewmaProb)
Return the average throughput of the MCS defined by groupId and rateId.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static const uint8_t MAX_SUPPORTED_STREAMS
Constants for maximum values.
uint8_t m_index
vector index
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
WifiModeList GetHtDeviceMcsList(void) const
Returns a list of only the HT MCS supported by the device.
void PrintTable(MinstrelHtWifiRemoteStation *station)
Printing Minstrel Table.
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...
void UpdatePacketCounters(MinstrelHtWifiRemoteStation *station, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus)
Update the number of sample count variables.
uint32_t GetLowestIndex(MinstrelHtWifiRemoteStation *station)
Returns the lowest global index of the rates supported by the station.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
uint32_t m_maxProbRate
The highest success probability rate of this group.
double CalculateEwmsd(double oldEwmsd, double currentProb, double ewmaProb, uint32_t weight)
Perform EWMSD (Exponentially Weighted Moving Standard Deviation) calculation.
MinstrelHtWifiRemoteStation structure.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
hold per-remote-station state for Minstrel Wifi manager.
uint32_t m_ampduPacketCount
Number of A-MPDUs transmitted.
uint32_t GetIndex(uint32_t groupId, uint32_t rateId)
Returns the global index corresponding to the groupId and rateId.
static const uint8_t MAX_VHT_STREAM_GROUPS
Maximal number of groups per stream in VHT (4 possible channel widths and 2 possible SGI configuratio...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_sampleRate
current sample rate
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint32_t m_maxTpRate
The max throughput rate of this group.
void SetStbc(bool stbc)
Sets if STBC is being used.
void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
Mac48Address m_address
Mac48Address of the remote station.
void StatsDump(MinstrelHtWifiRemoteStation *station, uint32_t index, std::ofstream &of)
Print group statistics.
HtMinstrelRate m_ratesTable
Information about rates of this group.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint8_t sgi
short guard interval (0 or 1)
uint32_t m_txrate
current transmit rate
uint32_t GetHtGroupId(uint8_t txstreams, uint8_t sgi, uint8_t chWidth)
Returns the groupId of a HT MCS with the given number of streams, if using sgi and the channel width ...
uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
bool DoNeedDataRetransmission(WifiRemoteStation *st, Ptr< const Packet > packet, bool normally)
MinstrelRate m_minstrelTable
minstrel table
uint32_t m_frameLength
Frame length used for calculate modes TxTime.
MinstrelMcsGroups m_minstrelGroups
Global array for groups information.
bool m_isHt
If the station is HT capable.
bool m_sampleDeferred
a flag to indicate sample rate is on the second stage
uint32_t m_maxTpRate2
The second max throughput rate of this group.
uint16_t GetFrequency(void) const
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetStbc(void) const
Return whether STBC is supported.
uint8_t m_nModes
number of modes supported
WifiRemoteStationState * m_state
Remote station state.
bool m_printStats
If statistics table should be printed.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Ptr< WifiPhy > GetPhy(void) const
Return the WifiPhy.
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, uint16_t frequency)
bool IsValid(void) const
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
uint8_t GetNBasicModes(void) const
Return the number of basic modes we support.
static uint8_t GetChannelWidthForTransmission(WifiMode mode, uint8_t maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY's default ...
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
void AddFirstMpduTxTime(uint32_t groupId, WifiMode mode, Time t)
Save a TxTime to the vector of groups.
virtual uint32_t GetInteger(void)=0
Get the next random value as an integer drawn from the distribution.
NS_ASSERT_MSG(false,"Ipv4AddressGenerator::MaskToIndex(): Impossible")
bool m_isSampling
a flag to indicate we are currently sampling
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
uint8_t GetNumberOfAntennas(void)
AttributeValue implementation for Time.
double m_ewmaLevel
Exponential weighted moving average level (or coefficient).
void CalculateRetransmits(MinstrelHtWifiRemoteStation *station, uint32_t index)
Calculate the number of retransmissions to set for the index rate.
SampleRate m_sampleTable
sample table
uint8_t m_col
To keep track of the current position in the our random sample table going row by row from 1st column...
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
Hold an unsigned integer type.
static const uint8_t MAX_VHT_GROUP_RATES
Number of rates (or MCS) per VHT group.
Time GetMpduTxTime(uint32_t groupId, WifiMode mode) const
Obtain the TXtime saved in the group information.
static const uint8_t MAX_HT_WIDTH
Maximal channel width.
bool IsValidMcs(Ptr< WifiPhy > phy, uint8_t streams, uint8_t chWidth, WifiMode mode)
Check the validity of a combination of number of streams, chWidth and mode.
virtual ~MinstrelHtWifiManager()
WifiPreamble GetPreambleForTransmission(WifiMode mode, Mac48Address dest)
Return the preamble to be used for the transmission.
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
uint8_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
static const uint8_t MAX_HT_STREAM_GROUPS
Maximal number of groups per stream in HT (2 possible channel widths and 2 possible SGI configuration...
WifiMode GetMode(uint8_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
uint8_t GetMcsValue(void) const
uint32_t GetRateId(uint32_t index)
For managing rates from different groups, a global index for all rates in all groups is used...
uint32_t m_sampleWait
How many transmission attempts to wait until a new sample.
Mac48Address GetAddress(const WifiRemoteStation *station) const
Return the address of the station.
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...
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
hold a list of per-remote-station state.
bool m_useVhtOnly
If only VHT MCS should be used, instead of HT and VHT.
std::vector< struct GroupInfo > McsGroupData
Data structure for a table of groups.
uint32_t m_longRetry
long retries such as data packets
static TypeId GetTypeId(void)
Get the type ID.
static const uint8_t MAX_VHT_WIDTH
Maximal channel width.
uint32_t GetNess(const WifiRemoteStation *station) const
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
bool m_initialized
for initializing tables
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
WifiRemoteStation * DoCreateStation(void) const
Time CalculateFirstMpduTxDuration(Ptr< WifiPhy > phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode)
Estimates the TxTime of a frame with a given mode and group (stream, guard interval and channel width...
WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
double ewmaProb
Exponential weighted moving average of probability.
Time perfectTxTime
Perfect transmission time calculation, or frame calculation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t m_numRates
Number of rates per group Minstrel should consider.
uint32_t m_maxTpRate2
second highest throughput rate
void SetBestStationThRates(MinstrelHtWifiRemoteStation *station, uint32_t index)
Set index rate as maxTpRate or maxTp2Rate if is better than current values.
void InitSampleTable(MinstrelHtWifiRemoteStation *station)
Initialize Sample Table.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
void UpdateRetry(MinstrelHtWifiRemoteStation *station)
Update the number of retries and reset accordingly.
uint32_t m_nSampleCol
Number of sample columns.
uint32_t m_sampleCount
Max number of samples per update interval.
void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
uint8_t m_numGroups
Number of groups Minstrel should consider.
void SetHeSupported(bool enable)
Enable or disable HE capability support.
Time m_updateStats
How frequent do we calculate the stats (1/10 seconds).
bool HasVhtSupported(void) const
Return whether the device has VHT capability support enabled.
static const uint8_t MAX_HT_GROUP_RATES
Number of rates (or MCS) per HT group.
void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
void UpdateStats(MinstrelHtWifiRemoteStation *station)
Updating the Minstrel Table every 1/10 seconds.
McsGroupData m_groupsTable
Table of groups with stats.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
uint32_t GetVhtGroupId(uint8_t txstreams, uint8_t sgi, uint8_t chWidth)
Returns the groupId of a VHT MCS with the given number of streams, if using sgi and the channel width...
WifiModeList GetVhtDeviceMcsList(void) const
Returns a list of only the VHT MCS supported by the device.
static Time Now(void)
Return the current simulation virtual time.
double m_ampduLen
Number of MPDUs in an A-MPDU.
std::vector< HtRateInfo > HtMinstrelRate
Data structure for a Minstrel Rate table.
std::ofstream m_statsFile
File where statistics table is written.
void RateInit(MinstrelHtWifiRemoteStation *station)
Initialize Minstrel Table.
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
int m_totalPacketsCount
total number of packets as of now
uint64_t GetNonHtReferenceRate(void) const
Implementation of Minstrel HT Rate Control AlgorithmMinstrel-HT is a rate adaptation mechanism for th...
uint32_t FindRate(MinstrelHtWifiRemoteStation *station)
Find a rate to use from Minstrel Table.
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...
bool HasHtSupported(void) const
Return whether the device has HT capability support enabled.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
Data structure to contain the information that defines a group.
WifiMode GetMcsSupported(const WifiRemoteStation *station, uint8_t i) const
Return the WifiMode supported by the specified station at the specified index.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void DoInitialize(void)
Initialize() implementation.
Time CalculateMpduTxDuration(Ptr< WifiPhy > phy, uint8_t streams, uint8_t sgi, uint8_t chWidth, WifiMode mode)
Estimates the TxTime of a frame with a given mode and group (stream, guard interval and channel width...
int m_samplePacketsCount
how many packets we have sample so far
uint8_t GetDefaultTxPowerLevel(void) const
double m_lookAroundRate
The % to try other rates than our current rate.
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_maxProbRate
rate with highest prob of success
std::vector< McsGroup > MinstrelMcsGroups
Data structure for a table of group definitions.
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
void AddMpduTxTime(uint32_t groupId, WifiMode mode, Time t)
Save a TxTime to the vector of groups.
A struct to contain all statistics information related to a data rate.
void SetNextSample(MinstrelHtWifiRemoteStation *station)
Set the next sample from Sample Table.
uint32_t m_maxTpRate
the current throughput rate
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
uint32_t m_numSamplesSlow
Number of times a slow rate was sampled.
Time Seconds(double value)
Construct a Time in the indicated unit.
Ptr< MinstrelWifiManager > m_legacyManager
Pointer to an instance of MinstrelWifiManager.
uint32_t numSamplesSkipped
Number of times this rate statistics were not updated because no attempts have been made...
uint32_t GetGroupId(uint32_t index)
Return the groupId from the global index.
void SetBestProbabilityRate(MinstrelHtWifiRemoteStation *station, uint32_t index)
Set index rate as maxProbRate if it is better than current value.
uint32_t m_sampleTries
Number of sample tries after waiting sampleWait.
uint8_t chWidth
channel width (MHz)
void SetNess(uint8_t ness)
Sets the Ness number refer to IEEE 802.11n Table 20-6 for explanation.
bool IsLowLatency(void) const
Time GetFirstMpduTxTime(uint32_t groupId, WifiMode mode) const
Obtain the TXtime saved in the group information.
void SetChannelWidth(uint8_t channelWidth)
Sets the selected channelWidth (in MHz)
bool GetHtSupported(Mac48Address address) const
Return whether the station supports HT or not.
uint32_t CountRetries(MinstrelHtWifiRemoteStation *station)
Count retries.
TracedCallback< uint64_t, Mac48Address > m_rateChange
The trace source fired when the transmission rate change.
WifiModulationClass GetModulationClass() const
WifiMode GetMode(void) const
void UpdateRate(MinstrelHtWifiRemoteStation *station)
Update rate.
uint32_t GetNextSample(MinstrelHtWifiRemoteStation *station)
Getting the next sample from Sample Table.
The MPDU is part of an A-MPDU, but is not the last aggregate.
double m_avgAmpduLen
Average number of MPDUs in an A-MPDU.
uint32_t m_shortRetry
short retries such as control packts
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.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
uint8_t GetNMcsSupported(Mac48Address address) const
Return the number of MCS supported by the station.
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.
std::vector< std::vector< uint32_t > > SampleRate
Data structure for a Sample Rate table A vector of a vector uint32_t.
void CheckInit(MinstrelHtWifiRemoteStation *station)
Check for initializations.
uint32_t m_sampleGroup
The group that the sample rate belongs to.
hold per-remote-station state.
uint8_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
Ptr< WifiMac > GetMac(void) const
Return the WifiMac.
Time m_nextStatsUpdate
10 times every second