TOSSIM Live

From TinyOS Wiki
Revision as of 06:26, 4 April 2009 by Ywlaw (talk | contribs) (New page: TOSSIM Live is an extension of TOSSIM (of TinyOS 2.x) developed by Chad Metcalf from the Colorado School of Mines to enable virtual tiered networks. It has two main parts: a simulation thr...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

TOSSIM Live is an extension of TOSSIM (of TinyOS 2.x) developed by Chad Metcalf from the Colorado School of Mines to enable virtual tiered networks. It has two main parts: a simulation throttle and a serial forwarder. The simulation throttle allows the simulation clock to emulate the wall clock, whereas the serial forwarder allows serial messages to be sent to and received from the virtual motes. The code for the serial forwarder resides in $TOSDIR/lib/tossim/sf/.


Tutorial

Caution: The following tutorial is targeted at the CVS version when TinyOS 2.1.0 was released.

The sample application TestSerial can be used to demonstrate the serial forwarder of TOSSIM Live. While the mote firmware resides in $TOSROOT/apps/tests/TestSerial, the Python simulation code lives in $TOSDIR/lib/tossim/sf/examples. Before TestSerial.py can be run, copy (or make symbolic links of) the files from $TOSDIR/lib/tossim/sf/examples/ to $TOSROOT/apps/tests/TestSerial/.

Two changes need to be made to TestSerial.py. First,

chmod u+x TestSerial.py

Then, add the following to the first line of TestSerial.py if it is not there already:

#!/usr/bin/python

Use the following command to generate TestSerialMsg.py:

mig python -target=null -python-classname=TestSerialMsg TestSerial.h test_serial_msg -o TestSerialMsg.py

The preceding command can be found in $TOSDIR/lib/tossim/sf/examples/Makefile.Driver. Notice that in the file TestSerial.h, the following enum is defined:

enum {
  AM_TEST_SERIAL_MSG = 0x89,
};

This is the active message type of the serial packets that travel across the serial interface. In TestSerialAppC.nc, the statement App.Receive -> AM.Receive[AM_TEST_SERIAL_MSG]; makes sure only serial packets of the type AM_TEST_SERIAL_MSG are received through the serial interface.

Finally, run

./TestSerial.py