Applicable VersionsNetSim StandardNetSim Pro


Applicable Releasesv13v14



Project Download Link: 

 

NetSim v13.1
NetSim v13.2
NetSim v14.2



NetSim can be interfaced with MATLAB, which allows users to interact with it during run-time. MATLAB can interact and control the behavior of  SIMULINK Models. In order to interface NetSim with SIMULINK, the existing MATLAB Interfacing can be utilized. NetSim can interact with SIMULINK Models and control its behavior via MATLAB.


Software Tools used to perform interfacing:

  • NetSim v11.0 (or higher versions) 64-bit 
  • MATLAB R2016a (or higher versions) 64-bit
  • SIMULINK


SIMULINK - Water Supply System:

In this example we consider a Water Supply System Model in SIMULINK as shown below:


Reference: https://in.mathworks.com/help/physmod/hydro/examples/water-supply-system.html


NetSim - Water Supply System in 5G Network




This model consists of four tanks and the readings of the volume of water in each of the tanks are taken periodically and sent to the MATLAB workspace. 

NetSim - Simulink Interfacing:

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

  • MATLAB Engine process is initialized
  • MATLAB Desktop window is loaded
  • 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 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 readings obtained from SIMULINK are read from MATLAB workspace and appended to the payload of the packets generated in NetSim. In this example readings are taken every one second and appended to the packet payload. 


Output/Metrics specific to this example:

  • NetSim Event Trace - MATLAB event is registered to periodically interact with MATLAB
  • Wireshark Packet Capture - Can be enabled in the source nodes or in the destination to view the packet payload containing the readings taken from SIMULINK Model.


Running Water Supply System simulation by interfacing NetSim

  • In this workspace/project we have given examples of the following networks
    • 5G NR
    • IoT
    • WLAN
  • Based on your requirement, open the appropriate example from NetSim UI.

  • Upon opening an example, Water-Supply-System-in-5G the scenario will be loaded.
  • In the above example, there are four UE’s corresponding to four Tank Stations in the SIMULINK model. 
  • Make sure that Event Trace, and Plots are enabled in the toolbar
  • Ensure Wireshark logging is enabled in the CONTROL STATION are enabled.
  • Traffic is configured from each Tank Station to the Control Station. Packets are generated every second.


  • Simulink files and MATLAB (.m) files are now part of the workspace. 
    • MATLAB Path: <Path-of-Workspace-your-imported>/bin_x64/MATLAB

  • Run Simulation for 100 Seconds.
  • As the simulation starts, MATLAB gets initialized, the SIMULINK model gets loaded, and Wireshark is initialized and displays the packets captured in the destination device (CONTROL STATION).

 

Analyzing the output Metrics specific to this example:

  • During the Simulation NetSim and SIMULINK simulations run synchronously as shown below:

  • Wireshark displays the packets received at the destination and the payload of the packets contains the readings taken in SIMULINK as shown below:


Note: For different versions of MATLAB, SIMULINK *.slx file can be found as explained in https://in.mathworks.com/help/physmod/hydro/examples/water-supply-system.html