|
|
| 30 |
#include "ns3/string.h" |
30 |
#include "ns3/string.h" |
| 31 |
#include "ns3/uinteger.h" |
31 |
#include "ns3/uinteger.h" |
| 32 |
#include "ns3/double.h" |
32 |
#include "ns3/double.h" |
|
|
33 |
#include "ns3/boolean.h" |
| 33 |
#include "ns3/data-rate.h" |
34 |
#include "ns3/data-rate.h" |
| 34 |
#include "ns3/inet-socket-address.h" |
35 |
#include "ns3/inet-socket-address.h" |
| 35 |
#include "ns3/internet-stack-helper.h" |
36 |
#include "ns3/internet-stack-helper.h" |
|
|
| 168 |
wifiChannel.AddPropagationLoss ("ns3::LogDistancePropagationLossModel"); |
169 |
wifiChannel.AddPropagationLoss ("ns3::LogDistancePropagationLossModel"); |
| 169 |
wifiPhy.SetChannel (wifiChannel.Create ()); |
170 |
wifiPhy.SetChannel (wifiChannel.Create ()); |
| 170 |
|
171 |
|
| 171 |
// Add a non-QoS upper mac, and disable rate control |
172 |
// Add an upper mac, and disable rate control |
| 172 |
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
173 |
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
| 173 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
174 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
| 174 |
"DataMode",StringValue (phyMode), |
175 |
"DataMode",StringValue (phyMode), |
| 175 |
"ControlMode",StringValue (phyMode)); |
176 |
"ControlMode",StringValue (phyMode)); |
| 176 |
// Set it to adhoc mode |
177 |
|
| 177 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
178 |
// Set it to adhoc mode (and enable QOS for HT/VHT stations) |
|
|
179 |
if (wifiStandard == WIFI_PHY_STANDARD_80211n_2_4GHZ |
| 180 |
|| wifiStandard == WIFI_PHY_STANDARD_80211n_5GHZ |
| 181 |
|| wifiStandard == WIFI_PHY_STANDARD_80211ac) |
| 182 |
{ |
| 183 |
wifiMac.SetType ("ns3::AdhocWifiMac", |
| 184 |
"QosSupported", BooleanValue (true)); |
| 185 |
} |
| 186 |
else |
| 187 |
{ |
| 188 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
| 189 |
} |
| 178 |
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0)); |
190 |
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c.Get (0)); |
|
|
191 |
|
| 179 |
// This will disable these sending devices from detecting a signal |
192 |
// This will disable these sending devices from detecting a signal |
| 180 |
// so that they do not backoff |
193 |
// so that they do not backoff |
| 181 |
wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) ); |
194 |
wifiPhy.Set ("EnergyDetectionThreshold", DoubleValue (0.0) ); |
|
|
| 274 |
NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2, |
287 |
NS_TEST_ASSERT_MSG_EQ (PERDiff1, PERDiff2, |
| 275 |
"The PER difference due to 1 microsecond difference in arrival shouldn't depend on absolute arrival"); |
288 |
"The PER difference due to 1 microsecond difference in arrival shouldn't depend on absolute arrival"); |
| 276 |
//Now rerun for 11n |
289 |
//Now rerun for 11n |
| 277 |
wifiStandard=WIFI_PHY_STANDARD_80211n_2_4GHZ; |
290 |
wifiStandard = WIFI_PHY_STANDARD_80211n_2_4GHZ; |
| 278 |
// Compute the packet error rate (PER) when delta=0 microseconds. This |
291 |
// Compute the packet error rate (PER) when delta=0 microseconds. This |
| 279 |
// means that the interferer arrives at exactly the same time as the |
292 |
// means that the interferer arrives at exactly the same time as the |
| 280 |
// intended packet |
293 |
// intended packet |