Several simulators are existing for IoT simulations, but some are assistive for IoT protocols. Simulation tools are crucial in the field of networking, and they play a pivotal role. With the help of an IoT network simulator, users can effortlessly send messages and test various scenarios. The following are few simulators which encompass a wide spectrum of IoT protocols and could be prolonged to help supplementary protocols by means of plugins or modules:
Simulators Supporting Multiple IoT Protocols
- NS-3 (Network Simulator 3):
- Explanation: NS-3 is an openly available discrete-event network simulator.
- Assisted protocols:
- IoT-Specific: 6LoWPAN, RPL, LoRaWAN, MQTT, Zigbee
- General Networking: Bluetooth, Ethernet, Wi-Fi, LTE.
- Characteristics:
- Extensive network simulations are assisted by high scalability.
- Generally, modular design facilitates appending novel protocols in an easier manner.
- Extensibility: High
- Environments: macOS, Linux, Windows (via Cygwin).
- Major Resources:
- NS-3 Documentation
- LoRaWAN NS-3 Module
- OMNeT++:
- Explanation: OMNeT++ is referred to as a modular network simulator that contains rich protocol assistance through extensions.
- Assisted Protocols:
- IoT-Specific: Zigbee, RPL, CoAP, LoRaWAN, 6LoWPAN, MQTT
- General Networking: Ethernet, TCP/IP, Wi-Fi, LTE
- Characteristics:
- Widespread protocol assistance is offered by the INET model.
- GUI-related design and analysis tools.
- Extensibility: High (supports custom modules).
- Environments: macOS, Linux, Windows.
- Major Resources:
- INET Framework
- OMNeT++ Documentation
- NetSim:
- Explanation: This simulator is described as a commercial network simulator with widespread IoT assistance.
- Assisted Protocols:
- IoT-Specific: 6LoWPAN, Sigfox, MQTT, Zigbee, CoAP, LoRaWAN, Wi-SUN
- General Networking: Bluetooth, TCP/IP, Wi-Fi, LTE.
- Characteristics:
- Through scripting, it assists protocol personalization.
- Combined data visualization and performance metrics.
- Extensibility: Medium (supports customization)
- Environment: Windows
- Major Resources:
- NetSim Documentation
- CupCarbon:
- Explanation: Concentrated on energy utilization and visualization, it is a smart city and IoT network simulator.
- Assisted Protocol:
- IoT-Specific: Zigbee, Sigfox, LoRa, Wi-Fi, 6LoWPAN
- General Networking: GPRS, GSM
- Characteristics:
- In urban IoT platforms, supportive in energy utilization exploration.
- 2D/3D visualization for smart city networks.
- Extensibility: Medium (Python Scripting)
- Environments: macOS, Linux, Windows
- Major Resources:
- CupCarbon Documentation
- Matlab/Simulink:
- Explanation: Along with IoT-specific toolboxes, MATLAB/Simulink is an extensive simulation platform.
- Assisted Protocols:
- IoT-Specific: LoRa, Wi-Fi, Zigbee, Bluetooth
- General Networking: LTE, TCP/IP, Ethernet
- Characteristics:
- Combination with hardware such as Raspberry Pi, Arduino.
- For quick modelling, it provides graphical model-based design.
- Extensibility: High (custom MATLAB/Simulink code)
- Environments: macOS, Linux, Windows
- Major Resources:
- Simulink IoT Examples
- Matlab Documentation
- GNS3 (Graphical Network Simulator):
- Explanation: GNS3 is a network simulator with digital appliances.
- Assisted Protocols:
- IoT-Specific: Through digital devices, it assists LoRaWAN, Zigbee, Bluetooth, etc.
- General Networking: Wi-Fi, BGP, Ethernet, TCP/IP
- Characteristics:
- Specifically, assists firewalls, routers, and network safety appliances.
- Incorporation together with hardware devices such as Arduino, Raspberry Pi.
- Extensibility: Medium (virtual appliances)
- Environments: macOS, Linux, Windows
- Major Resources:
- GNS3 Documentation
Summary Table
Parameter | NS-3 | OMNeT++ | NetSim | CupCarbon | Matlab/Simulink | GNS3 |
Supported Protocols | LoRaWAN, Zigbee, 6LoWPAN, RPL, MQTT, Wi-Fi, Bluetooth | LoRaWAN, Zigbee, 6LoWPAN, RPL, MQTT, CoAP, Wi-Fi | Zigbee, 6LoWPAN, LoRaWAN, Sigfox, Wi-SUN, MQTT, CoAP | LoRa, Zigbee, 6LoWPAN, Sigfox, Wi-Fi | Zigbee, LoRa, Wi-Fi, Bluetooth | Zigbee, LoRaWAN, Bluetooth, Ethernet, Wi-Fi |
Scalability | High | High | Medium | Medium | High | Medium |
Ease of Use | Medium | Medium | High | High | High | High |
Visualization | NetAnim, PyViz | GUI-based | Built-in tools | 2D/3D visualization | Plotting tools | Topology visualization |
Extensibility | High | High | Medium | Medium | High | Medium |
Platforms | Windows, macOS, Linux | Windows, macOS, Linux | Windows | Windows, macOS, Linux | Windows, macOS, Linux | Windows, macOS, Linux |
Best For | Protocol testing, large-scale networks | Custom protocols, routing | IoT protocol performance analysis | Smart city networks | Prototyping and signal processing | Testing network topologies |
| | | | | | | | |
Choosing the Right Simulator
- For extensive network simulations with extreme protocol personalization, NS-3 and OMNeT++ are determined as appropriate.
- Specifically, for wide-ranging IoT protocol analysis with visualization, NetSim and CupCarbon are efficient.
- Matlab/Simulink is perfect for the processes of signal processing and quick modelling.
- Typically, GNS3 is adaptable for secure network topology simulations along with digital appliances.
How to simulate an IoT device?
The usage of a simulator which can imitate the activity of a realistic IoT device, like its communication protocols, data generation trends, resource limitations, are needed when simulating an IoT device. We provide a stepwise instruction to simulate an IoT device through the utilization of various simulation tools in an efficient manner:
General Steps for Simulating IoT Devices
- Select a Simulation Tool: A tool has to be selected in a manner that assists the protocols and network infrastructure you need. Generally, OMNeT++, Matlab/Simulink, NS-3, CupCarbon, and Cooja are determined as prominent tools.
- Define Network Topology: Along with virtual IoT devices and interaction connections, aim to establish a network topology.
- Configure Device Properties:
- Protocols: It is appreciable to mention the communication protocols such as CoAP, LoRaWAN, MQTT, Zigbee.
- Data Patterns: How often the device will produce or send data has to be explained in an explicit manner.
- Resource Constraints: Focus on establishing memory use, energy utilization, and processing power limitations.
- Simulate Traffic Patterns: Aim to generate traffic trends in such a way that imitate actual-world data flows among devices.
- Run the Simulation: To research network effectiveness, protocol activity, or resource consumption, focus on running the simulation.
- Analyze Results: For simulation processes, gather and examine outcomes through the utilization of external software or in-built tools.
Simulation Examples
- Simulating an IoT Device with NS-3
Normally, modules for different IoT protocols such as Zigbee, 6LoWPAN, and LoRaWAN are offered by NS-3 which is defined as a discrete-event network simulator.
Example: Simulating a simple 6LoWPAN IoT device in NS-3
// Import relevant NS-3 modules
#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/internet-module.h”
#include “ns3/sixlowpan-module.h”
#include “ns3/lr-wpan-module.h”
#include “ns3/ipv6-address-helper.h”
using namespace ns3;
int main() {
// Enable logging LogComponentEnable(“SixLowPanExample”, LOG_LEVEL_INFO);
// Create two IoT nodes
NodeContainer nodes;
nodes.Create(2);
// Install LrWpanNetDevice on both nodes
LrWpanHelper lrwpanHelper;
NetDeviceContainer devices = lrwpanHelper.Install(nodes);
// Set up the 6LoWPAN layer
SixLowPanHelper sixlowpanHelper;
NetDeviceContainer sixlowpanDevices = sixlowpanHelper.Install(devices);
// Install the Internet stack
InternetStackHelper internet;
internet.Install(nodes);
// Assign IPv6 addresses
Ipv6AddressHelper ipv6; ipv6.SetBase(Ipv6Address(“2001:1::”), Ipv6Prefix(64));
Ipv6InterfaceContainer interfaces = ipv6.Assign(sixlowpanDevices);
// Create and configure a UDP echo server
uint16_t port = 9;
UdpEchoServerHelper echoServer(port);
ApplicationContainer serverApp = echoServer.Install(nodes.Get(1)); serverApp.Start(Seconds(1.0)); serverApp.Stop(Seconds(10.0));
// Create and configure a UDP echo client
UdpEchoClientHelper echoClient(interfaces.GetAddress(1, 1), port); echoClient.SetAttribute(“MaxPackets”, UintegerValue(1)); echoClient.SetAttribute(“Interval”, TimeValue(Seconds(1.0))); echoClient.SetAttribute(“PacketSize”, UintegerValue(10));
ApplicationContainer clientApp = echoClient.Install(nodes.Get(0)); clientApp.Start(Seconds(2.0)); clientApp.Stop(Seconds(10.0));
// Run the simulation
Simulator::Run();
Simulator::Destroy();
return 0;
}
- Simulating an IoT Device with Cooja (Contiki OS)
Cooja is mainly formulated for IoT and wireless sensor networks. It is determined as a simulator in the Contiki OS environment.
Example: Simulating a Contiki OS application with Cooja
- Install Contiki OS and Cooja:
git clone https://github.com/contiki-os/contiki.git
cd contiki/tools/cooja
ant run
- Create a New Simulation:
- It is approachable to open Cooja (ant run) and aim to choose “File” > “New simulation.”
- For a simulation, offer an appropriate name and focus on arranging radio medium settings.
- Add IoT Nodes to the Simulation:
- In this step, click “Mote Types” > “Create new mote type.”
- Aim to choose the “Sky” mote and compile the default hello-world example.
- To the simulation, it is better to append one or more motes.
- Run the Simulation:
- In order to run the simulation, click “Start.”
- It is appreciable to examine resource utilization and network congestion in the output records.
- Simulating an IoT Device with Matlab/Simulink
Focused toolboxes are offered by Matlab/Simulink for quick modelling and IoT simulation.
Example: Simulating a Zigbee IoT Network
- Install Simulink and Toolboxes:
- It is advisable to make sure that you have the essential tool boxes such as Simevents, Zigbee Toolbox.
- Create a Simulink Model:
- Aim to open Matlab and begin a novel Simulink model.
- Through employing the Zigbee toolbox, develop a Zigbee network system by appending blocks.
- Configure IoT Device Behavior:
- By utilizing SimEvents blocks, it is better to describe data generation trends.
- Protocol metrics such as bandwidth, transmission power, and frequency have to be arranged.
- Run the Simulation:
- Focus on simulating the model. By utilizing Matlab visualization tools, examine the outcomes.