03.08.2013 Views

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

the motes as three separate modules: BLESS_Start, BLESS_Receive, <strong>and</strong> BLESS_Send 13 ,<br />

each <strong>of</strong> which only deals with a single thread <strong>of</strong> reaction. In addition, there are a number <strong>of</strong><br />

global variables that use the TinyGUYS mechanism <strong>and</strong> are accessed from within at least<br />

two <strong>of</strong> the modules. This structure is displayed in Figure 20.<br />

from<br />

Application<br />

init<br />

Module BLESS_Start<br />

Initiate<br />

Router<br />

Message<br />

Module BLESS_Receive<br />

Process Message<br />

Generic Comm<br />

Module BLESS_Send<br />

Send Message<br />

Generic Comm<br />

TinyGUYS<br />

Variables<br />

Num Hops<br />

Heard Index<br />

Parent Index<br />

Motes Heard[]<br />

Heard Hops[]<br />

Figure 20: Structure <strong>of</strong> BLESS implementation under <strong>TinyGALS</strong>. Each shaded rectangle<br />

represents a module. The guarded global variables are shown on the right.<br />

The BLESS_Start module contains a single component that prepares an outgoing<br />

message initiated by the local application. The input port <strong>of</strong> BLESS_Start is connected<br />

to this application module <strong>and</strong> the output port is connected to the sending component within<br />

BLESS_Send. The BLESS_Start module reads the guarded global variables to deter-<br />

mine the current parent node <strong>and</strong> set up the outgoing message.<br />

The BLESS_Receive module is comprised <strong>of</strong> two components: Generic Comm 14<br />

receives messages from the radio, <strong>and</strong> Process Message processes those messages.<br />

The output port <strong>of</strong> BLESS_Receive is connected to the sending component within BLESS_Send<br />

to pass messages that must be <strong>for</strong>warded to the base. The BLESS_Receive module ac-<br />

cesses the guarded global variables both in order to update them <strong>and</strong> to use them when<br />

<strong>for</strong>warding a message.<br />

13 Resetting the parent is done within a separate module triggered directly by the clock.<br />

14 Generic Comm is the same as GENERIC COMM, an <strong>of</strong>f-the-shelf TinyOS component that implements<br />

the network stack.<br />

40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!