From 4e27c5e008e729f33e401aac4e2d48f4baa7c513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sat, 13 Jan 2018 12:16:29 +0100 Subject: [PATCH] examples: Add useRts option in wifi network examples, add frequency selection in he-wifi-network and extend regression --- examples/wireless/examples-to-run.py | 14 +++++++++++--- examples/wireless/he-wifi-network.cc | 26 ++++++++++++++++++++++++-- examples/wireless/ht-wifi-network.cc | 7 +++++++ examples/wireless/vht-wifi-network.cc | 7 +++++++ 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/examples/wireless/examples-to-run.py b/examples/wireless/examples-to-run.py index 22c3e0753..2d371a77c 100755 --- a/examples/wireless/examples-to-run.py +++ b/examples/wireless/examples-to-run.py @@ -36,9 +36,17 @@ cpp_examples = [ ("ofdm-vht-validation", "True", "True"), ("ofdm-he-validation", "True", "True"), ("80211n-mimo --simulationTime=0.1 --step=10", "True", "True"), - ("ht-wifi-network --simulationTime=0.1 --minExpectedThroughput=5 --maxExpectedThroughput=134", "True", "True"), - ("vht-wifi-network --simulationTime=0.1 --minExpectedThroughput=5 --maxExpectedThroughput=555", "True", "True"), - ("he-wifi-network --simulationTime=0.25 --minExpectedThroughput=6.35 --maxExpectedThroughput=754", "True", "True"), + ("ht-wifi-network --simulationTime=0.1 --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=134", "True", "True"), + ("ht-wifi-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=130", "True", "True"), + ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"), + ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=4.5 --maxExpectedThroughput=128", "True", "True"), + ("vht-wifi-network --simulationTime=0.1 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=555", "True", "True"), + ("vht-wifi-network --simulationTime=0.1 --useRts=1", "False", "False"), # see bug 2853 + ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6.35 --maxExpectedThroughput=754", "True", "True"), + ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6.35 --maxExpectedThroughput=754", "True", "True"), + ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=1", "False", "False"), # see bug 2853 + ("he-wifi-network --simulationTime=0.25 --frequency=1.4 --useRts=0", "False", "False"), # see bug 2854 + ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=1", "False", "False"), # see bug 2854 ("simple-ht-hidden-stations --simulationTime=1 --minExpectedThroughput=16.5 --maxExpectedThroughput=17", "True", "True"), ("mixed-network --simulationTime=1", "True", "True"), ("wifi-aggregation --simulationTime=1 --verifyResults=1", "True", "True"), diff --git a/examples/wireless/he-wifi-network.cc b/examples/wireless/he-wifi-network.cc index 88caf382d..b55b43761 100644 --- a/examples/wireless/he-wifi-network.cc +++ b/examples/wireless/he-wifi-network.cc @@ -48,21 +48,30 @@ NS_LOG_COMPONENT_DEFINE ("he-wifi-network"); int main (int argc, char *argv[]) { bool udp = true; + bool useRts = false; 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 double minExpectedThroughput = 0; double maxExpectedThroughput = 0; 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 ("useRts", "Enable/disable RTS/CTS", useRts); cmd.AddValue ("mcs", "if set, limit testing to a specific MCS (0-7)", mcs); cmd.AddValue ("minExpectedThroughput", "if set, simulation fails if the lowest throughput is below this value", minExpectedThroughput); cmd.AddValue ("maxExpectedThroughput", "if set, simulation fails if the highest throughput is above this value", maxExpectedThroughput); cmd.Parse (argc,argv); + if (useRts) + { + Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0")); + } + double prevThroughput [12]; for (uint32_t l = 0; l < 12; l++) { @@ -107,9 +116,22 @@ int main (int argc, char *argv[]) // Set guard interval phy.Set ("GuardInterval", TimeValue (NanoSeconds (gi))); - WifiHelper wifi; - wifi.SetStandard (WIFI_PHY_STANDARD_80211ax_5GHZ); WifiMacHelper mac; + WifiHelper wifi; + if (frequency == 5.0) + { + wifi.SetStandard (WIFI_PHY_STANDARD_80211ax_5GHZ); + } + else if (frequency == 2.4) + { + wifi.SetStandard (WIFI_PHY_STANDARD_80211ax_2_4GHZ); + Config::SetDefault ("ns3::LogDistancePropagationLossModel::ReferenceLoss", DoubleValue (40.046)); + } + else + { + std::cout << "Wrong frequency value!" << std::endl; + return 0; + } std::ostringstream oss; oss << "HeMcs" << mcs; diff --git a/examples/wireless/ht-wifi-network.cc b/examples/wireless/ht-wifi-network.cc index 216e27097..9fd306782 100644 --- a/examples/wireless/ht-wifi-network.cc +++ b/examples/wireless/ht-wifi-network.cc @@ -49,6 +49,7 @@ NS_LOG_COMPONENT_DEFINE ("ht-wifi-network"); int main (int argc, char *argv[]) { bool udp = true; + bool useRts = false; double simulationTime = 10; //seconds double distance = 1.0; //meters double frequency = 5.0; //whether 2.4 or 5.0 GHz @@ -61,11 +62,17 @@ int main (int argc, char *argv[]) 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 ("useRts", "Enable/disable RTS/CTS", useRts); cmd.AddValue ("mcs", "if set, limit testing to a specific MCS (0-7)", mcs); cmd.AddValue ("minExpectedThroughput", "if set, simulation fails if the lowest throughput is below this value", minExpectedThroughput); cmd.AddValue ("maxExpectedThroughput", "if set, simulation fails if the highest throughput is above this value", maxExpectedThroughput); cmd.Parse (argc,argv); + if (useRts) + { + Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0")); + } + double prevThroughput [8]; for (uint32_t l = 0; l < 8; l++) { diff --git a/examples/wireless/vht-wifi-network.cc b/examples/wireless/vht-wifi-network.cc index 1fbfeaafe..67fa92712 100644 --- a/examples/wireless/vht-wifi-network.cc +++ b/examples/wireless/vht-wifi-network.cc @@ -48,6 +48,7 @@ NS_LOG_COMPONENT_DEFINE ("vht-wifi-network"); int main (int argc, char *argv[]) { bool udp = true; + bool useRts = false; double simulationTime = 10; //seconds double distance = 1.0; //meters int mcs = -1; // -1 indicates an unset value @@ -58,11 +59,17 @@ int main (int argc, char *argv[]) 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 ("useRts", "Enable/disable RTS/CTS", useRts); cmd.AddValue ("mcs", "if set, limit testing to a specific MCS (0-9)", mcs); cmd.AddValue ("minExpectedThroughput", "if set, simulation fails if the lowest throughput is below this value", minExpectedThroughput); cmd.AddValue ("maxExpectedThroughput", "if set, simulation fails if the highest throughput is above this value", maxExpectedThroughput); cmd.Parse (argc,argv); + if (useRts) + { + Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0")); + } + double prevThroughput [8]; for (uint32_t l = 0; l < 8; l++) {