Merge tag 'ns-3.44' into unison
ns-3.44 release
This commit is contained in:
@@ -47,7 +47,7 @@ static Ptr<ThreeGppSpectrumPropagationLossModel>
|
||||
static Ptr<ChannelConditionModel> m_condModel; //!< the ChannelConditionModel object
|
||||
|
||||
/*
|
||||
* \brief A structure that holds the parameters for the ComputeSnr
|
||||
* @brief A structure that holds the parameters for the ComputeSnr
|
||||
* function. In this way the problem with the limited
|
||||
* number of parameters of method Schedule is avoided.
|
||||
*/
|
||||
@@ -63,9 +63,9 @@ struct ComputeSnrParams
|
||||
|
||||
/**
|
||||
* Perform the beamforming using the DFT beamforming method
|
||||
* \param thisDevice the device performing the beamforming
|
||||
* \param thisAntenna the antenna object associated to thisDevice
|
||||
* \param otherDevice the device towards which point the beam
|
||||
* @param thisDevice the device performing the beamforming
|
||||
* @param thisAntenna the antenna object associated to thisDevice
|
||||
* @param otherDevice the device towards which point the beam
|
||||
*/
|
||||
static void
|
||||
DoBeamforming(Ptr<NetDevice> thisDevice,
|
||||
@@ -87,7 +87,7 @@ DoBeamforming(Ptr<NetDevice> thisDevice,
|
||||
|
||||
/**
|
||||
* Compute the average SNR
|
||||
* \param params A structure that holds a bunch of parameters needed by ComputSnr function to
|
||||
* @param params A structure that holds a bunch of parameters needed by ComputSnr function to
|
||||
* calculate the average SNR
|
||||
*/
|
||||
static void
|
||||
@@ -138,7 +138,7 @@ ComputeSnr(const ComputeSnrParams& params)
|
||||
/**
|
||||
* Generates a GNU-plottable file representing the buildings deployed in the
|
||||
* scenario
|
||||
* \param filename the name of the output file
|
||||
* @param filename the name of the output file
|
||||
*/
|
||||
void
|
||||
PrintGnuplottableBuildingListToFile(std::string filename)
|
||||
@@ -254,7 +254,7 @@ main(int argc, char* argv[])
|
||||
double vRx = vScatt / 2;
|
||||
txMob = CreateObject<WaypointMobilityModel>();
|
||||
rxMob = CreateObject<WaypointMobilityModel>();
|
||||
Time nextWaypoint = Seconds(0.0);
|
||||
Time nextWaypoint;
|
||||
txMob->GetObject<WaypointMobilityModel>()->AddWaypoint(
|
||||
Waypoint(nextWaypoint, Vector(maxAxisX / 2 - streetWidth / 2, 1.0, 1.5)));
|
||||
nextWaypoint += Seconds((maxAxisY - streetWidth) / 2 / vTx);
|
||||
@@ -264,7 +264,7 @@ main(int argc, char* argv[])
|
||||
nextWaypoint += Seconds((maxAxisX - streetWidth) / 2 / vTx);
|
||||
txMob->GetObject<WaypointMobilityModel>()->AddWaypoint(
|
||||
Waypoint(nextWaypoint, Vector(0.0, maxAxisY / 2 - streetWidth / 2, 1.5)));
|
||||
nextWaypoint = Seconds(0.0);
|
||||
nextWaypoint = Seconds(0);
|
||||
rxMob->GetObject<WaypointMobilityModel>()->AddWaypoint(
|
||||
Waypoint(nextWaypoint, Vector(maxAxisX / 2 - streetWidth / 2, 0.0, 1.5)));
|
||||
nextWaypoint += Seconds(maxAxisY / vRx);
|
||||
|
||||
@@ -27,8 +27,8 @@ NS_LOG_COMPONENT_DEFINE("EnergyExample");
|
||||
/**
|
||||
* Print a received packet
|
||||
*
|
||||
* \param from sender address
|
||||
* \return a string with the details of the packet: dst {IP, port}, time.
|
||||
* @param from sender address
|
||||
* @return a string with the details of the packet: dst {IP, port}, time.
|
||||
*/
|
||||
static inline std::string
|
||||
PrintReceivedPacket(Address& from)
|
||||
@@ -43,7 +43,7 @@ PrintReceivedPacket(Address& from)
|
||||
}
|
||||
|
||||
/**
|
||||
* \param socket Pointer to socket.
|
||||
* @param socket Pointer to socket.
|
||||
*
|
||||
* Packet receiving sink.
|
||||
*/
|
||||
@@ -62,11 +62,11 @@ ReceivePacket(Ptr<Socket> socket)
|
||||
}
|
||||
|
||||
/**
|
||||
* \param socket Pointer to socket.
|
||||
* \param pktSize Packet size.
|
||||
* \param n Pointer to node.
|
||||
* \param pktCount Number of packets to generate.
|
||||
* \param pktInterval Packet sending interval.
|
||||
* @param socket Pointer to socket.
|
||||
* @param pktSize Packet size.
|
||||
* @param n Pointer to node.
|
||||
* @param pktCount Number of packets to generate.
|
||||
* @param pktInterval Packet sending interval.
|
||||
*
|
||||
* Traffic generator.
|
||||
*/
|
||||
@@ -97,8 +97,8 @@ GenerateTraffic(Ptr<Socket> socket,
|
||||
/**
|
||||
* Trace function for remaining energy at node.
|
||||
*
|
||||
* \param oldValue Old value
|
||||
* \param remainingEnergy New value
|
||||
* @param oldValue Old value
|
||||
* @param remainingEnergy New value
|
||||
*/
|
||||
void
|
||||
RemainingEnergy(double oldValue, double remainingEnergy)
|
||||
@@ -108,10 +108,10 @@ RemainingEnergy(double oldValue, double remainingEnergy)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Trace function for total energy consumption at node.
|
||||
* @brief Trace function for total energy consumption at node.
|
||||
*
|
||||
* \param oldValue Old value
|
||||
* \param totalEnergy New value
|
||||
* @param oldValue Old value
|
||||
* @param totalEnergy New value
|
||||
*/
|
||||
void
|
||||
TotalEnergy(double oldValue, double totalEnergy)
|
||||
@@ -275,7 +275,7 @@ main(int argc, char* argv[])
|
||||
numPackets,
|
||||
interPacketInterval);
|
||||
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Stop(Seconds(10));
|
||||
Simulator::Run();
|
||||
|
||||
for (auto iter = deviceModels.Begin(); iter != deviceModels.End(); iter++)
|
||||
|
||||
@@ -56,8 +56,8 @@ NS_LOG_COMPONENT_DEFINE("EnergyWithHarvestingExample");
|
||||
/**
|
||||
* Print a received packet
|
||||
*
|
||||
* \param from sender address
|
||||
* \return a string with the details of the packet: dst {IP, port}, time.
|
||||
* @param from sender address
|
||||
* @return a string with the details of the packet: dst {IP, port}, time.
|
||||
*/
|
||||
static inline std::string
|
||||
PrintReceivedPacket(Address& from)
|
||||
@@ -72,7 +72,7 @@ PrintReceivedPacket(Address& from)
|
||||
}
|
||||
|
||||
/**
|
||||
* \param socket Pointer to socket.
|
||||
* @param socket Pointer to socket.
|
||||
*
|
||||
* Packet receiving sink.
|
||||
*/
|
||||
@@ -91,11 +91,11 @@ ReceivePacket(Ptr<Socket> socket)
|
||||
}
|
||||
|
||||
/**
|
||||
* \param socket Pointer to socket.
|
||||
* \param pktSize Packet size.
|
||||
* \param n Pointer to node.
|
||||
* \param pktCount Number of packets to generate.
|
||||
* \param pktInterval Packet sending interval.
|
||||
* @param socket Pointer to socket.
|
||||
* @param pktSize Packet size.
|
||||
* @param n Pointer to node.
|
||||
* @param pktCount Number of packets to generate.
|
||||
* @param pktInterval Packet sending interval.
|
||||
*
|
||||
* Traffic generator.
|
||||
*/
|
||||
@@ -126,8 +126,8 @@ GenerateTraffic(Ptr<Socket> socket,
|
||||
/**
|
||||
* Trace function for remaining energy at node.
|
||||
*
|
||||
* \param oldValue Old value
|
||||
* \param remainingEnergy New value
|
||||
* @param oldValue Old value
|
||||
* @param remainingEnergy New value
|
||||
*/
|
||||
void
|
||||
RemainingEnergy(double oldValue, double remainingEnergy)
|
||||
@@ -139,8 +139,8 @@ RemainingEnergy(double oldValue, double remainingEnergy)
|
||||
/**
|
||||
* Trace function for total energy consumption at node.
|
||||
*
|
||||
* \param oldValue Old value
|
||||
* \param totalEnergy New value
|
||||
* @param oldValue Old value
|
||||
* @param totalEnergy New value
|
||||
*/
|
||||
void
|
||||
TotalEnergy(double oldValue, double totalEnergy)
|
||||
@@ -152,8 +152,8 @@ TotalEnergy(double oldValue, double totalEnergy)
|
||||
/**
|
||||
* Trace function for the power harvested by the energy harvester.
|
||||
*
|
||||
* \param oldValue Old value
|
||||
* \param harvestedPower New value
|
||||
* @param oldValue Old value
|
||||
* @param harvestedPower New value
|
||||
*/
|
||||
void
|
||||
HarvestedPower(double oldValue, double harvestedPower)
|
||||
@@ -165,8 +165,8 @@ HarvestedPower(double oldValue, double harvestedPower)
|
||||
/**
|
||||
* Trace function for the total energy harvested by the node.
|
||||
*
|
||||
* \param oldValue Old value
|
||||
* \param totalEnergyHarvested New value
|
||||
* @param oldValue Old value
|
||||
* @param totalEnergyHarvested New value
|
||||
*/
|
||||
void
|
||||
TotalEnergyHarvested(double oldValue, double totalEnergyHarvested)
|
||||
@@ -340,7 +340,7 @@ main(int argc, char* argv[])
|
||||
numPackets,
|
||||
interPacketInterval);
|
||||
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Stop(Seconds(10));
|
||||
Simulator::Run();
|
||||
|
||||
for (auto iter = deviceModels.Begin(); iter != deviceModels.End(); iter++)
|
||||
|
||||
@@ -112,27 +112,27 @@ main(int argc, char* argv[])
|
||||
Address(InetSocketAddress(i3i2.GetAddress(1), port)));
|
||||
onoff.SetConstantRate(DataRate("448kb/s"));
|
||||
ApplicationContainer apps = onoff.Install(c.Get(0));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create an optional packet sink to receive these packets
|
||||
PacketSinkHelper sink("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(c.Get(2));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
|
||||
onoff.SetAttribute("Remote", AddressValue(InetSocketAddress(i1i2.GetAddress(0), port)));
|
||||
apps = onoff.Install(c.Get(3));
|
||||
apps.Start(Seconds(1.1));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
sink.SetAttribute("Local", AddressValue(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(c.Get(1));
|
||||
apps.Start(Seconds(1.1));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Error model
|
||||
|
||||
@@ -114,8 +114,8 @@ main(int argc, char** argv)
|
||||
// Create an UDP Echo server on n2
|
||||
UdpEchoServerHelper echoServer(42);
|
||||
ApplicationContainer serverApps = echoServer.Install(n2);
|
||||
serverApps.Start(Seconds(0.0));
|
||||
serverApps.Stop(Seconds(30.0));
|
||||
serverApps.Start(Seconds(0));
|
||||
serverApps.Stop(Seconds(30));
|
||||
|
||||
uint32_t maxPacketCount = 5;
|
||||
|
||||
@@ -125,16 +125,16 @@ main(int argc, char** argv)
|
||||
echoClient.SetAttribute("PacketSize", UintegerValue(packetSizeN1));
|
||||
echoClient.SetAttribute("MaxPackets", UintegerValue(maxPacketCount));
|
||||
ApplicationContainer clientAppsN1 = echoClient.Install(n1);
|
||||
clientAppsN1.Start(Seconds(2.0));
|
||||
clientAppsN1.Stop(Seconds(10.0));
|
||||
clientAppsN1.Start(Seconds(2));
|
||||
clientAppsN1.Stop(Seconds(10));
|
||||
|
||||
// Create an UDP Echo client on n0 to send UDP packets to n2 via r0 and r1
|
||||
uint32_t packetSizeN2 = 4000; // Packet should fragment as intermediate link MTU is 1500
|
||||
echoClient.SetAttribute("PacketSize", UintegerValue(packetSizeN2));
|
||||
echoClient.SetAttribute("MaxPackets", UintegerValue(maxPacketCount));
|
||||
ApplicationContainer clientAppsN2 = echoClient.Install(n1);
|
||||
clientAppsN2.Start(Seconds(11.0));
|
||||
clientAppsN2.Stop(Seconds(20.0));
|
||||
clientAppsN2.Start(Seconds(11));
|
||||
clientAppsN2.Stop(Seconds(20));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("fragmentation-ipv6-PMTU.tr"));
|
||||
|
||||
@@ -94,13 +94,13 @@ main(int argc, char** argv)
|
||||
echoClient.SetAttribute("PacketSize", UintegerValue(packetSize));
|
||||
echoClient.SetAttribute("MaxPackets", UintegerValue(maxPacketCount));
|
||||
ApplicationContainer clientApps = echoClient.Install(net1.Get(0));
|
||||
clientApps.Start(Seconds(2.0));
|
||||
clientApps.Stop(Seconds(20.0));
|
||||
clientApps.Start(Seconds(2));
|
||||
clientApps.Stop(Seconds(20));
|
||||
|
||||
UdpEchoServerHelper echoServer(42);
|
||||
ApplicationContainer serverApps = echoServer.Install(net2.Get(1));
|
||||
serverApps.Start(Seconds(0.0));
|
||||
serverApps.Stop(Seconds(30.0));
|
||||
serverApps.Start(Seconds(0));
|
||||
serverApps.Stop(Seconds(30));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("fragmentation-ipv6-two-mtu.tr"));
|
||||
|
||||
@@ -91,13 +91,13 @@ main(int argc, char** argv)
|
||||
echoClient.SetAttribute("PacketSize", UintegerValue(packetSize));
|
||||
echoClient.SetAttribute("MaxPackets", UintegerValue(maxPacketCount));
|
||||
ApplicationContainer clientApps = echoClient.Install(net1.Get(0));
|
||||
clientApps.Start(Seconds(2.0));
|
||||
clientApps.Stop(Seconds(20.0));
|
||||
clientApps.Start(Seconds(2));
|
||||
clientApps.Stop(Seconds(20));
|
||||
|
||||
UdpEchoServerHelper echoServer(42);
|
||||
ApplicationContainer serverApps = echoServer.Install(net2.Get(1));
|
||||
serverApps.Start(Seconds(0.0));
|
||||
serverApps.Stop(Seconds(30.0));
|
||||
serverApps.Start(Seconds(0));
|
||||
serverApps.Stop(Seconds(30));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("fragmentation-ipv6.tr"));
|
||||
|
||||
@@ -103,8 +103,8 @@ main(int argc, char** argv)
|
||||
iic1.GetInterfaceIndex(1));
|
||||
|
||||
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper>(&std::cout);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(0.0), r1, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(3.0), sta1, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(0), r1, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(3), sta1, routingStream);
|
||||
|
||||
NS_LOG_INFO("Create Applications.");
|
||||
uint32_t packetSize = 1024;
|
||||
@@ -114,8 +114,8 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("Count", UintegerValue(maxPacketCount));
|
||||
ping.SetAttribute("Size", UintegerValue(packetSize));
|
||||
ApplicationContainer apps = ping.Install(sta1);
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("icmpv6-redirect.tr"));
|
||||
|
||||
@@ -146,7 +146,7 @@ main(int argc, char** argv)
|
||||
*/
|
||||
uint32_t packetSize = 1024;
|
||||
uint32_t maxPacketCount = 1;
|
||||
Time interPacketInterval = Seconds(1.0);
|
||||
Time interPacketInterval = Seconds(1);
|
||||
|
||||
std::vector<Ipv6Address> routersAddress;
|
||||
routersAddress.push_back(i3.GetAddress(1, 1));
|
||||
@@ -163,8 +163,8 @@ main(int argc, char** argv)
|
||||
ApplicationContainer apps = client.Install(h0);
|
||||
DynamicCast<Ping>(apps.Get(0))->SetRouters(routersAddress);
|
||||
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(20.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(20));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("loose-routing-ipv6.tr"));
|
||||
|
||||
@@ -85,8 +85,8 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("InterfaceAddress", AddressValue(i.GetAddress(0, 0)));
|
||||
|
||||
ApplicationContainer apps = ping.Install(n.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("ping6.tr"));
|
||||
|
||||
@@ -114,8 +114,8 @@ main(int argc, char** argv)
|
||||
radvdHelper.GetRadvdInterface(iic2.GetInterfaceIndex(1))->SetSendAdvert(false);
|
||||
|
||||
ApplicationContainer radvdApps = radvdHelper.Install(r);
|
||||
radvdApps.Start(Seconds(1.0));
|
||||
radvdApps.Stop(Seconds(10.0));
|
||||
radvdApps.Start(Seconds(1));
|
||||
radvdApps.Stop(Seconds(10));
|
||||
|
||||
/* Create a Ping application to send ICMPv6 echo request from n0 to n1 via R */
|
||||
uint32_t packetSize = 1024;
|
||||
@@ -126,8 +126,8 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("Count", UintegerValue(maxPacketCount));
|
||||
ping.SetAttribute("Size", UintegerValue(packetSize));
|
||||
ApplicationContainer apps = ping.Install(net1.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(7.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(7));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("radvd.tr"));
|
||||
|
||||
@@ -37,15 +37,15 @@ using namespace ns3;
|
||||
NS_LOG_COMPONENT_DEFINE("RadvdTwoPrefixExample");
|
||||
|
||||
/**
|
||||
* \class IpAddressHelper
|
||||
* \brief Helper to print a node's IP addresses.
|
||||
* @class IpAddressHelper
|
||||
* @brief Helper to print a node's IP addresses.
|
||||
*/
|
||||
class IpAddressHelper
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Print the node's IP addresses.
|
||||
* \param n the node
|
||||
* @brief Print the node's IP addresses.
|
||||
* @param n the node
|
||||
*/
|
||||
inline void PrintIpAddresses(Ptr<Node>& n)
|
||||
{
|
||||
@@ -174,8 +174,8 @@ main(int argc, char** argv)
|
||||
}
|
||||
|
||||
ApplicationContainer radvdApps = radvdHelper.Install(r);
|
||||
radvdApps.Start(Seconds(1.0));
|
||||
radvdApps.Stop(Seconds(2.0));
|
||||
radvdApps.Start(Seconds(1));
|
||||
radvdApps.Stop(Seconds(2));
|
||||
|
||||
/* Create a Ping application to send ICMPv6 echo request from n0 to n1 via R */
|
||||
uint32_t packetSize = 1024;
|
||||
@@ -187,18 +187,18 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("Count", UintegerValue(maxPacketCount));
|
||||
ping.SetAttribute("Size", UintegerValue(packetSize));
|
||||
ApplicationContainer apps = ping.Install(net1.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(5.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(5));
|
||||
|
||||
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper>(&std::cout);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(2.0), n0, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(10.0), n0, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(2), n0, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(10), n0, routingStream);
|
||||
|
||||
IpAddressHelper ipAddressHelper;
|
||||
/* RA should be received, two prefixes + routes + default route should be present */
|
||||
Simulator::Schedule(Seconds(2.0), &IpAddressHelper::PrintIpAddresses, &ipAddressHelper, n0);
|
||||
Simulator::Schedule(Seconds(2), &IpAddressHelper::PrintIpAddresses, &ipAddressHelper, n0);
|
||||
/* at the end, RA addresses and routes should be cleared */
|
||||
Simulator::Schedule(Seconds(10.0), &IpAddressHelper::PrintIpAddresses, &ipAddressHelper, n0);
|
||||
Simulator::Schedule(Seconds(10), &IpAddressHelper::PrintIpAddresses, &ipAddressHelper, n0);
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("radvd-two-prefix.tr"));
|
||||
|
||||
@@ -114,8 +114,8 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("Interval", TimeValue(interPacketInterval));
|
||||
ping.SetAttribute("Size", UintegerValue(packetSize));
|
||||
ApplicationContainer apps = ping.Install(nodes.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
lrWpanHelper.EnableAsciiAll(ascii.CreateFileStream("ping6wsn.tr"));
|
||||
|
||||
@@ -27,8 +27,8 @@ uint32_t bytesReceived = 0;
|
||||
/**
|
||||
* Function called when a packet is received.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param packet The received packet.
|
||||
* @param context The context.
|
||||
* @param packet The received packet.
|
||||
*/
|
||||
void
|
||||
RxEvent(std::string context, Ptr<const Packet> packet)
|
||||
@@ -142,8 +142,8 @@ main(int argc, char* argv[])
|
||||
// directly.
|
||||
//
|
||||
ApplicationContainer apps = server.Install("/Names/server");
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
uint32_t packetSize = 1024;
|
||||
uint32_t maxPacketCount = 1;
|
||||
@@ -157,8 +157,8 @@ main(int argc, char* argv[])
|
||||
// directly.
|
||||
//
|
||||
apps = client.Install("/Names/client");
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Use the Config system to connect a trace source using the object name
|
||||
|
||||
@@ -76,8 +76,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9; // well-known echo port number
|
||||
UdpEchoServerHelper server(port);
|
||||
ApplicationContainer apps = server.Install(n.Get(1));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Create a UdpEchoClient application to send UDP datagrams from node zero to
|
||||
@@ -91,8 +91,8 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("Interval", TimeValue(interPacketInterval));
|
||||
client.SetAttribute("PacketSize", UintegerValue(packetSize));
|
||||
apps = client.Install(n.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("realtime-udp-echo.tr"));
|
||||
@@ -101,7 +101,7 @@ main(int argc, char* argv[])
|
||||
//
|
||||
// Now, do the actual simulation.
|
||||
//
|
||||
Simulator::Stop(Seconds(11.0));
|
||||
Simulator::Stop(Seconds(11));
|
||||
NS_LOG_INFO("Run Simulation.");
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
@@ -72,8 +72,8 @@ def main(argv):
|
||||
port = 9 # well-known echo port number
|
||||
server = ns.UdpEchoServerHelper(port)
|
||||
apps = server.Install(n.Get(1))
|
||||
apps.Start(ns.Seconds(1.0))
|
||||
apps.Stop(ns.Seconds(10.0))
|
||||
apps.Start(ns.Seconds(1))
|
||||
apps.Stop(ns.Seconds(10))
|
||||
|
||||
#
|
||||
# Create a UdpEchoClient application to send UDP datagrams from node zero to
|
||||
@@ -87,8 +87,8 @@ def main(argv):
|
||||
client.SetAttribute("Interval", ns.TimeValue(interPacketInterval))
|
||||
client.SetAttribute("PacketSize", ns.UintegerValue(packetSize))
|
||||
apps = client.Install(n.Get(0))
|
||||
apps.Start(ns.Seconds(2.0))
|
||||
apps.Stop(ns.Seconds(10.0))
|
||||
apps.Start(ns.Seconds(2))
|
||||
apps.Stop(ns.Seconds(10))
|
||||
|
||||
ascii = ns.AsciiTraceHelper()
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("realtime-udp-echo.tr"))
|
||||
|
||||
@@ -141,8 +141,8 @@ main(int argc, char* argv[])
|
||||
onoff.SetAttribute("PacketSize", UintegerValue(50));
|
||||
|
||||
ApplicationContainer apps = onoff.Install(c.Get(1));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a second OnOff application to send UDP datagrams of size
|
||||
// 210 bytes at a rate of 448 Kb/s
|
||||
@@ -153,21 +153,21 @@ main(int argc, char* argv[])
|
||||
onoff2.SetAttribute("PacketSize", UintegerValue(50));
|
||||
|
||||
ApplicationContainer apps2 = onoff2.Install(c.Get(1));
|
||||
apps2.Start(Seconds(11.0));
|
||||
apps2.Stop(Seconds(16.0));
|
||||
apps2.Start(Seconds(11));
|
||||
apps2.Stop(Seconds(16));
|
||||
|
||||
// Create an optional packet sink to receive these packets
|
||||
PacketSinkHelper sink("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(c.Get(6));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
PacketSinkHelper sink2("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps2 = sink2.Install(c.Get(6));
|
||||
apps2.Start(Seconds(11.0));
|
||||
apps2.Stop(Seconds(16.0));
|
||||
apps2.Start(Seconds(11));
|
||||
apps2.Stop(Seconds(16));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream("dynamic-global-routing.tr");
|
||||
|
||||
@@ -129,15 +129,15 @@ main(int argc, char* argv[])
|
||||
Address(InetSocketAddress(ifInAddrC.GetLocal(), port)));
|
||||
onoff.SetConstantRate(DataRate(6000));
|
||||
ApplicationContainer apps = onoff.Install(nA);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(nC);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
p2p.EnableAsciiAll(ascii.CreateFileStream("global-routing-injection32.tr"));
|
||||
|
||||
@@ -100,15 +100,15 @@ main(int argc, char* argv[])
|
||||
Address(InetSocketAddress(ifInAddrC.GetLocal(), port)));
|
||||
onoff.SetConstantRate(DataRate(6000));
|
||||
ApplicationContainer apps = onoff.Install(nA);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(nC);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
p2p.EnableAsciiAll(ascii.CreateFileStream("global-routing-slash32.tr"));
|
||||
|
||||
@@ -89,22 +89,22 @@ class RoutingExperiment
|
||||
|
||||
/**
|
||||
* Handles the command-line parameters.
|
||||
* \param argc The argument count.
|
||||
* \param argv The argument vector.
|
||||
* @param argc The argument count.
|
||||
* @param argv The argument vector.
|
||||
*/
|
||||
void CommandSetup(int argc, char** argv);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Setup the receiving socket in a Sink Node.
|
||||
* \param addr The address of the node.
|
||||
* \param node The node pointer.
|
||||
* \return the socket.
|
||||
* @param addr The address of the node.
|
||||
* @param node The node pointer.
|
||||
* @return the socket.
|
||||
*/
|
||||
Ptr<Socket> SetupPacketReceive(Ipv4Address addr, Ptr<Node> node);
|
||||
/**
|
||||
* Receive a packet.
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void ReceivePacket(Ptr<Socket> socket);
|
||||
/**
|
||||
@@ -173,7 +173,7 @@ RoutingExperiment::CheckThroughput()
|
||||
|
||||
out.close();
|
||||
packetsReceived = 0;
|
||||
Simulator::Schedule(Seconds(1.0), &RoutingExperiment::CheckThroughput, this);
|
||||
Simulator::Schedule(Seconds(1), &RoutingExperiment::CheckThroughput, this);
|
||||
}
|
||||
|
||||
Ptr<Socket>
|
||||
|
||||
@@ -104,8 +104,8 @@ main(int argc, char* argv[])
|
||||
onoff.SetAttribute("PacketSize", UintegerValue(50));
|
||||
|
||||
ApplicationContainer apps = onoff.Install(c.Get(0));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
Ptr<OutputStreamWrapper> stream = ascii.CreateFileStream("mixed-global-routing.tr");
|
||||
|
||||
@@ -204,25 +204,25 @@ main(int argc, char** argv)
|
||||
{
|
||||
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper>(&std::cout);
|
||||
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30.0), a, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30.0), b, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30.0), c, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30.0), d, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30), a, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30), b, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30), c, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(30), d, routingStream);
|
||||
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60.0), a, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60.0), b, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60.0), c, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60.0), d, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60), a, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60), b, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60), c, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(60), d, routingStream);
|
||||
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90.0), a, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90.0), b, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90.0), c, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90.0), d, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90), a, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90), b, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90), c, routingStream);
|
||||
Ipv4RoutingHelper::PrintRoutingTableAt(Seconds(90), d, routingStream);
|
||||
}
|
||||
|
||||
NS_LOG_INFO("Create Applications.");
|
||||
uint32_t packetSize = 1024;
|
||||
Time interPacketInterval = Seconds(1.0);
|
||||
Time interPacketInterval = Seconds(1);
|
||||
PingHelper ping(Ipv4Address("10.0.6.2"));
|
||||
|
||||
ping.SetAttribute("Interval", TimeValue(interPacketInterval));
|
||||
@@ -232,8 +232,8 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("VerboseMode", EnumValue(Ping::VerboseMode::VERBOSE));
|
||||
}
|
||||
ApplicationContainer apps = ping.Install(src);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(110.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(110));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("rip-simple-routing.tr"));
|
||||
@@ -243,7 +243,7 @@ main(int argc, char** argv)
|
||||
|
||||
/* Now, do the actual simulation. */
|
||||
NS_LOG_INFO("Run Simulation.");
|
||||
Simulator::Stop(Seconds(131.0));
|
||||
Simulator::Stop(Seconds(131));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
NS_LOG_INFO("Done.");
|
||||
|
||||
@@ -209,25 +209,25 @@ main(int argc, char** argv)
|
||||
{
|
||||
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper>(&std::cout);
|
||||
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30.0), a, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30.0), b, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30.0), c, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30.0), d, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30), a, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30), b, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30), c, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(30), d, routingStream);
|
||||
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60.0), a, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60.0), b, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60.0), c, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60.0), d, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60), a, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60), b, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60), c, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(60), d, routingStream);
|
||||
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90.0), a, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90.0), b, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90.0), c, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90.0), d, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90), a, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90), b, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90), c, routingStream);
|
||||
Ipv6RoutingHelper::PrintRoutingTableAt(Seconds(90), d, routingStream);
|
||||
}
|
||||
|
||||
NS_LOG_INFO("Create Applications.");
|
||||
uint32_t packetSize = 1024;
|
||||
Time interPacketInterval = Seconds(1.0);
|
||||
Time interPacketInterval = Seconds(1);
|
||||
PingHelper ping(iic7.GetAddress(1, 1));
|
||||
|
||||
ping.SetAttribute("Interval", TimeValue(interPacketInterval));
|
||||
@@ -237,8 +237,8 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("VerboseMode", EnumValue(Ping::VerboseMode::VERBOSE));
|
||||
}
|
||||
ApplicationContainer apps = ping.Install(src);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(110.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(110));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("ripng-simple-routing.tr"));
|
||||
|
||||
@@ -131,14 +131,14 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer apps = onoff.Install(c.Get(3));
|
||||
apps.Start(Seconds(1.1));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(c.Get(1));
|
||||
apps.Start(Seconds(1.1));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
p2p.EnableAsciiAll(ascii.CreateFileStream("simple-alternate-routing.tr"));
|
||||
|
||||
@@ -110,26 +110,26 @@ main(int argc, char* argv[])
|
||||
Address(InetSocketAddress(i3i2.GetAddress(0), port)));
|
||||
onoff.SetConstantRate(DataRate("448kb/s"));
|
||||
ApplicationContainer apps = onoff.Install(c.Get(0));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(c.Get(3));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a similar flow from n3 to n1, starting at time 1.1 seconds
|
||||
onoff.SetAttribute("Remote", AddressValue(InetSocketAddress(i1i2.GetAddress(0), port)));
|
||||
apps = onoff.Install(c.Get(3));
|
||||
apps.Start(Seconds(1.1));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
apps = sink.Install(c.Get(1));
|
||||
apps.Start(Seconds(1.1));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
p2p.EnableAsciiAll(ascii.CreateFileStream("simple-global-routing.tr"));
|
||||
|
||||
@@ -30,17 +30,17 @@ using namespace ns3;
|
||||
NS_LOG_COMPONENT_DEFINE("SimpleRoutingPing6Example");
|
||||
|
||||
/**
|
||||
* \class StackHelper
|
||||
* \brief Helper to set or get some IPv6 information about nodes.
|
||||
* @class StackHelper
|
||||
* @brief Helper to set or get some IPv6 information about nodes.
|
||||
*/
|
||||
class StackHelper
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Add an address to a IPv6 node.
|
||||
* \param n node
|
||||
* \param interface interface index
|
||||
* \param address IPv6 address to add
|
||||
* @brief Add an address to a IPv6 node.
|
||||
* @param n node
|
||||
* @param interface interface index
|
||||
* @param address IPv6 address to add
|
||||
*/
|
||||
inline void AddAddress(Ptr<Node>& n, uint32_t interface, Ipv6Address address)
|
||||
{
|
||||
@@ -49,8 +49,8 @@ class StackHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Print the routing table.
|
||||
* \param n the node
|
||||
* @brief Print the routing table.
|
||||
* @param n the node
|
||||
*/
|
||||
inline void PrintRoutingTable(Ptr<Node>& n)
|
||||
{
|
||||
@@ -136,8 +136,8 @@ main(int argc, char** argv)
|
||||
ping.SetAttribute("Count", UintegerValue(maxPacketCount));
|
||||
ping.SetAttribute("Size", UintegerValue(packetSize));
|
||||
ApplicationContainer apps = ping.Install(net1.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(20.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(20));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
csma.EnableAsciiAll(ascii.CreateFileStream("simple-routing-ping6.tr"));
|
||||
|
||||
@@ -69,7 +69,7 @@ def main(argv):
|
||||
print("Application")
|
||||
packetSize = 1024
|
||||
maxPacketCount = 5
|
||||
interPacketInterval = ns.Seconds(1.0)
|
||||
interPacketInterval = ns.Seconds(1)
|
||||
# ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo())
|
||||
ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo())
|
||||
|
||||
@@ -81,8 +81,8 @@ def main(argv):
|
||||
ping.SetAttribute("Size", ns.UintegerValue(packetSize))
|
||||
|
||||
apps = ping.Install(ns.NodeContainer(net1.Get(0)))
|
||||
apps.Start(ns.Seconds(2.0))
|
||||
apps.Stop(ns.Seconds(20.0))
|
||||
apps.Start(ns.Seconds(2))
|
||||
apps.Stop(ns.Seconds(20))
|
||||
|
||||
print("Tracing")
|
||||
ascii = ns.AsciiTraceHelper()
|
||||
|
||||
@@ -106,15 +106,15 @@ main(int argc, char* argv[])
|
||||
Address(InetSocketAddress(ifInAddrC.GetLocal(), port)));
|
||||
onoff.SetConstantRate(DataRate(6000));
|
||||
ApplicationContainer apps = onoff.Install(nA);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink("ns3::UdpSocketFactory",
|
||||
Address(InetSocketAddress(Ipv4Address::GetAny(), port)));
|
||||
apps = sink.Install(nC);
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
p2p.EnableAsciiAll(ascii.CreateFileStream("static-routing-slash32.tr"));
|
||||
|
||||
@@ -144,17 +144,17 @@ main(int argc, char* argv[])
|
||||
// First packet as normal (goes via Rtr1)
|
||||
Simulator::Schedule(Seconds(0.1), &SendStuff, srcSocket, dstaddr, dstport);
|
||||
// Second via Rtr1 explicitly
|
||||
Simulator::Schedule(Seconds(1.0), &BindSock, srcSocket, SrcToRtr1);
|
||||
Simulator::Schedule(Seconds(1), &BindSock, srcSocket, SrcToRtr1);
|
||||
Simulator::Schedule(Seconds(1.1), &SendStuff, srcSocket, dstaddr, dstport);
|
||||
// Third via Rtr2 explicitly
|
||||
Simulator::Schedule(Seconds(2.0), &BindSock, srcSocket, SrcToRtr2);
|
||||
Simulator::Schedule(Seconds(2), &BindSock, srcSocket, SrcToRtr2);
|
||||
Simulator::Schedule(Seconds(2.1), &SendStuff, srcSocket, dstaddr, dstport);
|
||||
// Fourth again as normal (goes via Rtr1)
|
||||
Simulator::Schedule(Seconds(3.0), &BindSock, srcSocket, Ptr<NetDevice>(nullptr));
|
||||
Simulator::Schedule(Seconds(3), &BindSock, srcSocket, Ptr<NetDevice>(nullptr));
|
||||
Simulator::Schedule(Seconds(3.1), &SendStuff, srcSocket, dstaddr, dstport);
|
||||
// If you uncomment what's below, it results in ASSERT failing since you can't
|
||||
// bind to a socket not existing on a node
|
||||
// Simulator::Schedule(Seconds(4.0),&BindSock, srcSocket, dDstRtrdDst.Get(0));
|
||||
// Simulator::Schedule(Seconds(4),&BindSock, srcSocket, dDstRtrdDst.Get(0));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -149,8 +149,8 @@ main(int argc, char* argv[])
|
||||
PacketSinkHelper sink("ns3::TcpSocketFactory",
|
||||
InetSocketAddress(Ipv4Address::GetAny(), dstport));
|
||||
ApplicationContainer apps = sink.Install(nDst);
|
||||
apps.Start(Seconds(0.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(0));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
AsciiTraceHelper ascii;
|
||||
p2p.EnableAsciiAll(ascii.CreateFileStream("socket-bound-tcp-static-routing.tr"));
|
||||
@@ -162,17 +162,17 @@ main(int argc, char* argv[])
|
||||
// First packet as normal (goes via Rtr1)
|
||||
Simulator::Schedule(Seconds(0.1), &StartFlow, srcSocket1, dstaddr, dstport);
|
||||
// Second via Rtr1 explicitly
|
||||
Simulator::Schedule(Seconds(1.0), &BindSock, srcSocket2, SrcToRtr1);
|
||||
Simulator::Schedule(Seconds(1), &BindSock, srcSocket2, SrcToRtr1);
|
||||
Simulator::Schedule(Seconds(1.1), &StartFlow, srcSocket2, dstaddr, dstport);
|
||||
// Third via Rtr2 explicitly
|
||||
Simulator::Schedule(Seconds(2.0), &BindSock, srcSocket3, SrcToRtr2);
|
||||
Simulator::Schedule(Seconds(2), &BindSock, srcSocket3, SrcToRtr2);
|
||||
Simulator::Schedule(Seconds(2.1), &StartFlow, srcSocket3, dstaddr, dstport);
|
||||
// Fourth again as normal (goes via Rtr1)
|
||||
Simulator::Schedule(Seconds(3.0), &BindSock, srcSocket4, Ptr<NetDevice>(nullptr));
|
||||
Simulator::Schedule(Seconds(3), &BindSock, srcSocket4, Ptr<NetDevice>(nullptr));
|
||||
Simulator::Schedule(Seconds(3.1), &StartFlow, srcSocket4, dstaddr, dstport);
|
||||
// If you uncomment what's below, it results in ASSERT failing since you can't
|
||||
// bind to a socket not existing on a node
|
||||
// Simulator::Schedule(Seconds(4.0),&BindSock, srcSocket, dDstRtrdDst.Get(0));
|
||||
// Simulator::Schedule(Seconds(4),&BindSock, srcSocket, dDstRtrdDst.Get(0));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ main(int argc, char* argv[])
|
||||
// Schedule SendPacket
|
||||
Time interPacketInterval = Seconds(packetInterval);
|
||||
Simulator::ScheduleWithContext(source->GetNode()->GetId(),
|
||||
Seconds(1.0),
|
||||
Seconds(1),
|
||||
&SendPacket,
|
||||
source,
|
||||
packetSize,
|
||||
|
||||
@@ -135,7 +135,7 @@ main(int argc, char* argv[])
|
||||
// Schedule SendPacket
|
||||
Time interPacketInterval = Seconds(packetInterval);
|
||||
Simulator::ScheduleWithContext(source->GetNode()->GetId(),
|
||||
Seconds(1.0),
|
||||
Seconds(1),
|
||||
&SendPacket,
|
||||
source,
|
||||
packetSize,
|
||||
|
||||
@@ -31,8 +31,8 @@ class Sender : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return The object TypeId.
|
||||
* @brief Get the type ID.
|
||||
* @return The object TypeId.
|
||||
*/
|
||||
static TypeId GetTypeId();
|
||||
|
||||
@@ -76,8 +76,8 @@ class Receiver : public Application
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return The object TypeId.
|
||||
* @brief Get the type ID.
|
||||
* @return The object TypeId.
|
||||
*/
|
||||
static TypeId GetTypeId();
|
||||
|
||||
@@ -86,13 +86,13 @@ class Receiver : public Application
|
||||
|
||||
/**
|
||||
* Set the counter calculator for received packets.
|
||||
* \param calc The CounterCalculator.
|
||||
* @param calc The CounterCalculator.
|
||||
*/
|
||||
void SetCounter(Ptr<CounterCalculator<>> calc);
|
||||
|
||||
/**
|
||||
* Set the delay tracker for received packets.
|
||||
* \param delay The Delay calculator.
|
||||
* @param delay The Delay calculator.
|
||||
*/
|
||||
void SetDelayTracker(Ptr<TimeMinMaxAvgTotalCalculator> delay);
|
||||
|
||||
@@ -105,7 +105,7 @@ class Receiver : public Application
|
||||
|
||||
/**
|
||||
* Receive a packet.
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void Receive(Ptr<Socket> socket);
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ NS_LOG_COMPONENT_DEFINE("WiFiDistanceExperiment");
|
||||
/**
|
||||
* Function called when a packet is transmitted.
|
||||
*
|
||||
* \param datac The counter of the number of transmitted packets.
|
||||
* \param path The callback context.
|
||||
* \param packet The transmitted packet.
|
||||
* @param datac The counter of the number of transmitted packets.
|
||||
* @param path The callback context.
|
||||
* @param packet The transmitted packet.
|
||||
*/
|
||||
void
|
||||
TxCallback(Ptr<CounterCalculator<uint32_t>> datac, std::string path, Ptr<const Packet> packet)
|
||||
|
||||
@@ -287,7 +287,7 @@ main(int argc, char* argv[])
|
||||
|
||||
Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::" + tcpTypeId));
|
||||
|
||||
Time startTime = Seconds(0);
|
||||
Time startTime{0};
|
||||
Time stopTime = flowStartupWindow + convergenceTime + measurementWindow;
|
||||
|
||||
rxS1R1Bytes.reserve(10);
|
||||
|
||||
@@ -67,8 +67,8 @@ main(int argc, char* argv[])
|
||||
Address hubLocalAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", hubLocalAddress);
|
||||
ApplicationContainer hubApp = packetSinkHelper.Install(star.GetHub());
|
||||
hubApp.Start(Seconds(1.0));
|
||||
hubApp.Stop(Seconds(10.0));
|
||||
hubApp.Start(Seconds(1));
|
||||
hubApp.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Create OnOff applications to send TCP to the hub, one on each spoke node.
|
||||
@@ -85,8 +85,8 @@ main(int argc, char* argv[])
|
||||
onOffHelper.SetAttribute("Remote", remoteAddress);
|
||||
spokeApps.Add(onOffHelper.Install(star.GetSpokeNode(i)));
|
||||
}
|
||||
spokeApps.Start(Seconds(1.0));
|
||||
spokeApps.Stop(Seconds(10.0));
|
||||
spokeApps.Start(Seconds(1));
|
||||
spokeApps.Stop(Seconds(10));
|
||||
|
||||
NS_LOG_INFO("Enable static global routing.");
|
||||
//
|
||||
|
||||
@@ -59,7 +59,7 @@ std::ofstream throughput;
|
||||
std::ofstream queueSize;
|
||||
|
||||
uint32_t prev = 0;
|
||||
Time prevTime = Seconds(0);
|
||||
Time prevTime;
|
||||
|
||||
// Calculate throughput
|
||||
static void
|
||||
@@ -221,7 +221,7 @@ main(int argc, char* argv[])
|
||||
// Install application on the receiver
|
||||
PacketSinkHelper sink("ns3::TcpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
ApplicationContainer sinkApps = sink.Install(receiver.Get(0));
|
||||
sinkApps.Start(Seconds(0.0));
|
||||
sinkApps.Start(Seconds(0));
|
||||
sinkApps.Stop(stopTime);
|
||||
|
||||
// Create a new directory to store the output of the program
|
||||
|
||||
@@ -85,16 +85,16 @@ main(int argc, char* argv[])
|
||||
// Set the amount of data to send in bytes. Zero is unlimited.
|
||||
source.SetAttribute("MaxBytes", UintegerValue(maxBytes));
|
||||
ApplicationContainer sourceApps = source.Install(nodes.Get(0));
|
||||
sourceApps.Start(Seconds(0.0));
|
||||
sourceApps.Stop(Seconds(10.0));
|
||||
sourceApps.Start(Seconds(0));
|
||||
sourceApps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Create a PacketSinkApplication and install it on node 1
|
||||
//
|
||||
PacketSinkHelper sink("ns3::TcpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
ApplicationContainer sinkApps = sink.Install(nodes.Get(1));
|
||||
sinkApps.Start(Seconds(0.0));
|
||||
sinkApps.Stop(Seconds(10.0));
|
||||
sinkApps.Start(Seconds(0));
|
||||
sinkApps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Set up tracing if enabled
|
||||
@@ -110,7 +110,7 @@ main(int argc, char* argv[])
|
||||
// Now, do the actual simulation.
|
||||
//
|
||||
NS_LOG_INFO("Run Simulation.");
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Stop(Seconds(10));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
NS_LOG_INFO("Done.");
|
||||
|
||||
@@ -52,25 +52,25 @@ uint8_t data[writeSize];
|
||||
/**
|
||||
* Start a flow.
|
||||
*
|
||||
* \param localSocket The local (sending) socket.
|
||||
* \param servAddress The server address.
|
||||
* \param servPort The server port.
|
||||
* @param localSocket The local (sending) socket.
|
||||
* @param servAddress The server address.
|
||||
* @param servPort The server port.
|
||||
*/
|
||||
void StartFlow(Ptr<Socket> localSocket, Ipv4Address servAddress, uint16_t servPort);
|
||||
|
||||
/**
|
||||
* Write to the buffer, filling it.
|
||||
*
|
||||
* \param localSocket The socket.
|
||||
* \param txSpace The number of bytes to write.
|
||||
* @param localSocket The socket.
|
||||
* @param txSpace The number of bytes to write.
|
||||
*/
|
||||
void WriteUntilBufferFull(Ptr<Socket> localSocket, uint32_t txSpace);
|
||||
|
||||
/**
|
||||
* Congestion window tracker function.
|
||||
*
|
||||
* \param oldval Old value.
|
||||
* \param newval New value.
|
||||
* @param oldval Old value.
|
||||
* @param newval New value.
|
||||
*/
|
||||
static void
|
||||
CwndTracer(uint32_t oldval, uint32_t newval)
|
||||
@@ -151,8 +151,8 @@ main(int argc, char* argv[])
|
||||
InetSocketAddress(Ipv4Address::GetAny(), servPort));
|
||||
|
||||
ApplicationContainer apps = sink.Install(n1n2.Get(1));
|
||||
apps.Start(Seconds(0.0));
|
||||
apps.Stop(Seconds(3.0));
|
||||
apps.Start(Seconds(0));
|
||||
apps.Stop(Seconds(3));
|
||||
|
||||
// Create a source to send packets from n0. Instead of a full Application
|
||||
// and the helper APIs you might see in other example files, this example
|
||||
|
||||
@@ -92,8 +92,8 @@ InstallBulkSend(Ptr<Node> node,
|
||||
BulkSendHelper source(socketFactory, InetSocketAddress(address, port));
|
||||
source.SetAttribute("MaxBytes", UintegerValue(0));
|
||||
ApplicationContainer sourceApps = source.Install(node);
|
||||
sourceApps.Start(Seconds(10.0));
|
||||
Simulator::Schedule(Seconds(10.0) + Seconds(0.001), &TraceCwnd, nodeId, cwndWindow, CwndTrace);
|
||||
sourceApps.Start(Seconds(10));
|
||||
Simulator::Schedule(Seconds(10) + Seconds(0.001), &TraceCwnd, nodeId, cwndWindow, CwndTrace);
|
||||
sourceApps.Stop(stopTime);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ InstallPacketSink(Ptr<Node> node, uint16_t port, std::string socketFactory)
|
||||
{
|
||||
PacketSinkHelper sink(socketFactory, InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
ApplicationContainer sinkApps = sink.Install(node);
|
||||
sinkApps.Start(Seconds(10.0));
|
||||
sinkApps.Start(Seconds(10));
|
||||
sinkApps.Stop(stopTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -108,16 +108,16 @@ main(int argc, char* argv[])
|
||||
// Set the amount of data to send in bytes. Zero is unlimited.
|
||||
source.SetAttribute("MaxBytes", UintegerValue(maxBytes));
|
||||
ApplicationContainer sourceApps = source.Install(nodes.Get(0));
|
||||
sourceApps.Start(Seconds(0.0));
|
||||
sourceApps.Stop(Seconds(10.0));
|
||||
sourceApps.Start(Seconds(0));
|
||||
sourceApps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Create a PacketSinkApplication and install it on node 1
|
||||
//
|
||||
PacketSinkHelper sink("ns3::TcpSocketFactory", InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
ApplicationContainer sinkApps = sink.Install(nodes.Get(1));
|
||||
sinkApps.Start(Seconds(0.0));
|
||||
sinkApps.Stop(Seconds(10.0));
|
||||
sinkApps.Start(Seconds(0));
|
||||
sinkApps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Set up tracing if enabled
|
||||
@@ -132,7 +132,7 @@ main(int argc, char* argv[])
|
||||
// Now, do the actual simulation.
|
||||
//
|
||||
NS_LOG_INFO("Run Simulation.");
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Stop(Seconds(10));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
NS_LOG_INFO("Done.");
|
||||
|
||||
@@ -115,8 +115,8 @@ main(int argc, char* argv[])
|
||||
Address sinkLocalAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
PacketSinkHelper sinkHelper("ns3::TcpSocketFactory", sinkLocalAddress);
|
||||
ApplicationContainer sinkApp = sinkHelper.Install(serverNode);
|
||||
sinkApp.Start(Seconds(1.0));
|
||||
sinkApp.Stop(Seconds(10.0));
|
||||
sinkApp.Start(Seconds(1));
|
||||
sinkApp.Stop(Seconds(10));
|
||||
|
||||
// Create the OnOff applications to send TCP to the server
|
||||
OnOffHelper clientHelper("ns3::TcpSocketFactory", Address());
|
||||
@@ -133,8 +133,8 @@ main(int argc, char* argv[])
|
||||
clientHelper.SetAttribute("Remote", remoteAddress);
|
||||
clientApps.Add(clientHelper.Install(clientNodes.Get(i)));
|
||||
}
|
||||
clientApps.Start(Seconds(1.0));
|
||||
clientApps.Stop(Seconds(10.0));
|
||||
clientApps.Start(Seconds(1));
|
||||
clientApps.Stop(Seconds(10));
|
||||
|
||||
// configure tracing
|
||||
AsciiTraceHelper ascii;
|
||||
|
||||
@@ -145,9 +145,9 @@ bool g_validationFailed = false; //!< True if validation failed.
|
||||
/**
|
||||
* Trace first congestion window.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param oldCwnd Old value.
|
||||
* \param newCwnd new value.
|
||||
* @param ofStream Output filestream.
|
||||
* @param oldCwnd Old value.
|
||||
* @param newCwnd new value.
|
||||
*/
|
||||
void
|
||||
TraceFirstCwnd(std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
@@ -190,10 +190,10 @@ TraceFirstCwnd(std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
/**
|
||||
* Trace first TcpDctcp.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param bytesMarked Bytes marked.
|
||||
* \param bytesAcked Bytes ACKed.
|
||||
* \param alpha Alpha.
|
||||
* @param ofStream Output filestream.
|
||||
* @param bytesMarked Bytes marked.
|
||||
* @param bytesAcked Bytes ACKed.
|
||||
* @param alpha Alpha.
|
||||
*/
|
||||
void
|
||||
TraceFirstDctcp(std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
|
||||
@@ -243,9 +243,9 @@ TraceFirstDctcp(std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAck
|
||||
/**
|
||||
* Trace first RTT.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param oldRtt Old value.
|
||||
* \param newRtt New value.
|
||||
* @param ofStream Output filestream.
|
||||
* @param oldRtt Old value.
|
||||
* @param newRtt New value.
|
||||
*/
|
||||
void
|
||||
TraceFirstRtt(std::ofstream* ofStream, Time oldRtt, Time newRtt)
|
||||
@@ -260,9 +260,9 @@ TraceFirstRtt(std::ofstream* ofStream, Time oldRtt, Time newRtt)
|
||||
/**
|
||||
* Trace second congestion window.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param oldCwnd Old value.
|
||||
* \param newCwnd new value.
|
||||
* @param ofStream Output filestream.
|
||||
* @param oldCwnd Old value.
|
||||
* @param newCwnd new value.
|
||||
*/
|
||||
void
|
||||
TraceSecondCwnd(std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
@@ -279,9 +279,9 @@ TraceSecondCwnd(std::ofstream* ofStream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
/**
|
||||
* Trace second RTT.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param oldRtt Old value.
|
||||
* \param newRtt New value.
|
||||
* @param ofStream Output filestream.
|
||||
* @param oldRtt Old value.
|
||||
* @param newRtt New value.
|
||||
*/
|
||||
void
|
||||
TraceSecondRtt(std::ofstream* ofStream, Time oldRtt, Time newRtt)
|
||||
@@ -296,10 +296,10 @@ TraceSecondRtt(std::ofstream* ofStream, Time oldRtt, Time newRtt)
|
||||
/**
|
||||
* Trace second TcpDctcp.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param bytesMarked Bytes marked.
|
||||
* \param bytesAcked Bytes ACKed.
|
||||
* \param alpha Alpha.
|
||||
* @param ofStream Output filestream.
|
||||
* @param bytesMarked Bytes marked.
|
||||
* @param bytesAcked Bytes ACKed.
|
||||
* @param alpha Alpha.
|
||||
*/
|
||||
void
|
||||
TraceSecondDctcp(std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAcked, double alpha)
|
||||
@@ -313,8 +313,8 @@ TraceSecondDctcp(std::ofstream* ofStream, uint32_t bytesMarked, uint32_t bytesAc
|
||||
/**
|
||||
* Trace ping RTT.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param rtt RTT value.
|
||||
* @param ofStream Output filestream.
|
||||
* @param rtt RTT value.
|
||||
*/
|
||||
void
|
||||
TracePingRtt(std::ofstream* ofStream, uint16_t, Time rtt)
|
||||
@@ -328,8 +328,8 @@ TracePingRtt(std::ofstream* ofStream, uint16_t, Time rtt)
|
||||
/**
|
||||
* Trace first Rx.
|
||||
*
|
||||
* \param packet The packet.
|
||||
* \param address The sender address.
|
||||
* @param packet The packet.
|
||||
* @param address The sender address.
|
||||
*/
|
||||
void
|
||||
TraceFirstRx(Ptr<const Packet> packet, const Address& address)
|
||||
@@ -340,8 +340,8 @@ TraceFirstRx(Ptr<const Packet> packet, const Address& address)
|
||||
/**
|
||||
* Trace second Rx.
|
||||
*
|
||||
* \param packet The packet.
|
||||
* \param address The sender address.
|
||||
* @param packet The packet.
|
||||
* @param address The sender address.
|
||||
*/
|
||||
void
|
||||
TraceSecondRx(Ptr<const Packet> packet, const Address& address)
|
||||
@@ -352,8 +352,8 @@ TraceSecondRx(Ptr<const Packet> packet, const Address& address)
|
||||
/**
|
||||
* Trace queue drop.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param item The dropped QueueDiscItem.
|
||||
* @param ofStream Output filestream.
|
||||
* @param item The dropped QueueDiscItem.
|
||||
*/
|
||||
void
|
||||
TraceQueueDrop(std::ofstream* ofStream, Ptr<const QueueDiscItem> item)
|
||||
@@ -368,9 +368,9 @@ TraceQueueDrop(std::ofstream* ofStream, Ptr<const QueueDiscItem> item)
|
||||
/**
|
||||
* Trace queue marks.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param item The marked QueueDiscItem.
|
||||
* \param reason The reason.
|
||||
* @param ofStream Output filestream.
|
||||
* @param item The marked QueueDiscItem.
|
||||
* @param reason The reason.
|
||||
*/
|
||||
void
|
||||
TraceQueueMark(std::ofstream* ofStream, Ptr<const QueueDiscItem> item, const char* reason)
|
||||
@@ -385,10 +385,10 @@ TraceQueueMark(std::ofstream* ofStream, Ptr<const QueueDiscItem> item, const cha
|
||||
/**
|
||||
* Trace queue length.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param queueLinkRate Queue link rate.
|
||||
* \param oldVal Old value.
|
||||
* \param newVal New value.
|
||||
* @param ofStream Output filestream.
|
||||
* @param queueLinkRate Queue link rate.
|
||||
* @param oldVal Old value.
|
||||
* @param newVal New value.
|
||||
*/
|
||||
void
|
||||
TraceQueueLength(std::ofstream* ofStream, DataRate queueLinkRate, uint32_t oldVal, uint32_t newVal)
|
||||
@@ -405,8 +405,8 @@ TraceQueueLength(std::ofstream* ofStream, DataRate queueLinkRate, uint32_t oldVa
|
||||
/**
|
||||
* Trace marks frequency.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param marksSamplingInterval The mark sampling interval.
|
||||
* @param ofStream Output filestream.
|
||||
* @param marksSamplingInterval The mark sampling interval.
|
||||
*/
|
||||
void
|
||||
TraceMarksFrequency(std::ofstream* ofStream, Time marksSamplingInterval)
|
||||
@@ -425,8 +425,8 @@ TraceMarksFrequency(std::ofstream* ofStream, Time marksSamplingInterval)
|
||||
/**
|
||||
* Trace the first throughput.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param throughputInterval The throughput interval.
|
||||
* @param ofStream Output filestream.
|
||||
* @param throughputInterval The throughput interval.
|
||||
*/
|
||||
void
|
||||
TraceFirstThroughput(std::ofstream* ofStream, Time throughputInterval)
|
||||
@@ -475,8 +475,8 @@ TraceFirstThroughput(std::ofstream* ofStream, Time throughputInterval)
|
||||
/**
|
||||
* Trace the second throughput.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* \param throughputInterval The throughput interval.
|
||||
* @param ofStream Output filestream.
|
||||
* @param throughputInterval The throughput interval.
|
||||
*/
|
||||
void
|
||||
TraceSecondThroughput(std::ofstream* ofStream, Time throughputInterval)
|
||||
@@ -493,7 +493,7 @@ TraceSecondThroughput(std::ofstream* ofStream, Time throughputInterval)
|
||||
/**
|
||||
* Schedule trace connection.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* @param ofStream Output filestream.
|
||||
*/
|
||||
void
|
||||
ScheduleFirstTcpCwndTraceConnection(std::ofstream* ofStream)
|
||||
@@ -506,7 +506,7 @@ ScheduleFirstTcpCwndTraceConnection(std::ofstream* ofStream)
|
||||
/**
|
||||
* Schedule trace connection.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* @param ofStream Output filestream.
|
||||
*/
|
||||
void
|
||||
ScheduleFirstTcpRttTraceConnection(std::ofstream* ofStream)
|
||||
@@ -518,7 +518,7 @@ ScheduleFirstTcpRttTraceConnection(std::ofstream* ofStream)
|
||||
/**
|
||||
* Schedule trace connection.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* @param ofStream Output filestream.
|
||||
*/
|
||||
void
|
||||
ScheduleFirstDctcpTraceConnection(std::ofstream* ofStream)
|
||||
@@ -531,7 +531,7 @@ ScheduleFirstDctcpTraceConnection(std::ofstream* ofStream)
|
||||
/**
|
||||
* Schedule trace connection.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* @param ofStream Output filestream.
|
||||
*/
|
||||
void
|
||||
ScheduleSecondDctcpTraceConnection(std::ofstream* ofStream)
|
||||
@@ -554,7 +554,7 @@ ScheduleFirstPacketSinkConnection()
|
||||
/**
|
||||
* Schedule trace connection.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* @param ofStream Output filestream.
|
||||
*/
|
||||
void
|
||||
ScheduleSecondTcpCwndTraceConnection(std::ofstream* ofStream)
|
||||
@@ -566,7 +566,7 @@ ScheduleSecondTcpCwndTraceConnection(std::ofstream* ofStream)
|
||||
/**
|
||||
* Schedule trace connection.
|
||||
*
|
||||
* \param ofStream Output filestream.
|
||||
* @param ofStream Output filestream.
|
||||
*/
|
||||
void
|
||||
ScheduleSecondTcpRttTraceConnection(std::ofstream* ofStream)
|
||||
|
||||
@@ -62,8 +62,8 @@ static std::map<uint32_t, uint32_t> ssThreshValue; //!< SlowSta
|
||||
/**
|
||||
* Get the Node Id From Context.
|
||||
*
|
||||
* \param context The context.
|
||||
* \return the node ID.
|
||||
* @param context The context.
|
||||
* @return the node ID.
|
||||
*/
|
||||
static uint32_t
|
||||
GetNodeIdFromContext(std::string context)
|
||||
@@ -76,9 +76,9 @@ GetNodeIdFromContext(std::string context)
|
||||
/**
|
||||
* Congestion window tracer.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param oldval Old value.
|
||||
* \param newval New value.
|
||||
* @param context The context.
|
||||
* @param oldval Old value.
|
||||
* @param newval New value.
|
||||
*/
|
||||
static void
|
||||
CwndTracer(std::string context, uint32_t oldval, uint32_t newval)
|
||||
@@ -103,9 +103,9 @@ CwndTracer(std::string context, uint32_t oldval, uint32_t newval)
|
||||
/**
|
||||
* Slow start threshold tracer.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param oldval Old value.
|
||||
* \param newval New value.
|
||||
* @param context The context.
|
||||
* @param oldval Old value.
|
||||
* @param newval New value.
|
||||
*/
|
||||
static void
|
||||
SsThreshTracer(std::string context, uint32_t oldval, uint32_t newval)
|
||||
@@ -131,9 +131,9 @@ SsThreshTracer(std::string context, uint32_t oldval, uint32_t newval)
|
||||
/**
|
||||
* RTT tracer.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param oldval Old value.
|
||||
* \param newval New value.
|
||||
* @param context The context.
|
||||
* @param oldval Old value.
|
||||
* @param newval New value.
|
||||
*/
|
||||
static void
|
||||
RttTracer(std::string context, Time oldval, Time newval)
|
||||
@@ -152,9 +152,9 @@ RttTracer(std::string context, Time oldval, Time newval)
|
||||
/**
|
||||
* RTO tracer.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param oldval Old value.
|
||||
* \param newval New value.
|
||||
* @param context The context.
|
||||
* @param oldval Old value.
|
||||
* @param newval New value.
|
||||
*/
|
||||
static void
|
||||
RtoTracer(std::string context, Time oldval, Time newval)
|
||||
@@ -173,9 +173,9 @@ RtoTracer(std::string context, Time oldval, Time newval)
|
||||
/**
|
||||
* Next TX tracer.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param old Old sequence number.
|
||||
* \param nextTx Next sequence number.
|
||||
* @param context The context.
|
||||
* @param old Old sequence number.
|
||||
* @param nextTx Next sequence number.
|
||||
*/
|
||||
static void
|
||||
NextTxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], SequenceNumber32 nextTx)
|
||||
@@ -189,9 +189,9 @@ NextTxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], Sequenc
|
||||
/**
|
||||
* In-flight tracer.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param old Old value.
|
||||
* \param inFlight In flight value.
|
||||
* @param context The context.
|
||||
* @param old Old value.
|
||||
* @param inFlight In flight value.
|
||||
*/
|
||||
static void
|
||||
InFlightTracer(std::string context, uint32_t old [[maybe_unused]], uint32_t inFlight)
|
||||
@@ -205,9 +205,9 @@ InFlightTracer(std::string context, uint32_t old [[maybe_unused]], uint32_t inFl
|
||||
/**
|
||||
* Next RX tracer.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param old Old sequence number.
|
||||
* \param nextRx Next sequence number.
|
||||
* @param context The context.
|
||||
* @param old Old sequence number.
|
||||
* @param nextRx Next sequence number.
|
||||
*/
|
||||
static void
|
||||
NextRxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], SequenceNumber32 nextRx)
|
||||
@@ -221,8 +221,8 @@ NextRxTracer(std::string context, SequenceNumber32 old [[maybe_unused]], Sequenc
|
||||
/**
|
||||
* Congestion window trace connection.
|
||||
*
|
||||
* \param cwnd_tr_file_name Congestion window trace file name.
|
||||
* \param nodeId Node ID.
|
||||
* @param cwnd_tr_file_name Congestion window trace file name.
|
||||
* @param nodeId Node ID.
|
||||
*/
|
||||
static void
|
||||
TraceCwnd(std::string cwnd_tr_file_name, uint32_t nodeId)
|
||||
@@ -237,8 +237,8 @@ TraceCwnd(std::string cwnd_tr_file_name, uint32_t nodeId)
|
||||
/**
|
||||
* Slow start threshold trace connection.
|
||||
*
|
||||
* \param ssthresh_tr_file_name Slow start threshold trace file name.
|
||||
* \param nodeId Node ID.
|
||||
* @param ssthresh_tr_file_name Slow start threshold trace file name.
|
||||
* @param nodeId Node ID.
|
||||
*/
|
||||
static void
|
||||
TraceSsThresh(std::string ssthresh_tr_file_name, uint32_t nodeId)
|
||||
@@ -253,8 +253,8 @@ TraceSsThresh(std::string ssthresh_tr_file_name, uint32_t nodeId)
|
||||
/**
|
||||
* RTT trace connection.
|
||||
*
|
||||
* \param rtt_tr_file_name RTT trace file name.
|
||||
* \param nodeId Node ID.
|
||||
* @param rtt_tr_file_name RTT trace file name.
|
||||
* @param nodeId Node ID.
|
||||
*/
|
||||
static void
|
||||
TraceRtt(std::string rtt_tr_file_name, uint32_t nodeId)
|
||||
@@ -268,8 +268,8 @@ TraceRtt(std::string rtt_tr_file_name, uint32_t nodeId)
|
||||
/**
|
||||
* RTO trace connection.
|
||||
*
|
||||
* \param rto_tr_file_name RTO trace file name.
|
||||
* \param nodeId Node ID.
|
||||
* @param rto_tr_file_name RTO trace file name.
|
||||
* @param nodeId Node ID.
|
||||
*/
|
||||
static void
|
||||
TraceRto(std::string rto_tr_file_name, uint32_t nodeId)
|
||||
@@ -283,8 +283,8 @@ TraceRto(std::string rto_tr_file_name, uint32_t nodeId)
|
||||
/**
|
||||
* Next TX trace connection.
|
||||
*
|
||||
* \param next_tx_seq_file_name Next TX trace file name.
|
||||
* \param nodeId Node ID.
|
||||
* @param next_tx_seq_file_name Next TX trace file name.
|
||||
* @param nodeId Node ID.
|
||||
*/
|
||||
static void
|
||||
TraceNextTx(std::string& next_tx_seq_file_name, uint32_t nodeId)
|
||||
@@ -299,8 +299,8 @@ TraceNextTx(std::string& next_tx_seq_file_name, uint32_t nodeId)
|
||||
/**
|
||||
* In flight trace connection.
|
||||
*
|
||||
* \param in_flight_file_name In flight trace file name.
|
||||
* \param nodeId Node ID.
|
||||
* @param in_flight_file_name In flight trace file name.
|
||||
* @param nodeId Node ID.
|
||||
*/
|
||||
static void
|
||||
TraceInFlight(std::string& in_flight_file_name, uint32_t nodeId)
|
||||
@@ -315,8 +315,8 @@ TraceInFlight(std::string& in_flight_file_name, uint32_t nodeId)
|
||||
/**
|
||||
* Next RX trace connection.
|
||||
*
|
||||
* \param next_rx_seq_file_name Next RX trace file name.
|
||||
* \param nodeId Node ID.
|
||||
* @param next_rx_seq_file_name Next RX trace file name.
|
||||
* @param nodeId Node ID.
|
||||
*/
|
||||
static void
|
||||
TraceNextRx(std::string& next_rx_seq_file_name, uint32_t nodeId)
|
||||
|
||||
@@ -58,9 +58,9 @@ NS_LOG_COMPONENT_DEFINE("BenchmarkQueueDiscs");
|
||||
/**
|
||||
* Print the queue limits.
|
||||
*
|
||||
* \param stream The output stream.
|
||||
* \param oldVal Old value.
|
||||
* \param newVal New value.
|
||||
* @param stream The output stream.
|
||||
* @param oldVal Old value.
|
||||
* @param newVal New value.
|
||||
*/
|
||||
void
|
||||
LimitsTrace(Ptr<OutputStreamWrapper> stream, uint32_t oldVal, uint32_t newVal)
|
||||
@@ -71,9 +71,9 @@ LimitsTrace(Ptr<OutputStreamWrapper> stream, uint32_t oldVal, uint32_t newVal)
|
||||
/**
|
||||
* Print the bytes in the queue.
|
||||
*
|
||||
* \param stream The output stream.
|
||||
* \param oldVal Old value.
|
||||
* \param newVal New value.
|
||||
* @param stream The output stream.
|
||||
* @param oldVal Old value.
|
||||
* @param newVal New value.
|
||||
*/
|
||||
void
|
||||
BytesInQueueTrace(Ptr<OutputStreamWrapper> stream, uint32_t oldVal, uint32_t newVal)
|
||||
@@ -84,9 +84,9 @@ BytesInQueueTrace(Ptr<OutputStreamWrapper> stream, uint32_t oldVal, uint32_t new
|
||||
/**
|
||||
* Sample and print the queue goodput.
|
||||
*
|
||||
* \param app The Tx app.
|
||||
* \param stream The output stream.
|
||||
* \param period The sampling period.
|
||||
* @param app The Tx app.
|
||||
* @param stream The output stream.
|
||||
* @param period The sampling period.
|
||||
*/
|
||||
static void
|
||||
GoodputSampling(ApplicationContainer app, Ptr<OutputStreamWrapper> stream, float period)
|
||||
@@ -101,8 +101,8 @@ GoodputSampling(ApplicationContainer app, Ptr<OutputStreamWrapper> stream, float
|
||||
/**
|
||||
* Print the ping RTT.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param rtt The RTT.
|
||||
* @param context The context.
|
||||
* @param rtt The RTT.
|
||||
*/
|
||||
static void
|
||||
PingRtt(std::string context, uint16_t, Time rtt)
|
||||
|
||||
@@ -139,8 +139,8 @@ main(int argc, char* argv[])
|
||||
{
|
||||
sinkApps.Add(packetSinkHelper.Install(d.GetLeft(i)));
|
||||
}
|
||||
sinkApps.Start(Seconds(0.0));
|
||||
sinkApps.Stop(Seconds(30.0));
|
||||
sinkApps.Start(Seconds(0));
|
||||
sinkApps.Stop(Seconds(30));
|
||||
|
||||
ApplicationContainer clientApps;
|
||||
for (uint32_t i = 0; i < d.RightCount(); ++i)
|
||||
@@ -150,8 +150,8 @@ main(int argc, char* argv[])
|
||||
clientHelper.SetAttribute("Remote", remoteAddress);
|
||||
clientApps.Add(clientHelper.Install(d.GetRight(i)));
|
||||
}
|
||||
clientApps.Start(Seconds(1.0)); // Start 1 second after sink
|
||||
clientApps.Stop(Seconds(15.0)); // Stop before the sink
|
||||
clientApps.Start(Seconds(1)); // Start 1 second after sink
|
||||
clientApps.Stop(Seconds(15)); // Stop before the sink
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ main(int argc, char* argv[])
|
||||
{
|
||||
sinkApps.Add(packetSinkHelper.Install(d.GetLeft(i)));
|
||||
}
|
||||
sinkApps.Start(Seconds(0.0));
|
||||
sinkApps.Stop(Seconds(30.0));
|
||||
sinkApps.Start(Seconds(0));
|
||||
sinkApps.Stop(Seconds(30));
|
||||
|
||||
ApplicationContainer clientApps;
|
||||
for (uint32_t i = 0; i < d.RightCount(); ++i)
|
||||
@@ -151,8 +151,8 @@ main(int argc, char* argv[])
|
||||
clientHelper.SetAttribute("Remote", remoteAddress);
|
||||
clientApps.Add(clientHelper.Install(d.GetRight(i)));
|
||||
}
|
||||
clientApps.Start(Seconds(1.0)); // Start 1 second after sink
|
||||
clientApps.Stop(Seconds(15.0)); // Stop before the sink
|
||||
clientApps.Start(Seconds(1)); // Start 1 second after sink
|
||||
clientApps.Stop(Seconds(15)); // Stop before the sink
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ main(int argc, char* argv[])
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
ApplicationContainer sinkApp = packetSinkHelper.Install(nodes.Get(0));
|
||||
|
||||
sinkApp.Start(Seconds(0.0));
|
||||
sinkApp.Start(Seconds(0));
|
||||
sinkApp.Stop(Seconds(simulationTime + 0.1));
|
||||
|
||||
uint32_t payloadSize = 1448;
|
||||
@@ -126,7 +126,7 @@ main(int argc, char* argv[])
|
||||
onoff.SetAttribute("Tos", UintegerValue(0xb8));
|
||||
|
||||
apps.Add(onoff.Install(nodes.Get(1)));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(simulationTime + 0.1));
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 5));
|
||||
|
||||
@@ -57,8 +57,8 @@ NS_LOG_COMPONENT_DEFINE("TrafficControlExample");
|
||||
/**
|
||||
* Number of packets in TX queue trace.
|
||||
*
|
||||
* \param oldValue Old velue.
|
||||
* \param newValue New value.
|
||||
* @param oldValue Old velue.
|
||||
* @param newValue New value.
|
||||
*/
|
||||
void
|
||||
TcPacketsInQueueTrace(uint32_t oldValue, uint32_t newValue)
|
||||
@@ -69,8 +69,8 @@ TcPacketsInQueueTrace(uint32_t oldValue, uint32_t newValue)
|
||||
/**
|
||||
* Packets in the device queue trace.
|
||||
*
|
||||
* \param oldValue Old velue.
|
||||
* \param newValue New value.
|
||||
* @param oldValue Old velue.
|
||||
* @param newValue New value.
|
||||
*/
|
||||
void
|
||||
DevicePacketsInQueueTrace(uint32_t oldValue, uint32_t newValue)
|
||||
@@ -81,7 +81,7 @@ DevicePacketsInQueueTrace(uint32_t oldValue, uint32_t newValue)
|
||||
/**
|
||||
* TC Soujoun time trace.
|
||||
*
|
||||
* \param sojournTime The soujourn time.
|
||||
* @param sojournTime The soujourn time.
|
||||
*/
|
||||
void
|
||||
SojournTimeTrace(Time sojournTime)
|
||||
@@ -149,7 +149,7 @@ main(int argc, char* argv[])
|
||||
PacketSinkHelper packetSinkHelper(socketType, localAddress);
|
||||
ApplicationContainer sinkApp = packetSinkHelper.Install(nodes.Get(0));
|
||||
|
||||
sinkApp.Start(Seconds(0.0));
|
||||
sinkApp.Start(Seconds(0));
|
||||
sinkApp.Stop(Seconds(simulationTime + 0.1));
|
||||
|
||||
uint32_t payloadSize = 1448;
|
||||
@@ -166,7 +166,7 @@ main(int argc, char* argv[])
|
||||
onoff.SetAttribute("Remote", AddressValue(rmt));
|
||||
onoff.SetAttribute("Tos", UintegerValue(0xb8));
|
||||
apps.Add(onoff.Install(nodes.Get(1)));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(simulationTime + 0.1));
|
||||
|
||||
FlowMonitorHelper flowmon;
|
||||
|
||||
@@ -54,8 +54,8 @@ NS_LOG_COMPONENT_DEFINE("FifthScriptExample");
|
||||
/**
|
||||
* Congestion window change callback
|
||||
*
|
||||
* \param oldCwnd Old congestion window.
|
||||
* \param newCwnd New congestion window.
|
||||
* @param oldCwnd Old congestion window.
|
||||
* @param newCwnd New congestion window.
|
||||
*/
|
||||
static void
|
||||
CwndChange(uint32_t oldCwnd, uint32_t newCwnd)
|
||||
@@ -66,7 +66,7 @@ CwndChange(uint32_t oldCwnd, uint32_t newCwnd)
|
||||
/**
|
||||
* Rx drop callback
|
||||
*
|
||||
* \param p The dropped packet.
|
||||
* @param p The dropped packet.
|
||||
*/
|
||||
static void
|
||||
RxDrop(Ptr<const Packet> p)
|
||||
|
||||
@@ -50,17 +50,17 @@ main(int argc, char* argv[])
|
||||
UdpEchoServerHelper echoServer(9);
|
||||
|
||||
ApplicationContainer serverApps = echoServer.Install(nodes.Get(1));
|
||||
serverApps.Start(Seconds(1.0));
|
||||
serverApps.Stop(Seconds(10.0));
|
||||
serverApps.Start(Seconds(1));
|
||||
serverApps.Stop(Seconds(10));
|
||||
|
||||
UdpEchoClientHelper echoClient(interfaces.GetAddress(1), 9);
|
||||
echoClient.SetAttribute("MaxPackets", UintegerValue(1));
|
||||
echoClient.SetAttribute("Interval", TimeValue(Seconds(1.0)));
|
||||
echoClient.SetAttribute("Interval", TimeValue(Seconds(1)));
|
||||
echoClient.SetAttribute("PacketSize", UintegerValue(1024));
|
||||
|
||||
ApplicationContainer clientApps = echoClient.Install(nodes.Get(0));
|
||||
clientApps.Start(Seconds(2.0));
|
||||
clientApps.Stop(Seconds(10.0));
|
||||
clientApps.Start(Seconds(2));
|
||||
clientApps.Stop(Seconds(10));
|
||||
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
@@ -41,18 +41,18 @@ interfaces = address.Assign(devices)
|
||||
echoServer = ns.UdpEchoServerHelper(9)
|
||||
|
||||
serverApps = echoServer.Install(nodes.Get(1))
|
||||
serverApps.Start(ns.Seconds(1.0))
|
||||
serverApps.Stop(ns.Seconds(10.0))
|
||||
serverApps.Start(ns.Seconds(1))
|
||||
serverApps.Stop(ns.Seconds(10))
|
||||
|
||||
address = interfaces.GetAddress(1).ConvertTo()
|
||||
echoClient = ns.UdpEchoClientHelper(address, 9)
|
||||
echoClient.SetAttribute("MaxPackets", ns.UintegerValue(1))
|
||||
echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1.0)))
|
||||
echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1)))
|
||||
echoClient.SetAttribute("PacketSize", ns.UintegerValue(1024))
|
||||
|
||||
clientApps = echoClient.Install(nodes.Get(0))
|
||||
clientApps.Start(ns.Seconds(2.0))
|
||||
clientApps.Stop(ns.Seconds(10.0))
|
||||
clientApps.Start(ns.Seconds(2))
|
||||
clientApps.Stop(ns.Seconds(10))
|
||||
|
||||
ns.Simulator.Run()
|
||||
ns.Simulator.Destroy()
|
||||
|
||||
@@ -20,7 +20,7 @@ class MyObject : public Object
|
||||
public:
|
||||
/**
|
||||
* Register this type.
|
||||
* \return The TypeId.
|
||||
* @return The TypeId.
|
||||
*/
|
||||
static TypeId GetTypeId()
|
||||
{
|
||||
|
||||
@@ -79,17 +79,17 @@ main(int argc, char* argv[])
|
||||
UdpEchoServerHelper echoServer(9);
|
||||
|
||||
ApplicationContainer serverApps = echoServer.Install(csmaNodes.Get(nCsma));
|
||||
serverApps.Start(Seconds(1.0));
|
||||
serverApps.Stop(Seconds(10.0));
|
||||
serverApps.Start(Seconds(1));
|
||||
serverApps.Stop(Seconds(10));
|
||||
|
||||
UdpEchoClientHelper echoClient(csmaInterfaces.GetAddress(nCsma), 9);
|
||||
echoClient.SetAttribute("MaxPackets", UintegerValue(1));
|
||||
echoClient.SetAttribute("Interval", TimeValue(Seconds(1.0)));
|
||||
echoClient.SetAttribute("Interval", TimeValue(Seconds(1)));
|
||||
echoClient.SetAttribute("PacketSize", UintegerValue(1024));
|
||||
|
||||
ApplicationContainer clientApps = echoClient.Install(p2pNodes.Get(0));
|
||||
clientApps.Start(Seconds(2.0));
|
||||
clientApps.Stop(Seconds(10.0));
|
||||
clientApps.Start(Seconds(2));
|
||||
clientApps.Stop(Seconds(10));
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
|
||||
@@ -69,17 +69,17 @@ csmaInterfaces = address.Assign(csmaDevices)
|
||||
echoServer = ns.UdpEchoServerHelper(9)
|
||||
|
||||
serverApps = echoServer.Install(csmaNodes.Get(nCsma.value))
|
||||
serverApps.Start(ns.Seconds(1.0))
|
||||
serverApps.Stop(ns.Seconds(10.0))
|
||||
serverApps.Start(ns.Seconds(1))
|
||||
serverApps.Stop(ns.Seconds(10))
|
||||
|
||||
echoClient = ns.UdpEchoClientHelper(csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9)
|
||||
echoClient.SetAttribute("MaxPackets", ns.UintegerValue(1))
|
||||
echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1.0)))
|
||||
echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1)))
|
||||
echoClient.SetAttribute("PacketSize", ns.UintegerValue(1024))
|
||||
|
||||
clientApps = echoClient.Install(p2pNodes.Get(0))
|
||||
clientApps.Start(ns.Seconds(2.0))
|
||||
clientApps.Stop(ns.Seconds(10.0))
|
||||
clientApps.Start(ns.Seconds(2))
|
||||
clientApps.Stop(ns.Seconds(10))
|
||||
|
||||
ns.Ipv4GlobalRoutingHelper.PopulateRoutingTables()
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ NS_LOG_COMPONENT_DEFINE("SeventhScriptExample");
|
||||
/**
|
||||
* Congestion window change callback
|
||||
*
|
||||
* \param stream The output stream file.
|
||||
* \param oldCwnd Old congestion window.
|
||||
* \param newCwnd New congestion window.
|
||||
* @param stream The output stream file.
|
||||
* @param oldCwnd Old congestion window.
|
||||
* @param newCwnd New congestion window.
|
||||
*/
|
||||
static void
|
||||
CwndChange(Ptr<OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
@@ -73,8 +73,8 @@ CwndChange(Ptr<OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
/**
|
||||
* Rx drop callback
|
||||
*
|
||||
* \param file The output PCAP file.
|
||||
* \param p The dropped packet.
|
||||
* @param file The output PCAP file.
|
||||
* @param p The dropped packet.
|
||||
*/
|
||||
static void
|
||||
RxDrop(Ptr<PcapFileWrapper> file, Ptr<const Packet> p)
|
||||
|
||||
@@ -54,9 +54,9 @@ NS_LOG_COMPONENT_DEFINE("SixthScriptExample");
|
||||
/**
|
||||
* Congestion window change callback
|
||||
*
|
||||
* \param stream The output stream file.
|
||||
* \param oldCwnd Old congestion window.
|
||||
* \param newCwnd New congestion window.
|
||||
* @param stream The output stream file.
|
||||
* @param oldCwnd Old congestion window.
|
||||
* @param newCwnd New congestion window.
|
||||
*/
|
||||
static void
|
||||
CwndChange(Ptr<OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
@@ -69,8 +69,8 @@ CwndChange(Ptr<OutputStreamWrapper> stream, uint32_t oldCwnd, uint32_t newCwnd)
|
||||
/**
|
||||
* Rx drop callback
|
||||
*
|
||||
* \param file The output PCAP file.
|
||||
* \param p The dropped packet.
|
||||
* @param file The output PCAP file.
|
||||
* @param p The dropped packet.
|
||||
*/
|
||||
static void
|
||||
RxDrop(Ptr<PcapFileWrapper> file, Ptr<const Packet> p)
|
||||
|
||||
@@ -147,21 +147,21 @@ main(int argc, char* argv[])
|
||||
UdpEchoServerHelper echoServer(9);
|
||||
|
||||
ApplicationContainer serverApps = echoServer.Install(csmaNodes.Get(nCsma));
|
||||
serverApps.Start(Seconds(1.0));
|
||||
serverApps.Stop(Seconds(10.0));
|
||||
serverApps.Start(Seconds(1));
|
||||
serverApps.Stop(Seconds(10));
|
||||
|
||||
UdpEchoClientHelper echoClient(csmaInterfaces.GetAddress(nCsma), 9);
|
||||
echoClient.SetAttribute("MaxPackets", UintegerValue(1));
|
||||
echoClient.SetAttribute("Interval", TimeValue(Seconds(1.0)));
|
||||
echoClient.SetAttribute("Interval", TimeValue(Seconds(1)));
|
||||
echoClient.SetAttribute("PacketSize", UintegerValue(1024));
|
||||
|
||||
ApplicationContainer clientApps = echoClient.Install(wifiStaNodes.Get(nWifi - 1));
|
||||
clientApps.Start(Seconds(2.0));
|
||||
clientApps.Stop(Seconds(10.0));
|
||||
clientApps.Start(Seconds(2));
|
||||
clientApps.Stop(Seconds(10));
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Stop(Seconds(10));
|
||||
|
||||
if (tracing)
|
||||
{
|
||||
|
||||
@@ -135,21 +135,21 @@ address.Assign(apDevices)
|
||||
echoServer = ns.UdpEchoServerHelper(9)
|
||||
|
||||
serverApps = echoServer.Install(csmaNodes.Get(nCsma.value))
|
||||
serverApps.Start(ns.Seconds(1.0))
|
||||
serverApps.Stop(ns.Seconds(10.0))
|
||||
serverApps.Start(ns.Seconds(1))
|
||||
serverApps.Stop(ns.Seconds(10))
|
||||
|
||||
echoClient = ns.UdpEchoClientHelper(csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9)
|
||||
echoClient.SetAttribute("MaxPackets", ns.UintegerValue(1))
|
||||
echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1.0)))
|
||||
echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1)))
|
||||
echoClient.SetAttribute("PacketSize", ns.UintegerValue(1024))
|
||||
|
||||
clientApps = echoClient.Install(wifiStaNodes.Get(nWifi.value - 1))
|
||||
clientApps.Start(ns.Seconds(2.0))
|
||||
clientApps.Stop(ns.Seconds(10.0))
|
||||
clientApps.Start(ns.Seconds(2))
|
||||
clientApps.Stop(ns.Seconds(10))
|
||||
|
||||
ns.Ipv4GlobalRoutingHelper.PopulateRoutingTables()
|
||||
|
||||
ns.Simulator.Stop(ns.Seconds(10.0))
|
||||
ns.Simulator.Stop(ns.Seconds(10))
|
||||
|
||||
if tracing.value:
|
||||
phy.SetPcapDataLinkType(phy.DLT_IEEE802_11_RADIO)
|
||||
|
||||
@@ -25,17 +25,17 @@ class TutorialApp : public Application
|
||||
|
||||
/**
|
||||
* Register this type.
|
||||
* \return The TypeId.
|
||||
* @return The TypeId.
|
||||
*/
|
||||
static TypeId GetTypeId();
|
||||
|
||||
/**
|
||||
* Setup the socket.
|
||||
* \param socket The socket.
|
||||
* \param address The destination address.
|
||||
* \param packetSize The packet size to transmit.
|
||||
* \param nPackets The number of packets to transmit.
|
||||
* \param dataRate the data rate to use.
|
||||
* @param socket The socket.
|
||||
* @param address The destination address.
|
||||
* @param packetSize The packet size to transmit.
|
||||
* @param nPackets The number of packets to transmit.
|
||||
* @param dataRate the data rate to use.
|
||||
*/
|
||||
void Setup(Ptr<Socket> socket,
|
||||
Address address,
|
||||
|
||||
@@ -82,8 +82,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 4000;
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer apps = server.Install(n.Get(1));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
NS_LOG_INFO("Create UdpClient application on node 0 to send to node 1.");
|
||||
uint32_t MaxPacketSize = 1024;
|
||||
@@ -94,8 +94,8 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("Interval", TimeValue(interPacketInterval));
|
||||
client.SetAttribute("PacketSize", UintegerValue(MaxPacketSize));
|
||||
apps = client.Install(n.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
NS_LOG_INFO("Run Simulation.");
|
||||
Simulator::Run();
|
||||
|
||||
@@ -34,6 +34,7 @@ main(int argc, char* argv[])
|
||||
// Declare variables used in command-line arguments
|
||||
bool useV6 = false;
|
||||
bool logging = true;
|
||||
uint16_t port = 4000;
|
||||
Address serverAddress;
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
@@ -67,30 +68,29 @@ main(int argc, char* argv[])
|
||||
Ipv4AddressHelper ipv4;
|
||||
ipv4.SetBase("10.1.1.0", "255.255.255.0");
|
||||
Ipv4InterfaceContainer i = ipv4.Assign(d);
|
||||
serverAddress = Address(i.GetAddress(1));
|
||||
serverAddress = InetSocketAddress(i.GetAddress(1), port);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipv6AddressHelper ipv6;
|
||||
ipv6.SetBase("2001:0000:f00d:cafe::", Ipv6Prefix(64));
|
||||
Ipv6InterfaceContainer i6 = ipv6.Assign(d);
|
||||
serverAddress = Address(i6.GetAddress(1, 1));
|
||||
serverAddress = Inet6SocketAddress(i6.GetAddress(1, 1), port);
|
||||
}
|
||||
|
||||
NS_LOG_INFO("Create UdpServer application on node 1.");
|
||||
uint16_t port = 4000;
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer apps = server.Install(n.Get(1));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
NS_LOG_INFO("Create UdpClient application on node 0 to send to node 1.");
|
||||
uint32_t MaxPacketSize = 1472; // Back off 20 (IP) + 8 (UDP) bytes from MTU
|
||||
UdpTraceClientHelper client(serverAddress, port, "");
|
||||
UdpTraceClientHelper client(serverAddress);
|
||||
client.SetAttribute("MaxPacketSize", UintegerValue(MaxPacketSize));
|
||||
apps = client.Install(n.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
NS_LOG_INFO("Run Simulation.");
|
||||
Simulator::Run();
|
||||
|
||||
@@ -92,8 +92,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9; // well-known echo port number
|
||||
UdpEchoServerHelper server(port);
|
||||
ApplicationContainer apps = server.Install(n.Get(1));
|
||||
apps.Start(Seconds(1.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(1));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
//
|
||||
// Create a UdpEchoClient application to send UDP datagrams from node zero to
|
||||
@@ -107,8 +107,8 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("Interval", TimeValue(interPacketInterval));
|
||||
client.SetAttribute("PacketSize", UintegerValue(packetSize));
|
||||
apps = client.Install(n.Get(0));
|
||||
apps.Start(Seconds(2.0));
|
||||
apps.Stop(Seconds(10.0));
|
||||
apps.Start(Seconds(2));
|
||||
apps.Stop(Seconds(10));
|
||||
|
||||
#if 0
|
||||
//
|
||||
|
||||
@@ -298,3 +298,14 @@ build_example(
|
||||
LIBRARIES_TO_LINK ${libwifi}
|
||||
${libapplications}
|
||||
)
|
||||
|
||||
build_example(
|
||||
NAME wifi-multicast
|
||||
SOURCE_FILES wifi-multicast.cc
|
||||
LIBRARIES_TO_LINK
|
||||
${libwifi}
|
||||
${libcore}
|
||||
${libnetwork}
|
||||
${libapplications}
|
||||
${libinternet}
|
||||
)
|
||||
|
||||
79
examples/wireless/examples-to-run.py
Executable file → Normal file
79
examples/wireless/examples-to-run.py
Executable file → Normal file
@@ -180,7 +180,7 @@ cpp_examples = [
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.23s --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --frequency2=6 --minExpectedThroughput=60 --maxExpectedThroughput=430",
|
||||
"wifi-eht-network --simulationTime=0.23s --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --frequency2=6 --minExpectedThroughput=35 --maxExpectedThroughput=404",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
@@ -195,7 +195,37 @@ cpp_examples = [
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.25s --udp=0 --downlink=0 --useRts=0 --nStations=4 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mpduBufferSize=1024 --mcs=8 --muSchedAccessReqInterval=45ms --frequency2=6 --minExpectedThroughput=50 --maxExpectedThroughput=550",
|
||||
"wifi-eht-network --simulationTime=0.25s --udp=0 --downlink=0 --useRts=0 --nStations=4 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mpduBufferSize=1024 --mcs=8 --muSchedAccessReqInterval=45ms --frequency2=6 --minExpectedThroughput=50 --maxExpectedThroughput=550 --RngRun=7",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.2s --frequency=2.4 --frequency2=5 --guardInterval=1600 --udp=0 --downlink=1 --useRts=0 --mpduBufferSize=512 --emlsrLinks=0,1 --emlsrPaddingDelay=32 --emlsrTransitionDelay=32 --channelSwitchDelay=32us --emlsrAuxSwitch=True --emlsrAuxTxCapable=True --minExpectedThroughput=5 --maxExpectedThroughput=200",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.2s --frequency=2.4 --frequency2=5 --guardInterval=1600 --udp=0 --downlink=1 --useRts=1 --mpduBufferSize=512 --emlsrLinks=0,1 --emlsrPaddingDelay=64 --emlsrTransitionDelay=64 --channelSwitchDelay=64us --emlsrMgrTypeId=ns3::AdvancedEmlsrManager --emlsrAuxSwitch=False --emlsrAuxTxCapable=True --minExpectedThroughput=5 --maxExpectedThroughput=190",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.2s --frequency=2.4 --frequency2=5 --guardInterval=1600 --udp=0 --downlink=0 --useRts=0 --mpduBufferSize=512 --emlsrLinks=0,1 --emlsrPaddingDelay=0 --emlsrTransitionDelay=0 --channelSwitchDelay=1ns --emlsrMgrTypeId=ns3::AdvancedEmlsrManager --emlsrAuxSwitch=False --emlsrAuxTxCapable=False --minExpectedThroughput=5 --maxExpectedThroughput=40 --RngRun=7",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.3s --frequency=2.4 --frequency2=5 --frequency3=6 --guardInterval=1600 --udp=0 --downlink=1 --useRts=0 --mpduBufferSize=512 --emlsrLinks=0,1,2 --emlsrPaddingDelay=32 --emlsrTransitionDelay=32 --channelSwitchDelay=32us --emlsrAuxSwitch=True --emlsrAuxTxCapable=True --nStations=4 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=0,3,5,9,10 --minExpectedThroughput=8 --maxExpectedThroughput=300 --RngRun=6",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.3s --frequency=2.4 --frequency2=5 --frequency3=6 --guardInterval=1600 --udp=0 --downlink=0 --useRts=1 --mpduBufferSize=512 --emlsrLinks=0,1,2 --emlsrPaddingDelay=64 --emlsrTransitionDelay=64 --channelSwitchDelay=64us --emlsrAuxSwitch=False --emlsrAuxTxCapable=True --nStations=4 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=1,4,8,11,13 --minExpectedThroughput=10 --maxExpectedThroughput=260 --RngRun=4",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.3s --frequency=2.4 --frequency2=5 --frequency3=6 --guardInterval=1600 --udp=0 --downlink=0 --useRts=1 --mpduBufferSize=512 --emlsrLinks=0,1,2 --emlsrPaddingDelay=0 --emlsrTransitionDelay=0 --channelSwitchDelay=1ns --emlsrMgrTypeId=ns3::AdvancedEmlsrManager --emlsrAuxSwitch=False --emlsrAuxTxCapable=False --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=1 --mcs=1,5,8,11 --minExpectedThroughput=8 --maxExpectedThroughput=288 --RngRun=5",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
@@ -264,6 +294,51 @@ cpp_examples = [
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --minExpectedPackets=10",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrUr --minExpectedPackets=10",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrUr --multicastFrameErrorRate=0.2 --minExpectedPackets=10",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrUr --maxAmpduLength=65535 --maxPackets=0 --nStations=4 --dataRate=50Mbps --gcrProtection=Rts-Cts --rtsThreshold=0 --simulationTime=1 --minExpectedThroughput=35 --maxExpectedThroughput=40",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrUr --maxAmpduLength=65535 --maxPackets=0 --nStations=4 --dataRate=50Mbps --gcrProtection=Cts-To-Self --simulationTime=1 --minExpectedThroughput=40 --maxExpectedThroughput=45",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrBlockAck --minExpectedPackets=10",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrBlockAck --multicastFrameErrorRate=0.2 --minExpectedPackets=10",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrBlockAck --maxAmpduLength=65535 --maxPackets=0 --nStations=4 --dataRate=100Mbps --gcrProtection=Rts-Cts --rtsThreshold=0 --simulationTime=1s --minExpectedThroughput=100 --maxExpectedThroughput=100",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-multicast --gcrRetransmissionPolicy=GcrBlockAck --maxAmpduLength=65535 --maxPackets=0 --nStations=4 --dataRate=100Mbps --gcrProtection=Cts-To-Self --simulationTime=1s --minExpectedThroughput=100 --maxExpectedThroughput=100",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
]
|
||||
|
||||
# A list of Python examples to run in order to ensure that they remain
|
||||
|
||||
@@ -72,8 +72,8 @@ NS_LOG_COMPONENT_DEFINE("MixedWireless");
|
||||
* This function will be used below as a trace sink, if the command-line
|
||||
* argument or default value "useCourseChangeCallback" is set to true
|
||||
*
|
||||
* \param path The callback path.
|
||||
* \param model The mobility model.
|
||||
* @param path The callback path.
|
||||
* @param model The mobility model.
|
||||
*/
|
||||
static void
|
||||
CourseChangeCallback(std::string path, Ptr<const MobilityModel> model)
|
||||
|
||||
@@ -63,12 +63,12 @@ struct TxopDurationTracer
|
||||
/**
|
||||
* Callback connected to TXOP duration trace source.
|
||||
*
|
||||
* \param startTime TXOP start time
|
||||
* \param duration TXOP duration
|
||||
* \param linkId the ID of the link
|
||||
* @param startTime TXOP start time
|
||||
* @param duration TXOP duration
|
||||
* @param linkId the ID of the link
|
||||
*/
|
||||
void Trace(Time startTime, Time duration, uint8_t linkId);
|
||||
Time m_max{Seconds(0)}; //!< maximum TXOP duration
|
||||
Time m_max; //!< maximum TXOP duration
|
||||
};
|
||||
|
||||
void
|
||||
@@ -284,8 +284,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 5001;
|
||||
UdpServerHelper serverA(port);
|
||||
ApplicationContainer serverAppA = serverA.Install(wifiApNodes.Get(0));
|
||||
serverAppA.Start(Seconds(0.0));
|
||||
serverAppA.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppA.Start(Seconds(0));
|
||||
serverAppA.Stop(simulationTime + Seconds(1));
|
||||
|
||||
InetSocketAddress destA(ApInterfaceA.GetAddress(0), port);
|
||||
|
||||
@@ -297,13 +297,13 @@ main(int argc, char* argv[])
|
||||
clientA.SetAttribute("Tos", UintegerValue(0x70)); // AC_BE
|
||||
|
||||
ApplicationContainer clientAppA = clientA.Install(wifiStaNodes.Get(0));
|
||||
clientAppA.Start(Seconds(1.0));
|
||||
clientAppA.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppA.Start(Seconds(1));
|
||||
clientAppA.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverB(port);
|
||||
ApplicationContainer serverAppB = serverB.Install(wifiApNodes.Get(1));
|
||||
serverAppB.Start(Seconds(0.0));
|
||||
serverAppB.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppB.Start(Seconds(0));
|
||||
serverAppB.Stop(simulationTime + Seconds(1));
|
||||
|
||||
InetSocketAddress destB(ApInterfaceB.GetAddress(0), port);
|
||||
|
||||
@@ -315,13 +315,13 @@ main(int argc, char* argv[])
|
||||
clientB.SetAttribute("Tos", UintegerValue(0x70)); // AC_BE
|
||||
|
||||
ApplicationContainer clientAppB = clientB.Install(wifiStaNodes.Get(1));
|
||||
clientAppB.Start(Seconds(1.0));
|
||||
clientAppB.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppB.Start(Seconds(1));
|
||||
clientAppB.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverC(port);
|
||||
ApplicationContainer serverAppC = serverC.Install(wifiApNodes.Get(2));
|
||||
serverAppC.Start(Seconds(0.0));
|
||||
serverAppC.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppC.Start(Seconds(0));
|
||||
serverAppC.Stop(simulationTime + Seconds(1));
|
||||
|
||||
InetSocketAddress destC(ApInterfaceC.GetAddress(0), port);
|
||||
|
||||
@@ -333,13 +333,13 @@ main(int argc, char* argv[])
|
||||
clientC.SetAttribute("Tos", UintegerValue(0xb8)); // AC_VI
|
||||
|
||||
ApplicationContainer clientAppC = clientC.Install(wifiStaNodes.Get(2));
|
||||
clientAppC.Start(Seconds(1.0));
|
||||
clientAppC.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppC.Start(Seconds(1));
|
||||
clientAppC.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverD(port);
|
||||
ApplicationContainer serverAppD = serverD.Install(wifiApNodes.Get(3));
|
||||
serverAppD.Start(Seconds(0.0));
|
||||
serverAppD.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppD.Start(Seconds(0));
|
||||
serverAppD.Stop(simulationTime + Seconds(1));
|
||||
|
||||
InetSocketAddress destD(ApInterfaceD.GetAddress(0), port);
|
||||
|
||||
@@ -351,8 +351,8 @@ main(int argc, char* argv[])
|
||||
clientD.SetAttribute("Tos", UintegerValue(0xb8)); // AC_VI
|
||||
|
||||
ApplicationContainer clientAppD = clientD.Install(wifiStaNodes.Get(3));
|
||||
clientAppD.Start(Seconds(1.0));
|
||||
clientAppD.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppD.Start(Seconds(1));
|
||||
clientAppD.Stop(simulationTime + Seconds(1));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -366,7 +366,7 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap("STA_D", staDeviceD.Get(0));
|
||||
}
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
/* Show results */
|
||||
|
||||
@@ -204,7 +204,7 @@ main(int argc, char* argv[])
|
||||
|
||||
/* Setting applications */
|
||||
const auto maxLoad = HtPhy::GetDataRate(i,
|
||||
channelBonding ? 40 : 20,
|
||||
channelBonding ? MHz_u{40} : MHz_u{20},
|
||||
NanoSeconds(shortGuardInterval ? 400 : 800),
|
||||
nStreams);
|
||||
ApplicationContainer serverApp;
|
||||
@@ -214,8 +214,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper server(port);
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -223,8 +223,8 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("Interval", TimeValue(Seconds(packetInterval)));
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -233,8 +233,8 @@ main(int argc, char* argv[])
|
||||
Address localAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
serverApp = packetSinkHelper.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime",
|
||||
@@ -246,13 +246,13 @@ main(int argc, char* argv[])
|
||||
AddressValue remoteAddress(InetSocketAddress(staNodeInterface.GetAddress(0), port));
|
||||
onoff.SetAttribute("Remote", remoteAddress);
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
double throughput = 0;
|
||||
|
||||
@@ -36,17 +36,17 @@ class Experiment
|
||||
Experiment();
|
||||
/**
|
||||
* Constructor.
|
||||
* \param name The name of the experiment.
|
||||
* @param name The name of the experiment.
|
||||
*/
|
||||
Experiment(std::string name);
|
||||
|
||||
/**
|
||||
* Run an experiment.
|
||||
* \param wifi //!< The WifiHelper class.
|
||||
* \param wifiPhy //!< The YansWifiPhyHelper class.
|
||||
* \param wifiMac //!< The WifiMacHelper class.
|
||||
* \param wifiChannel //!< The YansWifiChannelHelper class.
|
||||
* \return a 2D dataset of the experiment data.
|
||||
* @param wifi //!< The WifiHelper class.
|
||||
* @param wifiPhy //!< The YansWifiPhyHelper class.
|
||||
* @param wifiMac //!< The WifiMacHelper class.
|
||||
* @param wifiChannel //!< The YansWifiChannelHelper class.
|
||||
* @return a 2D dataset of the experiment data.
|
||||
*/
|
||||
Gnuplot2dDataset Run(const WifiHelper& wifi,
|
||||
const YansWifiPhyHelper& wifiPhy,
|
||||
@@ -56,30 +56,30 @@ class Experiment
|
||||
private:
|
||||
/**
|
||||
* Receive a packet.
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void ReceivePacket(Ptr<Socket> socket);
|
||||
/**
|
||||
* Set the position of a node.
|
||||
* \param node The node.
|
||||
* \param position The position of the node.
|
||||
* @param node The node.
|
||||
* @param position The position of the node.
|
||||
*/
|
||||
void SetPosition(Ptr<Node> node, Vector position);
|
||||
/**
|
||||
* Get the position of a node.
|
||||
* \param node The node.
|
||||
* \return the position of the node.
|
||||
* @param node The node.
|
||||
* @return the position of the node.
|
||||
*/
|
||||
Vector GetPosition(Ptr<Node> node);
|
||||
/**
|
||||
* Move a node by 1m on the x axis, stops at 210m.
|
||||
* \param node The node.
|
||||
* @param node The node.
|
||||
*/
|
||||
void AdvancePosition(Ptr<Node> node);
|
||||
/**
|
||||
* Setup the receiving socket.
|
||||
* \param node The receiving node.
|
||||
* \return the socket.
|
||||
* @param node The receiving node.
|
||||
* @return the socket.
|
||||
*/
|
||||
Ptr<Socket> SetupPacketReceive(Ptr<Node> node);
|
||||
|
||||
@@ -124,7 +124,7 @@ Experiment::AdvancePosition(Ptr<Node> node)
|
||||
return;
|
||||
}
|
||||
SetPosition(node, pos);
|
||||
Simulator::Schedule(Seconds(1.0), &Experiment::AdvancePosition, this, node);
|
||||
Simulator::Schedule(Seconds(1), &Experiment::AdvancePosition, this, node);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -186,7 +186,7 @@ Experiment::Run(const WifiHelper& wifi,
|
||||
|
||||
ApplicationContainer apps = onoff.Install(c.Get(0));
|
||||
apps.Start(Seconds(0.5));
|
||||
apps.Stop(Seconds(250.0));
|
||||
apps.Stop(Seconds(250));
|
||||
|
||||
Simulator::Schedule(Seconds(1.5), &Experiment::AdvancePosition, this, c.Get(1));
|
||||
Ptr<Socket> recvSink = SetupPacketReceive(c.Get(1));
|
||||
|
||||
@@ -270,8 +270,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper serverA(port);
|
||||
ApplicationContainer serverAppA = serverA.Install(wifiStaNodes.Get(0));
|
||||
serverAppA.Start(Seconds(0.0));
|
||||
serverAppA.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppA.Start(Seconds(0));
|
||||
serverAppA.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientA(StaInterfaceA.GetAddress(0), port);
|
||||
clientA.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -279,13 +279,13 @@ main(int argc, char* argv[])
|
||||
clientA.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppA = clientA.Install(wifiApNodes.Get(0));
|
||||
clientAppA.Start(Seconds(1.0));
|
||||
clientAppA.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppA.Start(Seconds(1));
|
||||
clientAppA.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverB(port);
|
||||
ApplicationContainer serverAppB = serverB.Install(wifiStaNodes.Get(1));
|
||||
serverAppB.Start(Seconds(0.0));
|
||||
serverAppB.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppB.Start(Seconds(0));
|
||||
serverAppB.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientB(StaInterfaceB.GetAddress(0), port);
|
||||
clientB.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -293,13 +293,13 @@ main(int argc, char* argv[])
|
||||
clientB.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppB = clientB.Install(wifiApNodes.Get(1));
|
||||
clientAppB.Start(Seconds(1.0));
|
||||
clientAppB.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppB.Start(Seconds(1));
|
||||
clientAppB.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverC(port);
|
||||
ApplicationContainer serverAppC = serverC.Install(wifiStaNodes.Get(2));
|
||||
serverAppC.Start(Seconds(0.0));
|
||||
serverAppC.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppC.Start(Seconds(0));
|
||||
serverAppC.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientC(StaInterfaceC.GetAddress(0), port);
|
||||
clientC.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -307,13 +307,13 @@ main(int argc, char* argv[])
|
||||
clientC.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppC = clientC.Install(wifiApNodes.Get(2));
|
||||
clientAppC.Start(Seconds(1.0));
|
||||
clientAppC.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppC.Start(Seconds(1));
|
||||
clientAppC.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverD(port);
|
||||
ApplicationContainer serverAppD = serverD.Install(wifiStaNodes.Get(3));
|
||||
serverAppD.Start(Seconds(0.0));
|
||||
serverAppD.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppD.Start(Seconds(0));
|
||||
serverAppD.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientD(StaInterfaceD.GetAddress(0), port);
|
||||
clientD.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -321,8 +321,8 @@ main(int argc, char* argv[])
|
||||
clientD.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppD = clientD.Install(wifiApNodes.Get(3));
|
||||
clientAppD.Start(Seconds(1.0));
|
||||
clientAppD.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppD.Start(Seconds(1));
|
||||
clientAppD.Stop(simulationTime + Seconds(1));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -336,7 +336,7 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap("STA_D", staDeviceD.Get(0));
|
||||
}
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
// Show results
|
||||
|
||||
@@ -28,8 +28,8 @@ static bool g_verbose = true;
|
||||
/**
|
||||
* MAC-level TX trace.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param p The packet.
|
||||
* @param context The context.
|
||||
* @param p The packet.
|
||||
*/
|
||||
void
|
||||
DevTxTrace(std::string context, Ptr<const Packet> p)
|
||||
@@ -43,8 +43,8 @@ DevTxTrace(std::string context, Ptr<const Packet> p)
|
||||
/**
|
||||
* MAC-level RX trace.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param p The packet.
|
||||
* @param context The context.
|
||||
* @param p The packet.
|
||||
*/
|
||||
void
|
||||
DevRxTrace(std::string context, Ptr<const Packet> p)
|
||||
@@ -58,11 +58,11 @@ DevRxTrace(std::string context, Ptr<const Packet> p)
|
||||
/**
|
||||
* PHY-level RX OK trace
|
||||
*
|
||||
* \param context The context.
|
||||
* \param packet The packet.
|
||||
* \param snr The SNR.
|
||||
* \param mode The wifi mode.
|
||||
* \param preamble The preamble.
|
||||
* @param context The context.
|
||||
* @param packet The packet.
|
||||
* @param snr The SNR.
|
||||
* @param mode The wifi mode.
|
||||
* @param preamble The preamble.
|
||||
*/
|
||||
void
|
||||
PhyRxOkTrace(std::string context,
|
||||
@@ -80,9 +80,9 @@ PhyRxOkTrace(std::string context,
|
||||
/**
|
||||
* PHY-level RX error trace
|
||||
*
|
||||
* \param context The context.
|
||||
* \param packet The packet.
|
||||
* \param snr The SNR.
|
||||
* @param context The context.
|
||||
* @param packet The packet.
|
||||
* @param snr The SNR.
|
||||
*/
|
||||
void
|
||||
PhyRxErrorTrace(std::string context, Ptr<const Packet> packet, double snr)
|
||||
@@ -96,11 +96,11 @@ PhyRxErrorTrace(std::string context, Ptr<const Packet> packet, double snr)
|
||||
/**
|
||||
* PHY-level TX trace.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param packet The packet.
|
||||
* \param mode The wifi mode.
|
||||
* \param preamble The preamble.
|
||||
* \param txPower The TX power.
|
||||
* @param context The context.
|
||||
* @param packet The packet.
|
||||
* @param mode The wifi mode.
|
||||
* @param preamble The preamble.
|
||||
* @param txPower The TX power.
|
||||
*/
|
||||
void
|
||||
PhyTxTrace(std::string context,
|
||||
@@ -118,10 +118,10 @@ PhyTxTrace(std::string context,
|
||||
/**
|
||||
* PHY state trace.
|
||||
*
|
||||
* \param context The context.
|
||||
* \param start Start time of the state.
|
||||
* \param duration Duration of the state.
|
||||
* \param state The state.
|
||||
* @param context The context.
|
||||
* @param start Start time of the state.
|
||||
* @param duration Duration of the state.
|
||||
* @param state The state.
|
||||
*/
|
||||
void
|
||||
PhyStateTrace(std::string context, Time start, Time duration, WifiPhyState state)
|
||||
@@ -136,7 +136,7 @@ PhyStateTrace(std::string context, Time start, Time duration, WifiPhyState state
|
||||
/**
|
||||
* Move a node position by 5m on the x axis every second, up to 210m.
|
||||
*
|
||||
* \param node The node.
|
||||
* @param node The node.
|
||||
*/
|
||||
static void
|
||||
AdvancePosition(Ptr<Node> node)
|
||||
@@ -150,7 +150,7 @@ AdvancePosition(Ptr<Node> node)
|
||||
}
|
||||
mobility->SetPosition(pos);
|
||||
|
||||
Simulator::Schedule(Seconds(1.0), &AdvancePosition, node);
|
||||
Simulator::Schedule(Seconds(1), &AdvancePosition, node);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -196,7 +196,7 @@ main(int argc, char* argv[])
|
||||
mobility.Install(stas);
|
||||
mobility.Install(ap);
|
||||
|
||||
Simulator::Schedule(Seconds(1.0), &AdvancePosition, ap.Get(0));
|
||||
Simulator::Schedule(Seconds(1), &AdvancePosition, ap.Get(0));
|
||||
|
||||
PacketSocketAddress socket;
|
||||
socket.SetSingleDevice(staDevs.Get(0)->GetIfIndex());
|
||||
@@ -208,9 +208,9 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer apps = onoff.Install(stas.Get(0));
|
||||
apps.Start(Seconds(0.5));
|
||||
apps.Stop(Seconds(43.0));
|
||||
apps.Stop(Seconds(43));
|
||||
|
||||
Simulator::Stop(Seconds(44.0));
|
||||
Simulator::Stop(Seconds(44));
|
||||
|
||||
Config::Connect("/NodeList/*/DeviceList/*/Mac/MacTx", MakeCallback(&DevTxTrace));
|
||||
Config::Connect("/NodeList/*/DeviceList/*/Mac/MacRx", MakeCallback(&DevRxTrace));
|
||||
|
||||
@@ -76,7 +76,7 @@ ns.cppyy.cppdef(
|
||||
if (pos.x >= 210.0)
|
||||
return;
|
||||
mob->SetPosition(pos);
|
||||
Simulator::Schedule(Seconds(1.0), AdvancePosition, node);
|
||||
Simulator::Schedule(Seconds(1), AdvancePosition, node);
|
||||
}"""
|
||||
)
|
||||
|
||||
@@ -124,7 +124,7 @@ def main(argv):
|
||||
mobility.Install(stas)
|
||||
mobility.Install(ap)
|
||||
|
||||
ns.Simulator.Schedule(ns.Seconds(1.0), ns.cppyy.gbl.AdvancePosition, ap.Get(0))
|
||||
ns.Simulator.Schedule(ns.Seconds(1), ns.cppyy.gbl.AdvancePosition, ap.Get(0))
|
||||
|
||||
socket = ns.PacketSocketAddress()
|
||||
socket.SetSingleDevice(staDevs.Get(0).GetIfIndex())
|
||||
@@ -136,9 +136,9 @@ def main(argv):
|
||||
|
||||
apps = onoff.Install(ns.NodeContainer(stas.Get(0)))
|
||||
apps.Start(ns.Seconds(0.5))
|
||||
apps.Stop(ns.Seconds(43.0))
|
||||
apps.Stop(ns.Seconds(43))
|
||||
|
||||
ns.Simulator.Stop(ns.Seconds(44.0))
|
||||
ns.Simulator.Stop(ns.Seconds(44))
|
||||
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Tx", MakeCallback(&DevTxTrace));
|
||||
# Config::Connect("/NodeList/*/DeviceList/*/Rx", MakeCallback(&DevRxTrace));
|
||||
|
||||
@@ -44,8 +44,8 @@ NS_LOG_COMPONENT_DEFINE("wifi-backward-compatibility");
|
||||
/**
|
||||
* Convert a string (e.g., "80211a") to a pair {WifiStandard, WifiPhyBand}
|
||||
*
|
||||
* \param version The WiFi standard version.
|
||||
* \return a pair of WifiStandard, WifiPhyBand
|
||||
* @param version The WiFi standard version.
|
||||
* @return a pair of WifiStandard, WifiPhyBand
|
||||
*/
|
||||
std::pair<WifiStandard, WifiPhyBand>
|
||||
ConvertStringToStandardAndBand(std::string version)
|
||||
@@ -196,13 +196,13 @@ main(int argc, char* argv[])
|
||||
|
||||
UdpServerHelper apServer(9);
|
||||
ApplicationContainer apServerApp = apServer.Install(wifiApNode.Get(0));
|
||||
apServerApp.Start(Seconds(0.0));
|
||||
apServerApp.Stop(simulationTime + Seconds(1.0));
|
||||
apServerApp.Start(Seconds(0));
|
||||
apServerApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper staServer(5001);
|
||||
ApplicationContainer staServerApp = staServer.Install(wifiStaNode.Get(0));
|
||||
staServerApp.Start(Seconds(0.0));
|
||||
staServerApp.Stop(simulationTime + Seconds(1.0));
|
||||
staServerApp.Start(Seconds(0));
|
||||
staServerApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
if (apHasTraffic)
|
||||
{
|
||||
@@ -211,8 +211,8 @@ main(int argc, char* argv[])
|
||||
apClient.SetAttribute("Interval", TimeValue(Time("0.00001"))); // packets/s
|
||||
apClient.SetAttribute("PacketSize", UintegerValue(payloadSize)); // bytes
|
||||
ApplicationContainer apClientApp = apClient.Install(wifiApNode.Get(0));
|
||||
apClientApp.Start(Seconds(1.0));
|
||||
apClientApp.Stop(simulationTime + Seconds(1.0));
|
||||
apClientApp.Start(Seconds(1));
|
||||
apClientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
if (staHasTraffic)
|
||||
@@ -222,13 +222,13 @@ main(int argc, char* argv[])
|
||||
staClient.SetAttribute("Interval", TimeValue(Time("0.00001"))); // packets/s
|
||||
staClient.SetAttribute("PacketSize", UintegerValue(payloadSize)); // bytes
|
||||
ApplicationContainer staClientApp = staClient.Install(wifiStaNode.Get(0));
|
||||
staClientApp.Start(Seconds(1.0));
|
||||
staClientApp.Stop(simulationTime + Seconds(1.0));
|
||||
staClientApp.Start(Seconds(1));
|
||||
staClientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
double rxBytes;
|
||||
|
||||
@@ -150,12 +150,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer staApps = onOff.Install(sta);
|
||||
|
||||
staApps.Start(Seconds(1.0));
|
||||
staApps.Stop(Seconds(10.0));
|
||||
staApps.Start(Seconds(1));
|
||||
staApps.Stop(Seconds(10));
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(Seconds(10.0));
|
||||
Simulator::Stop(Seconds(10));
|
||||
|
||||
phy.EnablePcap("test-blockack", ap->GetId(), 0);
|
||||
Simulator::Run();
|
||||
|
||||
@@ -34,16 +34,16 @@ class Experiment
|
||||
Experiment();
|
||||
/**
|
||||
* Constructor.
|
||||
* \param name The name of the experiment.
|
||||
* @param name The name of the experiment.
|
||||
*/
|
||||
Experiment(std::string name);
|
||||
/**
|
||||
* Run an experiment.
|
||||
* \param wifi //!< The WifiHelper class.
|
||||
* \param wifiPhy //!< The YansWifiPhyHelper class.
|
||||
* \param wifiMac //!< The WifiMacHelper class.
|
||||
* \param wifiChannel //!< The YansWifiChannelHelper class.
|
||||
* \return the number of received packets.
|
||||
* @param wifi //!< The WifiHelper class.
|
||||
* @param wifiPhy //!< The YansWifiPhyHelper class.
|
||||
* @param wifiMac //!< The WifiMacHelper class.
|
||||
* @param wifiChannel //!< The YansWifiChannelHelper class.
|
||||
* @return the number of received packets.
|
||||
*/
|
||||
uint32_t Run(const WifiHelper& wifi,
|
||||
const YansWifiPhyHelper& wifiPhy,
|
||||
@@ -53,33 +53,33 @@ class Experiment
|
||||
private:
|
||||
/**
|
||||
* Receive a packet.
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void ReceivePacket(Ptr<Socket> socket);
|
||||
/**
|
||||
* Set the position of a node.
|
||||
* \param node The node.
|
||||
* \param position The position of the node.
|
||||
* @param node The node.
|
||||
* @param position The position of the node.
|
||||
*/
|
||||
void SetPosition(Ptr<Node> node, Vector position);
|
||||
/**
|
||||
* Get the position of a node.
|
||||
* \param node The node.
|
||||
* \return the position of the node.
|
||||
* @param node The node.
|
||||
* @return the position of the node.
|
||||
*/
|
||||
Vector GetPosition(Ptr<Node> node);
|
||||
/**
|
||||
* Setup the receiving socket.
|
||||
* \param node The receiving node.
|
||||
* \return the socket.
|
||||
* @param node The receiving node.
|
||||
* @return the socket.
|
||||
*/
|
||||
Ptr<Socket> SetupPacketReceive(Ptr<Node> node);
|
||||
/**
|
||||
* Generate the traffic.
|
||||
* \param socket The sending socket.
|
||||
* \param pktSize The packet size.
|
||||
* \param pktCount The number of packets to send.
|
||||
* \param pktInterval The time between packets.
|
||||
* @param socket The sending socket.
|
||||
* @param pktSize The packet size.
|
||||
* @param pktCount The number of packets to send.
|
||||
* @param pktInterval The time between packets.
|
||||
*/
|
||||
void GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval);
|
||||
|
||||
@@ -197,7 +197,7 @@ Experiment::Run(const WifiHelper& wifi,
|
||||
uint32_t packetSize = 1014;
|
||||
uint32_t maxPacketCount = 200;
|
||||
Time interPacketInterval = Seconds(1.);
|
||||
Simulator::Schedule(Seconds(1.0),
|
||||
Simulator::Schedule(Seconds(1),
|
||||
&Experiment::GenerateTraffic,
|
||||
this,
|
||||
source,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Author: Sebastien Deronne <sebastien.deronne@gmail.com>
|
||||
*/
|
||||
|
||||
#include "ns3/attribute-container.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/command-line.h"
|
||||
#include "ns3/config.h"
|
||||
@@ -30,6 +31,7 @@
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <numeric>
|
||||
@@ -57,10 +59,10 @@ using namespace ns3;
|
||||
NS_LOG_COMPONENT_DEFINE("eht-wifi-network");
|
||||
|
||||
/**
|
||||
* \param udp true if UDP is used, false if TCP is used
|
||||
* \param serverApp a container of server applications
|
||||
* \param payloadSize the size in bytes of the packets
|
||||
* \return the bytes received by each server application
|
||||
* @param udp true if UDP is used, false if TCP is used
|
||||
* @param serverApp a container of server applications
|
||||
* @param payloadSize the size in bytes of the packets
|
||||
* @return the bytes received by each server application
|
||||
*/
|
||||
std::vector<uint64_t>
|
||||
GetRxBytes(bool udp, const ApplicationContainer& serverApp, uint32_t payloadSize)
|
||||
@@ -85,12 +87,12 @@ GetRxBytes(bool udp, const ApplicationContainer& serverApp, uint32_t payloadSize
|
||||
|
||||
/**
|
||||
* Print average throughput over an intermediate time interval.
|
||||
* \param rxBytes a vector of the amount of bytes received by each server application
|
||||
* \param udp true if UDP is used, false if TCP is used
|
||||
* \param serverApp a container of server applications
|
||||
* \param payloadSize the size in bytes of the packets
|
||||
* \param tputInterval the duration of an intermediate time interval
|
||||
* \param simulationTime the simulation time in seconds
|
||||
* @param rxBytes a vector of the amount of bytes received by each server application
|
||||
* @param udp true if UDP is used, false if TCP is used
|
||||
* @param serverApp a container of server applications
|
||||
* @param payloadSize the size in bytes of the packets
|
||||
* @param tputInterval the duration of an intermediate time interval
|
||||
* @param simulationTime the simulation time in seconds
|
||||
*/
|
||||
void
|
||||
PrintIntermediateTput(std::vector<uint64_t>& rxBytes,
|
||||
@@ -136,10 +138,11 @@ main(int argc, char* argv[])
|
||||
bool useRts{false};
|
||||
bool use80Plus80{false};
|
||||
uint16_t mpduBufferSize{512};
|
||||
std::string emlsrMgrTypeId{"ns3::DefaultEmlsrManager"};
|
||||
std::string emlsrLinks;
|
||||
uint16_t paddingDelayUsec{32};
|
||||
uint16_t transitionDelayUsec{128};
|
||||
uint16_t channelSwitchDelayUsec{100};
|
||||
Time channelSwitchDelay{"100us"};
|
||||
bool switchAuxPhy{true};
|
||||
uint16_t auxPhyChWidth{20};
|
||||
bool auxPhyTxCapable{true};
|
||||
@@ -154,12 +157,15 @@ main(int argc, char* argv[])
|
||||
std::string dlAckSeqType{"NO-OFDMA"};
|
||||
bool enableUlOfdma{false};
|
||||
bool enableBsrp{false};
|
||||
int mcs{-1}; // -1 indicates an unset value
|
||||
std::string mcsStr;
|
||||
std::vector<uint64_t> mcsValues;
|
||||
int channelWidth{-1}; // in MHz, -1 indicates an unset value
|
||||
int guardInterval{-1}; // in nanoseconds, -1 indicates an unset value
|
||||
uint32_t payloadSize =
|
||||
700; // must fit in the max TX duration when transmitting at MCS 0 over an RU of 26 tones
|
||||
Time tputInterval{0}; // interval for detailed throughput measurement
|
||||
double minExpectedThroughput{0};
|
||||
double maxExpectedThroughput{0};
|
||||
double minExpectedThroughput{0.0};
|
||||
double maxExpectedThroughput{0.0};
|
||||
Time accessReqInterval{0};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
@@ -177,6 +183,7 @@ 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("emlsrMgrTypeId", "The ns-3 TypeId of the EMLSR manager to use", emlsrMgrTypeId);
|
||||
cmd.AddValue("emlsrLinks",
|
||||
"The comma separated list of IDs of EMLSR links (for MLDs only)",
|
||||
emlsrLinks);
|
||||
@@ -196,9 +203,7 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("emlsrAuxTxCapable",
|
||||
"Whether Aux PHYs are capable of transmitting.",
|
||||
auxPhyTxCapable);
|
||||
cmd.AddValue("channelSwitchDelay",
|
||||
"The PHY channel switch delay in microseconds",
|
||||
channelSwitchDelayUsec);
|
||||
cmd.AddValue("channelSwitchDelay", "The PHY channel switch delay", channelSwitchDelay);
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
@@ -226,7 +231,18 @@ main(int argc, char* argv[])
|
||||
"muSchedAccessReqInterval",
|
||||
"Duration of the interval between two requests for channel access made by the MU scheduler",
|
||||
accessReqInterval);
|
||||
cmd.AddValue("mcs", "if set, limit testing to a specific MCS (0-11)", mcs);
|
||||
cmd.AddValue(
|
||||
"mcs",
|
||||
"list of comma separated MCS values to test; if unset, all MCS values (0-13) are tested",
|
||||
mcsStr);
|
||||
cmd.AddValue("channelWidth",
|
||||
"if set, limit testing to a specific channel width expressed in MHz (20, 40, 80 "
|
||||
"or 160 MHz)",
|
||||
channelWidth);
|
||||
cmd.AddValue("guardInterval",
|
||||
"if set, limit testing to a specific guard interval duration expressed in "
|
||||
"nanoseconds (800, 1600 or 3200 ns)",
|
||||
guardInterval);
|
||||
cmd.AddValue("payloadSize", "The application payload size in bytes", payloadSize);
|
||||
cmd.AddValue("tputInterval", "duration of intervals for throughput measurement", tputInterval);
|
||||
cmd.AddValue("minExpectedThroughput",
|
||||
@@ -273,26 +289,51 @@ main(int argc, char* argv[])
|
||||
<< "GI"
|
||||
<< "\t\t\t"
|
||||
<< "Throughput" << '\n';
|
||||
int minMcs = 0;
|
||||
int maxMcs = 13;
|
||||
if (mcs >= 0 && mcs <= 13)
|
||||
uint8_t minMcs = 0;
|
||||
uint8_t maxMcs = 13;
|
||||
|
||||
if (mcsStr.empty())
|
||||
{
|
||||
minMcs = mcs;
|
||||
maxMcs = mcs;
|
||||
for (uint8_t mcs = minMcs; mcs <= maxMcs; ++mcs)
|
||||
{
|
||||
mcsValues.push_back(mcs);
|
||||
}
|
||||
}
|
||||
for (int mcs = minMcs; mcs <= maxMcs; mcs++)
|
||||
else
|
||||
{
|
||||
AttributeContainerValue<UintegerValue, ',', std::vector> attr;
|
||||
auto checker = DynamicCast<AttributeContainerChecker>(MakeAttributeContainerChecker(attr));
|
||||
checker->SetItemChecker(MakeUintegerChecker<uint8_t>());
|
||||
attr.DeserializeFromString(mcsStr, checker);
|
||||
mcsValues = attr.Get();
|
||||
std::sort(mcsValues.begin(), mcsValues.end());
|
||||
}
|
||||
|
||||
int minChannelWidth = 20;
|
||||
int maxChannelWidth = (frequency != 2.4 && frequency2 != 2.4 && frequency3 != 2.4) ? 160 : 40;
|
||||
if (channelWidth >= minChannelWidth && channelWidth <= maxChannelWidth)
|
||||
{
|
||||
minChannelWidth = channelWidth;
|
||||
maxChannelWidth = channelWidth;
|
||||
}
|
||||
int minGi = enableUlOfdma ? 1600 : 800;
|
||||
int maxGi = 3200;
|
||||
if (guardInterval >= minGi && guardInterval <= maxGi)
|
||||
{
|
||||
minGi = guardInterval;
|
||||
maxGi = guardInterval;
|
||||
}
|
||||
|
||||
for (const auto mcs : mcsValues)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
double previous = 0;
|
||||
uint16_t maxChannelWidth =
|
||||
(frequency != 2.4 && frequency2 != 2.4 && frequency3 != 2.4) ? 160 : 40;
|
||||
int minGi = enableUlOfdma ? 1600 : 800;
|
||||
for (int channelWidth = 20; channelWidth <= maxChannelWidth;) // MHz
|
||||
for (int width = minChannelWidth; width <= maxChannelWidth; width *= 2) // MHz
|
||||
{
|
||||
const auto is80Plus80 = (use80Plus80 && (channelWidth == 160));
|
||||
const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(channelWidth);
|
||||
const auto is80Plus80 = (use80Plus80 && (width == 160));
|
||||
const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(width);
|
||||
const auto segmentWidthStr = is80Plus80 ? "80" : widthStr;
|
||||
for (int gi = 3200; gi >= minGi;) // Nanoseconds
|
||||
for (int gi = maxGi; gi >= minGi; gi /= 2) // Nanoseconds
|
||||
{
|
||||
if (!udp)
|
||||
{
|
||||
@@ -391,10 +432,10 @@ main(int argc, char* argv[])
|
||||
|
||||
SpectrumWifiPhyHelper phy(nLinks);
|
||||
phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
|
||||
phy.Set("ChannelSwitchDelay", TimeValue(MicroSeconds(channelSwitchDelayUsec)));
|
||||
phy.Set("ChannelSwitchDelay", TimeValue(channelSwitchDelay));
|
||||
|
||||
mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
mac.SetEmlsrManager("ns3::DefaultEmlsrManager",
|
||||
mac.SetEmlsrManager(emlsrMgrTypeId,
|
||||
"EmlsrLinkSet",
|
||||
StringValue(emlsrLinks),
|
||||
"EmlsrPaddingDelay",
|
||||
@@ -486,8 +527,12 @@ main(int argc, char* argv[])
|
||||
clientNodes.Add(downlink ? wifiApNode.Get(0) : wifiStaNodes.Get(i));
|
||||
}
|
||||
|
||||
const auto maxLoad =
|
||||
nLinks * EhtPhy::GetDataRate(mcs, channelWidth, NanoSeconds(gi), 1) / nStations;
|
||||
const auto maxLoad = nLinks *
|
||||
EhtPhy::GetDataRate(mcs,
|
||||
MHz_u{static_cast<double>(width)},
|
||||
NanoSeconds(gi),
|
||||
1) /
|
||||
nStations;
|
||||
if (udp)
|
||||
{
|
||||
// UDP flow
|
||||
@@ -496,8 +541,8 @@ main(int argc, char* argv[])
|
||||
serverApp = server.Install(serverNodes.get());
|
||||
streamNumber += server.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
@@ -509,8 +554,8 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = client.Install(clientNodes.Get(i));
|
||||
streamNumber += client.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -522,8 +567,8 @@ main(int argc, char* argv[])
|
||||
serverApp = packetSinkHelper.Install(serverNodes.get());
|
||||
streamNumber += packetSinkHelper.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
{
|
||||
@@ -540,8 +585,8 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = onoff.Install(clientNodes.Get(i));
|
||||
streamNumber += onoff.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,10 +602,10 @@ main(int argc, char* argv[])
|
||||
serverApp,
|
||||
payloadSize,
|
||||
tputInterval,
|
||||
simulationTime + Seconds(1.0));
|
||||
simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
// When multiple stations are used, there are chances that association requests
|
||||
@@ -579,7 +624,7 @@ main(int argc, char* argv[])
|
||||
<< " Mbit/s" << std::endl;
|
||||
|
||||
// test first element
|
||||
if (mcs == minMcs && channelWidth == 20 && gi == 3200)
|
||||
if (mcs == minMcs && width == 20 && gi == 3200)
|
||||
{
|
||||
if (throughput * (1 + tolerance) < minExpectedThroughput)
|
||||
{
|
||||
@@ -588,7 +633,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
// test last element
|
||||
if (mcs == maxMcs && channelWidth == maxChannelWidth && gi == 800)
|
||||
if (mcs == maxMcs && width == maxChannelWidth && gi == 800)
|
||||
{
|
||||
if (maxExpectedThroughput > 0 &&
|
||||
throughput > maxExpectedThroughput * (1 + tolerance))
|
||||
@@ -618,9 +663,7 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
index++;
|
||||
gi /= 2;
|
||||
}
|
||||
channelWidth *= 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Author: Sebastien Deronne <sebastien.deronne@gmail.com>
|
||||
*/
|
||||
|
||||
#include "ns3/attribute-container.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/command-line.h"
|
||||
#include "ns3/config.h"
|
||||
@@ -31,6 +32,7 @@
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
// This is a simple example in order to show how to configure an IEEE 802.11ax Wi-Fi network.
|
||||
@@ -70,12 +72,15 @@ main(int argc, char* argv[])
|
||||
std::string dlAckSeqType{"NO-OFDMA"};
|
||||
bool enableUlOfdma{false};
|
||||
bool enableBsrp{false};
|
||||
int mcs{-1}; // -1 indicates an unset value
|
||||
std::string mcsStr;
|
||||
std::vector<uint64_t> mcsValues;
|
||||
int channelWidth{-1}; // in MHz, -1 indicates an unset value
|
||||
int guardInterval{-1}; // in nanoseconds, -1 indicates an unset value
|
||||
uint32_t payloadSize =
|
||||
700; // must fit in the max TX duration when transmitting at MCS 0 over an RU of 26 tones
|
||||
std::string phyModel{"Yans"};
|
||||
double minExpectedThroughput{0};
|
||||
double maxExpectedThroughput{0};
|
||||
double minExpectedThroughput{0.0};
|
||||
double maxExpectedThroughput{0.0};
|
||||
Time accessReqInterval{0};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
@@ -107,7 +112,18 @@ main(int argc, char* argv[])
|
||||
"muSchedAccessReqInterval",
|
||||
"Duration of the interval between two requests for channel access made by the MU scheduler",
|
||||
accessReqInterval);
|
||||
cmd.AddValue("mcs", "if set, limit testing to a specific MCS (0-11)", mcs);
|
||||
cmd.AddValue(
|
||||
"mcs",
|
||||
"list of comma separated MCS values to test; if unset, all MCS values (0-11) are tested",
|
||||
mcsStr);
|
||||
cmd.AddValue("channelWidth",
|
||||
"if set, limit testing to a specific channel width expressed in MHz (20, 40, 80 "
|
||||
"or 160 MHz)",
|
||||
channelWidth);
|
||||
cmd.AddValue("guardInterval",
|
||||
"if set, limit testing to a specific guard interval duration expressed in "
|
||||
"nanoseconds (800, 1600 or 3200 ns)",
|
||||
guardInterval);
|
||||
cmd.AddValue("payloadSize", "The application payload size in bytes", payloadSize);
|
||||
cmd.AddValue("phyModel",
|
||||
"PHY model to use when OFDMA is disabled (Yans or Spectrum). If 80+80 MHz or "
|
||||
@@ -168,25 +184,51 @@ main(int argc, char* argv[])
|
||||
<< "GI"
|
||||
<< "\t\t\t"
|
||||
<< "Throughput" << '\n';
|
||||
int minMcs = 0;
|
||||
int maxMcs = 11;
|
||||
if (mcs >= 0 && mcs <= 11)
|
||||
uint8_t minMcs = 0;
|
||||
uint8_t maxMcs = 11;
|
||||
|
||||
if (mcsStr.empty())
|
||||
{
|
||||
minMcs = mcs;
|
||||
maxMcs = mcs;
|
||||
for (uint8_t mcs = minMcs; mcs <= maxMcs; ++mcs)
|
||||
{
|
||||
mcsValues.push_back(mcs);
|
||||
}
|
||||
}
|
||||
for (int mcs = minMcs; mcs <= maxMcs; mcs++)
|
||||
else
|
||||
{
|
||||
AttributeContainerValue<UintegerValue, ',', std::vector> attr;
|
||||
auto checker = DynamicCast<AttributeContainerChecker>(MakeAttributeContainerChecker(attr));
|
||||
checker->SetItemChecker(MakeUintegerChecker<uint8_t>());
|
||||
attr.DeserializeFromString(mcsStr, checker);
|
||||
mcsValues = attr.Get();
|
||||
std::sort(mcsValues.begin(), mcsValues.end());
|
||||
}
|
||||
|
||||
int minChannelWidth = 20;
|
||||
int maxChannelWidth = frequency == 2.4 ? 40 : 160;
|
||||
if (channelWidth >= minChannelWidth && channelWidth <= maxChannelWidth)
|
||||
{
|
||||
minChannelWidth = channelWidth;
|
||||
maxChannelWidth = channelWidth;
|
||||
}
|
||||
int minGi = enableUlOfdma ? 1600 : 800;
|
||||
int maxGi = 3200;
|
||||
if (guardInterval >= minGi && guardInterval <= maxGi)
|
||||
{
|
||||
minGi = guardInterval;
|
||||
maxGi = guardInterval;
|
||||
}
|
||||
|
||||
for (const auto mcs : mcsValues)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
double previous = 0;
|
||||
uint8_t maxChannelWidth = frequency == 2.4 ? 40 : 160;
|
||||
int minGi = enableUlOfdma ? 1600 : 800;
|
||||
for (int channelWidth = 20; channelWidth <= maxChannelWidth;) // MHz
|
||||
for (int width = minChannelWidth; width <= maxChannelWidth; width *= 2) // MHz
|
||||
{
|
||||
const auto is80Plus80 = (use80Plus80 && (channelWidth == 160));
|
||||
const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(channelWidth);
|
||||
const auto is80Plus80 = (use80Plus80 && (width == 160));
|
||||
const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(width);
|
||||
const auto segmentWidthStr = is80Plus80 ? "80" : widthStr;
|
||||
for (int gi = 3200; gi >= minGi;) // Nanoseconds
|
||||
for (int gi = maxGi; gi >= minGi; gi /= 2) // Nanoseconds
|
||||
{
|
||||
if (!udp)
|
||||
{
|
||||
@@ -357,7 +399,8 @@ main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
const auto maxLoad =
|
||||
HePhy::GetDataRate(mcs, channelWidth, NanoSeconds(gi), 1) / nStations;
|
||||
HePhy::GetDataRate(mcs, MHz_u{static_cast<double>(width)}, NanoSeconds(gi), 1) /
|
||||
nStations;
|
||||
if (udp)
|
||||
{
|
||||
// UDP flow
|
||||
@@ -366,8 +409,8 @@ main(int argc, char* argv[])
|
||||
serverApp = server.Install(serverNodes.get());
|
||||
streamNumber += server.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
@@ -379,8 +422,8 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = client.Install(clientNodes.Get(i));
|
||||
streamNumber += client.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -392,8 +435,8 @@ main(int argc, char* argv[])
|
||||
serverApp = packetSinkHelper.Install(serverNodes.get());
|
||||
streamNumber += packetSinkHelper.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
{
|
||||
@@ -410,14 +453,14 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = onoff.Install(clientNodes.Get(i));
|
||||
streamNumber += onoff.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
Simulator::Schedule(Seconds(0), &Ipv4GlobalRoutingHelper::PopulateRoutingTables);
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
// When multiple stations are used, there are chances that association requests
|
||||
@@ -450,7 +493,7 @@ main(int argc, char* argv[])
|
||||
<< " Mbit/s" << std::endl;
|
||||
|
||||
// test first element
|
||||
if (mcs == minMcs && channelWidth == 20 && gi == 3200)
|
||||
if (mcs == minMcs && width == 20 && gi == 3200)
|
||||
{
|
||||
if (throughput * (1 + tolerance) < minExpectedThroughput)
|
||||
{
|
||||
@@ -459,7 +502,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
// test last element
|
||||
if (mcs == maxMcs && channelWidth == maxChannelWidth && gi == 800)
|
||||
if (mcs == maxMcs && width == maxChannelWidth && gi == 800)
|
||||
{
|
||||
if (maxExpectedThroughput > 0 &&
|
||||
throughput > maxExpectedThroughput * (1 + tolerance))
|
||||
@@ -495,9 +538,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
index++;
|
||||
gi /= 2;
|
||||
}
|
||||
channelWidth *= 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -38,8 +38,8 @@ using namespace ns3;
|
||||
/**
|
||||
* Run single 10 seconds experiment
|
||||
*
|
||||
* \param enableCtsRts if true, enable RTS/CTS for packets larger than 100 bytes.
|
||||
* \param wifiManager WiFi manager to use.
|
||||
* @param enableCtsRts if true, enable RTS/CTS for packets larger than 100 bytes.
|
||||
* @param wifiManager WiFi manager to use.
|
||||
*/
|
||||
void
|
||||
experiment(bool enableCtsRts, std::string wifiManager)
|
||||
@@ -115,7 +115,7 @@ experiment(bool enableCtsRts, std::string wifiManager)
|
||||
|
||||
// flow 2: node 2 -> node 1
|
||||
/**
|
||||
* \internal
|
||||
* @internal
|
||||
* The slightly different start times and data rates are a workaround
|
||||
* for \bugid{388} and \bugid{912}
|
||||
*/
|
||||
@@ -124,13 +124,13 @@ experiment(bool enableCtsRts, std::string wifiManager)
|
||||
cbrApps.Add(onOffHelper.Install(nodes.Get(2)));
|
||||
|
||||
/**
|
||||
* \internal
|
||||
* @internal
|
||||
* We also use separate UDP applications that will send a single
|
||||
* packet before the CBR flows start.
|
||||
* This is a workaround for the lack of perfect ARP, see \bugid{187}
|
||||
*/
|
||||
uint16_t echoPort = 9;
|
||||
UdpEchoClientHelper echoClientHelper(Ipv4Address("10.0.0.2"), echoPort);
|
||||
UdpEchoClientHelper echoClientHelper(InetSocketAddress(Ipv4Address("10.0.0.2"), echoPort));
|
||||
echoClientHelper.SetAttribute("MaxPackets", UintegerValue(1));
|
||||
echoClientHelper.SetAttribute("Interval", TimeValue(Seconds(0.1)));
|
||||
echoClientHelper.SetAttribute("PacketSize", UintegerValue(10));
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
// This is a simple example in order to show how to configure an IEEE 802.11n Wi-Fi network.
|
||||
//
|
||||
// It outputs the UDP or TCP goodput for every HT MCS value, which depends on the MCS value (0 to
|
||||
@@ -59,7 +62,10 @@ main(int argc, char* argv[])
|
||||
Time simulationTime{"10s"};
|
||||
meter_u distance{1.0};
|
||||
double frequency{5}; // whether 2.4 or 5 GHz
|
||||
int mcs{-1}; // -1 indicates an unset value
|
||||
std::string mcsStr;
|
||||
std::vector<uint64_t> mcsValues;
|
||||
int channelWidth{-1}; // in MHz, -1 indicates an unset value
|
||||
int guardInterval{-1}; // in nanoseconds, -1 indicates an unset value
|
||||
double minExpectedThroughput{0.0};
|
||||
double maxExpectedThroughput{0.0};
|
||||
|
||||
@@ -73,7 +79,18 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
|
||||
cmd.AddValue("mcs", "if set, limit testing to a specific MCS (0-7)", mcs);
|
||||
cmd.AddValue(
|
||||
"mcs",
|
||||
"list of comma separated MCS values to test; if unset, all MCS values (0-7) are tested",
|
||||
mcsStr);
|
||||
cmd.AddValue(
|
||||
"channelWidth",
|
||||
"if set, limit testing to a specific channel width expressed in MHz (20 or 40 MHz)",
|
||||
channelWidth);
|
||||
cmd.AddValue("guardInterval",
|
||||
"if set, limit testing to a specific guard interval duration expressed in "
|
||||
"nanoseconds (800 or 400 ns)",
|
||||
guardInterval);
|
||||
cmd.AddValue("minExpectedThroughput",
|
||||
"if set, simulation fails if the lowest throughput is below this value",
|
||||
minExpectedThroughput);
|
||||
@@ -96,21 +113,50 @@ main(int argc, char* argv[])
|
||||
<< "short GI"
|
||||
<< "\t\t"
|
||||
<< "Throughput" << '\n';
|
||||
int minMcs = 0;
|
||||
int maxMcs = 7;
|
||||
if (mcs >= 0 && mcs <= 7)
|
||||
uint8_t minMcs = 0;
|
||||
uint8_t maxMcs = 7;
|
||||
|
||||
if (mcsStr.empty())
|
||||
{
|
||||
minMcs = mcs;
|
||||
maxMcs = mcs;
|
||||
for (uint8_t mcs = minMcs; mcs <= maxMcs; ++mcs)
|
||||
{
|
||||
mcsValues.push_back(mcs);
|
||||
}
|
||||
}
|
||||
for (int mcs = minMcs; mcs <= maxMcs; mcs++)
|
||||
else
|
||||
{
|
||||
AttributeContainerValue<UintegerValue, ',', std::vector> attr;
|
||||
auto checker = DynamicCast<AttributeContainerChecker>(MakeAttributeContainerChecker(attr));
|
||||
checker->SetItemChecker(MakeUintegerChecker<uint8_t>());
|
||||
attr.DeserializeFromString(mcsStr, checker);
|
||||
mcsValues = attr.Get();
|
||||
std::sort(mcsValues.begin(), mcsValues.end());
|
||||
}
|
||||
|
||||
int minChannelWidth = 20;
|
||||
int maxChannelWidth = 40;
|
||||
if (channelWidth >= minChannelWidth && channelWidth <= maxChannelWidth)
|
||||
{
|
||||
minChannelWidth = channelWidth;
|
||||
maxChannelWidth = channelWidth;
|
||||
}
|
||||
int minGi = 400;
|
||||
int maxGi = 800;
|
||||
if (guardInterval >= minGi && guardInterval <= maxGi)
|
||||
{
|
||||
minGi = guardInterval;
|
||||
maxGi = guardInterval;
|
||||
}
|
||||
|
||||
for (const auto mcs : mcsValues)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
double previous = 0;
|
||||
for (int channelWidth = 20; channelWidth <= 40;)
|
||||
for (int width = minChannelWidth; width <= maxChannelWidth; width *= 2) // MHz
|
||||
{
|
||||
for (auto sgi : {false, true})
|
||||
for (int gi = maxGi; gi >= minGi; gi /= 2) // Nanoseconds
|
||||
{
|
||||
const auto sgi = (gi == 400);
|
||||
uint32_t payloadSize; // 1500 byte IP packet
|
||||
if (udp)
|
||||
{
|
||||
@@ -171,7 +217,7 @@ main(int argc, char* argv[])
|
||||
';'>
|
||||
channelValue;
|
||||
WifiPhyBand band = (frequency == 5.0 ? WIFI_PHY_BAND_5GHZ : WIFI_PHY_BAND_2_4GHZ);
|
||||
channelValue.Set(WifiPhy::ChannelSegments{{0, channelWidth, band, 0}});
|
||||
channelValue.Set(WifiPhy::ChannelSegments{{0, width, band, 0}});
|
||||
|
||||
mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
phy.Set("ChannelSettings", channelValue);
|
||||
@@ -221,8 +267,10 @@ main(int argc, char* argv[])
|
||||
apNodeInterface = address.Assign(apDevice);
|
||||
|
||||
/* Setting applications */
|
||||
const auto maxLoad =
|
||||
HtPhy::GetDataRate(mcs, channelWidth, NanoSeconds(sgi ? 400 : 800), 1);
|
||||
const auto maxLoad = HtPhy::GetDataRate(mcs,
|
||||
MHz_u{static_cast<double>(width)},
|
||||
NanoSeconds(sgi ? 400 : 800),
|
||||
1);
|
||||
ApplicationContainer serverApp;
|
||||
if (udp)
|
||||
{
|
||||
@@ -232,8 +280,8 @@ main(int argc, char* argv[])
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
streamNumber += server.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -243,8 +291,8 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
streamNumber += client.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -256,8 +304,8 @@ main(int argc, char* argv[])
|
||||
streamNumber +=
|
||||
packetSinkHelper.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime",
|
||||
@@ -272,13 +320,13 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
streamNumber += onoff.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
auto rxBytes = 0.0;
|
||||
@@ -294,11 +342,11 @@ main(int argc, char* argv[])
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << std::boolalpha
|
||||
<< sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl;
|
||||
std::cout << mcs << "\t\t\t" << width << " MHz\t\t\t" << std::boolalpha << sgi
|
||||
<< "\t\t\t" << throughput << " Mbit/s" << std::endl;
|
||||
|
||||
// test first element
|
||||
if (mcs == minMcs && channelWidth == 20 && !sgi)
|
||||
if (mcs == minMcs && width == 20 && !sgi)
|
||||
{
|
||||
if (throughput < minExpectedThroughput)
|
||||
{
|
||||
@@ -306,7 +354,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
// test last element
|
||||
if (mcs == maxMcs && channelWidth == 40 && sgi)
|
||||
if (mcs == maxMcs && width == 40 && sgi)
|
||||
{
|
||||
if (maxExpectedThroughput > 0 && throughput > maxExpectedThroughput)
|
||||
{
|
||||
@@ -333,7 +381,6 @@ main(int argc, char* argv[])
|
||||
}
|
||||
index++;
|
||||
}
|
||||
channelWidth *= 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -79,8 +79,8 @@ class Experiment
|
||||
Experiment();
|
||||
/**
|
||||
* Run an experiment with the given parameters
|
||||
* \param params the given parameters
|
||||
* \return the throughput
|
||||
* @param params the given parameters
|
||||
* @return the throughput
|
||||
*/
|
||||
double Run(Parameters params);
|
||||
};
|
||||
@@ -265,8 +265,8 @@ Experiment::Run(Parameters params)
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiApNode);
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper client(ApInterface.GetAddress(0), port);
|
||||
client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -286,10 +286,10 @@ Experiment::Run(Parameters params)
|
||||
{
|
||||
clientApps.Add(client.Install(wifiNStaNodes));
|
||||
}
|
||||
clientApps.Start(Seconds(1.0));
|
||||
clientApps.Stop(simulationTime + Seconds(1.0));
|
||||
clientApps.Start(Seconds(1));
|
||||
clientApps.Stop(simulationTime + Seconds(1));
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
double totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
@@ -302,8 +302,8 @@ Experiment::Run(Parameters params)
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
|
||||
ApplicationContainer serverApp = packetSinkHelper.Install(wifiApNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
|
||||
@@ -327,10 +327,10 @@ Experiment::Run(Parameters params)
|
||||
{
|
||||
clientApps.Add(onoff.Install(wifiNStaNodes));
|
||||
}
|
||||
clientApps.Start(Seconds(1.0));
|
||||
clientApps.Stop(simulationTime + Seconds(1.0));
|
||||
clientApps.Start(Seconds(1));
|
||||
clientApps.Stop(simulationTime + Seconds(1));
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
double totalPacketsThrough = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
|
||||
@@ -154,14 +154,14 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
sinkApplications.Start(Seconds(0.0));
|
||||
sinkApplications.Stop(simulationTime + Seconds(1.0));
|
||||
sourceApplications.Start(Seconds(1.0));
|
||||
sourceApplications.Stop(simulationTime + Seconds(1.0));
|
||||
sinkApplications.Start(Seconds(0));
|
||||
sinkApplications.Stop(simulationTime + Seconds(1));
|
||||
sourceApplications.Start(Seconds(1));
|
||||
sourceApplications.Stop(simulationTime + Seconds(1));
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
double throughput = 0;
|
||||
|
||||
538
examples/wireless/wifi-multicast.cc
Normal file
538
examples/wireless/wifi-multicast.cc
Normal file
@@ -0,0 +1,538 @@
|
||||
/*
|
||||
* Copyright (c) 2023 DERONNE SOFTWARE ENGINEERING
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*
|
||||
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
|
||||
*/
|
||||
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/command-line.h"
|
||||
#include "ns3/config.h"
|
||||
#include "ns3/data-rate.h"
|
||||
#include "ns3/double.h"
|
||||
#include "ns3/enum.h"
|
||||
#include "ns3/error-model.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/internet-stack-helper.h"
|
||||
#include "ns3/ipv4-address-helper.h"
|
||||
#include "ns3/ipv4-l3-protocol.h"
|
||||
#include "ns3/ipv4-list-routing-helper.h"
|
||||
#include "ns3/ipv4-static-routing-helper.h"
|
||||
#include "ns3/ipv4-static-routing.h"
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/mobility-helper.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
#include "ns3/names.h"
|
||||
#include "ns3/node.h"
|
||||
#include "ns3/on-off-helper.h"
|
||||
#include "ns3/packet-sink-helper.h"
|
||||
#include "ns3/packet-sink.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/socket.h"
|
||||
#include "ns3/ssid.h"
|
||||
#include "ns3/string.h"
|
||||
#include "ns3/test.h"
|
||||
#include "ns3/trace-helper.h"
|
||||
#include "ns3/udp-socket-factory.h"
|
||||
#include "ns3/udp-socket.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
#include "ns3/wifi-psdu.h"
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
// This is an example to verify performance of 802.11aa groupcast with retries (GCR) in comparison
|
||||
// with the usual NoAck/NoRetry retransmission policy. In the latter, a groupcast frame is
|
||||
// transmitted only once, whereas GCR allows to retransmit groupcast frames to improve reliability.
|
||||
//
|
||||
// The simulation considers a single 802.11ax AP and a configurable number of GCR-capable STAs in an
|
||||
// infrastructure network. Multicast traffic is generated from the AP to all the non-AP STAs and
|
||||
// artificial errors can be introduced to mimic interference on the wireless channel.
|
||||
//
|
||||
// There are a number of command-line options available to control the scenario under test. The list
|
||||
// of available command-line options can be listed with the following command:
|
||||
// ./ns3 run "wifi-multicast --help"
|
||||
//
|
||||
// The main command-line options are:
|
||||
// --gcrRetransmissionPolicy: control the retransmission policy by selecting "NoAckNoRetry" for
|
||||
// no retransmission, "GcrUr" for GCR with unsolicited retries or "GcrBlockAck" for GCR Block Ack
|
||||
// --nStations: control the number of GCR-capable STAs associated to the AP
|
||||
// --accessCategory: control the access category to use for the multicast traffic
|
||||
// --multicastFrameErrorRate: set the artificial frame error rate for the groupcast traffic
|
||||
// --nRetriesGcrUr: if GCR-UR is selected, this parameter controls the maximum number of retries
|
||||
// --gcrProtection: select the protection mechanism for groupcast frames if GCR-UR or GCR-BA is
|
||||
// used, either "Rts-Cts" or "Cts-To-Self" can be selected
|
||||
//
|
||||
// Example usage for NoAckNoRetry and a frame error rate of 20%:
|
||||
// ./ns3 run "wifi-multicast --gcrRetransmissionPolicy=NoAckNoRetry --multicastFrameErrorRate=0.2"
|
||||
// which outputs:
|
||||
// Node TX packets TX bytes RX packets RX bytes Throughput (Mbit/s)
|
||||
// AP 10 10000 0 0 11.1111
|
||||
// STA1 0 0 10 10000 10.992
|
||||
//
|
||||
// Example usage for GCR-UR with up to 2 retries and the same frame error rate:
|
||||
// ./ns3 run "wifi-multicast --gcrRetransmissionPolicy=GcrUr --nRetriesGcrUr=2
|
||||
// --multicastFrameErrorRate=0.2"
|
||||
// which outputs:
|
||||
// Node TX packets TX bytes RX packets RX bytes Throughput (Mbit/s)
|
||||
// AP 10 10000 0 0 11.1111
|
||||
// STA1 0 0 10 10000 10.992
|
||||
//
|
||||
// Example usage for GCR-BA with 4 STAs and the same frame error rate:
|
||||
// ./ns3 run "wifi-multicast --gcrRetransmissionPolicy=GcrBlockAck --nStations=4"
|
||||
// which outputs:
|
||||
// Node TX packets TX bytes RX packets RX bytes Throughput (Mbit/s)
|
||||
// AP 10 10000 0 0 11.1111
|
||||
// STA1 0 0 10 10000 8.26959
|
||||
// STA2 0 0 10 10000 8.26959
|
||||
// STA3 0 0 10 10000 8.26959
|
||||
// STA4 0 0 10 10000 8.26959
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE("WifiMulticast");
|
||||
|
||||
uint64_t g_txBytes; //!< Number of generated bytes
|
||||
Time g_firstTx; //!< Time at which first TX packet is generated
|
||||
Time g_lastTx; //!< Time at which last TX packet is generated
|
||||
Time g_lastRx; //!< Time at which last RX packet is received
|
||||
|
||||
/**
|
||||
* Parse context strings of the form "/NodeList/x/DeviceList/x/..." to extract the NodeId integer
|
||||
*
|
||||
* @param context The context to parse.
|
||||
* @return the NodeId
|
||||
*/
|
||||
uint32_t
|
||||
ContextToNodeId(const std::string& context)
|
||||
{
|
||||
std::string sub = context.substr(10);
|
||||
uint32_t pos = sub.find("/Device");
|
||||
return std::stoi(sub.substr(0, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Socket sent packet.
|
||||
*
|
||||
* @param context The context.
|
||||
* @param p The packet.
|
||||
*/
|
||||
void
|
||||
SocketTxPacket(std::string context, Ptr<const Packet> p)
|
||||
{
|
||||
if (g_txBytes == 0)
|
||||
{
|
||||
g_firstTx = Simulator::Now();
|
||||
}
|
||||
g_txBytes += p->GetSize();
|
||||
g_lastTx = Simulator::Now();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param context The context.
|
||||
* @param p The packet.
|
||||
* @param from sender address.
|
||||
*/
|
||||
void
|
||||
SocketRxPacket(std::string context, Ptr<const Packet> p, const Address& from)
|
||||
{
|
||||
g_lastRx = Simulator::Now();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback when a frame is transmitted.
|
||||
* @param rxErrorModel the post reception error model on the receiver
|
||||
* @param ranVar the random variable to determine whether the packet shall be corrupted
|
||||
* @param errorRate the configured corruption error rate for multicast frames
|
||||
* @param context the context
|
||||
* @param psduMap the PSDU map
|
||||
* @param txVector the TX vector
|
||||
* @param txPowerW the tx power in Watts
|
||||
*/
|
||||
void
|
||||
TxCallback(Ptr<ListErrorModel> rxErrorModel,
|
||||
Ptr<RandomVariableStream> ranVar,
|
||||
double errorRate,
|
||||
std::string context,
|
||||
WifiConstPsduMap psduMap,
|
||||
WifiTxVector txVector,
|
||||
double txPowerW)
|
||||
{
|
||||
auto psdu = psduMap.begin()->second;
|
||||
if (psdu->GetHeader(0).GetAddr1().IsGroup() && !psdu->GetHeader(0).GetAddr1().IsBroadcast() &&
|
||||
psdu->GetHeader(0).IsQosData())
|
||||
{
|
||||
NS_LOG_INFO("AP tx multicast: PSDU=" << *psdu << " TXVECTOR=" << txVector);
|
||||
if (ranVar->GetValue() < errorRate)
|
||||
{
|
||||
auto uid = psdu->GetPayload(0)->GetUid();
|
||||
NS_LOG_INFO("Corrupt multicast frame with UID=" << uid);
|
||||
rxErrorModel->SetList({uid});
|
||||
}
|
||||
else
|
||||
{
|
||||
rxErrorModel->SetList({});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback when a frame is successfully received.
|
||||
*
|
||||
* @param context the context
|
||||
* @param p the packet
|
||||
* @param snr the SNR (in linear scale)
|
||||
* @param mode the mode used to transmit the packet
|
||||
* @param preamble the preamble
|
||||
*/
|
||||
void
|
||||
RxCallback(std::string context,
|
||||
Ptr<const Packet> p,
|
||||
double snr,
|
||||
WifiMode mode,
|
||||
WifiPreamble preamble)
|
||||
{
|
||||
Ptr<Packet> packet = p->Copy();
|
||||
WifiMacHeader hdr;
|
||||
packet->RemoveHeader(hdr);
|
||||
if (hdr.GetAddr1().IsGroup() && !hdr.GetAddr1().IsBroadcast() && hdr.IsQosData())
|
||||
{
|
||||
std::stringstream ss;
|
||||
hdr.Print(ss);
|
||||
NS_LOG_INFO("STA" << ContextToNodeId(context) << " rx multicast: " << ss.str());
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
bool logging{false};
|
||||
bool verbose{false};
|
||||
bool pcap{false};
|
||||
std::size_t nStations{1};
|
||||
Time simulationTime{"10s"};
|
||||
uint32_t payloadSize{1000}; // bytes
|
||||
DataRate dataRate{"10Mb/s"};
|
||||
uint32_t maxPackets{10};
|
||||
uint32_t rtsThreshold{std::numeric_limits<uint16_t>::max()};
|
||||
std::string targetAddr{"239.192.100.1"};
|
||||
std::string accessCategory{"AC_BE"};
|
||||
std::string gcrRetransmissionPolicy{"NoAckNoRetry"};
|
||||
std::string rateManager{"Constant"};
|
||||
uint16_t constantRateMcs{11};
|
||||
uint16_t nRetriesGcrUr{7};
|
||||
std::string gcrProtection{"Rts-Cts"};
|
||||
double multicastFrameErrorRate{0.0};
|
||||
uint16_t maxAmpduLength{0};
|
||||
double minExpectedPackets{0};
|
||||
double maxExpectedPackets{0};
|
||||
double minExpectedThroughput{0};
|
||||
double maxExpectedThroughput{0};
|
||||
double tolerance{0.01};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("logging", "turn on example log components", logging);
|
||||
cmd.AddValue("verbose", "turn on all wifi log components", verbose);
|
||||
cmd.AddValue("pcap", "turn on pcap file output", pcap);
|
||||
cmd.AddValue("nStations", "number of non-AP stations", nStations);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("payloadSize", "The application payload size in bytes", payloadSize);
|
||||
cmd.AddValue(
|
||||
"maxPackets",
|
||||
"The maximum number of packets to be generated by the application (0 for no limit)",
|
||||
maxPackets);
|
||||
cmd.AddValue("dataRate", "The application data rate", dataRate);
|
||||
cmd.AddValue("rtsThreshold", "RTS threshold", rtsThreshold);
|
||||
cmd.AddValue("rateManager",
|
||||
"The rate adaptation manager to use (Constant, Ideal, MinstrelHt)",
|
||||
rateManager);
|
||||
cmd.AddValue("mcs",
|
||||
"The MCS to use if Constant rate adaptation manager is used",
|
||||
constantRateMcs);
|
||||
cmd.AddValue("targetAddress", "multicast target address", targetAddr);
|
||||
cmd.AddValue("accessCategory",
|
||||
"select the multicast traffic access category (AC_BE, AC_BK, AC_VI, AC_VO)",
|
||||
accessCategory);
|
||||
cmd.AddValue(
|
||||
"gcrRetransmissionPolicy",
|
||||
"GCR retransmission policy for groupcast frames (NoAckNoRetry, GcrUr, GcrBlockAck)",
|
||||
gcrRetransmissionPolicy);
|
||||
cmd.AddValue("nRetriesGcrUr",
|
||||
"number of retries per groupcast frame when GCR-UR retransmission policy is used",
|
||||
nRetriesGcrUr);
|
||||
cmd.AddValue("gcrProtection",
|
||||
"protection to use for GCR (Rts-Cts or Cts-To-Self)",
|
||||
gcrProtection);
|
||||
cmd.AddValue("multicastFrameErrorRate",
|
||||
"artificial error rate for multicast frame",
|
||||
multicastFrameErrorRate);
|
||||
cmd.AddValue("maxAmpduLength", "maximum length in bytes of an A-MPDU", maxAmpduLength);
|
||||
cmd.AddValue("minExpectedPackets",
|
||||
"if set, simulation fails if the lowest amount of received packets is below this "
|
||||
"value (in Mbit/s)",
|
||||
minExpectedPackets);
|
||||
cmd.AddValue("maxExpectedPackets",
|
||||
"if set, simulation fails if the highest amount of received packets is above this "
|
||||
"value (in Mbit/s)",
|
||||
maxExpectedPackets);
|
||||
cmd.AddValue("minExpectedThroughput",
|
||||
"if set, simulation fails if the throughput is below this value",
|
||||
minExpectedThroughput);
|
||||
cmd.AddValue("maxExpectedThroughput",
|
||||
"if set, simulation fails if the throughput is above this value",
|
||||
maxExpectedThroughput);
|
||||
cmd.Parse(argc, argv);
|
||||
|
||||
Config::SetDefault("ns3::WifiMac::RobustAVStreamingSupported", BooleanValue(true));
|
||||
|
||||
// create nodes
|
||||
NodeContainer wifiApNode;
|
||||
wifiApNode.Create(1);
|
||||
NodeContainer wifiStaNodes;
|
||||
wifiStaNodes.Create(nStations);
|
||||
|
||||
// configure PHY and MAC
|
||||
WifiHelper wifi;
|
||||
if (verbose)
|
||||
{
|
||||
WifiHelper::EnableLogComponents();
|
||||
}
|
||||
if (logging)
|
||||
{
|
||||
LogComponentEnable("WifiMulticast", LOG_LEVEL_ALL);
|
||||
}
|
||||
wifi.SetStandard(WIFI_STANDARD_80211ax);
|
||||
|
||||
YansWifiPhyHelper wifiPhy;
|
||||
wifiPhy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
|
||||
|
||||
auto wifiChannel = YansWifiChannelHelper::Default();
|
||||
wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
|
||||
wifiPhy.SetChannel(wifiChannel.Create());
|
||||
|
||||
WifiMacHelper wifiMac;
|
||||
if (rateManager == "Constant")
|
||||
{
|
||||
wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
|
||||
"DataMode",
|
||||
StringValue("HeMcs" + std::to_string(constantRateMcs)),
|
||||
"RtsCtsThreshold",
|
||||
UintegerValue(rtsThreshold));
|
||||
}
|
||||
else
|
||||
{
|
||||
wifi.SetRemoteStationManager("ns3::" + rateManager + "RateWifiManager",
|
||||
"RtsCtsThreshold",
|
||||
UintegerValue(rtsThreshold));
|
||||
}
|
||||
|
||||
if (gcrRetransmissionPolicy != "NoAckNoRetry")
|
||||
{
|
||||
std::string retransmissionPolicyStr;
|
||||
if (gcrRetransmissionPolicy == "GcrUr")
|
||||
{
|
||||
retransmissionPolicyStr = "GCR_UR";
|
||||
}
|
||||
else if (gcrRetransmissionPolicy == "GcrBlockAck")
|
||||
{
|
||||
retransmissionPolicyStr = "GCR_BA";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Wrong retransmission policy!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
wifiMac.SetGcrManager("ns3::WifiDefaultGcrManager",
|
||||
"RetransmissionPolicy",
|
||||
StringValue(retransmissionPolicyStr),
|
||||
"UnsolicitedRetryLimit",
|
||||
UintegerValue(nRetriesGcrUr),
|
||||
"GcrProtectionMode",
|
||||
StringValue(gcrProtection));
|
||||
}
|
||||
|
||||
Ssid ssid = Ssid("wifi-multicast");
|
||||
|
||||
// setup AP
|
||||
wifiMac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid));
|
||||
auto apDevice = wifi.Install(wifiPhy, wifiMac, wifiApNode);
|
||||
|
||||
// setup STAs
|
||||
wifiMac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
auto staDevices = wifi.Install(wifiPhy, wifiMac, wifiStaNodes);
|
||||
|
||||
auto rxErrorModel = CreateObject<ListErrorModel>();
|
||||
auto ranVar = CreateObject<UniformRandomVariable>();
|
||||
ranVar->SetStream(1);
|
||||
Config::Connect("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
|
||||
MakeCallback(TxCallback).Bind(rxErrorModel, ranVar, multicastFrameErrorRate));
|
||||
for (std::size_t i = 0; i < nStations; ++i)
|
||||
{
|
||||
auto wifiMac = DynamicCast<WifiNetDevice>(staDevices.Get(i))->GetMac();
|
||||
wifiMac->GetWifiPhy(0)->SetPostReceptionErrorModel(rxErrorModel);
|
||||
}
|
||||
Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/State/RxOk",
|
||||
MakeCallback(RxCallback));
|
||||
|
||||
// mobility
|
||||
MobilityHelper mobility;
|
||||
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
|
||||
positionAlloc->Add(Vector(0.0, 0.0, 0.0));
|
||||
for (std::size_t i = 0; i < nStations; ++i)
|
||||
{
|
||||
positionAlloc->Add(Vector(i, 0.0, 0.0));
|
||||
}
|
||||
mobility.SetPositionAllocator(positionAlloc);
|
||||
mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
|
||||
mobility.Install(wifiApNode);
|
||||
mobility.Install(wifiStaNodes);
|
||||
|
||||
// setup static routes to facilitate multicast flood
|
||||
Ipv4ListRoutingHelper listRouting;
|
||||
Ipv4StaticRoutingHelper staticRouting;
|
||||
listRouting.Add(staticRouting, 0);
|
||||
|
||||
// configure IP stack
|
||||
InternetStackHelper internet;
|
||||
internet.SetIpv6StackInstall(false);
|
||||
internet.SetIpv4ArpJitter(true);
|
||||
internet.SetRoutingHelper(listRouting);
|
||||
internet.Install(wifiApNode);
|
||||
internet.Install(wifiStaNodes);
|
||||
|
||||
Ipv4AddressHelper ipv4address;
|
||||
ipv4address.SetBase("10.0.0.0", "255.255.255.0");
|
||||
auto apNodeInterface = ipv4address.Assign(apDevice);
|
||||
auto staNodeInterfaces = ipv4address.Assign(staDevices);
|
||||
|
||||
// add static route in AP
|
||||
auto ipv4 = wifiApNode.Get(0)->GetObject<Ipv4>();
|
||||
auto routing = staticRouting.GetStaticRouting(ipv4);
|
||||
routing->AddHostRouteTo(targetAddr.c_str(),
|
||||
ipv4->GetInterfaceForDevice(wifiApNode.Get(0)->GetDevice(0)),
|
||||
0);
|
||||
|
||||
uint8_t tosValue;
|
||||
std::string maxAmpduSizeAttribute;
|
||||
if (accessCategory == "AC_BE")
|
||||
{
|
||||
tosValue = 0x70;
|
||||
maxAmpduSizeAttribute = "BE_MaxAmpduSize";
|
||||
}
|
||||
else if (accessCategory == "AC_BK")
|
||||
{
|
||||
tosValue = 0x28;
|
||||
maxAmpduSizeAttribute = "BK_MaxAmpduSize";
|
||||
}
|
||||
else if (accessCategory == "AC_VI")
|
||||
{
|
||||
tosValue = 0xb8;
|
||||
maxAmpduSizeAttribute = "VI_MaxAmpduSize";
|
||||
}
|
||||
else if (accessCategory == "AC_VO")
|
||||
{
|
||||
tosValue = 0xc0;
|
||||
maxAmpduSizeAttribute = "VO_MaxAmpduSize";
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ABORT_MSG("Invalid access category");
|
||||
}
|
||||
auto apWifiMac = DynamicCast<WifiNetDevice>(apDevice.Get(0))->GetMac();
|
||||
apWifiMac->SetAttribute(maxAmpduSizeAttribute, UintegerValue(maxAmpduLength));
|
||||
|
||||
// sinks
|
||||
InetSocketAddress sinkSocket(Ipv4Address::GetAny(), 90);
|
||||
PacketSinkHelper sinkHelper("ns3::UdpSocketFactory", sinkSocket);
|
||||
auto sinks = sinkHelper.Install(wifiStaNodes);
|
||||
sinks.Start(Seconds(0));
|
||||
sinks.Stop(simulationTime + Seconds(2.0));
|
||||
|
||||
// source
|
||||
InetSocketAddress sourceSocket(targetAddr.c_str(), 90);
|
||||
OnOffHelper onoffHelper("ns3::UdpSocketFactory", sourceSocket);
|
||||
onoffHelper.SetAttribute("DataRate", DataRateValue(dataRate));
|
||||
onoffHelper.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
onoffHelper.SetAttribute("MaxBytes", UintegerValue(maxPackets * payloadSize));
|
||||
onoffHelper.SetAttribute("Tos", UintegerValue(tosValue));
|
||||
onoffHelper.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
|
||||
onoffHelper.SetAttribute("OffTime", StringValue("ns3::ConstantRandomVariable[Constant=0]"));
|
||||
auto source = onoffHelper.Install(wifiApNode);
|
||||
source.Start(Seconds(1));
|
||||
source.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
// pcap
|
||||
if (pcap)
|
||||
{
|
||||
wifiPhy.EnablePcap("wifi-multicast-AP", apDevice.Get(0));
|
||||
for (std::size_t i = 0; i < nStations; ++i)
|
||||
{
|
||||
wifiPhy.EnablePcap("wifi-multicast-STA" + std::to_string(i + 1), staDevices.Get(i));
|
||||
}
|
||||
}
|
||||
|
||||
g_txBytes = 0;
|
||||
|
||||
Config::Connect("/NodeList/*/$ns3::Node/ApplicationList/*/$ns3::OnOffApplication/Tx",
|
||||
MakeCallback(&SocketTxPacket));
|
||||
|
||||
Config::Connect("/NodeList/*/ApplicationList/*/$ns3::PacketSink/Rx",
|
||||
MakeCallback(&SocketRxPacket));
|
||||
|
||||
// run simulation
|
||||
Simulator::Stop(simulationTime + Seconds(2.0));
|
||||
Simulator::Run();
|
||||
|
||||
// check results
|
||||
std::cout << "Node\t\t\tTX packets\t\tTX bytes\t\tRX packets\t\tRX bytes\t\tThroughput (Mbit/s)"
|
||||
<< std::endl;
|
||||
const auto txRate =
|
||||
(g_lastTx - g_firstTx).IsStrictlyPositive()
|
||||
? static_cast<double>(g_txBytes * 8) / ((g_lastTx - g_firstTx).GetMicroSeconds())
|
||||
: 0.0; // Mbit/s
|
||||
const auto txPackets = g_txBytes / payloadSize;
|
||||
std::cout << "AP"
|
||||
<< "\t\t\t" << txPackets << "\t\t\t" << g_txBytes << "\t\t\t0\t\t\t0\t\t\t" << txRate
|
||||
<< "" << std::endl;
|
||||
for (std::size_t i = 0; i < nStations; ++i)
|
||||
{
|
||||
const auto rxBytes = sinks.Get(0)->GetObject<PacketSink>()->GetTotalRx();
|
||||
const auto rxPackets = rxBytes / payloadSize;
|
||||
const auto throughput =
|
||||
(g_lastRx - g_firstTx).IsStrictlyPositive()
|
||||
? static_cast<double>(rxBytes * 8) / ((g_lastRx - g_firstTx).GetMicroSeconds())
|
||||
: 0.0; // Mbit/s
|
||||
std::cout << "STA" << i + 1 << "\t\t\t0\t\t\t0\t\t\t" << rxPackets << "\t\t\t" << rxBytes
|
||||
<< "\t\t\t" << throughput << "" << std::endl;
|
||||
if (rxPackets < minExpectedPackets)
|
||||
{
|
||||
NS_LOG_ERROR("Obtained RX packets " << rxPackets << " is not expected!");
|
||||
exit(1);
|
||||
}
|
||||
if (maxExpectedPackets > 0 && rxPackets > maxExpectedPackets)
|
||||
{
|
||||
NS_LOG_ERROR("Obtained RX packets " << rxPackets << " is not expected!");
|
||||
exit(1);
|
||||
}
|
||||
if ((throughput * (1 + tolerance)) < minExpectedThroughput)
|
||||
{
|
||||
NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
|
||||
exit(1);
|
||||
}
|
||||
if (maxExpectedThroughput > 0 && (throughput > (maxExpectedThroughput * (1 + tolerance))))
|
||||
{
|
||||
NS_LOG_ERROR("Obtained throughput " << throughput << " is not expected!");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Simulator::Destroy();
|
||||
return 0;
|
||||
}
|
||||
@@ -69,19 +69,19 @@ class Experiment
|
||||
public:
|
||||
Experiment();
|
||||
/**
|
||||
* \brief Construct a new Experiment object
|
||||
* @brief Construct a new Experiment object
|
||||
*
|
||||
* \param name The name of the experiment.
|
||||
* @param name The name of the experiment.
|
||||
*/
|
||||
Experiment(std::string name);
|
||||
/**
|
||||
* Run an experiment.
|
||||
* \param wifi The WifiHelper class.
|
||||
* \param wifiPhy The YansWifiPhyHelper class.
|
||||
* \param wifiMac The WifiMacHelper class.
|
||||
* \param wifiChannel The YansWifiChannelHelper class.
|
||||
* \param mobility The MobilityHelper class.
|
||||
* \return a 2D dataset of the experiment data.
|
||||
* @param wifi The WifiHelper class.
|
||||
* @param wifiPhy The YansWifiPhyHelper class.
|
||||
* @param wifiMac The WifiMacHelper class.
|
||||
* @param wifiChannel The YansWifiChannelHelper class.
|
||||
* @param mobility The MobilityHelper class.
|
||||
* @return a 2D dataset of the experiment data.
|
||||
*/
|
||||
Gnuplot2dDataset Run(const WifiHelper& wifi,
|
||||
const YansWifiPhyHelper& wifiPhy,
|
||||
@@ -90,18 +90,18 @@ class Experiment
|
||||
const MobilityHelper& mobility);
|
||||
|
||||
/**
|
||||
* \brief Setup the experiment from the command line arguments.
|
||||
* @brief Setup the experiment from the command line arguments.
|
||||
*
|
||||
* \param argc The argument count.
|
||||
* \param argv The argument vector.
|
||||
* \return true
|
||||
* @param argc The argument count.
|
||||
* @param argv The argument vector.
|
||||
* @return true
|
||||
*/
|
||||
bool CommandSetup(int argc, char** argv);
|
||||
|
||||
/**
|
||||
* \brief Check if routing is enabled.
|
||||
* @brief Check if routing is enabled.
|
||||
*
|
||||
* \return true if routing is enabled.
|
||||
* @return true if routing is enabled.
|
||||
*/
|
||||
bool IsRouting() const
|
||||
{
|
||||
@@ -109,9 +109,9 @@ class Experiment
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check if mobility is enabled.
|
||||
* @brief Check if mobility is enabled.
|
||||
*
|
||||
* \return true if mobility is enabled.
|
||||
* @return true if mobility is enabled.
|
||||
*/
|
||||
bool IsMobility() const
|
||||
{
|
||||
@@ -119,9 +119,9 @@ class Experiment
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the Scenario number.
|
||||
* @brief Get the Scenario number.
|
||||
*
|
||||
* \return the scenario number.
|
||||
* @return the scenario number.
|
||||
*/
|
||||
uint32_t GetScenario() const
|
||||
{
|
||||
@@ -129,9 +129,9 @@ class Experiment
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the RTS Threshold.
|
||||
* @brief Get the RTS Threshold.
|
||||
*
|
||||
* \return the RTS Threshold.
|
||||
* @return the RTS Threshold.
|
||||
*/
|
||||
std::string GetRtsThreshold() const
|
||||
{
|
||||
@@ -139,9 +139,9 @@ class Experiment
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the Output File Name.
|
||||
* @brief Get the Output File Name.
|
||||
*
|
||||
* \return the Output File Name.
|
||||
* @return the Output File Name.
|
||||
*/
|
||||
std::string GetOutputFileName() const
|
||||
{
|
||||
@@ -149,9 +149,9 @@ class Experiment
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the Rate Manager.
|
||||
* @brief Get the Rate Manager.
|
||||
*
|
||||
* \return the Rate Manager.
|
||||
* @return the Rate Manager.
|
||||
*/
|
||||
std::string GetRateManager() const
|
||||
{
|
||||
@@ -160,34 +160,34 @@ class Experiment
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Setup the receiving socket.
|
||||
* @brief Setup the receiving socket.
|
||||
*
|
||||
* \param node The receiving node.
|
||||
* \return the Rx socket.
|
||||
* @param node The receiving node.
|
||||
* @return the Rx socket.
|
||||
*/
|
||||
Ptr<Socket> SetupPacketReceive(Ptr<Node> node);
|
||||
/**
|
||||
* Generate 1-hop and 2-hop neighbors of a node in grid topology
|
||||
* \param c The node container.
|
||||
* \param senderId The sender ID.
|
||||
* \return the neighbor nodes.
|
||||
* @param c The node container.
|
||||
* @param senderId The sender ID.
|
||||
* @return the neighbor nodes.
|
||||
*/
|
||||
NodeContainer GenerateNeighbors(NodeContainer c, uint32_t senderId);
|
||||
|
||||
/**
|
||||
* \brief Setup the application in the nodes.
|
||||
* @brief Setup the application in the nodes.
|
||||
*
|
||||
* \param client Client node.
|
||||
* \param server Server node.
|
||||
* \param start Start time.
|
||||
* \param stop Stop time.
|
||||
* @param client Client node.
|
||||
* @param server Server node.
|
||||
* @param start Start time.
|
||||
* @param stop Stop time.
|
||||
*/
|
||||
void ApplicationSetup(Ptr<Node> client, Ptr<Node> server, double start, double stop);
|
||||
/**
|
||||
* Take the grid map, divide it into 4 quadrants
|
||||
* Assign all nodes from each quadrant to a specific container
|
||||
*
|
||||
* \param c The node container.
|
||||
* @param c The node container.
|
||||
*/
|
||||
void AssignNeighbors(NodeContainer c);
|
||||
/**
|
||||
@@ -195,25 +195,25 @@ class Experiment
|
||||
* may be the source for multiple destinations and a node maybe a destination
|
||||
* for multiple sources.
|
||||
*
|
||||
* \param c The node container.
|
||||
* @param c The node container.
|
||||
*/
|
||||
void SelectSrcDest(NodeContainer c);
|
||||
/**
|
||||
* \brief Receive a packet.
|
||||
* @brief Receive a packet.
|
||||
*
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void ReceivePacket(Ptr<Socket> socket);
|
||||
/**
|
||||
* \brief Calculate the throughput.
|
||||
* @brief Calculate the throughput.
|
||||
*/
|
||||
void CheckThroughput();
|
||||
/**
|
||||
* A sender node will set up a flow to each of the its neighbors
|
||||
* in its quadrant randomly. All the flows are exponentially distributed.
|
||||
*
|
||||
* \param sender The sender node.
|
||||
* \param c The node neighbors.
|
||||
* @param sender The sender node.
|
||||
* @param c The node neighbors.
|
||||
*/
|
||||
void SendMultiDestinations(Ptr<Node> sender, NodeContainer c);
|
||||
|
||||
@@ -425,9 +425,9 @@ Experiment::SendMultiDestinations(Ptr<Node> sender, NodeContainer c)
|
||||
/**
|
||||
* Print the position of two nodes.
|
||||
*
|
||||
* \param client Client node.
|
||||
* \param server Server node.
|
||||
* \return a string with the nodes data and positions
|
||||
* @param client Client node.
|
||||
* @param server Server node.
|
||||
* @return a string with the nodes data and positions
|
||||
*/
|
||||
static inline std::string
|
||||
PrintPosition(Ptr<Node> client, Ptr<Node> server)
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
* into an eps file, by running:
|
||||
* \code{.sh}
|
||||
* gnuplot throughput-parf.plt
|
||||
* \endcode
|
||||
* @endcode
|
||||
* Also, to enable logging of rate and power changes to the terminal, set this
|
||||
* environment variable:
|
||||
* \code{.sh}
|
||||
* export NS_LOG=PowerAdaptationDistance=level_info
|
||||
* \endcode
|
||||
* @endcode
|
||||
*
|
||||
* This simulation consist of 2 nodes, one AP and one STA.
|
||||
* The AP generates UDP traffic with a CBR of 54 Mbps to the STA.
|
||||
@@ -55,7 +55,7 @@
|
||||
* To display all the possible arguments and their defaults:
|
||||
* \code{.sh}
|
||||
* ./ns3 run "wifi-power-adaptation-distance --help"
|
||||
* \endcode
|
||||
* @endcode
|
||||
*
|
||||
* Example usage (selecting Aparf rather than Parf):
|
||||
* \code{.sh}
|
||||
@@ -70,7 +70,7 @@
|
||||
* To enable the log of rate and power changes:
|
||||
* \code{.sh}
|
||||
* export NS_LOG=PowerAdaptationDistance=level_info
|
||||
* \endcode
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
#include "ns3/command-line.h"
|
||||
@@ -100,85 +100,85 @@ NS_LOG_COMPONENT_DEFINE("PowerAdaptationDistance");
|
||||
static const uint32_t packetSize = 1420;
|
||||
|
||||
/**
|
||||
* \brief Class to collect node statistics.
|
||||
* @brief Class to collect node statistics.
|
||||
*/
|
||||
class NodeStatistics
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* @brief Constructor.
|
||||
*
|
||||
* \param aps Access points
|
||||
* \param stas WiFi Stations.
|
||||
* @param aps Access points
|
||||
* @param stas WiFi Stations.
|
||||
*/
|
||||
NodeStatistics(NetDeviceContainer aps, NetDeviceContainer stas);
|
||||
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/Phy/PhyTxBegin.
|
||||
* @brief Callback called by WifiNetDevice/Phy/PhyTxBegin.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param packet The sent packet.
|
||||
* \param powerW The Tx power.
|
||||
* @param path The trace path.
|
||||
* @param packet The sent packet.
|
||||
* @param powerW The Tx power.
|
||||
*/
|
||||
void PhyCallback(std::string path, Ptr<const Packet> packet, double powerW);
|
||||
/**
|
||||
* \brief Callback called by PacketSink/Rx.
|
||||
* @brief Callback called by PacketSink/Rx.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param packet The received packet.
|
||||
* \param from The sender address.
|
||||
* @param path The trace path.
|
||||
* @param packet The received packet.
|
||||
* @param from The sender address.
|
||||
*/
|
||||
void RxCallback(std::string path, Ptr<const Packet> packet, const Address& from);
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.
|
||||
* @brief Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldPower Old Tx power.
|
||||
* \param newPower Actual Tx power.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldPower Old Tx power.
|
||||
* @param newPower Actual Tx power.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest);
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
* @brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldRate Old rate.
|
||||
* \param newRate Actual rate.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldRate Old rate.
|
||||
* @param newRate Actual rate.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void RateCallback(std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest);
|
||||
/**
|
||||
* \brief Set the Position of a node.
|
||||
* @brief Set the Position of a node.
|
||||
*
|
||||
* \param node The node.
|
||||
* \param position The position.
|
||||
* @param node The node.
|
||||
* @param position The position.
|
||||
*/
|
||||
void SetPosition(Ptr<Node> node, Vector position);
|
||||
/**
|
||||
* Move a node.
|
||||
* \param node The node.
|
||||
* \param stepsSize The step size.
|
||||
* \param stepsTime Time on each step.
|
||||
* @param node The node.
|
||||
* @param stepsSize The step size.
|
||||
* @param stepsTime Time on each step.
|
||||
*/
|
||||
void AdvancePosition(Ptr<Node> node, int stepsSize, Time stepsTime);
|
||||
/**
|
||||
* \brief Get the Position of a node.
|
||||
* @brief Get the Position of a node.
|
||||
*
|
||||
* \param node The node.
|
||||
* \return the position of the node.
|
||||
* @param node The node.
|
||||
* @return the position of the node.
|
||||
*/
|
||||
Vector GetPosition(Ptr<Node> node);
|
||||
|
||||
/**
|
||||
* \brief Get the Throughput output data
|
||||
* @brief Get the Throughput output data
|
||||
*
|
||||
* \return the Throughput output data.
|
||||
* @return the Throughput output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetDatafile();
|
||||
/**
|
||||
* \brief Get the Power output data.
|
||||
* @brief Get the Power output data.
|
||||
*
|
||||
* \return the Power output data.
|
||||
* @return the Power output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetPowerDatafile();
|
||||
|
||||
@@ -186,16 +186,16 @@ class NodeStatistics
|
||||
/// Time, DataRate pair vector.
|
||||
typedef std::vector<std::pair<Time, DataRate>> TxTime;
|
||||
/**
|
||||
* \brief Setup the WifiPhy object.
|
||||
* @brief Setup the WifiPhy object.
|
||||
*
|
||||
* \param phy The WifiPhy to setup.
|
||||
* @param phy The WifiPhy to setup.
|
||||
*/
|
||||
void SetupPhy(Ptr<WifiPhy> phy);
|
||||
/**
|
||||
* \brief Get the time at which a given datarate has been recorded.
|
||||
* @brief Get the time at which a given datarate has been recorded.
|
||||
*
|
||||
* \param rate The datarate to search.
|
||||
* \return the time.
|
||||
* @param rate The datarate to search.
|
||||
* @return the time.
|
||||
*/
|
||||
Time GetCalcTxTime(DataRate rate);
|
||||
|
||||
@@ -243,7 +243,7 @@ NodeStatistics::SetupPhy(Ptr<WifiPhy> phy)
|
||||
txVector.SetPreambleType(WIFI_PREAMBLE_LONG);
|
||||
txVector.SetChannelWidth(phy->GetChannelWidth());
|
||||
DataRate dataRate(mode.GetDataRate(phy->GetChannelWidth()));
|
||||
Time time = phy->CalculateTxDuration(packetSize, txVector, phy->GetPhyBand());
|
||||
Time time = WifiPhy::CalculateTxDuration(packetSize, txVector, phy->GetPhyBand());
|
||||
NS_LOG_DEBUG(mode.GetUniqueName() << " " << time.GetSeconds() << " " << dataRate);
|
||||
m_timeTable.emplace_back(time, dataRate);
|
||||
}
|
||||
@@ -260,7 +260,7 @@ NodeStatistics::GetCalcTxTime(DataRate rate)
|
||||
}
|
||||
}
|
||||
NS_ASSERT(false);
|
||||
return Seconds(0);
|
||||
return Time(0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -272,16 +272,16 @@ NodeStatistics::PhyCallback(std::string path, Ptr<const Packet> packet, double p
|
||||
|
||||
if (head.GetType() == WIFI_MAC_DATA)
|
||||
{
|
||||
m_totalEnergy += pow(10.0, m_currentPower[dest] / 10.0) *
|
||||
GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalTime += GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
const auto txTimeSeconds = GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalEnergy += DbmToW(m_currentPower[dest]) * txTimeSeconds;
|
||||
m_totalTime += txTimeSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NodeStatistics::PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest)
|
||||
{
|
||||
m_currentPower[dest] = newPower;
|
||||
m_currentPower[dest] = dBm_u{newPower};
|
||||
}
|
||||
|
||||
void
|
||||
@@ -351,10 +351,10 @@ NodeStatistics::GetPowerDatafile()
|
||||
/**
|
||||
* Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldPower Old Tx power.
|
||||
* \param newPower Actual Tx power.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldPower Old Tx power.
|
||||
* @param newPower Actual Tx power.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void
|
||||
PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest)
|
||||
@@ -364,12 +364,12 @@ PowerCallback(std::string path, double oldPower, double newPower, Mac48Address d
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
* @brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldRate Old rate.
|
||||
* \param newRate Actual rate.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldRate Old rate.
|
||||
* @param newRate Actual rate.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void
|
||||
RateCallback(std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest)
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
* To enable the log of rate and power changes:
|
||||
* \code{.sh}
|
||||
* export NS_LOG=PowerAdaptationInterference=level_info
|
||||
* \endcode
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
#include "ns3/command-line.h"
|
||||
@@ -72,111 +72,111 @@ NS_LOG_COMPONENT_DEFINE("PowerAdaptationInterference");
|
||||
static const uint32_t packetSize = 1420;
|
||||
|
||||
/**
|
||||
* \brief Class to collect node statistics.
|
||||
* @brief Class to collect node statistics.
|
||||
*/
|
||||
class NodeStatistics
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor.
|
||||
* @brief Constructor.
|
||||
*
|
||||
* \param aps Access points
|
||||
* \param stas WiFi Stations.
|
||||
* @param aps Access points
|
||||
* @param stas WiFi Stations.
|
||||
*/
|
||||
NodeStatistics(NetDeviceContainer aps, NetDeviceContainer stas);
|
||||
|
||||
/**
|
||||
* \brief Collects the statistics at a given time.
|
||||
* @brief Collects the statistics at a given time.
|
||||
*
|
||||
* \param time Time at which the statistics are collected.
|
||||
* @param time Time at which the statistics are collected.
|
||||
*/
|
||||
void CheckStatistics(double time);
|
||||
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/Phy/PhyTxBegin.
|
||||
* @brief Callback called by WifiNetDevice/Phy/PhyTxBegin.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param packet The sent packet.
|
||||
* \param powerW The Tx power.
|
||||
* @param path The trace path.
|
||||
* @param packet The sent packet.
|
||||
* @param powerW The Tx power.
|
||||
*/
|
||||
void PhyCallback(std::string path, Ptr<const Packet> packet, double powerW);
|
||||
/**
|
||||
* \brief Callback called by PacketSink/Rx.
|
||||
* @brief Callback called by PacketSink/Rx.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param packet The received packet.
|
||||
* \param from The sender address.
|
||||
* @param path The trace path.
|
||||
* @param packet The received packet.
|
||||
* @param from The sender address.
|
||||
*/
|
||||
void RxCallback(std::string path, Ptr<const Packet> packet, const Address& from);
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.
|
||||
* @brief Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldPower Old Tx power.
|
||||
* \param newPower Actual Tx power.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldPower Old Tx power.
|
||||
* @param newPower Actual Tx power.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest);
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
* @brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldRate Old rate.
|
||||
* \param newRate Actual rate.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldRate Old rate.
|
||||
* @param newRate Actual rate.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void RateCallback(std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest);
|
||||
/**
|
||||
* \brief Callback called by YansWifiPhy/State/State.
|
||||
* @brief Callback called by YansWifiPhy/State/State.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param init Time when the state started.
|
||||
* \param duration Amount of time we've been in (or will be in) the state.
|
||||
* \param state The state.
|
||||
* @param path The trace path.
|
||||
* @param init Time when the state started.
|
||||
* @param duration Amount of time we've been in (or will be in) the state.
|
||||
* @param state The state.
|
||||
*/
|
||||
void StateCallback(std::string path, Time init, Time duration, WifiPhyState state);
|
||||
|
||||
/**
|
||||
* \brief Get the Throughput output data
|
||||
* @brief Get the Throughput output data
|
||||
*
|
||||
* \return the Throughput output data.
|
||||
* @return the Throughput output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetDatafile();
|
||||
/**
|
||||
* \brief Get the Power output data.
|
||||
* @brief Get the Power output data.
|
||||
*
|
||||
* \return the Power output data.
|
||||
* @return the Power output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetPowerDatafile();
|
||||
/**
|
||||
* \brief Get the IDLE state output data.
|
||||
* @brief Get the IDLE state output data.
|
||||
*
|
||||
* \return the IDLE state output data.
|
||||
* @return the IDLE state output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetIdleDatafile();
|
||||
/**
|
||||
* \brief Get the BUSY state output data.
|
||||
* @brief Get the BUSY state output data.
|
||||
*
|
||||
* \return the BUSY state output data.
|
||||
* @return the BUSY state output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetBusyDatafile();
|
||||
/**
|
||||
* \brief Get the TX state output data.
|
||||
* @brief Get the TX state output data.
|
||||
*
|
||||
* \return the TX state output data.
|
||||
* @return the TX state output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetTxDatafile();
|
||||
/**
|
||||
* \brief Get the RX state output data.
|
||||
* @brief Get the RX state output data.
|
||||
*
|
||||
* \return the RX state output data.
|
||||
* @return the RX state output data.
|
||||
*/
|
||||
Gnuplot2dDataset GetRxDatafile();
|
||||
|
||||
/**
|
||||
* \brief Get the Busy time.
|
||||
* @brief Get the Busy time.
|
||||
*
|
||||
* \return the busy time.
|
||||
* @return the busy time.
|
||||
*/
|
||||
double GetBusyTime() const;
|
||||
|
||||
@@ -184,16 +184,16 @@ class NodeStatistics
|
||||
/// Time, DataRate pair vector.
|
||||
typedef std::vector<std::pair<Time, DataRate>> TxTime;
|
||||
/**
|
||||
* \brief Setup the WifiPhy object.
|
||||
* @brief Setup the WifiPhy object.
|
||||
*
|
||||
* \param phy The WifiPhy to setup.
|
||||
* @param phy The WifiPhy to setup.
|
||||
*/
|
||||
void SetupPhy(Ptr<WifiPhy> phy);
|
||||
/**
|
||||
* \brief Get the time at which a given datarate has been recorded.
|
||||
* @brief Get the time at which a given datarate has been recorded.
|
||||
*
|
||||
* \param rate The datarate to search.
|
||||
* \return the time.
|
||||
* @param rate The datarate to search.
|
||||
* @return the time.
|
||||
*/
|
||||
Time GetCalcTxTime(DataRate rate);
|
||||
|
||||
@@ -264,7 +264,7 @@ NodeStatistics::SetupPhy(Ptr<WifiPhy> phy)
|
||||
txVector.SetPreambleType(WIFI_PREAMBLE_LONG);
|
||||
txVector.SetChannelWidth(phy->GetChannelWidth());
|
||||
DataRate dataRate(mode.GetDataRate(phy->GetChannelWidth()));
|
||||
Time time = phy->CalculateTxDuration(packetSize, txVector, phy->GetPhyBand());
|
||||
Time time = WifiPhy::CalculateTxDuration(packetSize, txVector, phy->GetPhyBand());
|
||||
NS_LOG_DEBUG(mode.GetUniqueName() << " " << time.GetSeconds() << " " << dataRate);
|
||||
m_timeTable.emplace_back(time, dataRate);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ NodeStatistics::GetCalcTxTime(DataRate rate)
|
||||
}
|
||||
}
|
||||
NS_ASSERT(false);
|
||||
return Seconds(0);
|
||||
return Time(0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -293,16 +293,16 @@ NodeStatistics::PhyCallback(std::string path, Ptr<const Packet> packet, double p
|
||||
|
||||
if (head.GetType() == WIFI_MAC_DATA)
|
||||
{
|
||||
m_totalEnergy += pow(10.0, m_currentPower[dest] / 10.0) *
|
||||
GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalTime += GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
const auto txTimeSeconds = GetCalcTxTime(m_currentRate[dest]).GetSeconds();
|
||||
m_totalEnergy += DbmToW(m_currentPower[dest]) * txTimeSeconds;
|
||||
m_totalTime += txTimeSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NodeStatistics::PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest)
|
||||
{
|
||||
m_currentPower[dest] = newPower;
|
||||
m_currentPower[dest] = dBm_u{newPower};
|
||||
}
|
||||
|
||||
void
|
||||
@@ -413,10 +413,10 @@ NodeStatistics::GetBusyTime() const
|
||||
/**
|
||||
* Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldPower Old Tx power.
|
||||
* \param newPower Actual Tx power.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldPower Old Tx power.
|
||||
* @param newPower Actual Tx power.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void
|
||||
PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest)
|
||||
@@ -426,12 +426,12 @@ PowerCallback(std::string path, double oldPower, double newPower, Mac48Address d
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
* @brief Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.
|
||||
*
|
||||
* \param path The trace path.
|
||||
* \param oldRate Old rate.
|
||||
* \param newRate Actual rate.
|
||||
* \param dest Destination of the transmission.
|
||||
* @param path The trace path.
|
||||
* @param oldRate Old rate.
|
||||
* @param newRate Actual rate.
|
||||
* @param dest Destination of the transmission.
|
||||
*/
|
||||
void
|
||||
RateCallback(std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest)
|
||||
@@ -578,8 +578,8 @@ main(int argc, char* argv[])
|
||||
|
||||
OnOffHelper onoff("ns3::UdpSocketFactory", InetSocketAddress(sinkAddress, port));
|
||||
onoff.SetConstantRate(DataRate("54Mb/s"), packetSize);
|
||||
onoff.SetAttribute("StartTime", TimeValue(Seconds(0.0)));
|
||||
onoff.SetAttribute("StopTime", TimeValue(Seconds(100.0)));
|
||||
onoff.SetAttribute("StartTime", TimeValue(Seconds(0)));
|
||||
onoff.SetAttribute("StopTime", TimeValue(Seconds(100)));
|
||||
ApplicationContainer apps_source = onoff.Install(wifiApNodes.Get(0));
|
||||
|
||||
PacketSinkHelper sink1("ns3::UdpSocketFactory", InetSocketAddress(sinkAddress1, port));
|
||||
@@ -587,8 +587,8 @@ main(int argc, char* argv[])
|
||||
|
||||
OnOffHelper onoff1("ns3::UdpSocketFactory", InetSocketAddress(sinkAddress1, port));
|
||||
onoff1.SetConstantRate(DataRate("54Mb/s"), packetSize);
|
||||
onoff1.SetAttribute("StartTime", TimeValue(Seconds(0.0)));
|
||||
onoff1.SetAttribute("StopTime", TimeValue(Seconds(100.0)));
|
||||
onoff1.SetAttribute("StartTime", TimeValue(Seconds(0)));
|
||||
onoff1.SetAttribute("StopTime", TimeValue(Seconds(100)));
|
||||
apps_source.Add(onoff1.Install(wifiApNodes.Get(1)));
|
||||
|
||||
apps_sink.Start(Seconds(0.5));
|
||||
|
||||
@@ -70,39 +70,39 @@ class NodeStatistics
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* \param aps AP devices
|
||||
* \param stas STA devices
|
||||
* @param aps AP devices
|
||||
* @param stas STA devices
|
||||
*/
|
||||
NodeStatistics(NetDeviceContainer aps, NetDeviceContainer stas);
|
||||
|
||||
/**
|
||||
* RX callback
|
||||
* \param path path
|
||||
* \param packet received packet
|
||||
* \param from sender
|
||||
* @param path path
|
||||
* @param packet received packet
|
||||
* @param from sender
|
||||
*/
|
||||
void RxCallback(std::string path, Ptr<const Packet> packet, const Address& from);
|
||||
/**
|
||||
* Set node position
|
||||
* \param node the node
|
||||
* \param position the position
|
||||
* @param node the node
|
||||
* @param position the position
|
||||
*/
|
||||
void SetPosition(Ptr<Node> node, Vector position);
|
||||
/**
|
||||
* Advance node position
|
||||
* \param node the node
|
||||
* \param stepsSize the size of a step
|
||||
* \param stepsTime the time interval between steps
|
||||
* @param node the node
|
||||
* @param stepsSize the size of a step
|
||||
* @param stepsTime the time interval between steps
|
||||
*/
|
||||
void AdvancePosition(Ptr<Node> node, int stepsSize, int stepsTime);
|
||||
/**
|
||||
* Get node position
|
||||
* \param node the node
|
||||
* \return the position
|
||||
* @param node the node
|
||||
* @return the position
|
||||
*/
|
||||
Vector GetPosition(Ptr<Node> node);
|
||||
/**
|
||||
* \return the gnuplot 2d dataset
|
||||
* @return the gnuplot 2d dataset
|
||||
*/
|
||||
Gnuplot2dDataset GetDatafile();
|
||||
|
||||
@@ -162,8 +162,8 @@ NodeStatistics::GetDatafile()
|
||||
/**
|
||||
* Callback for 'Rate' trace source
|
||||
*
|
||||
* \param oldRate old MCS rate (bits/sec)
|
||||
* \param newRate new MCS rate (bits/sec)
|
||||
* @param oldRate old MCS rate (bits/sec)
|
||||
* @param newRate new MCS rate (bits/sec)
|
||||
*/
|
||||
void
|
||||
RateCallback(uint64_t oldRate, uint64_t newRate)
|
||||
|
||||
@@ -97,7 +97,7 @@ NS_LOG_COMPONENT_DEFINE("WifiSimpleAdhocGrid");
|
||||
/**
|
||||
* Function called when a packet is received.
|
||||
*
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void
|
||||
ReceivePacket(Ptr<Socket> socket)
|
||||
@@ -111,10 +111,10 @@ ReceivePacket(Ptr<Socket> socket)
|
||||
/**
|
||||
* Generate traffic.
|
||||
*
|
||||
* \param socket The sending socket.
|
||||
* \param pktSize The packet size.
|
||||
* \param pktCount The packet count.
|
||||
* \param pktInterval The interval between two packets.
|
||||
* @param socket The sending socket.
|
||||
* @param pktSize The packet size.
|
||||
* @param pktCount The packet count.
|
||||
* @param pktInterval The interval between two packets.
|
||||
*/
|
||||
static void
|
||||
GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
|
||||
@@ -259,7 +259,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// Give OLSR time to converge-- 30 seconds perhaps
|
||||
Simulator::Schedule(Seconds(30.0),
|
||||
Simulator::Schedule(Seconds(30),
|
||||
&GenerateTraffic,
|
||||
source,
|
||||
packetSize,
|
||||
@@ -270,7 +270,7 @@ main(int argc, char* argv[])
|
||||
NS_LOG_UNCOND("Testing from node " << sourceNode << " to " << sinkNode << " with grid distance "
|
||||
<< distance);
|
||||
|
||||
Simulator::Stop(Seconds(33.0));
|
||||
Simulator::Stop(Seconds(33));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ NS_LOG_COMPONENT_DEFINE("WifiSimpleAdhoc");
|
||||
/**
|
||||
* Function called when a packet is received.
|
||||
*
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void
|
||||
ReceivePacket(Ptr<Socket> socket)
|
||||
@@ -71,10 +71,10 @@ ReceivePacket(Ptr<Socket> socket)
|
||||
/**
|
||||
* Generate traffic.
|
||||
*
|
||||
* \param socket The sending socket.
|
||||
* \param pktSize The packet size.
|
||||
* \param pktCount The packet count.
|
||||
* \param pktInterval The interval between two packets.
|
||||
* @param socket The sending socket.
|
||||
* @param pktSize The packet size.
|
||||
* @param pktCount The packet count.
|
||||
* @param pktInterval The interval between two packets.
|
||||
*/
|
||||
static void
|
||||
GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
|
||||
@@ -189,7 +189,7 @@ main(int argc, char* argv[])
|
||||
NS_LOG_UNCOND("Testing " << numPackets << " packets sent with receiver rss " << rss);
|
||||
|
||||
Simulator::ScheduleWithContext(source->GetNode()->GetId(),
|
||||
Seconds(1.0),
|
||||
Seconds(1),
|
||||
&GenerateTraffic,
|
||||
source,
|
||||
packetSize,
|
||||
|
||||
@@ -166,8 +166,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiApNode);
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
streamNumber += server.AssignStreams(wifiApNode, streamNumber);
|
||||
|
||||
UdpClientHelper client(ApInterface.GetAddress(0), port);
|
||||
@@ -177,8 +177,8 @@ main(int argc, char* argv[])
|
||||
|
||||
// Saturated UDP traffic from stations to AP
|
||||
ApplicationContainer clientApp1 = client.Install(wifiStaNodes);
|
||||
clientApp1.Start(Seconds(1.0));
|
||||
clientApp1.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp1.Start(Seconds(1));
|
||||
clientApp1.Stop(simulationTime + Seconds(1));
|
||||
streamNumber += client.AssignStreams(wifiStaNodes, streamNumber);
|
||||
|
||||
phy.EnablePcap("SimpleHtHiddenStations_Ap", apDevice.Get(0));
|
||||
@@ -188,7 +188,7 @@ main(int argc, char* argv[])
|
||||
AsciiTraceHelper ascii;
|
||||
phy.EnableAsciiAll(ascii.CreateFileStream("SimpleHtHiddenStations.tr"));
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
|
||||
Simulator::Run();
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ NS_LOG_COMPONENT_DEFINE("WifiSimpleInfra");
|
||||
/**
|
||||
* Function called when a packet is received.
|
||||
*
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
void
|
||||
ReceivePacket(Ptr<Socket> socket)
|
||||
@@ -103,10 +103,10 @@ ReceivePacket(Ptr<Socket> socket)
|
||||
/**
|
||||
* Generate traffic.
|
||||
*
|
||||
* \param socket The sending socket.
|
||||
* \param pktSize The packet size.
|
||||
* \param pktCount The packet count.
|
||||
* \param pktInterval The interval between two packets.
|
||||
* @param socket The sending socket.
|
||||
* @param pktSize The packet size.
|
||||
* @param pktCount The packet count.
|
||||
* @param pktInterval The interval between two packets.
|
||||
*/
|
||||
static void
|
||||
GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
|
||||
@@ -229,14 +229,14 @@ main(int argc, char* argv[])
|
||||
std::cout << "Testing " << numPackets << " packets sent with receiver rss " << rss << std::endl;
|
||||
|
||||
Simulator::ScheduleWithContext(source->GetNode()->GetId(),
|
||||
Seconds(1.0),
|
||||
Seconds(1),
|
||||
&GenerateTraffic,
|
||||
source,
|
||||
packetSize,
|
||||
numPackets,
|
||||
interval);
|
||||
|
||||
Simulator::Stop(Seconds(30.0));
|
||||
Simulator::Stop(Seconds(30));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ NS_LOG_COMPONENT_DEFINE("WifiSimpleInterference");
|
||||
/**
|
||||
* Print a packer that has been received.
|
||||
*
|
||||
* \param socket The receiving socket.
|
||||
* \return a string with the packet details.
|
||||
* @param socket The receiving socket.
|
||||
* @return a string with the packet details.
|
||||
*/
|
||||
static inline std::string
|
||||
PrintReceivedPacket(Ptr<Socket> socket)
|
||||
@@ -111,7 +111,7 @@ PrintReceivedPacket(Ptr<Socket> socket)
|
||||
/**
|
||||
* Function called when a packet is received.
|
||||
*
|
||||
* \param socket The receiving socket.
|
||||
* @param socket The receiving socket.
|
||||
*/
|
||||
static void
|
||||
ReceivePacket(Ptr<Socket> socket)
|
||||
@@ -122,10 +122,10 @@ ReceivePacket(Ptr<Socket> socket)
|
||||
/**
|
||||
* Generate traffic
|
||||
*
|
||||
* \param socket The seding socket.
|
||||
* \param pktSize The packet size.
|
||||
* \param pktCount The packet counter.
|
||||
* \param pktInterval The interval between two packets.
|
||||
* @param socket The sending socket.
|
||||
* @param pktSize The packet size.
|
||||
* @param pktCount The packet counter.
|
||||
* @param pktInterval The interval between two packets.
|
||||
*/
|
||||
static void
|
||||
GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pktInterval)
|
||||
|
||||
@@ -58,9 +58,9 @@ NS_LOG_COMPONENT_DEFINE("WifiSleep");
|
||||
/**
|
||||
* Remaining energy trace sink
|
||||
*
|
||||
* \tparam node The node ID this trace belongs to.
|
||||
* \param oldValue Old value.
|
||||
* \param newValue New value.
|
||||
* @tparam node The node ID this trace belongs to.
|
||||
* @param oldValue Old value.
|
||||
* @param newValue New value.
|
||||
*/
|
||||
template <int node>
|
||||
void
|
||||
@@ -77,11 +77,11 @@ RemainingEnergyTrace(double oldValue, double newValue)
|
||||
/**
|
||||
* PHY state trace sink
|
||||
*
|
||||
* \tparam node The node ID this trace belongs to.
|
||||
* \param context The context
|
||||
* \param start Start time for the current state
|
||||
* \param duration Duratio of the current state
|
||||
* \param state State
|
||||
* @tparam node The node ID this trace belongs to.
|
||||
* @param context The context
|
||||
* @param start Start time for the current state
|
||||
* @param duration Duratio of the current state
|
||||
* @param state State
|
||||
*/
|
||||
template <int node>
|
||||
void
|
||||
@@ -245,7 +245,7 @@ main(int argc, char* argv[])
|
||||
Config::Connect("/NodeList/0/DeviceList/*/Phy/State/State", MakeCallback(&PhyStateTrace<0>));
|
||||
Config::Connect("/NodeList/1/DeviceList/*/Phy/State/State", MakeCallback(&PhyStateTrace<1>));
|
||||
|
||||
Simulator::Stop(duration + Seconds(1.0));
|
||||
Simulator::Stop(duration + Seconds(1));
|
||||
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
@@ -91,12 +91,12 @@ uint32_t g_samples; //!< Number of samples
|
||||
/**
|
||||
* Monitor sniffer Rx trace
|
||||
*
|
||||
* \param packet The sensed packet.
|
||||
* \param channelFreqMhz The channel frequency [MHz].
|
||||
* \param txVector The Tx vector.
|
||||
* \param aMpdu The aMPDU.
|
||||
* \param signalNoise The signal and noise dBm.
|
||||
* \param staId The STA ID.
|
||||
* @param packet The sensed packet.
|
||||
* @param channelFreqMhz The channel frequency [MHz].
|
||||
* @param txVector The Tx vector.
|
||||
* @param aMpdu The aMPDU.
|
||||
* @param signalNoise The signal and noise dBm.
|
||||
* @param staId The STA ID.
|
||||
*/
|
||||
void
|
||||
MonitorSniffRx(Ptr<const Packet> packet,
|
||||
@@ -443,8 +443,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper server(port);
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / (datarate * 1e6);
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -452,8 +452,8 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("Interval", TimeValue(Seconds(packetInterval)));
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -462,8 +462,8 @@ main(int argc, char* argv[])
|
||||
Address localAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
serverApp = packetSinkHelper.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
|
||||
@@ -473,8 +473,8 @@ main(int argc, char* argv[])
|
||||
AddressValue remoteAddress(InetSocketAddress(staNodeInterface.GetAddress(0), port));
|
||||
onoff.SetAttribute("Remote", remoteAddress);
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
Config::ConnectWithoutContext("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx",
|
||||
@@ -495,7 +495,7 @@ main(int argc, char* argv[])
|
||||
g_noiseDbmAvg = 0;
|
||||
g_samples = 0;
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
auto throughput = 0.0;
|
||||
|
||||
@@ -97,12 +97,12 @@ uint32_t g_samples; //!< Number of samples
|
||||
/**
|
||||
* Monitor sniffer Rx trace
|
||||
*
|
||||
* \param packet The sensed packet.
|
||||
* \param channelFreqMhz The channel frequency [MHz].
|
||||
* \param txVector The Tx vector.
|
||||
* \param aMpdu The aMPDU.
|
||||
* \param signalNoise The signal and noise dBm.
|
||||
* \param staId The STA ID.
|
||||
* @param packet The sensed packet.
|
||||
* @param channelFreqMhz The channel frequency [MHz].
|
||||
* @param txVector The Tx vector.
|
||||
* @param aMpdu The aMPDU.
|
||||
* @param signalNoise The signal and noise dBm.
|
||||
* @param staId The STA ID.
|
||||
*/
|
||||
void
|
||||
MonitorSniffRx(Ptr<const Packet> packet,
|
||||
@@ -498,8 +498,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper server(port);
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / (datarate * 1e6);
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -507,8 +507,8 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("Interval", TimeValue(Seconds(packetInterval)));
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -517,8 +517,8 @@ main(int argc, char* argv[])
|
||||
Address localAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
serverApp = packetSinkHelper.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
|
||||
@@ -528,8 +528,8 @@ main(int argc, char* argv[])
|
||||
AddressValue remoteAddress(InetSocketAddress(staNodeInterface.GetAddress(0), port));
|
||||
onoff.SetAttribute("Remote", remoteAddress);
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
// Configure waveform generator
|
||||
@@ -578,22 +578,22 @@ main(int argc, char* argv[])
|
||||
Ptr<WifiPhy> wifiPhyPtr = staDevicePtr->GetObject<WifiNetDevice>()->GetPhy();
|
||||
if (i <= 15)
|
||||
{
|
||||
NS_ABORT_MSG_IF(wifiPhyPtr->GetChannelWidth() != 20,
|
||||
NS_ABORT_MSG_IF(wifiPhyPtr->GetChannelWidth() != MHz_u{20},
|
||||
"Error: Channel width must be 20 MHz if MCS index <= 15");
|
||||
NS_ABORT_MSG_IF(
|
||||
wifiPhyPtr->GetFrequency() != 5180,
|
||||
wifiPhyPtr->GetFrequency() != MHz_u{5180},
|
||||
"Error: Wi-Fi nodes must be tuned to 5180 MHz to match the waveform generator");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ABORT_MSG_IF(wifiPhyPtr->GetChannelWidth() != 40,
|
||||
NS_ABORT_MSG_IF(wifiPhyPtr->GetChannelWidth() != MHz_u{40},
|
||||
"Error: Channel width must be 40 MHz if MCS index > 15");
|
||||
NS_ABORT_MSG_IF(
|
||||
wifiPhyPtr->GetFrequency() != 5190,
|
||||
wifiPhyPtr->GetFrequency() != MHz_u{5190},
|
||||
"Error: Wi-Fi nodes must be tuned to 5190 MHz to match the waveform generator");
|
||||
}
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
auto throughput = 0.0;
|
||||
|
||||
@@ -577,8 +577,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / (datarate * 1e6);
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -586,8 +586,8 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("Interval", TimeValue(Seconds(packetInterval)));
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -600,7 +600,7 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap(ss.str(), apDevice);
|
||||
}
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
double totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
|
||||
@@ -170,8 +170,8 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer serverApp = server.Install(staWifiNode);
|
||||
|
||||
/* Start Applications */
|
||||
sinkApp.Start(Seconds(0.0));
|
||||
serverApp.Start(Seconds(1.0));
|
||||
sinkApp.Start(Seconds(0));
|
||||
serverApp.Start(Seconds(1));
|
||||
Simulator::Schedule(Seconds(1.1), &CalculateThroughput);
|
||||
|
||||
/* Enable Traces */
|
||||
@@ -183,7 +183,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* Start Simulation */
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
auto averageThroughput =
|
||||
|
||||
@@ -131,8 +131,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -140,14 +140,14 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("PacketSize", UintegerValue(1472)); // bytes
|
||||
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
// Populate routing table
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
// Set simulation time and launch simulation
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
// Get and print results
|
||||
|
||||
@@ -77,12 +77,12 @@ struct TxopDurationTracer
|
||||
/**
|
||||
* Callback connected to TXOP duration trace source.
|
||||
*
|
||||
* \param startTime TXOP start time
|
||||
* \param duration TXOP duration
|
||||
* \param linkId the ID of the link
|
||||
* @param startTime TXOP start time
|
||||
* @param duration TXOP duration
|
||||
* @param linkId the ID of the link
|
||||
*/
|
||||
void Trace(Time startTime, Time duration, uint8_t linkId);
|
||||
Time m_max{Seconds(0)}; //!< maximum TXOP duration
|
||||
Time m_max; //!< maximum TXOP duration
|
||||
};
|
||||
|
||||
void
|
||||
@@ -339,8 +339,8 @@ main(int argc, char* argv[])
|
||||
uint16_t port = 9;
|
||||
UdpServerHelper serverA(port);
|
||||
ApplicationContainer serverAppA = serverA.Install(wifiStaNodes.Get(0));
|
||||
serverAppA.Start(Seconds(0.0));
|
||||
serverAppA.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppA.Start(Seconds(0));
|
||||
serverAppA.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientA(StaInterfaceA.GetAddress(0), port);
|
||||
clientA.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -348,13 +348,13 @@ main(int argc, char* argv[])
|
||||
clientA.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppA = clientA.Install(wifiApNodes.Get(0));
|
||||
clientAppA.Start(Seconds(1.0));
|
||||
clientAppA.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppA.Start(Seconds(1));
|
||||
clientAppA.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverB(port);
|
||||
ApplicationContainer serverAppB = serverB.Install(wifiStaNodes.Get(1));
|
||||
serverAppB.Start(Seconds(0.0));
|
||||
serverAppB.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppB.Start(Seconds(0));
|
||||
serverAppB.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientB(StaInterfaceB.GetAddress(0), port);
|
||||
clientB.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -362,13 +362,13 @@ main(int argc, char* argv[])
|
||||
clientB.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppB = clientB.Install(wifiApNodes.Get(1));
|
||||
clientAppB.Start(Seconds(1.0));
|
||||
clientAppB.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppB.Start(Seconds(1));
|
||||
clientAppB.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverC(port);
|
||||
ApplicationContainer serverAppC = serverC.Install(wifiStaNodes.Get(2));
|
||||
serverAppC.Start(Seconds(0.0));
|
||||
serverAppC.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppC.Start(Seconds(0));
|
||||
serverAppC.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientC(StaInterfaceC.GetAddress(0), port);
|
||||
clientC.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -376,13 +376,13 @@ main(int argc, char* argv[])
|
||||
clientC.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppC = clientC.Install(wifiApNodes.Get(2));
|
||||
clientAppC.Start(Seconds(1.0));
|
||||
clientAppC.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppC.Start(Seconds(1));
|
||||
clientAppC.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpServerHelper serverD(port);
|
||||
ApplicationContainer serverAppD = serverD.Install(wifiStaNodes.Get(3));
|
||||
serverAppD.Start(Seconds(0.0));
|
||||
serverAppD.Stop(simulationTime + Seconds(1.0));
|
||||
serverAppD.Start(Seconds(0));
|
||||
serverAppD.Stop(simulationTime + Seconds(1));
|
||||
|
||||
UdpClientHelper clientD(StaInterfaceD.GetAddress(0), port);
|
||||
clientD.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -390,8 +390,8 @@ main(int argc, char* argv[])
|
||||
clientD.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
|
||||
ApplicationContainer clientAppD = clientD.Install(wifiApNodes.Get(3));
|
||||
clientAppD.Start(Seconds(1.0));
|
||||
clientAppD.Stop(simulationTime + Seconds(1.0));
|
||||
clientAppD.Start(Seconds(1));
|
||||
clientAppD.Stop(simulationTime + Seconds(1));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -405,7 +405,7 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap("STA_D", staDeviceD.Get(0));
|
||||
}
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
// Show results
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Author: Sebastien Deronne <sebastien.deronne@gmail.com>
|
||||
*/
|
||||
|
||||
#include "ns3/attribute-container.h"
|
||||
#include "ns3/boolean.h"
|
||||
#include "ns3/command-line.h"
|
||||
#include "ns3/config.h"
|
||||
@@ -29,6 +30,9 @@
|
||||
#include "ns3/yans-wifi-channel.h"
|
||||
#include "ns3/yans-wifi-helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
// This is a simple example in order to show how to configure an IEEE 802.11ac Wi-Fi network.
|
||||
//
|
||||
// It outputs the UDP or TCP goodput for every VHT MCS value, which depends on the MCS value (0 to
|
||||
@@ -58,8 +62,11 @@ main(int argc, char* argv[])
|
||||
bool use80Plus80{false};
|
||||
Time simulationTime{"10s"};
|
||||
meter_u distance{1.0};
|
||||
int mcs{-1}; // -1 indicates an unset value
|
||||
std::string mcsStr;
|
||||
std::vector<uint64_t> mcsValues;
|
||||
std::string phyModel{"Yans"};
|
||||
int channelWidth{-1}; // in MHz, -1 indicates an unset value
|
||||
int guardInterval{-1}; // in nanoseconds, -1 indicates an unset value
|
||||
double minExpectedThroughput{0.0};
|
||||
double maxExpectedThroughput{0.0};
|
||||
|
||||
@@ -71,11 +78,22 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
|
||||
cmd.AddValue("use80Plus80", "Enable/disable use of 80+80 MHz", use80Plus80);
|
||||
cmd.AddValue("mcs", "if set, limit testing to a specific MCS (0-9)", mcs);
|
||||
cmd.AddValue(
|
||||
"mcs",
|
||||
"list of comma separated MCS values to test; if unset, all MCS values (0-9) are tested",
|
||||
mcsStr);
|
||||
cmd.AddValue("phyModel",
|
||||
"PHY model to use (Yans or Spectrum). If 80+80 MHz is enabled, then Spectrum is "
|
||||
"automatically selected",
|
||||
phyModel);
|
||||
cmd.AddValue("channelWidth",
|
||||
"if set, limit testing to a specific channel width expressed in MHz (20, 40, 80 "
|
||||
"or 160 MHz)",
|
||||
channelWidth);
|
||||
cmd.AddValue("guardInterval",
|
||||
"if set, limit testing to a specific guard interval duration expressed in "
|
||||
"nanoseconds (800 or 400 ns)",
|
||||
guardInterval);
|
||||
cmd.AddValue("minExpectedThroughput",
|
||||
"if set, simulation fails if the lowest throughput is below this value",
|
||||
minExpectedThroughput);
|
||||
@@ -108,29 +126,57 @@ main(int argc, char* argv[])
|
||||
<< "short GI"
|
||||
<< "\t\t"
|
||||
<< "Throughput" << '\n';
|
||||
int minMcs = 0;
|
||||
int maxMcs = 9;
|
||||
if (mcs >= 0 && mcs <= 9)
|
||||
uint8_t minMcs = 0;
|
||||
uint8_t maxMcs = 9;
|
||||
|
||||
if (mcsStr.empty())
|
||||
{
|
||||
minMcs = mcs;
|
||||
maxMcs = mcs;
|
||||
for (uint8_t mcs = minMcs; mcs <= maxMcs; ++mcs)
|
||||
{
|
||||
mcsValues.push_back(mcs);
|
||||
}
|
||||
}
|
||||
for (int mcs = minMcs; mcs <= maxMcs; mcs++)
|
||||
else
|
||||
{
|
||||
AttributeContainerValue<UintegerValue, ',', std::vector> attr;
|
||||
auto checker = DynamicCast<AttributeContainerChecker>(MakeAttributeContainerChecker(attr));
|
||||
checker->SetItemChecker(MakeUintegerChecker<uint8_t>());
|
||||
attr.DeserializeFromString(mcsStr, checker);
|
||||
mcsValues = attr.Get();
|
||||
std::sort(mcsValues.begin(), mcsValues.end());
|
||||
}
|
||||
|
||||
int minChannelWidth = 20;
|
||||
int maxChannelWidth = 160;
|
||||
if (channelWidth >= minChannelWidth && channelWidth <= maxChannelWidth)
|
||||
{
|
||||
minChannelWidth = channelWidth;
|
||||
maxChannelWidth = channelWidth;
|
||||
}
|
||||
int minGi = 400;
|
||||
int maxGi = 800;
|
||||
if (guardInterval >= minGi && guardInterval <= maxGi)
|
||||
{
|
||||
minGi = guardInterval;
|
||||
maxGi = guardInterval;
|
||||
}
|
||||
|
||||
for (const auto mcs : mcsValues)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
double previous = 0;
|
||||
for (int channelWidth = 20; channelWidth <= 160;)
|
||||
for (int width = minChannelWidth; width <= maxChannelWidth; width *= 2) // MHz
|
||||
{
|
||||
if (mcs == 9 && channelWidth == 20)
|
||||
if (mcs == 9 && width == 20)
|
||||
{
|
||||
channelWidth *= 2;
|
||||
continue;
|
||||
}
|
||||
const auto is80Plus80 = (use80Plus80 && (channelWidth == 160));
|
||||
const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(channelWidth);
|
||||
const auto is80Plus80 = (use80Plus80 && (width == 160));
|
||||
const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(width);
|
||||
const auto segmentWidthStr = is80Plus80 ? "80" : widthStr;
|
||||
for (auto sgi : {false, true})
|
||||
for (int gi = maxGi; gi >= minGi; gi /= 2) // Nanoseconds
|
||||
{
|
||||
const auto sgi = (gi == 400);
|
||||
uint32_t payloadSize; // 1500 byte IP packet
|
||||
if (udp)
|
||||
{
|
||||
@@ -188,7 +234,7 @@ main(int argc, char* argv[])
|
||||
phy.SetChannel(spectrumChannel);
|
||||
|
||||
phy.Set("ChannelSettings",
|
||||
StringValue("{0, " + std::to_string(channelWidth) + ", BAND_5GHZ, 0}"));
|
||||
StringValue("{0, " + std::to_string(width) + ", BAND_5GHZ, 0}"));
|
||||
|
||||
mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
staDevice = wifi.Install(phy, mac, wifiStaNode);
|
||||
@@ -208,7 +254,7 @@ main(int argc, char* argv[])
|
||||
phy.SetChannel(channel.Create());
|
||||
|
||||
phy.Set("ChannelSettings",
|
||||
StringValue("{0, " + std::to_string(channelWidth) + ", BAND_5GHZ, 0}"));
|
||||
StringValue("{0, " + std::to_string(width) + ", BAND_5GHZ, 0}"));
|
||||
|
||||
mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid));
|
||||
staDevice = wifi.Install(phy, mac, wifiStaNode);
|
||||
@@ -254,8 +300,10 @@ main(int argc, char* argv[])
|
||||
apNodeInterface = address.Assign(apDevice);
|
||||
|
||||
/* Setting applications */
|
||||
const auto maxLoad =
|
||||
VhtPhy::GetDataRate(mcs, channelWidth, NanoSeconds(sgi ? 400 : 800), 1);
|
||||
const auto maxLoad = VhtPhy::GetDataRate(mcs,
|
||||
MHz_u{static_cast<double>(width)},
|
||||
NanoSeconds(sgi ? 400 : 800),
|
||||
1);
|
||||
ApplicationContainer serverApp;
|
||||
if (udp)
|
||||
{
|
||||
@@ -265,8 +313,8 @@ main(int argc, char* argv[])
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
streamNumber += server.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -276,8 +324,8 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
streamNumber += client.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -289,8 +337,8 @@ main(int argc, char* argv[])
|
||||
streamNumber +=
|
||||
packetSinkHelper.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
serverApp.Start(Seconds(0));
|
||||
serverApp.Stop(simulationTime + Seconds(1));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime",
|
||||
@@ -305,13 +353,13 @@ main(int argc, char* argv[])
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
streamNumber += onoff.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
clientApp.Start(Seconds(1));
|
||||
clientApp.Stop(simulationTime + Seconds(1));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Stop(simulationTime + Seconds(1));
|
||||
Simulator::Run();
|
||||
|
||||
auto rxBytes = 0.0;
|
||||
@@ -332,7 +380,7 @@ main(int argc, char* argv[])
|
||||
<< "\t\t\t" << throughput << " Mbit/s" << std::endl;
|
||||
|
||||
// test first element
|
||||
if (mcs == minMcs && channelWidth == 20 && !sgi)
|
||||
if (mcs == minMcs && width == 20 && !sgi)
|
||||
{
|
||||
if (throughput < minExpectedThroughput)
|
||||
{
|
||||
@@ -341,7 +389,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
// test last element
|
||||
if (mcs == maxMcs && channelWidth == 160 && sgi)
|
||||
if (mcs == maxMcs && width == 160 && sgi)
|
||||
{
|
||||
if (maxExpectedThroughput > 0 && throughput > maxExpectedThroughput)
|
||||
{
|
||||
@@ -371,7 +419,6 @@ main(int argc, char* argv[])
|
||||
}
|
||||
index++;
|
||||
}
|
||||
channelWidth *= 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -181,7 +181,7 @@ main(int argc, char* argv[])
|
||||
onoff.SetConstantRate(DataRate("500kb/s"));
|
||||
ApplicationContainer apps = onoff.Install(staNodes[0].Get(0));
|
||||
apps.Start(Seconds(0.5));
|
||||
apps.Stop(Seconds(3.0));
|
||||
apps.Stop(Seconds(3));
|
||||
|
||||
wifiPhy.EnablePcap("wifi-wired-bridging", apDevices[0]);
|
||||
wifiPhy.EnablePcap("wifi-wired-bridging", apDevices[1]);
|
||||
@@ -192,7 +192,7 @@ main(int argc, char* argv[])
|
||||
MobilityHelper::EnableAsciiAll(ascii.CreateFileStream("wifi-wired-bridging.mob"));
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(5.0));
|
||||
Simulator::Stop(Seconds(5));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user