OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 University of Washington | 3 * Copyright (c) 2009 University of Washington |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "ns3/yans-wifi-phy.h" | 43 #include "ns3/yans-wifi-phy.h" |
44 #include "ns3/wifi-net-device.h" | 44 #include "ns3/wifi-net-device.h" |
45 #include "ns3/mobility-helper.h" | 45 #include "ns3/mobility-helper.h" |
46 #include "ns3/constant-position-mobility-model.h" | 46 #include "ns3/constant-position-mobility-model.h" |
47 #include "ns3/simulator.h" | 47 #include "ns3/simulator.h" |
48 | 48 |
49 using namespace ns3; | 49 using namespace ns3; |
50 | 50 |
51 NS_LOG_COMPONENT_DEFINE ("WifiInterferenceTestSuite"); | 51 NS_LOG_COMPONENT_DEFINE ("WifiInterferenceTestSuite"); |
52 | 52 |
| 53 /** |
| 54 * \ingroup ns3wifi-test |
| 55 * \ingroup tests |
| 56 * |
| 57 * \brief Wifi Interference Test Case |
| 58 */ |
53 class WifiInterferenceTestCase : public TestCase | 59 class WifiInterferenceTestCase : public TestCase |
54 { | 60 { |
55 public: | 61 public: |
56 WifiInterferenceTestCase (); | 62 WifiInterferenceTestCase (); |
57 virtual ~WifiInterferenceTestCase (); | 63 virtual ~WifiInterferenceTestCase (); |
58 | 64 |
59 private: | 65 private: |
60 virtual void DoRun (void); | 66 virtual void DoRun (void); |
| 67 /** |
| 68 * Receive packet function |
| 69 * \param socket the socket |
| 70 */ |
61 void ReceivePacket (Ptr<Socket> socket); | 71 void ReceivePacket (Ptr<Socket> socket); |
| 72 /** |
| 73 * Generate traffic function |
| 74 * \param socket the socket |
| 75 * \param pktSize the packet size |
| 76 * \param pktCount the packet count |
| 77 * \param pktInterval the packet interval |
| 78 */ |
62 static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, uint32_t pk
tCount, Time pktInterval); | 79 static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, uint32_t pk
tCount, Time pktInterval); |
| 80 /** |
| 81 * Print end sync function |
| 82 * \param context the context |
| 83 * \param dataRate the data rate |
| 84 * \param snr the SNR |
| 85 * \param per the PER |
| 86 */ |
63 void PrintEndSync (std::string context, uint32_t dataRate, double snr, double
per); | 87 void PrintEndSync (std::string context, uint32_t dataRate, double snr, double
per); |
| 88 /** |
| 89 * Wifi simple interference function |
| 90 * \param phyMode the phy mode |
| 91 * \param Prss the PRSS |
| 92 * \param Irss the IRSS |
| 93 * \param delta the delta |
| 94 * \param PpacketSize the P packet size |
| 95 * \param IpacketSize the I packet size |
| 96 * \param verbose true if verbose |
| 97 * \param internet the internet helper |
| 98 * \param wifiStandard the wifi standard |
| 99 * \returns the interference |
| 100 */ |
64 double WifiSimpleInterference (std::string phyMode, double Prss, double Irss,
double delta, uint32_t PpacketSize,· | 101 double WifiSimpleInterference (std::string phyMode, double Prss, double Irss,
double delta, uint32_t PpacketSize,· |
65 uint32_t IpacketSize, bool verbose, InternetSta
ckHelper internet, WifiPhyStandard wifiStandard); | 102 uint32_t IpacketSize, bool verbose, InternetSta
ckHelper internet, WifiPhyStandard wifiStandard); |
66 double m_PER; | 103 double m_PER; ///< PER |
67 double m_SNR; | 104 double m_SNR; ///< SNR |
68 uint32_t m_DataRate; | 105 uint32_t m_DataRate; ///< data rate |
69 }; | 106 }; |
70 | 107 |
71 // Add some help text to this case to describe what it is intended to test | 108 // Add some help text to this case to describe what it is intended to test |
72 WifiInterferenceTestCase::WifiInterferenceTestCase () | 109 WifiInterferenceTestCase::WifiInterferenceTestCase () |
73 : TestCase ("Test interference calculation when interfering frame exactly over
laps intended frame") | 110 : TestCase ("Test interference calculation when interfering frame exactly over
laps intended frame") |
74 { | 111 { |
75 } | 112 } |
76 | 113 |
77 WifiInterferenceTestCase::~WifiInterferenceTestCase () | 114 WifiInterferenceTestCase::~WifiInterferenceTestCase () |
78 { | 115 { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 341 |
305 PERDiff1 = PER - PER1; | 342 PERDiff1 = PER - PER1; |
306 | 343 |
307 PERDiff2 = PER1 - PER2; | 344 PERDiff2 = PER1 - PER2; |
308 | 345 |
309 NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2,· | 346 NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2,· |
310 "The PER difference due to 1 microsecond difference in
arrival shouldn't depend on absolute arrival"); | 347 "The PER difference due to 1 microsecond difference in
arrival shouldn't depend on absolute arrival"); |
311 | 348 |
312 } | 349 } |
313 | 350 |
| 351 /** |
| 352 * \ingroup ns3wifi-test |
| 353 * \ingroup tests |
| 354 * |
| 355 * \brief Wifi Interference Test Suite |
| 356 */ |
314 class WifiInterferenceTestSuite : public TestSuite | 357 class WifiInterferenceTestSuite : public TestSuite |
315 { | 358 { |
316 public: | 359 public: |
317 WifiInterferenceTestSuite (); | 360 WifiInterferenceTestSuite (); |
318 }; | 361 }; |
319 | 362 |
320 WifiInterferenceTestSuite::WifiInterferenceTestSuite () | 363 WifiInterferenceTestSuite::WifiInterferenceTestSuite () |
321 : TestSuite ("ns3-wifi-interference", UNIT) | 364 : TestSuite ("ns3-wifi-interference", UNIT) |
322 { | 365 { |
323 AddTestCase (new WifiInterferenceTestCase, TestCase::QUICK); | 366 AddTestCase (new WifiInterferenceTestCase, TestCase::QUICK); |
324 } | 367 } |
325 | 368 |
326 static WifiInterferenceTestSuite wifiInterferenceTestSuite; | 369 static WifiInterferenceTestSuite wifiInterferenceTestSuite; ///< the test suite |
327 | 370 |
OLD | NEW |