NetSim - Internet Of Things


NetSim allows users to design a network, simulate and analyse the performance of an IOT network using
  • Devices: Sensor Motes, 6LoWPAN Gateway, Routers, Switches, AP, Nodes can be dragged and dropped for network design
  • Data link and physical layer implementation is as per IEEE 802.15.4 standards
  • Network layer is IPV6 (RFC 2460) and can run both on IPV4 and IPv6
  • Routing via AODV (RFC 3561), RPL (RFC 6550)
  • 6LoWPAN Gateway will switch the packet from one network to another
Netsim IOT Network


IOT R & D Being Carried Out With NetSim

Example 1: Energy Harvesting in IOT

The Internet of Things (IoT) is an intelligent infrastructure of uniquely identiable devices capable of wirelessly communicating with each other, services, and people on a large scale through the Internet. IOT devices require adequate energy to operate the network in a self-suficient manner without compromising quality of service (QoS). Therefore, it is imperative to improve the energy eficiency and longevity of devices in IoT.

In NetSim the lifetime of an IoT system would depend on the average energy consumption of the sensor devices per active duty cycle. This involves the combined operations of Sensing(SN), Processing(PR), Receiving(RX) and Transmiting(TX).

In this example the wireless energy is harvested and the harvested energy EH is inversely proportional to rij2

Netsim Energy Harvesting
Increase in the lifetime of sensor network with energy harvesting


Example 2: Clustering Algorithms for Reducing Energy Consumption

Clustering algorithms are widely used to increase the life time of WSNs. Low Energy Adaptive Clustering Hierarchy(LEACH) is a MAC protocol which is integrated with clustering and a simple routing protocol in WSNs. The goal of LEACH is to lower the energy consumption required to create and maintain clusters.

Netsim Leach
(b)Peak energy consumption at cluster heads leading to lower lifetime.
(c) Uniform energy consumptions in LEACH leading to higher lifetime


In LEACH nodes transmit to cluster heads, and the cluster heads aggregate the data and forward it to the sink. Each node uses a stochastic algorithm at each round to determine whether it will become a cluster head in that round. In this implementation, for each iteration, the remaining power is used as the criteria for cluster head selection. The node with the highest remaining energy becomes the cluster head and then creates a schedule for each node in its cluster to transmit its data.

Further enhancements to LEACH can include clustering algorithms where the number of clusters is an optimized variable and where other parameters apart from remaining energy are used for cluster head selection.


Example 3: Application of Machine Learning to IOT

The goal of this project is to maximize the life-time of a Wireless Sensor Network using Self Organizing Map (SOM) based Neural Network algorithms for cluster head selection. We dene the lifetime of a WSN as the time at which the power of half the sensors reach zero (also called half-life of Network). Initially all sensors start with a xed amount of energy. Subsequently, energy is consumed during transmission, reception and idle states. Packets are transmitted from sensors to their cluster head sensor and then it is forwarded to sink node through other cluster heads. In this example all MAC/PHY layer simulations are carried using NetSim while the cluster head selection using SOM algorithm is done using MATLAB®.

Netsim Machine Learning
(a) a neural network where red points represent the lattice points (nodes) and the green points (neurons) represent the input layer.
The connections between the red and green points represent the links.
(b) the four points in blue shows the finnal weight positions of the trained neural network. The green spots are the sensors whose
position vectors are used as input to the neural network while training.


Example 4: Route Optimization in RPL Based IoT Networks

Low power and Lossy Networks (LLNs) are a class of network in which both the routers and their interconnect are constrained: LLN routers typically operate with constraints on (any subset of ) processing power, memory and energy (battery), and their interconnects are characterized by (any subset of ) high loss rates, low data rates and instability. The Objective Function (OF) is used by RPL to specify how the routing metric and constraints should be used to reach specic objectives



The objective function in NetSim RPL seeks to find the route with the best link quality. Link quality calculations, available in Zigbee Project 802.15.4 C file with function get_link_quality( ):
Lq = (1 - p / rs) where p = received power (dBm) and rs = Receiver sensitivity (dBm)
And Final Link Quality = (Sending Link Quality + Receiving link quality) / 2
The Destination Oriented Directed Acyclic Graph (DODAG) rank calculations are done in Neighbour.c in RPL project per the formula given below and the same can be visualized as shown above Rank = (Max_increment - Min_Increment) * (1 - Lq)2 + Min_Increment
The link quality, in this example, is based on received power and can be optimized by the user to factor in distance, delay etc. The routes with the best link quality will then be based on this optimized function.


Example 5: Attacks in IOT Networks

Providing security in IPv6/RPL connected 6LoWPANs is challenging because the devices are connected to the untrusted Internet and are resource constrained, the communication links are lossy, and the devices use a set of novel IoT technologies such as RPL, 6LoWPAN, and CoAPs. In a sinkhole attack simulated in NetSim a malicious node advertises an articial benecial routing path and attracts many nearby nodes to route trac through it. The RPL protocol provides several mechanisms to nodes in the DODAG to determine which node to use as its default route. One of them is rank, which is calculated and transmitted by the neighboring nodes, though based on the relative position of nodes from the DODAG root. An attacker can launch a sinkhole by advertising a better rank thus attracting nodes down in the DODAG to select it as the parent. This attack in itself does not necessarily disrupt the network operation; however, when coupled with another attack, it can become very powerful

Netsim Sink Hole Attack
Visualization of RPL DODAG and Rank
Netsim RSSI Trilateration
Visualization of RPL DODAG and Rank


Example 6: Localization Techniques

Location awareness, providing the ability to identify the location of sensor, machine, vehicle, and wearable device, is a rapidly growing trend of hyper-connected society and one of the key ingredients for internet of things (IoT). One challenge for the massive IoT networks is to identify the location map of whole sensor nodes from partially observed distance information. This is especially important for massive sensor networks, relay-based and hierarchical networks, and vehicular to everything (V2X) networks.

In this example where localization is implemented in NetSim, sensor nodes with known location information are known as anchor nodes, while nodes which do not know their location are known as unknown nodes. The received power of a wireless signal between an anchor node and an unknown known is used to estimate the distance. This estimation is based on the log-distance path loss formula. Three anchor nodes are used and based on the distance from these three nodes, the exact location of the unknown node is got using geometric trilateration.


Sensor Emulation (Beta)*

Netsim Respberry PI
Interfacing NetSim and Raspberry Pi

How does the Raspberry Pi - NetSim Interface work?

  • A server is created in NetSim which can connect to multiple clients through TCP sockets using NetSim Emulation library
  • There would be a sender program running on one Raspberry Pi and a receiver program on another
  • Both sender and receiver Raspbian connect with NetSim through Sockets
  • Sender Client <-> NetSim Server <-> Receiver Client
  • Data is sent as a Byte stream
  • Dierent sensors like Ultrasonic distance sensor, PIR motion sensor, Digital & Analog Temperature sensors are programmed with Raspbian, which acts as the Sender
  • The sensed data is sent to the receiver Raspbian through NetSim Emulation Server

The sensed data in the receiver Raspbian can be displayed with LCD display, Dot matrix display, seven segment display, etc.