This article explains the steps involved in interfacing the VANETs toolbox of NetSim with MATLAB with an example.


In this example, we have tried to cover the following type of communication

  • V2V Communication

  • V2I Communication

  • V2X Communication 

  • UAV-to-UAV Communication

  • UAV-to-Ground Station Communication


Applicable Version   NetSim Standard  NetSim Pro


Applicable Release v13.0 / v13.1 / v13.2


MATLAB Version2020b (UAV Toolbox)


Introduction:


NetSim has a variety of Mobility models in infrastructure-less network toolboxes. Especially in VANETs, NetSim interfaces with the third-party tool (SUMO) Simulation of Urban Mobility for road traffic simulation, whereas vehicle to vehicle (V2V) or vehicle to Infrastructure communication is simulated in NetSim.


In this example, we are interfacing NetSim with MATLAB for UAV Drone simulation and simulating the communication between UAV to UAV or UAV to Vehicle or UAV to Ground Station in NetSim. 


NetSim Scenario:



Configuration Properties in NetSim

  • Created 4 application 
    • Vehicle to Vehicle (V2V)
    • Vehicle to Infrastructure (V2I) - RSU(Road Side Units are considered to be RSU)
    • Vehicle to UAV 
      • Vehicles following SUMO Simulation
      • UAV following MATLAB Simulation
    • UAV to UAV
      • Both UAVs are interfacing with MATLAB Simulation
Note :

Please refer VANET Technology library and VANET Knowledge Base for how to interface VANET with SUMO. This article is only focused on how to interface with MATLAB


Steps involved in interfacing VANET with MATLAB Module:


Upon interfacing NetSim with MATLAB the following tasks are performed during the simulation start:

  • MATLAB Engine process is initialized
  • MATLAB Desktop window is loaded
  • UAV SIMULINK Model is loaded

Upon simulating a network created in NetSim the following tasks are performed periodically:

  • SIMULINK Model is simulated
  • SIMULINK Model is paused
  • NetSim reads the data generated by SIMULINK from the MATLAB workspace
  • Appends the readings to the packet payload as packets are formed


During the Simulation, the SIMULINK Model is started and paused several times for NetSim and SIMULINK simulations to run synchronously. The X, Y, and Z coordinates obtained from SIMULINK are read from the MATLAB workspace and given as input to NetSim's Mobility model. In this example, coordinates are taken every second and updated to the UAV device's mobility. 


Project Download Link:  


NetSim v13.1 (Market Release) 


Follow the instructions specified in the following link to download and set up the project in NetSim: https://support.tetcos.com/en/support/solutions/articles/14000128666-downloading-and-settingup-netsim-file-exchange-projects


Running VANET-MATLAB Interfacing project:


  • Back up of Property.xml file and replace it with the one attached in the downloaded project. The location of Property.xml looks like this: C:\Program Files\NetSim\Standard_v13_1\Docs\xml\Properties\Property.xml. This step is to add the UAV Mobility model to the UI
  • In the imported workspace we have modeled VANET Scenario with 4 applications as mentioned above in the properties section.
  • Open the scenario, and make sure that all Vehicles, RSU, and UAVs are loaded with its mobility model configured.
    • Vehicle: SUMO Mobility
    • UAV: UAV Mobility
  • Run the simulation for 100s (Default)
  • During simulation, we can observe that Vehicle will initiate the SUMO simulation, and the UAV  will initiate the MATLAB Simulation window.


Results and Plots:

NetSim, SUMO and MATLAB Simulation:






Additional Links:

MATLAB Interfacing Basics: How to interface NetSim and MATLAB? : NetSim Support Portal (tetcos.com)
Simulink Interfacing:
Interfacing NetSim and SIMULINK : NetSim Support Portal (tetcos.com)