JTossim Quick Start Guide


JTossim requires Java 1.6 or greater and a fully configured Tinyos development environment. To verify that your computer is properly setup up try to run make micaz sim in your project directory (where the Makefile of your application is). If errors appear please make sure that you have correctly installed TOSSIM and the required dependencies (most notably Python development libraries, the package python-devel under Fedora).


  • Download jtossim zip from the web.
  • Uncompress it.

Running JTossim

With a terminal cd to the uncompressed directory and execute the following command:

java -jar JtosSim.jar

Setting up a new simulation project

Click on “Create new project”


Select the folder apps/MViz under located in your TinyOS SDK installation then click on “Next”


Click on “Compile application”. JTossim will run make micaz sim in the selected folder. This step is performed to be able to detected automatically what are the logging channels that your application is using.

Once the compilation is done click on “Next”. (Please make sure that no compilation error happened)


Select the debug channels that have to be captured. To select more than once channel press the CTRL key. In this tutorial we are interested in just selecting the channel TreeRouting. When done press “Next”.


Now we need to enter the “Topology match string”. This regular expression is used by JTossim to capture the current (logical) network topology that will be depicted as a tree. The default string will update the parent of a given node whenever the node emits a string of the type ”… Changed parent to [ some node id] ”. For this tutorial we need to set the string to .*Changed parent.* to ([0-9]+).* and then press “Next”.

In this step we need to specify the radio parameters, these parameters are the same used in TOSSIM. For a precise description please refer to its documentation. For this example we don't need to change them. Just press “Next”.


In the next screen we need to select the radio noise trace that will be used for the simulation. This setting is similar to TOSSIM, the only difference is that we can set the number of noise samples that must be loaded from the trace. This is useful when the noise trace is very long. For the purpose of this tutorial we will select a standard noisetrace provided with the TinyOS SDK. This trace is located in tos/lib/tossim/noise/meyer-heavy.txt and we will set the number of samples to 200. Press “Next” when done.


In the next step we have to setup the size of the area where the nodes will be deployed. For our test we set the area size to be 100×100 m. When done press “Next”.


In the next step we need to setup the number of nodes that we need to deploy. For our test we can set it to 32 and then press “Next”.


In the next step we need to setup how the nodes are distributed in the area. For our test we will select “Random”.


We are now done with the setup and we can press “Finish”.


Executing simulations

Now we are in the main JTossim window. The window is divided in three parts. In the upper left part you can change the simulation parameters and control the simulation execution.


In the upper right part you can see the network. You can use the zoom buttons to change the display. The rulers show the distance of the nodes in meters. If you press the button “Range” you will see an approximation of the range of the nodes.


By clicking on a node only the range of the selected node will be displayed.


The green area represent the area where most of the packets are received. The yellow area represent the region in which the packets may be received. Notice that if your radio model has an high shadowing standard deviation the actual range might be much larger for some nodes. To see the actual gain to other nodes you can press the button “Links”.


The button “Background” can be used to display an image behind the nodes. It can be useful in case you have a map of the area where the nodes are deployed. The “Topology” button when pressed will display dynamically the logical topology of the network during the simulation.

The middle part of the screen is divided in two tabs. The first tab shows the output of the debug channels. If a node is selected in the network view only the messages of that node are displayed. The second tab shows the rest of the output (usually nothing particularly interesting).

Let's unselect the node previously selected in the network view by clicking again on it and let's start the simulation. To do so click on the “Run” button on the upper left corner of the window. You will see that the network panel will display a red tree showing the current logical network topology. If the tree doens't appear make sure you pressed the “Topology” button in the toolbar of the network view.

You can notice that as the simulation progresses in the message tab messages start to appear. If you click on a node in the network view the messages will be automatically filtered. You can also filter them by typing a regular expression in the “Filter” field. For instance we can see all messages containing the work neighbor by typing .*neighbor.* in the filter field.

The bottom view shows the distribution of messages according to time. Time is divided in timeslots, depending on the number of messages sent by a given node during a timeslot the color will change from black to red. In order to be displayed in this view messages must be timestamped. We will add a new timestamped message to the source code of the MViz app. To do so open the file MVizAppC.nc in the mviz source folder and add the following line in the function Timer.fired:

dbg("Application", "%s: Timer fired\n", sim_time_string());

Now go back to JTossim and press the “Make” button on the upper left part of the window. Wait the compilation to be done (you can check the output of the compilation process in the output pane).

In order to capture these messages add the logging channel Application to the list of captured log channels. To do so open the “Logging” tab of the settings and press on “Add channel…”, select Application and then press OK.

Finally press again “Run”. You will see that timestamped messages will appear as red dots in the lower part of the window.


software/jtossim_tutorial.txt · Last modified: 2010/10/15 09:31 by lokeller
© ARNI/EPFL, 1015 Lausanne