Merge tag 'ns-3.41' into unison
ns-3.41 release
This commit is contained in:
@@ -114,11 +114,12 @@ ComputeSnr(const ComputeSnrParams& params)
|
||||
*(params.txParams->psd) *= propagationGainLinear;
|
||||
|
||||
// apply the fast fading and the beamforming gain
|
||||
Ptr<SpectrumValue> rxPsd = m_spectrumLossModel->CalcRxPowerSpectralDensity(params.txParams,
|
||||
params.txMob,
|
||||
params.rxMob,
|
||||
params.txAntenna,
|
||||
params.rxAntenna);
|
||||
auto rxParams = m_spectrumLossModel->CalcRxPowerSpectralDensity(params.txParams,
|
||||
params.txMob,
|
||||
params.rxMob,
|
||||
params.txAntenna,
|
||||
params.rxAntenna);
|
||||
Ptr<SpectrumValue> rxPsd = rxParams->psd;
|
||||
NS_LOG_DEBUG("Average rx power " << 10 * log10(Sum(*rxPsd) * 180e3) << " dB");
|
||||
|
||||
// create the noise psd
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
* Author: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
|
||||
*/
|
||||
|
||||
#include "ns3/config-store-module.h"
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/energy-module.h"
|
||||
#include "ns3/internet-module.h"
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ns3/config-store-module.h"
|
||||
#include "ns3/core-module.h"
|
||||
#include "ns3/energy-module.h"
|
||||
#include "ns3/internet-module.h"
|
||||
|
||||
@@ -217,7 +217,7 @@ main(int argc, char* argv[])
|
||||
if (!outputValidated)
|
||||
{
|
||||
std::cerr << "Program internal checking failed; returning with error" << std::endl;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -23,89 +23,101 @@
|
||||
# - DropTail queues
|
||||
# - Tracing of queues and packet receptions to file "udp-echo.tr"
|
||||
|
||||
from ns import ns
|
||||
try:
|
||||
from ns import ns
|
||||
except ModuleNotFoundError:
|
||||
raise SystemExit(
|
||||
"Error: ns3 Python module not found;"
|
||||
" Python bindings may not be enabled"
|
||||
" or your PYTHONPATH might not be properly configured"
|
||||
)
|
||||
|
||||
|
||||
def main(argv):
|
||||
#
|
||||
# Allow the user to override any of the defaults and the above Bind() at
|
||||
# run-time, via command-line arguments
|
||||
#
|
||||
cmd = ns.core.CommandLine()
|
||||
cmd.Parse(argv)
|
||||
#
|
||||
# Allow the user to override any of the defaults and the above Bind() at
|
||||
# run-time, via command-line arguments
|
||||
#
|
||||
cmd = ns.core.CommandLine()
|
||||
cmd.Parse(argv)
|
||||
|
||||
#
|
||||
# But since this is a realtime script, don't allow the user to mess with
|
||||
# that.
|
||||
#
|
||||
ns.core.GlobalValue.Bind("SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl"))
|
||||
#
|
||||
# But since this is a realtime script, don't allow the user to mess with
|
||||
# that.
|
||||
#
|
||||
ns.core.GlobalValue.Bind(
|
||||
"SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl")
|
||||
)
|
||||
|
||||
#
|
||||
# Explicitly create the nodes required by the topology (shown above).
|
||||
#
|
||||
print ("Create nodes.")
|
||||
n = ns.network.NodeContainer()
|
||||
n.Create(4)
|
||||
#
|
||||
# Explicitly create the nodes required by the topology (shown above).
|
||||
#
|
||||
print("Create nodes.")
|
||||
n = ns.network.NodeContainer()
|
||||
n.Create(4)
|
||||
|
||||
internet = ns.internet.InternetStackHelper()
|
||||
internet.Install(n)
|
||||
internet = ns.internet.InternetStackHelper()
|
||||
internet.Install(n)
|
||||
|
||||
#
|
||||
# Explicitly create the channels required by the topology (shown above).
|
||||
#
|
||||
print ("Create channels.")
|
||||
csma = ns.csma.CsmaHelper()
|
||||
csma.SetChannelAttribute("DataRate", ns.network.DataRateValue(ns.network.DataRate(5000000)))
|
||||
csma.SetChannelAttribute("Delay", ns.core.TimeValue(ns.core.MilliSeconds(2)));
|
||||
csma.SetDeviceAttribute("Mtu", ns.core.UintegerValue(1400))
|
||||
d = csma.Install(n)
|
||||
#
|
||||
# Explicitly create the channels required by the topology (shown above).
|
||||
#
|
||||
print("Create channels.")
|
||||
csma = ns.csma.CsmaHelper()
|
||||
csma.SetChannelAttribute("DataRate", ns.network.DataRateValue(ns.network.DataRate(5000000)))
|
||||
csma.SetChannelAttribute("Delay", ns.core.TimeValue(ns.core.MilliSeconds(2)))
|
||||
csma.SetDeviceAttribute("Mtu", ns.core.UintegerValue(1400))
|
||||
d = csma.Install(n)
|
||||
|
||||
#
|
||||
# We've got the "hardware" in place. Now we need to add IP addresses.
|
||||
#
|
||||
print ("Assign IP Addresses.")
|
||||
ipv4 = ns.internet.Ipv4AddressHelper()
|
||||
ipv4.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0"))
|
||||
i = ipv4.Assign(d)
|
||||
#
|
||||
# We've got the "hardware" in place. Now we need to add IP addresses.
|
||||
#
|
||||
print("Assign IP Addresses.")
|
||||
ipv4 = ns.internet.Ipv4AddressHelper()
|
||||
ipv4.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0"))
|
||||
i = ipv4.Assign(d)
|
||||
|
||||
print ("Create Applications.")
|
||||
print("Create Applications.")
|
||||
|
||||
#
|
||||
# Create a UdpEchoServer application on node one.
|
||||
#
|
||||
port = 9 # well-known echo port number
|
||||
server = ns.applications.UdpEchoServerHelper(port)
|
||||
apps = server.Install(n.Get(1))
|
||||
apps.Start(ns.core.Seconds(1.0))
|
||||
apps.Stop(ns.core.Seconds(10.0))
|
||||
#
|
||||
# Create a UdpEchoServer application on node one.
|
||||
#
|
||||
port = 9 # well-known echo port number
|
||||
server = ns.applications.UdpEchoServerHelper(port)
|
||||
apps = server.Install(n.Get(1))
|
||||
apps.Start(ns.core.Seconds(1.0))
|
||||
apps.Stop(ns.core.Seconds(10.0))
|
||||
|
||||
#
|
||||
# Create a UdpEchoClient application to send UDP datagrams from node zero to
|
||||
# node one.
|
||||
#
|
||||
packetSize = 1024
|
||||
maxPacketCount = 500
|
||||
interPacketInterval = ns.core.Seconds(0.01)
|
||||
client = ns.applications.UdpEchoClientHelper(i.GetAddress(1).ConvertTo(), port)
|
||||
client.SetAttribute("MaxPackets", ns.core.UintegerValue(maxPacketCount))
|
||||
client.SetAttribute("Interval", ns.core.TimeValue(interPacketInterval))
|
||||
client.SetAttribute("PacketSize", ns.core.UintegerValue(packetSize))
|
||||
apps = client.Install(n.Get(0))
|
||||
apps.Start(ns.core.Seconds(2.0))
|
||||
apps.Stop(ns.core.Seconds(10.0))
|
||||
#
|
||||
# Create a UdpEchoClient application to send UDP datagrams from node zero to
|
||||
# node one.
|
||||
#
|
||||
packetSize = 1024
|
||||
maxPacketCount = 500
|
||||
interPacketInterval = ns.core.Seconds(0.01)
|
||||
client = ns.applications.UdpEchoClientHelper(i.GetAddress(1).ConvertTo(), port)
|
||||
client.SetAttribute("MaxPackets", ns.core.UintegerValue(maxPacketCount))
|
||||
client.SetAttribute("Interval", ns.core.TimeValue(interPacketInterval))
|
||||
client.SetAttribute("PacketSize", ns.core.UintegerValue(packetSize))
|
||||
apps = client.Install(n.Get(0))
|
||||
apps.Start(ns.core.Seconds(2.0))
|
||||
apps.Stop(ns.core.Seconds(10.0))
|
||||
|
||||
ascii = ns.network.AsciiTraceHelper()
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("realtime-udp-echo.tr"))
|
||||
csma.EnablePcapAll("realtime-udp-echo", False)
|
||||
ascii = ns.network.AsciiTraceHelper()
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("realtime-udp-echo.tr"))
|
||||
csma.EnablePcapAll("realtime-udp-echo", False)
|
||||
|
||||
#
|
||||
# Now, do the actual simulation.
|
||||
#
|
||||
print ("Run Simulation.")
|
||||
ns.core.Simulator.Stop(ns.Seconds(10))
|
||||
ns.core.Simulator.Run()
|
||||
ns.core.Simulator.Destroy()
|
||||
print ("Done.")
|
||||
#
|
||||
# Now, do the actual simulation.
|
||||
#
|
||||
print("Run Simulation.")
|
||||
ns.core.Simulator.Stop(ns.Seconds(10))
|
||||
ns.core.Simulator.Run()
|
||||
ns.core.Simulator.Destroy()
|
||||
print("Done.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
main(sys.argv)
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
main(sys.argv)
|
||||
|
||||
@@ -27,7 +27,14 @@
|
||||
# router
|
||||
#
|
||||
|
||||
from ns import ns
|
||||
try:
|
||||
from ns import ns
|
||||
except ModuleNotFoundError:
|
||||
raise SystemExit(
|
||||
"Error: ns3 Python module not found;"
|
||||
" Python bindings may not be enabled"
|
||||
" or your PYTHONPATH might not be properly configured"
|
||||
)
|
||||
|
||||
|
||||
def main(argv):
|
||||
@@ -73,7 +80,7 @@ def main(argv):
|
||||
print("Application")
|
||||
packetSize = 1024
|
||||
maxPacketCount = 5
|
||||
interPacketInterval = ns.Seconds(1.)
|
||||
interPacketInterval = ns.Seconds(1.0)
|
||||
# ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo())
|
||||
ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo())
|
||||
|
||||
@@ -98,7 +105,7 @@ def main(argv):
|
||||
ns.Simulator.Destroy()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
main(sys.argv)
|
||||
|
||||
@@ -11,10 +11,26 @@ cpp_examples = [
|
||||
("tcp-large-transfer", "True", "True"),
|
||||
("tcp-star-server", "True", "True"),
|
||||
("tcp-variants-comparison", "True", "True"),
|
||||
("tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=10ms --queueUseEcn=1 --stopTime=15s --validate=dctcp-10ms", "True", "True"),
|
||||
("tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=80ms --queueUseEcn=1 --stopTime=40s --validate=dctcp-80ms", "True", "True"),
|
||||
("tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=cubic-50ms-no-ecn", "True", "True"),
|
||||
("tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=1 --stopTime=20s --validate=cubic-50ms-ecn", "True", "True"),
|
||||
(
|
||||
"tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=10ms --queueUseEcn=1 --stopTime=15s --validate=dctcp-10ms",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=80ms --queueUseEcn=1 --stopTime=40s --validate=dctcp-80ms",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=cubic-50ms-no-ecn",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=1 --stopTime=20s --validate=cubic-50ms-ecn",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
]
|
||||
|
||||
# A list of Python examples to run in order to ensure that they remain
|
||||
|
||||
@@ -60,9 +60,15 @@
|
||||
#include "ns3/point-to-point-module.h"
|
||||
#include "ns3/traffic-control-module.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
using namespace ns3;
|
||||
using namespace ns3::SystemPath;
|
||||
|
||||
std::string dir;
|
||||
std::ofstream throughput;
|
||||
std::ofstream queueSize;
|
||||
|
||||
uint32_t prev = 0;
|
||||
Time prevTime = Seconds(0);
|
||||
|
||||
@@ -71,15 +77,16 @@ static void
|
||||
TraceThroughput(Ptr<FlowMonitor> monitor)
|
||||
{
|
||||
FlowMonitor::FlowStatsContainer stats = monitor->GetFlowStats();
|
||||
auto itr = stats.begin();
|
||||
Time curTime = Now();
|
||||
std::ofstream thr(dir + "/throughput.dat", std::ios::out | std::ios::app);
|
||||
thr << curTime << " "
|
||||
<< 8 * (itr->second.txBytes - prev) /
|
||||
(1000 * 1000 * (curTime.GetSeconds() - prevTime.GetSeconds()))
|
||||
<< std::endl;
|
||||
prevTime = curTime;
|
||||
prev = itr->second.txBytes;
|
||||
if (!stats.empty())
|
||||
{
|
||||
auto itr = stats.begin();
|
||||
Time curTime = Now();
|
||||
throughput << curTime << " "
|
||||
<< 8 * (itr->second.txBytes - prev) / ((curTime - prevTime).ToDouble(Time::US))
|
||||
<< std::endl;
|
||||
prevTime = curTime;
|
||||
prev = itr->second.txBytes;
|
||||
}
|
||||
Simulator::Schedule(Seconds(0.2), &TraceThroughput, monitor);
|
||||
}
|
||||
|
||||
@@ -89,9 +96,7 @@ CheckQueueSize(Ptr<QueueDisc> qd)
|
||||
{
|
||||
uint32_t qsize = qd->GetCurrentSize().GetValue();
|
||||
Simulator::Schedule(Seconds(0.2), &CheckQueueSize, qd);
|
||||
std::ofstream q(dir + "/queueSize.dat", std::ios::out | std::ios::app);
|
||||
q << Simulator::Now().GetSeconds() << " " << qsize << std::endl;
|
||||
q.close();
|
||||
queueSize << Simulator::Now().GetSeconds() << " " << qsize << std::endl;
|
||||
}
|
||||
|
||||
// Trace congestion window
|
||||
@@ -143,6 +148,10 @@ main(int argc, char* argv[])
|
||||
queueDisc = std::string("ns3::") + queueDisc;
|
||||
|
||||
Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::" + tcpTypeId));
|
||||
|
||||
// The maximum send buffer size is set to 4194304 bytes (4MB) and the
|
||||
// maximum receive buffer size is set to 6291456 bytes (6MB) in the Linux
|
||||
// kernel. The same buffer sizes are used as default in this example.
|
||||
Config::SetDefault("ns3::TcpSocket::SndBufSize", UintegerValue(4194304));
|
||||
Config::SetDefault("ns3::TcpSocket::RcvBufSize", UintegerValue(6291456));
|
||||
Config::SetDefault("ns3::TcpSocket::InitialCwnd", UintegerValue(10));
|
||||
@@ -225,23 +234,20 @@ main(int argc, char* argv[])
|
||||
|
||||
// Create a new directory to store the output of the program
|
||||
dir = "bbr-results/" + currentTime + "/";
|
||||
std::string dirToSave = "mkdir -p " + dir;
|
||||
if (system(dirToSave.c_str()) == -1)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
MakeDirectories(dir);
|
||||
|
||||
// The plotting scripts are provided in the following repository, if needed:
|
||||
// https://github.com/mohittahiliani/BBR-Validation/
|
||||
//
|
||||
// Download 'PlotScripts' directory (which is inside ns-3 scripts directory)
|
||||
// from the link given above and place it in the ns-3 root directory.
|
||||
// Uncomment the following three lines to generate plots for Congestion
|
||||
// Window, sender side throughput and queue occupancy on the bottleneck link.
|
||||
// Uncomment the following three lines to copy plot scripts for
|
||||
// Congestion Window, sender side throughput and queue occupancy on the
|
||||
// bottleneck link into the output directory.
|
||||
//
|
||||
// system (("cp -R PlotScripts/gnuplotScriptCwnd " + dir).c_str ());
|
||||
// system (("cp -R PlotScripts/gnuplotScriptThroughput " + dir).c_str ());
|
||||
// system (("cp -R PlotScripts/gnuplotScriptQueueSize " + dir).c_str ());
|
||||
// std::filesystem::copy("PlotScripts/gnuplotScriptCwnd", dir);
|
||||
// std::filesystem::copy("PlotScripts/gnuplotScriptThroughput", dir);
|
||||
// std::filesystem::copy("PlotScripts/gnuplotScriptQueueSize", dir);
|
||||
|
||||
// Trace the queue occupancy on the second interface of R1
|
||||
tch.Uninstall(routers.Get(0)->GetDevice(1));
|
||||
@@ -252,13 +258,17 @@ main(int argc, char* argv[])
|
||||
// Generate PCAP traces if it is enabled
|
||||
if (enablePcap)
|
||||
{
|
||||
if (system((dirToSave + "/pcap/").c_str()) == -1)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
MakeDirectories(dir + "pcap/");
|
||||
bottleneckLink.EnablePcapAll(dir + "/pcap/bbr", true);
|
||||
}
|
||||
|
||||
// Open files for writing throughput traces and queue size
|
||||
throughput.open(dir + "/throughput.dat", std::ios::out);
|
||||
queueSize.open(dir + "/queueSize.dat", std::ios::out);
|
||||
|
||||
NS_ASSERT_MSG(throughput.is_open(), "Throughput file was not opened correctly");
|
||||
NS_ASSERT_MSG(queueSize.is_open(), "Queue size file was not opened correctly");
|
||||
|
||||
// Check for dropped packets using Flow Monitor
|
||||
FlowMonitorHelper flowmon;
|
||||
Ptr<FlowMonitor> monitor = flowmon.InstallAll();
|
||||
@@ -268,5 +278,8 @@ main(int argc, char* argv[])
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
throughput.close();
|
||||
queueSize.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ std::string dir = "results/";
|
||||
Time stopTime = Seconds(60);
|
||||
uint32_t segmentSize = 524;
|
||||
|
||||
std::ofstream fPlotQueue;
|
||||
std::ofstream fPlotCwnd;
|
||||
|
||||
// Function to check queue length of Router 1
|
||||
void
|
||||
CheckQueueSize(Ptr<QueueDisc> queue)
|
||||
@@ -60,19 +63,14 @@ CheckQueueSize(Ptr<QueueDisc> queue)
|
||||
|
||||
// Check queue size every 1/100 of a second
|
||||
Simulator::Schedule(Seconds(0.001), &CheckQueueSize, queue);
|
||||
std::ofstream fPlotQueue(std::stringstream(dir + "queue-size.dat").str(),
|
||||
std::ios::out | std::ios::app);
|
||||
fPlotQueue << Simulator::Now().GetSeconds() << " " << qSize << std::endl;
|
||||
fPlotQueue.close();
|
||||
}
|
||||
|
||||
// Function to trace change in cwnd at n0
|
||||
static void
|
||||
CwndChange(uint32_t oldCwnd, uint32_t newCwnd)
|
||||
{
|
||||
std::ofstream fPlotQueue(dir + "cwndTraces/n0.dat", std::ios::out | std::ios::app);
|
||||
fPlotQueue << Simulator::Now().GetSeconds() << " " << newCwnd / segmentSize << std::endl;
|
||||
fPlotQueue.close();
|
||||
fPlotCwnd << Simulator::Now().GetSeconds() << " " << newCwnd / segmentSize << std::endl;
|
||||
}
|
||||
|
||||
// Function to calculate drops in a particular Queue
|
||||
@@ -228,15 +226,11 @@ main(int argc, char* argv[])
|
||||
retVal = system(dirToRemove.c_str());
|
||||
NS_ASSERT_MSG(retVal == 0, "Error in return value");
|
||||
}
|
||||
std::string dirToSave = "mkdir -p " + dir;
|
||||
retVal = system(dirToSave.c_str());
|
||||
NS_ASSERT_MSG(retVal == 0, "Error in return value");
|
||||
retVal = system((dirToSave + "/pcap/").c_str());
|
||||
NS_ASSERT_MSG(retVal == 0, "Error in return value");
|
||||
retVal = system((dirToSave + "/queueTraces/").c_str());
|
||||
NS_ASSERT_MSG(retVal == 0, "Error in return value");
|
||||
retVal = system((dirToSave + "/cwndTraces/").c_str());
|
||||
NS_ASSERT_MSG(retVal == 0, "Error in return value");
|
||||
|
||||
SystemPath::MakeDirectories(dir);
|
||||
SystemPath::MakeDirectories(dir + "/pcap/");
|
||||
SystemPath::MakeDirectories(dir + "/queueTraces/");
|
||||
SystemPath::MakeDirectories(dir + "/cwndTraces/");
|
||||
|
||||
// Set default parameters for queue discipline
|
||||
Config::SetDefault(qdiscTypeId + "::MaxSize", QueueSizeValue(QueueSize("100p")));
|
||||
@@ -251,6 +245,10 @@ main(int argc, char* argv[])
|
||||
// Enable BQL
|
||||
tch.SetQueueLimits("ns3::DynamicQueueLimits");
|
||||
|
||||
// Open files for writing queue size and cwnd traces
|
||||
fPlotQueue.open(dir + "queue-size.dat", std::ios::out);
|
||||
fPlotCwnd.open(dir + "cwndTraces/n0.dat", std::ios::out);
|
||||
|
||||
// Calls function to check queue size
|
||||
Simulator::ScheduleNow(&CheckQueueSize, qd.Get(0));
|
||||
|
||||
@@ -299,5 +297,8 @@ main(int argc, char* argv[])
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
fPlotQueue.close();
|
||||
fPlotCwnd.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -663,6 +663,9 @@ main(int argc, char* argv[])
|
||||
Config::SetDefault("ns3::TcpSocket::InitialCwnd", UintegerValue(10));
|
||||
Config::SetDefault("ns3::TcpL4Protocol::RecoveryType",
|
||||
TypeIdValue(TcpPrrRecovery::GetTypeId()));
|
||||
// Validation criteria were written for TCP Cubic without Reno-friendly behavior, so disable it
|
||||
// for these tests
|
||||
Config::SetDefault("ns3::TcpCubic::TcpFriendliness", BooleanValue(false));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// command-line argument parsing //
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
# /*
|
||||
# * This program is free software; you can redistribute it and/or modify
|
||||
# * it under the terms of the GNU General Public License version 2 as
|
||||
# * published by the Free Software Foundation;
|
||||
# *
|
||||
# * This program is distributed in the hope that it will be useful,
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# * GNU General Public License for more details.
|
||||
# *
|
||||
# * You should have received a copy of the GNU General Public License
|
||||
# * along with this program; if not, write to the Free Software
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# */
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation;
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
from ns import ns
|
||||
try:
|
||||
from ns import ns
|
||||
except ModuleNotFoundError:
|
||||
raise SystemExit(
|
||||
"Error: ns3 Python module not found;"
|
||||
" Python bindings may not be enabled"
|
||||
" or your PYTHONPATH might not be properly configured"
|
||||
)
|
||||
|
||||
# // Default Network Topology
|
||||
# //
|
||||
@@ -38,8 +45,7 @@ stack = ns.internet.InternetStackHelper()
|
||||
stack.Install(nodes)
|
||||
|
||||
address = ns.internet.Ipv4AddressHelper()
|
||||
address.SetBase(ns.network.Ipv4Address("10.1.1.0"),
|
||||
ns.network.Ipv4Mask("255.255.255.0"))
|
||||
address.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0"))
|
||||
|
||||
interfaces = address.Assign(devices)
|
||||
|
||||
@@ -61,4 +67,3 @@ clientApps.Stop(ns.core.Seconds(10.0))
|
||||
|
||||
ns.core.Simulator.Run()
|
||||
ns.core.Simulator.Destroy()
|
||||
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
# -*- Mode: Python; -*-
|
||||
# /*
|
||||
# * This program is free software; you can redistribute it and/or modify
|
||||
# * it under the terms of the GNU General Public License version 2 as
|
||||
# * published by the Free Software Foundation;
|
||||
# *
|
||||
# * This program is distributed in the hope that it will be useful,
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# * GNU General Public License for more details.
|
||||
# *
|
||||
# * You should have received a copy of the GNU General Public License
|
||||
# * along with this program; if not, write to the Free Software
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# *
|
||||
# * Ported to Python by Mohit P. Tahiliani
|
||||
# */
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation;
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Ported to Python by Mohit P. Tahiliani
|
||||
#
|
||||
|
||||
from ns import ns
|
||||
try:
|
||||
from ns import ns
|
||||
except ModuleNotFoundError:
|
||||
raise SystemExit(
|
||||
"Error: ns3 Python module not found;"
|
||||
" Python bindings may not be enabled"
|
||||
" or your PYTHONPATH might not be properly configured"
|
||||
)
|
||||
import sys
|
||||
from ctypes import c_bool, c_int
|
||||
|
||||
# // Default Network Topology
|
||||
# //
|
||||
@@ -27,7 +34,7 @@ import sys
|
||||
# // ================
|
||||
# // LAN 10.1.2.0
|
||||
|
||||
from ctypes import c_int, c_bool
|
||||
|
||||
nCsma = c_int(3)
|
||||
verbose = c_bool(True)
|
||||
cmd = ns.CommandLine(__file__)
|
||||
@@ -76,9 +83,11 @@ serverApps = echoServer.Install(csmaNodes.Get(nCsma.value))
|
||||
serverApps.Start(ns.core.Seconds(1.0))
|
||||
serverApps.Stop(ns.core.Seconds(10.0))
|
||||
|
||||
echoClient = ns.applications.UdpEchoClientHelper(csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9)
|
||||
echoClient = ns.applications.UdpEchoClientHelper(
|
||||
csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9
|
||||
)
|
||||
echoClient.SetAttribute("MaxPackets", ns.core.UintegerValue(1))
|
||||
echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds (1.0)))
|
||||
echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds(1.0)))
|
||||
echoClient.SetAttribute("PacketSize", ns.core.UintegerValue(1024))
|
||||
|
||||
clientApps = echoClient.Install(p2pNodes.Get(0))
|
||||
@@ -88,8 +97,7 @@ clientApps.Stop(ns.core.Seconds(10.0))
|
||||
ns.internet.Ipv4GlobalRoutingHelper.PopulateRoutingTables()
|
||||
|
||||
pointToPoint.EnablePcapAll("second")
|
||||
csma.EnablePcap ("second", csmaDevices.Get (1), True)
|
||||
csma.EnablePcap("second", csmaDevices.Get(1), True)
|
||||
|
||||
ns.core.Simulator.Run()
|
||||
ns.core.Simulator.Destroy()
|
||||
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
# -*- Mode: Python; -*-
|
||||
# /*
|
||||
# * This program is free software; you can redistribute it and/or modify
|
||||
# * it under the terms of the GNU General Public License version 2 as
|
||||
# * published by the Free Software Foundation;
|
||||
# *
|
||||
# * This program is distributed in the hope that it will be useful,
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# * GNU General Public License for more details.
|
||||
# *
|
||||
# * You should have received a copy of the GNU General Public License
|
||||
# * along with this program; if not, write to the Free Software
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# *
|
||||
# * Ported to Python by Mohit P. Tahiliani
|
||||
# */
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation;
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Ported to Python by Mohit P. Tahiliani
|
||||
#
|
||||
|
||||
from ns import ns
|
||||
try:
|
||||
from ns import ns
|
||||
except ModuleNotFoundError:
|
||||
raise SystemExit(
|
||||
"Error: ns3 Python module not found;"
|
||||
" Python bindings may not be enabled"
|
||||
" or your PYTHONPATH might not be properly configured"
|
||||
)
|
||||
import sys
|
||||
from ctypes import c_bool, c_int
|
||||
|
||||
# // Default Network Topology
|
||||
# //
|
||||
@@ -30,7 +37,7 @@ import sys
|
||||
# // ================
|
||||
# // LAN 10.1.2.0
|
||||
|
||||
from ctypes import c_bool, c_int
|
||||
|
||||
nCsma = c_int(3)
|
||||
verbose = c_bool(True)
|
||||
nWifi = c_int(3)
|
||||
@@ -83,22 +90,40 @@ phy = ns.wifi.YansWifiPhyHelper()
|
||||
phy.SetChannel(channel.Create())
|
||||
|
||||
mac = ns.wifi.WifiMacHelper()
|
||||
ssid = ns.wifi.Ssid ("ns-3-ssid")
|
||||
ssid = ns.wifi.Ssid("ns-3-ssid")
|
||||
|
||||
wifi = ns.wifi.WifiHelper()
|
||||
|
||||
mac.SetType ("ns3::StaWifiMac", "Ssid", ns.wifi.SsidValue(ssid), "ActiveProbing", ns.core.BooleanValue(False))
|
||||
mac.SetType(
|
||||
"ns3::StaWifiMac", "Ssid", ns.wifi.SsidValue(ssid), "ActiveProbing", ns.core.BooleanValue(False)
|
||||
)
|
||||
staDevices = wifi.Install(phy, mac, wifiStaNodes)
|
||||
|
||||
mac.SetType("ns3::ApWifiMac","Ssid", ns.wifi.SsidValue (ssid))
|
||||
mac.SetType("ns3::ApWifiMac", "Ssid", ns.wifi.SsidValue(ssid))
|
||||
apDevices = wifi.Install(phy, mac, wifiApNode)
|
||||
|
||||
mobility = ns.mobility.MobilityHelper()
|
||||
mobility.SetPositionAllocator("ns3::GridPositionAllocator", "MinX", ns.core.DoubleValue(0.0),
|
||||
"MinY", ns.core.DoubleValue (0.0), "DeltaX", ns.core.DoubleValue(5.0), "DeltaY", ns.core.DoubleValue(10.0),
|
||||
"GridWidth", ns.core.UintegerValue(3), "LayoutType", ns.core.StringValue("RowFirst"))
|
||||
mobility.SetPositionAllocator(
|
||||
"ns3::GridPositionAllocator",
|
||||
"MinX",
|
||||
ns.core.DoubleValue(0.0),
|
||||
"MinY",
|
||||
ns.core.DoubleValue(0.0),
|
||||
"DeltaX",
|
||||
ns.core.DoubleValue(5.0),
|
||||
"DeltaY",
|
||||
ns.core.DoubleValue(10.0),
|
||||
"GridWidth",
|
||||
ns.core.UintegerValue(3),
|
||||
"LayoutType",
|
||||
ns.core.StringValue("RowFirst"),
|
||||
)
|
||||
|
||||
mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel", "Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle (-50, 50, -50, 50)))
|
||||
mobility.SetMobilityModel(
|
||||
"ns3::RandomWalk2dMobilityModel",
|
||||
"Bounds",
|
||||
ns.mobility.RectangleValue(ns.mobility.Rectangle(-50, 50, -50, 50)),
|
||||
)
|
||||
mobility.Install(wifiStaNodes)
|
||||
|
||||
mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel")
|
||||
@@ -126,12 +151,14 @@ serverApps = echoServer.Install(csmaNodes.Get(nCsma.value))
|
||||
serverApps.Start(ns.core.Seconds(1.0))
|
||||
serverApps.Stop(ns.core.Seconds(10.0))
|
||||
|
||||
echoClient = ns.applications.UdpEchoClientHelper(csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9)
|
||||
echoClient = ns.applications.UdpEchoClientHelper(
|
||||
csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9
|
||||
)
|
||||
echoClient.SetAttribute("MaxPackets", ns.core.UintegerValue(1))
|
||||
echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds (1.0)))
|
||||
echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds(1.0)))
|
||||
echoClient.SetAttribute("PacketSize", ns.core.UintegerValue(1024))
|
||||
|
||||
clientApps = echoClient.Install(wifiStaNodes.Get (nWifi.value - 1))
|
||||
clientApps = echoClient.Install(wifiStaNodes.Get(nWifi.value - 1))
|
||||
clientApps.Start(ns.core.Seconds(2.0))
|
||||
clientApps.Stop(ns.core.Seconds(10.0))
|
||||
|
||||
@@ -141,10 +168,9 @@ ns.core.Simulator.Stop(ns.core.Seconds(10.0))
|
||||
|
||||
if tracing.value:
|
||||
phy.SetPcapDataLinkType(phy.DLT_IEEE802_11_RADIO)
|
||||
pointToPoint.EnablePcapAll ("third")
|
||||
phy.EnablePcap ("third", apDevices.Get (0))
|
||||
csma.EnablePcap ("third", csmaDevices.Get (0), True)
|
||||
pointToPoint.EnablePcapAll("third")
|
||||
phy.EnablePcap("third", apDevices.Get(0))
|
||||
csma.EnablePcap("third", csmaDevices.Get(0), True)
|
||||
|
||||
ns.core.Simulator.Run()
|
||||
ns.core.Simulator.Destroy()
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ cpp_examples = [
|
||||
("wifi-multirate --totalTime=0.3s --rateManager=ns3::MinstrelWifiManager", "True", "False"),
|
||||
("wifi-multirate --totalTime=0.3s --rateManager=ns3::OnoeWifiManager", "True", "False"),
|
||||
("wifi-multirate --totalTime=0.3s --rateManager=ns3::RraaWifiManager", "True", "False"),
|
||||
("wifi-adhoc", "False", "True"), # Takes too long to run
|
||||
("wifi-ap --verbose=0", "True", "True"), # Don't let it spew to stdout
|
||||
("wifi-clear-channel-cmu", "False", "True"), # Requires specific hardware
|
||||
("wifi-adhoc", "False", "True"), # Takes too long to run
|
||||
("wifi-ap --verbose=0", "True", "True"), # Don't let it spew to stdout
|
||||
("wifi-clear-channel-cmu", "False", "True"), # Requires specific hardware
|
||||
("wifi-simple-adhoc", "True", "True"),
|
||||
("wifi-simple-adhoc-grid", "True", "True"),
|
||||
("wifi-simple-infra", "True", "True"),
|
||||
@@ -26,12 +26,36 @@ cpp_examples = [
|
||||
("wifi-sleep", "True", "True"),
|
||||
("wifi-blockack", "True", "True"),
|
||||
("wifi-timing-attributes --simulationTime=1", "True", "True"),
|
||||
("wifi-power-adaptation-distance --manager=ns3::ParfWifiManager --outputFileName=parf --steps=5 --stepsSize=10", "True", "True"),
|
||||
("wifi-power-adaptation-distance --manager=ns3::AparfWifiManager --outputFileName=aparf --steps=5 --stepsSize=10", "True", "False"),
|
||||
("wifi-power-adaptation-distance --manager=ns3::RrpaaWifiManager --outputFileName=rrpaa --steps=5 --stepsSize=10", "True", "False"),
|
||||
("wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1", "True", "False"),
|
||||
("wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1 --STA1_x=-200", "True", "False"),
|
||||
("wifi-rate-adaptation-distance --staManager=ns3::MinstrelHtWifiManager --apManager=ns3::MinstrelHtWifiManager --outputFileName=minstrelHt --shortGuardInterval=true --channelWidth=40 --stepsSize=50 --stepsTime=0.1", "True", "False"),
|
||||
(
|
||||
"wifi-power-adaptation-distance --manager=ns3::ParfWifiManager --outputFileName=parf --steps=5 --stepsSize=10",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-power-adaptation-distance --manager=ns3::AparfWifiManager --outputFileName=aparf --steps=5 --stepsSize=10",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-power-adaptation-distance --manager=ns3::RrpaaWifiManager --outputFileName=rrpaa --steps=5 --stepsSize=10",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1 --STA1_x=-200",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-rate-adaptation-distance --staManager=ns3::MinstrelHtWifiManager --apManager=ns3::MinstrelHtWifiManager --outputFileName=minstrelHt --shortGuardInterval=true --channelWidth=40 --stepsSize=50 --stepsTime=0.1",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
("wifi-power-adaptation-interference --simuTime=5", "True", "False"),
|
||||
("wifi-dsss-validation", "True", "True"),
|
||||
("wifi-ofdm-validation", "True", "True"),
|
||||
@@ -40,37 +64,145 @@ cpp_examples = [
|
||||
("wifi-ofdm-he-validation", "True", "True"),
|
||||
("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=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=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"),
|
||||
("wifi-he-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=223", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --minExpectedThroughput=20 --maxExpectedThroughput=212", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.3 --frequency=2.4 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --minExpectedThroughput=27 --maxExpectedThroughput=50", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --minExpectedThroughput=31 --maxExpectedThroughput=290", "True", "True"),
|
||||
("wifi-he-network --simulationTime=0.3 --udp=1 --downlink=0 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --minExpectedThroughput=46 --maxExpectedThroughput=327", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=550", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --frequency2=6 --minExpectedThroughput=12 --maxExpectedThroughput=550", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=547", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --useExtendedBlockAck=1 --frequency2=5 --minExpectedThroughput=12 --maxExpectedThroughput=500", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=212", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.23 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --frequency2=6 --minExpectedThroughput=35 --maxExpectedThroughput=280", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.25 --frequency=2.4 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --frequency2=5 --useExtendedBlockAck=1 --minExpectedThroughput=40 --maxExpectedThroughput=100", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --frequency2=2.4 --minExpectedThroughput=50 --maxExpectedThroughput=140", "True", "True"),
|
||||
("wifi-eht-network --simulationTime=0.2 --udp=1 --downlink=0 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --frequency2=6 --minExpectedThroughput=70 --maxExpectedThroughput=715", "True", "True"),
|
||||
("wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", "True", "True"),
|
||||
("wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58", "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=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=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",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=223",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --minExpectedThroughput=20 --maxExpectedThroughput=212",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --frequency=2.4 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --minExpectedThroughput=27 --maxExpectedThroughput=50",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --minExpectedThroughput=31 --maxExpectedThroughput=290",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --udp=1 --downlink=0 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --minExpectedThroughput=46 --maxExpectedThroughput=327",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=550",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --mpduBufferSize=1024 --frequency2=6 --minExpectedThroughput=12 --maxExpectedThroughput=550",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=547",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --mpduBufferSize=512 --frequency2=5 --minExpectedThroughput=12 --maxExpectedThroughput=500",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=240",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.23 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=5 --frequency2=6 --minExpectedThroughput=35 --maxExpectedThroughput=280",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.25 --frequency=2.4 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --frequency2=5 --mpduBufferSize=1024 --minExpectedThroughput=50 --maxExpectedThroughput=120",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --frequency2=2.4 --minExpectedThroughput=50 --maxExpectedThroughput=140",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.2 --udp=0 --downlink=0 --useRts=0 --nStations=4 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mpduBufferSize=1024 --mcs=4 --muSchedAccessReqInterval=45ms --frequency2=6 --minExpectedThroughput=50 --maxExpectedThroughput=415",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
("wifi-mixed-network --simulationTime=1", "True", "True"),
|
||||
("wifi-aggregation --simulationTime=1 --verifyResults=1", "True", "True"),
|
||||
("wifi-txop-aggregation --simulationTime=1 --verifyResults=1", "True", "True"),
|
||||
("wifi-80211e-txop --simulationTime=1 --verifyResults=1", "True", "True"),
|
||||
("wifi-multi-tos --simulationTime=1 --nWifi=16 --useRts=1 --useShortGuardInterval=1", "True", "True"),
|
||||
(
|
||||
"wifi-multi-tos --simulationTime=1 --nWifi=16 --useRts=1 --useShortGuardInterval=1",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
("wifi-tcp", "True", "True"),
|
||||
("wifi-hidden-terminal --wifiManager=Arf", "True", "True"),
|
||||
("wifi-hidden-terminal --wifiManager=Aarf", "True", "True"),
|
||||
@@ -81,14 +213,42 @@ cpp_examples = [
|
||||
("wifi-hidden-terminal --wifiManager=Cara", "True", "True"),
|
||||
("wifi-hidden-terminal --wifiManager=Rraa", "True", "True"),
|
||||
("wifi-hidden-terminal --wifiManager=Rrpaa", "True", "True"),
|
||||
("wifi-spectrum-per-example --distance=52 --index=3 --wifiType=ns3::SpectrumWifiPhy --simulationTime=1", "True", "True"),
|
||||
("wifi-spectrum-per-example --distance=24 --index=31 --wifiType=ns3::YansWifiPhy --simulationTime=1", "True", "False"),
|
||||
("wifi-spectrum-per-interference --distance=24 --index=31 --simulationTime=1 --waveformPower=0.1", "True", "True"),
|
||||
(
|
||||
"wifi-spectrum-per-example --distance=52 --index=3 --wifiType=ns3::SpectrumWifiPhy --simulationTime=1",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-spectrum-per-example --distance=24 --index=31 --wifiType=ns3::YansWifiPhy --simulationTime=1",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-spectrum-per-interference --distance=24 --index=31 --simulationTime=1 --waveformPower=0.1",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
("wifi-spectrum-saturation-example --simulationTime=1 --index=63", "True", "True"),
|
||||
("wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --simulationTime=1", "True", "True"),
|
||||
("wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --apRaa=Ideal --staRaa=Ideal --simulationTime=1", "True", "False"),
|
||||
("wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --simulationTime=1", "True", "False"),
|
||||
("wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --apRaa=Ideal --staRaa=Ideal --simulationTime=1", "True", "False"),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --simulationTime=1",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --apRaa=Ideal --staRaa=Ideal --simulationTime=1",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --simulationTime=1",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --apRaa=Ideal --staRaa=Ideal --simulationTime=1",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
]
|
||||
|
||||
# A list of Python examples to run in order to ensure that they remain
|
||||
|
||||
@@ -51,7 +51,14 @@
|
||||
# +----------------+ +----------------+
|
||||
#
|
||||
|
||||
from ns import ns
|
||||
try:
|
||||
from ns import ns
|
||||
except ModuleNotFoundError:
|
||||
raise SystemExit(
|
||||
"Error: ns3 Python module not found;"
|
||||
" Python bindings may not be enabled"
|
||||
" or your PYTHONPATH might not be properly configured"
|
||||
)
|
||||
|
||||
# #
|
||||
# # This function will be used below as a trace sink
|
||||
@@ -63,12 +70,14 @@ from ns import ns
|
||||
# std.cout << "CourseChange " << path << " x=" << position.x << ", y=" << position.y << ", z=" << position.z << std.endl;
|
||||
# }
|
||||
|
||||
|
||||
def main(argv):
|
||||
#
|
||||
# First, we initialize a few local variables that control some
|
||||
# simulation parameters.
|
||||
#
|
||||
from ctypes import c_int, c_double
|
||||
from ctypes import c_double, c_int
|
||||
|
||||
backboneNodes = c_int(10)
|
||||
infraNodes = c_int(2)
|
||||
lanNodes = c_int(2)
|
||||
@@ -99,8 +108,8 @@ def main(argv):
|
||||
#
|
||||
cmd.Parse(argv)
|
||||
|
||||
if (stopTime.value < 10):
|
||||
print ("Use a simulation stop time >= 10 seconds")
|
||||
if stopTime.value < 10:
|
||||
print("Use a simulation stop time >= 10 seconds")
|
||||
exit(1)
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
# #
|
||||
@@ -121,8 +130,9 @@ def main(argv):
|
||||
wifi = ns.wifi.WifiHelper()
|
||||
mac = ns.wifi.WifiMacHelper()
|
||||
mac.SetType("ns3::AdhocWifiMac")
|
||||
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
|
||||
"DataMode", ns.core.StringValue("OfdmRate54Mbps"))
|
||||
wifi.SetRemoteStationManager(
|
||||
"ns3::ConstantRateWifiManager", "DataMode", ns.core.StringValue("OfdmRate54Mbps")
|
||||
)
|
||||
wifiPhy = ns.wifi.YansWifiPhyHelper()
|
||||
wifiPhy.SetPcapDataLinkType(wifiPhy.DLT_IEEE802_11_RADIO)
|
||||
wifiChannel = ns.wifi.YansWifiChannelHelper.Default()
|
||||
@@ -131,11 +141,12 @@ def main(argv):
|
||||
#
|
||||
# Add the IPv4 protocol stack to the nodes in our container
|
||||
#
|
||||
print ("Enabling OLSR routing on all backbone nodes")
|
||||
print("Enabling OLSR routing on all backbone nodes")
|
||||
internet = ns.internet.InternetStackHelper()
|
||||
olsr = ns.olsr.OlsrHelper()
|
||||
internet.SetRoutingHelper(olsr); # has effect on the next Install ()
|
||||
internet.Install(backbone);
|
||||
internet.SetRoutingHelper(olsr)
|
||||
# has effect on the next Install ()
|
||||
internet.Install(backbone)
|
||||
# re-initialize for non-olsr routing.
|
||||
# internet.Reset()
|
||||
#
|
||||
@@ -151,17 +162,30 @@ def main(argv):
|
||||
# each of the nodes we just finished building.
|
||||
#
|
||||
mobility = ns.mobility.MobilityHelper()
|
||||
mobility.SetPositionAllocator("ns3::GridPositionAllocator",
|
||||
"MinX", ns.core.DoubleValue(20.0),
|
||||
"MinY", ns.core.DoubleValue(20.0),
|
||||
"DeltaX", ns.core.DoubleValue(20.0),
|
||||
"DeltaY", ns.core.DoubleValue(20.0),
|
||||
"GridWidth", ns.core.UintegerValue(5),
|
||||
"LayoutType", ns.core.StringValue("RowFirst"))
|
||||
mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
|
||||
"Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle(-500, 500, -500, 500)),
|
||||
"Speed", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=2]"),
|
||||
"Pause", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0.2]"))
|
||||
mobility.SetPositionAllocator(
|
||||
"ns3::GridPositionAllocator",
|
||||
"MinX",
|
||||
ns.core.DoubleValue(20.0),
|
||||
"MinY",
|
||||
ns.core.DoubleValue(20.0),
|
||||
"DeltaX",
|
||||
ns.core.DoubleValue(20.0),
|
||||
"DeltaY",
|
||||
ns.core.DoubleValue(20.0),
|
||||
"GridWidth",
|
||||
ns.core.UintegerValue(5),
|
||||
"LayoutType",
|
||||
ns.core.StringValue("RowFirst"),
|
||||
)
|
||||
mobility.SetMobilityModel(
|
||||
"ns3::RandomDirection2dMobilityModel",
|
||||
"Bounds",
|
||||
ns.mobility.RectangleValue(ns.mobility.Rectangle(-500, 500, -500, 500)),
|
||||
"Speed",
|
||||
ns.core.StringValue("ns3::ConstantRandomVariable[Constant=2]"),
|
||||
"Pause",
|
||||
ns.core.StringValue("ns3::ConstantRandomVariable[Constant=0.2]"),
|
||||
)
|
||||
mobility.Install(backbone)
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
@@ -175,7 +199,7 @@ def main(argv):
|
||||
ipAddrs.SetBase(ns.network.Ipv4Address("172.16.0.0"), ns.network.Ipv4Mask("255.255.255.0"))
|
||||
|
||||
for i in range(backboneNodes.value):
|
||||
print ("Configuring local area network for backbone node ", i)
|
||||
print("Configuring local area network for backbone node ", i)
|
||||
#
|
||||
# Create a container to manage the nodes of the LAN. We need
|
||||
# two containers here; one with all of the new nodes, and one
|
||||
@@ -214,12 +238,12 @@ def main(argv):
|
||||
mobilityLan = ns.mobility.MobilityHelper()
|
||||
positionAlloc = ns.mobility.ListPositionAllocator()
|
||||
for j in range(newLanNodes.GetN()):
|
||||
positionAlloc.Add(ns.core.Vector(0.0, (j*10 + 10), 0.0))
|
||||
positionAlloc.Add(ns.core.Vector(0.0, (j * 10 + 10), 0.0))
|
||||
|
||||
mobilityLan.SetPositionAllocator(positionAlloc)
|
||||
mobilityLan.PushReferenceMobilityModel(backbone.Get(i))
|
||||
mobilityLan.SetMobilityModel("ns3::ConstantPositionMobilityModel")
|
||||
mobilityLan.Install(newLanNodes);
|
||||
mobilityLan.Install(newLanNodes)
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
# #
|
||||
@@ -232,7 +256,7 @@ def main(argv):
|
||||
ipAddrs.SetBase(ns.network.Ipv4Address("10.0.0.0"), ns.network.Ipv4Mask("255.255.255.0"))
|
||||
tempRef = [] # list of references to be held to prevent garbage collection
|
||||
for i in range(backboneNodes.value):
|
||||
print ("Configuring wireless network for backbone node ", i)
|
||||
print("Configuring wireless network for backbone node ", i)
|
||||
#
|
||||
# Create a container to manage the nodes of the LAN. We need
|
||||
# two containers here; one with all of the new nodes, and one
|
||||
@@ -245,18 +269,16 @@ def main(argv):
|
||||
#
|
||||
# Create another ad hoc network and devices
|
||||
#
|
||||
ssid = ns.wifi.Ssid('wifi-infra' + str(i))
|
||||
ssid = ns.wifi.Ssid("wifi-infra" + str(i))
|
||||
wifiInfra = ns.wifi.WifiHelper()
|
||||
wifiPhy.SetChannel(wifiChannel.Create())
|
||||
macInfra = ns.wifi.WifiMacHelper();
|
||||
macInfra.SetType("ns3::StaWifiMac",
|
||||
"Ssid", ns.wifi.SsidValue(ssid))
|
||||
macInfra = ns.wifi.WifiMacHelper()
|
||||
macInfra.SetType("ns3::StaWifiMac", "Ssid", ns.wifi.SsidValue(ssid))
|
||||
|
||||
# setup stas
|
||||
staDevices = wifiInfra.Install(wifiPhy, macInfra, stas)
|
||||
# setup ap.
|
||||
macInfra.SetType("ns3::ApWifiMac",
|
||||
"Ssid", ns.wifi.SsidValue(ssid))
|
||||
macInfra.SetType("ns3::ApWifiMac", "Ssid", ns.wifi.SsidValue(ssid))
|
||||
apDevices = wifiInfra.Install(wifiPhy, macInfra, backbone.Get(i))
|
||||
# Collect all of these new devices
|
||||
infraDevices = ns.network.NetDeviceContainer(apDevices, staDevices)
|
||||
@@ -291,10 +313,15 @@ def main(argv):
|
||||
|
||||
mobility.PushReferenceMobilityModel(backbone.Get(i))
|
||||
mobility.SetPositionAllocator(subnetAlloc)
|
||||
mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel",
|
||||
"Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle(-10, 10, -10, 10)),
|
||||
"Speed", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=3]"),
|
||||
"Pause", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0.4]"))
|
||||
mobility.SetMobilityModel(
|
||||
"ns3::RandomDirection2dMobilityModel",
|
||||
"Bounds",
|
||||
ns.mobility.RectangleValue(ns.mobility.Rectangle(-10, 10, -10, 10)),
|
||||
"Speed",
|
||||
ns.core.StringValue("ns3::ConstantRandomVariable[Constant=3]"),
|
||||
"Pause",
|
||||
ns.core.StringValue("ns3::ConstantRandomVariable[Constant=0.4]"),
|
||||
)
|
||||
mobility.Install(stas)
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
@@ -305,18 +332,25 @@ def main(argv):
|
||||
|
||||
# Create the OnOff application to send UDP datagrams of size
|
||||
# 210 bytes at a rate of 448 Kb/s, between two nodes
|
||||
print ("Create Applications.")
|
||||
port = 9 # Discard port(RFC 863)
|
||||
print("Create Applications.")
|
||||
port = 9 # Discard port(RFC 863)
|
||||
|
||||
appSource = ns.network.NodeList.GetNode(backboneNodes.value)
|
||||
lastNodeIndex = backboneNodes.value + backboneNodes.value*(lanNodes.value - 1) + backboneNodes.value*(infraNodes.value - 1) - 1
|
||||
lastNodeIndex = (
|
||||
backboneNodes.value
|
||||
+ backboneNodes.value * (lanNodes.value - 1)
|
||||
+ backboneNodes.value * (infraNodes.value - 1)
|
||||
- 1
|
||||
)
|
||||
appSink = ns.network.NodeList.GetNode(lastNodeIndex)
|
||||
|
||||
ns.cppyy.cppdef("""
|
||||
ns.cppyy.cppdef(
|
||||
"""
|
||||
Ipv4Address getIpv4AddressFromNode(Ptr<Node> node){
|
||||
return node->GetObject<Ipv4>()->GetAddress(1,0).GetLocal();
|
||||
}
|
||||
""")
|
||||
"""
|
||||
)
|
||||
# Let's fetch the IP address of the last node, which is on Ipv4Interface 1
|
||||
remoteAddr = ns.cppyy.gbl.getIpv4AddressFromNode(appSink)
|
||||
socketAddr = ns.network.InetSocketAddress(remoteAddr, port)
|
||||
@@ -326,8 +360,12 @@ def main(argv):
|
||||
apps.Stop(ns.core.Seconds(stopTime.value - 1))
|
||||
|
||||
# Create a packet sink to receive these packets
|
||||
sink = ns.applications.PacketSinkHelper("ns3::UdpSocketFactory",
|
||||
ns.network.InetSocketAddress(ns.network.InetSocketAddress(ns.network.Ipv4Address.GetAny(), port)).ConvertTo())
|
||||
sink = ns.applications.PacketSinkHelper(
|
||||
"ns3::UdpSocketFactory",
|
||||
ns.network.InetSocketAddress(
|
||||
ns.network.InetSocketAddress(ns.network.Ipv4Address.GetAny(), port)
|
||||
).ConvertTo(),
|
||||
)
|
||||
sinkContainer = ns.network.NodeContainer(appSink)
|
||||
apps = sink.Install(sinkContainer)
|
||||
apps.Start(ns.core.Seconds(3))
|
||||
@@ -338,16 +376,16 @@ def main(argv):
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # /
|
||||
|
||||
print ("Configure Tracing.")
|
||||
print("Configure Tracing.")
|
||||
csma = ns.csma.CsmaHelper()
|
||||
#
|
||||
# Let's set up some ns-2-like ascii traces, using another helper class
|
||||
#
|
||||
ascii = ns.network.AsciiTraceHelper();
|
||||
stream = ascii.CreateFileStream("mixed-wireless.tr");
|
||||
wifiPhy.EnableAsciiAll(stream);
|
||||
csma.EnableAsciiAll(stream);
|
||||
internet.EnableAsciiIpv4All(stream);
|
||||
ascii = ns.network.AsciiTraceHelper()
|
||||
stream = ascii.CreateFileStream("mixed-wireless.tr")
|
||||
wifiPhy.EnableAsciiAll(stream)
|
||||
csma.EnableAsciiAll(stream)
|
||||
internet.EnableAsciiIpv4All(stream)
|
||||
|
||||
# Csma captures in non-promiscuous mode
|
||||
csma.EnablePcapAll("mixed-wireless", False)
|
||||
@@ -355,11 +393,10 @@ def main(argv):
|
||||
wifiPhy.EnablePcap("mixed-wireless", backboneDevices)
|
||||
wifiPhy.EnablePcap("mixed-wireless", appSink.GetId(), 0)
|
||||
|
||||
# #ifdef ENABLE_FOR_TRACING_EXAMPLE
|
||||
# Config.Connect("/NodeList/*/$MobilityModel/CourseChange",
|
||||
# MakeCallback(&CourseChangeCallback))
|
||||
# #endif
|
||||
|
||||
# #ifdef ENABLE_FOR_TRACING_EXAMPLE
|
||||
# Config.Connect("/NodeList/*/$MobilityModel/CourseChange",
|
||||
# MakeCallback(&CourseChangeCallback))
|
||||
# #endif
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
@@ -367,13 +404,13 @@ def main(argv):
|
||||
# #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
print ("Run Simulation.")
|
||||
print("Run Simulation.")
|
||||
ns.core.Simulator.Stop(ns.core.Seconds(stopTime.value))
|
||||
ns.core.Simulator.Run()
|
||||
ns.core.Simulator.Destroy()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
main(sys.argv)
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
|
||||
@@ -22,7 +22,14 @@
|
||||
|
||||
import sys
|
||||
|
||||
from ns import ns
|
||||
try:
|
||||
from ns import ns
|
||||
except ModuleNotFoundError:
|
||||
raise SystemExit(
|
||||
"Error: ns3 Python module not found;"
|
||||
" Python bindings may not be enabled"
|
||||
" or your PYTHONPATH might not be properly configured"
|
||||
)
|
||||
|
||||
# void
|
||||
# DevTxTrace (std::string context, Ptr<const Packet> p, Mac48Address address)
|
||||
@@ -70,7 +77,8 @@ from ns import ns
|
||||
# std::cout << " start="<<start<<" duration="<<duration<<std::endl;
|
||||
# }
|
||||
|
||||
ns.cppyy.cppdef("""
|
||||
ns.cppyy.cppdef(
|
||||
"""
|
||||
using namespace ns3;
|
||||
void AdvancePosition(Ptr<Node> node){
|
||||
Ptr<MobilityModel> mob = node->GetObject<MobilityModel>();
|
||||
@@ -80,7 +88,9 @@ ns.cppyy.cppdef("""
|
||||
return;
|
||||
mob->SetPosition(pos);
|
||||
Simulator::Schedule(Seconds(1.0), AdvancePosition, node);
|
||||
}""")
|
||||
}"""
|
||||
)
|
||||
|
||||
|
||||
def main(argv):
|
||||
ns.core.CommandLine().Parse(argv)
|
||||
@@ -91,7 +101,7 @@ def main(argv):
|
||||
mobility = ns.mobility.MobilityHelper()
|
||||
stas = ns.network.NodeContainer()
|
||||
ap = ns.network.NodeContainer()
|
||||
#NetDeviceContainer staDevs;
|
||||
# NetDeviceContainer staDevs;
|
||||
packetSocket = ns.network.PacketSocketHelper()
|
||||
|
||||
stas.Create(2)
|
||||
@@ -109,15 +119,16 @@ def main(argv):
|
||||
wifiMac = ns.wifi.WifiMacHelper()
|
||||
|
||||
# setup stas.
|
||||
wifiMac.SetType("ns3::StaWifiMac",
|
||||
"ActiveProbing",
|
||||
ns.core.BooleanValue(True),
|
||||
"Ssid",
|
||||
ns.wifi.SsidValue(ssid))
|
||||
wifiMac.SetType(
|
||||
"ns3::StaWifiMac",
|
||||
"ActiveProbing",
|
||||
ns.core.BooleanValue(True),
|
||||
"Ssid",
|
||||
ns.wifi.SsidValue(ssid),
|
||||
)
|
||||
staDevs = wifi.Install(wifiPhy, wifiMac, stas)
|
||||
# setup ap.
|
||||
wifiMac.SetType("ns3::ApWifiMac",
|
||||
"Ssid", ns.wifi.SsidValue(ssid))
|
||||
wifiMac.SetType("ns3::ApWifiMac", "Ssid", ns.wifi.SsidValue(ssid))
|
||||
wifi.Install(wifiPhy, wifiMac, ap)
|
||||
|
||||
# mobility.
|
||||
@@ -132,7 +143,7 @@ def main(argv):
|
||||
socket.SetProtocol(1)
|
||||
|
||||
onoff = ns.applications.OnOffHelper("ns3::PacketSocketFactory", socket.ConvertTo())
|
||||
onoff.SetConstantRate (ns.network.DataRate ("500kb/s"))
|
||||
onoff.SetConstantRate(ns.network.DataRate("500kb/s"))
|
||||
|
||||
apps = onoff.Install(ns.network.NodeContainer(stas.Get(0)))
|
||||
apps.Start(ns.core.Seconds(0.5))
|
||||
@@ -140,13 +151,12 @@ def main(argv):
|
||||
|
||||
ns.core.Simulator.Stop(ns.core.Seconds(44.0))
|
||||
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Tx", MakeCallback(&DevTxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Rx", MakeCallback(&DevRxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback(&PhyRxOkTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback(&PhyRxErrorTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback(&PhyTxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/State", MakeCallback(&PhyStateTrace));
|
||||
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Tx", MakeCallback(&DevTxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Rx", MakeCallback(&DevRxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback(&PhyRxOkTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback(&PhyRxErrorTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback(&PhyTxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Phy/State", MakeCallback(&PhyStateTrace));
|
||||
|
||||
ns.core.Simulator.Run()
|
||||
ns.core.Simulator.Destroy()
|
||||
@@ -154,6 +164,5 @@ def main(argv):
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/tuple.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
@@ -149,7 +150,7 @@ main(int argc, char* argv[])
|
||||
WifiMacHelper mac;
|
||||
WifiHelper wifi;
|
||||
Ssid ssid = Ssid("ns3");
|
||||
TupleValue<UintegerValue, UintegerValue, EnumValue, UintegerValue> channelValue;
|
||||
TupleValue<UintegerValue, UintegerValue, EnumValue<WifiPhyBand>, UintegerValue> channelValue;
|
||||
|
||||
const auto& [staStandard, staBand] = ConvertStringToStandardAndBand(staVersion);
|
||||
wifi.SetStandard(staStandard);
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "ns3/enum.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/ipv4-global-routing-helper.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/multi-model-spectrum-channel.h"
|
||||
@@ -37,6 +36,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/wifi-acknowledgment.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
@@ -93,7 +93,7 @@ GetRxBytes(bool udp, const ApplicationContainer& serverApp, uint32_t payloadSize
|
||||
}
|
||||
}
|
||||
return rxBytes;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Print average throughput over an intermediate time interval.
|
||||
@@ -146,7 +146,12 @@ main(int argc, char* argv[])
|
||||
bool udp{true};
|
||||
bool downlink{true};
|
||||
bool useRts{false};
|
||||
bool useExtendedBlockAck{false};
|
||||
uint16_t mpduBufferSize{512};
|
||||
std::string emlsrLinks;
|
||||
uint16_t paddingDelayUsec{32};
|
||||
uint16_t transitionDelayUsec{128};
|
||||
uint16_t channelSwitchDelayUsec{100};
|
||||
bool switchAuxPhy{true};
|
||||
double simulationTime{10}; // seconds
|
||||
double distance{1.0}; // meters
|
||||
double frequency{5}; // whether the first link operates in the 2.4, 5 or 6 GHz
|
||||
@@ -181,6 +186,22 @@ main(int argc, char* argv[])
|
||||
"Whether the third link operates in the 2.4, 5 or 6 GHz band (0 means the device has up to "
|
||||
"two links, otherwise the band must be different than first link and second link)",
|
||||
frequency3);
|
||||
cmd.AddValue("emlsrLinks",
|
||||
"The comma separated list of IDs of EMLSR links (for MLDs only)",
|
||||
emlsrLinks);
|
||||
cmd.AddValue("emlsrPaddingDelay",
|
||||
"The EMLSR padding delay in microseconds (0, 32, 64, 128 or 256)",
|
||||
paddingDelayUsec);
|
||||
cmd.AddValue("emlsrTransitionDelay",
|
||||
"The EMLSR transition delay in microseconds (0, 16, 32, 64, 128 or 256)",
|
||||
transitionDelayUsec);
|
||||
cmd.AddValue("emlsrAuxSwitch",
|
||||
"Whether Aux PHY should switch channel to operate on the link on which "
|
||||
"the Main PHY was operating before moving to the link of the Aux PHY. ",
|
||||
switchAuxPhy);
|
||||
cmd.AddValue("channelSwitchDelay",
|
||||
"The PHY channel switch delay in microseconds",
|
||||
channelSwitchDelayUsec);
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
@@ -190,7 +211,9 @@ main(int argc, char* argv[])
|
||||
"Generate downlink flows if set to 1, uplink flows otherwise",
|
||||
downlink);
|
||||
cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
|
||||
cmd.AddValue("useExtendedBlockAck", "Enable/disable use of extended BACK", useExtendedBlockAck);
|
||||
cmd.AddValue("mpduBufferSize",
|
||||
"Size (in number of MPDUs) of the BlockAck buffer",
|
||||
mpduBufferSize);
|
||||
cmd.AddValue("nStations", "Number of non-AP HE stations", nStations);
|
||||
cmd.AddValue("dlAckType",
|
||||
"Ack sequence type for DL OFDMA (NO-OFDMA, ACK-SU-FORMAT, MU-BAR, AGGR-MU-BAR)",
|
||||
@@ -286,6 +309,7 @@ main(int argc, char* argv[])
|
||||
|
||||
wifi.SetStandard(WIFI_STANDARD_80211be);
|
||||
std::array<std::string, 3> channelStr;
|
||||
std::array<FrequencyRange, 3> freqRanges;
|
||||
uint8_t nLinks = 0;
|
||||
std::string dataModeStr = "EhtMcs" + std::to_string(mcs);
|
||||
std::string ctrlRateStr;
|
||||
@@ -308,6 +332,7 @@ main(int argc, char* argv[])
|
||||
if (freq == 6)
|
||||
{
|
||||
channelStr[nLinks] += "BAND_6GHZ, 0}";
|
||||
freqRanges[nLinks] = WIFI_SPECTRUM_6_GHZ;
|
||||
Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
|
||||
DoubleValue(48));
|
||||
wifi.SetRemoteStationManager(nLinks,
|
||||
@@ -320,6 +345,7 @@ main(int argc, char* argv[])
|
||||
else if (freq == 5)
|
||||
{
|
||||
channelStr[nLinks] += "BAND_5GHZ, 0}";
|
||||
freqRanges[nLinks] = WIFI_SPECTRUM_5_GHZ;
|
||||
ctrlRateStr = "OfdmRate" + std::to_string(nonHtRefRateMbps) + "Mbps";
|
||||
wifi.SetRemoteStationManager(nLinks,
|
||||
"ns3::ConstantRateWifiManager",
|
||||
@@ -331,6 +357,7 @@ main(int argc, char* argv[])
|
||||
else if (freq == 2.4)
|
||||
{
|
||||
channelStr[nLinks] += "BAND_2_4GHZ, 0}";
|
||||
freqRanges[nLinks] = WIFI_SPECTRUM_2_4_GHZ;
|
||||
Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
|
||||
DoubleValue(40));
|
||||
ctrlRateStr = "ErpOfdmRate" + std::to_string(nonHtRefRateMbps) + "Mbps";
|
||||
@@ -349,6 +376,11 @@ main(int argc, char* argv[])
|
||||
nLinks++;
|
||||
}
|
||||
|
||||
if (nLinks > 1 && !emlsrLinks.empty())
|
||||
{
|
||||
wifi.ConfigEhtOptions("EmlsrActivated", BooleanValue(true));
|
||||
}
|
||||
|
||||
Ssid ssid = Ssid("ns3-80211be");
|
||||
|
||||
/*
|
||||
@@ -357,21 +389,28 @@ main(int argc, char* argv[])
|
||||
* and one with 312.5 kHz bands for, e.g., non-HT PPDUs (for more details,
|
||||
* see issue #408 (CLOSED))
|
||||
*/
|
||||
Ptr<MultiModelSpectrumChannel> spectrumChannel =
|
||||
CreateObject<MultiModelSpectrumChannel>();
|
||||
|
||||
Ptr<LogDistancePropagationLossModel> lossModel =
|
||||
CreateObject<LogDistancePropagationLossModel>();
|
||||
spectrumChannel->AddPropagationLossModel(lossModel);
|
||||
|
||||
SpectrumWifiPhyHelper phy(nLinks);
|
||||
phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
|
||||
phy.SetChannel(spectrumChannel);
|
||||
phy.Set("ChannelSwitchDelay", TimeValue(MicroSeconds(channelSwitchDelayUsec)));
|
||||
|
||||
mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
mac.SetEmlsrManager("ns3::DefaultEmlsrManager",
|
||||
"EmlsrLinkSet",
|
||||
StringValue(emlsrLinks),
|
||||
"EmlsrPaddingDelay",
|
||||
TimeValue(MicroSeconds(paddingDelayUsec)),
|
||||
"EmlsrTransitionDelay",
|
||||
TimeValue(MicroSeconds(transitionDelayUsec)),
|
||||
"SwitchAuxPhy",
|
||||
BooleanValue(switchAuxPhy));
|
||||
for (uint8_t linkId = 0; linkId < nLinks; linkId++)
|
||||
{
|
||||
phy.Set(linkId, "ChannelSettings", StringValue(channelStr[linkId]));
|
||||
|
||||
auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
|
||||
auto lossModel = CreateObject<LogDistancePropagationLossModel>();
|
||||
spectrumChannel->AddPropagationLossModel(lossModel);
|
||||
phy.AddChannel(spectrumChannel, freqRanges[linkId]);
|
||||
}
|
||||
staDevices = wifi.Install(phy, mac, wifiStaNodes);
|
||||
|
||||
@@ -402,9 +441,8 @@ main(int argc, char* argv[])
|
||||
Config::Set(
|
||||
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/GuardInterval",
|
||||
TimeValue(NanoSeconds(gi)));
|
||||
Config::Set(
|
||||
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/HeConfiguration/MpduBufferSize",
|
||||
UintegerValue(useExtendedBlockAck ? 256 : 64));
|
||||
Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/MpduBufferSize",
|
||||
UintegerValue(mpduBufferSize));
|
||||
|
||||
// mobility.
|
||||
MobilityHelper mobility;
|
||||
@@ -507,8 +545,6 @@ main(int argc, char* argv[])
|
||||
simulationTime + 1);
|
||||
}
|
||||
|
||||
Simulator::Schedule(Seconds(0), &Ipv4GlobalRoutingHelper::PopulateRoutingTables);
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Run();
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/wifi-acknowledgment.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
@@ -250,11 +251,8 @@ main(int argc, char* argv[])
|
||||
StringValue(ossDataMode.str()),
|
||||
"ControlMode",
|
||||
ctrlRate);
|
||||
// Set guard interval and MPDU buffer size
|
||||
wifi.ConfigHeOptions("GuardInterval",
|
||||
TimeValue(NanoSeconds(gi)),
|
||||
"MpduBufferSize",
|
||||
UintegerValue(useExtendedBlockAck ? 256 : 64));
|
||||
// Set guard interval
|
||||
wifi.ConfigHeOptions("GuardInterval", TimeValue(NanoSeconds(gi)));
|
||||
|
||||
Ssid ssid = Ssid("ns3-80211ax");
|
||||
|
||||
@@ -277,7 +275,11 @@ main(int argc, char* argv[])
|
||||
phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
|
||||
phy.SetChannel(spectrumChannel);
|
||||
|
||||
mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
mac.SetType("ns3::StaWifiMac",
|
||||
"Ssid",
|
||||
SsidValue(ssid),
|
||||
"MpduBufferSize",
|
||||
UintegerValue(useExtendedBlockAck ? 256 : 64));
|
||||
phy.Set("ChannelSettings", StringValue(channelStr));
|
||||
staDevices = wifi.Install(phy, mac, wifiStaNodes);
|
||||
|
||||
@@ -305,7 +307,11 @@ main(int argc, char* argv[])
|
||||
phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
|
||||
phy.SetChannel(channel.Create());
|
||||
|
||||
mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
mac.SetType("ns3::StaWifiMac",
|
||||
"Ssid",
|
||||
SsidValue(ssid),
|
||||
"MpduBufferSize",
|
||||
UintegerValue(useExtendedBlockAck ? 256 : 64));
|
||||
phy.Set("ChannelSettings", StringValue(channelStr));
|
||||
staDevices = wifi.Install(phy, mac, wifiStaNodes);
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/tuple.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
@@ -176,7 +177,8 @@ main(int argc, char* argv[])
|
||||
wifi.ConfigHtOptions("ShortGuardIntervalSupported", BooleanValue(sgi));
|
||||
|
||||
Ssid ssid = Ssid("ns3-80211n");
|
||||
TupleValue<UintegerValue, UintegerValue, EnumValue, UintegerValue> channelValue;
|
||||
TupleValue<UintegerValue, UintegerValue, EnumValue<WifiPhyBand>, UintegerValue>
|
||||
channelValue;
|
||||
WifiPhyBand band = (frequency == 5.0 ? WIFI_PHY_BAND_5GHZ : WIFI_PHY_BAND_2_4GHZ);
|
||||
channelValue.Set(WifiPhy::ChannelTuple{0, channelWidth, band, 0});
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
|
||||
@@ -191,7 +191,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_ERROR("Obtained throughput is 0!");
|
||||
std::cout << "Obtained throughput is 0!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -670,7 +670,7 @@ main(int argc, char* argv[])
|
||||
for (auto i = stats.begin(); i != stats.end(); ++i)
|
||||
{
|
||||
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow(i->first);
|
||||
if ((t.sourceAddress == "10.1.1.3" && t.destinationAddress == "10.1.1.1"))
|
||||
if (t.sourceAddress == "10.1.1.3" && t.destinationAddress == "10.1.1.1")
|
||||
{
|
||||
NS_LOG_INFO("Flow " << i->first << " (" << t.sourceAddress << " -> "
|
||||
<< t.destinationAddress << ")\n");
|
||||
@@ -688,7 +688,7 @@ main(int argc, char* argv[])
|
||||
<< i->second.jitterSum.GetSeconds() / (i->second.rxPackets - 1) << "\n");
|
||||
NS_LOG_INFO(" Tx Opp: " << 1 - (statisticsAp0.GetBusyTime() / simuTime));
|
||||
}
|
||||
if ((t.sourceAddress == "10.1.1.4" && t.destinationAddress == "10.1.1.2"))
|
||||
if (t.sourceAddress == "10.1.1.4" && t.destinationAddress == "10.1.1.2")
|
||||
{
|
||||
NS_LOG_INFO("Flow " << i->first << " (" << t.sourceAddress << " -> "
|
||||
<< t.destinationAddress << ")\n");
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/rng-seed-manager.h"
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
@@ -63,6 +65,9 @@ main(int argc, char* argv[])
|
||||
double minExpectedThroughput = 0;
|
||||
double maxExpectedThroughput = 0;
|
||||
|
||||
RngSeedManager::SetSeed(1);
|
||||
RngSeedManager::SetRun(5);
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("nMpdus", "Number of aggregated MPDUs", nMpdus);
|
||||
cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
//
|
||||
// The geometry is as follows:
|
||||
//
|
||||
// STA1 STA1
|
||||
// STA1 STA2
|
||||
// | |
|
||||
// d1 | |d2
|
||||
// | d3 |
|
||||
@@ -34,7 +34,7 @@
|
||||
//
|
||||
// STA1 is continuously transmitting data to AP1, while STA2 is continuously sending data to AP2.
|
||||
// Each STA has configurable traffic loads (inter packet interval and packet size).
|
||||
// It is also possible to configure TX power per node as well as their CCA-ED tresholds.
|
||||
// It is also possible to configure TX power per node as well as their CCA-ED thresholds.
|
||||
// OBSS_PD spatial reuse feature can be enabled (default) or disabled, and the OBSS_PD
|
||||
// threshold can be set as well (default: -72 dBm).
|
||||
// A simple Friis path loss model is used and a constant PHY rate is considered.
|
||||
@@ -81,6 +81,9 @@
|
||||
// benefits of spatial reuse in this scenario. This can, for
|
||||
// instance, be accomplished by setting --interval=0.0001.
|
||||
//
|
||||
// Spatial reuse reset events are traced in two text files:
|
||||
// - wifi-spatial-reuse-resets-bss-1.txt (for STA 1)
|
||||
// - wifi-spatial-reuse-resets-bss-2.txt (for STA 2)
|
||||
|
||||
#include "ns3/abort.h"
|
||||
#include "ns3/ap-wifi-mac.h"
|
||||
@@ -89,8 +92,10 @@
|
||||
#include "ns3/config.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/he-configuration.h"
|
||||
#include "ns3/he-phy.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/multi-model-spectrum-channel.h"
|
||||
#include "ns3/obss-pd-algorithm.h"
|
||||
#include "ns3/packet-socket-client.h"
|
||||
#include "ns3/packet-socket-helper.h"
|
||||
#include "ns3/packet-socket-server.h"
|
||||
@@ -102,6 +107,8 @@
|
||||
using namespace ns3;
|
||||
|
||||
std::vector<uint32_t> bytesReceived(4);
|
||||
std::ofstream g_resetFile1;
|
||||
std::ofstream g_resetFile2;
|
||||
|
||||
uint32_t
|
||||
ContextToNodeId(std::string context)
|
||||
@@ -118,6 +125,34 @@ SocketRx(std::string context, Ptr<const Packet> p, const Address& addr)
|
||||
bytesReceived[nodeId] += p->GetSize();
|
||||
}
|
||||
|
||||
void
|
||||
ResetTrace(std::string context,
|
||||
uint8_t bssColor,
|
||||
double rssiDbm,
|
||||
bool powerRestricted,
|
||||
double txPowerMaxDbmSiso,
|
||||
double txPowerMaxDbmMimo)
|
||||
{
|
||||
if (context == "1")
|
||||
{
|
||||
g_resetFile1 << Simulator::Now().GetSeconds() << " bssColor: " << +bssColor
|
||||
<< " rssiDbm: " << rssiDbm << " powerRestricted: " << powerRestricted
|
||||
<< " txPowerMaxDbmSiso: " << txPowerMaxDbmSiso
|
||||
<< " txPowerMaxDbmMimo: " << txPowerMaxDbmMimo << std::endl;
|
||||
}
|
||||
else if (context == "2")
|
||||
{
|
||||
g_resetFile2 << Simulator::Now().GetSeconds() << " bssColor: " << +bssColor
|
||||
<< " rssiDbm: " << rssiDbm << " powerRestricted: " << powerRestricted
|
||||
<< " txPowerMaxDbmSiso: " << txPowerMaxDbmSiso
|
||||
<< " txPowerMaxDbmMimo: " << txPowerMaxDbmMimo << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_FATAL_ERROR("Unknown context " << context);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
@@ -164,6 +199,9 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("mcs", "The constant MCS value to transmit HE PPDUs", mcs);
|
||||
cmd.Parse(argc, argv);
|
||||
|
||||
g_resetFile1.open("wifi-spatial-reuse-resets-bss-1.txt", std::ofstream::out);
|
||||
g_resetFile2.open("wifi-spatial-reuse-resets-bss-2.txt", std::ofstream::out);
|
||||
|
||||
NodeContainer wifiStaNodes;
|
||||
wifiStaNodes.Create(2);
|
||||
|
||||
@@ -318,6 +356,18 @@ main(int argc, char* argv[])
|
||||
Config::Connect("/NodeList/*/ApplicationList/*/$ns3::PacketSocketServer/Rx",
|
||||
MakeCallback(&SocketRx));
|
||||
|
||||
// Obtain pointers to the ObssPdAlgorithm objects and hook trace sinks
|
||||
// to the Reset trace source on each STA. Note that this trace connection
|
||||
// cannot be done through the Config path system, so pointers are used.
|
||||
auto deviceA = staDeviceA.Get(0)->GetObject<WifiNetDevice>();
|
||||
auto hePhyA = DynamicCast<HePhy>(deviceA->GetPhy()->GetPhyEntity(WIFI_MOD_CLASS_HE));
|
||||
// Pass in the context string "1" to allow the trace to distinguish objects
|
||||
hePhyA->GetObssPdAlgorithm()->TraceConnect("Reset", "1", MakeCallback(&ResetTrace));
|
||||
auto deviceB = staDeviceB.Get(0)->GetObject<WifiNetDevice>();
|
||||
auto hePhyB = DynamicCast<HePhy>(deviceB->GetPhy()->GetPhyEntity(WIFI_MOD_CLASS_HE));
|
||||
// Pass in the context string "2" to allow the trace to distinguish objects
|
||||
hePhyB->GetObssPdAlgorithm()->TraceConnect("Reset", "2", MakeCallback(&ResetTrace));
|
||||
|
||||
Simulator::Stop(Seconds(duration));
|
||||
Simulator::Run();
|
||||
|
||||
@@ -329,5 +379,8 @@ main(int argc, char* argv[])
|
||||
std::cout << "Throughput for BSS " << i + 1 << ": " << throughput << " Mbit/s" << std::endl;
|
||||
}
|
||||
|
||||
g_resetFile1.close();
|
||||
g_resetFile2.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/waveform-generator-helper.h"
|
||||
#include "ns3/waveform-generator.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/udp-client-server-helper.h"
|
||||
#include "ns3/udp-server.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/vht-phy.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
|
||||
Reference in New Issue
Block a user