time synchronization in sensor networks

39
April 28 th 2005 Time Synchronization in Sensor Networks 1 Time synchronization in sensor networks Presented by: Nirav Jasapara Graduate Student, USC. [email protected]

Upload: aram

Post on 10-Feb-2016

54 views

Category:

Documents


1 download

DESCRIPTION

Time synchronization in sensor networks. Presented by: Nirav Jasapara Graduate Student, USC. [email protected]. Time Synchronization – Introduction. Network Time Protocol (NTP). Challenges for time-sync in Sensor networks. Reference Broadcast System. Time-sync protocol for sensor networks. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 1

Time synchronization in sensor networks

Presented by: Nirav JasaparaGraduate Student, USC.

[email protected]

Page 2: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 2

Table 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

Page 3: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 3

Introduction• 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

Page 4: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 4

How 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)

Page 5: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 5

Network Time Protocol• Used since 1985 for time-synchronization over WAN’s.

• 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.

Page 6: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 6

NTP: 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 1[3]: A schematic design of an NTP network

Page 7: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 7

Sensor 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) won’t work ?- Energy constrained.- Dynamic topology.- No infrastructure support.

Page 8: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 8

Reference Broadcast System (RBS)

Developed by: Jeremy Elson, Lewis Girod and

Deborah Estrin.

Page 9: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 9

Reference 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 sender’s non-

determinism from the system.• Federate clocks over different broadcast domains with

little loss of accuracy over multiple hops.

Page 10: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 10

Reference 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.

Figure 3 [1]: Critical path analysis for RBS

Page 11: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 11

Estimation 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.

Page 12: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 12

Estimation of Phase Offset

– 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: r’s clock when it received broadcast b

• The receiver error is Gaussian.

• We can increase precision by sending more reference beacons.

.1],[:,1

,,

m

kkikj TT

mjiOffsetnjni

Page 13: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 13

Estimation 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 oscillator’s 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.

Page 14: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 14

Implementation 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

Page 15: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 15

Relative 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 clock’s 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.

Page 16: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 16

Test 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]

Page 17: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 17

Application 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.

Page 18: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 18

Multi-Hop Time Synchronization• Let the notation Ei(Rj) mean the time of

event i according to receiver j’s clock.

• Receivers R1 and R7 observe events at times E1(R1) and E7(R7), respectively.

• R4 uses A’s reference broadcasts to convert clock values from R1 to R4. This is used to convert E1(R1) to E1(R4).

• R4 similarly uses B’s broadcasts to convert E1(R4) to E1(R7).

• The time elapsed between the events is computed as E1(R7)-E7(R7)

Figure 6: [1] A simple topology where multi-hop time synchronization is required.

Page 19: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 19

Synchronization 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.

Page 20: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 20

Scrutiny: 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.

Page 21: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 21

Time Synch Protocol for Sensor Networks (TPSN)

Developed by Saurabh Ganeriwal, Ramkumar Rengaswamy and Mani B

Srivastava.

Page 22: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 22

Time Sync Protocol for Sensor Networks

• Extend NTP’s 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.

Page 23: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 23

Level 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 node’s level has been decided, it ignores all such packets in the future

Page 24: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 24

Synchronization 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. D=clock drift between the two nodes d=propagation 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

Figure 9 [2]:

Page 25: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 25

Some 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 i+1

– when a node ‘i’ loses all its neighbors with level ‘i+1’• 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.

Page 26: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 26

Error Analysis in TPSN• Decomposition of packet delay

Figure 9 [2]

Figure 10 [2]: Drift among Local nodes Figure 11 [2]: Error Calculation

Page 27: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 27

Implementation 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.

Page 28: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 28

Test 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

Figure 12 [2] : Histogram of Sync-error

Page 29: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 29

Multi-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.

Page 30: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 30

Scrutiny: 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.

Page 31: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 31

Summary

NTP RBS TPSNSender-Receiver based scalable and robust protocol which is most widely used.

Receiver-Receiver based scheme which achieves high precision by leveraging the broadcast property of wireless networks.

Sender-Receiver based protocol which builds a NTP like hierarchy to time-sync nodes.

Uses a hierarchical synchronization scheme to scale the network.

Uses reference beacon broadcasts and synchronization domains to improve scalability.

Uses a hierarchical NTP like structure to improve scalability.

Does not require MAC layer time-stamping.

Does not require MAC layer time-stamping.

Requires MAC layer time-stamping.

Mostly used over wired networks.

Mostly used over wired and wireless networks with broadcast domains.

Mostly used over wireless sensor networks.

Widely used and time-tested. Comprehensive experiments support deployment in real WSN’s.

Initial results are promising.

Page 32: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 32

Conclusion• NTP is the most widely used time synchronization

protocol over the large WAN’s 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.

Page 33: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 33

Acknowledgements

• Dr. Wei Ye • Dr. Jeremy Elson

Page 34: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 34

References

1. 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.

2. Saurabh Ganeriwal, Ramkumar Rengaswamy, Mani B Srivastava, Timing-sync Protocol for Sensor Networks, ACM SenSys'03, November 2003.

3. D.L. Mills, Precision synchronization of computer network clocks, ACM Computer Communication Review 24, 2, April 1994.

Page 35: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 35

Questions ?

Thank You.

Page 36: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 36

Backup Slides

Page 37: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 37

Estimation 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

Figure 4: [1]

Page 38: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 38

RBS 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.

Page 39: Time synchronization in sensor networks

April 28th 2005 Time Synchronization in Sensor Networks 39

Time Routing in Multi-Hop Networks

Figure 7: [1] A more complex multi-hop network topology.