simulation of distributed application and protocols using tossim valliappan annamalai

15
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Upload: sara-clark

Post on 03-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Simulation of Distributed Application and Protocols using TOSSIM

Valliappan Annamalai

Page 2: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Traditional system

Keyboard

Kernel

MonitorMouseWirelessTransceiver

Application 1 Application 2

ProvidesServices

Page 3: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Sensor Systems

Sensor applications developed on top of TinyOS. TinyOS similar to traditional OS but light weight. Some of the services provided by TinyOS

Transmit and receive a packet wirelessly. LED for displaying to display output. Accessing storage (Flash) etc.

Application specific. So only one application is loaded onto each sensor.

TinyOS component-based OS

Page 4: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

TinyOS Components

Provide services. Services are accessed via interfaces. Interfaces defines functions used for

accessing services (e.g. Timer, SendMsg, RecvMsg).

Function calls: Blocking Non-blocking

Page 5: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Split-phase operation

In TinyOS all function calls are non-blocking. Example: Sending packets. Application sends data by invoking a function called send. Transmission of packet is a long latency operation.

Long latency operations are grouped into a function called Task which is scheduled for execution when CPU is idle.

So packet is scheduled for later transmission and send immediately returns.

After transmission TinyOS notifies the application by invoking a callback function implemented by the application.

Two way communication between components.

Page 6: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Commands & Events

Interfaces define both the functions for accessing the service and the call back functions (enables two-way communication between components).

Commands: Functions invoked to access a service. Events: Callback functions. Component providing an service via an interface will

have command definition. Component using an interface will have event definition. Example:

Command: start of Timer Event: fired of Timer

Page 7: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Interface Example: Timer

interface Timer {

command result_t start(char type, uint32_t interval);

command result_t stop();

event result_t fired();

}

Page 8: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

TinyOS Application

Will contain at least one component called configuration and might contain another component called Module.

Configuration: Defines how TinyOS components are connected to the Application (Wiring).

Module: Application specific code. Example: Blink Application.

Configuration: Blink.nc Module: BlinkM.nc

Each application provides stdcontrol interface.

Page 9: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Main Component

Entry point into application. Starts a scheduler queue (FIFO) for Tasks. Passes control to application component

through start command of stdcontrol interface provided by application.

Two threads of execution Scheduler for tasks Commands and events

Page 10: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Wiring of components: Blink Component

BlinkM

SingleTimer

HPLClock

Hardware Clock

Set InterruptSpecific parameters

ISR calls clock firedEvent handler

Clock InterfaceHPLClock provides the interface for Setting timer interrupt parameters TimerC implements the event handler for fired event

Timer InterfaceTimerC provides the interface forSetting timer interrupt parametersBadgeM implements the event handler for fired event

Leds

Led interface forturning on and offLEDS

MainstdControl InterfaceBadgeM implements stdControl interface

Entry point

All wiringsBelow this arepredetermined

Page 11: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Event and Commands in BlinkM

FIFOScheduler

Clock ISR(TOSH_INTERRUPT)

HPLClock

SingleTimer

BlinkM

Fired

Fired

Fired

Leds

RedToggle

Main Starts FIFO

StartStart

Command

Event

Function

Tasks

Start

setInterval

TimerInterface Leds

Interface

stdcontrolInterface

stdcontrolInterface

Page 12: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

TOSSIM

Simulator to test sensor network applications. Distributed systems are hard to debug. Before actual deployment TOSSIM can be used to

debug developed application on a large sensor network.

No specific modification to application code. Application compiled for TOSSIM will the simulator

code too. Run the exe file and pass the number of nodes to be

simulated as the parameter.

Page 13: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Programming Assignment I

Develop an application for the flooding-based tree construction protocol that we discussed in class on TinyOS using NesC and simulate it using TOSSIM

Things you should know Basic NesC programming language constructs How to transmit and receive user defined packets using the

services provided by the communication component in TinyOS?

How to use TimerM component? How to compile the application for TOSSIM? How to display the output in TOSSIM?

Page 14: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Deliverables

Soft copy of your application's configuration file. Soft copy of your application's module file Soft copy of the header file with packet definitions

and AM message type definitions A document that details the working of your

application. Also should contain the difference in the routing tree, if any, when the lossy and the simple radio model are used. Also include the amount of time it took you to complete each of the steps mentioned above and the task.

Zip file which contains all these files. Name the zip file using your lastname_firstname.

Page 15: Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai

Estimated Time for Assignment Step 1: 2 Hours Step 2: 8 Hours Step 3: 2 Hours Step 4: 1 Hour Task: 5 Hours Total: 18 Hours