Using Avrora for Sensor Network ResearchOne of the main goals of developing Avrora is to enable sensor network research by providing an accurate and scalable simulator for the actual hardware platform on which sensor programs run. Avrora has a nearly complete implementation of the mica2 hardware platform, including a nearly complete ATMega128L implementation, and an implementation of the CC1000 AM radio.The architecture of Avrora allows multiple Simulator objects to be instantiated and run. Avrora can then simulate an entire network of nodes by periodically synchronizing the simulator instances to preserve the timing interactions between them. Nodes can send and receive bytes over the CC1000 radio.
Single node Simulation - BlinkYou can simulate your sensor network program in isolation on one node or as part of a network. Simulating a single node can allow you to test crucial parts of your program before you run it in a network simulation. You can debug, test, profile, and analyze the program in isolation. You can simulate a sensor network program for the mica2 platform by simply specifying the -platform=mica2 option on the command line.An example of running the Blink program:
Multiple-node SimulationAvrora is also capable of running a complete sensor network simulation with full timing accuracy, allowing programs to communicate via the radio using the software stack provided in TinyOS. It does this with a complete simulation of the CC1000 AM radio. Let's go through an example of running a multiple-node simulation.
Step 1 - Compile the TinyOS programsSuppose we want to run the CntToRfm and the RfmToLeds TinyOS programs in simulation and measure the sleeping behavior. First we compile the programs to an ELF file for the mica2 hardware platform, and then run avr-objdump on each to produce a file readable by Avrora. For more information, see the page on objdump.
Step 2 - Test SimulationNow, having done that for both applications, we are ready to run. Let's try running two nodes for 10 simulated seconds, with one node running CntToRfm and the other running RfmToLeds. Notice that in order to select a multi-node simulation, we will need to specify the simulation option with the value sensor-network. This tells Avrora to the simulation type is a sensor network, rather than the default, single node simulation.
Step 3 - Attach Monitors to SimulationNow that we can run the nodes in simulation, let's attach a monitor to analyze the network behavior. Luckily, there is already a built-in monitor in Avrora to do this! We can simply add the -monitors=packet option to enable this monitor, which displays the packets sent by each node.
Profiling Multiple-node SimulationsAs we saw in the example, profiling of multiple-node simulations is as easy as it is for single node simulation. All the flexibility that is afforded by the monitor organization is preserved in multiple node simulations. Therefore, building new monitors and using the default monitors work in exactly the same way, by specifying the -monitors option. Most of the monitors that work for single node simulation, such as profiling execution or memory accesses, work equally well for multiple-node simulation. This allows you to use Avrora to profile your applications across the entire sensor network--a feature not available in any other simulator. For more information on building your own monitors see the page on monitoring.
More Command Line OptionsHelp for each option in this action is available simply by running Avrora with the -help sensor-network parameter, and is also available in the online help. |