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