$29.99
EECE5155: Wireless Sensor Networks and the Internet of Things
Computer Laboratory Assignment 2
Part 1: Wi-Fi Networks
In the first part of this laboratory assignment, you will work on the simulation of WiFi Networks:
• Before starting, you need to read Section 6.3 in the ns-3 Tutorial available in Additional Reading
Materials folder in Canvas (Module L2)
• Note that here are three models available for WiFi MAC, namely, Access Point (AP)
(ns3::ApWifiMac), non-AP Station (STA) (ns3::StaWifiMac), and Ad hoc network
(ns3::AdhocWifiMac).
Task 1: Wireless Local Area Network – Ad-hoc Mode
Define a Wireless Local Area Network (WLAN) operating in Ad-hoc Mode with 5 nodes. Nodes move by
following a 2D random walk in a rectangular area defined by the lower-left corner (x=-90 m, y=-90 m) and
the upper-right corner (x=90 m, y=90 m). Consider the following specifications:
• Channel: Default wireless channel in ns-3
• Physical Layer:
o Default parameters in IEEE 802.11G standard
o Adaptive rate control given by the AARF algorithm (default)
• Link Layer:
o Standard MAC without quality of service control
o Remember: the network should operate in ad-hoc mode
• Network Layer:
o Standard IPv4
o Address range: 192.168.1.0/24
o Assume that all the nodes behave as ideal routers and can exchange their routing tables
in the background
• Transport Layer:
o UDP
• Application Layer:
o UDP Echo Server at Node 0:
Listening on port 20
o UDP Echo Client at Node 4:
Sends 2 UDP Echo packets to the server at times 1s and 2s
o UDP Echo Client at Node 3:
Sends 2 UDP Echo packets to the server at times 2s and 4s
o Packet size: 512 bytes
• Additional parameters:
o Set up a packet tracer ONLY on node 2
Answer the following questions:
• Are all the frames acknowledged? Explain why.
• Are there any collisions in the network? Explain why. How have you reached this conclusion?
• How can you force the nodes to utilize the RTS/CTS handshake procedure seen in class? What
is the reasoning behind this procedure?
• Force the utilization of RTS/CTS in the network:
o Are there any collisions now?
o Which is the benefit or RTS/CTS?
o Where can you find the Network Allocation Vector information?
3/5
Task 2: Wireless LAN – Infrastructure Mode
Define a Wireless Local Area Network (LAN) operating in Infrastructure Mode with 5 nodes and access
point. Nodes move by following a 2D random walk in a rectangular area defined by the lower-left corner
(x=-90 m, y=-90 m) and the upper-right corner (x=90 m, y=90 m). The network name (SSID) should be
EECE5155. To start, do not force the handshaking process. Consider the following specifications:
• Channel: Default wireless channel in ns-3
• Physical Layer:
o Default parameters in IEEE 802.11G standard
o Adaptive rate control given by the AARF (default)
• Link Layer:
o Standard MAC without quality of service control
o Remember: the network should operate in infrastructure mode
• Network Layer:
o Standard IPv4
o Address range: 192.168.2.0/24
o Assume that all the nodes behave as ideal routers and can exchange their routing tables
in the background
• Transport Layer:
o UDP
• Application Layer:
o UDP Echo Server at Node 0:
Listening on port 21
o UDP Echo Client at Node 3:
Sends 2 UDP Echo packets to the server at times 2s and 4s
o UDP Echo Client at Node 4:
Sends 2 UDP Echo packets to the server at times 1s and 4s
o Packet size: 512 bytes
• Additional parameters:
o Set up a packet tracer ONLY on node 4(one of the clients) and on the AP.
Answer the following questions:
• Explain the behavior of the APs. What is happening since the very first moment the network starts
operating?
• Take a look to a beacon frame. Which are the most relevant parameters defined in it?
• Are there any collisions in the network? When are these collisions happening?
• As in Task 1, force the utilization of the handshaking process and repeat the simulation. Are there
any collisions now? Explain why.
4/5
Part 2: LoRaWAN Networks
In this part, we are going to simulate a LoRaWAN network. For this, you need to install an additional
extension to ns-3. Two options:
• Option 1: If you are using the virtual machine (VM) provided in the class, proceed with the
following steps:
o Start the VM and open the terminal
o Type the following commands:
cd source/ns-3.31
git clone https://github.com/signetlabdei/lorawan src/lorawan
./waf configure --enable-tests --enable-examples
(ignore any errors/warnings)
./waf build
./test.py -s lorawan
At this point, you have successfully installed the extension.
• Option 2: If you have created your own ns-3 custom installation, follow the developers
instructions here: https://github.com/drakkar-lig/lora-ns3-module/blob/master/README.md
Task 3:
In this last task, we are going to simulate a LoRaWAN network with 1 gateway and 6 end devices.
Proceed as follows:
• Open the terminal and navigate to your ns-3.31 folder (e.g., cd source/ns-3.31 if you are using the
class VM).
• Copy one of the LoRaWAN extension examples:
cp src/lorawan/examples/parallel-reception-example.cc scratch/mylora.cc
• Run the mylora.cc without changing anything:
./waf --run=mylora
• By looking both at the terminal output as well as the source code in mylora.cc, answer the
following questions:
o How many packets are sent in this network in total?
o How many simultaneous packets are sent in this network?
o If more than one, are there any collisions?
If yes, explain how you have reached this conclusion.
If no, explain how this is possible.
o What is the duration of each packet?
• Edit your mylora.cc to force all the users to use the same spreading factor (e.g., SF7).
o What is now the result?
5/5
Submission materials:
Prepare a report with the following materials:
• Task 1:
o Experimental setup: Explain the key lines of your code that you have modified to
implement the specific network.
o Results: Comment and include a screenshot of the packet traces in Wireshark and the
simulation results(if any).
o Answer the questions at the end of Task 1.
• Task 2:
o Experimental setup: Explain the key lines of your code that you have modified to
implement the specific network.
o Results: Comment and include a screenshot of the packet traces in Wireshark and the
simulation results(if any).
o Answer the questions at the end of Task 2.
• Task 3:
o Experimental setup: explain the general structure of the provided file
o Answer the questions at the end of Task 3.
In your submission, include also your modified .cc files. Please follow the Report template under the Module
L1 for the final report submission.