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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Matías Richart <mrichart@fing.edu.uy>
18 */
19
20#include "rrpaa-wifi-manager.h"
21
22#include "ns3/boolean.h"
23#include "ns3/data-rate.h"
24#include "ns3/double.h"
25#include "ns3/log.h"
26#include "ns3/packet.h"
27#include "ns3/simulator.h"
28#include "ns3/uinteger.h"
29#include "ns3/wifi-mac.h"
30#include "ns3/wifi-phy.h"
31
32NS_LOG_COMPONENT_DEFINE("RrpaaWifiManager");
33
34namespace ns3
35{
36
44{
53 uint8_t m_nRate;
55 uint8_t m_rateIndex;
57 uint8_t m_powerLevel;
60};
61
63
66{
67 static TypeId tid =
68 TypeId("ns3::RrpaaWifiManager")
70 .SetGroupName("Wifi")
71 .AddConstructor<RrpaaWifiManager>()
72 .AddAttribute(
73 "Basic",
74 "If true the RRPAA-BASIC algorithm will be used, otherwise the RRPAA will be used.",
75 BooleanValue(true),
78 .AddAttribute("Timeout",
79 "Timeout for the RRPAA-BASIC loss estimation block.",
83 .AddAttribute("FrameLength",
84 "The Data frame length (in bytes) used for calculating mode TxTime.",
85 UintegerValue(1420),
87 MakeUintegerChecker<uint32_t>())
88 .AddAttribute("AckFrameLength",
89 "The Ack frame length (in bytes) used for calculating mode TxTime.",
90 UintegerValue(14),
92 MakeUintegerChecker<uint32_t>())
93 .AddAttribute("Alpha",
94 "Constant for calculating the MTL threshold.",
95 DoubleValue(1.25),
97 MakeDoubleChecker<double>(1))
98 .AddAttribute("Beta",
99 "Constant for calculating the ORI threshold.",
100 DoubleValue(2),
102 MakeDoubleChecker<double>(1))
103 .AddAttribute("Tau",
104 "Constant for calculating the EWND size.",
105 DoubleValue(0.015),
107 MakeDoubleChecker<double>(0))
108 .AddAttribute("Gamma",
109 "Constant for Probabilistic Decision Table decrements.",
110 DoubleValue(2),
112 MakeDoubleChecker<double>(1))
113 .AddAttribute("Delta",
114 "Constant for Probabilistic Decision Table increments.",
115 DoubleValue(1.0905),
117 MakeDoubleChecker<double>(1))
118 .AddTraceSource("RateChange",
119 "The transmission rate has change.",
121 "ns3::WifiRemoteStationManager::RateChangeTracedCallback")
122 .AddTraceSource("PowerChange",
123 "The transmission power has change.",
125 "ns3::WifiRemoteStationManager::PowerChangeTracedCallback");
126 return tid;
127}
128
130{
131 NS_LOG_FUNCTION(this);
132 m_uniformRandomVariable = CreateObject<UniformRandomVariable>();
133}
134
136{
137 NS_LOG_FUNCTION(this);
138}
139
140int64_t
142{
143 NS_LOG_FUNCTION(this << stream);
145 return 1;
146}
147
148void
150{
151 NS_LOG_FUNCTION(this << phy);
152 m_sifs = phy->GetSifs();
153 m_difs = m_sifs + 2 * phy->GetSlot();
154 m_nPowerLevels = phy->GetNTxPower();
156 m_minPowerLevel = 0;
157 for (const auto& mode : phy->GetModeList())
158 {
159 WifiTxVector txVector;
160 txVector.SetMode(mode);
162 /* Calculate the TX Time of the Data and the corresponding Ack */
163 Time dataTxTime = phy->CalculateTxDuration(m_frameLength, txVector, phy->GetPhyBand());
164 Time ackTxTime = phy->CalculateTxDuration(m_ackLength, txVector, phy->GetPhyBand());
165 NS_LOG_DEBUG("Calculating TX times: Mode= " << mode << " DataTxTime= " << dataTxTime
166 << " AckTxTime= " << ackTxTime);
167 AddCalcTxTime(mode, dataTxTime + ackTxTime);
168 }
170}
171
172void
174{
175 NS_LOG_FUNCTION(this << mac);
177}
178
179void
181{
182 NS_LOG_FUNCTION(this);
183 if (GetHtSupported())
184 {
185 NS_FATAL_ERROR("WifiRemoteStationManager selected does not support HT rates");
186 }
187 if (GetVhtSupported())
188 {
189 NS_FATAL_ERROR("WifiRemoteStationManager selected does not support VHT rates");
190 }
191 if (GetHeSupported())
192 {
193 NS_FATAL_ERROR("WifiRemoteStationManager selected does not support HE rates");
194 }
195}
196
197Time
199{
200 NS_LOG_FUNCTION(this << mode);
201 for (TxTime::const_iterator i = m_calcTxTime.begin(); i != m_calcTxTime.end(); i++)
202 {
203 if (mode == i->second)
204 {
205 return i->first;
206 }
207 }
208 NS_ASSERT(false);
209 return Seconds(0);
210}
211
212void
214{
215 NS_LOG_FUNCTION(this << mode << t);
216 m_calcTxTime.emplace_back(t, mode);
217}
218
221{
222 NS_LOG_FUNCTION(this << station << mode);
223 WifiRrpaaThresholds threshold;
224 for (RrpaaThresholdsTable::const_iterator i = station->m_thresholds.begin();
225 i != station->m_thresholds.end();
226 i++)
227 {
228 if (mode == i->second)
229 {
230 return i->first;
231 }
232 }
233 NS_ABORT_MSG("No thresholds for mode " << mode << " found");
234 return threshold; // Silence compiler warning
235}
236
239{
240 NS_LOG_FUNCTION(this);
242 station->m_adaptiveRtsWnd = 0;
243 station->m_rtsCounter = 0;
244 station->m_adaptiveRtsOn = false;
245 station->m_lastFrameFail = false;
246 station->m_initialized = false;
247 return station;
248}
249
250void
252{
253 NS_LOG_FUNCTION(this << station);
254 if (!station->m_initialized)
255 {
256 // Note: we appear to be doing late initialization of the table
257 // to make sure that the set of supported rates has been initialized
258 // before we perform our own initialization.
259 station->m_nRate = GetNSupported(station);
260 // Initialize at minimal rate and maximal power.
261 station->m_prevRateIndex = 0;
262 station->m_rateIndex = 0;
264 station->m_powerLevel = m_maxPowerLevel;
265 WifiMode mode = GetSupported(station, 0);
266 uint16_t channelWidth = GetChannelWidth(station);
267 DataRate rate = DataRate(mode.GetDataRate(channelWidth));
268 double power = GetPhy()->GetPowerDbm(station->m_powerLevel);
269 m_rateChange(rate, rate, station->m_state->m_address);
270 m_powerChange(power, power, station->m_state->m_address);
271
272 station->m_pdTable =
273 RrpaaProbabilitiesTable(station->m_nRate, std::vector<double>(m_nPowerLevels));
274 NS_LOG_DEBUG("Initializing pdTable");
275 for (uint8_t i = 0; i < station->m_nRate; i++)
276 {
277 for (uint8_t j = 0; j < m_nPowerLevels; j++)
278 {
279 station->m_pdTable[i][j] = 1;
280 }
281 }
282
283 station->m_initialized = true;
284
285 station->m_thresholds = RrpaaThresholdsTable(station->m_nRate);
286 InitThresholds(station);
287 ResetCountersBasic(station);
288 }
289}
290
291void
293{
294 NS_LOG_FUNCTION(this << station);
295 double nextCritical = 0;
296 double nextMtl = 0;
297 double mtl = 0;
298 double ori = 0;
299 for (uint8_t i = 0; i < station->m_nRate; i++)
300 {
301 WifiMode mode = GetSupported(station, i);
302 Time totalTxTime = GetCalcTxTime(mode) + m_sifs + m_difs;
303 if (i == station->m_nRate - 1)
304 {
305 ori = 0;
306 }
307 else
308 {
309 WifiMode nextMode = GetSupported(station, i + 1);
310 Time nextTotalTxTime = GetCalcTxTime(nextMode) + m_sifs + m_difs;
311 nextCritical = 1 - (nextTotalTxTime.GetSeconds() / totalTxTime.GetSeconds());
312 nextMtl = m_alpha * nextCritical;
313 ori = nextMtl / m_beta;
314 }
315 if (i == 0)
316 {
317 mtl = nextMtl;
318 }
320 th.m_ewnd = static_cast<uint32_t>(ceil(m_tau / totalTxTime.GetSeconds()));
321 th.m_ori = ori;
322 th.m_mtl = mtl;
323 station->m_thresholds.emplace_back(th, mode);
324 mtl = nextMtl;
325 NS_LOG_DEBUG(mode << " " << th.m_ewnd << " " << th.m_mtl << " " << th.m_ori);
326 }
327}
328
329void
331{
332 NS_LOG_FUNCTION(this << station);
333 station->m_nFailed = 0;
334 station->m_counter = GetThresholds(station, station->m_rateIndex).m_ewnd;
335 station->m_lastReset = Simulator::Now();
336}
337
338void
340{
341 NS_LOG_FUNCTION(this << st);
342}
343
344void
346{
347 NS_LOG_FUNCTION(this << st);
348 RrpaaWifiRemoteStation* station = static_cast<RrpaaWifiRemoteStation*>(st);
349 CheckInit(station);
350 station->m_lastFrameFail = true;
351 CheckTimeout(station);
352 station->m_counter--;
353 station->m_nFailed++;
354 RunBasicAlgorithm(station);
355}
356
357void
359{
360 NS_LOG_FUNCTION(this << st << rxSnr << txMode);
361}
362
363void
365 double ctsSnr,
366 WifiMode ctsMode,
367 double rtsSnr)
368{
369 NS_LOG_FUNCTION(this << st << ctsSnr << ctsMode << rtsSnr);
370}
371
372void
374 double ackSnr,
375 WifiMode ackMode,
376 double dataSnr,
377 uint16_t dataChannelWidth,
378 uint8_t dataNss)
379{
380 NS_LOG_FUNCTION(this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
381 RrpaaWifiRemoteStation* station = static_cast<RrpaaWifiRemoteStation*>(st);
382 CheckInit(station);
383 station->m_lastFrameFail = false;
384 CheckTimeout(station);
385 station->m_counter--;
386 RunBasicAlgorithm(station);
387}
388
389void
391{
392 NS_LOG_FUNCTION(this << st);
393}
394
395void
397{
398 NS_LOG_FUNCTION(this << st);
399}
400
403{
404 NS_LOG_FUNCTION(this << st << allowedWidth);
405 RrpaaWifiRemoteStation* station = static_cast<RrpaaWifiRemoteStation*>(st);
406 uint16_t channelWidth = GetChannelWidth(station);
407 if (channelWidth > 20 && channelWidth != 22)
408 {
409 channelWidth = 20;
410 }
411 CheckInit(station);
412 WifiMode mode = GetSupported(station, station->m_rateIndex);
413 DataRate rate = DataRate(mode.GetDataRate(channelWidth));
414 DataRate prevRate =
415 DataRate(GetSupported(station, station->m_prevRateIndex).GetDataRate(channelWidth));
416 double power = GetPhy()->GetPowerDbm(station->m_powerLevel);
417 double prevPower = GetPhy()->GetPowerDbm(station->m_prevPowerLevel);
418 if (station->m_prevRateIndex != station->m_rateIndex)
419 {
420 m_rateChange(prevRate, rate, station->m_state->m_address);
421 station->m_prevRateIndex = station->m_rateIndex;
422 }
423 if (station->m_prevPowerLevel != station->m_powerLevel)
424 {
425 m_powerChange(prevPower, power, station->m_state->m_address);
426 station->m_prevPowerLevel = station->m_powerLevel;
427 }
428 return WifiTxVector(
429 mode,
430 station->m_powerLevel,
432 800,
433 1,
434 1,
435 0,
436 channelWidth,
437 GetAggregation(station));
438}
439
442{
443 NS_LOG_FUNCTION(this << st);
444 RrpaaWifiRemoteStation* station = static_cast<RrpaaWifiRemoteStation*>(st);
445 uint16_t channelWidth = GetChannelWidth(station);
446 if (channelWidth > 20 && channelWidth != 22)
447 {
448 channelWidth = 20;
449 }
450 WifiMode mode;
452 {
453 mode = GetSupported(station, 0);
454 }
455 else
456 {
457 mode = GetNonErpSupported(station, 0);
458 }
459 return WifiTxVector(
460 mode,
463 800,
464 1,
465 1,
466 0,
467 channelWidth,
468 GetAggregation(station));
469}
470
471bool
473{
474 NS_LOG_FUNCTION(this << st << size << normally);
475 RrpaaWifiRemoteStation* station = static_cast<RrpaaWifiRemoteStation*>(st);
476 CheckInit(station);
477 if (m_basic)
478 {
479 return normally;
480 }
482 return station->m_adaptiveRtsOn;
483}
484
485void
487{
488 NS_LOG_FUNCTION(this << station);
489 Time d = Simulator::Now() - station->m_lastReset;
490 if (station->m_counter == 0 || d > m_timeout)
491 {
492 ResetCountersBasic(station);
493 }
494}
495
496void
498{
499 NS_LOG_FUNCTION(this << station);
500 WifiRrpaaThresholds thresholds = GetThresholds(station, station->m_rateIndex);
501 double bploss = (static_cast<double>(station->m_nFailed) / thresholds.m_ewnd);
502 double wploss =
503 (static_cast<double>(station->m_counter + station->m_nFailed) / thresholds.m_ewnd);
504 NS_LOG_DEBUG("Best loss prob= " << bploss);
505 NS_LOG_DEBUG("Worst loss prob= " << wploss);
506 if (bploss >= thresholds.m_mtl)
507 {
508 if (station->m_powerLevel < m_maxPowerLevel)
509 {
510 NS_LOG_DEBUG("bploss >= MTL and power < maxPower => Increase Power");
511 station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
512 NS_LOG_DEBUG("pdTable["
513 << +station->m_rateIndex << "][" << station->m_powerLevel << "] = "
514 << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
515 station->m_powerLevel++;
516 ResetCountersBasic(station);
517 }
518 else if (station->m_rateIndex != 0)
519 {
520 NS_LOG_DEBUG("bploss >= MTL and power = maxPower => Decrease Rate");
521 station->m_pdTable[station->m_rateIndex][station->m_powerLevel] /= m_gamma;
522 NS_LOG_DEBUG("pdTable["
523 << +station->m_rateIndex << "][" << station->m_powerLevel << "] = "
524 << station->m_pdTable[station->m_rateIndex][station->m_powerLevel]);
525 station->m_rateIndex--;
526 ResetCountersBasic(station);
527 }
528 else
529 {
530 NS_LOG_DEBUG("bploss >= MTL but already at maxPower and minRate");
531 }
532 }
533 else if (wploss <= thresholds.m_ori)
534 {
535 if (station->m_rateIndex < station->m_nRate - 1)
536 {
537 NS_LOG_DEBUG("wploss <= ORI and rate < maxRate => Probabilistic Rate Increase");
538
539 // Recalculate probabilities of lower rates.
540 for (uint8_t i = 0; i <= station->m_rateIndex; i++)
541 {
542 station->m_pdTable[i][station->m_powerLevel] *= m_delta;
543 if (station->m_pdTable[i][station->m_powerLevel] > 1)
544 {
545 station->m_pdTable[i][station->m_powerLevel] = 1;
546 }
547 NS_LOG_DEBUG("pdTable[" << i << "][" << (int)station->m_powerLevel
548 << "] = " << station->m_pdTable[i][station->m_powerLevel]);
549 }
550 double rand = m_uniformRandomVariable->GetValue(0, 1);
551 if (rand < station->m_pdTable[station->m_rateIndex + 1][station->m_powerLevel])
552 {
553 NS_LOG_DEBUG("Increase Rate");
554 station->m_rateIndex++;
555 }
556 }
557 else if (station->m_powerLevel > m_minPowerLevel)
558 {
559 NS_LOG_DEBUG("wploss <= ORI and rate = maxRate => Probabilistic Power Decrease");
560
561 // Recalculate probabilities of higher powers.
562 for (uint32_t i = m_maxPowerLevel; i > station->m_powerLevel; i--)
563 {
564 station->m_pdTable[station->m_rateIndex][i] *= m_delta;
565 if (station->m_pdTable[station->m_rateIndex][i] > 1)
566 {
567 station->m_pdTable[station->m_rateIndex][i] = 1;
568 }
569 NS_LOG_DEBUG("pdTable[" << +station->m_rateIndex << "][" << i
570 << "] = " << station->m_pdTable[station->m_rateIndex][i]);
571 }
572 double rand = m_uniformRandomVariable->GetValue(0, 1);
573 if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])
574 {
575 NS_LOG_DEBUG("Decrease Power");
576 station->m_powerLevel--;
577 }
578 }
579 ResetCountersBasic(station);
580 }
581 else if (bploss > thresholds.m_ori && wploss < thresholds.m_mtl)
582 {
583 if (station->m_powerLevel > m_minPowerLevel)
584 {
585 NS_LOG_DEBUG("loss between ORI and MTL and power > minPowerLevel => Probabilistic "
586 "Power Decrease");
587
588 // Recalculate probabilities of higher powers.
589 for (uint32_t i = m_maxPowerLevel; i >= station->m_powerLevel; i--)
590 {
591 station->m_pdTable[station->m_rateIndex][i] *= m_delta;
592 if (station->m_pdTable[station->m_rateIndex][i] > 1)
593 {
594 station->m_pdTable[station->m_rateIndex][i] = 1;
595 }
596 NS_LOG_DEBUG("pdTable[" << +station->m_rateIndex << "][" << i
597 << "] = " << station->m_pdTable[station->m_rateIndex][i]);
598 }
599 double rand = m_uniformRandomVariable->GetValue(0, 1);
600 if (rand < station->m_pdTable[station->m_rateIndex][station->m_powerLevel - 1])
601 {
602 NS_LOG_DEBUG("Decrease Power");
603 station->m_powerLevel--;
604 }
605 ResetCountersBasic(station);
606 }
607 }
608 if (station->m_counter == 0)
609 {
610 ResetCountersBasic(station);
611 }
612}
613
614void
616{
617 NS_LOG_FUNCTION(this << station);
618 if (!station->m_adaptiveRtsOn && station->m_lastFrameFail)
619 {
620 station->m_adaptiveRtsWnd += 2;
621 station->m_rtsCounter = station->m_adaptiveRtsWnd;
622 }
623 else if ((station->m_adaptiveRtsOn && station->m_lastFrameFail) ||
624 (!station->m_adaptiveRtsOn && !station->m_lastFrameFail))
625 {
626 station->m_adaptiveRtsWnd = station->m_adaptiveRtsWnd / 2;
627 station->m_rtsCounter = station->m_adaptiveRtsWnd;
628 }
629 if (station->m_rtsCounter > 0)
630 {
631 station->m_adaptiveRtsOn = true;
632 station->m_rtsCounter--;
633 }
634 else
635 {
636 station->m_adaptiveRtsOn = false;
637 }
638}
639
642{
643 NS_LOG_FUNCTION(this << station << +index);
644 WifiMode mode = GetSupported(station, index);
645 return GetThresholds(station, mode);
646}
647
648} // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Class for representing data rates.
Definition: data-rate.h:89
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
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.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station, uint16_t allowedWidth) override
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 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.
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.
double m_tau
Tau value for RRPAA (value for calculating EWND size).
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:199
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
AttributeValue implementation for Time.
Definition: nstime.h:1423
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
Hold an unsigned integer type.
Definition: uinteger.h:45
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
represent a single transmission mode
Definition: wifi-mode.h:51
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:185
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:122
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
Definition: wifi-phy.cc:673
hold a list of per-remote-station state.
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.
uint8_t GetNSupported(const WifiRemoteStation *station) const
Return the number of modes supported by the given station.
Ptr< WifiPhy > GetPhy() const
Return the WifiPhy.
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.
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.
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:66
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Definition: double.h:43
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1444
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1424
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
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.
std::vector< std::vector< double > > RrpaaProbabilitiesTable
List of probabilities.
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
std::vector< std::pair< WifiRrpaaThresholds, WifiMode > > RrpaaThresholdsTable
List of thresholds for each mode.
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.