Title: Time synchronization in sensor networks
1Time synchronization in sensor networks
- Presented by Nirav Jasapara
- Graduate Student, USC.
- jasapara_at_isi.edu
2Table of Contents
- Time Synchronization Introduction.
- Network Time Protocol (NTP).
- Challenges for time-sync in Sensor networks.
- Reference Broadcast System.
- Time-sync protocol for sensor networks.
- Summary.
- Conclusion
3Introduction
- What is time-synchronization ?
- A method which allows individual entities in
a group to synchronize their clocks w.r.t each
other or to some coordinated universal time
(UTC). - Why do we need time-synchronization ?
- Agreeing on a common time scale
- Track relative order of events
- Co-ordinate future events
- Order logged events for debugging
- Handling leases
4How is it done ?
- Wired Domain
- -- NTP (Network Time Protocol)
- - most widely used time-synchronization
protocol for - large multi-hop networks.
- - allows construction of a hierarchy of time
servers - rooted at sources of external time (eg. UTC)
- Wireless Domain
- -- RBS (Reference Broadcast System)
- -- TPSN (Time-sync protocol for sensor networks)
-
5Network Time Protocol
- Used since 1985 for time-synchronization over
WANs. - Unix NTP daemon ported to almost every server
platform available today - from PCs to Crays -
Unix, Windows, VMS and embedded systems. - Provides clients with an average accuracy below 5
ms. - Stands out by virtue of its scalability,
self-configuration in large multi-hop networks,
robustness to failures and ubiquitous deployment.
6NTP A Brief Overview
- Uses a hierarchical design.
- At the top are stratum 1 clocks, computers with
source of accurate time (eg. GPS, WWVB). - Stratum 2 clocks synchronize themselves with
stratum 1 clocks over the network. - This process repeats up to stratum 16 which is
effectively infinity for NTP. - A typical NTP network would have stratum 1
somewhere on the internet, stratum 2 clocks near
a gateway and stratum 3 clocks on a LAN. - NTP network is semi-self-organizing each node
requires some manual configuration, once the NTP
host is set up it can run itself autonomously.
- Figure 13 A schematic design of
- an NTP network
7Sensor Networks A New Domain
- Wireless Sensor Networks (WSN) consists of large
numbers of cooperating small-scale nodes, spread
over a geographical area, each capable of limited
computation, wireless communication, and sensing. - Why existing solutions for wired networks (NTP)
wont work ? - - Energy constrained.
- - Dynamic topology.
- - No infrastructure support.
8Reference Broadcast System (RBS)
- Developed by
- Jeremy Elson, Lewis Girod and Deborah Estrin.
9Reference Broadcast System
- Exploits the broadcast channel available in many
physical-layer networks. - -- Works by sending periodic reference beacons
to a set of receivers using physical layer
broadcasts. - -- Broadcasts do not contain a time-stamp.
- -- Broadcasts used as a relative time reference
to synchronize a set of receivers. - Scheme is receiver-receiver as opposed to
sender-receiver (NTP). - Tries to achieve accuracy by removing the
senders non-determinism from the system. - Federate clocks over different broadcast domains
with little loss of accuracy over multiple hops.
10Reference Broadcast System
- The enemy of precise network time-sync is
non-determinism in latency which contributes
directly to synchronization error. 1 - Sources of Latency include
- Send Time
- Time required to construct the message
- Access Time
- Time required to access the medium
- Propagation Time
- Time taken for beacon to travel from one NIC card
to the other - Receive Time
- Time taken to receive the beacon and notify the
host of its arrival - Broadcast at the physical layer will arrive at a
set of receivers with very little variability in
its delay. This reduces non-determinism due to
send-time and receive-time.
- Figure 2 1 Critical path analysis for
traditional protocols.
11Estimation of Phase Offset
- Sequence of Events
- A transmitter broadcasts a reference packet to
two receivers (i and j). - Each receiver records the time that the reference
was received, according to its local clock. - The receivers exchange their observations.
- Based on this single broadcast the receivers can
form a relative timescale.
12Estimation of Phase Offset
- The receiver error is Gaussian.
- We can increase precision by sending more
reference beacons.
- A transmitter broadcasts m reference packets.
- Each of the n receivers records the time that the
reference was observed, according to its local
clock. - The receivers exchange their observations.
- Each receiver i can compute its phase offset to
any other receiver j as the average of the phase
offsets implied by each pulse received by both
nodes i and j. That is, given - n the number of receivers
- m the number of reference broadcasts
- Tr,b rs clock when it received broadcast b
13Estimation of Clock Skew
- What is Clock Skew ?
- The change in frequency of the oscillator over
time. - Why is it necessary ?
- Clock Skew is major source of error.
- Oscillator Characteristics
- Accuracy
- Agreement between the oscillators actual and
expected frequencies - Stability
- An oscillators tendency to stay at the same
frequency over a period - To calculate clock skew, least squares linear
regression is performed - The slope of the best fit line through the phase
offsets can give the relative clock skew of the
remote node.
14Implementation on Berkeley Motes
- First test
- 5 Berkeley motes sending out reference pulses
periodically at 2 micro sec clock resolution. - Residual error detected 11.2 micro sec
- Second Test
- Used motes as NIC cards for std. Linux boxes.
- Modified Linux kernel to time-stamp serial port
interrupts for reduction in phase calculation
error. - Tried to test the clock skew measurement
algorithm by sending a few synchronization
pulses, then silencing the radio for a minute and
sending synchronization pulses again. - Residual error detected 7.6 micro sec
15Relative Performance of RBS and NTP
- Implemented RBS under same constraints as NTP.
- Ran RBS as a UNIX daemon on a Compaq IPAQ, with
Familiar Linux running, using UDP datagrams as
motes. - Daemon ran completely in user space, using
standard system calls the same as NTP. - Three different synchronization schemes tested
- RBS
- NTP
- NTP with offset
- Test application queried the NTP daemon for the
clocks phase offset and subtracted it from the
test pulse time. - Two Different scenarios tested
- Light Network Load
- Little or not background traffic
- Heavy Network Load
- Two additional IPAQs configured as traffic
generators sending UDP datagrams at 6.5Mbit/sec.
16Test Results
- RBS performs 8 times better than NTP in the same
environment. - The performs of RBS remains almost the same even
with heavy traffic - The performance of NTP degrades 32 fold in the
presence of heavy traffic - Figure 5 1
17Application to Post-Facto synchronization
- What is Post-Facto synchronization ?
- Post-facto synchronization strives to conserve
energy in sensor nodes by not keeping the clocks
in continuous synchrony. Clocks are synchronized
only when an event of interest occurs. - RBS clock skew estimator acts as an effective
form of post-facto synchronization. - Once nodes power up from deep sleep and exchange
updates, exact time of events of interest can be
calculated using backwards extrapolation of
clock-skew.
18Multi-Hop Time Synchronization
- Let the notation Ei(Rj) mean the time of event i
according to receiver js clock. - Receivers R1 and R7 observe events at times
E1(R1) and E7(R7), respectively. - R4 uses As reference broadcasts to convert clock
values from R1 to R4. This is used to convert
E1(R1) to E1(R4). - R4 similarly uses Bs broadcasts to convert
E1(R4) to E1(R7). - The time elapsed between the events is computed
as E1(R7)-E7(R7)
19Synchronization with external timescales
- RBS can be extended to include external
timescales. - Only one node is required to be as the reference
external timescale, for e.g. a special node can
be GPS enabled and can synchronize its own clock
externally. - Then other nodes can convert their time to GPS
times using the conversion algorithms.
20Scrutiny RBS
- Advantages
- Receiver-Receiver mechanism, hence most sources
of non-deterministic latency removed giving high
precision. - Multiple reference broadcasts reduce
synchronization offset. - Allows nodes to construct local timescales which
is sufficient for applications like sensor
networks - Time can be propagated across broadcast domains.
- Limitations
- It requires a network with a physical broadcast
channel - It can not be used, for example, in networks that
employ point-to-point links.
21Time Synch Protocol for Sensor Networks (TPSN)
- Developed by Saurabh Ganeriwal, Ramkumar
Rengaswamy and Mani B Srivastava.
22Time Sync Protocol for Sensor Networks
- Extend NTPs approach for Time Synchronization in
wireless sensor networks. - Uses the sender-receiver paradigm of NTP
- Works in two steps
- Sets up Level hierarchy (Level discovery phase)
- Propagates synchronization messages
(Synchronization Phase) - Tries is to maintain a unique global timescale,
at every instant of time, throughout the network.
23Level Discovery Phase
- Root node assigned level 0
- The root node initiates this phase by
broadcasting a level-discovery packet - Any neighbor receiving this packet will set its
own level to one greater than the one they
received and send its own level discovery packet. - This process is continued and eventually every
node in the network is assigned a particular
level. - Once a nodes level has been decided, it ignores
all such packets in the future
24Synchronization Phase
- Root node sends out a time-sync packet.
- Pair-wise synchronization is performed over the
entire network. - Figure 8
- At time T1, A sends a sync pulse packet to B
which contains the level number of A and T1. - Node B receives this packet at T2, where T2 is
equal to T1 D d. - Dclock drift between the two nodes
- dpropagation delay
- At time T3, B sends back an acknowledgement
packet to A with values of T1, T2 and T3. - A can calculate the phase offset as shown in
figure 9.
-
- Figure 8 2 Two Way Message
Exchange
25Some Special Provisions
- TPSN has some special provisions for
- when a new node joins a network or when it does
not get a level discovery packet - Wait for some time and listen for a level
discovery packet - Timeout and Broadcast a Level Request query
- Neighboring nodes send their own level
- Again select the lowest level received i and
assign yourself i1 - when a node i loses all its neighbors with
level i1 - After sending synchronization initiation messages
a fixed number of times, a node times out and
sends out a Level Request query - when the root node dies
- Level 1 nodes will timeout on ack packets to
root. - Instead of Level Request query, they run an
election algorithm and select a new root node. - A brand new Level Discovery phase is started till
all the nodes get reassigned their new level.
26Error Analysis in TPSN
- Decomposition of packet delay
- Figure 9 2
-
27Implementation on Berkeley Motes
- Tested on IPAQ testbed with no external
components used. - Modification to TinyOS
- Generate a lower granularity clock.
- Timestamp packets at the MAC layer.
28Test Results
- Contribution of uncertainty at the sender towards
the sync-error is very low (0.65 microsec) thus
can be ignored. - Comparison with RBS showed that on an average it
was twice as accurate as RBS under similar
conditions.
- Figure 12 2 Statistics of Sync-error
29Multi-Hop results
- Figure 13 2 Sync-error over Multi-Hop
- It was observed that error does not blow up as
the hop count increases. - Some experiments showed high error values but its
probability is low. - Better analytical models for multi-top topologies
are under research.
30Scrutiny TPSN
- Advantages
- Being a logical extension of NTP to sensor
networks, supports high level of scalability.
Error is almost entirely based on hop distance of
adjacent nodes and independent of total number of
nodes in the network. - Can achieve better accuracy by using a min.
spanning tree algorithm (level discovery phase)
with an added complexity of O(N). - Limitations
- Requires MAC layer time-stamping.
- The main drawback is the time taken for
synchronization phase which increases linearly
with N (the number of nodes). - This initial setup might take a long time and
might have to be done more than once especially
in dynamic situation. - Performance in the presence of traffic is not
investigated.
31Summary
32Conclusion
- NTP is the most widely used time synchronization
protocol over the large WANs and other wired
networks - RBS works very well in broadcast networks (eg.
WSN) giving higher precision as compared to NTP. - TPSN improves accuracy over RBS by a factor of 2
but performance in actual sensor network
environments is yet to be tested.
33Acknowledgements
- Dr. Wei Ye
- Dr. Jeremy Elson
34References
- Jeremy Elson, Lewis Girod and Deborah Estrin,
Fine-Grained Network Time Synchronization using
Reference Broadcasts, In Proceedings of the Fifth
Symposium on Operating Systems Design and
Implementation (OSDI 2002), Boston, MA. December
2002. - Saurabh Ganeriwal, Ramkumar Rengaswamy, Mani B
Srivastava, Timing-sync Protocol for Sensor
Networks, ACM SenSys'03, November 2003. - D.L. Mills, Precision synchronization of computer
network clocks, ACM Computer Communication Review
24, 2, April 1994.
35Questions ?
36Backup Slides
37Estimation of Phase Offset
- Figure 4 shows the maximum pair-wise error after
RBS. The receiver reports errors according to the
Gaussian distribution. - Figure 4-a shows the mean group dispersion and
the standard deviation from the mean. - Figure 4-b shows a 3D view of the same dataset,
from 2 to 20 receivers
38RBS using kernel timestamps.
- Time-stamping at interrupt time, before the
packet is even transferred from the NIC,
significantly reduces jitter. - Kernel Time stamping significantly improved the
performance over the same setup. - 1.85 1.28 microseconds from 6.29 6.45
microseconds.
39Time Routing in Multi-Hop Networks
- Figure 7 1 A more complex multi-hop
network topology.