22#include "ns3/applications-module.h"
23#include "ns3/core-module.h"
24#include "ns3/internet-module.h"
25#include "ns3/ipv6-routing-table-entry.h"
26#include "ns3/ipv6-static-routing-helper.h"
27#include "ns3/network-module.h"
28#include "ns3/point-to-point-module.h"
29#include "ns3/tcp-header.h"
30#include "ns3/traffic-control-module.h"
43std::string
dir =
"MixTraffic/";
48 double qSize = queue->GetCurrentSize().GetValue();
52 std::ofstream fPlotQueue(
dir + queue_disc_type +
"/queueTraces/queue.plotme",
53 std::ios::out | std::ios::app);
67 for (uint8_t i = 0; i < 5; i++)
71 dir + queue_disc_type +
"/cwndTraces/S1-" + std::to_string(i + 1) +
".plotme");
73 "/$ns3::TcpL4Protocol/SocketList/0/CongestionWindow",
83 std::string queue_disc = std::string(
"ns3::") + queue_disc_type;
85 std::string bottleneckBandwidth =
"10Mbps";
86 std::string bottleneckDelay =
"50ms";
88 std::string accessBandwidth =
"10Mbps";
89 std::string accessDelay =
"5ms";
116 internet.InstallAll();
132 for (uint8_t i = 0; i < 5; i++)
134 devices[i] = accessLink.
Install(tcpSender.
Get(i), gateway.
Get(0));
140 tchPfifo.
Install(devices_sink);
147 devices_gateway = bottleneckLink.
Install(gateway.
Get(0), gateway.
Get(1));
152 address.SetBase(
"10.0.0.0",
"255.255.255.0");
161 for (uint8_t i = 0; i < 5; i++)
163 address.NewNetwork();
164 interfaces[i] = address.Assign(devices[i]);
167 for (uint8_t i = 0; i < 2; i++)
169 udpdevices[i] = accessLink.
Install(udpSender.
Get(i), gateway.
Get(0));
170 address.NewNetwork();
171 udpinterfaces[i] = address.Assign(udpdevices[i]);
174 address.NewNetwork();
175 interfaces_gateway = address.Assign(devices_gateway);
177 address.NewNetwork();
178 interfaces_sink = address.Assign(devices_sink);
182 uint16_t
port = 50000;
183 uint16_t port1 = 50001;
237 std::string dirToSave =
"mkdir -p " +
dir + queue_disc_type;
238 if (system((dirToSave +
"/cwndTraces/").c_str()) == -1 ||
239 system((dirToSave +
"/queueTraces/").c_str()) == -1)
252main(
int argc,
char** argv)
254 std::cout <<
"Simulation with COBALT QueueDisc: Start\n" << std::flush;
256 std::cout <<
"Simulation with COBALT QueueDisc: End\n" << std::flush;
257 std::cout <<
"------------------------------------------------\n";
258 std::cout <<
"Simulation with CoDel QueueDisc: Start\n";
260 std::cout <<
"Simulation with CoDel QueueDisc: End\n";
a polymophic address class
AttributeValue implementation for Address.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container.
Manage ASCII trace files for device models.
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
AttributeValue implementation for Boolean.
A helper to make it easier to instantiate an ns3::BulkSendApplication on a set of nodes.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes, not the socket attributes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::BulkSendApplication on each node of the input container configured with all the attri...
Class for representing data rates.
AttributeValue implementation for DataRate.
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.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
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.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
NetDeviceContainer Install(NodeContainer c)
Smart pointer class similar to boost::intrusive_ptr.
Holds a vector of ns3::QueueDisc pointers.
Ptr< QueueDisc > Get(std::size_t i) const
Get the Ptr<QueueDisc> stored in this container at a given index.
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 EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
static TypeId GetTypeId()
Get the type ID.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
AttributeValue implementation for Time.
Build a set of QueueDisc objects.
QueueDiscContainer Install(NetDeviceContainer c)
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.
void AddInternalQueues(uint16_t handle, uint16_t count, std::string type, Args &&... args)
Helper function used to add the given number of internal queues (of the given type and with the given...
AttributeValue implementation for TypeId.
static TypeId GetTypeId()
Get the type ID.
Hold an unsigned integer type.
void CheckQueueSize(Ptr< QueueDisc > queue, std::string queue_disc_type)
void experiment(std::string queue_disc_type)
static void TraceCwnd(std::string queue_disc_type)
static void CwndTrace(Ptr< OutputStreamWrapper > stream, uint32_t oldCwnd, uint32_t newCwnd)
void SetDefault(std::string name, const AttributeValue &value)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< PacketSink > sink
Pointer to the packet sink application.