Categories

Category: Software

How to simulate Internet-of-Things (IoT) using NetSim

NetSim GUI- Configurator

NetSim is a discrete event simulator covering a broad range of wired, wireless, mobile and sensor networks that comes with a user-friendly GUI which features. read on to get an idea of how IOT networks are simulated in NetSim..

NetSim Packet trace is saved as a spread sheet and can be converted to an Excel table to make the management and analysis of data easier. A table typically contains related data in a series of worksheet rows and columns that have been formatted as a table. By using the table features, you can then manage the data in the table rows and columns independently from the data in other rows and columns on the worksheet.

PivotTables are a great way to summarize, analyse, explore, and present your data, and you can create them with just a few clicks. PivotTables are highly flexible and can be quickly adjusted depending on how you need to display your results. You can also create Pivot Charts based on PivotTables that will automatically update when your PivotTables do.

Following are the steps to analyse the packet trace using pivot tables (using Excel 2013)

Step1. Click on a cell and then click on Format as Table

The Excel would ask you for the range of the data set and in general Excel would automatically choose till the last row, as shown below

Click OK and then the spread sheet will be converted to a table as shown below

Step 2. Next, from the Insert tab, click the PivotTable command.

Step 3. The Create Pivot Table dialog box will appear. Click on OK

Step 4. A blank PivotTable and Field List will appear on a new worksheet

Step 5. Once you create a Pivot Table, you’ll need to decide which fields to add. Each field is simply a column header from the source data. In the Pivot Table Field List, check the box for each field you want to add.

Step 6. If you want to analyse packets sent from all sources to all destinations, then check SOURCE_ID, DESTINATION_ID and CONTROL_PACKET_TYPE/APP_NAME.

Step 7. The selected fields will be added to one of the four areas below the Field List. Click SOURCE_ID, hold it and drag to the ROW field. Similarly, DESTINATION_ID to COLUMNS and CONTROL_PACKET_TYPE/APP_NAME VALUES

Step 8. The Pivot Table will calculate and summarize the selected fields. In this example, the Pivot Table shows the packets sent from all sources to all destinations.

Step 9. The above example shows all the packets which including data packets and control packets.

Step 10. If you wish to know how many were Data and how many were control packets then, check the PACKET_TYPE and drag it to the ROWS field

Step 11. This will look like

Step 12. Further, if you wish to know how many packets got errored and how many were successful, check the PACKET_STATUS field and drag it to the ROWS field.

NetSim now provides users the ability to interface with MATLAB in run time

Underlying Theory: MATLAB provides API’s to start and end the MATLAB process and send data / commands to and from MATLAB. NetSim runs these functions during initialization to simultaneously start-up a MATLAB process and whenever required send data to & from MATLAB in run time. NetSim ends the MATLAB process upon completion of the simulation.

Interfacing: An interfacing file named as NetSim_MATLAB_Interface.c is used to control the MATLAB computational engine and contains the functions –

fn_netsim_matlab_init() – which starts the MATLAB Process

fn_netsim_matlab_run() – which sends data to and from MATLAB, and sends commands to be processed in MATLAB

fn_netsim_matlab_finish() – which ends the MATLAB Process

Example of MATLAB call from WLAN PHY layer in NETSIM

Example Application: In this example, we replace NetSim’s default Rayleigh fading with the Nakagami fading model from MATLAB. Calls to the above functions are made at appropriate places in the NetSim code. So, for each packet, MATLAB calculates the Nakagami fading value in run time. This value returned by MATLAB is used by NetSim as the fading power instead of using the Rayleigh model. Note that instead of sending the commands directly from NetSim to MATLAB, we can also use a MATLAB .m file which will contain the commands to be executed by MATLAB.

What is a network emulator?
A NetSim emulator enables you to run real applications over virtual networks with wide selection of network conditions like error, delay, loss etc. Use of an emulator from development through pre-deployment phases obviates the need of redesigning, testing and tuning your applications, thus saving time, effort and eventually cost of setting up a network.

What are the benefits of NetSim Emulator?• Emulate a wide range of technologies – Switching, Routing, MANETs, Cognitive Radio networks, 4G-LTE networks, ZigBee networks
• A cost effective alternative to hardware emulators that have high costs and limited scale
• Reduced learning curve through agile testing in lab without complicated configuration

How does it work?• Create the desired network in the Emulation server using NetSim GUI
• Run emulation client in the PC’s/VM’s where your live applications run
• Set the device IP addresses per the real PC/VM in the simulated network. Each live PC/VM corresponds to a node in the simulated network.
• Run your application and the emulation server
• Measure your application performance