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