Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
- 2 /*
- 3 * Copyright (c) 2016 Sébastien Deronne
- 4 *
- 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
- 7 * published by the Free Software Foundation;
- 8 *
- 9 * This program is distributed in the hope that it will be useful,
- 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
- 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- 12 * GNU General Public License for more details.
- 13 *
- 14 * You should have received a copy of the GNU General Public License
- 15 * along with this program; if not, write to the Free Software
- 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- 17 *
- 18 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
- 19 */
- 20
- 21 #include "ns3/command-line.h"
- 22 #include "ns3/config.h"
- 23 #include "ns3/string.h"
- 24 #include "ns3/pointer.h"
- 25 #include "ns3/log.h"
- 26 #include "ns3/yans-wifi-helper.h"
- 27 #include "ns3/ssid.h"
- 28 #include "ns3/mobility-helper.h"
- 29 #include "ns3/internet-stack-helper.h"
- 30 #include "ns3/ipv4-address-helper.h"
- 31 #include "ns3/udp-client-server-helper.h"
- 32 #include "ns3/on-off-helper.h"
- 33 #include "ns3/yans-wifi-channel.h"
- 34 #include "ns3/wifi-net-device.h"
- 35 #include "ns3/qos-txop.h"
- 36 #include "ns3/wifi-mac.h"
- 37 #include "ns3/packet-sink-helper.h"
- 38 #include "ns3/packet-sink.h"
- 39
- 40 // This example shows how to configure mixed networks (i.e. mixed b/g and HT/non-HT) and how are performance in several scenarios.
- 41 //
- 42 // The example compares first g only and mixed b/g cases with various configurations depending on the following parameters:
- 43 // - protection mode that is configured on the AP;
- 44 // - whether short PLCP is supported by the 802.11b station;
- 45 // - whether short slot time is supported by both the 802.11g station and the AP.
- 46 //
- 47 // The example then compares HT only and mixed HT/non-HT cases with various configurations depending on the following parameters:
- 48 // - whether HT GF is supported by the AP;
- 49 // - whether HT GF is supported by all HT stations;
- 50 // - whether RIFS is enabled on HT stations;
- 51 // - RIFS mode that is configured on the AP.
- 52 //
- 53 // The output results show that the presence of an 802.11b station strongly affects 802.11g performance.
- 54 // Protection mechanisms ensure that the NAV value of 802.11b stations is set correctly in case of 802.11g transmissions.
- 55 // In practice, those protection mechanism add a lot of overhead, resulting in reduced performance. CTS-To-Self introduces
- 56 // less overhead than Rts-Cts, but is not heard by hidden stations (and is thus generally only recommended as a protection
- 57 // mechanism for access points). Since short slot time is disabled once an 802.11b station enters the network, benefits from
- 58 // short slot time are only observed in a g only configuration.
- 59 //
- 60 // HT and mixed-HT results show that HT GF permits to slightly increase performance when all HT stations support GF mode, and RIFS also permits
- 61 // such a small improvement when no non-HT station is present. In order to show the benefit offered by RIFS, aggregation has been disabled and
- 62 // Block ACK together with a TXOP duration of 3008 microseconds have been set.
- 63 //
- 64 // The user can also select the payload size and can choose either an UDP or a TCP connection.
- 65 // Example: ./waf --run "mixed-network --isUdp=1"
- 66
- 67 using namespace ns3;
- 68
- 69 NS_LOG_COMPONENT_DEFINE ("MixedNetwork");
- 70
- 71 struct Parameters
- 72 {
- 73 std::string testName;
- 74 bool enableErpProtection;
- 75 std::string erpProtectionMode;
- 76 bool enableShortSlotTime;
- 77 bool enableShortPlcpPreamble;
- 78 WifiPhyStandard apType;
- 79 bool apSupportsGreenfield;
- 80 bool rifsSupported;
- 81 bool rifsMode;
- 82 uint32_t nWifiB;
- 83 bool bHasTraffic;
- 84 uint32_t nWifiG;
- 85 bool gHasTraffic;
- 86 uint32_t nWifiNNonGreenfield;
- 87 bool nNonGreenfieldHasTraffic;
- 88 uint32_t nWifiNGreenfield;
- 89 bool nGreenfieldHasTraffic;
- 90 bool isUdp;
- 91 uint32_t payloadSize;
- 92 double simulationTime;
- 93 };
- 94
- 95 class Experiment
- 96 {
- 97 public:
- 98 Experiment ();
- 99 double Run (Parameters params);
- 100 };
- 101
- 102 Experiment::Experiment ()
- 103 {
- 104 }
- 105
- 106 double
- 107 Experiment::Run (Parameters params)
- 108 {
- 109 std::string apTypeString;
- 110 if (params.apType == WIFI_PHY_STANDARD_80211g)
- 111 {
- 112 apTypeString = "WIFI_PHY_STANDARD_80211g";
- 113 }
- 114 else if (params.apType == WIFI_PHY_STANDARD_80211n_2_4GHZ)
- 115 {
- 116 apTypeString = "WIFI_PHY_STANDARD_80211n_2_4GHZ";
- 117 }
- 118
- 119 std::cout << "Run: " << params.testName
- 120 << "\n\t enableErpProtection=" << params.enableErpProtection
- 121 << "\n\t erpProtectionMode=" << params.erpProtectionMode
- 122 << "\n\t enableShortSlotTime=" << params.enableShortSlotTime
- 123 << "\n\t enableShortPlcpPreamble=" << params.enableShortPlcpPreamble
- 124 << "\n\t apType=" << apTypeString
- 125 << "\n\t apSupportsGreenfield=" << params.apSupportsGreenfield
- 126 << "\n\t rifsSupported=" << params.rifsSupported
- 127 << "\n\t rifsMode=" << params.rifsMode
- 128 << "\n\t nWifiB=" << params.nWifiB
- 129 << "\n\t bHasTraffic=" << params.bHasTraffic
- 130 << "\n\t nWifiG=" << params.nWifiG
- 131 << "\n\t gHasTraffic=" << params.gHasTraffic
- 132 << "\n\t nWifiNNonGreenfield=" << params.nWifiNNonGreenfield
- 133 << "\n\t nNonGreenfieldHasTraffic=" << params.nNonGreenfieldHasTraffic
- 134 << "\n\t nWifiNGreenfield=" << params.nWifiNGreenfield
- 135 << "\n\t nGreenfieldHasTraffic=" << params.nGreenfieldHasTraffic
- 136 << std::endl;
- 137
- 138 Config::SetDefault ("ns3::WifiRemoteStationManager::ErpProtectionMode", StringValue (params.erpProtectionMode));
- 139
- 140 double throughput = 0;
- 141 uint32_t nWifiB = params.nWifiB;
- 142 uint32_t nWifiG = params.nWifiG;
- 143 uint32_t nWifiNNGF = params.nWifiNNonGreenfield;
- 144 uint32_t nWifiNGF = params.nWifiNGreenfield;
- 145 double simulationTime = params.simulationTime;
- 146 uint32_t payloadSize = params.payloadSize;
- 147
- 148 NodeContainer wifiBStaNodes;
- 149 wifiBStaNodes.Create (nWifiB);
- 150 NodeContainer wifiGStaNodes;
- 151 wifiGStaNodes.Create (nWifiG);
- 152 NodeContainer wifiNNGFStaNodes;
- 153 wifiNNGFStaNodes.Create (nWifiNNGF);
- 154 NodeContainer wifiNGFStaNodes;
- 155 wifiNGFStaNodes.Create (nWifiNGF);
- 156 NodeContainer wifiApNode;
- 157 wifiApNode.Create (1);
- 158
- 159 YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
- 160 channel.AddPropagationLoss ("ns3::RangePropagationLossModel");
- 161
- 162 YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
- 163 phy.SetPcapDataLinkType (WifiPhyHelper::DLT_IEEE802_11_RADIO);
- 164 phy.SetChannel (channel.Create ());
- 165
- 166 WifiHelper wifi;
- 167 wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
- 168
- 169 // 802.11b STA
- 170 wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
- 171
- 172 WifiMacHelper mac;
- 173 Ssid ssid = Ssid ("ns-3-ssid");
- 174
- 175 mac.SetType ("ns3::StaWifiMac",
- 176 "Ssid", SsidValue (ssid),
- 177 "ShortSlotTimeSupported", BooleanValue (params.enableShortSlotTime));
- 178
- 179 // Configure the PLCP preamble type: long or short
- 180 phy.Set ("ShortPlcpPreambleSupported", BooleanValue (params.enableShortPlcpPreamble));
- 181
- 182 NetDeviceContainer bStaDevice;
- 183 bStaDevice = wifi.Install (phy, mac, wifiBStaNodes);
- 184
- 185 // 802.11b/g STA
- 186 wifi.SetStandard (WIFI_PHY_STANDARD_80211g);
- 187 NetDeviceContainer gStaDevice;
- 188 gStaDevice = wifi.Install (phy, mac, wifiGStaNodes);
- 189
- 190 // 802.11b/g/n STA
- 191 wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);
- 192 NetDeviceContainer nNGFStaDevice, nGFStaDevice;
- 193 mac.SetType ("ns3::StaWifiMac",
- 194 "RifsSupported", BooleanValue (params.rifsSupported),
- 195 "Ssid", SsidValue (ssid),
- 196 "BE_MaxAmpduSize", UintegerValue (0),
- 197 "BE_BlockAckThreshold", UintegerValue (2),
- 198 "ShortSlotTimeSupported", BooleanValue (params.enableShortSlotTime));
- 199 phy.Set ("GreenfieldEnabled", BooleanValue (false));
- 200 nNGFStaDevice = wifi.Install (phy, mac, wifiNNGFStaNodes);
- 201 phy.Set ("GreenfieldEnabled", BooleanValue (true));
- 202 nGFStaDevice = wifi.Install (phy, mac, wifiNGFStaNodes);
- 203
- 204 // AP
- 205 NetDeviceContainer apDevice;
- 206 wifi.SetStandard (params.apType);
- 207 mac.SetType ("ns3::ApWifiMac",
- 208 "Ssid", SsidValue (ssid),
- 209 "EnableBeaconJitter", BooleanValue (false),
- 210 "BE_MaxAmpduSize", UintegerValue (0),
- 211 "BE_BlockAckThreshold", UintegerValue (2),
- 212 "RifsSupported", BooleanValue (params.rifsSupported),
- 213 "RifsMode", BooleanValue (params.rifsMode),
- 214 "EnableNonErpProtection", BooleanValue (params.enableErpProtection),
- 215 "ShortSlotTimeSupported", BooleanValue (params.enableShortSlotTime));
- 216 phy.Set ("GreenfieldEnabled", BooleanValue (params.apSupportsGreenfield));
- 217 apDevice = wifi.Install (phy, mac, wifiApNode);
- 218
- 219 // Set TXOP limit
- 220 if (params.apType == WIFI_PHY_STANDARD_80211n_2_4GHZ)
- 221 {
- 222 Ptr<NetDevice> dev = wifiApNode.Get (0)->GetDevice (0);
- 223 Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
- 224 Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
- 225 PointerValue ptr;
- 226 wifi_mac->GetAttribute ("BE_Txop", ptr);
- 227 Ptr<QosTxop> edca = ptr.Get<QosTxop> ();
- 228 edca->SetTxopLimit (MicroSeconds (3008));
- 229 }
- 230 if (nWifiNNGF > 0)
- 231 {
- 232 Ptr<NetDevice> dev = wifiNNGFStaNodes.Get (0)->GetDevice (0);
- 233 Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
- 234 Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
- 235 PointerValue ptr;
- 236 wifi_mac->GetAttribute ("BE_Txop", ptr);
- 237 Ptr<QosTxop> edca = ptr.Get<QosTxop> ();
- 238 edca->SetTxopLimit (MicroSeconds (3008));
- 239 }
- 240 if (nWifiNGF > 0)
- 241 {
- 242 Ptr<NetDevice> dev = wifiNGFStaNodes.Get (0)->GetDevice (0);
- 243 Ptr<WifiNetDevice> wifi_dev = DynamicCast<WifiNetDevice> (dev);
- 244 Ptr<WifiMac> wifi_mac = wifi_dev->GetMac ();
- 245 PointerValue ptr;
- 246 wifi_mac->GetAttribute ("BE_Txop", ptr);
- 247 Ptr<QosTxop> edca = ptr.Get<QosTxop> ();
- 248 edca->SetTxopLimit (MicroSeconds (3008));
- 249 }
- 250
- 251 // Define mobility model
- 252 MobilityHelper mobility;
- 253 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
- 254
- 255 positionAlloc->Add (Vector (0.0, 0.0, 0.0));
- 256 for (uint32_t i = 0; i < nWifiB; i++)
- 257 {
- 258 positionAlloc->Add (Vector (5.0, 0.0, 0.0));
- 259 }
- 260 for (uint32_t i = 0; i < nWifiG; i++)
- 261 {
- 262 positionAlloc->Add (Vector (0.0, 5.0, 0.0));
- 263 }
- 264 for (uint32_t i = 0; i < nWifiNNGF; i++)
- 265 {
- 266 positionAlloc->Add (Vector (0.0, 0.0, 5.0));
- 267 }
- 268 for (uint32_t i = 0; i < nWifiNGF; i++)
- 269 {
- 270 positionAlloc->Add (Vector (0.0, 0.0, 5.0));
- 271 }
- 272
- 273 mobility.SetPositionAllocator (positionAlloc);
- 274 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
- 275 mobility.Install (wifiApNode);
- 276 mobility.Install (wifiBStaNodes);
- 277 mobility.Install (wifiGStaNodes);
- 278 mobility.Install (wifiNNGFStaNodes);
- 279 mobility.Install (wifiNGFStaNodes);
- 280
- 281 // Internet stack
- 282 InternetStackHelper stack;
- 283 stack.Install (wifiApNode);
- 284 stack.Install (wifiBStaNodes);
- 285 stack.Install (wifiGStaNodes);
- 286 stack.Install (wifiNNGFStaNodes);
- 287 stack.Install (wifiNGFStaNodes);
- 288
- 289 Ipv4AddressHelper address;
- 290 address.SetBase ("192.168.1.0", "255.255.255.0");
- 291 Ipv4InterfaceContainer bStaInterface;
- 292 bStaInterface = address.Assign (bStaDevice);
- 293 Ipv4InterfaceContainer gStaInterface;
- 294 gStaInterface = address.Assign (gStaDevice);
- 295 Ipv4InterfaceContainer nNGFStaInterface;
- 296 nNGFStaInterface = address.Assign (nNGFStaDevice);
- 297 Ipv4InterfaceContainer nGFStaInterface;
- 298 nGFStaInterface = address.Assign (nGFStaDevice);
- 299 Ipv4InterfaceContainer ApInterface;
- 300 ApInterface = address.Assign (apDevice);
- 301
- 302 // Setting applications
- 303 if (params.isUdp)
- 304 {
- 305 uint16_t port = 9;
- 306 UdpServerHelper server (port);
- 307 ApplicationContainer serverApp = server.Install (wifiApNode);
- 308 serverApp.Start (Seconds (0.0));
- 309 serverApp.Stop (Seconds (simulationTime + 1));
- 310
- 311 UdpClientHelper client (ApInterface.GetAddress (0), port);
- 312 client.SetAttribute ("MaxPackets", UintegerValue (4294967295u));
- 313 client.SetAttribute ("Interval", TimeValue (Time ("0.0002"))); //packets/s
- 314 client.SetAttribute ("PacketSize", UintegerValue (payloadSize));
- 315
- 316 ApplicationContainer clientApps;
- 317 if (params.bHasTraffic)
- 318 {
- 319 clientApps.Add (client.Install (wifiBStaNodes));
- 320 }
- 321 if (params.gHasTraffic)
- 322 {
- 323 clientApps.Add (client.Install (wifiGStaNodes));
- 324 }
- 325 if (params.nNonGreenfieldHasTraffic)
- 326 {
- 327 clientApps.Add (client.Install (wifiNNGFStaNodes));
- 328 }
- 329 if (params.nGreenfieldHasTraffic)
- 330 {
- 331 clientApps.Add (client.Install (wifiNGFStaNodes));
- 332 }
- 333 clientApps.Start (Seconds (1.0));
- 334 clientApps.Stop (Seconds (simulationTime + 1));
- 335
- 336 Simulator::Stop (Seconds (simulationTime + 1));
- 337 Simulator::Run ();
- 338 Simulator::Destroy ();
- 339
- 340 uint64_t totalPacketsThrough = DynamicCast<UdpServer> (serverApp.Get (0))->GetReceived ();
- 341 throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0);
- 342 }
- 343 else
- 344 {
- 345 uint16_t port = 50000;
- 346 Address localAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
- 347 PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", localAddress);
- 348
- 349 ApplicationContainer serverApp = packetSinkHelper.Install (wifiApNode.Get (0));
- 350 serverApp.Start (Seconds (0.0));
- 351 serverApp.Stop (Seconds (simulationTime + 1));
- 352
- 353 OnOffHelper onoff ("ns3::TcpSocketFactory", Ipv4Address::GetAny ());
- 354 onoff.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
- 355 onoff.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
- 356 onoff.SetAttribute ("PacketSize", UintegerValue (payloadSize));
- 357 onoff.SetAttribute ("DataRate", DataRateValue (150000000)); //bit/s
- 358
- 359 AddressValue remoteAddress (InetSocketAddress (ApInterface.GetAddress (0), port));
- 360 onoff.SetAttribute ("Remote", remoteAddress);
- 361
- 362 ApplicationContainer clientApps;
- 363 if (params.bHasTraffic)
- 364 {
- 365 clientApps.Add (onoff.Install (wifiBStaNodes));
- 366 }
- 367 if (params.gHasTraffic)
- 368 {
- 369 clientApps.Add (onoff.Install (wifiGStaNodes));
- 370 }
- 371 if (params.nNonGreenfieldHasTraffic)
- 372 {
- 373 clientApps.Add (onoff.Install (wifiNNGFStaNodes));
- 374 }
- 375 if (params.nGreenfieldHasTraffic)
- 376 {
- 377 clientApps.Add (onoff.Install (wifiNGFStaNodes));
- 378 }
- 379 clientApps.Start (Seconds (1.0));
- 380 clientApps.Stop (Seconds (simulationTime + 1));
- 381
- 382 Simulator::Stop (Seconds (simulationTime + 1));
- 383 Simulator::Run ();
- 384 Simulator::Destroy ();
- 385
- 386 uint64_t totalPacketsThrough = DynamicCast<PacketSink> (serverApp.Get (0))->GetTotalRx ();
- 387 throughput += totalPacketsThrough * 8 / (simulationTime * 1000000.0);
- 388 }
- 389 return throughput;
- 390 }
- 391
- 392 int main (int argc, char *argv[])
- 393 {
- 394 Parameters params;
- 395 params.testName = "";
- 396 params.enableErpProtection = false;
- 397 params.erpProtectionMode = "Cts-To-Self";
- 398 params.enableShortSlotTime = false;
- 399 params.enableShortPlcpPreamble = false;
- 400 params.apType = WIFI_PHY_STANDARD_80211g;
- 401 params.apSupportsGreenfield = false;
- 402 params.rifsSupported = false;
- 403 params.rifsMode = false;
- 404 params.nWifiB = 0;
- 405 params.bHasTraffic = false;
- 406 params.nWifiG = 1;
- 407 params.gHasTraffic = true;
- 408 params.nWifiNNonGreenfield = 0;
- 409 params.nNonGreenfieldHasTraffic = false;
- 410 params.nWifiNGreenfield = 0;
- 411 params.nGreenfieldHasTraffic = false;
- 412 params.isUdp = true;
- 413 params.payloadSize = 1472; //bytes
- 414 params.simulationTime = 10; //seconds
- 415
- 416 bool verifyResults = 0; //used for regression
- 417
- 418 CommandLine cmd;
- 419 cmd.AddValue ("payloadSize", "Payload size in bytes", params.payloadSize);
- 420 cmd.AddValue ("simulationTime", "Simulation time in seconds", params.simulationTime);
- 421 cmd.AddValue ("isUdp", "UDP if set to 1, TCP otherwise", params.isUdp);
- 422 cmd.AddValue ("verifyResults", "Enable/disable results verification at the end of the simulation", verifyResults);
- 423 cmd.Parse (argc, argv);
- 424
- 425 Experiment experiment;
- 426 double throughput = 0;
- 427
- 428 params.testName = "g only with all g features disabled";
- 429 throughput = experiment.Run (params);
- 430 if (verifyResults && (throughput < 22.5 || throughput > 23.5))
- 431 {
- 432 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 433 exit (1);
- 434 }
- 435 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 436
- 437 params.testName = "g only with short slot time enabled";
- 438 params.enableErpProtection = false;
- 439 params.enableShortSlotTime = true;
- 440 params.enableShortPlcpPreamble = false;
- 441 params.nWifiB = 0;
- 442 throughput = experiment.Run (params);
- 443 if (verifyResults && (throughput < 29 || throughput > 30))
- 444 {
- 445 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 446 exit (1);
- 447 }
- 448 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 449
- 450 params.testName = "Mixed b/g with all g features disabled";
- 451 params.enableErpProtection = false;
- 452 params.enableShortSlotTime = false;
- 453 params.enableShortPlcpPreamble = false;
- 454 params.nWifiB = 1;
- 455 throughput = experiment.Run (params);
- 456 if (verifyResults && (throughput < 22.5 || throughput > 23.5))
- 457 {
- 458 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 459 exit (1);
- 460 }
- 461 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 462
- 463 params.testName = "Mixed b/g with short plcp preamble enabled";
- 464 params.enableErpProtection = false;
- 465 params.enableShortSlotTime = false;
- 466 params.enableShortPlcpPreamble = true;
- 467 params.nWifiB = 1;
- 468 throughput = experiment.Run (params);
- 469 if (verifyResults && (throughput < 22.5 || throughput > 23.5))
- 470 {
- 471 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 472 exit (1);
- 473 }
- 474 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 475
- 476 params.testName = "Mixed b/g with short slot time enabled using RTS-CTS protection";
- 477 params.enableErpProtection = true;
- 478 params.erpProtectionMode = "Rts-Cts";
- 479 params.enableShortSlotTime = false;
- 480 params.enableShortPlcpPreamble = false;
- 481 params.nWifiB = 1;
- 482 throughput = experiment.Run (params);
- 483 if (verifyResults && (throughput < 19 || throughput > 20))
- 484 {
- 485 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 486 exit (1);
- 487 }
- 488 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 489
- 490 params.testName = "Mixed b/g with short plcp preamble enabled using RTS-CTS protection";
- 491 params.enableErpProtection = true;
- 492 params.enableShortSlotTime = false;
- 493 params.enableShortPlcpPreamble = true;
- 494 params.nWifiB = 1;
- 495 throughput = experiment.Run (params);
- 496 if (verifyResults && (throughput < 19 || throughput > 20))
- 497 {
- 498 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 499 exit (1);
- 500 }
- 501 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 502
- 503 params.testName = "Mixed b/g with short slot time enabled using CTS-TO-SELF protection";
- 504 params.enableErpProtection = true;
- 505 params.erpProtectionMode = "Cts-To-Self";
- 506 params.enableShortSlotTime = false;
- 507 params.enableShortPlcpPreamble = false;
- 508 params.nWifiB = 1;
- 509 throughput = experiment.Run (params);
- 510 if (verifyResults && (throughput < 20.5 || throughput > 21.5))
- 511 {
- 512 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 513 exit (1);
- 514 }
- 515 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 516
- 517 params.testName = "Mixed b/g with short plcp preamble enabled using CTS-TO-SELF protection";
- 518 params.enableErpProtection = true;
- 519 params.enableShortSlotTime = false;
- 520 params.enableShortPlcpPreamble = true;
- 521 params.nWifiB = 1;
- 522 throughput = experiment.Run (params);
- 523 if (verifyResults && (throughput < 20.5 || throughput > 21.5))
- 524 {
- 525 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 526 exit (1);
- 527 }
- 528 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 529
- 530 params.testName = "HT GF not supported";
- 531 params.enableErpProtection = false;
- 532 params.enableShortSlotTime = false;
- 533 params.enableShortPlcpPreamble = false;
- 534 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 535 params.apSupportsGreenfield = false;
- 536 params.nWifiB = 0;
- 537 params.bHasTraffic = false;
- 538 params.nWifiG = 0;
- 539 params.gHasTraffic = false;
- 540 params.nWifiNNonGreenfield = 1;
- 541 params.nNonGreenfieldHasTraffic = true;
- 542 params.nWifiNGreenfield = 0;
- 543 params.nGreenfieldHasTraffic = false;
- 544 throughput = experiment.Run (params);
- 545 if (verifyResults && (throughput < 43 || throughput > 44))
- 546 {
- 547 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 548 exit (1);
- 549 }
- 550 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 551
- 552 params.testName = "HT only with GF used";
- 553 params.enableErpProtection = false;
- 554 params.enableShortSlotTime = false;
- 555 params.enableShortPlcpPreamble = false;
- 556 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 557 params.apSupportsGreenfield = true;
- 558 params.nWifiB = 0;
- 559 params.bHasTraffic = false;
- 560 params.nWifiG = 0;
- 561 params.gHasTraffic = false;
- 562 params.nWifiNNonGreenfield = 0;
- 563 params.nNonGreenfieldHasTraffic = false;
- 564 params.nWifiNGreenfield = 1;
- 565 params.nGreenfieldHasTraffic = true;
- 566 throughput = experiment.Run (params);
- 567 if (verifyResults && (throughput < 44 || throughput > 45))
- 568 {
- 569 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 570 exit (1);
- 571 }
- 572 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 573
- 574 params.testName = "HT only with GF allowed but disabled by protection";
- 575 params.enableErpProtection = false;
- 576 params.enableShortSlotTime = false;
- 577 params.enableShortPlcpPreamble = false;
- 578 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 579 params.apSupportsGreenfield = true;
- 580 params.nWifiB = 0;
- 581 params.bHasTraffic = false;
- 582 params.nWifiG = 0;
- 583 params.gHasTraffic = false;
- 584 params.nWifiNNonGreenfield = 1;
- 585 params.nNonGreenfieldHasTraffic = false;
- 586 params.nWifiNGreenfield = 1;
- 587 params.nGreenfieldHasTraffic = true;
- 588 throughput = experiment.Run (params);
- 589 if (verifyResults && (throughput < 43 || throughput > 44))
- 590 {
- 591 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 592 exit (1);
- 593 }
- 594 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 595
- 596 params.testName = "HT only with GF not supported by the receiver";
- 597 params.enableErpProtection = false;
- 598 params.enableShortSlotTime = false;
- 599 params.enableShortPlcpPreamble = false;
- 600 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 601 params.apSupportsGreenfield = false;
- 602 params.nWifiB = 0;
- 603 params.bHasTraffic = false;
- 604 params.nWifiG = 0;
- 605 params.gHasTraffic = false;
- 606 params.nWifiNNonGreenfield = 0;
- 607 params.nNonGreenfieldHasTraffic = false;
- 608 params.nWifiNGreenfield = 1;
- 609 params.nGreenfieldHasTraffic = true;
- 610 throughput = experiment.Run (params);
- 611 if (verifyResults && (throughput < 43 || throughput > 44))
- 612 {
- 613 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 614 exit (1);
- 615 }
- 616 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 617
- 618 params.testName = "Mixed HT/non-HT with GF enabled";
- 619 params.enableErpProtection = false;
- 620 params.enableShortSlotTime = false;
- 621 params.enableShortPlcpPreamble = false;
- 622 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 623 params.apSupportsGreenfield = true;
- 624 params.nWifiB = 0;
- 625 params.bHasTraffic = false;
- 626 params.nWifiG = 1;
- 627 params.gHasTraffic = false;
- 628 params.nWifiNNonGreenfield = 0;
- 629 params.nNonGreenfieldHasTraffic = false;
- 630 params.nWifiNGreenfield = 1;
- 631 params.nGreenfieldHasTraffic = true;
- 632 throughput = experiment.Run (params);
- 633 if (verifyResults && (throughput < 44 || throughput > 45))
- 634 {
- 635 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 636 exit (1);
- 637 }
- 638 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 639
- 640 params.testName = "HT only with RIFS enabled";
- 641 params.enableErpProtection = false;
- 642 params.enableShortSlotTime = false;
- 643 params.enableShortPlcpPreamble = false;
- 644 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 645 params.apSupportsGreenfield = false;
- 646 params.rifsSupported = true;
- 647 params.rifsMode = false;
- 648 params.nWifiB = 0;
- 649 params.bHasTraffic = false;
- 650 params.nWifiG = 0;
- 651 params.gHasTraffic = false;
- 652 params.nWifiNNonGreenfield = 1;
- 653 params.nNonGreenfieldHasTraffic = true;
- 654 params.nWifiNGreenfield = 0;
- 655 params.nGreenfieldHasTraffic = false;
- 656 throughput = experiment.Run (params);
- 657 if (verifyResults && (throughput < 44 || throughput > 45))
- 658 {
- 659 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 660 exit (1);
- 661 }
- 662 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 663
- 664 params.testName = "Mixed HT/non-HT with RIFS enabled but not forbidden";
- 665 params.enableErpProtection = false;
- 666 params.enableShortSlotTime = false;
- 667 params.enableShortPlcpPreamble = false;
- 668 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 669 params.apSupportsGreenfield = false;
- 670 params.rifsSupported = true;
- 671 params.rifsMode = false;
- 672 params.nWifiB = 0;
- 673 params.bHasTraffic = false;
- 674 params.nWifiG = 1;
- 675 params.gHasTraffic = false;
- 676 params.nWifiNNonGreenfield = 1;
- 677 params.nNonGreenfieldHasTraffic = true;
- 678 params.nWifiNGreenfield = 0;
- 679 params.nGreenfieldHasTraffic = false;
- 680 throughput = experiment.Run (params);
- 681 if (verifyResults && (throughput < 44 || throughput > 45))
- 682 {
- 683 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 684 exit (1);
- 685 }
- 686 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 687
- 688 params.testName = "Mixed HT/non-HT with RIFS enabled but forbidden";
- 689 params.enableErpProtection = false;
- 690 params.enableShortSlotTime = false;
- 691 params.enableShortPlcpPreamble = false;
- 692 params.apType = WIFI_PHY_STANDARD_80211n_2_4GHZ;
- 693 params.apSupportsGreenfield = false;
- 694 params.rifsSupported = true;
- 695 params.rifsMode = true;
- 696 params.nWifiB = 0;
- 697 params.bHasTraffic = false;
- 698 params.nWifiG = 1;
- 699 params.gHasTraffic = false;
- 700 params.nWifiNNonGreenfield = 1;
- 701 params.nNonGreenfieldHasTraffic = true;
- 702 params.nWifiNGreenfield = 0;
- 703 params.nGreenfieldHasTraffic = false;
- 704 throughput = experiment.Run (params);
- 705 if (verifyResults && (throughput < 43 || throughput > 44))
- 706 {
- 707 NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
- 708 exit (1);
- 709 }
- 710 std::cout << "Throughput: " << throughput << " Mbit/s \n" << std::endl;
- 711
- 712 return 0;
- 713 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement