150 likes | 161 Views
Valliappan Annamalai. Simulation of Distributed Application and Protocols using TOSSIM. Traditional system. Application 1. Application 2. Kernel. Provides Services. Mouse. Monitor. Keyboard. Wireless Transceiver. Sensor Systems. Sensor applications developed on top of TinyOS.
E N D
Valliappan Annamalai Simulation of Distributed Application and Protocols using TOSSIM
Traditional system Application 1 Application 2 Kernel Provides Services Mouse Monitor Keyboard Wireless Transceiver
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
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
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.
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
Interface Example: Timer interface Timer { command result_t start(char type, uint32_t interval); command result_t stop(); event result_t fired(); }
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.
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
Wiring of components: Blink Component Entry point Main stdControl Interface BadgeM implements stdControl interface BlinkM Timer Interface TimerC provides the interface for Setting timer interrupt parameters BadgeM implements the event handler for fired event Led interface for turning on and off LEDS SingleTimer All wirings Below this are predetermined Clock Interface HPLClock provides the interface for Setting timer interrupt parameters TimerC implements the event handler for fired event HPLClock Set Interrupt Specific parameters ISR calls clock fired Event handler Leds Hardware Clock
Event and Commands in BlinkM stdcontrol Interface Command Main Event Starts FIFO Function stdcontrol Interface Start Start Tasks BlinkM FIFO Scheduler Fired Start Timer Interface Leds Interface SingleTimer setInterval Fired HPLClock RedToggle Fired Clock ISR (TOSH_INTERRUPT) Leds
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.
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?
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.
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