examples: Fix control rate in wifi HT/VHT/HE examples
This commit is contained in:
@@ -39,11 +39,11 @@ cpp_examples = [
|
||||
("wifi-error-models-comparison", "True", "True"),
|
||||
("wifi-80211n-mimo --simulationTime=0.1 --step=10", "True", "True"),
|
||||
("wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=135", "True", "True"),
|
||||
("wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=131", "True", "True"),
|
||||
("wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"),
|
||||
("wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"),
|
||||
("wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=129", "True", "True"),
|
||||
("wifi-vht-network --simulationTime=0.2 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=583", "True", "True"),
|
||||
("wifi-vht-network --simulationTime=0.2 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=547", "True", "True"),
|
||||
("wifi-vht-network --simulationTime=0.2 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=557", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745", "True", "True"),
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ns3/config.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/enum.h"
|
||||
#include "ns3/he-phy.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
@@ -208,10 +209,16 @@ main(int argc, char* argv[])
|
||||
WifiMacHelper mac;
|
||||
WifiHelper wifi;
|
||||
std::string channelStr("{0, " + std::to_string(channelWidth) + ", ");
|
||||
StringValue ctrlRate;
|
||||
auto nonHtRefRateMbps = HePhy::GetNonHtReferenceRate(mcs) / 1e6;
|
||||
|
||||
std::ostringstream ossDataMode;
|
||||
ossDataMode << "HeMcs" << mcs;
|
||||
|
||||
if (frequency == 6)
|
||||
{
|
||||
wifi.SetStandard(WIFI_STANDARD_80211ax);
|
||||
ctrlRate = StringValue(ossDataMode.str());
|
||||
channelStr += "BAND_6GHZ, 0}";
|
||||
Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
|
||||
DoubleValue(48));
|
||||
@@ -219,11 +226,17 @@ main(int argc, char* argv[])
|
||||
else if (frequency == 5)
|
||||
{
|
||||
wifi.SetStandard(WIFI_STANDARD_80211ax);
|
||||
std::ostringstream ossControlMode;
|
||||
ossControlMode << "OfdmRate" << nonHtRefRateMbps << "Mbps";
|
||||
ctrlRate = StringValue(ossControlMode.str());
|
||||
channelStr += "BAND_5GHZ, 0}";
|
||||
}
|
||||
else if (frequency == 2.4)
|
||||
{
|
||||
wifi.SetStandard(WIFI_STANDARD_80211ax);
|
||||
std::ostringstream ossControlMode;
|
||||
ossControlMode << "ErpOfdmRate" << nonHtRefRateMbps << "Mbps";
|
||||
ctrlRate = StringValue(ossControlMode.str());
|
||||
channelStr += "BAND_2_4GHZ, 0}";
|
||||
Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
|
||||
DoubleValue(40));
|
||||
@@ -234,13 +247,11 @@ main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "HeMcs" << mcs;
|
||||
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
|
||||
"DataMode",
|
||||
StringValue(oss.str()),
|
||||
StringValue(ossDataMode.str()),
|
||||
"ControlMode",
|
||||
StringValue(oss.str()));
|
||||
ctrlRate);
|
||||
// Set guard interval and MPDU buffer size
|
||||
wifi.ConfigHeOptions("GuardInterval",
|
||||
TimeValue(NanoSeconds(gi)),
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "ns3/config.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/enum.h"
|
||||
#include "ns3/ht-phy.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
@@ -144,14 +145,17 @@ main(int argc, char* argv[])
|
||||
|
||||
WifiMacHelper mac;
|
||||
WifiHelper wifi;
|
||||
std::ostringstream ossControlMode;
|
||||
|
||||
if (frequency == 5.0)
|
||||
{
|
||||
ossControlMode << "OfdmRate";
|
||||
wifi.SetStandard(WIFI_STANDARD_80211n);
|
||||
}
|
||||
else if (frequency == 2.4)
|
||||
{
|
||||
wifi.SetStandard(WIFI_STANDARD_80211n);
|
||||
ossControlMode << "ErpOfdmRate";
|
||||
Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
|
||||
DoubleValue(40.046));
|
||||
}
|
||||
@@ -161,13 +165,16 @@ main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "HtMcs" << mcs;
|
||||
auto nonHtRefRateMbps = HtPhy::GetNonHtReferenceRate(mcs) / 1e6;
|
||||
ossControlMode << nonHtRefRateMbps << "Mbps";
|
||||
|
||||
std::ostringstream ossDataMode;
|
||||
ossDataMode << "HtMcs" << mcs;
|
||||
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
|
||||
"DataMode",
|
||||
StringValue(oss.str()),
|
||||
StringValue(ossDataMode.str()),
|
||||
"ControlMode",
|
||||
StringValue(oss.str()));
|
||||
StringValue(ossControlMode.str()));
|
||||
// Set guard interval
|
||||
wifi.ConfigHtOptions("ShortGuardIntervalSupported", BooleanValue(sgi));
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/vht-phy.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
@@ -148,13 +149,18 @@ main(int argc, char* argv[])
|
||||
wifi.SetStandard(WIFI_STANDARD_80211ac);
|
||||
WifiMacHelper mac;
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "VhtMcs" << mcs;
|
||||
std::ostringstream ossControlMode;
|
||||
auto nonHtRefRateMbps = VhtPhy::GetNonHtReferenceRate(mcs) / 1e6;
|
||||
ossControlMode << "OfdmRate" << nonHtRefRateMbps << "Mbps";
|
||||
|
||||
std::ostringstream ossDataMode;
|
||||
ossDataMode << "VhtMcs" << mcs;
|
||||
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
|
||||
"DataMode",
|
||||
StringValue(oss.str()),
|
||||
StringValue(ossDataMode.str()),
|
||||
"ControlMode",
|
||||
StringValue(oss.str()));
|
||||
StringValue(ossControlMode.str()));
|
||||
|
||||
// Set guard interval
|
||||
wifi.ConfigHtOptions("ShortGuardIntervalSupported", BooleanValue(sgi));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user