Skip to content

Simulation and Analysis of IoT LoRaWAN Networks Under ns-3

LoRa (“long range”) is a proprietary low-power wide-area network modulation technique  based on spread-spectrum modulation techniques derived from chirp spread spectrum (CSS) technology.

It was developed by Cycleo, a company of Grenoble, France, later acquired by Semtech, which is the founding member of the LoRa Alliance. LoRa enables long-range transmissions with low power consumption and covers the physical layer, while other technologies and protocols such as LoRaWAN (Long Range Wide Area Network) cover the upper layers[1].

LoRa

 

One of the key parameters of the LoRa modulation is the Spreading Factor (SF): this value, ranging from 7 to 12, expresses how much a packet is spread in time (i.e., how long it takes for a chirp to complete a complete scan of the available bandwidth).

Transmissions using a low SF need a lower Time on Air (ToA) (assuming the same bandwidth) than packets using SF values closer to 12. The advantage of using higher SFs is in the increased sensitivity of the receiver. Transmission using SF7 that cannot be detected by a LoRa receiver may be correctly demodulated if performed using SF12.

Another key feature of the modulation is the quasi-orthogonality between transmissions using different SF values: even if two packets overlap in time, a receiver may still be able to demodulate one of the packets, assuming that they are using different SF and that some restrictions on their reciprocal power are respected[4].

LoRaWAN

The LoRa Alliance first defined the LoRaWAN standard with the objective of creating a medium access scheme and a set of network management policies that leverage the properties of the modulation to achieve good network performance at a low price in the complexity of the devices[4].

There will be three kinds of devices in a LoRaWAN network: End Devices (EDs), Gateways (GWs) and a Network Server (NS). End Devices are basic network nodes: typically inexpensive, they are constrained by low computational capabilities and are usually powered by a battery.

Gateways are high-end, mains powered devices that are tasked with collecting the data transmitted by End Devices leveraging the LoRa modulation. After a packet is correctly received, it is forwarded to the Network Server via a link with high reliability and speed. The Network Server functions as a sink for data coming from all devices, and as a controller of the network that can leverage some MAC commands to change transmission settings in the End Devices[4].

End Devices of the most basic type are defined as Class A devices, and are currently the only kind of device supported by this module. Class A devices perform transmission in a totally asynchronous way, and open two receive windows of fixed duration after each transmission to allow the Network Server to transmit acknowledgments or MAC commands[4].

Another important characteristic of the standard is that it is defined to work on unlicensed bands in various regions, which usually subject transmitters to regulations on duty cycle. This fact will be explained in greater detail in the MAC layer model section of this document[4].

LoRaWAN ns-3 module[3]

This is an ns-3 module that can be used to perform simulations of a LoRaWAN network. This module was developed by Davide Magrin and Martina Capuzzo of the Signet Lab at University of Padova’s Department of Information Engineering, under the supervision of Lorenzo Vangelista, Marco Centenaro, Andrea Zanella and Michele Zorzi.

This module contains a series of classes and examples aimed at modeling the modulation and medium access technology of a LoRaWAN network. Thanks to a simple underlying physical layer model and to the regulations imposed on traffic in the unlicensed bands this technology operates on, this module can support simulations featuring a large number of devices that access the wireless channel infrequently.

Aside from models representing the various components of the network and helpers to set them up, the module comes with a packet tracker that monitors network performance, and with facilities that print the network topology to file for easy debugging and simulation monitoring. Various examples ranging from simple to complex network configurations are also provided[2]. 

Features of  LoRaWAN ns-3 module [2]

Current features include:

  • Support for Class A devices
  • Network Server Implementation
    • ADR
    • Confirmed messages
    • Multi-GW support
  • Urban propagation models
  • Realistic GW chip model
  • Energy model integration

Installing LoRaWAN ns-3 Module Under ns-3.35

 

Step 1: Install ns-3.35 using the following procedure or any other procedure of your choice.

Installing ns3.35 in Debian 10 chroot Jail Under Debian 11 Host OS or any Version of Linux Host

Installing ns3.35 in Debian 10 chroot Jail Under Debian 11 Host OS or any Version of Linux Host

 

Step 2: Cloning the LoRaWAN ns-3 Module from GitHub

 
#change to the src folder of your ns-3 installation
$ cd ./ns-allinone-3.35/ns-3.35/src

#Clone the project from GitHub
$ git clone https://github.com/signetlabdei/lorawan ./lorawan

The above command will create a folder “lorawan” under the “src” directory and clone the LoRaWAN project in it.
 
The following screenshot shows the successful cloning:

Step 3: Configuring waf make system

 
#change to the ns-3.35 folder
$ cd ./ns-allinone-3.35/ns-3.35/

#Configure Waf
$ ./waf  configure –enable-examples

The above command will configure the make system and produce output like the below one on success.

Step 4: Compiling ns-3

 
#compile ns-3
$ ./waf  
The above command will compile ns-3 with the newly added LoRaWAN Module and produce output like the below one on success.

Testing the LoRaWAN ns-3 Module

Testing the installation by running simple-network-example.cc example.
 
$ ./waf –run simple-network-example
The following screenshot shows the successful run of the simulation and hence proves the good working of the newly installed LoRaWAN ns-3 module.
 
 

Running the ADR Example

 
The following command will run the Adaptive Data Rate Algorithm (ADR) example simulation.  This program creates a simple network that uses an ADR algorithm to set up the Spreading Factors (SF) of the devices in the Network.

 
$ ./waf –run adr-example
This will run the 24000-second simulation and the following screenshot shows the successful run of the simulation.

 

Sorry!!!. Some sections are hidden; because, you are only having restricted access to this article.

While getting paid support/assistance for your research from Charles, you may get an access key/password to some articles. If you are having the access key/password to this particular article, then please enter it below to unlock the restricted section of this article.

If your research is related to this area, and you want to get paid support/assistance from Charles, then you may start a 'free' research discussion with Charles.

 

Ok. To understand the way of generating the following NetAnim output of that example scenario, one should answer the following questions:

Sorry!!!. Some sections are hidden; because, you are only having restricted access to this article.

While getting paid support/assistance for your research from Charles, you may get an access key/password to some articles. If you are having the access key/password to this particular article, then please enter it below to unlock the restricted section of this article.

If your research is related to this area, and you want to get paid support/assistance from Charles, then you may start a 'free' research discussion with Charles.

 

One may think that creating and using  NetAnim output is not at all needed for research-level work. But while experimenting with several topologies, I didn’t get the correct PDR for one particular topology.  After a lot of effort only, I found the “logical error” that I made in that particular topology. It was related to the automated placing of the WS nodes and their locations- I was able to find that mistake only while visualizing the scenario under NetAnim.

The Animation of the Above Network  

The following is the gif animated video of the same example scenario. In the following output also the GW nodes are not correctly getting rendered.  We have to use a suitable image to represent the GW node.


Simulation of a simple LoRaWan Network with Static IoT-EDs

The following is the output of the same example script (with a little bit of modification). In this, we use only one GW node and now the GW node is getting rendered correctly with a suitable image.

 

Simulation of a simple LoRaWan Network with Mobile IoT-EDs

The following is the output of the same example script (with a little further modification). In this, we make the LoT-EDs to move – so that making it as a Mobile LoRaWAN network.

 

Energy Consumption  in LoRaWan Network with 50 IoT-EDs

The following screenshot shows the Energy Consumed by the 50 IoT EDs at the end of the 1200 second simulation.

 

The following Gnuplot Shows the Energy Consumption over time in ED(0).

The following Gnuplot Shows the Comparison  of Energy Consumption over time in ED(0) and ED(1).

References:

  1. https://en.wikipedia.org/wiki/LoRa
  2. https://apps.nsnam.org/app/lorawan/
  3. https://github.com/signetlabdei/lorawan
  4. https://signetlabdei.github.io/lorawan-docs/models/build/html/lorawan.html
  5. Network level performances of a LoRa system (Master thesis).
  6. D. Magrin, M. Capuzzo and A. Zanella, “A Thorough Study of LoRaWAN Performance Under Different Parameter Settings,” in IEEE Internet of Things Journal. 2019.

For Assistance in Protocol Implementation, Simulations & Analysis of Industrial as well as Scholarly Research Works, you may Contact Us.

WhatsApp chatDiscuss Through WhatsApp

Call 91 9843779735

Send an e-Mail Message.




This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.

WhatsApp Discuss Through WhatsApp