Programming WSNs:
from Theory to Practice
Luca Mottola (luca@sics.se)
University of Trento, Italy
Swedish Institute of Computer Science (SICS), Sweden
Gian Pietro Picco (picco@dit.unitn.it)
University of Trento, Italy
Tutorial at the 6th European Conference on Wireless Sensor Networks (EWSN)
Cork, Ireland – February 11th, 2009
Uses Send
nesC/TinyOS
Component Model
sendDone()
sendMsg(msg
Signals
Calls
Components encapsulate
)
state and processing
use or provide interfaces
Interfaces list
commands and events Provides Send
Configurations wire
components together
Function Commands Events
calls
Implement
Using Call Command
Event Handler
Implement
Providing Signal Event 27
Command Body
Multi-hop Connected:
EnviroSuite
Mainly designed for object
tracking
objects are physical phenomena
An OO language is used for:
conditions to create objects
operations to process the
corresponding data
Supported by a dedicated
environment (compiler and
runtime support) targeting nesC
47
Abstract Regions
Example: Object Tracking
location = get_location(); Setup a region
region = k_nearest_region.create(8); containing
while (true) { the 8 nearest neighbors
reading = get_sensor_reading(); Share sensed and
region.putvar(reading_key, reading); processed data with region
region.putvar(reg_x_key, reading * location.x); members
region.putvar(reg_y_key, reading * location.y);
if (reading > threshold) {
max_id = region.reduce(OP_MAXID, reading_key);
if (max_id == my_id) {
sum = region.reduce(OP_SUM, reading_key);
sum_x = region.reduce(OP_SUM, reg_x_key);
sum_y = region.reduce(OP_SUM, reg_y_key);
centroid.x = sum_x / sum;
centroid.y = sum_y / sum;
send_to_basestation(centroid);
} Compute aggregates over
} the region using reduce
50
Logical Neighborhoods
Neighborhoods “I want to address all
vibration sensor in a given
location…”
A (logical) neighborhood template
neighborhood is the VibrationSens[ f ]
with Function = “sensor” and
set of nodes satisfying Type = “vibration” and
Floor = f
a predicate
encoded in a Data
Scope
neighborhood template
instantiation specifies
where to evaluate the create neighborhood vb_my_location
from VibrationSens[ f: “Floor1” ]
predicate max hops 2
“…lying at a maximum
distance of two hops”.
56
Logical Neighborhoods
Example
Send a command to toggle blue to nodes
sensing humidity above 50%
neighborhood template
Tutorial1[]
with Type = "Humidity" and create node sn from
Reading > 50 Sensor
create neighborhood tut_ln1 use cost 1
from Tutorial1[] Type = “Humidity” 58
max hops 10 Reading as call …
Regiment
Example: Plume Monitoring
Goal: detect a plume in a large area
To minimize false positives:
a node reports its measurement only if above threshold
sum of all “high” readings reported only if above threshold
fun abovethresh(t) {t > CHEM_THRESHOLD} Aggregates all
fun read(n) {sense (“conc”, n)}
values in region
fun sum(r) {rfold((+), 0, r)}
r
detects = rfilter(abovethresh, rmap(read, world));
hoods = rmap(fun(t,nd){khood(1,nd)}, detects);
sums = rmap(sum, hoods);
rfilter(fun(t){t > CLUSTER_THRESH}, sums) BASE
Filters the outliers
Expands the
Computes the sum
region by 1 hop
Filters the outliers over 61
each of these regions
Hood
Application Structure
Bootstrap
command to
trigger data push,
pull command
also provided
Scribbles are
local annotations
(e.g., aggregations) Determines how
attribute values
to the state of a are sent (e.g.,
neighbor period)
Filters are
boolean functions
encoding
neighborhood
membership
rules
Data marshalling layer, takes care
of the actual communication 75 75
0 comments
Post a comment