Iwst09 Submission 13
Iwst09 Submission 13
Iwst09 Submission 13
Jimmy Osmont
CS Dept., UBO
France
g.kremer@wanadoo.fr
Jimmy.Osmont@univ-brest.fr
Abstract
To ease the development for sensor networks, we propose a
two-stage top-down flow: design and simulation, then synthesis of sensor code. The flow is an alternative to a direct
design at node level.
The first operation is to describe network topologies on
a graph model using textual or interactive tools. Simulations are achieved by generating a system of processes into
an Occam program which is compiled and executed. This
program represents a distributed machine conforming to the
synchronous communication model, which is a strong reference for algorithm design.
The network simulation allows an early check of solutions to problems such as routing or dumping network data in
various deployment topologies. It provides fast exploration
of algorithm, and topology spaces, focusing on the difficult
collective behaviour rather than local level programming.
1. Introduction
Wireless Sensor Networks (WSN) is an emerging domain
with numerous applications arising, that take benefits from
the communication and sensor technology progresses. Typical nodes for WSN are very small systems grouping a microcontroller, a wireless communication transceiver, local acquisition and control subsystem, and a power supply. Node
hardware size can be in the order of few square centimeters
with very low costs, the technology tendency being still to
decrease node sizes and power consumption by integrating
memory, logic and analogue interfaces on mixed-signal circuits[Doboli and Currie 2007].
Permission to make digital or hard copies of all or part of this work for personal or
classroom use is granted without fee provided that copies are not made or distributed
for profit or commercial advantage and that copies bear this notice and the full citation
on the first page. To copy otherwise, to republish, to post on servers or to redistribute
to lists, requires prior specific permission and/or a fee.
IWST 09 September 2009, Brest.
c 2009 ACM [to be supplied]. . . $10.00
Copyright
Bernard Pottier
LabSTICC UMR CNRS 3192, UBO
France
pottier@univ-brest.fr
P6
P6.P18
P18.P6
P6.P13
P18
P13.P18
P11.P18
P18.P11
P11
P18.P13
P13
P13.P11
P11.P13
P15.P3
P3
P3.P5
P5.P3
P3.P15
P15.P5
P15
P5
P5.P15
Figure 1. From distribution to connectivity: node distribution is decided to obtain wireless connections. Circles represent area where other sensors can (likely) receive the center
messages.
P10.P12
P9.P12
P12
P12.P10
P12.P9
P19.P12
P12.P19
P8.P7
P19.P8
P9.P19
P10
P10.P9
P9.P10
P9
P19
P8.P19
P8
P7.P8
P19.P7
P7
P19.P9
P7.P2
P2.P7
P2
P2.P14
P14.P2
P14
P7.P19
P10.P17
P9.P20
P17.P10
P20.P17
P20.P9
P17
P17.P20
P20
P20.P4
P4.P20
P4.P17
P4
P17.P4
Figure 2. Process organization for a 20 nodes random system. Geometric space is a drawing view of 640pts, sensors
can reach neighbours at the same distance. Some nodes are
isolated
An Occam program is a structural description of a concurrent activity. If the language, and associated instruction set,
have relatively high level system primitives, it remains that
the process organization, and the communication channels
must be given in the program, and is checked effectively by
the compiler. In the case of sensors, we have irregular system
architectures.
By analyzing the network model from section 2, we can
produce everything necessary for a translation to Occam:
channel declarations (perhaps thousands!)
grouping of channels in aliases used as process parame-
space reservations
starting the WSN as a set of cooperating processes
declaring procedure skeletons for process found in the
network
tracing.
nodes
10
100
400
user
5.8s
7.4m
149m
real
1.1s
1.3m
42m
channels
14
1510
24496
controller, small RAM and flash memory, general purpose I/Os, SPI interface.
Because the controller can directly integrate analogue
signals, a couple of these circuits is enough to build a wireless sensor.
Other options include ARM system on chip, GPS receiver
on one chip etc.. ARM can be programmed using free GNU
tool chain, which is not the case for the first controller.
In each case, systems have very low memory capacity, in
particular for data and stack management.
4.1 Options for implementation
A reference for low level implementation is simply the target
processor for Occam. This processor (transputer) existed
several years ago, and still survives due to its instruction set
(TIS).
The Kent Retargetable Occam Compiler (KROC) proceeds in two passes producing an intermediate code suitable for Occam, then translating to i386 native code. TIS
has process level semantics with instructions for launching
processes, communicating on channels, computing barriers,
managing timers, etc. . . TIS is documented by [Inmos a],
has a simulator VM written in C, and has a portable interpreter initiative called the Transterpreter [Jacobsen and
Jadud 2004].
Writing such a VM is not very difficult due to the abundant documentation and examples available. As there is a
compiler available, a first option to cover WSN needs is to
implement a VM adapted to the sensor framework removing useless instructions, and adding new ones to support local control directed to sensing devices, and the synchronous
communication model. TIS code is very compact and perfectly suitable for spreading programs on WSN, securely and
at low cost. This can be a decisive advantage for the VM approach.
Another option for practical support is to build a synthesizer for C, if there is some chance to compile C to a controller, or native processor code in the other case.
The practical communication issue is discussed with a
proposition in the following section.
4.2 A link access model
Wireless transmissions are inherently multiple access on a
shared medium. Basic communications are always broadcast, and point to point messaging is a consensus on a channel choice and how to decide to receive a packet.
Collisions can happen, and this is more likely to arise
in some well known situations. The exposed terminal and
the hidden terminal problem are two of them. Both are well
explained in the literature [Karl and Willig].
Two nodes sending data at the same time and at the
same frequency to a third node is an example of a potential
collision situation. To reduce packet losses, the two nodes
8
7
6
5
7
1
9
3
6
5
7
3
Few observations can be made relative to sensor distribution and relative to the synchronous model applicability.
Sensor generally do not need to speak all the time, but periodically, or on-demand. One can see the general behaviour
of a sensor as a cycle, including power saving mode, then
the sensor awakes, process data and enter a communication
activity. For this to work, it is necessary to maintain a shared
clock reference.
During communication period, each sensor must speak
and listen. In a large network, there will be shared slots due
to coloring. In small, grouped networks, there can be a complete connectivity inside the network. In this situation, it is
necessary to have one slot for each node. Another interesting
question is the relation between the synchronous communication model, and TDMA.
As we have a turn allocated for each sensor, we can
implement the neighbour communication phase by sending
our messages at this turn, listening the rest of the superframe,
or only one part of the slots if the neighbour slots are known.
5. Conclusion
9
1
We have described a top down approach for WSN programming. An associated framework is being built centered on
a graph model. This model can be addressed in different
ways such as texts, interactive maps[Kremer and Osmont
2009], or random distributions. It can be translated in different ways, and an example are Occam programs which
processes execute loops embedding communications and local processing according to the synchronous communication
model. The aim of the framework is to focus on distributed
algorithms design, use and validation, prior to sensor code
generation. Concurrent simulation of intermediate programs
can be obtained using the KROC compiler targeting multicore processors. As it is, the framework has been used to
simulate network activities such as route management, effective routing (RIP, AODV, DSDV), naming. Very large random networks have been produced to check correctness of
the solutions.
It is a known question that the time-driven simulation
achieved on the system process can be sub-optimal compared to an event driven simulation that can reduce the number of channel synchronizations. An improvement will thus
to produce a different execution sequenced by an appropriate
scheduler supporting a virtual time.
It is also known that more support could be obtained from
Occam variant (Occam-Pi) that allows to describe mobile
channels, and mobile barriers, but it appeared risky to use
this support, due to the necessity to control future sensor mo-
graph1
sample network
graphSample
m e s s a g e s M1
P1 { P2 , P3 ,
P2 { P1 , P3
P3 { P1 , P2
P4 { P1 , P2
</ methods >
b u i l d a s y n c h r o n o u s Occam p r o g r am
| net graph t e x t f i l e |
n e t : = s e l f new g r a p h 1 . p a r s e r model
g r a p h : = n e t b u i l d G r a p h . g r a p h model
t e x t : = g r a p h p r o g r am Main . Occam t e x t
f i l e : = sy n cMo d el . occ a s F i l e n a m e w r i t e S t r e a m
f i l e nextPutAll : text ; close .
</ methods >
B.
, M2 .
P4} Pim
} Pam
} Poum
, P3 } Poum
g e n e r a t e d a t J u n e 2 3 , 2009 1 0 : 1 7 : 4 3 am
g e n e r i c s y n c h r o n o u s n e t w o r k model
B e r n a r d P o t t i e r . UBO
r i n g 5
m e s s a g e s n u l l
search leader .
P0 { P1 } Node
P1 { P2 } Node
P2 { P3 } Node
P3 { P0 } Node
VAL [ 4 ] [ 2 ] BYTE N e t P r o c e s s I S [
P0 , i d : 1
P1 , i d : 2
PAR
PAR i =0 FOR SIZE i n
in [ i ] ? inMessages [ i ]
PAR j =0 FOR SIZE o u t
out [ j ] ! outMessages [ j ]
dummy b e h a v i o u r
SEQ i =0 FOR SIZE i n
outMessages [ i ] : = inMessages [ i ]
:
PROC r i n g 5 ( )
C h a n n e l d e c l a r a t i o n s
CHAN OF r i n g 5 . p r o t o P0 . P1 :
CHAN OF r i n g 5 . p r o t o P1 . P2 :
CHAN OF r i n g 5 . p r o t o P2 . P3 :
CHAN OF r i n g 5 . p r o t o P3 . P0 :
C h a n n e l t a b l e d e c l a r a t i o n f o r n o d e s
P0 . o u t I S [ P0 . P1 ] :
P0 . i n I S [ P3 . P0 ] :
P1 . o u t I S [ P1 . P2 ] :
P1 . i n I S [ P0 . P1 ] :
P2 . o u t I S [ P2 . P3 ] :
P2 . i n I S [ P1 . P2 ] :
P3 . o u t I S [ P3 . P0 ] :
P3 . i n I S [ P2 . P3 ] :
P2 , i d : 3
P3 ] :
VAL [ 4 ] [ 4 ] BYTE N e t P r o c e d u r e I S [
Node , i d : 1
Node , i d : 2
Node , i d : 3
Node ] :
PROTOCOL r i n g 5 . p r o t o I S
BYTE :
P r o c e d u r e d e f i n i t i o n s
PROC Node ( [ ]CHAN OF r i n g 5 . p r o t o i n ,
[ ]CHAN OF r i n g 5 . p r o t o o u t ,
VAL INT i d e n t i t y )
m e s s a g e s d e c l a r a t i o n Node
[ 1 ] BYTE i n M e s s a g e s :
[ 1 ] BYTE o u t M e s s a g e s :
[ 2 ] BYTE MyName :
Code o f p r o c e d u r e Node
SEQ
SEQ i n d e x = 0 FOR SIZE MyName
MyName[ i n d e x ] : = f o l d e d
NetProcess [ i d e n t i t y ] [ index ]
SEQ t o u r s = 0 FOR 100000
SEQ
Pr o g r am Body
PAR
Node ( P0 . i n , P0 . o u t , 1 )
Node ( P1 . i n , P1 . o u t , 2 )
Node ( P2 . i n , P2 . o u t , 3 )
Node ( P3 . i n , P3 . o u t , 4 )
End o f p r o g r am body
:
References
George Aggelou. Wireless Mesh Networking, with ZigBee. Mc-Graw Hill Communications, 2008.
Lan S. Bai, Rober P. Dick, and Peter A. Dinda. Archetype-based design: Sensor network programming for application experts, not just
programming experts. IPSN09, San Francisco, April 2009.
Alex N. Doboli and Edward H. Currie. Introduction to Mixed-Signal, Embedded Design. Cypress semi-conductor, 2007.
David Gay, Philip Levis, David Culler, and Eric Brewer.
http://nescc.sourceforge.net/papers/nesc-ref.pdf.
May 2003.
URL
Adele Goldberg and David Robson. Smalltalk-80, the language and its implementation. Addison-Wesley, 1983.
Inmos. Transputer instruction set, a compiler writers guide. Inmos, a.
Inmos. Occam2 reference manual. Prentice-Hall International, b.
Christian L. Jacobsen and Matthew C. Jadud. Communicating Process Architecture, chapter The Transterpreter, a Transputer Interpreter,
pages 99106. IOS Press, 2004.
Holger Karl and Andreas Willig. Protocols and architectures for wireless sensor networks. Wiley.
Guillaume Kremer and Jimmy Osmont. Reseaux mobiles de capteurs: Outils detude et de simulation. Masters thesis, Master informatique
Universite de Brest, May 2009.
Nancy Lynch. Distributed Algorithms. Morgan-Kauffman, 1998.
Joseph Macker and Ian Chackeres.
Mobile ad-hoc
http://www.ietf.org/html.charters/manet-charter.html.
networks
(manet).
IETF,
2009.
URL
Rainer Matischek. A TinyOS-based ad hoc wireless sensor network. VDM Verlag, dr Muller, 2008.
Carl G. Ritson, Adam T. Sampson, and Frederick R. M. Barnes. Multicore Scheduling for Lightweight Communicating Processes. In John
Field and Vasco Thudichum Vasconcelos, editors, Coordination Models and Languages, 11th International Conference, volume 5521 of
Lecture Notes in Computer Science, pages 163183. Springer, June 2009. URL http://www.cs.kent.ac.uk/pubs/2009/2928.
Claire Swedberg.
SF uses wireless sensors to help manage parking.
http://www.rfidjournal.com/article/view/3625/2.
URL
Tim Wark, Peter Corke, Pavan Sikka, Lasse Klingbeil, Ying Guo, Chris Crossman, Phil Valencia, Dave Swain, , and Greg Bishop-Hurley.
Transforming agriculture through pervasive wireless sensor networks. Pervasive Computing, IEEE, 2007.
Mark Weiser and John Seely Brown.
The coming of calm technology.
http://www.ubiq.com/hypertext/weiser/acmfuture2endnote.htm.
URL
Peter H. Welch and Frederick R. M. Barnes. Communicating Sequential Processes, the first 25 years, chapter Communicating Mobile
Processes, pages 175210. Springer, 2004.