59 virtual void DoRun (void); |
59 virtual void DoRun (void); |
60 void ReceivePacket (Ptr<Socket> socket); |
60 void ReceivePacket (Ptr<Socket> socket); |
61 static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval); |
61 static void GenerateTraffic (Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval); |
62 void PrintEndSync (std::string context, uint32_t dataRate, double snr, double per); |
62 void PrintEndSync (std::string context, uint32_t dataRate, double snr, double per); |
63 double WifiSimpleInterference (std::string phyMode, double Prss, double Irss, double delta, uint32_t PpacketSize, |
63 double WifiSimpleInterference (std::string phyMode, double Prss, double Irss, double delta, uint32_t PpacketSize, |
64 uint32_t IpacketSize, bool verbose, InternetStackHelper internet); |
64 uint32_t IpacketSize, bool verbose, InternetStackHelper internet, WifiPhyStandard wifiStandard); |
65 double m_PER; |
65 double m_PER; |
66 double m_SNR; |
66 double m_SNR; |
67 uint32_t m_DataRate; |
67 uint32_t m_DataRate; |
68 }; |
68 }; |
69 |
69 |
118 m_SNR = snr; |
118 m_SNR = snr; |
119 m_DataRate = dataRate; |
119 m_DataRate = dataRate; |
120 } |
120 } |
121 |
121 |
122 double |
122 double |
123 WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prss, double Irss, double delta, uint32_t PpacketSize, uint32_t IpacketSize, bool verbose, InternetStackHelper internet) |
123 WifiInterferenceTestCase::WifiSimpleInterference (std::string phyMode,double Prss, double Irss, double delta, uint32_t PpacketSize, uint32_t IpacketSize, bool verbose, InternetStackHelper internet, WifiPhyStandard wifiStandard) |
124 { |
124 { |
125 |
125 |
126 uint32_t numPackets = 1; |
126 uint32_t numPackets = 1; |
127 double interval = 1.0; // seconds |
127 double interval = 1.0; // seconds |
128 double startTime = 10.0; // seconds |
128 double startTime = 10.0; // seconds |
251 InternetStackHelper internet; |
252 InternetStackHelper internet; |
252 |
253 |
253 // Compute the packet error rate (PER) when delta=0 microseconds. This |
254 // Compute the packet error rate (PER) when delta=0 microseconds. This |
254 // means that the interferer arrives at exactly the same time as the |
255 // means that the interferer arrives at exactly the same time as the |
255 // intended packet |
256 // intended packet |
256 PER = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet); |
257 PER = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet,wifiStandard); |
257 |
258 |
258 // Now rerun this test case and compute the PER when the delta time between |
259 // Now rerun this test case and compute the PER when the delta time between |
259 // arrival of the intended frame and interferer is 1 microsecond. |
260 // arrival of the intended frame and interferer is 1 microsecond. |
260 delta = 1; |
261 delta = 1; |
261 PER1 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet); |
262 PER1 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet,wifiStandard); |
262 |
263 |
263 // Now rerun this test case and compute the PER when the delta time between |
264 // Now rerun this test case and compute the PER when the delta time between |
264 // arrival of the intended frame and interferer is 2 microseconds. |
265 // arrival of the intended frame and interferer is 2 microseconds. |
265 delta = 2; |
266 delta = 2; |
266 PER2 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet); |
267 PER2 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet,wifiStandard); |
267 |
268 |
268 double PERDiff1 = PER - PER1; |
269 double PERDiff1 = PER - PER1; |
269 |
270 |
270 double PERDiff2 = PER1 - PER2; |
271 double PERDiff2 = PER1 - PER2; |
271 |
272 |
272 NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2, |
273 NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2, |
273 "The PER difference due to 1 microsecond difference in arrival shouldn't depend on absolute arrival"); |
274 "The PER difference due to 1 microsecond difference in arrival shouldn't depend on absolute arrival"); |
|
275 //Now rerun for 11n |
|
276 wifiStandard=WIFI_PHY_STANDARD_80211n_2_4GHZ; |
|
277 // Compute the packet error rate (PER) when delta=0 microseconds. This |
|
278 // means that the interferer arrives at exactly the same time as the |
|
279 // intended packet |
|
280 PER = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet,wifiStandard); |
|
281 |
|
282 // Now rerun this test case and compute the PER when the delta time between |
|
283 // arrival of the intended frame and interferer is 1 microsecond. |
|
284 delta = 1; |
|
285 PER1 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet,wifiStandard); |
|
286 |
|
287 // Now rerun this test case and compute the PER when the delta time between |
|
288 // arrival of the intended frame and interferer is 2 microseconds. |
|
289 delta = 2; |
|
290 PER2 = WifiSimpleInterference (phyMode,Prss,Irss,delta,PpacketSize,IpacketSize,verbose,internet,wifiStandard); |
|
291 |
|
292 PERDiff1 = PER - PER1; |
|
293 |
|
294 PERDiff2 = PER1 - PER2; |
|
295 |
|
296 NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2, |
|
297 "The PER difference due to 1 microsecond difference in arrival shouldn't depend on absolute arrival"); |
|
298 |
274 } |
299 } |
275 |
300 |
276 class WifiInterferenceTestSuite : public TestSuite |
301 class WifiInterferenceTestSuite : public TestSuite |
277 { |
302 { |
278 public: |
303 public: |