A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
minstrel-ht-wifi-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 Duy Nguyen
3 * Copyright (c) 2015 Ghada Badawy
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 *Authors: Duy Nguyen <duy@soe.ucsc.edu>
8 * Ghada Badawy <gbadawy@gmail.com>
9 * Matias Richart <mrichart@fing.edu.uy>
10 *
11 * MinstrelHt is a rate adaptation algorithm for high-throughput (HT) 802.11
12 */
13
14#ifndef MINSTREL_HT_WIFI_MANAGER_H
15#define MINSTREL_HT_WIFI_MANAGER_H
16
18
19#include "ns3/wifi-remote-station-manager.h"
20#include "ns3/wifi-types.h"
21
22namespace ns3
23{
24
25/**
26 * Data structure to save transmission time calculations per rate.
27 */
28typedef std::map<WifiMode, Time> TxTime;
29
30/**
31 * \enum McsGroupType
32 * \brief Available MCS group types
33 */
40
41/**
42 * \brief Stream insertion operator.
43 *
44 * \param os the stream
45 * \param type the MCS group type
46 * \returns a reference to the stream
47 */
48inline std::ostream&
49operator<<(std::ostream& os, McsGroupType type)
50{
51 switch (type)
52 {
54 return (os << "HT");
56 return (os << "VHT");
58 return (os << "HE");
59 default:
60 return (os << "INVALID");
61 }
62}
63
64/**
65 * Data structure to contain the information that defines a group.
66 * It also contains the transmission times for all the MCS in the group.
67 * A group is a collection of MCS defined by the number of spatial streams,
68 * if it uses or not Short Guard Interval, and the channel width used.
69 */
71{
72 uint8_t streams; ///< number of spatial streams
73 Time gi; ///< guard interval duration
74 MHz_u chWidth; ///< channel width
75 McsGroupType type; ///< identifies the group, \see McsGroupType
76 bool isSupported; ///< flag whether group is supported
77 // To accurately account for TX times, we separate the TX time of the first
78 // MPDU in an A-MPDU from the rest of the MPDUs.
79 TxTime ratesTxTimeTable; ///< rates transmit time table
80 TxTime ratesFirstMpduTxTimeTable; ///< rates MPDU transmit time table
81};
82
83/**
84 * Data structure for a table of group definitions.
85 * A vector of McsGroups.
86 */
87typedef std::vector<McsGroup> MinstrelMcsGroups;
88
90
91/**
92 * A struct to contain all statistics information related to a data rate.
93 */
95{
96 /**
97 * Perfect transmission time calculation, or frame calculation.
98 * Given a bit rate and a packet length n bytes.
99 */
101 bool supported; //!< If the rate is supported.
102 uint8_t mcsIndex; //!< The index in the operationalMcsSet of the WifiRemoteStationManager.
103 uint32_t retryCount; //!< Retry limit.
104 uint32_t adjustedRetryCount; //!< Adjust the retry limit for this rate.
105 uint32_t numRateAttempt; //!< Number of transmission attempts so far.
106 uint32_t numRateSuccess; //!< Number of successful frames transmitted so far.
107 double prob; //!< Current probability within last time interval. (# frame success )/(# total
108 //!< frames)
109 bool retryUpdated; //!< If number of retries was updated already.
110 /**
111 * Exponential weighted moving average of probability.
112 * EWMA calculation:
113 * ewma_prob =[prob *(100 - ewma_level) + (ewma_prob_old * ewma_level)]/100
114 */
115 double ewmaProb;
116 double ewmsdProb; //!< Exponential weighted moving standard deviation of probability.
117 uint32_t prevNumRateAttempt; //!< Number of transmission attempts with previous rate.
118 uint32_t prevNumRateSuccess; //!< Number of successful frames transmitted with previous rate.
119 uint32_t numSamplesSkipped; //!< Number of times this rate statistics were not updated because
120 //!< no attempts have been made.
121 uint64_t successHist; //!< Aggregate of all transmission successes.
122 uint64_t attemptHist; //!< Aggregate of all transmission attempts.
123 double throughput; //!< Throughput of this rate (in packets per second).
124};
125
126/**
127 * Data structure for a Minstrel Rate table.
128 * A vector of a struct MinstrelHtRateInfo.
129 */
130typedef std::vector<MinstrelHtRateInfo> MinstrelHtRate;
131
132/**
133 * A struct to contain information of a group.
134 */
136{
137 /**
138 * MCS rates are divided into groups based on the number of streams and flags that they use.
139 */
140 uint8_t m_col; //!< Sample table column.
141 uint8_t m_index; //!< Sample table index.
142 bool m_supported; //!< If the rates of this group are supported by the station.
143 uint16_t m_maxTpRate; //!< The max throughput rate of this group in bps.
144 uint16_t m_maxTpRate2; //!< The second max throughput rate of this group in bps.
145 uint16_t m_maxProbRate; //!< The highest success probability rate of this group in bps.
146 MinstrelHtRate m_ratesTable; //!< Information about rates of this group.
147};
148
149/**
150 * Data structure for a table of groups. Each group is of type GroupInfo.
151 * A vector of a GroupInfo.
152 */
153typedef std::vector<GroupInfo> McsGroupData;
154
155/**
156 * Constants for maximum values.
157 */
158
159static const uint8_t MAX_HT_SUPPORTED_STREAMS =
160 4; //!< Maximal number of streams supported by the HT PHY layer.
161static const uint8_t MAX_VHT_SUPPORTED_STREAMS =
162 8; //!< Maximal number of streams supported by the VHT PHY layer.
163static const uint8_t MAX_HE_SUPPORTED_STREAMS =
164 8; //!< Maximal number of streams supported by the HE PHY layer.
165static const uint8_t MAX_HT_STREAM_GROUPS =
166 4; //!< Maximal number of groups per stream in HT (2 possible channel widths and 2 possible GI
167 //!< configurations).
168static const uint8_t MAX_VHT_STREAM_GROUPS =
169 8; //!< Maximal number of groups per stream in VHT (4 possible channel widths and 2 possible GI
170 //!< configurations).
171static const uint8_t MAX_HE_STREAM_GROUPS =
172 12; //!< Maximal number of groups per stream in HE (4 possible channel widths and 3 possible GI
173 //!< configurations).
174static const uint8_t MAX_HT_GROUP_RATES = 8; //!< Number of rates (or MCS) per HT group.
175static const uint8_t MAX_VHT_GROUP_RATES = 10; //!< Number of rates (or MCS) per VHT group.
176static const uint8_t MAX_HE_GROUP_RATES = 12; //!< Number of rates (or MCS) per HE group.
177static const MHz_u MAX_HT_WIDTH = 40; //!< Maximal channel width.
178static const MHz_u MAX_VHT_WIDTH = 160; //!< Maximal channel width.
179static const MHz_u MAX_HE_WIDTH = 160; //!< Maximal channel width.
180
181/**
182 * \brief Implementation of Minstrel-HT Rate Control Algorithm
183 * \ingroup wifi
184 *
185 * Minstrel-HT is a rate adaptation mechanism for the 802.11n/ac/ax standards
186 * based on Minstrel, and is based on the approach of probing the channel
187 * to dynamically learn about working rates that can be supported.
188 * Minstrel-HT is designed for high-latency devices that implement a
189 * Multiple Rate Retry (MRR) chain. This kind of device does
190 * not give feedback for every frame retransmission, but only when a frame
191 * was correctly transmitted (an Ack is received) or a frame transmission
192 * completely fails (all retransmission attempts fail).
193 * The MRR chain is used to advise the hardware about which rate to use
194 * when retransmitting a frame.
195 *
196 * Minstrel-HT adapts the MCS, channel width, number of streams, and
197 * short guard interval (enabled or disabled). For keeping statistics,
198 * it arranges MCS in groups, where each group is defined by the
199 * tuple (streams, GI, channel width). There is a vector of all groups
200 * supported by the PHY layer of the transmitter; for each group, the
201 * capabilities and the estimated duration of its rates are maintained.
202 *
203 * Each station maintains a table of groups statistics. For each group, a flag
204 * indicates if the group is supported by the station. Different stations
205 * communicating with an AP can have different capabilities.
206 *
207 * Stats are updated per A-MPDU when receiving AmpduTxStatus. If the number
208 * of successful or failed MPDUs is greater than zero (a BlockAck was
209 * received), the rates are also updated.
210 * If the number of successful and failed MPDUs is zero (BlockAck timeout),
211 * then the rate selected is based on the MRR chain.
212 *
213 * On each update interval, it sets the maxThrRate, the secondmaxThrRate
214 * and the maxProbRate for the MRR chain. These rates are only used when
215 * an entire A-MPDU fails and is retried.
216 *
217 * Differently from legacy minstrel, sampling is not done based on
218 * "lookaround ratio", but assuring all rates are sampled at least once
219 * each interval. However, it samples less often the low rates and high
220 * probability of error rates.
221 *
222 * When this rate control is configured but non-legacy modes are not supported,
223 * Minstrel-HT uses legacy Minstrel (minstrel-wifi-manager) for rate control.
224 */
226{
227 public:
228 /**
229 * \brief Get the type ID.
230 * \return the object TypeId
231 */
232 static TypeId GetTypeId();
234 ~MinstrelHtWifiManager() override;
235
236 void SetupPhy(const Ptr<WifiPhy> phy) override;
237 void SetupMac(const Ptr<WifiMac> mac) override;
238 int64_t AssignStreams(int64_t stream) override;
239
240 /**
241 * TracedCallback signature for rate change events.
242 *
243 * \param [in] rate The new rate.
244 * \param [in] address The remote station MAC address.
245 */
246 typedef void (*RateChangeTracedCallback)(const uint64_t rate, const Mac48Address remoteAddress);
247
248 private:
249 void DoInitialize() override;
250 WifiRemoteStation* DoCreateStation() const override;
251 void DoReportRxOk(WifiRemoteStation* station, double rxSnr, WifiMode txMode) override;
252 void DoReportRtsFailed(WifiRemoteStation* station) override;
253 void DoReportDataFailed(WifiRemoteStation* station) override;
254 void DoReportRtsOk(WifiRemoteStation* station,
255 double ctsSnr,
256 WifiMode ctsMode,
257 double rtsSnr) override;
258 void DoReportDataOk(WifiRemoteStation* station,
259 double ackSnr,
260 WifiMode ackMode,
261 double dataSnr,
262 MHz_u dataChannelWidth,
263 uint8_t dataNss) override;
264 void DoReportFinalRtsFailed(WifiRemoteStation* station) override;
265 void DoReportFinalDataFailed(WifiRemoteStation* station) override;
266 WifiTxVector DoGetDataTxVector(WifiRemoteStation* station, MHz_u allowedWidth) override;
269 uint16_t nSuccessfulMpdus,
270 uint16_t nFailedMpdus,
271 double rxSnr,
272 double dataSnr,
273 MHz_u dataChannelWidth,
274 uint8_t dataNss) override;
276 Ptr<const Packet> packet,
277 bool normally) override;
278
279 /**
280 * Check the validity of a combination of number of streams, chWidth and mode.
281 *
282 * \param phy pointer to the wifi PHY
283 * \param streams the number of streams
284 * \param chWidth the channel width
285 * \param mode the wifi mode
286 * \returns true if the combination is valid
287 */
288 bool IsValidMcs(Ptr<WifiPhy> phy, uint8_t streams, MHz_u chWidth, WifiMode mode);
289
290 /**
291 * Estimates the TxTime of a frame with a given mode and group (stream, guard interval and
292 * channel width).
293 *
294 * \param phy pointer to the wifi PHY
295 * \param streams the number of streams
296 * \param gi guard interval duration
297 * \param chWidth the channel width
298 * \param mode the wifi mode
299 * \param mpduType the type of the MPDU
300 * \returns the transmit time
301 */
303 uint8_t streams,
304 Time gi,
305 MHz_u chWidth,
306 WifiMode mode,
307 MpduType mpduType);
308
309 /**
310 * Obtain the TxTime saved in the group information.
311 *
312 * \param groupId the group ID
313 * \param mode the wifi mode
314 * \returns the transmit time
315 */
316 Time GetMpduTxTime(uint8_t groupId, WifiMode mode) const;
317
318 /**
319 * Save a TxTime to the vector of groups.
320 *
321 * \param groupId the group ID
322 * \param mode the wifi mode
323 * \param t the transmit time
324 */
325 void AddMpduTxTime(uint8_t groupId, WifiMode mode, Time t);
326
327 /**
328 * Obtain the TxTime saved in the group information.
329 *
330 * \param groupId the group ID
331 * \param mode the wifi mode
332 * \returns the transmit time
333 */
334 Time GetFirstMpduTxTime(uint8_t groupId, WifiMode mode) const;
335
336 /**
337 * Save a TxTime to the vector of groups.
338 *
339 * \param groupId the group ID
340 * \param mode the wifi mode
341 * \param t the transmit time
342 */
343 void AddFirstMpduTxTime(uint8_t groupId, WifiMode mode, Time t);
344
345 /**
346 * Update the number of retries and reset accordingly.
347 * \param station the wifi remote station
348 */
350
351 /**
352 * Update the number of sample count variables.
353 *
354 * \param station the wifi remote station
355 * \param nSuccessfulMpdus the number of successfully received MPDUs
356 * \param nFailedMpdus the number of failed MPDUs
357 */
359 uint16_t nSuccessfulMpdus,
360 uint16_t nFailedMpdus);
361
362 /**
363 * Getting the next sample from Sample Table.
364 *
365 * \param station the wifi remote station
366 * \returns the next sample
367 */
369
370 /**
371 * Set the next sample from Sample Table.
372 *
373 * \param station the wifi remote station
374 */
376
377 /**
378 * Find a rate to use from Minstrel Table.
379 *
380 * \param station the Minstrel-HT wifi remote station
381 * \returns the rate in bps
382 */
383 uint16_t FindRate(MinstrelHtWifiRemoteStation* station);
384
385 /**
386 * Update the Minstrel Table.
387 *
388 * \param station the Minstrel-HT wifi remote station
389 */
391
392 /**
393 * Initialize Minstrel Table.
394 *
395 * \param station the Minstrel-HT wifi remote station
396 */
398
399 /**
400 * Return the average throughput of the MCS defined by groupId and rateId.
401 *
402 * \param station the Minstrel-HT wifi remote station
403 * \param groupId the group ID
404 * \param rateId the rate ID
405 * \param ewmaProb the EWMA probability
406 * \returns the throughput in bps
407 */
409 uint8_t groupId,
410 uint8_t rateId,
411 double ewmaProb);
412
413 /**
414 * Set index rate as maxTpRate or maxTp2Rate if is better than current values.
415 *
416 * \param station the Minstrel-HT wifi remote station
417 * \param index the index
418 */
419 void SetBestStationThRates(MinstrelHtWifiRemoteStation* station, uint16_t index);
420
421 /**
422 * Set index rate as maxProbRate if it is better than current value.
423 *
424 * \param station the Minstrel-HT wifi remote station
425 * \param index the index
426 */
427 void SetBestProbabilityRate(MinstrelHtWifiRemoteStation* station, uint16_t index);
428
429 /**
430 * Calculate the number of retransmissions to set for the index rate.
431 *
432 * \param station the Minstrel-HT wifi remote station
433 * \param index the index
434 */
435 void CalculateRetransmits(MinstrelHtWifiRemoteStation* station, uint16_t index);
436
437 /**
438 * Calculate the number of retransmissions to set for the (groupId, rateId) rate.
439 *
440 * \param station the Minstrel-HT wifi remote station
441 * \param groupId the group ID
442 * \param rateId the rate ID
443 */
445 uint8_t groupId,
446 uint8_t rateId);
447
448 /**
449 * Estimate the time to transmit the given packet with the given number of retries.
450 * This function is "roughly" the function "calc_usecs_unicast_packet" in minstrel.c
451 * in the madwifi implementation.
452 *
453 * The basic idea is that, we try to estimate the "average" time used to transmit the
454 * packet for the given number of retries while also accounting for the 802.11 congestion
455 * window change. The original code in the madwifi seems to estimate the number of backoff
456 * slots as the half of the current CW size.
457 *
458 * There are four main parts:
459 * - wait for DIFS (sense idle channel)
460 * - Ack timeouts
461 * - Data transmission
462 * - backoffs according to CW
463 *
464 * \param dataTransmissionTime the data transmission time
465 * \param shortRetries the short retries
466 * \param longRetries the long retries
467 * \returns the unicast packet time
468 */
470 uint32_t shortRetries,
471 uint32_t longRetries);
472
473 /**
474 * Perform EWMSD (Exponentially Weighted Moving Standard Deviation) calculation.
475 *
476 * \param oldEwmsd the old EWMSD
477 * \param currentProb the current probability
478 * \param ewmaProb the EWMA probability
479 * \param weight the weight
480 * \returns the EWMSD
481 */
482 double CalculateEwmsd(double oldEwmsd, double currentProb, double ewmaProb, double weight);
483
484 /**
485 * Initialize Sample Table.
486 *
487 * \param station the Minstrel-HT wifi remote station
488 */
490
491 /**
492 * Printing Sample Table.
493 *
494 * \param station the Minstrel-HT wifi remote station
495 */
497
498 /**
499 * Printing Minstrel Table.
500 *
501 * \param station the Minstrel-HT wifi remote station
502 */
504
505 /**
506 * Print group statistics.
507 *
508 * \param station the Minstrel-HT wifi remote station
509 * \param groupId the group ID
510 * \param of the output file stream
511 */
512 void StatsDump(MinstrelHtWifiRemoteStation* station, uint8_t groupId, std::ofstream& of);
513
514 /**
515 * Check for initializations.
516 *
517 * \param station the Minstrel-HT wifi remote station
518 */
520
521 /**
522 * Count retries.
523 *
524 * \param station the Minstrel-HT wifi remote station
525 * \returns the count of retries
526 */
528
529 /**
530 * Update rate.
531 *
532 * \param station the Minstrel-HT wifi remote station
533 */
535
536 /**
537 * Return the rateId inside a group, from the global index.
538 *
539 * \param index the index
540 * \returns the rate ID
541 */
542 uint8_t GetRateId(uint16_t index);
543
544 /**
545 * Return the groupId from the global index.
546 *
547 * \param index the index
548 * \returns the group ID
549 */
550 uint8_t GetGroupId(uint16_t index);
551
552 /**
553 * Returns the global index corresponding to the groupId and rateId.
554 *
555 * For managing rates from different groups, a global index for
556 * all rates in all groups is used.
557 * The group order is fixed by BW -> SGI -> streams.
558 *
559 * \param groupId the group ID
560 * \param rateId the rate ID
561 * \returns the index
562 */
563 uint16_t GetIndex(uint8_t groupId, uint8_t rateId);
564
565 /**
566 * Returns the groupId of an HT MCS with the given number of streams, GI and channel width used.
567 *
568 * \param txstreams the number of streams
569 * \param guardInterval guard interval duration
570 * \param chWidth the channel width
571 * \returns the HT group ID
572 */
573 uint8_t GetHtGroupId(uint8_t txstreams, Time guardInterval, MHz_u chWidth);
574
575 /**
576 * Returns the groupId of a VHT MCS with the given number of streams, GI and channel width used.
577 *
578 * \param txstreams the number of streams
579 * \param guardInterval guard interval duration
580 * \param chWidth the channel width
581 * \returns the VHT group ID
582 */
583 uint8_t GetVhtGroupId(uint8_t txstreams, Time guardInterval, MHz_u chWidth);
584
585 /**
586 * Returns the groupId of an HE MCS with the given number of streams, GI and channel width used.
587 *
588 * \param txstreams the number of streams
589 * \param guardInterval guard interval duration
590 * \param chWidth the channel width
591 * \returns the HE group ID
592 */
593 uint8_t GetHeGroupId(uint8_t txstreams, Time guardInterval, MHz_u chWidth);
594
595 /**
596 * Returns the lowest global index of the rates supported by the station.
597 *
598 * \param station the Minstrel-HT wifi remote station
599 * \returns the lowest global index
600 */
602
603 /**
604 * Returns the lowest global index of the rates supported by in the group.
605 *
606 * \param station the Minstrel-HT wifi remote station
607 * \param groupId the group ID
608 * \returns the lowest global index
609 */
610 uint16_t GetLowestIndex(MinstrelHtWifiRemoteStation* station, uint8_t groupId);
611
612 /**
613 * Returns a list of only the HE MCS supported by the device.
614 * \returns the list of the HE MCS supported
615 */
617
618 /**
619 * Returns a list of only the VHT MCS supported by the device.
620 * \returns the list of the VHT MCS supported
621 */
623
624 /**
625 * Returns a list of only the HT MCS supported by the device.
626 * \returns the list of the HT MCS supported
627 */
629
630 /**
631 * Given the index of the current TX rate, check whether the channel width is
632 * not greater than the given allowed width. If so, the index of the current TX
633 * rate is returned. Otherwise, try halving the channel width and check if the
634 * MCS group with the same number of streams and same GI is supported. If a
635 * supported MCS group is found, return the index of the TX rate within such a
636 * group with the same MCS as the given TX rate. If no supported MCS group is
637 * found, the simulation aborts.
638 *
639 * \param txRate the index of the current TX rate
640 * \param allowedWidth the allowed width
641 * \return the index of a TX rate whose channel width is not greater than the
642 * allowed width, if found (otherwise, the simulation aborts)
643 */
644 uint16_t UpdateRateAfterAllowedWidth(uint16_t txRate, MHz_u allowedWidth);
645
646 Time m_updateStats; //!< How frequent do we calculate the stats.
647 Time m_legacyUpdateStats; //!< How frequent do we calculate the stats for legacy
648 //!< MinstrelWifiManager.
649 uint8_t m_lookAroundRate; //!< The % to try other rates than our current rate.
650 uint8_t m_ewmaLevel; //!< Exponential weighted moving average level (or coefficient).
651 uint8_t m_nSampleCol; //!< Number of sample columns.
652 uint32_t m_frameLength; //!< Frame length used to calculate modes TxTime in bytes.
653 uint8_t m_numGroups; //!< Number of groups Minstrel should consider.
654 uint8_t m_numRates; //!< Number of rates per group Minstrel should consider.
655 bool m_useLatestAmendmentOnly; //!< Flag if only the latest supported amendment by both peers
656 //!< should be used.
657 bool m_printStats; //!< If statistics table should be printed.
658
659 MinstrelMcsGroups m_minstrelGroups; //!< Global array for groups information.
660
661 Ptr<MinstrelWifiManager> m_legacyManager; //!< Pointer to an instance of MinstrelWifiManager.
662 //!< Used when 802.11n/ac/ax not supported.
663
664 Ptr<UniformRandomVariable> m_uniformRandomVariable; //!< Provides uniform random variables.
665
666 TracedValue<uint64_t> m_currentRate; //!< Trace rate changes
667};
668
669} // namespace ns3
670
671#endif /* MINSTREL_HT_WIFI_MANAGER_H */
an EUI-48 address
Implementation of Minstrel-HT Rate Control Algorithm.
void(* RateChangeTracedCallback)(const uint64_t rate, const Mac48Address remoteAddress)
TracedCallback signature for rate change events.
static TypeId GetTypeId()
Get the type ID.
uint32_t CountRetries(MinstrelHtWifiRemoteStation *station)
Count retries.
uint32_t m_frameLength
Frame length used to calculate modes TxTime in bytes.
void InitSampleTable(MinstrelHtWifiRemoteStation *station)
Initialize Sample Table.
bool m_printStats
If statistics table should be printed.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
bool DoNeedRetransmission(WifiRemoteStation *st, Ptr< const Packet > packet, bool normally) override
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
Time CalculateTimeUnicastPacket(Time dataTransmissionTime, uint32_t shortRetries, uint32_t longRetries)
Estimate the time to transmit the given packet with the given number of retries.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
MinstrelMcsGroups m_minstrelGroups
Global array for groups information.
void AddMpduTxTime(uint8_t groupId, WifiMode mode, Time t)
Save a TxTime to the vector of groups.
void SetNextSample(MinstrelHtWifiRemoteStation *station)
Set the next sample from Sample Table.
uint8_t m_numRates
Number of rates per group Minstrel should consider.
uint16_t UpdateRateAfterAllowedWidth(uint16_t txRate, MHz_u allowedWidth)
Given the index of the current TX rate, check whether the channel width is not greater than the given...
uint8_t m_nSampleCol
Number of sample columns.
bool IsValidMcs(Ptr< WifiPhy > phy, uint8_t streams, MHz_u chWidth, WifiMode mode)
Check the validity of a combination of number of streams, chWidth and mode.
void RateInit(MinstrelHtWifiRemoteStation *station)
Initialize Minstrel Table.
void SetBestStationThRates(MinstrelHtWifiRemoteStation *station, uint16_t index)
Set index rate as maxTpRate or maxTp2Rate if is better than current values.
void PrintTable(MinstrelHtWifiRemoteStation *station)
Printing Minstrel Table.
void StatsDump(MinstrelHtWifiRemoteStation *station, uint8_t groupId, std::ofstream &of)
Print group statistics.
void AddFirstMpduTxTime(uint8_t groupId, WifiMode mode, Time t)
Save a TxTime to the vector of groups.
double CalculateEwmsd(double oldEwmsd, double currentProb, double ewmaProb, double weight)
Perform EWMSD (Exponentially Weighted Moving Standard Deviation) calculation.
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void SetBestProbabilityRate(MinstrelHtWifiRemoteStation *station, uint16_t index)
Set index rate as maxProbRate if it is better than current value.
WifiModeList GetHeDeviceMcsList() const
Returns a list of only the HE MCS supported by the device.
Time m_updateStats
How frequent do we calculate the stats.
TracedValue< uint64_t > m_currentRate
Trace rate changes.
uint16_t GetLowestIndex(MinstrelHtWifiRemoteStation *station)
Returns the lowest global index of the rates supported by the station.
void DoInitialize() override
Initialize() implementation.
WifiModeList GetVhtDeviceMcsList() const
Returns a list of only the VHT MCS supported by the device.
uint8_t GetVhtGroupId(uint8_t txstreams, Time guardInterval, MHz_u chWidth)
Returns the groupId of a VHT MCS with the given number of streams, GI and channel width used.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth) override
void CheckInit(MinstrelHtWifiRemoteStation *station)
Check for initializations.
WifiModeList GetHtDeviceMcsList() const
Returns a list of only the HT MCS supported by the device.
void UpdateRetry(MinstrelHtWifiRemoteStation *station)
Update the number of retries and reset accordingly.
Time GetFirstMpduTxTime(uint8_t groupId, WifiMode mode) const
Obtain the TxTime saved in the group information.
Time GetMpduTxTime(uint8_t groupId, WifiMode mode) const
Obtain the TxTime saved in the group information.
uint8_t m_numGroups
Number of groups Minstrel should consider.
void CalculateRetransmits(MinstrelHtWifiRemoteStation *station, uint16_t index)
Calculate the number of retransmissions to set for the index rate.
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...
uint8_t GetHeGroupId(uint8_t txstreams, Time guardInterval, MHz_u chWidth)
Returns the groupId of an HE MCS with the given number of streams, GI and channel width used.
uint8_t m_ewmaLevel
Exponential weighted moving average level (or coefficient).
uint16_t FindRate(MinstrelHtWifiRemoteStation *station)
Find a rate to use from Minstrel Table.
uint8_t m_lookAroundRate
The % to try other rates than our current rate.
void UpdateRate(MinstrelHtWifiRemoteStation *station)
Update rate.
uint8_t GetRateId(uint16_t index)
Return the rateId inside a group, from the global index.
Time m_legacyUpdateStats
How frequent do we calculate the stats for legacy MinstrelWifiManager.
uint8_t GetGroupId(uint16_t index)
Return the groupId from the global index.
void PrintSampleTable(MinstrelHtWifiRemoteStation *station)
Printing Sample Table.
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.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables.
Time CalculateMpduTxDuration(Ptr< WifiPhy > phy, uint8_t streams, Time gi, MHz_u chWidth, WifiMode mode, MpduType mpduType)
Estimates the TxTime of a frame with a given mode and group (stream, guard interval and channel width...
uint8_t GetHtGroupId(uint8_t txstreams, Time guardInterval, MHz_u chWidth)
Returns the groupId of an HT MCS with the given number of streams, GI and channel width used.
uint16_t GetNextSample(MinstrelHtWifiRemoteStation *station)
Getting the next sample from Sample Table.
void UpdateStats(MinstrelHtWifiRemoteStation *station)
Update the Minstrel Table.
uint16_t GetIndex(uint8_t groupId, uint8_t rateId)
Returns the global index corresponding to the groupId and rateId.
WifiRemoteStation * DoCreateStation() const override
Ptr< MinstrelWifiManager > m_legacyManager
Pointer to an instance of MinstrelWifiManager.
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...
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void UpdatePacketCounters(MinstrelHtWifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus)
Update the number of sample count variables.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
bool m_useLatestAmendmentOnly
Flag if only the latest supported amendment by both peers should be used.
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportAmpduTxStatus(WifiRemoteStation *station, uint16_t nSuccessfulMpdus, uint16_t nFailedMpdus, double rxSnr, double dataSnr, MHz_u dataChannelWidth, uint8_t dataNss) override
Typically called per A-MPDU, either when a Block ACK was successfully received or when a BlockAckTime...
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Trace classes with value semantics.
a unique identifier for an interface.
Definition type-id.h:48
represent a single transmission mode
Definition wifi-mode.h:40
hold a list of per-remote-station state.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
MpduType
The type of an MPDU.
Definition wifi-types.h:41
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const MHz_u MAX_HT_WIDTH
Maximal channel width.
static const uint8_t MAX_HT_GROUP_RATES
Number of rates (or MCS) per HT group.
static const uint8_t MAX_VHT_STREAM_GROUPS
Maximal number of groups per stream in VHT (4 possible channel widths and 2 possible GI configuration...
std::vector< McsGroup > MinstrelMcsGroups
Data structure for a table of group definitions.
McsGroupType
Available MCS group types.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
std::map< WifiMode, Time > TxTime
Data structure to save transmission time calculations per rate.
static const uint8_t MAX_VHT_GROUP_RATES
Number of rates (or MCS) per VHT group.
static const uint8_t MAX_VHT_SUPPORTED_STREAMS
Maximal number of streams supported by the VHT PHY layer.
double MHz_u
MHz weak type.
Definition wifi-units.h:31
static const uint8_t MAX_HT_SUPPORTED_STREAMS
Constants for maximum values.
static const uint8_t MAX_HE_GROUP_RATES
Number of rates (or MCS) per HE group.
static const MHz_u MAX_VHT_WIDTH
Maximal channel width.
static const uint8_t MAX_HT_STREAM_GROUPS
Maximal number of groups per stream in HT (2 possible channel widths and 2 possible GI configurations...
static const uint8_t MAX_HE_STREAM_GROUPS
Maximal number of groups per stream in HE (4 possible channel widths and 3 possible GI configurations...
std::vector< MinstrelHtRateInfo > MinstrelHtRate
Data structure for a Minstrel Rate table.
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes.
Definition wifi-mode.h:251
std::vector< GroupInfo > McsGroupData
Data structure for a table of groups.
static const uint8_t MAX_HE_SUPPORTED_STREAMS
Maximal number of streams supported by the HE PHY layer.
static const MHz_u MAX_HE_WIDTH
Maximal channel width.
A struct to contain information of a group.
MinstrelHtRate m_ratesTable
Information about rates of this group.
bool m_supported
If the rates of this group are supported by the station.
uint8_t m_index
Sample table index.
uint16_t m_maxTpRate2
The second max throughput rate of this group in bps.
uint8_t m_col
MCS rates are divided into groups based on the number of streams and flags that they use.
uint16_t m_maxProbRate
The highest success probability rate of this group in bps.
uint16_t m_maxTpRate
The max throughput rate of this group in bps.
Data structure to contain the information that defines a group.
MHz_u chWidth
channel width
TxTime ratesTxTimeTable
rates transmit time table
TxTime ratesFirstMpduTxTimeTable
rates MPDU transmit time table
Time gi
guard interval duration
McsGroupType type
identifies the group,
bool isSupported
flag whether group is supported
uint8_t streams
number of spatial streams
A struct to contain all statistics information related to a data rate.
uint32_t prevNumRateAttempt
Number of transmission attempts with previous rate.
uint32_t prevNumRateSuccess
Number of successful frames transmitted with previous rate.
bool supported
If the rate is supported.
Time perfectTxTime
Perfect transmission time calculation, or frame calculation.
uint8_t mcsIndex
The index in the operationalMcsSet of the WifiRemoteStationManager.
uint32_t numRateSuccess
Number of successful frames transmitted so far.
double ewmaProb
Exponential weighted moving average of probability.
double prob
Current probability within last time interval.
double ewmsdProb
Exponential weighted moving standard deviation of probability.
uint32_t numRateAttempt
Number of transmission attempts so far.
uint32_t numSamplesSkipped
Number of times this rate statistics were not updated because no attempts have been made.
double throughput
Throughput of this rate (in packets per second).
uint32_t adjustedRetryCount
Adjust the retry limit for this rate.
uint64_t successHist
Aggregate of all transmission successes.
uint64_t attemptHist
Aggregate of all transmission attempts.
bool retryUpdated
If number of retries was updated already.
MinstrelHtWifiRemoteStation structure.
hold per-remote-station state.
void CalculateThroughput()
Calculate the throughput.
Definition wifi-tcp.cc:51