A Discrete-Event Network Simulator
API
power-rate-adaptation-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Universidad de la República - Uruguay
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  * Author: Matías Richart <mrichart@fing.edu.uy>
19  */
20 
21 #include "ns3/node.h"
22 #include "ns3/wifi-net-device.h"
23 #include "ns3/yans-wifi-channel.h"
24 #include "ns3/yans-wifi-phy.h"
25 #include "ns3/adhoc-wifi-mac.h"
26 #include "ns3/constant-position-mobility-model.h"
27 #include "ns3/simulator.h"
28 #include "ns3/test.h"
29 #include "ns3/frame-exchange-manager.h"
30 #include "ns3/wifi-default-protection-manager.h"
31 #include "ns3/wifi-default-ack-manager.h"
32 
33 using namespace ns3;
34 
42 {
43 public:
45 
46  void DoRun (void) override;
47 private:
49  void TestParf ();
51  void TestAparf ();
53  void TestRrpaa ();
58  Ptr<Node> ConfigureNode ();
59 
61 };
62 
64  : TestCase ("PowerRateAdaptation")
65 {
66 }
67 
70 {
71  /*
72  * Create channel model. Is is necessary to configure correctly the phy layer.
73  */
74  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
75 
76  /*
77  * Create mac layer. We use Adhoc because association is not needed to get supported rates.
78  */
79  Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
80  Ptr<AdhocWifiMac> mac = CreateObject<AdhocWifiMac> ();
81  mac->SetDevice (dev);
82  mac->ConfigureStandard (WIFI_STANDARD_80211a);
83  Ptr<FrameExchangeManager> fem = mac->GetFrameExchangeManager ();
84 
85  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
86  protectionManager->SetWifiMac (mac);
87  fem->SetProtectionManager (protectionManager);
88 
89  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
90  ackManager->SetWifiMac (mac);
91  fem->SetAckManager (ackManager);
92 
93  /*
94  * Create mobility model. Is needed by the phy layer for transmission.
95  */
96  Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
97 
98  /*
99  * Create and configure phy layer.
100  */
101  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
102  phy->SetChannel (channel);
103  phy->SetDevice (dev);
104  phy->SetMobility (mobility);
105  phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211a, WIFI_PHY_BAND_5GHZ);
106 
107  /*
108  * Configure power control parameters.
109  */
110  phy->SetNTxPower (18);
111  phy->SetTxPowerStart (0);
112  phy->SetTxPowerEnd (17);
113 
114  /*
115  * Create manager.
116  */
118 
119  /*
120  * Create and configure node. Add mac and phy layer and the manager.
121  */
122  Ptr<Node> node = CreateObject<Node> ();
123  mac->SetAddress (Mac48Address::Allocate ());
124  dev->SetMac (mac);
125  dev->SetPhy (phy);
126  dev->SetRemoteStationManager (manager);
127  node->AddDevice (dev);
128 
129  return node;
130 }
131 
132 void
134 {
135  m_manager.SetTypeId ("ns3::ParfWifiManager");
136  Ptr<Node> node = ConfigureNode ();
137  Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (node->GetDevice (0));
139 
140  /*
141  * Configure thresholds for rate and power control.
142  */
143  manager->SetAttribute ("AttemptThreshold",UintegerValue (15));
144  manager->SetAttribute ("SuccessThreshold",UintegerValue (10));
145 
146  /*
147  * Create a dummy packet to simulate transmission.
148  */
149  Mac48Address remoteAddress = Mac48Address::Allocate ();
150  WifiMacHeader packetHeader;
151  packetHeader.SetAddr1 (remoteAddress);
152  packetHeader.SetType (WIFI_MAC_DATA);
153  packetHeader.SetQosTid (0);
154  Ptr<Packet> packet = Create<Packet> (10);
155  Ptr<WifiMacQueueItem> mpdu = Create<WifiMacQueueItem> (packet, packetHeader);
156  WifiMode ackMode;
157 
158  /*
159  * To initialize the manager we need to generate a transmission.
160  */
161  Ptr<Packet> p = Create<Packet> ();
162  dev->Send (p, remoteAddress, 1);
163 
164  //-----------------------------------------------------------------------------------------------------
165 
166  /*
167  * Parf initiates with maximal rate and power.
168  */
169  WifiTxVector txVector = manager->GetDataTxVector (packetHeader);
170  WifiMode mode = txVector.GetMode ();
171  int power = (int) txVector.GetTxPowerLevel ();
172 
173  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Initial data rate wrong");
174  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Initial power level wrong");
175 
176  //-----------------------------------------------------------------------------------------------------
177 
178  /*
179  * After 10 consecutive successful transmissions parf increase rate or decrease power.
180  * As we are at maximal rate, the power should be decreased. recoveryPower=true.
181  */
182  for (int i = 0; i < 10; i++)
183  {
184  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
185  }
186 
187  txVector = manager->GetDataTxVector (packetHeader);
188  mode = txVector.GetMode ();
189  power = (int) txVector.GetTxPowerLevel ();
190 
191  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
192  NS_TEST_ASSERT_MSG_EQ (power, 16, "PARF: Incorrect value of power level");
193 
194  //-----------------------------------------------------------------------------------------------------
195 
196  /*
197  * As we are using recovery power, one failure make power increase.
198  *
199  */
200  manager->ReportDataFailed (mpdu);
201 
202  txVector = manager->GetDataTxVector (packetHeader);
203  mode = txVector.GetMode ();
204  power = (int) txVector.GetTxPowerLevel ();
205 
206  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
207  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
208 
209  //-----------------------------------------------------------------------------------------------------
210 
211  /*
212  * After 15 transmissions attempts parf increase rate or decrease power.
213  * As we are at maximal rate, the power should be decreased. recoveryPower=true.
214  */
215  for (int i = 0; i < 7; i++)
216  {
217  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
218  manager->ReportDataFailed (mpdu);
219  }
220  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
221 
222  txVector = manager->GetDataTxVector (packetHeader);
223  mode = txVector.GetMode ();
224  power = (int) txVector.GetTxPowerLevel ();
225 
226  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
227  NS_TEST_ASSERT_MSG_EQ (power, 16, "PARF: Incorrect value of power level");
228 
229  //-----------------------------------------------------------------------------------------------------
230 
231  /*
232  * As we are using recovery power, one failure make power increase. recoveryPower=false.
233  */
234 
235  manager->ReportDataFailed (mpdu);
236 
237  txVector = manager->GetDataTxVector (packetHeader);
238  mode = txVector.GetMode ();
239  power = (int) txVector.GetTxPowerLevel ();
240 
241  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
242  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
243 
244  //-----------------------------------------------------------------------------------------------------
245 
246  /*
247  * After two consecutive fails the rate is decreased or the power increased.
248  * As we are at maximal power, the rate should be decreased.
249  */
250  manager->ReportDataFailed (mpdu);
251  manager->ReportDataFailed (mpdu);
252 
253  txVector = manager->GetDataTxVector (packetHeader);
254  mode = txVector.GetMode ();
255  power = (int) txVector.GetTxPowerLevel ();
256 
257  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 48000000, "PARF: Incorrect vale of data rate");
258  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
259 
260  //-----------------------------------------------------------------------------------------------------
261 
262  /*
263  * After 10 consecutive successful transmissions parf increase rate or decrease power.
264  * As we are not at maximal rate, the rate is increased again. recoveryRate=true.
265  */
266  for (int i = 0; i < 10; i++)
267  {
268  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
269  }
270 
271  txVector = manager->GetDataTxVector (packetHeader);
272  mode = txVector.GetMode ();
273  power = (int) txVector.GetTxPowerLevel ();
274 
275  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
276  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
277 
278  //-----------------------------------------------------------------------------------------------------
279 
280  /*
281  * As we are using recovery rate, one failure make rate decrease. recoveryRate=false.
282  */
283 
284  manager->ReportDataFailed (mpdu);
285 
286  txVector = manager->GetDataTxVector (packetHeader);
287  mode = txVector.GetMode ();
288  power = (int) txVector.GetTxPowerLevel ();
289 
290  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 48000000, "PARF: Incorrect vale of data rate");
291  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
292 
293  //-----------------------------------------------------------------------------------------------------
294 
295  /*
296  * After 10 consecutive successful transmissions parf increase rate or decrease power.
297  * As we are not at maximal rate, the rate is increased again. recoveryRate=true.
298  */
299  for (int i = 0; i < 10; i++)
300  {
301  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
302  }
303 
304  txVector = manager->GetDataTxVector (packetHeader);
305  mode = txVector.GetMode ();
306  power = (int) txVector.GetTxPowerLevel ();
307 
308  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
309  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
310 
311  //-----------------------------------------------------------------------------------------------------
312 
313  /*
314  * After 10 consecutive successful transmissions parf increase rate or decrease power.
315  * As we are at maximal rate, the power is decreased. recoveryRate=false, recoveryPower=true.
316  */
317  for (int i = 0; i < 10; i++)
318  {
319  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
320  }
321 
322  txVector = manager->GetDataTxVector (packetHeader);
323  mode = txVector.GetMode ();
324  power = (int) txVector.GetTxPowerLevel ();
325 
326  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
327  NS_TEST_ASSERT_MSG_EQ (power, 16, "PARF: Incorrect value of power level");
328 
329  //-----------------------------------------------------------------------------------------------------
330 
331  /*
332  * One successful transmissions after a power decrease make recoverPower=false.
333  * So we need two consecutive failures to increase power again.
334  */
335  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
336 
337  for (int i = 0; i < 2; i++)
338  {
339  manager->ReportDataFailed (mpdu);
340  }
341 
342  txVector = manager->GetDataTxVector (packetHeader);
343  mode = txVector.GetMode ();
344  power = (int) txVector.GetTxPowerLevel ();
345 
346  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "PARF: Incorrect vale of data rate");
347  NS_TEST_ASSERT_MSG_EQ (power, 17, "PARF: Incorrect value of power level");
348 
349  Simulator::Destroy ();
350 }
351 
352 void
354 {
355  m_manager.SetTypeId ("ns3::AparfWifiManager");
356  Ptr<Node> node = ConfigureNode ();
357  Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (node->GetDevice (0));
359 
360  /*
361  * Configure thresholds for rate and power control.
362  */
363  manager->SetAttribute ("SuccessThreshold1",UintegerValue (3));
364  manager->SetAttribute ("SuccessThreshold2",UintegerValue (10));
365  manager->SetAttribute ("FailThreshold",UintegerValue (1));
366  manager->SetAttribute ("PowerThreshold",UintegerValue (10));
367 
368  /*
369  * Create a dummy packet to simulate transmission.
370  */
371  Mac48Address remoteAddress = Mac48Address::Allocate ();
372  WifiMacHeader packetHeader;
373  packetHeader.SetAddr1 (remoteAddress);
374  packetHeader.SetType (WIFI_MAC_DATA);
375  packetHeader.SetQosTid (0);
376  Ptr<Packet> packet = Create<Packet> (10);
377  Ptr<WifiMacQueueItem> mpdu = Create<WifiMacQueueItem> (packet, packetHeader);
378  WifiMode ackMode;
379 
380  /*
381  * To initialize the manager we need to generate a transmission.
382  */
383  Ptr<Packet> p = Create<Packet> ();
384  dev->Send (p, remoteAddress, 1);
385 
386  //-----------------------------------------------------------------------------------------------------
387 
388  /*
389  * Aparf initiates with maximal rate and power.
390  */
391  WifiTxVector txVector = manager->GetDataTxVector (packetHeader);
392  WifiMode mode = txVector.GetMode ();
393  int power = (int) txVector.GetTxPowerLevel ();
394 
395  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Initial data rate wrong");
396  NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Initial power level wrong");
397 
398  //-----------------------------------------------------------------------------------------------------
399 
400  /*
401  * As Aparf starts in state High, after 3 consecutive successful transmissions aparf increase rate or decrease power.
402  * As we are at maximal rate, the power should be decreased.
403  * Change to state Spread.
404  */
405  for (int i = 0; i < 3; i++)
406  {
407  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
408  }
409 
410  txVector = manager->GetDataTxVector (packetHeader);
411  mode = txVector.GetMode ();
412  power = (int) txVector.GetTxPowerLevel ();
413 
414  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Incorrect vale of data rate");
415  NS_TEST_ASSERT_MSG_EQ (power, 16, "APARF: Incorrect value of power level");
416 
417  //-----------------------------------------------------------------------------------------------------
418 
419  /*
420  * One failure make the power to be increased again.
421  * Change to state Low.
422  */
423  manager->ReportDataFailed (mpdu);
424 
425  txVector = manager->GetDataTxVector (packetHeader);
426  mode = txVector.GetMode ();
427  power = (int) txVector.GetTxPowerLevel ();
428 
429  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Incorrect vale of data rate");
430  NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Incorrect value of power level");
431 
432  //-----------------------------------------------------------------------------------------------------
433 
434  /*
435  * As we are in state Low we need 10 successful transmissions to increase rate or decrease power.
436  * As we are at maximal rate, the power should be decreased.
437  * Change to state Spread.
438  */
439  for (int i = 0; i < 10; i++)
440  {
441  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
442  }
443 
444  txVector = manager->GetDataTxVector (packetHeader);
445  mode = txVector.GetMode ();
446  power = (int) txVector.GetTxPowerLevel ();
447 
448  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Incorrect vale of data rate");
449  NS_TEST_ASSERT_MSG_EQ (power, 16, "APARF: Incorrect value of power level");
450 
451  //-----------------------------------------------------------------------------------------------------
452 
453  /*
454  * One more successful transmission make to change to state High.
455  * Two more successful transmissions make power decrease.
456  */
457 
458  for (int i = 0; i < 3; i++)
459  {
460  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
461  }
462 
463  txVector = manager->GetDataTxVector (packetHeader);
464  mode = txVector.GetMode ();
465  power = (int) txVector.GetTxPowerLevel ();
466 
467  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Incorrect vale of data rate");
468  NS_TEST_ASSERT_MSG_EQ (power, 15, "APARF: Incorrect value of power level");
469 
470  //-----------------------------------------------------------------------------------------------------
471 
472  /*
473  * As we are in state High we need 3 successful transmissions to increase rate or decrease power.
474  * After 16*3 successful transmissions power is decreased to zero.
475  */
476  for (int i = 0; i < 16 * 3; i++)
477  {
478  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
479  }
480 
481  txVector = manager->GetDataTxVector (packetHeader);
482  mode = txVector.GetMode ();
483  power = (int) txVector.GetTxPowerLevel ();
484 
485  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Incorrect vale of data rate");
486  NS_TEST_ASSERT_MSG_EQ (power, 0, "APARF: Incorrect value of power level");
487 
488  //-----------------------------------------------------------------------------------------------------
489 
490  /*
491  * After one fail the rate is decreased or the power increased.
492  * As we are at minimal power, the power should be increased.
493  */
494  manager->ReportDataFailed (mpdu);
495 
496  txVector = manager->GetDataTxVector (packetHeader);
497  mode = txVector.GetMode ();
498  power = (int) txVector.GetTxPowerLevel ();
499 
500  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "Incorrect vale of data rate");
501  NS_TEST_ASSERT_MSG_EQ (power, 1, "Incorrect value of power level");
502 
503  //-----------------------------------------------------------------------------------------------------
504 
505  /*
506  * After one fail the rate is decreased or the power increased.
507  * After 16 failed transmissions power is increase to 17.
508  */
509  for (int i = 0; i < 16; i++)
510  {
511  manager->ReportDataFailed (mpdu);
512  }
513 
514  txVector = manager->GetDataTxVector (packetHeader);
515  mode = txVector.GetMode ();
516  power = (int) txVector.GetTxPowerLevel ();
517 
518  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Incorrect vale of data rate");
519  NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Incorrect value of power level");
520 
521  //-----------------------------------------------------------------------------------------------------
522 
523  /*
524  * After one fail the rate is decreased or the power increased.
525  * As we are at maximal power, the rate should be decreased.
526  * Set critical rate to 54 Mbps.
527  */
528  manager->ReportDataFailed (mpdu);
529 
530  txVector = manager->GetDataTxVector (packetHeader);
531  mode = txVector.GetMode ();
532  power = (int) txVector.GetTxPowerLevel ();
533 
534  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 48000000, "Incorrect vale of data rate");
535  NS_TEST_ASSERT_MSG_EQ (power, 17, "Incorrect value of power level");
536 
537  //-----------------------------------------------------------------------------------------------------
538 
539  /*
540  * As we are in state High we need 3 successful transmissions to increase rate or decrease power.
541  * As rate critical is set, after 3 successful transmissions power is decreased.
542  */
543  for (int i = 0; i < 3; i++)
544  {
545  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
546  }
547 
548  txVector = manager->GetDataTxVector (packetHeader);
549  mode = txVector.GetMode ();
550  power = (int) txVector.GetTxPowerLevel ();
551 
552  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 48000000, "APARF: Incorrect vale of data rate");
553  NS_TEST_ASSERT_MSG_EQ (power, 16, "APARF: Incorrect value of power level");
554 
555  //-----------------------------------------------------------------------------------------------------
556 
557  /*
558  * As we are in state High we need 3 successful transmissions to increase rate or decrease power.
559  * After 10 power changes critical rate is reset.
560  * So after 10*3 successful transmissions critical rate is set to 0.
561  * And 3 successful transmissions more will make power increase to maximum and rate increase to the critical rate.
562  */
563  for (int i = 0; i < 9 * 3; i++)
564  {
565  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
566  }
567 
568  txVector = manager->GetDataTxVector (packetHeader);
569  mode = txVector.GetMode ();
570  power = (int) txVector.GetTxPowerLevel ();
571 
572  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 48000000, "APARF: Incorrect vale of data rate");
573  NS_TEST_ASSERT_MSG_EQ (power, 7, "APARF: Incorrect value of power level");
574 
575  for (int i = 0; i < 3; i++)
576  {
577  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
578  }
579 
580  txVector = manager->GetDataTxVector (packetHeader);
581  mode = txVector.GetMode ();
582  power = (int) txVector.GetTxPowerLevel ();
583 
584  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth ()), 54000000, "APARF: Incorrect vale of data rate");
585  NS_TEST_ASSERT_MSG_EQ (power, 17, "APARF: Incorrect value of power level");
586 
587  Simulator::Destroy ();
588 }
589 
590 void
592 {
593  m_manager.SetTypeId ("ns3::RrpaaWifiManager");
594  Ptr<Node> node = ConfigureNode ();
595  Ptr<WifiNetDevice> dev = DynamicCast<WifiNetDevice> (node->GetDevice (0));
597 
598  /*
599  * Configure constants for rate and power control.
600  */
601  manager->SetAttribute ("Basic", BooleanValue (true));
602  manager->SetAttribute ("Alpha", DoubleValue (1.25));
603  manager->SetAttribute ("Beta", DoubleValue (2));
604  manager->SetAttribute ("Tau", DoubleValue (0.015));
605  /*
606  * Constants for the Probabilistic Decision Table.
607  * We set both to 1 to avoid random behaviour in tests.
608  */
609  manager->SetAttribute ("Gamma", DoubleValue (1));
610  manager->SetAttribute ("Delta", DoubleValue (1));
611 
612  /*
613  * Create a dummy packet to simulate transmission.
614  */
615  Mac48Address remoteAddress = Mac48Address::Allocate ();
616  WifiMacHeader packetHeader;
617  packetHeader.SetAddr1 (remoteAddress);
618  packetHeader.SetType (WIFI_MAC_DATA);
619  packetHeader.SetQosTid (0);
620  Ptr<Packet> packet = Create<Packet> (10);
621  Ptr<WifiMacQueueItem> mpdu = Create<WifiMacQueueItem> (packet, packetHeader);
622  WifiMode ackMode;
623 
624  /*
625  * To initialize the manager we need to generate a transmission.
626  */
627  Ptr<Packet> p = Create<Packet> ();
628  dev->Send (p, remoteAddress, 1);
629 
656  //-----------------------------------------------------------------------------------------------------
657 
658  /*
659  * RRPAA initiates with minimal rate and maximal power.
660  */
661  WifiTxVector txVector = manager->GetDataTxVector (packetHeader);
662  WifiMode mode = txVector.GetMode ();
663  int power = (int) txVector.GetTxPowerLevel ();
664 
665  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 6000000, "RRPAA: Initial data rate wrong"); //802.11a minimal rate is 6Mbps
666  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Initial power level wrong");
667 
668  //-----------------------------------------------------------------------------------------------------
669 
670  /*
671  * As RRPAA starts with the 6Mbps rate, 7 successful transmissions are needed for RRPAA to increase rate.
672  * 1/8 = 0.125
673  */
674 
678  for (int i = 0; i < 6; i++)
679  {
680  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
681  }
682 
683  txVector = manager->GetDataTxVector (packetHeader);
684  mode = txVector.GetMode ();
685  power = (int) txVector.GetTxPowerLevel ();
686 
687  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 6000000, "RRPAA: Incorrect vale of data rate");
688  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
689 
693  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
694 
695  txVector = manager->GetDataTxVector (packetHeader);
696  mode = txVector.GetMode ();
697  power = (int) txVector.GetTxPowerLevel ();
698 
699  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 9000000, "RRPAA: Incorrect vale of data rate");
700  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
701 
702  //-----------------------------------------------------------------------------------------------------
703 
704  /*
705  * 5 failures are needed to make the rate decrease again.
706  * 5/11 = 0.45
707  */
708  for (int i = 0; i < 4; i++)
709  {
710  manager->ReportDataFailed (mpdu);
711  }
712 
713  txVector = manager->GetDataTxVector (packetHeader);
714  mode = txVector.GetMode ();
715  power = (int) txVector.GetTxPowerLevel ();
716 
717  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 9000000, "RRPAA: Incorrect vale of data rate");
718  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
719 
720  manager->ReportDataFailed (mpdu);
721 
722  txVector = manager->GetDataTxVector (packetHeader);
723  mode = txVector.GetMode ();
724  power = (int) txVector.GetTxPowerLevel ();
725 
726  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 6000000, "RRPAA: Incorrect vale of data rate");
727  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
728 
729  //-----------------------------------------------------------------------------------------------------
730 
735  for (int i = 0; i < 7; i++)
736  {
737  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
738  }
739 
740  txVector = manager->GetDataTxVector (packetHeader);
741  mode = txVector.GetMode ();
742  power = (int) txVector.GetTxPowerLevel ();
743 
744  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 9000000, "RRPAA: Incorrect vale of data rate");
745  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
746 
747  for (int i = 0; i < 10; i++)
748  {
749  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
750  }
751 
752  txVector = manager->GetDataTxVector (packetHeader);
753  mode = txVector.GetMode ();
754  power = (int) txVector.GetTxPowerLevel ();
755 
756  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 12000000, "RRPAA: Incorrect vale of data rate");
757  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
758 
759  for (int i = 0; i < 13; i++)
760  {
761  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
762  }
763 
764  txVector = manager->GetDataTxVector (packetHeader);
765  mode = txVector.GetMode ();
766  power = (int) txVector.GetTxPowerLevel ();
767 
768  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 18000000, "RRPAA: Incorrect vale of data rate");
769  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
770 
771  for (int i = 0; i < 19; i++)
772  {
773  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
774  }
775 
776  txVector = manager->GetDataTxVector (packetHeader);
777  mode = txVector.GetMode ();
778  power = (int) txVector.GetTxPowerLevel ();
779 
780  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 24000000, "RRPAA: Incorrect vale of data rate");
781  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
782 
783  for (int i = 0; i < 23; i++)
784  {
785  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
786  }
787 
788  txVector = manager->GetDataTxVector (packetHeader);
789  mode = txVector.GetMode ();
790  power = (int) txVector.GetTxPowerLevel ();
791 
792  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 36000000, "RRPAA: Incorrect vale of data rate");
793  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
794 
795  for (int i = 0; i < 33; i++)
796  {
797  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
798  }
799 
800  txVector = manager->GetDataTxVector (packetHeader);
801  mode = txVector.GetMode ();
802  power = (int) txVector.GetTxPowerLevel ();
803 
804  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 48000000, "RRPAA: Incorrect vale of data rate");
805  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
806 
807  for (int i = 0; i < 43; i++)
808  {
809  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
810  }
811 
812  txVector = manager->GetDataTxVector (packetHeader);
813  mode = txVector.GetMode ();
814  power = (int) txVector.GetTxPowerLevel ();
815 
816  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 54000000, "RRPAA: Incorrect vale of data rate");
817  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
818 
819  //-----------------------------------------------------------------------------------------------------
820 
827  for (int i = 0; i < 49; i++)
828  {
829  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
830  }
831 
832  txVector = manager->GetDataTxVector (packetHeader);
833  mode = txVector.GetMode ();
834  power = (int) txVector.GetTxPowerLevel ();
835 
836  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 54000000, "RRPAA: Incorrect vale of data rate");
837  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
838 
839  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
840 
841  txVector = manager->GetDataTxVector (packetHeader);
842  mode = txVector.GetMode ();
843  power = (int) txVector.GetTxPowerLevel ();
844 
845  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 54000000, "RRPAA: Incorrect vale of data rate");
846  NS_TEST_ASSERT_MSG_EQ (power, 16, "RRPAA: Incorrect value of power level");
847 
848  //-----------------------------------------------------------------------------------------------------
849 
855  for (int i = 0; i < 16 * 50; i++)
856  {
857  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
858  }
859 
860  txVector = manager->GetDataTxVector (packetHeader);
861  mode = txVector.GetMode ();
862  power = (int) txVector.GetTxPowerLevel ();
863 
864  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 54000000, "RRPAA: Incorrect vale of data rate");
865  NS_TEST_ASSERT_MSG_EQ (power, 0, "RRPAA: Incorrect value of power level");
866 
867  //-----------------------------------------------------------------------------------------------------
868 
873  for (int i = 0; i < 6; i++)
874  {
875  manager->ReportDataFailed (mpdu);
876  }
877 
878  txVector = manager->GetDataTxVector (packetHeader);
879  mode = txVector.GetMode ();
880  power = (int) txVector.GetTxPowerLevel ();
881 
882  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 54000000, "RRPAA: Incorrect vale of data rate");
883  NS_TEST_ASSERT_MSG_EQ (power, 1, "RRPAA: Incorrect value of power level");
884 
885  //-----------------------------------------------------------------------------------------------------
886 
887  /*
888  * After 16*6 failed transmissions power is increase to 17.
889  */
890 
891  for (int i = 0; i < 16 * 6; i++)
892  {
893  manager->ReportDataFailed (mpdu);
894  }
895 
896  txVector = manager->GetDataTxVector (packetHeader);
897  mode = txVector.GetMode ();
898  power = (int) txVector.GetTxPowerLevel ();
899 
900  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 54000000, "RRPAA: Incorrect vale of data rate");
901  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
902 
903  //-----------------------------------------------------------------------------------------------------
904 
905  /*
906  * After 6 more failures the rate should be decreased.
907  */
908 
909  for (int i = 0; i < 6; i++)
910  {
911  manager->ReportDataFailed (mpdu);
912  }
913 
914  txVector = manager->GetDataTxVector (packetHeader);
915  mode = txVector.GetMode ();
916  power = (int) txVector.GetTxPowerLevel ();
917 
918  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 48000000, "RRPAA: Incorrect vale of data rate");
919  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
920 
921  /*
922  * Now 11 failures are needed to decrease rate again.
923  */
924 
925  for (int i = 0; i < 11; i++)
926  {
927  manager->ReportDataFailed (mpdu);
928  }
929 
930  txVector = manager->GetDataTxVector (packetHeader);
931  mode = txVector.GetMode ();
932  power = (int) txVector.GetTxPowerLevel ();
933 
934  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 36000000, "RRPAA: Incorrect vale of data rate");
935  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
936 
937  //-----------------------------------------------------------------------------------------------------
938 
939  /*
940  * Test power decrement when loss probability is between MTL and ORI.
941  * As we are at rate 36 Mbps we need at least 25 successful transmissions
942  * and 5 failures.
943  */
944 
945  for (int i = 0; i < 25; i++)
946  {
947  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
948  }
949 
950  txVector = manager->GetDataTxVector (packetHeader);
951  mode = txVector.GetMode ();
952  power = (int) txVector.GetTxPowerLevel ();
953 
954  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 36000000, "RRPAA: Incorrect vale of data rate");
955  NS_TEST_ASSERT_MSG_EQ (power, 17, "RRPAA: Incorrect value of power level");
956 
957  for (int i = 0; i < 5; i++)
958  {
959  manager->ReportDataFailed (mpdu);
960  }
961 
962  txVector = manager->GetDataTxVector (packetHeader);
963  mode = txVector.GetMode ();
964  power = (int) txVector.GetTxPowerLevel ();
965 
966  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 36000000, "RRPAA: Incorrect vale of data rate");
967  NS_TEST_ASSERT_MSG_EQ (power, 16, "RRPAA: Incorrect value of power level");
968 
969  for (int i = 0; i < 5; i++)
970  {
971  manager->ReportDataFailed (mpdu);
972  }
973 
974  txVector = manager->GetDataTxVector (packetHeader);
975  mode = txVector.GetMode ();
976  power = (int) txVector.GetTxPowerLevel ();
977 
978  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 36000000, "RRPAA: Incorrect vale of data rate");
979  NS_TEST_ASSERT_MSG_EQ (power, 16, "RRPAA: Incorrect value of power level");
980 
981  for (int i = 0; i < 25; i++)
982  {
983  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
984  }
985 
986  txVector = manager->GetDataTxVector (packetHeader);
987  mode = txVector.GetMode ();
988  power = (int) txVector.GetTxPowerLevel ();
989 
990  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 36000000, "RRPAA: Incorrect vale of data rate");
991  NS_TEST_ASSERT_MSG_EQ (power, 15, "RRPAA: Incorrect value of power level");
992 
993  //-----------------------------------------------------------------------------------------------------
994 
995  /*
996  * Repeat the previous test until power 0 is reached.
997  */
998 
999  for (int i = 0; i < 16; i++)
1000  {
1001  for (int j = 0; j < 25; j++)
1002  {
1003  manager->ReportDataOk (mpdu, 0, ackMode, 0, txVector);
1004  }
1005 
1006  for (int j = 0; j < 5; j++)
1007  {
1008  manager->ReportDataFailed (mpdu);
1009  }
1010  }
1011 
1012  txVector = manager->GetDataTxVector (packetHeader);
1013  mode = txVector.GetMode ();
1014  power = (int) txVector.GetTxPowerLevel ();
1015 
1016  NS_TEST_ASSERT_MSG_EQ (mode.GetDataRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), 1), 36000000, "RRPAA: Incorrect vale of data rate");
1017  NS_TEST_ASSERT_MSG_EQ (power, 0, "RRPAA: Incorrect value of power level");
1018 
1019  Simulator::Stop (Seconds (10.0));
1020 
1021  Simulator::Run ();
1022  Simulator::Destroy ();
1023 
1024 }
1025 
1026 void
1028 {
1029 
1030  TestParf ();
1031  TestAparf ();
1032  TestRrpaa ();
1033 }
1034 
1042 {
1043 public:
1045 };
1046 
1048  : TestSuite ("wifi-power-rate-adaptation", UNIT)
1049 {
1050  AddTestCase (new PowerRateAdaptationTest, TestCase::QUICK);
1051 }
1052 
PowerRateAdaptationTest::TestRrpaa
void TestRrpaa()
Test rrpaa function.
Definition: power-rate-adaptation-test.cc:591
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiNetDevice::SetMac
void SetMac(const Ptr< WifiMac > mac)
Definition: wifi-net-device.cc:180
ns3::FrameExchangeManager::SetAckManager
virtual void SetAckManager(Ptr< WifiAckManager > ackManager)
Set the Acknowledgment Manager to use.
Definition: frame-exchange-manager.cc:117
ns3::WIFI_PHY_BAND_5GHZ
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
PowerRateAdaptationTestSuite::PowerRateAdaptationTestSuite
PowerRateAdaptationTestSuite()
Definition: power-rate-adaptation-test.cc:1047
third.channel
channel
Definition: third.py:92
ns3::WifiProtectionManager::SetWifiMac
void SetWifiMac(Ptr< RegularWifiMac > mac)
Set the MAC which is using this Protection Manager.
Definition: wifi-protection-manager.cc:56
ns3::WifiRemoteStationManager
hold a list of per-remote-station state.
Definition: wifi-remote-station-manager.h:121
PowerRateAdaptationTest::ConfigureNode
Ptr< Node > ConfigureNode()
Configure nde function.
Definition: power-rate-adaptation-test.cc:69
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
PowerRateAdaptationTest
Power Rate Adaptation Test.
Definition: power-rate-adaptation-test.cc:42
ns3::FrameExchangeManager::SetProtectionManager
virtual void SetProtectionManager(Ptr< WifiProtectionManager > protectionManager)
Set the Protection Manager to use.
Definition: frame-exchange-manager.cc:104
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
PowerRateAdaptationTestSuite
Power Rate Adaptation Test Suite.
Definition: power-rate-adaptation-test.cc:1042
g_powerRateAdaptationTestSuite
static PowerRateAdaptationTestSuite g_powerRateAdaptationTestSuite
the test suite
Definition: power-rate-adaptation-test.cc:1053
third.mac
mac
Definition: third.py:99
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
PowerRateAdaptationTest::PowerRateAdaptationTest
PowerRateAdaptationTest()
Definition: power-rate-adaptation-test.cc:63
ns3::TestCase
encapsulates test code
Definition: test.h:1154
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition: wifi-mac-header.cc:108
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::Ptr< Node >
ns3::WifiNetDevice::Send
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Definition: wifi-net-device.cc:319
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::WifiAckManager::SetWifiMac
void SetWifiMac(Ptr< RegularWifiMac > mac)
Set the MAC which is using this Acknowledgment Manager.
Definition: wifi-ack-manager.cc:57
ns3::WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211a
Definition: wifi-standards.h:127
ns3::Node::GetDevice
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:144
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition: object-factory.h:48
ns3::WIFI_PHY_STANDARD_80211a
@ WIFI_PHY_STANDARD_80211a
OFDM PHY (Clause 17)
Definition: wifi-standards.h:37
ns3::WifiNetDevice::GetRemoteStationManager
Ptr< WifiRemoteStationManager > GetRemoteStationManager(void) const
Definition: wifi-net-device.cc:213
PowerRateAdaptationTest::m_manager
ObjectFactory m_manager
manager
Definition: power-rate-adaptation-test.cc:60
ns3::WifiTxVector::GetChannelWidth
uint16_t GetChannelWidth(void) const
Definition: wifi-tx-vector.cc:153
ns3::WifiRemoteStationManager::GetDataTxVector
WifiTxVector GetDataTxVector(const WifiMacHeader &header)
Definition: wifi-remote-station-manager.cc:535
PowerRateAdaptationTest::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: power-rate-adaptation-test.cc:1027
PowerRateAdaptationTest::TestParf
void TestParf()
Test parf function.
Definition: power-rate-adaptation-test.cc:133
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
ns3::WifiRemoteStationManager::ReportDataFailed
void ReportDataFailed(Ptr< const WifiMacQueueItem > mpdu)
Should be invoked whenever the AckTimeout associated to a transmission attempt expires.
Definition: wifi-remote-station-manager.cc:840
ns3::WifiTxVector::GetGuardInterval
uint16_t GetGuardInterval(void) const
Definition: wifi-tx-vector.cc:159
NS_TEST_ASSERT_MSG_EQ
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition: test.h:166
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::WifiNetDevice::SetRemoteStationManager
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Definition: wifi-net-device.cc:194
ns3::WIFI_MAC_DATA
@ WIFI_MAC_DATA
Definition: wifi-mac-header.h:62
ns3::WifiTxVector::GetTxPowerLevel
uint8_t GetTxPowerLevel(void) const
Definition: wifi-tx-vector.cc:141
ns3::WifiMacHeader::SetType
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Definition: wifi-mac-header.cc:132
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition: object-factory.cc:40
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::ObjectFactory::Create
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Definition: object-factory.cc:98
ns3::WifiRemoteStationManager::ReportDataOk
void ReportDataOk(Ptr< const WifiMacQueueItem > mpdu, double ackSnr, WifiMode ackMode, double dataSnr, WifiTxVector dataTxVector)
Should be invoked whenever we receive the ACK associated to a data packet we just sent.
Definition: wifi-remote-station-manager.cc:872
ns3::WifiMode::GetDataRate
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:100
ns3::WifiMacHeader::SetQosTid
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Definition: wifi-mac-header.cc:352
ns3::WifiTxVector::GetMode
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
Definition: wifi-tx-vector.cc:111
third.mobility
mobility
Definition: third.py:108
ns3::WifiNetDevice::SetPhy
void SetPhy(const Ptr< WifiPhy > phy)
Definition: wifi-net-device.cc:187
third.phy
phy
Definition: third.py:93
PowerRateAdaptationTest::TestAparf
void TestAparf()
Test aparf function.
Definition: power-rate-adaptation-test.cc:353