Docstoc

Network-wide Time Synchronization in Sensor Networks

Document Sample
Network-wide Time Synchronization in Sensor Networks Powered By Docstoc
					 UCLA NESL TECHNICAL REPORT                                                                         NESL 01-01-2003



                    Network-wide Time Synchronization in Sensor Networks
      Saurabh Ganeriwal                 Ram Kumar                 Sachin Adlakha                Mani Srivastava

              Networked and Embedded Systems Lab (NESL), Electrical Engineering Department, UCLA
                            56-125B Eng. IV, UCLA -EE Dept., Los Angeles, CA 90095
                                    {saurabh, ram, sachin, mbs}@ee.ucla.edu


Abstract- Wireless sensor networks have emerged as an           node, several signal processing techniques are used to
interesting and important research area in the last few         get meaningful results of this raw data. For example, the
years. The applications envisioned for such networks            target tracking applications use Kalman filter to estimate
require collaborative execution of a distributed task
                                                                the target position [3]. Such signal-processing
amongst a large set of sensor nodes. The collaborative
execution is realized by exchanging messages that are time -    techniques require relative synchronization among
stamped using the local clocks on the nodes. Hence, time        sensor node clocks, so that a right chronology of events
synchronization becomes an indispensable piece of               can be detected. On the other hand, for sensor network
infrastructure in such distributed systems. For years,          applications such as detecting brushfires, gas leaks etc.;
protocols such as NTP have kept the clocks of networked         the time of occurrence of an event is itself a critical
systems in perfect synchrony. However, this new class of        parameter. For such class of applications, the
wireless sensor networks has a large density of nodes and       synchronization of the complete network with every
very limited energy resource at every node; this leads to       node maintaining a unique global time scale becomes
improved scalability requirements while limiting the
                                                                paramount. Time synchronization is also indispensable
resources that can be used to achieve them. A new
approach to time synchronization is needed for the wireless     in the implementation of the commonly used medium
sensor networks.                                                access control (MAC) protocols such as TDMA.
     In this paper, we present an algorithm for network-            Time synchronization problem has been investigated
wide time synchronization in a sensor network. The             thoroughly in Internet and LANs. Several technologies
algorithm works in two phases. The first phase of the          such as GPS, radio ranging etc have been used to provide
algorithm creates a hierarchical topology, assigning every     global synchronization in networks. Complex protocols
node a level in the hierarchy. In the second phase, every      such as NTP [4] have been developed that have kept the
node synchronizes itself to a node belonging to exactly one    Internet’s clocks ticking in phase. However, the time
level above in the hierarchy. Eventually all nodes in the
                                                               synchronization requirements differ drastically in the
network synchronize their clocks to a reference node. We
verify the efficacy of the algorithm via simulations. We       context of sensor networks. In general such networks are
show that the algorithm is scalable and the synchronization    dense, consisting of a large number of sensor nodes. To
accuracy does not degrade significantly with the increase in   operate in such large network densities, we need the time
number of nodes being deployed.                                synchronization algorithm to be scalable with the
                                                               number of nodes being deployed. Also, energy efficiency
                    I. INTRODUCTION                            is a major concern in these networks due to the limited
                                                               battery capacity of the sensor nodes. This eliminates the
     Advances in microelectronics fabrication have
                                                               use of external energy-hungry equipments, such as GPS
allowed the integration of sensing, processing and
                                                               receivers.
wireless communication capabilities into low-cost and
small form-factor embedded systems called sensor nodes         B. Contribution
[1][2]. The need for unobtrusive and remote monitoring
is the main motivation for deploying a sensing and                  The objective of our scheme is to establish a unique
communication network (sensor network) consisting of a         global timescale for all the nodes in a sensor network.
large number of these battery-powered nodes.                   We create a self-configuring system, suitable for sensor
                                                               networks, where a hierarchical structure is established in
A. Motivation                                                  the network. In our algorithm, NTP-like daemons self-
                                                               organize to act as servers to some nodes while acting as
    The applications envisioned for sensor networks
                                                               client to another server. We show our scheme to be
vary from monitoring inhospitable habitats and disaster
                                                               efficient and accurate.
areas to operating indoors for intrusion detection and
                                                                    We have verified the efficacy of our algorithm in
equipment monitoring. Most of these applications
                                                               practical scenarios, where the network is dense (average
require sensor nodes to maintain local clocks in order to
                                                               number of neighbors per node vary from 20-40). We
determine the timing of the events. In general, sensor
                                                               have chosen a realistic clock model for analyzing and
nodes gather sensor readings, and forward this raw data
                                                               testing our algorithm. In our model, the sensor node
to a central processing node. At the central processing
                                                               clocks drift independently at different rates. We show
UCLA NESL TECHNICAL REPORT                                                                       NESL 01-01-2003


that all nodes in a sensor network can be synchronized       phase”. Once the hierarchical structure has been
within an average accuracy of around 0.7ms. The error        established, the root node initiates the second stage of the
reduces dramatically to about 0.1ms when a radio-setup       algorithm, which is called the “synchronization phase”.
as proposed in [9] is employed. We also show that our        A node belonging to a level i synchronize to a node
algorithm is scalable and hence, is aptly suitable for the   belonging to level i-1. Eventually every node is
sensor network domain.                                       synchronized to the root node and we achieve network-
                                                             wide time synchronization.
                   II. RELATED W ORK
                                                             B. Assumptions
     Although time synchronization has been the topic of
research for the past several decades in a wide spectrum           We assume that the sensor nodes have unique
of applications, with regard to sensor networks, a final     identifiers. A link level protocol ensures that each node
solution is yet to be found. A scheme dealing with timing    is aware of the set of nodes with which it can directly
issues in sensor networks is proposed in [6]. The            communicate, also termed as the “neighbor set” of the
objective of the scheme is not to synchronize the sensor     node. Our scheme uses the bi-directional links in the
node clocks but to generate the chronology of events         network. We also assume that the network is connected
using the time stamps from unsynchronized local clocks.      i.e. there exists a multi hop path between any two nodes
     A more recent work is the approach of Reference-        in the network, using these bi-directional links. A node
Broadcast Synchronization [5], where the nodes               has been designated as the root node. We shall explain
periodically send beacon messages to their neighbors         later, how to choose the root node.
using the network’s physical layer broadcast. Recipients
use the message’s arrival time as point of reference for
                                                                     IV. TIME SYNCHRONIZATION ALGORITHM
comparing their clocks. The offset between any pair of
nodes, receiving the beacon, is calculated by exchanging     A. Level Discovery phase
the local timestamps. This scheme successfully removes
                                                                  This phase of the algorithm occurs at the onset,
all possible sources of error exc ept the variability in
                                                             when the network is deployed. The root node is assigned
processing delay at the receiver. As explained later, we
                                                             a level 0 and it initiates this phase by broadcasting a
use the symmetric properties of bi-directional links in
                                                             level_discovery packet. The level_discovery packet
sensor-networks to remove all the sources of error. The
                                                             contains the identity and the level of the sender. The
number of receivers lying within a single broadcast
                                                             immediate neighbors of the root node receive this packet
domain limits the set of receivers synchronized by the
                                                             and assign themselves a level, one greater than the level
RBS scheme. The extension of this scheme to multi-hop
                                                             they have received i.e., level 1. After establishing their
introduces an error that increases with the square root of
                                                             own level, they broadcast a new level_discovery packet
the number of hops. The scheme is therefore effective
                                                             containing their own level. This process is continued and
only for a small cluster of nodes lying in a neighborhood.
                                                             eventually every node in the network is assigned a
The emphasis of our scheme is to achieve
                                                             unique level. On being assigned a level, a node neglects
synchronization at the network-wide level.
                                                             any such future packets. This makes sure that no
     NTP [4] has a similar objective of network-wide
                                                             flooding congestion takes place in this phase. Thus a
synchronization, but it is computationally intensive and
                                                             hierarchical structure is created with only one node, root
hence not feasible for implementation on the energy
                                                             node, at level 0. A node might not receive any
constrained sensor nodes. Our scheme can be viewed as
                                                             level_discovery packets owing to MAC layer collisions.
a practical extension of NTP to sensor networks. As
                                                             We explain how to handle such special cases in
mentioned earlier, our goal is to maintain a unique global
                                                             subsection C.
timescale, at every instant of time, throughout the
network.
                                                             B. Synchronization phase
                    III. DEFINITIONS                              We first analyze how a two-way message exchange
                                                             between a pair of nodes can synchronize them. Fig. 1
A. Basic Concept
                                                             shows this message-exchange between nodes ‘ ’ and  A
      The first step of the algorithm is to create a         ‘B’. Here, T1, T4 represent the time measured by local
hierarchical topology in the network. Every node is          clock of ‘A’. Similarly T2, T3 represent the time
assigned a level in this hierarchical structure. We ensure   measured by local clock of ‘B’. At time T1, ‘A’ sends a
that a node belonging to level i can communicate with at     synchronization_pulse       packet    to     ‘B’.    The
least one node belonging to level i-1. Only one node is      synchronization_pulse packet contains the level number
assigned to level 0, which we call the “root node”. We       of ‘A’ and the value of T1. Node B receives this packet at
call this stage of our algorithm as the “level discovery     T1, where T2 is equal to T1 + ∆ + d. Here ∆ and d
UCLA NESL TECHNICAL REPORT                                                                               NESL 01-01-2003




                                T2     T3
          Node B                                                      C. Special Provisions
                                                                           In a sensor network, the nodes are usually deployed
                                                                      in a random fashion. So scenarios might exist where a
         Node A                                                       sensor node joins an already established network i.e., the
                     T1                        T4                     node might join the network when the level discovery
                                                                      phase is already over. Even if the node is present at the
  Fig. 1: Two way message exchange between A and B
                                                                      onset of the network, it might not receive any
                                                                      level_discovery packets owing to MAC layer collisions.
represents the clock drift between the two nodes and
                                                                      In either case it will not be assigned any level in the
propagation delay respectively. At time T3, ‘B’ sends
                                                                      hierarchy. However, every node needs to be a part of the
back an acknowledgement packet to ‘A’. The
                                                                      hierarchical topology so that it can be synchronized with
acknowledgement packet contains the level number of
                                                                      the root node. Thus, when a node is deployed, it waits
‘B’ and the values of T1, T2 and T3. Node A receives the
                                                                      for some time to be assigned a level. If it is not assigned
packet at T4. Assuming that the clock drift and the
                                                                      a level within that period, it timeouts and broadcasts a
propagation delay do not change in this small span of
                                                                      level_request message. The neighbors reply to this
time, ‘A’ can calculate the clock drift and propagation
                                                                      request by sending their own level. The new node
delay as:
                                                                      assigns itself a level, one greater then the level it has
         (T 2 − T1) − (T 4 − T 3)          (T 2 − T1) + (T 4 − T 3)   received and hence, joins the hierarchy. This could be
    ∆=                            ;   d=                              seen as a local level discovery phase.
                    2                                 2
                                                                            In a sensor network nodes also die randomly. A
                                                                      situation may arise, when a level i node does not have
Knowing the drift, node A can correct its clock
                                                                      any neighbor at level i-1. In such scenarios, the node
accordingly, so that it synchronizes to node B. This is a
                                                                      would not get back an acknowledgement to its
sender-initiated approach, where the sender synchronizes
                                                                      synchronization_pulse. Thus, this node at level i would
its clock to that of the receiver.
                                                                      not be able to synchronize to the root node. It has already
      This message exchange at the network level begins
                                                                      been explained that in order to handle collisions, a node
with the root node initiating the phase by broadcasting a
                                                                      would retransmit the synchronization_pulse after some
time_sync packet. On receiving this packet, nodes
                                                                      random amount of time. After retransmitting the
belonging to level 1 wait for some random time before
                                                                      synchronization_pulse a fixed number of times, a node
they initiate the two-way message exchange with the root
                                                                      assumes that it has lost all its neighbors on the upper
node. This randomization is to avoid the contention in
                                                                      level and broadcasts a level_ request message. On
medium access. On receiving back an acknowledgment,
                                                                      getting back a reply, the node is assigned a new level.
these nodes adjust their clock to the root node. The nodes
                                                                      Assuming the network is still connected, the node will
belonging to level 2 will overhear this message
                                                                      have at least one node in its neighbor set and thus it will
exchange. This is based on the fact that every node in
                                                                      surely be assigned a new level in the hierarchy. We
level 2 has at least one node of level 1 in its neighbor set.
                                                                      consider four retransmissions to be a heuristic for
On hearing this message, nodes in level 2 back off for
                                                                      deciding non-availability of a neighbor in the upper
some random time, after which they initiate the message
                                                                      level. The validity of this heuristic has been verified via
exchange with nodes in level 1. This randomization is to
                                                                      simulations. In general, choosing a large number will
ensure that nodes in level 2 start the synchronization
                                                                      increase the time taken for synchronization whereas a
phase after nodes in level 1 have been synchronized.
                                                                      small number will cause unnecessary flooding in the
Note that a node sends back an acknowledgement to a
                                                                      network, decreasing the synchronization accuracy.
synchronization_pulse, provided that it has synchronized
                                                                           We started with the premise that a node has been
itself. This ensures that no multiple levels of
                                                                      designated as the root node. In general, a user node that
synchronization are formed in the network.
                                                                      acts as the gateway between the sensor network and the
       This process is carried out throughout the network
                                                                      external world can act as the root node. The user node
and eventually every node is synchronized to the root
                                                                      can be equipped with a GPS receiver, in which case the
node. In a sensor network packet collisions can take
                                                                      sensor nodes would be synchronized to the physical
place quite often. To handle such scenario a node wa iting
                                                                      world. In more hostile environments, where it is
for an acknowledgement, timeouts after some random
                                                                      impossible to have an external entity, sensor nodes can
time and retransmits the synchronization_pulse. This
                                                                      periodically take over the functionality of being the root
process is continued until a successful two-way message
                                                                      node, using some leader election algorithm [10]. The
exchange has been done.
                                                                      choice of a particular leader election algorithm is beyond
UCLA NESL TECHNICAL REPORT                                                                       NESL 01-01-2003


the scope of this paper. If an elected root node dies, the     exchange independent of the other nodes. Thus we
nodes in level 1 would not receive any acknowledgement         anticipate that the time for synchronization phase should
packets and hence, they will timeout following the
scheme described above. Instead of broadcasting a
level_request packet, they run a leader election algorithm
and the elected leader takes over the functionality of the
root node. This new root node starts from the beginning
and reruns the level discovery phase.

        V. A NALYSIS A ND SIMULATION RESULTS
    In this section, we verify our algorithm through
simulations, which were written on the Parsec platform,
an event-driven parallel simulation language [8]. All
results are averaged over 5000 simulation runs.

A. Simulation Setup
     We deploy N nodes in a uniformly random fashion               Fig. 2: Time for two phases v/s Number of nodes
over a sensor terrain of size 100m x 100m. Each node
has a transmission range of 20m. We vary the number of         increase with N. Fig. 2 shows the time taken for the two
nodes, N, from 150 to 300. These numbers correspond to         phases vs. N. As expected, the time taken for the level
topologies, where average number of neighbours per             discovery phase remains a constant as N is increased.
node varies from 20 to 40 respectively. Our setup              Moreover, the time for synchronization phase increases
includes a CSMA MAC. The radio speed is 19.2kb/sec,            linearly with N. Note that the nodes being synchronized
similar to the UC Berkeley MICA Motes [9], and every           also increases linearly with N. This means that the
packet has a fixed size of 128 bits. This corresponds to a     overhead per node (in terms of resources spent during the
transmission delay of approximately 6ms. A node is             two phases) remains a constant with increasing N,
chosen randomly to act as the root node.                       making our algorithm scalable.
     The granularity of the node clocks, which is the
minimum accuracy attainable, is 0.01 milliseconds. The         C. Synchronization Accuracy
clock model used in simulations has been derived from
                                                                    We characterize the accuracy of the algorithm by
the characteristics of the oscillators used in sensor nodes.
                                                               measuring       the     synchronization      error.  The
The datasheets [7] indicate that the frequency drift due to
                                                               synchronization error is defined as the difference
variations in temperature is in the range of ±20 parts per
                                                               between the clocks of the sensor nodes and the root node,
million (ppm). This translates to an error of 0.02 ms
                                                               just after the node has been synchronized using our
every second. The frequency drift is varied randomly
                                                               algorithm. Before analyzing the obtained results, let us
with time, within the specified range, to model the
                                                               briefly discuss the possible sources of error:
temporal variations in temperature. All sensor node
clocks drift independently of each other. There is an
                                                               Ø   MAC delay fluctuations: The packet might not be
initial random offset uniformly distributed over 2
                                                                   transmitted at the same time, as indicated by the
seconds among the sensor node clocks to capture the
                                                                   timestamp due to MAC layer contention. As a result,
initial spatial temperature variations and the difference in
                                                                   the calculated propagation delay will be more than
the boot up times.
                                                                   the actual value.
B. Overhead                                                    Ø   Drifts among the sensor node clock s: As the local
                                                                   clocks of sensor nodes are drifting continuously, a
    The overheads incurred by the algorithm are                    node might synchronize itself to a clock that is
characterized by measuring the time taken in running the           already in error. For example, consider a node A that
two phases of the algorithm. The time for level discovery          gets perfectly synchronized (error is 0) to the root
phase is directly proportional to the maximum number of            node at time t1. Suppose at a later time t2, a node B
hops needed to traverse the network, which in turn                 synchronizes perfectly to A. Node B will still have
depends on the sensor terrain, L, and the radio range of           an error with respect to the root node, equal to the
the sensor nodes, R. Thus, the time for level discovery            drift between the local clock of node A and the root
phase should be independent of the number of nodes                 node between t1 and t2. This source of error is
being deployed, N. On the other hand, in the                       inherent in all the schemes where the nodes are not
synchronization phase each node carries out a message              synchronized simultaneously.
UCLA NESL TECHNICAL REPORT                                                                        NESL 01-01-2003




    Fig. 3: Synchronization error vs. Number of nodes         Fig. 4: Spatial variation of Synchronization error

Ø   Processing delay: The variations in the processing        piggybacked over the data packet or special MAC
    delays at different nodes also result in a wrong          packets such as RTS, CTS etc. Thus we anticipate that
    estimation of the propagation delay. In a simulation      the accuracy of our algorithm won’t be affected by the
    environment, this factor does not result in causing       presence of data traffic.
    any errors but in a real sensor network testbed, it
    might play a critical role.                               D. Spatial variation of Synchronization accuracy
                                                                   Fig. 4 plots the synchronization error, for Setup I,
     In [9] a new architecture has been proposed that
                                                              over the sensor terrain when 200 nodes were deployed.
time stamps the packets at the radio layer, when they are
                                                              The figure has been obtained by averaging the results
actually transmitted, thereby reducing MAC delay
                                                              over 5000 simulation runs. The root node position was
fluctuations. We have verified the efficacy of our
                                                              fixed at (0, 0) in all the simulation runs. As expected, the
algorithm with the normal architecture (Setup I), as well
                                                              synchronization error increases with the distance from
as with this new advanced architecture (     Setup II). We
                                                              the root node. A key thing to observe is that the
average out synchronization error over all the nodes in
                                                              synchronization error increases uniformly with distance.
the network. Fig. 3 shows the mean and standard
                                                              This implies that two nodes in neighborhood are
deviation in synchronization error vs. N.
                                                              synchronized, with respect to each other, to even tighter
     The attained accuracy with Setup I is approximately
                                                              levels of accuracy. For example, in this scenario the
0.7ms i.e. to the scale of 1/10th of the propagation delay.
                                                              maximum and average relative error between any two
Moreover, as N increases, the error increases at a slope
                                                              nodes in neighborhood comes out to be 0.29ms and
of 1 µs/node that can be treated as negligible for any        0.06ms respectively. For Setup II, the maximum and
practical setting. Moreover, in every simulation run, at
                                                              average relative error between any two nodes in
least 60% of the nodes had synchronization error less
                                                              neighborhood comes out to be 0.06ms and 0.02ms
than or equal to the mean error. As can be observed from      respectively.
Fig. 3, the attained accuracy with Setup II is around
                                                                   This result implies that to reduce synchronization
0.1ms. This implies that MAC delay fluctuation is a
                                                              error, we should assign every node a level that
critical factor contributing to the synchronization error.    corresponds to its shortest path from the root node. This
     As mentioned earlier, the granularity of the sensor
                                                              can be done using shortest path algorithms such as
node clocks is 0.01 ms. Even if the granularity were
                                                              Bellman-Ford and Dijkshtra’s algorithm [11] at           the
improved; the impact of MAC delay fluctuations would          level discovery phase. However these algorithms have
remain the same. Thus the results for Setup I would
                                                              a complexity directly proportional to the number of
remain unaffected. However, the errors due to varying
                                                              nodes (O(N)), which is undesirable. We see this as a
clock drifts of sensor nodes should decrease and hence        tradeoff between complexity and accuracy and the choice
we expect to get better results with Setup II, as the
                                                              depends on the particular scenario. Note that the
granularity is improved.
                                                              overhead of level discovery can be significant in
     In this paper, we have used special packets,             scenarios where the new root node is elected
synchronization_pulse and acknowledgement, to carry
                                                              periodically.
out the two-way message exchange between nodes. In
the presence of existing data traffic this information,
level number and different timestamps, can be simply
UCLA NESL TECHNICAL REPORT                                                                                             NESL 01-01-2003


                       VI . CONCLUSIONS                                     [10] N. Malpani, J. L. Welch, N. Vaidya, “Leader election algorithm
                                                                                   for mobile ad-hoc networks,” In Proceedings of 4 th International
     In this paper, we have introduced an algorithm for                            Workshop on Discrete Algorithms and Methods for Mobile
network-wide time synchronization in sensor networks.                              Computing and Communication, pp. 96-103, August 2000.
We show that our algorithm can synchronize all the                          [11] D. Bertsekas, R. Gallager, “Data Networks,” Prentice-Hall, Inc.,
sensor nodes within an average accuracy of around                                  Englewood Cliffs, New Jersey, pp. 318-323, 1987.
0.7ms. The error can be further reduced to about 0.1ms
by using a more efficient radio setup. The accuracy of
our algorithm does not degrade significantly with the
increase in the number of sensor nodes being deployed.
Thus our algorithm is scalable and is aptly suited for
sensor network domain.
     We are currently in the process of implementing this
algorithm on a sensor network test-bed. We are also
exploring a new paradigm for time synchronization,
where the network is divided into several small subnets.
Every node in a subnet maintains a timescale, unique to
that subnet, using our algorithm. Nodes lying at
boundary of one subnet maintain a relative timescale to
the nodes of other subnet using a scheme similar to
Reference Broadcast Synchronization [5]. We anticipate
obtaining much tighter levels of accuracy with this new
paradigm of time synchronization.

                         REREFENCES


[1]    K. Sohrabi, J. Gao, V. Ailawadhi, G. Pottie, “Protocols for self-
       organization of a wireless sensor network,” IEEE Personal
       Communications Magazine, Vol.7, No.5, pp. 16-27, Oct. 2000.

[2]    L. Clare, G. Pottie, J. Agre, “Self-organizing distributed sensor
       networks,” SPIE - The International Society for Optical
       Engineering, Orlando, FL, pp. 229-237, April 1999.

[3]    S. I. Roumeliotis, G. A. Bekey, “An extended kalman filter for
       frequent local and infrequent global sensor data fusion,” In Proc.
       of the SPIE (Sensor Fusion and Decentralized Control in
       Autonomous Robotic Systems, Pittsburgh, PA, USA, Oct. 14-15,
       1997, pp.11-22.

[4] D. L. Mills, “Internet time synchronization: The Network Time
       Protocol” In Z. Yang and T.A. Marsland, editors, Global States
       and Time in Distributed Systems. IEEE Computer Society Press,
       1994.

[5]    Jeremy Elson, Lewis Girod and Deborah Estrin, “Fine-Grained
       Network Time Synchronization using Reference Broadcasts,” To
       appear in the proceedings of the fifth symposium on Operating
       System Design and Implementation (OSDI 2002), December
       2002

[6]    Kay Romer (ETH-Zurich), “Time synchronization in ad hoc
       networks”. Mobihoc 2001.

[7]    TLA Micro-systems http://www.tla.co.nz/xtal1.html

[8]    R. Bagrodia, R. Meyer, M. Takai, Y.A. Chan, X. Zeng, J.
       Marting, H.Y. Song, “Parsec: a parallel simulation environment
       for complex systems,” Computer, Vol.31, No.10, pp. 77-85,
       October 1998 .

[9]    Jason Hill and David Culler, “A Wireless embedded sensor
       architecture for system-level optimization.” Technical report,
       U.C. Berkeley, 2001

				
DOCUMENT INFO