A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rrpaa-wifi-manager.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Universidad de la República - Uruguay
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Matías Richart <mrichart@fing.edu.uy>
7 */
8
10
11#include "ns3/boolean.h"
12#include "ns3/data-rate.h"
13#include "ns3/double.h"
14#include "ns3/log.h"
15#include "ns3/packet.h"
16#include "ns3/simulator.h"
17#include "ns3/uinteger.h"
18#include "ns3/wifi-mac.h"
19#include "ns3/wifi-phy.h"
20
21NS_LOG_COMPONENT_DEFINE("RrpaaWifiManager");
22
23namespace ns3
24{
25
26/**
27 * Hold per-remote-station state for RRPAA Wifi manager.
28 *
29 * This struct extends from WifiRemoteStation struct to hold additional
30 * information required by the APARF Wifi manager
31 */
33{
34 uint32_t m_counter; //!< Counter for transmission attempts.
35 uint32_t m_nFailed; //!< Number of failed transmission attempts.
36 uint32_t m_adaptiveRtsWnd; //!< Window size for the Adaptive RTS mechanism.
37 uint32_t m_rtsCounter; //!< Counter for RTS transmission attempts.
38 Time m_lastReset; //!< Time of the last reset.
39 bool m_adaptiveRtsOn; //!< Check if Adaptive RTS mechanism is on.
40 bool m_lastFrameFail; //!< Flag if the last frame sent has failed.
41 bool m_initialized; //!< For initializing variables.
42 uint8_t m_nRate; //!< Number of supported rates.
43 uint8_t m_prevRateIndex; //!< Rate index of the previous transmission.
44 uint8_t m_rateIndex; //!< Current rate index.
45 uint8_t m_prevPowerLevel; //!< Power level of the previous transmission.
46 uint8_t m_powerLevel; //!< Current power level.
47 RrpaaThresholdsTable m_thresholds; //!< RRPAA thresholds for this station.
48 RrpaaProbabilitiesTable m_pdTable; //!< Probability table for power and rate changes.
49};
50
52
55{
56 static TypeId tid =
57 TypeId("ns3::RrpaaWifiManager")
59 .SetGroupName("Wifi")
60 .AddConstructor<RrpaaWifiManager>()
61 .AddAttribute(
62 "Basic",
63 "If true the RRPAA-BASIC algorithm will be used, otherwise the RRPAA will be used.",
64 BooleanValue(true),
67 .AddAttribute("Timeout",
68 "Timeout for the RRPAA-BASIC loss estimation block.",
72 .AddAttribute("FrameLength",
73 "The Data frame length (in bytes) used for calculating mode TxTime.",
74 UintegerValue(1420),
77 .AddAttribute("AckFrameLength",
78 "The Ack frame length (in bytes) used for calculating mode TxTime.",
79 UintegerValue(14),
82 .AddAttribute("Alpha",
83 "Constant for calculating the MTL threshold.",
84 DoubleValue(1.25),
87 .AddAttribute("Beta",
88 "Constant for calculating the ORI threshold.",
89 DoubleValue(2),
92 .AddAttribute("Tau",
93 "Constant for calculating the EWND size.",
94 DoubleValue(0.015),
97 .AddAttribute("Gamma",
98 "Constant for Probabilistic Decision Table decrements.",
99 DoubleValue(2),
102 .AddAttribute("Delta",
103 "Constant for Probabilistic Decision Table increments.",
104 DoubleValue(1.0905),
107 .AddTraceSource("RateChange",
108 "The transmission rate has change.",
110 "ns3::WifiRemoteStationManager::RateChangeTracedCallback")
111 .AddTraceSource("PowerChange",
112 "The transmission power has change.",
114 "ns3::WifiRemoteStationManager::PowerChangeTracedCallback");
115 return tid;
116}
117
123
128
129int64_t
131{
132 NS_LOG_FUNCTION(this << stream);
133 m_uniformRandomVariable->SetStream(stream);
134 return 1;
135}
136
137void
139{
140 NS_LOG_FUNCTION(this << phy);
141 m_sifs = phy->GetSifs();
142 m_difs = m_sifs + 2 * phy->GetSlot();
143 m_nPowerLevels = phy->GetNTxPower();
145 m_minPowerLevel = 0;
146 for (const auto& mode : phy->GetModeList())
147 {
148 WifiTxVector txVector;
149 txVector.SetMode(mode);
151 /* Calculate the TX Time of the Data and the corresponding Ack */
152 Time dataTxTime = phy->CalculateTxDuration(m_frameLength, txVector, phy->GetPhyBand());
153 Time ackTxTime = phy->CalculateTxDuration(m_ackLength, txVector, phy->GetPhyBand());
154 NS_LOG_DEBUG("Calculating TX times: Mode= " << mode << " DataTxTime= " << dataTxTime
155 << " AckTxTime= " << ackTxTime);
156 AddCalcTxTime(mode, dataTxTime + ackTxTime);
157 }
159}
160
161void
167
168void
170{
171 NS_LOG_FUNCTION(this);
172 if (GetHtSupported())
173 {
174 NS_FATAL_ERROR("WifiRemoteStationManager selected does not support HT rates");
175 }
176 if (GetVhtSupported())
177 {
178 NS_FATAL_ERROR("WifiRemoteStationManager selected does not support VHT rates");
179 }
180 if (GetHeSupported())
181 {
182 NS_FATAL_ERROR("WifiRemoteStationManager selected does not support HE rates");
183 }
184}
185
186Time
188{
189 NS_LOG_FUNCTION(this << mode);
190 for (auto i = m_calcTxTime.begin(); i != m_calcTxTime.end(); i++)
191 {
192 if (mode == i->second)
193 {
194 return i->first;
195 }
196 }
197 NS_ASSERT(false);
198 return Seconds(0);
199}
200
201void
203{
204 NS_LOG_FUNCTION(this << mode << t);
205 m_calcTxTime.emplace_back(t, mode);
206}
207
210{
211 NS_LOG_FUNCTION(this << station << mode);
212 WifiRrpaaThresholds threshold;
213 for (auto i = station->m_thresholds.begin(); i != station->m_thresholds.end(); i++)
214 {
215 if (mode == i->second)
216 {
217 return i->first;
218 }
219 }
220 NS_ABORT_MSG("No thresholds for mode " << mode << " found");
221 return threshold; // Silence compiler warning
222}
223
226{
227 NS_LOG_FUNCTION(this);
228 auto station = new RrpaaWifiRemoteStation();
229 station->m_adaptiveRtsWnd = 0;
230 station->m_rtsCounter = 0;
231 station->m_adaptiveRtsOn = false;
232 station->m_lastFrameFail = false;
233 station->m_initialized = false;
234 return station;
235}
236
237void
239{
240 NS_LOG_FUNCTION(this << station);
241 if (!station->m_initialized)
242 {
243 // Note: we appear to be doing late initialization of the table
244 // to make sure that the set of supported rates has been initialized
245 // before we perform our own initialization.
246 station->m_nRate = GetNSupported(station);
247 // Initialize at minimal rate and maximal power.
248 station->m_prevRateIndex = 0;
249 station->m_rateIndex = 0;
251 station->m_powerLevel = m_maxPowerLevel;
252 WifiMode mode = GetSupported(station, 0);
253 auto channelWidth = GetChannelWidth(station);
254 DataRate rate(mode.GetDataRate(channelWidth));
255 const auto power = GetPhy()->GetPower(station->m_powerLevel);
256 m_rateChange(rate, rate, station->m_state->m_address);
257 m_powerChange(power, power, station->m_state->m_address);
258
259 station->m_pdTable =
260 RrpaaProbabilitiesTable(station->m_nRate, std::vector<double>(m_nPowerLevels));
261 NS_LOG_DEBUG("Initializing pdTable");
262 for (uint8_t i = 0; i < station->m_nRate; i++)
263 {
264 for (uint8_t j = 0; j < m_nPowerLevels; j++)
265 {
266 station->m_pdTable[i][j] = 1;
267 }
268 }
269
270 station->m_initialized = true;
271
272 station->m_thresholds = RrpaaThresholdsTable(station->m_nRate);
273 InitThresholds(station);
274 ResetCountersBasic(station);
275 }
276}
277
278void
280{
281 NS_LOG_FUNCTION(this << station);
282 double nextCritical = 0;
283 double nextMtl = 0;
284 double mtl = 0;
285 double ori = 0;
286 for (uint8_t i = 0; i < station->m_nRate; i++)
287 {
288 WifiMode mode = GetSupported(station, i);
289 Time totalTxTime = GetCalcTxTime(mode) + m_sifs + m_difs;
290 if (i == station->m_nRate - 1)
291 {
292 ori = 0;
293 }
294 else
295 {
296 WifiMode nextMode = GetSupported(station, i + 1);
297 Time nextTotalTxTime = GetCalcTxTime(nextMode) + m_sifs + m_difs;
298 nextCritical = 1 - (nextTotalTxTime.GetSeconds() / totalTxTime.GetSeconds());
299 nextMtl = m_alpha * nextCritical;
300 ori = nextMtl / m_beta;
301 }
302 if (i == 0)
303 {
304 mtl = nextMtl;
305 }
307 th.m_ewnd = static_cast<uint32_t>(ceil(m_tau / totalTxTime.GetSeconds()));
308 th.m_ori = ori;
309 th.m_mtl = mtl;
310 station->m_thresholds.emplace_back(th, mode);
311 mtl = nextMtl;
312 NS_LOG_DEBUG(mode << " " << th.m_ewnd << " " << th.m_mtl << " " << th.m_ori);
313 }
314}
315
316void
318{
319 NS_LOG_FUNCTION(this << station);
320 station->m_nFailed = 0;
321 station->m_counter = GetThresholds(station, station->m_rateIndex).m_ewnd;
322 station->m_lastReset = Simulator::Now();
323}
324
325void
330
331void
333{
334 NS_LOG_FUNCTION(this << st);
335 auto station = static_cast<RrpaaWifiRemoteStation*>(st);
336 CheckInit(station);
337 station->m_lastFrameFail = true;
338 CheckTimeout(station);
339 station->m_counter--;
340 station->m_nFailed++;
341 RunBasicAlgorithm(station);
342}
343
344void
346{
347 NS_LOG_FUNCTION(this << st << rxSnr << txMode);
348}
349
350void
352 double ctsSnr,
353 WifiMode ctsMode,
354 double rtsSnr)
355{
356 NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode << rtsSnr);
357}
358
359void
361 double ackSnr,
362 WifiMode ackMode,
363 double dataSnr,
364 MHz_u dataChannelWidth,
365 uint8_t dataNss)
366{
367 NS_LOG_FUNCTION(this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
368 auto station = static_cast<RrpaaWifiRemoteStation*>(st);
369 CheckInit(station);
370 station->m_lastFrameFail = false;
371 CheckTimeout(station);
372 station->m_counter--;
373 RunBasicAlgorithm(station);
374}
375
376void
381
382void
387
390{
391 NS_LOG_FUNCTION(this << st << allowedWidth);
392 auto station = static_cast<RrpaaWifiRemoteStation*>(st);
393 auto channelWidth = GetChannelWidth(station);
394 if (channelWidth > 20 && channelWidth != 22)
395 {
396 channelWidth = 20;
397 }
398 CheckInit(station);
399 WifiMode mode = GetSupported(station, station->m_rateIndex);
400 DataRate rate(mode.GetDataRate(channelWidth));
401 DataRate prevRate(GetSupported(station, station->m_prevRateIndex).GetDataRate(channelWidth));
402 const auto power = GetPhy()->GetPower(station->m_powerLevel);
403 const auto prevPower = GetPhy()->GetPower(station->m_prevPowerLevel);
404 if (station->m_prevRateIndex != station->m_rateIndex)
405 {
406 m_rateChange(prevRate, rate, station->m_state->m_address);
407 station->m_prevRateIndex = station->m_rateIndex;
408 }
409 if (station->m_prevPowerLevel != station->m_powerLevel)
410 {
411 m_powerChange(prevPower, power, station->m_state->m_address);
412 station->m_prevPowerLevel = station->m_powerLevel;
413 }
414 return WifiTxVector(
415 mode,
416 station->m_powerLevel,
418 NanoSeconds(800),
419 1,
420 1,
421 0,
422 channelWidth,
423 GetAggregation(station));
424}
425
428{
429 NS_LOG_FUNCTION(this << st);
430 auto station = static_cast<RrpaaWifiRemoteStation*>(st);
431 auto channelWidth = GetChannelWidth(station);
432 if (channelWidth > 20 && channelWidth != 22)
433 {
434 channelWidth = 20;
435 }
436 WifiMode mode;
438 {
439 mode = GetSupported(station, 0);
440 }
441 else
442 {
443 mode = GetNonErpSupported(station, 0);
444 }
445 return WifiTxVector(
446 mode,
449 NanoSeconds(800),
450 1,
451 1,
452 0,
453 channelWidth,
454 GetAggregation(station));
455}
456
457bool
459{
460 NS_LOG_FUNCTION(this << st << size << normally);
461 auto station = static_cast<RrpaaWifiRemoteStation*>(st);
462 CheckInit(station);
463 if (m_basic)
464 {
465 return normally;
466 }
468 return station->m_adaptiveRtsOn;
469}
470
471void
473{
474 NS_LOG_FUNCTION(this << station);
475 Time d = Simulator::Now() - station->m_lastReset;
476 if (station->m_counter == 0 || d > m_timeout)
477 {
478 ResetCountersBasic(station);
479 }
480}
481
482void
484{
485 NS_LOG_FUNCTION(this << station);
486 WifiRrpaaThresholds thresholds = GetThresholds(station, station->m_rateIndex);
487 double bploss = (static_cast<double>(station->m_nFailed) / thresholds.m_ewnd);
488 double wploss =
489 (static_cast<double>(station->m_counter + station->m_nFailed) / thresholds.m_ewnd);
490 NS_LOG_DEBUG("Best loss prob= " << bploss);
491 NS_LOG_DEBUG("Worst loss prob= " << wploss);
492 if (bploss >= thresholds.m_mtl)
493 {
494 if (station->m_powerLevel < m_maxPowerLevel)
495 {
496 NS_LOG_DEBUG("bploss >= MTL and power < maxPower => Increase Power");
497 station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
498 NS_LOG_DEBUG("pdTable["
499 << +station->m_rateIndex << "][" << station->m_powerLevel << "] = "
500 << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
501 station->m_powerLevel++;
502 ResetCountersBasic(station);
503 }
504 else if (station->m_rateIndex != 0)
505 {
506 NS_LOG_DEBUG("bploss >= MTL and power = maxPower => Decrease Rate");
507 station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
508 NS_LOG_DEBUG("pdTable["
509 << +station->m_rateIndex << "][" << station->m_powerLevel << "] = "
510 << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
511 station->m_rateIndex--;
512 ResetCountersBasic(station);
513 }
514 else
515 {
516 NS_LOG_DEBUG("bploss >= MTL but already at maxPower and minRate");
517 }
518 }
519 else if (wploss <= thresholds.m_ori)
520 {
521 if (station->m_rateIndex < station->m_nRate - 1)
522 {
523 NS_LOG_DEBUG("wploss <= ORI and rate < maxRate => Probabilistic Rate Increase");
524
525 // Recalculate probabilities of lower rates.
526 for (uint8_t i = 0; i <= station->m_rateIndex; i++)
527 {
528 station->m_pdTable[i][station->m_powerLevel] *= m_delta;
529 if (station->m_pdTable[i][station->m_powerLevel] > 1)
530 {
531 station->m_pdTable[i][station->m_powerLevel] = 1;
532 }
533 NS_LOG_DEBUG("pdTable[" << i << "][" << (int)station->m_powerLevel
534 << "] = " << station->m_pdTable[i][station->m_powerLevel]);
535 }
536 double rand = m_uniformRandomVariable->GetValue(0, 1);
537 if (rand < station->m_pdTable[station->m_rateIndex + 1][station->m_powerLevel])
538 {
539 NS_LOG_DEBUG("Increase Rate");
540 station->m_rateIndex++;
541 }
542 }
543 else if (station->m_powerLevel > m_minPowerLevel)
544 {
545 NS_LOG_DEBUG("wploss <= ORI and rate = maxRate => Probabilistic Power Decrease");
546
547 // Recalculate probabilities of higher powers.
548 for (uint32_t i = m_maxPowerLevel; i > station->m_powerLevel; i--)
549 {
550 station->m_pdTable[station->m_rateIndex][i] *= m_delta;
551 if (station->m_pdTable[station->m_rateIndex][i] > 1)
552 {
553 station->m_pdTable[station->m_rateIndex][i] = 1;
554 }
555 NS_LOG_DEBUG("pdTable[" << +station->m_rateIndex << "][" << i
556 << "] = " << station->m_pdTable[station->m_rateIndex][i]);
557 }
558 double rand = m_uniformRandomVariable->GetValue(0, 1);
559 if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])
560 {
561 NS_LOG_DEBUG("Decrease Power");
562 station->m_powerLevel--;
563 }
564 }
565 ResetCountersBasic(station);
566 }
567 else if (bploss > thresholds.m_ori && wploss < thresholds.m_mtl)
568 {
569 if (station->m_powerLevel > m_minPowerLevel)
570 {
571 NS_LOG_DEBUG("loss between ORI and MTL and power > minPowerLevel => Probabilistic "
572 "Power Decrease");
573
574 // Recalculate probabilities of higher powers.
575 for (uint32_t i = m_maxPowerLevel; i >= station->m_powerLevel; i--)
576 {
577 station->m_pdTable[station->m_rateIndex][i] *= m_delta;
578 if (station->m_pdTable[station->m_rateIndex][i] > 1)
579 {
580 station->m_pdTable[station->m_rateIndex][i] = 1;
581 }
582 NS_LOG_DEBUG("pdTable[" << +station->m_rateIndex << "][" << i
583 << "] = " << station->m_pdTable[station->m_rateIndex][i]);
584 }
585 double rand = m_uniformRandomVariable->GetValue(0, 1);
586 if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])
587 {
588 NS_LOG_DEBUG("Decrease Power");
589 station->m_powerLevel--;
590 }
591 ResetCountersBasic(station);
592 }
593 }
594 if (station->m_counter == 0)
595 {
596 ResetCountersBasic(station);
597 }
598}
599
600void
602{
603 NS_LOG_FUNCTION(this << station);
604 if (!station->m_adaptiveRtsOn && station->m_lastFrameFail)
605 {
606 station->m_adaptiveRtsWnd += 2;
607 station->m_rtsCounter = station->m_adaptiveRtsWnd;
608 }
609 else if ((station->m_adaptiveRtsOn && station->m_lastFrameFail) ||
610 (!station->m_adaptiveRtsOn && !station->m_lastFrameFail))
611 {
612 station->m_adaptiveRtsWnd = station->m_adaptiveRtsWnd / 2;
613 station->m_rtsCounter = station->m_adaptiveRtsWnd;
614 }
615 if (station->m_rtsCounter > 0)
616 {
617 station->m_adaptiveRtsOn = true;
618 station->m_rtsCounter--;
619 }
620 else
621 {
622 station->m_adaptiveRtsOn = false;
623 }
624}
625
628{
629 NS_LOG_FUNCTION(this << station << +index);
630 WifiMode mode = GetSupported(station, index);
631 return GetThresholds(station, mode);
632}
633
634} // namespace ns3
Class for representing data rates.
Definition data-rate.h:78
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition double.h:31
Smart pointer class similar to boost::intrusive_ptr.
Time m_sifs
Value of SIFS configured in the device.
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables for probabilistic changes.
uint8_t m_maxPowerLevel
Maximal power level.
void ResetCountersBasic(RrpaaWifiRemoteStation *station)
Reset the counters of the given station.
double m_beta
Beta value for RRPAA (value for calculating ORI threshold).
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Time m_difs
Value of DIFS configured in the device.
WifiRemoteStation * DoCreateStation() const override
bool m_basic
If using the basic algorithm (without RTS/CTS).
void DoInitialize() override
Initialize() implementation.
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
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...
TxTime m_calcTxTime
To hold all the calculated TxTime for all modes.
void CheckInit(RrpaaWifiRemoteStation *station)
Check for initializations.
TracedCallback< double, double, Mac48Address > m_powerChange
The trace source fired when the transmission power change.
uint8_t m_minPowerLevel
Differently form rate, power levels do not depend on the remote station.
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.
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.
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 RunAdaptiveRtsAlgorithm(RrpaaWifiRemoteStation *station)
Run an enhanced algorithm which activates the use of RTS for the given station if the conditions are ...
TracedCallback< DataRate, DataRate, Mac48Address > m_rateChange
The trace source fired when the transmission rate change.
Time m_timeout
Timeout for the RRAA BASIC loss estimation block.
uint32_t m_ackLength
Ack frame length used to calculate mode TxTime (in bytes).
uint8_t m_nPowerLevels
Number of power levels.
WifiRrpaaThresholds GetThresholds(RrpaaWifiRemoteStation *station, WifiMode mode) const
Get the thresholds for the given station and mode.
double m_tau
Tau value for RRPAA (value for calculating EWND size).
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, MHz_u allowedWidth) override
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
double m_gamma
Gamma value for RRPAA (value for pdTable decrements).
Time GetCalcTxTime(WifiMode mode) const
Get the estimated TxTime of a packet with a given mode.
double m_delta
Delta value for RRPAA (value for pdTable increments).
void CheckTimeout(RrpaaWifiRemoteStation *station)
Check if the counter should be reset.
double m_alpha
Alpha value for RRPAA (value for calculating MTL threshold)
bool DoNeedRts(WifiRemoteStation *st, uint32_t size, bool normally) override
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t m_frameLength
Data frame length used to calculate mode TxTime (in bytes).
void AddCalcTxTime(WifiMode mode, Time t)
Add transmission time for the given mode to an internal list.
void InitThresholds(RrpaaWifiRemoteStation *station)
Initialize the thresholds internal list for the given station.
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
static TypeId GetTypeId()
Register this type.
void RunBasicAlgorithm(RrpaaWifiRemoteStation *station)
Find an appropriate rate and power for the given station, using a basic algorithm.
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
represent a single transmission mode
Definition wifi-mode.h:40
WifiModulationClass GetModulationClass() const
Definition wifi-mode.cc:174
uint64_t GetDataRate(MHz_u channelWidth, Time guardInterval, uint8_t nss) const
Definition wifi-mode.cc:111
dBm_u GetPower(uint8_t powerLevel) const
Get the power of the given power level.
Definition wifi-phy.cc:714
hold a list of per-remote-station state.
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
Ptr< WifiPhy > GetPhy() const
Return the WifiPhy.
MHz_u GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
bool GetHtSupported() const
Return whether the device has HT capability support enabled on the link this manager is associated wi...
WifiMode GetNonErpSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether non-ERP mode associated with the specified station at the specified index.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
bool GetUseNonErpProtection() const
Return whether the device supports protection of non-ERP stations.
bool GetVhtSupported() const
Return whether the device has VHT capability support enabled on the link this manager is associated w...
bool GetShortPreambleEnabled() const
Return whether the device uses short PHY preambles.
WifiMode GetSupported(const WifiRemoteStation *station, uint8_t i) const
Return whether mode associated with the specified station at the specified index.
bool GetHeSupported() const
Return whether the device has HE capability support enabled.
virtual void SetupMac(const Ptr< WifiMac > mac)
Set up MAC associated with this device since it is the object that knows the full set of timing param...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1344
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1320
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
@ WIFI_PREAMBLE_LONG
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition boolean.cc:113
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
std::vector< std::vector< double > > RrpaaProbabilitiesTable
List of probabilities.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition nstime.h:1396
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35
Ptr< const AttributeChecker > MakeDoubleChecker()
Definition double.h:82
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition boolean.h:70
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition double.h:32
std::vector< std::pair< WifiRrpaaThresholds, WifiMode > > RrpaaThresholdsTable
List of thresholds for each mode.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition nstime.h:1416
Hold per-remote-station state for RRPAA Wifi manager.
uint32_t m_rtsCounter
Counter for RTS transmission attempts.
uint32_t m_counter
Counter for transmission attempts.
bool m_initialized
For initializing variables.
uint32_t m_nFailed
Number of failed transmission attempts.
uint8_t m_prevPowerLevel
Power level of the previous transmission.
RrpaaThresholdsTable m_thresholds
RRPAA thresholds for this station.
Time m_lastReset
Time of the last reset.
bool m_adaptiveRtsOn
Check if Adaptive RTS mechanism is on.
uint8_t m_prevRateIndex
Rate index of the previous transmission.
bool m_lastFrameFail
Flag if the last frame sent has failed.
uint8_t m_nRate
Number of supported rates.
uint8_t m_powerLevel
Current power level.
RrpaaProbabilitiesTable m_pdTable
Probability table for power and rate changes.
uint8_t m_rateIndex
Current rate index.
uint32_t m_adaptiveRtsWnd
Window size for the Adaptive RTS mechanism.
hold per-remote-station state.
WifiRemoteStationState * m_state
Remote station state.
Mac48Address m_address
Mac48Address of the remote station.
Robust Rate and Power Adaptation Algorithm.
double m_ori
The Opportunistic Rate Increase threshold.
uint32_t m_ewnd
The Estimation Window size.
double m_mtl
The Maximum Tolerable Loss threshold.