User guide

Installation and directory structure

The simulation framework DEVS-TOSSIM was developed and tested with TinyOS 2.1.2 and Linux. The DEVS user interface requires the readline library and its development files (headers).

The installation of the framework consists in the copy of the source code to a user’s directory. No additional steps are required.

The framework is composed of two main directories: devscpp and devstossim.

The implementation of DEVS can be found on the directory: devscpp. This implementation is generic and can be used independently of the models of WSN motes (see: devscpp).

The directory devstossim contains all the models for simulating wireless sensor networks and basic client and server applications. This directory has the following subdirectories:

Compiling TinyOS applications with DEVS-TOSSIM

To compile TinyOS applications with DEVS-TOSSIM is necessary to export the environment variables: DEVSBASE and TOSMAKE_PATH. Assuming that DEVS-TOSSIM source code is in the directory /opt/devs:

export DEVSBASE=/opt/devs/src
export TOSMAKE_PATH=$DEVSBASE/devstossim/make/

DEVS-TOSSIM implements a TinyOS platform called “devs”. To compile an application with the simulator, navigate to the TinyOS application directory and execute: make devs. For example:

cd /opt/tinyos-2.1.2/apps/RadioCountToLeds/
make devs

If compilation was successful a directory “simbuild” with a program “mote” has been generated and the following message is shown:

*** Successfully built DEVS-TOSSIM (DEVS TinyOS Simulator).

Compiling the simulation server

The server program executes the RadioMedium coupled model and the DEVS user interface. To compile the program, you must execute:

cd /opt/devs/devstossim/server
make

This commands will generate a binary called “server”.

The user interface of DEVS-TOSSIM

The DEVS framework includes a basic user interface that is compiled with the root DEVS simulator (the higher level simulator in the hierarchy).

The DEVS-TOSSIM user interface

The interface provides the following commands:

The simulation uses the syslog’s facility “USER” to log information. All logs are preceded with the tag “DEVSTOSSIM” and the PID of the originating process.

Running a simulation with DEVS-TOSSIM

To run a simulation with DEVS-TOSSIM, the server program must be executed as follows (the argument specifies the TCP port in which the server listens):

cd /opt/devs/devstossim/server
./server 5001

Then, the TinyOS application (that was compiled for the devs platform) must be executed. Every instance of this program represents an independent sensor node. The program receives the following arguments:

For example, to add the following two nodes to the simulation:

You must execute:

cd /opt/tinyos-2.1.2/apps/RadioCountToLeds/simbuild
./mote localhost:5001 root 0 0.5 0,0,0 9002 5000 &
./mote localhost:5001 node1 1 0.5 0,0,50 0 7000 &

Additionally, a bash script called “nodes.sh” (src/devstossim/client_mote) can be used to generate a grid of nodes.