Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

NS3 Simulation of 802.11 CSMA/CA MAC

0. Overview

In this project, we aim to study the saturation throughput in an IEEE 802.11 network that uses   CSMA/CA with binary exponential backoff to avoid collisions (also referred to as DCF). You are required to simulate a specific wireless transmission scenario in NS-3: a network simulator.

Submit the comparison plots and explain the trends you observe and describe (in sufficient

detail) your implementation. Code (including comments) does not count as a description and

hence do not include your code files in the report. All code files and the electronic report should be submitted online via blackboard. Finally, please make sure that your code works with the

NS-3 installation on the provided virtual machine.

VM Info:

●    User: ee597

●    Password: ee597

1. Environment

Please use the virtual box software to run the provided virtual machine image (ubuntu 18.04),  which has ns-3 preinstalled in ~/ns-3-allinone/. If you have an ubuntu 18.04 system and prefer to code in your native environment, please make sure to test in vm before final submission. To get familiar with the development environment, please study the following examples

   ~/ns-3-allinone/ns-3-dev/examples/wireless/wifi-pcf.cc

   ~/ns-3-allinone/ns-3-dev/examples/wireless/wireless-ad-hoc.cc

●   ~/ns-3-allinone/ns-3-dev/examples/tutorial/third.cc (a description of this tutorial can be found here)

To compile and run the example, please run the following command in the ns-3 root directory ●    ./waf --run "wifi-simple-adhoc --rss=-97 --numPackets=20"

●    ./waf --run "wifi-simple-adhoc --rss=-98 --numPackets=20"

●    ./waf --run "wifi-simple-adhoc --rss=-99 --numPackets=20"

Drop your script into the scratch directory and it will automatically build and run with Waf ●    ./waf --run yourscript.cc

There are many more ns3 tutorials online if you need further studies.

2. NS-3 Simulation

Scenario: use the default setting for the PHY layer in NS-3 to set up the following scenario:

●    Place a node in the terrain to act as the common receiver.

●    Place N wireless transmitter nodes uniformly in the terrain such that all the nodes are within the radio range of each other and that of the common receiver.

●   Set up a constant bit rate (CBR) traffic of rate R Mbits/sec from each of the N nodes to   the receiver. Use a packet size of 512 bytes. See the OnOffApplication class in NS-3 for details on how to set up CBR traffic.

●   Assuming that each transmitter node always has packets to send, simulate packet transmissions long enough to get good estimates of the throughput.

Consider 2 cases:

●   Case A: minimum backoff window size as 1 and maximum backoff window size as 1023 units of slot times.

●   Case B: minimum backoff window size as 63 and maximum backoff window size as 127 units of slot times.

●    Tips: changing the contention window may require changes in the ns3 source code. Please don’t hesitate to do so if necessary. In fact, reading and changing the source code maybe the easiest way out. You might need to play around with wifi-phy.cc, txop.cc, wifi-helper.h (all in the ~/ns-3-allinone/ns-3-dev/src/wifi/ directory)

For each case,

●    E1: Increase the offered load by increasing the number of nodes N: Set the data rate to a reasonable value and vary the number of nodes N and calculate the throughput at the receiver for each value of N.

●    E2: Increase the offered load by increasing the data rate: Keep the number of nodes fixed at 20 and vary R in sufficiently fine granularity.

3. Evaluation

Metrics (averaged over several runs):

   Total throughput (Throughput v.s. N in E1, and Throughput v.s. R in E2)

●    Per-node throughput

●    [optional] Average backoff time slots per transmission

●    [optional] Collision rate: how many attempts of transmission are failing. Evaluation

●    Case A E1

●    Case A E2

●    Case B E1

●    Case B E2

Discussion

●    Please discuss your results with respect to different case configurations and use any visualization tool to analyze the different throughput case data points you obtain in the CSV using ns3 simulator if you [Note: Visualization makes you see the pattern in the throughput saturation, however, explaining your data set for the above cases using the CSV you generate will also be considered. But preferably plot it out using MATLAB/Python/R or any tool].

5. Submission

●    Please submit your report of all evaluations as a pdf,  and code as a zip file through Blackboard. Please provide a readme file to run your code.

●    For code, you can make one common lab1.cc file that is used to run all the NS-3

simulations in the three steps,including CaseA E1, CaseA E2, CaseB E1, and CaseB E2.

●   Hint: You can use Lab1Run.sh: a bash script that runs lab1.cc and passes all the needed command line arguments to accomplish all the required simulations.

6. Rubric (100 pt)

●    (22 pt) Case A E1

○    (10 pt) Throughput v.s. N

○    (10 pt) Per-node throughput v.s. N

●    (22 pt) Case A E2

○    (10 pt) Throughput v.s. R

○    (10 pt) Per-node throughput v.s. R

●    (22 pt) Case B E1

○    (10 pt) Throughput v.s. N

○    (10 pt) Per-node throughput v.s. N

●    (22 pt) Case B E2

○    (10 pt) Throughput v.s. R

○    (10 pt) Per-node throughput v.s. R

●    (12 pt) Discussion

●    (Bonus 5 pt) Mean and variance of backoff time slots per transmission v.s. N/R

●    (Bonus 5 pt) Collision rate v.s. N/R