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