82#include "ns3/applications-module.h"
83#include "ns3/core-module.h"
84#include "ns3/internet-module.h"
85#include "ns3/network-module.h"
86#include "ns3/point-to-point-module.h"
87#include "ns3/traffic-control-module.h"
109 std::cout <<
"Progress to " << std::fixed << std::setprecision(1)
135 for (std::size_t
i = 0;
i < 10;
i++)
139 for (std::size_t
i = 0;
i < 20;
i++)
143 for (std::size_t
i = 0;
i < 10;
i++)
152 for (std::size_t
i = 0;
i < 10;
i++)
158 for (std::size_t
i = 0;
i < 20;
i++)
164 for (std::size_t
i = 0;
i < 10;
i++)
180 for (std::size_t
i = 0;
i < 10;
i++)
187 fairnessIndex <<
"Average throughput for S1-R1 flows: " << std::fixed << std::setprecision(2)
188 <<
average <<
" Mbps; fairness: " << std::fixed << std::setprecision(3)
194 for (std::size_t
i = 0;
i < 20;
i++)
201 fairnessIndex <<
"Average throughput for S2-R2 flows: " << std::fixed << std::setprecision(2)
202 <<
average <<
" Mbps; fairness: " << std::fixed << std::setprecision(3)
208 for (std::size_t
i = 0;
i < 10;
i++)
215 fairnessIndex <<
"Average throughput for S3-R1 flows: " << std::fixed << std::setprecision(2)
216 <<
average <<
" Mbps; fairness: " << std::fixed << std::setprecision(3)
219 for (std::size_t
i = 0;
i < 10;
i++)
223 for (std::size_t
i = 0;
i < 20;
i++)
227 fairnessIndex <<
"Aggregate user-level throughput for flows through T1: "
228 <<
static_cast<double>(
sum * 8) / 1
e9 <<
" Gbps" << std::endl;
230 for (std::size_t
i = 0;
i < 10;
i++)
234 for (std::size_t
i = 0;
i < 10;
i++)
238 fairnessIndex <<
"Aggregate user-level throughput for flows to R1: "
239 <<
static_cast<double>(
sum * 8) / 1
e9 <<
" Gbps" << std::endl;
250 <<
qSize <<
" " <<
backlog.GetMicroSeconds() << std::endl;
262 <<
qSize <<
" " <<
backlog.GetMicroSeconds() << std::endl;
279 cmd.AddValue(
"tcpTypeId",
"ns-3 TCP TypeId",
tcpTypeId);
280 cmd.AddValue(
"flowStartupWindow",
281 "startup time window (TCP staggered starts)",
338 std::vector<NetDeviceContainer>
S1T1;
340 std::vector<NetDeviceContainer>
S2T1;
342 std::vector<NetDeviceContainer>
S3T2;
344 std::vector<NetDeviceContainer>
R2T2;
349 for (std::size_t
i = 0;
i < 10;
i++)
354 for (std::size_t
i = 0;
i < 20;
i++)
359 for (std::size_t
i = 0;
i < 10;
i++)
364 for (std::size_t
i = 0;
i < 20;
i++)
400 for (std::size_t
i = 0;
i < 10;
i++)
404 for (std::size_t
i = 0;
i < 20;
i++)
408 for (std::size_t
i = 0;
i < 10;
i++)
412 for (std::size_t
i = 0;
i < 20;
i++)
418 std::vector<Ipv4InterfaceContainer>
ipS1T1;
420 std::vector<Ipv4InterfaceContainer>
ipS2T1;
422 std::vector<Ipv4InterfaceContainer>
ipS3T2;
424 std::vector<Ipv4InterfaceContainer>
ipR2T2;
426 address.SetBase(
"172.16.1.0",
"255.255.255.0");
428 address.SetBase(
"192.168.0.0",
"255.255.255.0");
430 address.SetBase(
"10.1.1.0",
"255.255.255.0");
431 for (std::size_t
i = 0;
i < 10;
i++)
436 address.SetBase(
"10.2.1.0",
"255.255.255.0");
437 for (std::size_t
i = 0;
i < 20;
i++)
442 address.SetBase(
"10.3.1.0",
"255.255.255.0");
443 for (std::size_t
i = 0;
i < 10;
i++)
448 address.SetBase(
"10.4.1.0",
"255.255.255.0");
449 for (std::size_t
i = 0;
i < 20;
i++)
458 std::vector<Ptr<PacketSink>>
r2Sinks;
460 for (std::size_t
i = 0;
i < 20;
i++)
462 uint16_t
port = 50000 +
i;
473 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"));
475 StringValue(
"ns3::ConstantRandomVariable[Constant=0]"));
492 for (std::size_t
i = 0;
i < 20;
i++)
494 uint16_t
port = 50000 +
i;
512 StringValue(
"ns3::ConstantRandomVariable[Constant=1]"));
514 StringValue(
"ns3::ConstantRandomVariable[Constant=0]"));
541 fairnessIndex.open(
"dctcp-example-fairness.dat", std::ios::out);
542 t1QueueLength.open(
"dctcp-example-t1-length.dat", std::ios::out);
543 t1QueueLength <<
"#Time(s) qlen(pkts) qlen(us)" << std::endl;
544 t2QueueLength.open(
"dctcp-example-t2-length.dat", std::ios::out);
545 t2QueueLength <<
"#Time(s) qlen(pkts) qlen(us)" << std::endl;
546 for (std::size_t
i = 0;
i < 10;
i++)
550 for (std::size_t
i = 0;
i < 20;
i++)
554 for (std::size_t
i = 0;
i < 10;
i++)
a polymophic address class
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
AttributeValue implementation for Boolean.
Parse command-line arguments.
Class for representing data rates.
AttributeValue implementation for DataRate.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static Ipv4Address GetAny()
static void PopulateRoutingTables()
Build a routing database and initialize the routing tables of the nodes in the simulation.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
Receive and consume traffic generated to an IP address and port.
Build a set of PointToPointNetDevice objects.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::QueueDisc pointers.
Class for representing queue sizes.
AttributeValue implementation for QueueSize.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Build a set of QueueDisc objects.
uint16_t SetRootQueueDisc(const std::string &type, Args &&... args)
Helper function used to set a root queue disc of the given type and with the given attributes.
Hold an unsigned integer type.
void TraceS1R1Sink(std::size_t index, Ptr< const Packet > p, const Address &a)
std::ofstream rxS3R1Throughput
std::ofstream fairnessIndex
std::ofstream t1QueueLength
std::vector< uint64_t > rxS3R1Bytes
std::stringstream filePlotQueue1
void PrintFairness(Time measurementWindow)
void InitializeCounters()
void TraceS2R2Sink(std::size_t index, Ptr< const Packet > p, const Address &a)
std::vector< uint64_t > rxS2R2Bytes
void PrintThroughput(Time measurementWindow)
void CheckT1QueueSize(Ptr< QueueDisc > queue)
void PrintProgress(Time interval)
std::stringstream filePlotQueue2
std::ofstream rxS2R2Throughput
void TraceS3R1Sink(std::size_t index, Ptr< const Packet > p, const Address &a)
std::vector< uint64_t > rxS1R1Bytes
std::ofstream rxS1R1Throughput
std::ofstream t2QueueLength
void CheckT2QueueSize(Ptr< QueueDisc > queue)
void SetDefault(std::string name, const AttributeValue &value)
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.