0% found this document useful (0 votes)
9 views6 pages

NETWORK SIMULATION - Group 1's LABWORK 5 Report

Uploaded by

huylq.bi12-200
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

NETWORK SIMULATION - Group 1's LABWORK 5 Report

Uploaded by

huylq.bi12-200
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

I.

Introduction

− This report will cover the design, implementation of labwork 5 and its results. The code will

consider the CSMA/CA protocol used in ad-hoc Wi-Fi networks. Analyze the way the

protocol performs when there are between 2 and 30 nodes in a communication range without

using the RTS/CTS scheme.

− The provided code is a C++ program that simulates a wireless network with a variable

number of nodes, ranging from 2 to 30, using the ns-3 network simulation library. One UDP

Echo Server and a group of UDP Echo Clients make up the simulation, with each client

sending packets to the server at specified times. Then, using the ns-3 Flow Monitor, the

program calculates various network metrics like packet loss rate, throughput, and delay. Each

simulation run's results are saved in an .xml file for later analysis.

II. Designing

− The code is organized into two main parts: the execute function, which sets up and runs a single

simulation, and the main function, which runs a series of simulations with varying numbers of

nodes. The execute function takes three arguments: the number of WiFi nodes in the network,

the interval between packets in milliseconds, and the maximum number of packets each node

sends.

− The WiFi nodes that make up the network can all send and receive packets according to the

802.11p wireless standard. The nodes are arranged in a grid and remain in place for the duration

of the simulation. A UDP echo client application is running on each node, which sends packets

to a UDP echo server application on one of the nodes. Each node sends a certain number of

packets, which are spread out at regular intervals. The results are gathered and saved to an .xml

file after the simulation has finished running for a particular period of time.

− In the execute function, the network is first set up by creating a NodeContainer object

containing the specified number of WiFi nodes, and configuring their positions using the
MobilityHelper class. The WifiHelper, YansWifiPhyHelper, and WifiMacHelper classes are

then used to configure the network's physical and MAC layers. The InternetStackHelper class

is used to configure the IP layer, and the Ipv4AddressHelper class is used to assign IP

addresses to the nodes.

− The UdpEchoClientHelper and ApplicationContainer classes are then used to create and

install a set of UDP echo client applications on each node. The UdpEchoServerHelper and

ApplicationContainer classes are used to create and install a UDP echo server application on

one of the nodes.

− Finally, a FlowMonitor object is created using the FlowMonitorHelper class, and the

simulation is run for a fixed duration using the Simulator class.

− In the main function, a series of simulations are run by calling the execute function with

varying numbers of WiFi nodes. The user can specify the minimum and maximum number of

nodes, the maximum number of packets, the maximum number of packets per second, and the

packet interval. Each simulation's results are saved to an XML output file that can be examined

with the FlowMonitor module in the Parse.py file which we will talk about later.

III. Implementing

- The main function that sets the simulation parameters and executes the execute function for each

number of WiFi nodes in the range specified.

- The UdpEchoClient and UdpEchoServer applications' logging is turned on in the execute function,
and the WiFi network's Request-To-Send/Clear-To-Send (RTS/CTS) mechanism is disabled since the
threshold is set to a high value. After that, it uses the NodeContainer class to create a collection of

nWifi nodes and the MobilityHelper class to arrange them in a grid. The WifiHelper,

YansWifiPhyHelper, and WifiMacHelper classes are used to configure the WiFi network, and the

Ipv4AddressHelper class is used to assign the nodes an IPv4 network.

- The UdpEchoClientHelper and UdpEchoServerHelper classes are used, respectively, to create a

group of nWifi UDP echo clients and a single UDP echo server. The clients are set up to send a
maximum of maxPackets packets, one after the other, to the next node, with a 5 millisecond gap

between each packet. On port 443, the server watches for incoming packets. The

ApplicationContainer class is used to install the applications on the nodes.

- Next, a FlowMonitor is created using the FlowMonitorHelper class, and packet capture is enabled

using the EnablePcapAll method of the YansWifiPhyHelper class.

- The ns-3 Simulator class is used to run the simulation for 25 seconds, and the SerializeToXmlFile

method of the FlowMonitor class is used to serialize the results to an .xml file.

Some challenges that we face during the development:

• Parsing and processing large datasets is intensive and time-consuming.

• Choosing appropriate algorithms and versions of ns-3. We use 2 different versions of ns3 so

some bugs have been encountered.

IV. Data Collection

− File parse.py will collect information to sketch diagrams. Diagram will show us the results

− Firstly, the “FiveTuple” class has five properties that represent the five-tuple values of a

network packet. These values are the source and destination IP addresses, the network

protocol, and the source and destination ports.

− Secondly, the “Histogram” class has three properties: bin, nbins and number_of_flows. The

bins property is a list of tuples, where each tuple represents a histogram bin with start, width,

and count values. The nbins property is the number of histogram bins, and the

number_of_flows property is the total number of flows in the histogram.

− Next, the “Flow” class has several properties that represent different aspects of network

traffic flow. These properties include flow ID, delay mean, packet loss ratio, receive and

transmit bitrates, five-tuple information, packet size mean, hop count, flow interruptions

histogram and receive duration.

− Finally, the code imports some modules like sys, os, and matplolib.pyplot to sketch the

diagrams.
V. Results

- From the data collected, we can see that there has been some variation in the result between runs.

This occurs due to the change of max number of packets. Albeit, all the graphs still follow similar

trends.

1. Max packet loss ratio

2. Mean delay

3. Packet loss ratio:

4. Rx bitrate

5. Tx bitrate
In the third case of each of these categories, we change the max number of packets to 30 (down from

100). On the one hand, the rate in the 4 and 5 categories seems to resemble each other, higher rate at

small number of nodes then drops at 5 nodes and increases gradually. On the other hand, in the other

categories, the difference between having 30 and 100 packets is more visible.

VI. Conclusion

This report gives a general overview of labwork 5, which uses the ns-3 network simulation library to

simulate a wireless network with a variable number of nodes. Without using the RTS/CTS scheme,

the simulation relies on the CSMA/CA protocol in ad-hoc Wi-Fi networks and examines how it

operates when there are 2 to 30 nodes within a communication range.The code is divided into two

main parts: the main function runs a series of simulations with different numbers of nodes. Processing

large datasets and deciding on the right algorithms and ns-3 versions were the main development

challenges. The "parse.py" file is used in the data collection to gather and analyze network metrics,

such as packet loss rate, throughput, and mean delay.

You might also like