From b8741c23d1fb90a011d68ad23f5770fbba0855e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Wed, 11 Jan 2017 20:13:32 +0100 Subject: [PATCH] examples: Add option to select a specific MCS value for ht-wifi-network and vht-wifi-network --- examples/wireless/ht-wifi-network.cc | 15 ++++++++++++--- examples/wireless/vht-wifi-network.cc | 13 +++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/examples/wireless/ht-wifi-network.cc b/examples/wireless/ht-wifi-network.cc index e833df79a..f707d5ae2 100644 --- a/examples/wireless/ht-wifi-network.cc +++ b/examples/wireless/ht-wifi-network.cc @@ -27,7 +27,7 @@ // This is a simple example in order to show how to configure an IEEE 802.11n Wi-Fi network. // -// It ouputs the UDP or TCP goodput for every VHT bitrate value, which depends on the MCS value (0 to 7), the +// It ouputs the UDP or TCP goodput for every HT MCS value, which depends on the MCS value (0 to 7), the // channel width (20 or 40 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. @@ -52,12 +52,14 @@ int main (int argc, char *argv[]) double simulationTime = 10; //seconds double distance = 1.0; //meters double frequency = 5.0; //whether 2.4 or 5.0 GHz - + int mcs = -1; // -1 indicates an unset value + 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.AddValue ("mcs", "if set, limit testing to a specific MCS (0-7)", mcs); cmd.Parse (argc,argv); double prevThroughput [8]; @@ -66,7 +68,14 @@ int main (int argc, char *argv[]) prevThroughput[l] = 0; } std::cout << "MCS value" << "\t\t" << "Channel width" << "\t\t" << "short GI" << "\t\t" << "Throughput" << '\n'; - for (int mcs = 0; mcs <= 7; mcs++) + int minMcs = 0; + int maxMcs = 7; + if (mcs >= 0 && mcs <= 7) + { + minMcs = mcs; + maxMcs = mcs; + } + for (int mcs = minMcs; mcs <= maxMcs; mcs++) { uint8_t index = 0; double previous = 0; diff --git a/examples/wireless/vht-wifi-network.cc b/examples/wireless/vht-wifi-network.cc index 5271ce327..c533ae309 100644 --- a/examples/wireless/vht-wifi-network.cc +++ b/examples/wireless/vht-wifi-network.cc @@ -26,7 +26,7 @@ // This is a simple example in order to show how to configure an IEEE 802.11ac Wi-Fi network. // -// It ouputs the UDP or TCP goodput for every VHT bitrate value, which depends on the MCS value (0 to 9, where 9 is +// It ouputs the UDP or TCP goodput for every VHT MCS 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. @@ -50,11 +50,13 @@ int main (int argc, char *argv[]) bool udp = true; double simulationTime = 10; //seconds double distance = 1.0; //meters + int mcs = -1; // -1 indicates an unset value 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.AddValue ("mcs", "if set, limit testing to a specific MCS (0-7)", mcs); cmd.Parse (argc,argv); double prevThroughput [8]; @@ -63,7 +65,14 @@ int main (int argc, char *argv[]) prevThroughput[l] = 0; } std::cout << "MCS value" << "\t\t" << "Channel width" << "\t\t" << "short GI" << "\t\t" << "Throughput" << '\n'; - for (int mcs = 0; mcs <= 9; mcs++) + int minMcs = 0; + int maxMcs = 9; + if (mcs >= 0 && mcs <= 9) + { + minMcs = mcs; + maxMcs = mcs; + } + for (int mcs = minMcs; mcs <= maxMcs; mcs++) { uint8_t index = 0; double previous = 0;