OpenSim allows you to simulate an OpenWSN network without physical devices.

How it works

A simulated network behaves exactly like a network with real hardware. You can interact with the OpenVisualizer, communicate with your nodes from the Internet. The difference is the firmware of each mote is running on your computer, rather than on a target device.

OpenSim does so by compiling the mote firmware as a Python extension module, and creating an instance of the resulting class for each emulated mote. When the simulation is running, these emulate motes communicate with the rest of the OpenVisualizer architecture (see Architecture) over the eventBus.

As illustrated in the diagram below, the emulated motes interact with the eventBus the exact say way a moteProbe instance (connected to a hardware mote) does.

The OpenVisualizer is not aware it is talking with emulated motes, and from a networking point of view, interacting with the emulated motes is exactly the same as interacting with real motes.

Preparing for a simulation

Directory organization

The OpenSim environment combines elements from the following repositories:

The OpenSim environment assumes that you have cloned them at the same level. That is, you need to have the openwsn-sw/ and openwsn-fw/ directories side-by-side on your computer.

Installation requirements

Compiling firmware

Before you can run a simulation, you need to compile the OpenWSN firmware as a Python extension module. For that, navigate to the openwsn-fw/ directory, and enter the following command:

scons board=python toolchain=gcc oos_openwsn

You can see an example output of this command on the OpenWSN builders:

This command creates the following Python extension module.

openwsn-fw/firmware/openos/projects/common/oos_openwsn.pyd

Running a simulation

Running a simulation is exactly like running the OpenVisualizer, but specifying that this is a simulation.

As with the OpenVisualizer, there are several interfaces available.

graphical user interface (GUI)

You have two options to start it:

Brackets are not required when issuing a command. For example, to run a 5 motes simulating network, use following command without brackets. It's the same for following two cases: CLI and Web interface

scons rungui --sim --simCount=5

command line interface (CLI)

You have two options to start it:

web interface

You have two options to start it: