WSNs. The survey classified the modelling
techniques according to the capability to capture the
hardware and middleware components, the network
topology, the node behaviour, and the network
behaviour of a WSN.
A model driven engineering approach has been
developed in Eclipse to generate the nesC code for a
design from the UML diagrams (Losilla et al.,
2007). The design goes through three layers of
models, which are the independent UML model, the
domain specific model, and then the platform
specific model. The paper has specified a group of
rules which control the transformation from one
model to another. The last step in their approach is
to generate the nesC code from the platform specific
model. Our approach has one layer of modelling and
aims to capture the design components and
interaction between the components through using
UML class diagrams and UML state-charts.
Capturing the design behaviour at the UML layer
enables the designer to fix the design error before
the actual implementation.
A UML profile has been developed for voice
wireless communication platforms (Chen,
2010).The profile contains stereotypes, constraints,
and tags for such platforms. The tags contain
information about the bandwidth, throughput,
latency, and power consumption of the components.
The tags are used to verify the system behaviour
after implementation. The profile contain deployed,
component, and class diagrams for the platform. Our
approach has defined stereotypes for WSN systems
and focus on the behaviour side of the full system
(operating system and the deployed applications)
through using the animated state diagrams.
We have also determined that there is no
published material that tries to present a set of
design patterns for WSNs. We have though seen
such design patterns presented in the tinyOS
Programing manual (Levis, 2009)but these design
patterns are very specific to tinyOS programming as
opposed to patterns that can be used at the software
modelling layer.
3 WSN DESIGN PATTERNS
This section presents a set of design patterns, which
can be used to support the modelling and design of
WSNs. We have used class diagrams and state-
charts features to explain these patterns. The UML
state-charts are used to capture the behaviour of both
hardware and middleware modules. We also take
advantage of animated state-charts, which are used
to capture the application design behaviour, the flow
of the data across the system components, and the
interaction between the system components. The
animated state charts enable the designer to test the
flow of the design.
The design patterns came about from experience
in trying to model a WSN application in the tinyOS
environment as well as from the tinyOS
programming guide (Levis, 2009).
Through the process of trying to capture the
model using a language independent notation like
UML we have been able to generalize some tinyOS
specific concepts like the concept of “wiring”, which
is unique to the tinyOS environment, into a general
interface association captured by composite classes.
3.1 WSN Hardware and Middleware
Component Pattern
All WSN applications can be designed from a set of
components that represent hardware or middleware
components. In this work we define a group of
classes that are used as stereotype classes to capture
these hardware and middleware components. The
defined stereotype classes capture the methods,
parameters, and behavioural flow of the
components. The behavioural flow of the
components is captured by using animated state
diagrams. The animated state charts are extremely
useful for the following reasons:
Validation of the Design Flow. There are many
behavioural flows where events are expected for
normal operation. If these do not occur there is a
design flaw in the application.
Analysis for Power Consumption. Since the
system application can be animated it is
possible to compute the power consumption for
those deterministic scenarios as explained in the
future work section.
3.1.1 The Hardware Stereotype Classes
Many typical hardware classes are used in WSN
nodes such as radio, LEDs, and ADC modules. As
an example, let us take a specific ADC module
called the MDA used in the crossbow motes for
capturing data. This MDA module has a MDA
interface component that is captured in our design as
a UML class.
The behaviour of the MDA class is captured by
using state-chart (see Figure 1). The state-chart
contains the triggered operation called sensor_on,
which captures the behaviour of the TinyOS
operation read. Once the method sensor_on is
SENSORNETS2013-2ndInternationalConferenceonSensorNetworks
90