Table of Contents

1. Start simulation
2. WSim output traces

1. Start simulation

In this section, we will show you how to start a simulation involving two nodes executing RadioCountToLeds program. To achieve that, we need to launch two WSim instances (one per node), and WSNet. Here are the commands to execute in three terminals :

$wsnet1

$wsim-telosb --ui --mode=time --modearg=5s --wsnet1 --node-id=0 --trace=trace0.trc radiocounttoleds.elf

$wsim-telosb --ui --mode=time --modearg=5s --wsnet1 --node-id=1 --trace=trace1.trc radiocounttoleds.elf

The --trace option enables to gather traces during the WSim simulation.

Simulation with WSim and WSNet of RadioCountToLeds TinyOS program

Figure IV.1. Simulation with WSim and WSNet of RadioCountToLeds TinyOS program


2. WSim output traces

In order to interprete WSim traces, you may use GtkWave software. You need first to convert *.trc files into *.vcd files by using WTracer tool (available in WSim ./utils/wtracer/ sources) :

$wtracer --in=trace0.trc --out=trace0.vcd --format=vcd
$wtracer --in=trace1.trc --out=trace1.vcd --format=vcd

[Note]VCD format

You will find further informations on VCD format in the ADC tutorial.

Then you just have to run GtkWave with the appropriate file, for example to see node 0 traces :

$gtkwave trace0.vcd

WSim output traces of node 0 with RadioCountToLeds TinyOS program in GtkWave

Figure IV.2. WSim output traces of node 0 with RadioCountToLeds TinyOS program in GtkWave


In order to compare easily several nodes traces, WTracer allows to merge several *.trc files into only one *.vcd file. For instance with our example :

$wtracer --out=multi.vcd --format=vcd --merge --multi trace*.trc
$gtkwave multi.vcd

WSim output traces of node 0 and 1 with RadioCountToLeds TinyOS program in GtkWave

Figure IV.3. WSim output traces of node 0 and 1 with RadioCountToLeds TinyOS program in GtkWave