190 likes | 542 Views
Gradient Clock Synchronization in Wireless Sensor Networks. Philipp Sommer Roger Wattenhofer. Time Synchronization is a well-studied Problem. Time, Clocks, and the Ordering of Events in a Distributed System L. Lamport, Communications of the ACM, 1978.
E N D
Gradient ClockSynchronization in Wireless Sensor Networks Philipp Sommer Roger Wattenhofer
Philipp Sommer, ETH Zurich @ IPSN'09 Time Synchronization is a well-studied Problem • Time, Clocks, and the Ordering of Events in a Distributed SystemL. Lamport, Communications of the ACM, 1978. • Internet Time Synchronization: The Network Time ProtocolD. Mills, IEEE Transactions on Communications, 1991 • Reference Broadcast Synchronization (RBS)J. Elson, L. Girod and D. Estrin, OSDI'02 • Timing-sync Protocol for Sensor Networks (TPSN)S. Ganeriwal, R. Kumar and M. Srivastava, SenSys'03 • Flooding Time Synchronization Protocol (FTSP)M. Maróti, B. Kusy, G. Simon and Á. Lédeczi, SenSys'04 • and many more ... State-of-the-art time syncprotocolforwirelesssensornetworks
Philipp Sommer, ETH Zurich @ IPSN'09 Preview: FTSP vs. GTSP • Gradient Time Synchronization Protocol (GTSP) • Details will followsoon • Network synchronizationerror(global skew) • Pair-wisesynchronizationerrorbetweenanynodes in thenetwork NEW FTSP (avg: 7.7 μs) GTSP (avg: 14.0 μs)
Philipp Sommer, ETH Zurich @ IPSN'09 Preview: FTSP vs. GTSP (2) • NeighborSynchronizationerror(localskew) • Pair-wisesynchronizationerrorbetweenneighboringnodes • Synchronizationerrorbetweentwodirectneighbors FTSP (avg: 15.0 μs) GTSP (avg: 2.8 μs)
Philipp Sommer, ETH Zurich @ IPSN'09 Time in Sensor Networks • Common time is essential formanyapplications: • Assigning a global timestamptosenseddata/events • Co-operationof multiple sensornodes • Preciseeventlocalization (e.g., shooterdetection) • Coordinationofwake-upandsleepingtimes (energyefficiency) • TDMA-based MAC layer Global Global Local Local Local
Philipp Sommer, ETH Zurich @ IPSN'09 Outline • Introduction • ClockSynchronization Basics • Gradient Time Synchronization Protocol (GTSP) • Evaluation • Conclusions
Philipp Sommer, ETH Zurich @ IPSN'09 Sensor NodeClocks • Eachnodehas a hardwareclockH(t) • Counter registerofthemicrocontroller • Crystal quartzoscillator (e.g., 32kHz, 7.37 MHz) • Subjecttoclockdrift (30 ppm) • Eachnodehas a logicalclockL(t) • Holdstheestimationofthecurrent global time • Computedas a functionofthecurrenthardwareclockH(t) • Logical clock rate
Philipp Sommer, ETH Zurich @ IPSN'09 ClockSynchronizationAlgorithm • Exchange messageswithcurrentclockvalue L(t) withothers • Adjustclockratesandoffset • Repeat thisprocessfrequently • Uncertainty (jitter) in themessagedelay • Varioussourcesoferrors (deterministicandundeterministic) • Can bereduced (but not eliminated) bytimestampingat MAC layer
Philipp Sommer, ETH Zurich @ IPSN'09 TheoreticalBounds on theSynchronizationAccuracy • Two nodes u and v cannot be synchronized perfectly • Worst-case example: • Error increaseswithdistancefromthereferencenode • Lowerboundresultfromtheoreticalwork • Clockerrorbetweennodesdistanced apart depends on thenetworkdiameterD: • R. Fan and N. Lynch. Gradient Clock Synchronization. In PODC ’04: Proceedings of the twenty-third annual ACM symposium on principles of distributed computing, 2004. u 0 1 2 3 μ v 0 1 2 3 u 0 1 2 3 μ + ε v 0 1 2 3
Philipp Sommer, ETH Zurich @ IPSN'09 Gradient ClockSynchronization • Global property: Minimize clock error between any two nodes • Local (“gradient”) property: Small clock error between two nodes if the distance between the nodes is small. FTSP GTSP
Philipp Sommer, ETH Zurich @ IPSN'09 Gradient Time Synchronization Protocol (GTSP) • Synchronizewithallneighboringnodes • Broadcast periodic time beacons, e.g., every 30 s • Noreferencenodenecessary • Howtosynchronizeclockswithouthaving a leader? • Follow thenodewiththe fastest/slowestclock? • Idea: Go totheaverageclockvalue/rate of all neighbors (includingnodeitself)
Philipp Sommer, ETH Zurich @ IPSN'09 Drift and Offset Compensation in GTSP • Update ruleforthelogicalclock rate: • Update ruleforthelogicalclockoffset: • Note: We will jump directlyto a higherclockvalueiftheoffsetexceeds a certainthreshold, e.g., 20 μs.
Philipp Sommer, ETH Zurich @ IPSN'09 Experimental Evaluation • Mica2 platformusingTinyOS 2.1 • System clock: 7.37 MHz (crystalquartz) • Hardware clock: System clockdividedby 8 = 921 kHz • Clockgranularityof 1 microsecond (1 clock tick ≈ 1 μs) • Testbedof 20 Mica2 nodes • Base stationtriggersexternaleventsbysending time probe packets • Ring topologyisenforcedbysoftware
Philipp Sommer, ETH Zurich @ IPSN'09 Experimental Results • Network synchronizationerror(global clockskew) • 7.7 μs with FTSP, 14.0 μs with GTSP • FTSP needsmore time tosynchronize all nodes after startup FTSP GTSP
Philipp Sommer, ETH Zurich @ IPSN'09 Experimental Results (2) • Neighborsynchronizationerror(localclockskew) • 5.3 μs with FTSP, 4.0 μs with GTSP FTSP GTSP
Philipp Sommer, ETH Zurich @ IPSN'09 NeighborSynchronization Error: FTSP vs. GTSP • FTSP has a large clockerrorforneighborswith large stretch in thetree (Node 8 andNode 15) FTSP GTSP
Philipp Sommer, ETH Zurich @ IPSN'09 Multi-Hop Time Synchronization in Practice • Is thisreally a problem in practice? • Ring topologyof 20 nodesseemstobe „artificial“!? • Finding a tree-embeddingwithlowstretchishard • In a n = m*m gridyou will havetwoneighborswith a stretchofat least • Example: FTSP on a 5x4 gridtopology • Node 2 and 7 have a distanceof 13 hops!
Philipp Sommer, ETH Zurich @ IPSN'09 Simulation Results • Simulation of GTSP for larger networktopologies • Network errorof ~1 msfor 100 nodes in a linetopology • Neighborerrorbelow 100 μs forthe same topology
Philipp Sommer, ETH Zurich @ IPSN'09 Conclusionsand Future Work • Gradient Time Synchronization Protocol (GTSP) • Distributed time synchronizationalgorithm (noleader) • Improvesthesynchronizationerrorbetweenneighboringnodeswhile still providingprecisenetwork-widesynchronization • Bridgingthegapbetweentheoryandpractice • Is there a „perfect“ clocksynchronizationprotocol? • Goal: Minimizinglocaland global skewatthe same time