examples: Add vht-wifi-network in regression run
This commit is contained in:
@@ -30,6 +30,7 @@ cpp_examples = [
|
||||
("ofdm-ht-validation", "True", "True"),
|
||||
("ofdm-validation", "True", "True"),
|
||||
("ofdm-vht-validation", "True", "True"),
|
||||
("vht-wifi-network --simulationTime=0.1", "True", "True"),
|
||||
("mixed-bg-network", "True", "True"),
|
||||
("wifi-tcp", "True", "True"),
|
||||
("wifi-spectrum-per-example --distance=52 --index=3 --wifiType=ns3::SpectrumWifiPhy --simulationTime=1", "True", "True"),
|
||||
|
||||
@@ -57,17 +57,24 @@ int main (int argc, char *argv[])
|
||||
cmd.AddValue ("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.Parse (argc,argv);
|
||||
|
||||
std::cout << "MCS value" << "\t\t" << "Channel width" << "\t\t" << "short GI" << "\t\t" << "Throughput" << '\n';
|
||||
for (int i = 0; i <= 9; i++) //MCS
|
||||
double prevThroughput [8];
|
||||
for (uint32_t l = 0; l < 8; l++)
|
||||
{
|
||||
for (int j = 20; j <= 160; ) //channel width
|
||||
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++)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
double previous = 0;
|
||||
for (int channelWidth = 20; channelWidth <= 160;)
|
||||
{
|
||||
if (i == 9 && j == 20)
|
||||
if (mcs == 9 && channelWidth == 20)
|
||||
{
|
||||
j *= 2;
|
||||
channelWidth *= 2;
|
||||
continue;
|
||||
}
|
||||
for (int k = 0; k < 2; k++) //GI: 0 and 1
|
||||
for (int sgi = 0; sgi < 2; sgi++)
|
||||
{
|
||||
uint32_t payloadSize; //1500 byte IP packet
|
||||
if (udp)
|
||||
@@ -90,14 +97,14 @@ int main (int argc, char *argv[])
|
||||
phy.SetChannel (channel.Create ());
|
||||
|
||||
// Set guard interval
|
||||
phy.Set ("ShortGuardEnabled", BooleanValue (k));
|
||||
phy.Set ("ShortGuardEnabled", BooleanValue (sgi));
|
||||
|
||||
WifiHelper wifi;
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
|
||||
WifiMacHelper mac;
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "VhtMcs" << i;
|
||||
oss << "VhtMcs" << mcs;
|
||||
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", StringValue (oss.str ()),
|
||||
"ControlMode", StringValue (oss.str ()));
|
||||
|
||||
@@ -116,7 +123,7 @@ int main (int argc, char *argv[])
|
||||
apDevice = wifi.Install (phy, mac, wifiApNode);
|
||||
|
||||
// Set channel width
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (j));
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));
|
||||
|
||||
// mobility.
|
||||
MobilityHelper mobility;
|
||||
@@ -149,7 +156,6 @@ int main (int argc, char *argv[])
|
||||
ApplicationContainer serverApp, sinkApp;
|
||||
if (udp)
|
||||
{
|
||||
//UDP flow
|
||||
UdpServerHelper myServer (9);
|
||||
serverApp = myServer.Install (wifiStaNode.Get (0));
|
||||
serverApp.Start (Seconds (0.0));
|
||||
@@ -166,7 +172,6 @@ int main (int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
//TCP flow
|
||||
uint16_t port = 50000;
|
||||
Address apLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), port));
|
||||
PacketSinkHelper packetSinkHelper ("ns3::TcpSocketFactory", apLocalAddress);
|
||||
@@ -205,9 +210,48 @@ int main (int argc, char *argv[])
|
||||
rxBytes = payloadSize * DynamicCast<PacketSink> (sinkApp.Get (0))->GetTotalRx ();
|
||||
}
|
||||
double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); //Mbit/s
|
||||
std::cout << i << "\t\t\t" << j << " MHz\t\t\t" << k << "\t\t\t" << throughput << " Mbit/s" << std::endl;
|
||||
std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl;
|
||||
//test first element
|
||||
if (udp && mcs == 0 && channelWidth == 20 && sgi == 0)
|
||||
{
|
||||
if (throughput < 5.1 || throughput > 6.1)
|
||||
{
|
||||
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not expected!");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
//test last element
|
||||
if (udp && mcs == 9 && channelWidth == 160 && sgi == 1)
|
||||
{
|
||||
if (throughput < 550 || throughput > 650)
|
||||
{
|
||||
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not expected!");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
//test previous throughput is smaller (for the same mcs)
|
||||
if (throughput > previous)
|
||||
{
|
||||
previous = throughput;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not expected!");
|
||||
exit (1);
|
||||
}
|
||||
//test previous throughput is smaller (for the same channel width and GI)
|
||||
if (throughput > prevThroughput [index])
|
||||
{
|
||||
prevThroughput [index] = throughput;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not expected!");
|
||||
exit (1);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
j *= 2;
|
||||
channelWidth *= 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user