--- a/examples/wireless/ht-wifi-network.cc Sat Sep 05 12:00:44 2015 +0200
+++ b/examples/wireless/ht-wifi-network.cc Sat Sep 05 13:33:43 2015 +0200
@@ -18,6 +18,7 @@
* Authors: Mirko Banchi <mk.banchi@gmail.com>
* Sebastien Deronne <sebastien.deronne@gmail.com>
*/
+
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
@@ -26,16 +27,19 @@
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/internet-module.h"
-//This is a simple example of an IEEE 802.11n Wi-Fi network.
+// This is a simple example in order to show how to configure an IEEE 802.11n Wi-Fi network.
//
-//Network topology:
+// It ouputs the UDP or TCP goodput for every VHT bitrate value, which depends on the MCS value (0 to 7), the
+// channel width (20, 40, 80 or 160 MHz) and the guard interval (long or short). The PHY bitrate is constant
+// over all the simulation run. The user can also specify the distance between the access point and the
+// station: the larger the distance the smaller the goodput.
//
-// Wifi 192.168.1.0
+// The simulation assumes a single station in an infrastructure network:
//
-// AP
-// * *
-// | |
-// n1 n2
+// STA AP
+// * *
+// | |
+// n1 n2
//
//Packets in this simulation aren't marked with a QosTag so they are considered
//belonging to BestEffort Access Class (AC_BE).
@@ -48,7 +52,12 @@
{
bool udp = true;
double simulationTime = 10; //seconds
+ double distance = 1.0; //meters
+ double frequency = 5.0; //whether 2.4 or 5.0 GHz
+
CommandLine cmd;
+ cmd.AddValue ("frequency", "Whether working in the 2.4 or 5.0 GHz band (other values gets rejected)", frequency);
+ cmd.AddValue ("distance", "Distance in meters between the station and the access point", distance);
cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
cmd.Parse (argc,argv);
@@ -84,9 +93,22 @@
phy.Set ("ShortGuardEnabled", BooleanValue (k));
WifiHelper wifi = WifiHelper::Default ();
- wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
+ if (frequency == 5.0)
+ {
+ wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
+ }
+ else if (frequency == 2.4)
+ {
+ wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);
+ Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceLoss", DoubleValue (40.046));
+ }
+ else
+ {
+ std::cout<<"Wrong frequency value!"<<std::endl;
+ return 0;
+ }
+
HtWifiMacHelper mac = HtWifiMacHelper::Default ();
-
StringValue DataRate = HtWifiMacHelper::DataRateForMcs (i);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", DataRate,
"ControlMode", DataRate);
@@ -114,7 +136,7 @@
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
- positionAlloc->Add (Vector (1.0, 0.0, 0.0));
+ positionAlloc->Add (Vector (distance, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
--- a/examples/wireless/vht-wifi-network.cc Sat Sep 05 12:00:44 2015 +0200
+++ b/examples/wireless/vht-wifi-network.cc Sat Sep 05 13:33:43 2015 +0200
@@ -17,6 +17,7 @@
*
* Author: Sebastien Deronne <sebastien.deronne@gmail.com>
*/
+
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
@@ -25,16 +26,19 @@
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/internet-module.h"
-//This is a simple example of an IEEE 802.11ac Wi-Fi network.
+// This is a simple example in order to show how to configure an IEEE 802.11ac Wi-Fi network.
//
-//Network topology:
+// It ouputs the UDP or TCP goodput for every VHT bitrate value, which depends on the MCS value (0 to 9, where 9 is
+// forbidden when the channel width is 20 MHz), the channel width (20, 40, 80 or 160 MHz) and the guard interval (long
+// or short). The PHY bitrate is constant over all the simulation run. The user can also specify the distance between
+// the access point and the station: the larger the distance the smaller the goodput.
//
-// Wifi 192.168.1.0
+// The simulation assumes a single station in an infrastructure network:
//
-// AP
-// * *
-// | |
-// n1 n2
+// STA AP
+// * *
+// | |
+// n1 n2
//
//Packets in this simulation aren't marked with a QosTag so they are considered
//belonging to BestEffort Access Class (AC_BE).
@@ -47,7 +51,10 @@
{
bool udp = true;
double simulationTime = 10; //seconds
+ double distance = 1.0; //meters
+
CommandLine cmd;
+ cmd.AddValue ("distance", "Distance in meters between the station and the access point", distance);
cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
cmd.Parse (argc,argv);
@@ -118,7 +125,7 @@
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
- positionAlloc->Add (Vector (1.0, 0.0, 0.0));
+ positionAlloc->Add (Vector (distance, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");