Programming Wireless Sensor Networks
Francisco Martins University of Lisbon
MiNEMA Winter School, Göteborg, Sweden,March 23-26, 2009.
1
Programming Wireless Sensor Networks Francisco Martins University - - PowerPoint PPT Presentation
Programming Wireless Sensor Networks Francisco Martins University of Lisbon MiNEMA Winter School, Gteborg, Sweden,March 23-26, 2009. 1 Summary Sensor networks overview Hardware and Operating System Program Languages and Systems
Francisco Martins University of Lisbon
MiNEMA Winter School, Göteborg, Sweden,March 23-26, 2009.
1
language
2
constrained in terms of
range
possible deployed into unaccessible places
intervention
3
routing, security, energy consumption
more recent and scarce
abstraction level (nesC over TinyOS)
4
perception of its underlying hardware
groups of sensors satisfying some criteria
queriable via declarative languages (e.g. SQL)
hosting autonomous mobile agents
5
provided to the programmer
miniaturization, and cost restrictions
complexity and size of programs.
the distance. It’s the most energy consumption component
6
sound, magnetic field, temperature, etc.
AAA battery will last from 5 to 17 years.
7
8
threaded execution-model with non- preemptive tasks
the application
language nesC
9
applications and dynamic loading of modules
the OS (not the application) manages the CPU
10
network perception hardware interaction data acquisition
11
network perception
C/ C/ C/ C/ C/C/
macroprogramming sensor based
hardware interaction data acquisition
11
network perception
C/ C/ C/ C/ C/C/
macroprogramming sensor based
hardware interaction
C
low-level middleware virtual machine high-level
data acquisition
11
network perception
C/ C/ C/ C/ C/C/
macroprogramming sensor based
hardware interaction
C
low-level middleware virtual machine high-level
data acquisition
C/
messages streams databases mobile agents
11
problems for large-scale applications
12
files, single-hop, bidirectional comm.)
environment
13
abstract away specific hardware and OS
control
memory demands that may be incompatible with most restrictive sensor devices
14
event-handlers upon reception
byte code, running on the bare metal.
station (suites serialized to the sensors)
15
programmer
accentuating the computational overhead for the WSN
GLUE
16
middleware.
addressed by the application
topology of the network, assigning computations to event perception.
GLUE
17
all networking and communication details
architecture or configuration
its run-time representation
regions and data streams as its basic programming abstraction.
installed on-the-fly and run on sensors
network and must implement its behavior, compile it, and deploy it
aware of WSN details (e.g. architecture)
SensorWare, Smart Messages
C/ C/ C/ C/ C/20
typical distributed applications without requiring the developer to specify the behavior of each sensor.
and run-time libraries
C/
21
position, distance (in number of hops), properties of the data gathered
Diffusion, TAG, Regiment,...
C/
22
generated by nodes, packed in messages and transmitted over the network
programming like message routing and data and code dissemination.
23
hardware, communication protocol, topology (region streams).
(aggregate data) and map (apply some function to the stream).
24
can apply database processing primitives
request into low-level sensor specific
data via web services.
25
which applications composed of multiple, interacting, mobile agents evolve.
problems
Messages (Java based)
C/
26
classification of 30 programming languages + discussions on OSs and VMs
Proposals/Abstractions Hardware interaction Network perception Data acquisition Abstract Regions [45]
C
C/Agilla [21]
C/
AmbientTalk [13]
Cosmos [5]
Cougar [23]
27
Sink Node1 Node2
28
Sink Node1 Node2
28
Sink Node1 Node2
getTemp getTemp getTemp getTemp
28
Sink Node1 Node2
replyTemp replyTemp replyTemp
28
29
program queue code modules
29
program queue code modules position energy
29
[ idle ▹ System :: {...} /* /dev */ Temperature :: { getTemp() = let t = System.senseTemp() in let m = System.getMAC() in send Temperature.replyTemp(t); send Temperature.getTemp() replyTemp(t, m) = send Temp.replyTemp(t, m) } ]
30
[ idle ▹ System :: {...} /* /dev */ Temperature :: { getTemp() = let t = System.senseTemp() in let m = System.getMAC() in send Temperature.replyTemp(t); send Temperature.getTemp() replyTemp(t, m) = send Temp.replyTemp(t, m) } ] did you spot the error?
30
[ send Temperature.getTemp() ▹ System :: {...} /* /dev */ Sink :: {...} /* sink specific module */ Temperature :: { getTemp() = {} replyTemp(t, m) = Sink.log(t, m) } ]
31
[ send Temperature.getTemp() ▹ ... ] | /* the sink */ [ idle ▹ ... ] | /* node 1 */ [ idle ▹ ... ] | /* node 2 */ [ idle ▹ ... ] /* node 3 */
32
temperature
forget to update the highest broadcasted temperature value)
33
Temperature :: { getTemp() = let t = ... in let m = ... in Temperature.transmit(t, m); send Temperature.getTemp() replyTemp(t, m) = let mT = Temperature.maxTemp() in if (t > mT) then Temperature.transmit(t, m) transmit(t, m) = install {Temperature::maxTemp() = m}; send Temperature.replyTemp(t,m) }
34
[ install { System :: { deploy(m) = install m;
send System.deploy(m)
...} /* the remaining system modules */ } ▹ {} ]
35
[ install {
System :: ... /* as for the nodes */ Sink :: ... /* local sink code */ Temperature :: ... /* sink’s temperature */ };
send System.deploy(Temperature :: ...); /* node’s temp */ send Temperature.getTemp() /* query the WSN */ ▹
{}
]
36
S ::= Sensor Networks 0 empty network | [ P : ... : P ▹ C ] sensor | S | S composition p e
37
S ::= Sensor Networks 0 empty network | [ P : ... : P ▹ C ] sensor | S | S composition p e P ::= Processes v value | v.l(v1...vn) function call | send X.l(v1...vn) transmission | install(v) install module | let x = P in P new variable | post {P} defer execution
37
S ::= Sensor Networks 0 empty network | [ P : ... : P ▹ C ] sensor | S | S composition p e P ::= Processes v value | v.l(v1...vn) function call | send X.l(v1...vn) transmission | install(v) install module | let x = P in P new variable | post {P} defer execution v ::= Values b built-in value | x variable | X module name | M module
37
S ::= Sensor Networks 0 empty network | [ P : ... : P ▹ C ] sensor | S | S composition p e P ::= Processes v value | v.l(v1...vn) function call | send X.l(v1...vn) transmission | install(v) install module | let x = P in P new variable | post {P} defer execution C ::= {Mi} Module Collections M ::= Modules X :: {li(x1...xn) = Pi} named module v ::= Values b built-in value | x variable | X module name | M module
37
program is to explain how its operations compute
Operational Semantics
State 1 State 2 State 3 State 4 a b c
38
if then
e > ein [post {P} : P1 : ... : Pn ▹ C ]p
e
[P1 : ... : Pn : P▹ C ]p
e - ein
39
if then
e > ein [post {P} : P1 : ... : Pn ▹ C ]p
e
[P1 : ... : Pn : P▹ C ]p
e - ein
e > ein [X.l(v) : ... ▹ C ]p
e
[P{v/x} : ... ▹ C ]p C(X) = M M(l) = (x) P
e - ein
39
why are they interesting for WSN?
that l is a function of module X and receives a parameter of the type of v
40
program will not destroy the integrity of the virtual machine
not perform some undesired action
compiler), for instance using type systems
41
proposals
programming language
42
semantic properties all way down from a high-level language to a bytecode.
languages
43
Francisco Martins University of Lisbon
MiNEMA Winter School, Göteborg, Sweden,March 23-26, 2009.
44