Skip to content

Using 3D obstacle-compliant 3D-mobility models under ns-3.37

Mobility Models for UAV

To facilitate 3D for testing UAV systems, [1] presents different mobility models for the emulation of the movement of a UAV. The GitHub repository[2] contains the complete ns-3 version 3.23 with the implementation of the 3 new mobility models.

These models work in 3 dimensions and allow some 3D obstacles to be present in the simulation. The 3D obstacles are used as internal boundaries, so when nodes collide with them, they act as if they were bouncing off with respect to the rules of the mobility model like in the case of the external boundaries of the simulation.

The core implementation of three different mobility models can be found in the following six files:

  • src/mobility/model/obstacle-gauss-markov-mobility-model.{h,cc}: Gauss-Markov model adapted to comply with obstacles in the scenario.
  • src/mobility/model/random-direction-3d-mobility-model.{h,cc}: Random Direction adapted for three dimensions and obstacles.
  • src/mobility/model/random-walk-3d-mobility-model.{h,cc}: Random Walk adapted for three dimensions and obstacles.

The following figure from[1] explains the 3D movement of one node object with one rectangular obstacle at the centre of the scenario.

Installation

Since the original implementation work of [1] has been presented at [2] and contains a complete ns-3 version 3.23 with the implementation of the 3 new mobility models, those who want to compile that old version of ns-3 can able to compile it under a suitable old version of Linux.

The following is the outline of the procedure to incorporate these three mobility models under the latest versions of ns-3 with CMake support. In this article, we use the ns-3.37 version to demonstrate this installation.

Step 1: Install the suitable version of Linux

If you are planning to install a suitable linux Operating system Under VirtualBox, then you may need to install VistualBox First,

You may install VirtualBox and a suitable version of Linux by doing a procedure like the one explained in the following article[3].

Installing an old Linux under VirtualBox and using Shared Folders.

Step 2: Installing a Suitable Version of ns-3

You may install the ns-3.37 version by following the article[4].

Cmake based ns-3.37 install in Debian 11 chroot Environment

Step 3: Copy the Mobility Model files

Copy the following 6 files from [2] under the folder Your_Home/ns-allinone-3.37/ns-3.37/src/mobility/model

  • src/mobility/model/obstacle-gauss-markov-mobility-model.{h,cc}
  • src/mobility/model/random-direction-3d-mobility-model.{h,cc}
  • src/mobility/model/random-walk-3d-mobility-model.{h,cc}

 

Step4: Edit the CMakeList.txt

/ns-allinone-3.37/ns-3.37/src/mobility/CMakeList.txt

Include the .cc files in SOURCE_FILES section

 

Include the .h files in HEADER_FILES section

Step 5: Recompile ns-3.

If we try to recompile ns-3 with this three mobility models, then possibly we will end up with the following error:

In fact, the authors of this mobility model did few more additions in two other files; but forget to mention it anywhere on the GitHub page. So you need to edit the following files:

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

 

Similarly, we have to correct the following error :

 

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

 

Finally, now the compilation will succeed and will show no errors.

 

Running the Example

All the examples that come with this module were obsolete—I mean, it will be based on some obsolete ns-3 objects—So, to make them work, we have to do a lot of modifications in them.

The following is the NetAnim output of one such example simulation code NetWalkTime.cc. For visualizing the output of this simulation, we have enabled NetAnim feature in that script.

 

 

The following is the gif animation of NetAnim output.

 

We may explore Mobility with some Obstacles in our future article.

 

References:

  1. Regis, Paulo Alexandre and Bhunia, Suman and Sengupta, Shamik, “Implementation of 3d obstacle compliant mobility models for uav networks in ns-3”, Proceedings of the Workshop on ns-3, 2016, https://dl.acm.org/doi/pdf/10.1145/2915371.2915384
  2. https://github.com/regisin/ns-3-obstacles
  3. Installing an old Linux under VirtualBox and using Shared Folders.
  4. Cmake based ns-3.37 install in Debian 11 chroot Environment
WhatsApp Discuss Through WhatsApp