Avrora

From TinyOS Wiki
Revision as of 13:06, 21 April 2009 by JohnRegehr (talk | contribs)
Jump to: navigation, search

What is Avrora?

Avrora is a cycle-accurate simulator for sensor network programs. The MicaZ and Mica2 platforms are supported. The main Avrora web page contains a lot of good information but is not actively maintained; Avrora development has moved to Sourceforge.

Installing Avrora

Avrora works fine on Linux and Windows. The main prerequisite is a Java 5 or 6 development environment. Download the latest CVS snapshot:

cvs -d:pserver:anonymous@avrora.cvs.sourceforge.net:/cvsroot/avrora login
cvs -z3 -d:pserver:anonymous@avrora.cvs.sourceforge.net:/cvsroot/avrora co -P avrora

The following will assume that you have set $AVRORA to be the absolute path to this avrora directory.

Build Avrora:

cd $AVRORA
make avrora

There should not be any error messages.

Add $AVRORA/bin to your CLASSPATH. Ensure that you can run Avrora:

java avrora.Main

The output should be a bunch of usage information. On Cygwin the colors may not show up properly in which case you'll want to invoke Avrora using the -colors=false command line option.

Simulating TinyOS Applications

It is assumed that you have TinyOS 2.x installed and can build applications. Try these commands:

cd $TOSROOT/apps/Blink
make micaz
mv build/micaz/main.exe Blink.elf
java avrora.Main -platform=micaz -simulation=sensor-network -seconds=3 -monitors=leds Blink.elf

The output should be something like this:

Avrora [Beta 1.7.107] - (c) 2003-2007 UCLA Compilers Group

Loading Blink.elf...[OK: 0.068 seconds]
=={ Simulation events }=======================================================
Node          Time   Event
------------------------------------------------------------------------------
   0       8006682  off off on  
   0       8006684  off on  on  
   0       8006686  on  on  on  
   0       8006688  on  on  off 
   0       8006690  on  off off 
   0       8006692  off off off 
   0       9793689  off off on  
   0      11579289  off off off 
   0      11579762  off on  off 
   0      13364889  off on  on  
   0      15150489  off on  off 
   0      15150962  off off off 
   0      15151490  on  off off 
   0      16936089  on  off on  
   0      18721689  on  off off 
   0      18722162  on  on  off 
   0      20507289  on  on  on  
==============================================================================
Simulated time: 22118400 cycles
Time for simulation: 1.337 seconds
Total throughput: 16.543306 mhz