20 #include "ns3/adhoc-wifi-mac.h"
21 #include "ns3/constant-position-mobility-model.h"
22 #include "ns3/fcfs-wifi-queue-scheduler.h"
23 #include "ns3/frame-exchange-manager.h"
24 #include "ns3/interference-helper.h"
26 #include "ns3/simulator.h"
28 #include "ns3/wifi-default-ack-manager.h"
29 #include "ns3/wifi-default-protection-manager.h"
30 #include "ns3/wifi-net-device.h"
31 #include "ns3/yans-wifi-channel.h"
32 #include "ns3/yans-wifi-phy.h"
47 void DoRun()
override;
95 phy->SetInterferenceHelper(interferenceHelper);
105 phy->SetNTxPower(18);
106 phy->SetTxPowerStart(0);
107 phy->SetTxPowerEnd(17);
120 mac->SetAddress(Mac48Address::Allocate());
123 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
127 protectionManager->SetWifiMac(
mac);
128 fem->SetProtectionManager(protectionManager);
131 ackManager->SetWifiMac(
mac);
132 fem->SetAckManager(ackManager);
148 manager->SetAttribute(
"AttemptThreshold",
UintegerValue(15));
149 manager->SetAttribute(
"SuccessThreshold",
UintegerValue(10));
181 "PARF: Initial data rate wrong");
190 for (
int i = 0; i < 10; i++)
192 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
201 "PARF: Incorrect vale of data rate");
210 manager->ReportDataFailed(mpdu);
218 "PARF: Incorrect vale of data rate");
227 for (
int i = 0; i < 7; i++)
229 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
230 manager->ReportDataFailed(mpdu);
232 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
240 "PARF: Incorrect vale of data rate");
249 manager->ReportDataFailed(mpdu);
257 "PARF: Incorrect vale of data rate");
266 manager->ReportDataFailed(mpdu);
267 manager->ReportDataFailed(mpdu);
275 "PARF: Incorrect vale of data rate");
284 for (
int i = 0; i < 10; i++)
286 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
295 "PARF: Incorrect vale of data rate");
304 manager->ReportDataFailed(mpdu);
312 "PARF: Incorrect vale of data rate");
321 for (
int i = 0; i < 10; i++)
323 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
332 "PARF: Incorrect vale of data rate");
341 for (
int i = 0; i < 10; i++)
343 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
352 "PARF: Incorrect vale of data rate");
361 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
363 for (
int i = 0; i < 2; i++)
365 manager->ReportDataFailed(mpdu);
374 "PARF: Incorrect vale of data rate");
377 Simulator::Destroy();
391 manager->SetAttribute(
"SuccessThreshold1",
UintegerValue(3));
392 manager->SetAttribute(
"SuccessThreshold2",
UintegerValue(10));
426 "APARF: Initial data rate wrong");
436 for (
int i = 0; i < 3; i++)
438 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
447 "APARF: Incorrect vale of data rate");
456 manager->ReportDataFailed(mpdu);
464 "APARF: Incorrect vale of data rate");
473 for (
int i = 0; i < 10; i++)
475 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
484 "APARF: Incorrect vale of data rate");
494 for (
int i = 0; i < 3; i++)
496 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
505 "APARF: Incorrect vale of data rate");
514 for (
int i = 0; i < 16 * 3; i++)
516 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
525 "APARF: Incorrect vale of data rate");
534 manager->ReportDataFailed(mpdu);
542 "Incorrect vale of data rate");
551 for (
int i = 0; i < 16; i++)
553 manager->ReportDataFailed(mpdu);
562 "APARF: Incorrect vale of data rate");
572 manager->ReportDataFailed(mpdu);
580 "Incorrect vale of data rate");
589 for (
int i = 0; i < 3; i++)
591 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
600 "APARF: Incorrect vale of data rate");
611 for (
int i = 0; i < 9 * 3; i++)
613 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
622 "APARF: Incorrect vale of data rate");
625 for (
int i = 0; i < 3; i++)
627 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
636 "APARF: Incorrect vale of data rate");
639 Simulator::Destroy();
721 "RRPAA: Initial data rate wrong");
734 for (
int i = 0; i < 6; i++)
736 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
746 "RRPAA: Incorrect vale of data rate");
752 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
761 "RRPAA: Incorrect vale of data rate");
770 for (
int i = 0; i < 4; i++)
772 manager->ReportDataFailed(mpdu);
782 "RRPAA: Incorrect vale of data rate");
785 manager->ReportDataFailed(mpdu);
794 "RRPAA: Incorrect vale of data rate");
803 for (
int i = 0; i < 7; i++)
805 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
815 "RRPAA: Incorrect vale of data rate");
818 for (
int i = 0; i < 10; i++)
820 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
830 "RRPAA: Incorrect vale of data rate");
833 for (
int i = 0; i < 13; i++)
835 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
845 "RRPAA: Incorrect vale of data rate");
848 for (
int i = 0; i < 19; i++)
850 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
860 "RRPAA: Incorrect vale of data rate");
863 for (
int i = 0; i < 23; i++)
865 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
875 "RRPAA: Incorrect vale of data rate");
878 for (
int i = 0; i < 33; i++)
880 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
890 "RRPAA: Incorrect vale of data rate");
893 for (
int i = 0; i < 43; i++)
895 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
905 "RRPAA: Incorrect vale of data rate");
916 for (
int i = 0; i < 49; i++)
918 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
928 "RRPAA: Incorrect vale of data rate");
931 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
940 "RRPAA: Incorrect vale of data rate");
950 for (
int i = 0; i < 16 * 50; i++)
952 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
962 "RRPAA: Incorrect vale of data rate");
971 for (
int i = 0; i < 6; i++)
973 manager->ReportDataFailed(mpdu);
983 "RRPAA: Incorrect vale of data rate");
992 for (
int i = 0; i < 16 * 6; i++)
994 manager->ReportDataFailed(mpdu);
1004 "RRPAA: Incorrect vale of data rate");
1013 for (
int i = 0; i < 6; i++)
1015 manager->ReportDataFailed(mpdu);
1025 "RRPAA: Incorrect vale of data rate");
1032 for (
int i = 0; i < 11; i++)
1034 manager->ReportDataFailed(mpdu);
1044 "RRPAA: Incorrect vale of data rate");
1055 for (
int i = 0; i < 25; i++)
1057 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
1067 "RRPAA: Incorrect vale of data rate");
1070 for (
int i = 0; i < 5; i++)
1072 manager->ReportDataFailed(mpdu);
1082 "RRPAA: Incorrect vale of data rate");
1085 for (
int i = 0; i < 5; i++)
1087 manager->ReportDataFailed(mpdu);
1097 "RRPAA: Incorrect vale of data rate");
1100 for (
int i = 0; i < 25; i++)
1102 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
1112 "RRPAA: Incorrect vale of data rate");
1121 for (
int i = 0; i < 16; i++)
1123 for (
int j = 0; j < 25; j++)
1125 manager->ReportDataOk(mpdu, 0, ackMode, 0, txVector);
1128 for (
int j = 0; j < 5; j++)
1130 manager->ReportDataFailed(mpdu);
1141 "RRPAA: Incorrect vale of data rate");
1144 Simulator::Stop(
Seconds(10.0));
1147 Simulator::Destroy();
1171 :
TestSuite(
"wifi-power-rate-adaptation", UNIT)
Power Rate Adaptation Test.
void TestParf()
Test parf function.
void TestAparf()
Test aparf function.
Ptr< Node > ConfigureNode()
Configure nde function.
PowerRateAdaptationTest()
void DoRun() override
Implementation to actually run this TestCase.
void TestRrpaa()
Test rrpaa function.
ObjectFactory m_manager
manager
Power Rate Adaptation Test Suite.
PowerRateAdaptationTestSuite()
This class can be used to hold variables of floating point type such as 'double' or 'float'.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Hold an unsigned integer type.
represent a single transmission mode
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
void SetMac(const Ptr< WifiMac > mac)
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Ptr< WifiRemoteStationManager > GetRemoteStationManager() const
Ptr< WifiPhy > GetPhy() const
void SetPhy(const Ptr< WifiPhy > phy)
uint16_t GetChannelWidth() const
hold a list of per-remote-station state.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint16_t GetGuardInterval() const
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.
uint8_t GetTxPowerLevel() const
uint16_t GetChannelWidth() const
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static PowerRateAdaptationTestSuite g_powerRateAdaptationTestSuite
the test suite