author | Nicola Baldo <nbaldo@cttc.es> |
Fri, 22 Mar 2013 13:14:38 +0100 | |
changeset 9266 | d26408b17360 |
parent 8866 | a44fcd5f9c1d |
child 10139 | 17a71cd49da3 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7143
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
2 |
/* |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 CTTC |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
4 |
* |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
8 |
* |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
13 |
* |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
17 |
* |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
18 |
* Author: Nicola Baldo <nbaldo@cttc.es> |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
19 |
*/ |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
20 |
|
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
21 |
#include <ns3/object.h> |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
22 |
#include <ns3/log.h> |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
23 |
#include <ns3/test.h> |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
24 |
#include <iostream> |
6951
ba9081dbe0ee
Create test module libraries for some modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6852
diff
changeset
|
25 |
#include "ns3/interference-helper.h" |
ba9081dbe0ee
Create test module libraries for some modules
Mitch Watrous <watrous@u.washington.edu>
parents:
6852
diff
changeset
|
26 |
#include "ns3/wifi-phy.h" |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
27 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
28 |
NS_LOG_COMPONENT_DEFINE ("InterferenceHelperTxDurationTest"); |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
29 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
30 |
namespace ns3 { |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
31 |
|
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
32 |
class TxDurationTest : public TestCase |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
33 |
{ |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
34 |
public: |
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
35 |
TxDurationTest (); |
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
36 |
virtual ~TxDurationTest (); |
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
37 |
virtual void DoRun (void); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
38 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
39 |
private: |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
40 |
/** |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
41 |
* Check if the payload tx duration returned by InterferenceHelper |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
42 |
* corresponds to a known value of the pay |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
43 |
* |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
44 |
* @param size size of payload in octets (includes everything after the PLCP header) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
45 |
* @param payloadMode the WifiMode used |
8866
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
7386
diff
changeset
|
46 |
* @param knownDurationMicroSeconds the known payload size |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
47 |
* |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
48 |
* @return true if values correspond, false otherwise |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
49 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
50 |
bool CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t knownDurationMicroSeconds); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
51 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
52 |
/** |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
53 |
* Check if the overall tx duration returned by InterferenceHelper |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
54 |
* corresponds to a known value of the pay |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
55 |
* |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
56 |
* @param size size of payload in octets (includes everything after the PLCP header) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
57 |
* @param payloadMode the WifiMode used |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
58 |
* @param preamble the WifiPreamble used |
8866
a44fcd5f9c1d
Fix easy doxygen warnings
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
7386
diff
changeset
|
59 |
* @param knownDurationMicroSeconds the known value of the transmission |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
60 |
* |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
61 |
* @return true if values correspond, false otherwise |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
62 |
*/ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
63 |
bool CheckTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble, uint32_t knownDurationMicroSeconds); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
64 |
|
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
65 |
}; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
66 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
67 |
|
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
68 |
TxDurationTest::TxDurationTest () |
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
69 |
: TestCase ("Wifi TX Duration") |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
70 |
{ |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
71 |
} |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
72 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
73 |
|
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
74 |
TxDurationTest::~TxDurationTest () |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
75 |
{ |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
76 |
} |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
77 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
78 |
bool |
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
79 |
TxDurationTest::CheckPayloadDuration (uint32_t size, WifiMode payloadMode, uint32_t knownDurationMicroSeconds) |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
80 |
{ |
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
81 |
uint32_t calculatedDurationMicroSeconds = WifiPhy::GetPayloadDurationMicroSeconds (size, payloadMode); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
82 |
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds) |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
83 |
{ |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
84 |
std::cerr << " size=" << size |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
85 |
<< " mode=" << payloadMode |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
86 |
<< " known=" << knownDurationMicroSeconds |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
87 |
<< " calculated=" << calculatedDurationMicroSeconds |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
88 |
<< std::endl; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
89 |
return false; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
90 |
} |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
91 |
return true; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
92 |
} |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
93 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
94 |
bool |
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
95 |
TxDurationTest::CheckTxDuration (uint32_t size, WifiMode payloadMode, WifiPreamble preamble, uint32_t knownDurationMicroSeconds) |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
96 |
{ |
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
97 |
uint32_t calculatedDurationMicroSeconds = WifiPhy::CalculateTxDuration (size, payloadMode, preamble).GetMicroSeconds (); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
98 |
if (calculatedDurationMicroSeconds != knownDurationMicroSeconds) |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
99 |
{ |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
100 |
std::cerr << " size=" << size |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
101 |
<< " mode=" << payloadMode |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
102 |
<< " preamble=" << preamble |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
103 |
<< " known=" << knownDurationMicroSeconds |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
104 |
<< " calculated=" << calculatedDurationMicroSeconds |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
105 |
<< std::endl; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
106 |
return false; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
107 |
} |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
108 |
return true; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
109 |
} |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
110 |
|
6775
0783f42a364b
Make test cases not return bool valuesMake all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6774
diff
changeset
|
111 |
void |
7143
0146b1916bc0
wifi tx duration calculations moved from InterferenceHelper to WifiPhy
Nicola Baldo <nicola@baldo.biz>
parents:
7141
diff
changeset
|
112 |
TxDurationTest::DoRun (void) |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
113 |
{ |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
114 |
bool retval = true; |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
115 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
116 |
// IEEE Std 802.11-2007 Table 18-2 "Example of LENGTH calculations for CCK" |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
117 |
retval = retval |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
118 |
&& CheckPayloadDuration (1023, WifiPhy::GetDsssRate11Mbps (), 744) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
119 |
&& CheckPayloadDuration (1024, WifiPhy::GetDsssRate11Mbps (), 745) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
120 |
&& CheckPayloadDuration (1025, WifiPhy::GetDsssRate11Mbps (), 746) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
121 |
&& CheckPayloadDuration (1026, WifiPhy::GetDsssRate11Mbps (), 747); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
122 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
123 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
124 |
// Similar, but we add PLCP preamble and header durations |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
125 |
// and we test different rates. |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
126 |
// The payload durations for modes other than 11mbb have been |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
127 |
// calculated by hand according to IEEE Std 802.11-2007 18.2.3.5 |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
128 |
retval = retval |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
129 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 744 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
130 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 745 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
131 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 746 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
132 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_SHORT, 747 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
133 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 744 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
134 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 745 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
135 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 746 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
136 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 747 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
137 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1488 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
138 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1490 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
139 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1491 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
140 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_SHORT, 1493 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
141 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1488 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
142 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1490 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
143 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1491 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
144 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate5_5Mbps (), WIFI_PREAMBLE_LONG, 1493 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
145 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4092 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
146 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4096 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
147 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4100 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
148 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_SHORT, 4104 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
149 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4092 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
150 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4096 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
151 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4100 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
152 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate2Mbps (), WIFI_PREAMBLE_LONG, 4104 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
153 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8184 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
154 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8192 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
155 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8200 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
156 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_SHORT, 8208 + 96) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
157 |
&& CheckTxDuration (1023, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8184 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
158 |
&& CheckTxDuration (1024, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8192 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
159 |
&& CheckTxDuration (1025, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8200 + 192) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
160 |
&& CheckTxDuration (1026, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 8208 + 192); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
161 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
162 |
// values from http://mailman.isi.edu/pipermail/ns-developers/2009-July/006226.html |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
163 |
retval = retval && CheckTxDuration (14, WifiPhy::GetDsssRate1Mbps (), WIFI_PREAMBLE_LONG, 304); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
164 |
|
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
165 |
// values from |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
166 |
// http://www.oreillynet.com/pub/a/wireless/2003/08/08/wireless_throughput.html |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6951
diff
changeset
|
167 |
retval = retval |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
168 |
&& CheckTxDuration (1536, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 1310) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
169 |
&& CheckTxDuration (76, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 248) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
170 |
&& CheckTxDuration (14, WifiPhy::GetDsssRate11Mbps (), WIFI_PREAMBLE_LONG, 203) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
171 |
&& CheckTxDuration (1536, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 248) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
172 |
&& CheckTxDuration (76, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 32) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
5320
diff
changeset
|
173 |
&& CheckTxDuration (14, WifiPhy::GetOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 24); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
174 |
|
6597
7fbc895f7361
Bug 852: Support ERP-OFDM rates and thus '802.11g'
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
175 |
// 802.11g durations are same as 802.11a durations but with 6 us signal extension |
7fbc895f7361
Bug 852: Support ERP-OFDM rates and thus '802.11g'
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
176 |
retval = retval |
7fbc895f7361
Bug 852: Support ERP-OFDM rates and thus '802.11g'
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
177 |
&& CheckTxDuration (1536, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 254) |
7fbc895f7361
Bug 852: Support ERP-OFDM rates and thus '802.11g'
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
178 |
&& CheckTxDuration (76, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 38) |
7fbc895f7361
Bug 852: Support ERP-OFDM rates and thus '802.11g'
Dean Armstrong <deanarm@gmail.com>
parents:
6360
diff
changeset
|
179 |
&& CheckTxDuration (14, WifiPhy::GetErpOfdmRate54Mbps (), WIFI_PREAMBLE_LONG, 30); |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
180 |
} |
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
181 |
|
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
182 |
class TxDurationTestSuite : public TestSuite |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
183 |
{ |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
184 |
public: |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
185 |
TxDurationTestSuite (); |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
186 |
}; |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
187 |
|
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
188 |
TxDurationTestSuite::TxDurationTestSuite () |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
189 |
: TestSuite ("devices-wifi-tx-duration", UNIT) |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
190 |
{ |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
8866
diff
changeset
|
191 |
AddTestCase (new TxDurationTest, TestCase::QUICK); |
5320
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
192 |
} |
0fb5a9f1a9c0
wifi unit tests ported to new framework
Pavel Boyko <boyko@iitp.ru>
parents:
4681
diff
changeset
|
193 |
|
6774
034f362af24d
Make all TestSuite instances be static
Mitch Watrous <watrous@u.washington.edu>
parents:
6597
diff
changeset
|
194 |
static TxDurationTestSuite g_txDurationTestSuite; |
7386
2310ed220a61
standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
195 |
} // namespace ns3 |
4681
8558474b6149
made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
196 |