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