TOSSIM

What is TOSSIM:

  • Tossim is a type of simulator used in TINY OS.
  • Directly compile from Tiny OS.
  • It has an extensible network
  • Simultaneously tossim simulate thousands of nodes.
  • TOSSIM is a library

Features of TOSSIM:

  • TOSSIM uses two interfaces which are,
    • C++
    • Python
  • Simulate MicaZ mote.
  • To model radio noise it uses CPM (Closest-fit Pattern Matching).

TOSSIM-Simulator-Projects

Other TOSSIMFeatures:

  • Injecting packets
  • Inspecting internal variables
  • C++ interface
  • Debugging using gdb

TOSSIM Plugins:

  • A TinyViz plugin is a software module
  • It watches for events coming from the simulation
  • The main plugins likely to use are:
    • Debug messages
    • Set breakpoint
    • ADC readings
    • Sent radio packets
    • Radio links
    • Set location
    • Radio model

Radio interfaces:

  • Tiny OS provide direct access to the radio through several interfaces which includes:
    • Packet
    • Send
    • Receive
    • PacketAcknowledgements
  • Tiny OS provide Active Message (AM) layer to multiple access to the radio

AM layer:

  • AM layers are similar function to Ethernet frame type.
  • AM layer also includes destination field.
  • It stores the AM Address

Coding:

from TOSSIM import *

import sys, os, getopt

optSimDuration = __SIMULATION_DURATION_SECS__

optNumNodes = __NUM_NODES__

optLowRadioFidelity = True

ONE_SECOND = 10000000000

def usage():

print ‘Usage: runTossim.py [-options]’

print ‘\t\tto run the Tossim simulation.\n’

print ‘where options include:’

print ‘-h, –help\tdisplay this message’

print ‘–duration <t> in seconds\n\tdefault: ‘ + str(optSimDuration)

print ‘–num-nodes <n>\n\tdefault: ‘ + str(optNumNodes)

print ‘–low-radio-fidelity [true|false]\n\tdefault:’ + str(optLowRadioFidelity) + ” (set to true for faster simulations)”

#Converts a string to boolean based on the value of the first character.

def convertBool(text):

if text == ”:

return False

if text[0] in (‘T’,’t’):

return True

if text[0] in (‘F’,’f’):

return False

print ‘Cannot convert “‘+text+'” to boolean value’

sys.exit(1)