Beruflich Dokumente
Kultur Dokumente
Goals of TOSSIM
Scalability
Able to handle large scale networks > 1000 nodes
Completeness
Capture all details and components
Fidelity
Capture the network interaction at a fine grain
Bridging
Ease the process of implementation of an algorithm
What is TOSSIM?
Simulator for TinyOS applications Discrete event simulator Compiles directly from source code Simulates network at the bit level Allows for some real world phenomena bit error
What is TOSSIM?
TOSSIM emulates the behavior of underlying hardware
ADC Clock EEPROM Radio stack
TOSSIM Architecture
Five parts
1. Compiling components into simulation architecture 2. Discrete event queue 3. Few reimplemented hardware abstractions 4. Extensible radio and ADC models 5. Communications service for external programs
Key Points
Time at mote instruction cycle frequency 4MHz = 4 x 106 ticks/second Radio models external to TOSSIM; Models network as a directed graph of bit error probabilities Almost perfect simulation of TinyOS networking stack at bit level Communication service: Allows user to drive, monitor, debug simulation
Radio Models
Network is modeled as a directed graph with bit error probabilities for each edge (u,v) in the graph Signal is either a 1 or 0 All signals have equal strength No propagation model, no collision model
Radio Models
Simple:
every mote in one cell, bits perfectly transmitted
Lossy:
connectivity determined at startup
Compiling TOSSIM
Code: tos/lib/tossim Simulation implementations of packages are in optional sim subdirectory of component To compile:
Make micaz sim Note: micaz is only platform supported by TOSSIM
Python Script
$ From TOSSIM import * $ T = Tossim([])
- Square brackets are for optional arguments
$ M = T.getNode(12)
- Create a node id 12
$ T.runNextEvent()
- Returns 1 if there is an event, 0 if no event to run
Mote Calls
Can turn motes on/off
m.turnOn() m.turnOff()
Debugging Statements
Debugging output system dbg Four Calls:
1. dbg
Node ID, debugging statement
2. dbg_clear
Debugging statement (good for complex types)
3. dbgerror
Node ID, error statement
4. dbgerror_clear
Debugging Statements
Ex:
Event void Boot.booted() { call Leds.led0On(); dbg(Boot, Application booted.\n); call AMControl.start(); }
Output Channel Message (sprintf format)
Debugging Statements
Print out current simulation time
dbg(Blink, Time: $s\n, sim_time_string());
Channels by default are dropped, must specify where to direct channel output
import sys T.addChannel(Boot, sys.stdout) F = open(log.txt, w) T.addChannel(Blink, F)
Configuring a Network
To communicate between nodes
Create a network topology
Default TOSSIM radio model is signal strength based Simulates RF noise and interference Can input trace models or noise topo.txt
Source_id, Dest_id, radio_gain
Conclusions
Basic workings of TOSSIM Use simulations to test programs under varying scenarios TinyViz (not in 2.0)