NetSim can be interfaced with MATLAB with the help of MATLAB Interfacing C file format and associated settings that are explained in NetSim User Manual and in related sample projects in NetSim File Exchange. For you to interface NetSim with MATLAB, initially analyze what parameters your algorithm in MATLAB expects as input. Identify the relevant parameters in NetSim to be passed to MATLAB. Identify whether your MATLAB codes are going to work instead of an existing functionality (set of codes) available in NetSim or if it is going to do something in addition to what is already happening in NetSim. Make calls from relevant places of NetSim source code and read the values computed in MATLAB to tune the simulation variables in NetSim.
MATLAB Interfacing C file (refer NetSim User Manual) contains the following functions:
fn_netsim_matlab_init() - This function is used to initialize the MATLAB Engine.
fn_netsim_matlab_run() -This is the function where MATLAB code is executed.
fn_netsim_matlab_finish() -This function is used to Close the MATLAB Engine.
Upon interfacing NetSim with MATLAB,
- NetSim can initializes a MATLAB Engine process at the start of the simulation,
- can pass parameters to MATLAB workspace at runtime (either execute work space commands, or pass parameters to MATLAB .m files, perform computation or generate dynamic plots in matlab)
- can read parameters from MATLAB workspace
- can terminate the MATLAB engine parameter at the end of the simulation
Refer the following resources for further information:
1. NetSim User Manual - Section 8.3
2. NetSim File Exchange Projects related to Matlab Interfacing in v10.2 - http://www.tetcos.com/file-exchange.html
3. NetSim Knowlegebase articles related to interfacing with other tools - https://tetcos.freshdesk.com/solution/folders/14000090960