UNIT-5-EC8702-Adhoc and Wireless Sensor Networks
UNIT-5-EC8702-Adhoc and Wireless Sensor Networks
TABLE OF CONTENTS
5.1 Sensor Node Hardware 5.1
5.2 Berkeley Motes 5.2
These nodes typically run off-the-shelf operating systems such as WinCE, Linux, or
real-time operating systems and use standard wireless communication protocols such
as IEEE 802.11, Bluetooth, Zigbee etc.
Because of their relatively higher processing capability, they can accommodate wide
variety of sensors, ranging from simple microphones to more sophisticated video
cameras. It is fully supported for popular programming languages.
Examples include low-power PCs, embedded PCs (e.g. PC104), custom-designed PCs,
(e.g. Sensoria WINS NG nodes), and various personal digital assistants (PDA).
These platforms typically use commercial off-the-shelf (COTS) chip sets with
emphasis on small form factor, low power processing and communication, and simple
sensor interfaces.
AD HOC and Wireless Sensor Networks 5.2
Because of their COTS CPU, these platforms typically support at least one
programming language, such as C. However, in order to keep the program footprint
small to accommodate their small memory size, programmers of these platforms are
given full access to hardware but rarely any operating system support.
Examples include the Berkeley mote family, the UCLA Medusa family, Ember nodes and
MIT µAMP. A classical example is the TinyOS platform and its companion programming
language, nesC, mica.
These platforms try to push the hardware limits by fundamentally rethinking the
hardware architecture trade-offs for a sensor node at the chip design level.
The goal is to find new ways of integrating CMOS, MEMS, and RF technologies to
build extremely low power and small footprint sensor nodes that still provide certain
sensing, computation, and communication capabilities.
Examples of SoC hardware include smart dust the BWRC picoradio node, and the
PASTA node.
The Berkeley Mote platform was developed under the Networked Embedded Systems
Technology (NEST) program with the quantitative target of building dependable,
real-time, distributed, embedded applications comprising 100 to 100 000 simple
computing nodes.
Berkeley motes tiny, self-contained, battery powered computers with radio links,
which enable to communicate and exchange data with one other, and to self- organize
into ad hoc networks.
The platform consists of four basic components: Power, sensors, computation, and
communication. These motes are autonomous and connectable to other motes.
The main advantages are small physical size, low cost, modest power consumption,
and diversity in design and usage. The latest versions of the Berkeley Mote include
the MicaZ, Mica2, and Mica2dot processor boards (Fig. 5. 1). The Motes have
AD HOC and Wireless Sensor Networks 5.3
Figure 5.1 Berkeley Mote processor boards: (a) MicaZ, (b) Mica2, and (c) Mica2dot.
Source : Protocol and Architecture for Wireless Sensor Networks by Holger Karl ,
Andreas willig
Table 5.1 Characteristics of the MicaZ, Mica2, and Mica2dot processor boards
The Motes have the versatility to connect different Printed Circuit Boards (PCB); that
is, the Motes have the modularity to support different types of sensors. Users can
switch the sensor board or customise it, independent of the other hardware
components. Table 5. 2 provides a description of the sensors that are used on the
respective boards.
The current sensor board designs for the Mica2 platform includes: MTS101CA,
MTS300CA, MTS310CA, MTS400CA, and MTS420CA
AD HOC and Wireless Sensor Networks 5.4
The microkernel technologies modularize the operating system so that only the
necessary parts are deployed with the application. Real-time scheduling allocates
resources to more urgent tasks so that they can be finished early.
Event-driven execution allows the system to fall into low-power sleep mode when no
interesting events need to be processed.
At the extreme, embedded operating systems tend to expose more hardware controls to
the programmers, who now have to directly face device drivers and scheduling
algorithms, and optimize code at the assembly level.
Although these techniques may work well for small, stand-alone embedded systems,
they do not scale up for the programming of sensor networks for two reasons:
AD HOC and Wireless Sensor Networks 5.5
As sensor nodes deeply embed into the physical world, a sensor network should
be able to respond to multiple concurrent stimuli at the speed of changes of the
physical phenomena of interest.
There no single universal design methodology for all applications. Depending on the
specific tasks of a sensor network and the way the sensor nodes are organized, certain
methodologies and platforms may be better choices than others.
For example, if the network is used for monitoring a small set of phenomena and the
sensor nodes are organized in a simple star topology, then a client-server software
model would be sufficient.
If the network is used for monitorin g a large area from a single access point (i.e., the
base station), and if user queries can be decoupled into aggregations of sensor readings
from a subset of nodes, then a tree structure that is rooted at the base station is a better
choice. However, if the phenomena to be monitored are moving targets, as in the target
tracking, then neither the simple client-server model nor the tree organization is
optimal. More sophisticated design and methodologies and platforms are required.
A node level platform can be node-centric operating system, which provides hardware
and networking abstractions of a sensor node to programmers, or it can be a language
platform, which provides a library of components to programmers.
For embedded systems, due to their highly specialized applications and limited
resources, their operating systems make different trade-offs when providing these
services.
AD HOC and Wireless Sensor Networks 5.6
Traditional OS functions are therefore to manage processes, memory, CPU time, file
system, and devices. This is often implemented in a modular and layered fashion,
including a lower layer of kernels and a higher layer of system libraries.
Traditional OSs are not suitable for wireless sensor networks because WSNs have
constrained resources and diverse data-centric applications, in addition to a variable
topology.
Hence, WSNs need a new type of operating system, considering their special
characteristics. There are several issues to consider when designing operating systems
for wireless sensor networks.
The first issue is process management and scheduling. The traditional OS provides
process protection by allocating a separate memory space (stack) for each process.
Each process maintains data and information in its own space. But this approach
usually causes multiple data copying and context switching between processes. This is
obviously not energy efficient for WSNs. For some real-time applications in WSNs, a
real-time scheduler such as earliest deadline first (EDF) or its variants may be a good
choice, but the number of processes should be confined since that would determine the
time complexity of the EDF scheduler.
The second issue is memory management. Memory is often allocated exclusively for
each process/task in traditional operating systems, which is helpful for protection and
security of the tasks. Since sensor nodes have small memory, another approach,
sharing, can reduce memory requirements.
The third issue is the kernel model. The event-driven and finite state machine (FSM)
models have been used to design microkernels for WSNs. The event-driven model
may serve WSNs well because they look like event-driven systems. An event may
comprise receiving a packet, transmitting a packet, detection of an event of interest,
AD HOC and Wireless Sensor Networks 5.7
alarms about energy depletion of a sensor node, and so on. The FSM-based model is
convenient to realize concurrency, reactivity, and synchronization.
The fourth issue is the application program interface (API). Sensor nodes need to
provide modular and general APIs for their applications. The APIs should enable
applications access the underlying hardware.
The fifth issue is code upgrade and reprogramming. Since the behavior of sensor
nodes and their algorithms may need to be adjusted either for their functionality or for
energy conservation, the operating system should be able to reprogram and upgrade.
Finally, because sensor nodes generally have no external disk, the operating syst em
for WSNs cannot have a file system. These issues should be considered carefully in the
design of WSN OSs and to meet their constrained resources, network behavior, and
data-centric application requirements.
Sensor operating systems (SOS) should represent the following functions, bearing in
mind the limited resource of sensor nodes:
Should be compact and small in size since the sensor nodes have very small
memory. The sensor nodes often have memories of only tens or hundreds of
kilobytes.
Should provide real-time support, since there are real-time applications, especially
when actuators are involved. The information received may become outdated
rather quickly. Therefore, information should be collected and reported as quickly
as possible.
Should support reliable and efficient code distribution since the functionality
performed by the sensor nodes may need to be changed after deployment. The
code distribution must keep WSNs running normally and use as little wireless
bandwidth as possible.
Should support power management, which helps to extend the system lifetime and
improve its performance. For example, the operating system may schedule the
process to sleep when the system is idle, and to wake up with the advent of an
incoming event or an interrupt from the hardware.
AD HOC and Wireless Sensor Networks 5.8
These issues are important since TinyOS is required to manage hardware capabilities
and resources effectively while supporting concurrent operation in an efficient manner.
It can rapidly create tasks associated with an event, with no blocking or polling. When
CPU is idle, the process is maintained in a sleep state to conserve energy. TinyOS
includes a tiny scheduler and a set of components. The scheduler schedules operation
of those components.
Commands and tasks are executed in the context of the frame and operate on its state.
Each component will declare its commands and events to enable modularity and easy
interaction with other components.
The current task scheduler in TinyOS is a simple FIFO mechanism whose scheduling
data structure is very small, but it is power efficient since it allows a processor to sleep
when the task queue is empty and while the peripheral devices are still running. The
frame is fixed in size and is assigned statically. It specifies the memory requirements
of a component at compile time and removes the overhead from dynamic assignment.
Commands are non-blocking requests made to the low-level components. Therefore,
commands do not have to wait a long time to be executed.
AD HOC and Wireless Sensor Networks 5.9
The occurrence of a hardware event will invoke event handlers. An event handler can
store information in its frame, assign tasks, and issue high-level events or call low-
level commands. Both commands and events can be used to perform a small and
usually fixed amount of work as well as to pre-empt tasks.
Tasks are a major part of components. Like events, tasks can call low-level commands,
issue high-level events, and assign other tasks. Through groups of tasks, TinyOS can
realize arbitrary computation in an event-based model.
The design of components makes it easy to connect various components in the form of
function calls. The architecture of TinyOS shown in Figure 5.2.
Hardware abstractions
Synthetic hardware
Synthetic hardware components are used to map the behavior of advanced hardware
and often sit on the hardware abstraction components. TinyOS designs a hardware
abstract component called the radio-frequency module (RFM) for the radio transceiver,
and a synthetic hardware component called radio byte, which handles data into or out
of the underlying RFM.
Events are propagated quickly and the rate of posting a task and switching the
corresponding context is very high.
5.7 nesC
nesC is a component-based, event-driven programming language used to build
applications for the TinyOS platform. TinyOS is an operating environment designed to
run on embedded devices used in distributed wireless sensor networks.
nesC programs are subject to whole program analysis (for safety) and optimization (for
performance). Therefore we do not consider separate compilation in nesC’s design.
The limited program size on motes makes this approach tractable.
nesC is a “static language”. There is no dynamic memory allocation and the call-graph
is fully known at compile-time. These restrictions make whole program analysis and
optimization significantly simpler and more accurate. nesC’s component model and
parameterized interfaces eliminate many needs for dynamic memory allocation and
dynamic dispatch.
AD HOC and Wireless Sensor Networks 5.11
nesC is based on the concept of components, and directly supports TinyOS’s event
based concurrency model. Additionally, nesC explicitly addresses the issue of
concurrent access to shared data. In practice, nesC resolved many ambiguities in the
TinyOS concepts of components and concurrency.
Component Specification
TimerM provides the logic that maps from a hardware clock (Clock) into TinyOS’s
timer abstraction (Timer).
Interfaces in nesC are bidirectional. They contain commands and events, both of which
are essentially functions. The providers or an interf ace implement the commands,
while the users implements the events. For instance, the Timer interface (Figure 5.4)
defines start and stop commands and a fired event.
In Figure 5.3 provided interfaces are shown above the TimerM component and used
interfaces are below; downward-pointing arrows depict commands and upward-
pointing arrows depict events. Although this same interaction between the timer and its
client could have been provided via two separate interfaces (one for start and stop, and
one for fired), grouping these commands and events in the same interface makes the
specification much clearer and helps prevent bugs when wiring components together.
Split-phase operations are cleanly modelled by placing the command request and event
response in the same interface. Figure 5.4 shows two examples of this.
The Send interface has the send command and sendDone event of the split-phased
packet send. The ADC interface is similarly used to model split-phase sensor value
reads. The separation of interface type definitions from their use in components
promotes the definition of standard interfaces, making components more reusable and
flexible.
A component can provide and use the same interface type (e.g., when interposing a
component between a client and service), or provide the same interface multiple times.
In these cases, the component must give each interface instance a separate name using
the as notation shown for Clk in Figure 5.3.
The components are also a clean way to abstract the boundary between hardware an d
software. For instance, on one sensor board, the temperature sensor (accessed via a
component named Temp) is mostly in hardware; Temp is a thin layer of software
accessing on-chip hardware registers.
Component Implementation
There are two types of components in nesC: modules and configurations. Modules
provide application code, implementing one or more interfaces. Configurations are
used to wire other components together, connecting interfaces used by components to
interfaces provided by others.
AD HOC and Wireless Sensor Networks 5.13
nesC detects the data races at compile time. Data races occur due to concurrent updates
to shared state. In order to prevent them, a compiler must
5.8 ContikiOS
ContikiOS is open source operating system for resource constraint hardware devices
with low power and less memory. It was developed by Adam Dunkels in 2002. This
OS is fully GUI based system requires only 30 KB RO M and 10 KB RAM. It also
provide multitasking feature and have the built in TCP/IP suit.
The working environments of the WSNs are often energy-limited. This is one of the
most important constraint for WSNs. Likewise, tiny and simple designs of the nodes
are the other constraints. For this reason, WSNs should have some important hardware
and software features to cope with these constraints.
Contiki OS is one of the convenient solutions to cope with mentioned constraints to its
flexibility and support of lightweight and low-powered networks.
Contiki can provide communication over IPv4, IPv6 and Rime Network Stack. Contiki
Network Stack shown in Figure 5.5 gives more details for its structure.
Source : Protocol and Architecture for Wireless Sensor Networks by Holger Karl ,
Andreas willig
AD HOC and Wireless Sensor Networks 5.14
be simulated at the MAC layer or network layer, using, for example, stochastic
processes to represent low-level behaviours.
A sensor network simulator simulates the behavior of a subset of the sensor nodes with
respect to time. Depending on how the time is advanced in the simulation, there are
two types of execution models:
Cycle-Driven Simulation
Discrete-Event Simulation
A cycle-driven (CD) simulation discretizes the continuous notion of real time into
(typically regularly spaced) ticks and simulates the system behavior at these ticks.
At each tick, the physical phenomena are first simu lated, and then all nodes are
checked to see if they have anything to sense, process, or communicate.
Sensing and computation are assumed to be finished before the next tick. Sending
a packet is also assumed to be completed by then. However, the packet will not be
available for the destination node until next tick. This split-phase communication
is a key mechanism to reduce cyclic dependencies that may occur in cycle-driven
simulations.
AD HOC and Wireless Sensor Networks 5.16
A Discrete-Event (DE) simulator assumes that the time is continuous and an event
may occur at any time. As event is 2-tuple with a value and a time stamp indicating
when the event is supposed to be handled. Components in a DE simulation react
to input events and produce output events. In node-level simulators, a component
can be a sensor node, and the events can be communication packets; or a
component can be software module within and the events can be message passing
among these nodes.
Typically, components are causal, in the sense that if an output event is computed
from an input event, then the time stamp of the output should not be earlier than
that of the input event. Non-causal components require the simulators to be able to
roll back in time, and worse, they may not define a deterministic b ehavior of a
system.
CD simulations usually require less complex components and give faster simulations.
DE simulations are sometimes considered as good as actual implementations, because
of their continuous notion of time and discrete notion of events.
There are several open source or commercial simulators available. One class of these
simulators comprises extensions of classical network simulators, such as ns-2, J-Sim
(previously known as JavaSim), and GloMoSim/ Qualnet. The focus of these
simulators is on network modelling, protocol stacks, and simulation performance.
NS-2 includes a large number of simulated network protocols and tools used for
simulating transport control protocol (TCP), routing algorithm, multicast protocol over
the wired or wireless (local connection or via satellite connection) networks.
NS-2 is committed to OSI model simulation, including the behaviour of physical layer
and it is a free open source software and available for free download.
Limitations of NS-2
It has been built by many developers and contains several inherent known and
unknown bugs.
It does not scale well for WSNs due to its object-oriented design.
Actually, NS-2 was not initially designed to simulate wireless sensor network, but a
few research groups had extended NS-2 in order to enable it to support wireless sensor
network simulation, including sensor model, battery model, a small stack, and hybrid
simulation tools.
It is extensible, but not very scalable because of the split programming model and
object-oriented structure. In addition, because NS-2 can simulate very detailed data
packet close to the exact number of running packets, it is unable to carry out large-
scale network simulation.
To overcome the above drawbacks the improved NS-3 simulator was developed. NS-3
supports simulation and emulation. It is totally written in C++, while users can use
python scripts to define simulations.
AD HOC and Wireless Sensor Networks 5.18
Furthermore, NS-3 supports a real-time schedule that makes it possible to interact with
real systems. For example, a real network device can emit and receive NS-3 generated
packets.
5.11 COOJA
Cooja simulator is the efficient simulate wireless sensor networks. Cooja is the default
simulator of Contiki operating system that helps to simulate the wireless sensor
networks in addition it helps to do the performance evolution.
Contiki is a light weight operating system that is developed mainly for wireless nodes.
The motes that are developed by the contiki offers many advantages.
Contiki offers a java based simulator called as cooja which is used to simulate the
wireless sensors. Cooja simulator is more flexible so that many parts of the simulator
is replaceable and extendable. The parts of the simulator like simulated node hardware,
plug-ins and radio medium can be replaceable.
Characteristics of Cooja
Scalability
Efficiency
Extensibility
Flexibility
Wireless sensor network has the powerful tool called tool in which it can be simulate
the idea before it is implementing in real time. Contiki Cooja WSN Simulator mainly
used to simulate many wireless scenario.
Contiki cooja is the best simulator to simulate any wireless sensors with its own
property. For example, if we are designing a wireless sensor network that detects the
earth quake, the sensor has its own property like lifetime, withstand ability, capacity,
etc.
AD HOC and Wireless Sensor Networks 5.19
We can design this wireless sensors with the same property in contiki cooja. When
compared to other simulators cooja is developed purely for wireless sensor networks.
In addition cooja is more flexible to change the properties of a node so that we could
implement our own idea exactly. Wireless sensors play important role in IOT (Internet
of Thins), where contiki Operating system was developed mainly for IOT devices,
cooja is a simulator comes with the Contiki. So we can use the Cooja simulator for
simulating any wireless sensor networks.
5.12 TOSSIM
TOSSIM (TinyOS Mote Simulator) is an open-source operating system specially
developed for the wireless embedded sensor networks. There are few hardware
platforms available for TinyOS, some commercial and some non-commercial.
TinyOS release includes a simulator called TOSSI M. It is built especially for Berkeley
Mica Mote platform. TOSSIM is an emulator rather than a simulator, as it runs actual
application code. Simulated application code can be transferred directly to the
platform, but it might not run in a mote as it runs in a simulation due to the simplifying
assumptions in TOSSI M.
Figure 5.6 shows the working flow of TOSSIM. The TOSSIM architecture is consisted
of five segments: Frames, Components, Models, Services and Events.
TOSSIM is a very simple but powerful emulator for WSN. Each node can be
evaluated under perfect transmission conditions, and using this emulator can capture
the hidden terminal problems.
TOSSIM also provides open sources and online documents. Developers had set four
requirements for TOSSIM: scalability, completeness, fidelity and bridging.
The goal of TOSSIM is to study the behavior of TinyOS and its applications rather
than performance metrics of some new protocol. Hence, it has some limitations, for
instance, it does not capture energy consumption. Another drawback of this framework
is that every node must run the same code. Therefore, TOSSIM cannot be used to
evaluate some types of heterogeneous applications.
AD HOC and Wireless Sensor Networks 5.21
As the target traverses the sensor field and the belief evolves to follow its motion, the
most “informative” sensors might no longer be those closest to the current leader. A
nearby sensor might then be selected to replace this leader on the basis of the updated
belief and a criterion combining resource constraints with some measure of sensing
utility (such as mutual information). The current leader then hands off the belief to this
sensor, which becomes the next leader at time t + δ, where δ is the communication
delay. The process of sensing, estimation, and leader selection repeats.
As a vehicle moves through a sensor field, nearby sensors detect it. An elected leader
node aggregates data from the active sensors and migrates the information from node
to node as the vehicle moves.
The sensor nodes collaborate primarily to improve sensing accuracy, and acceptable
estimation quality might be achieved using only a subset of the sensors.
One node, the leader, plays a key role in fusing others’ sensor measurements. If no
leader is present, all sensors that form the contour are equally important. Each node
might locally update and repair its observation of a contour section, but the global state
can only be assembled from observations of many nodes along the entire contour.
Hence, System designers must explicitly write code to
Maintain sensor connectivities in a neighbourhood
Discover the best node for handoff
Invite neighbour nodes into the group
Handle communication delays and failures
AD HOC and Wireless Sensor Networks 5.23