Clock Synchronization in Sensor Networks Mostafa Nouri Outline Need for time synchronization in sensor networks Definition of time synchronization Common problems in time synchronization Typical schemes and algorithms. Sensor Networks Sensor networks and applications Deeply embedded into the environment Sense, monitor, and control environments for a long period of time without human intervention Vast collection of miniature, lightweight, inexpensive, energy-efficient sensor nodes Sensor Networks Applications Biological & Environmental: habitat monitoring, wildlife, pollution, natural catastrophes Civil: infrastructure, machine health, human health, traffic monitoring Military: surveillance, tracking, detection Network Architecture / Sensor Platforms ADC Battery Low-power CPU/mC Memory Radio Sensors Base Station Why Need for Time Synchronization Link to the physical world When does an event take place? Key basic service of sensor networks Fundamental Crucial to the efficient working of other basic services Localization, to data fusion Calibration, In-network processing, … Several protocols require time synchronization Cryptography, Topology management. Sensor Networks Characteristics of SN Cheap No Accurate Oscillator Limited Energy Together Data Fusion Conclusion must ? ? Need to Sleep Work ? and Small initiate T-Sync in WSN ? ? Metrics for Synchronization Protocols Precision Longevity of synchronization Time and power budget available for synchronization Geographical span Size and network topology Examples Energy efficient radio scheduling Sender Receiver Time Array processing Radio On Radio Off Radio Off Guard band due to clock skew; receiver can’t predict exactly when packet will arrive Computer Clocks Clocks in computers C(t)=k∫0tω(τ)d τ + C(t0) ω is frequency of oscillator, C(t0). Time of the computer click implemented based on a hardware oscillator Computer clock is an approximation of a real time t C(t)=a*t+b C(t) a is a clock drift (rate) B is an offset of the clock Perfect clock Rate = 1 Offset = 0 b C(t) a t Definition of time synchronization Let C(t) be a perfect clock A clock If Ci(t)=C(t) A clock Ct(t) is called accurate at time t If dCi(t)/dt = dC(t)/dt = 1 Two Ci(t) is called correct at time t clocks Ci(t) and Ck(t) are synchronized at time t if Ci(t)=Ck(t) Time synchronization Requires knowing both offset and drift NTP Overview Most widely used time synchronization protocol Hierarchical: Perfectly acceptable for most cases. Coarse C/S model grain synchronization Inefficient when fine grain synchronization is required Why not Use NTP Link Topology Ratio of packet loss is very low in Internet (fiber, cable) Links are short range and short lived in sensor networks (wireless) Static, robust and configurable Energy aware Frequent message exchange Listening to the network is free Using the CPU in moderation free Difficulties in Sensor Networks No periodic message exchange is guaranteed There Transmission delay between two nodes is hard to estimate The may be no links between two nodes at all link distance changes all the time Energy is very limited Nodes sleep most of the time to conserve power Node need to be small and cheap No expensive clock circuitry Basic Approach Collaboration among sensor nodes Establish pair-wise relationship between nodes. Extend this to network level. Two approaches for collaboration Receiver-Receiver Sender-Receiver SR vs. RR A A B Beacon B A B A Sources of error-variation of packet delays and clock drifts B Basic Mechanism Pair-wise synchronization A T2=T1+delay+offset distance B T1 T2 T3 T4=T3+delay-offset T4 offset=((T2-T1)-(T4-T3))/2 delay=((T2-T1)+(T4-T3))/2 hi hj Sources of Errors Send time Kernel processing Context switches Interrupt processing Access time Specific to MAC protocol Transmission time Propagation time e.g. in Ethernet, sender must wait for clear channel Very small in WSNs, can be ommited Reception time Receive time Illustration Sender Receiver Receive time Send time NIC Acess time Transmission time Propagation time NIC Reception time Physical Media Typical Schemes and Algorithms RBS (Reference Broadcast Synchronization) TPSN (Timing-Sync Protocol for Sensor Networs) DTMS (Delay Measurement Time Synchronization) LTS (Lightweight Time Synchronization) FTSP (Flooding Time Synchronization Protocol) TS/MS (Tiny-Sync and Miny-Sync) TSync AD (Asynchonous Diffusion) TPSN Features Sender-receiver bidirectional mechanism Two phases of operation: Level discovery and synchronization Level discovery phase Root node initiates level discovery A node on receiving its level broadcasts it Any node receiving multiple level packets takes the first one and ignores the others Any node not receiving a level packet times out and sends a request for level packet Level Discovery Phase 2 1 K B 0 1 A H 1 2 C F 1 2 E 3 I L 2 2 G D 3 J TPSN Synchronization phase Root node sends a start synchronization packet All nodes of level 1 synchronize themselves to the root node For every level i, the nodes of that level synchronize to the nodes of level i-1 If a node in level i-1 is not synchronized, then it does not respond to synchronization requests from level i Time Synchronization Algorithm K B 0 1 A H 1 2 C F 1 2 E 3 I L 2 2 G D 3 J LTS Features Minimize synchronization complexity rather than maximizing accuracy Authors claim that wireless sensor networks need quite low synchronization accuracy Sender-receiver bidirectional Two LTS algorithms Centralized mechanism Node sends a synchronization request to a closest reference node by any routing mechanism Distributed Requires a spanning tree to be constructed firstly LTS LTS optimizes synchronization frequency with required precision The synchronization frequency is calculated from the requested precision, from the depth of the spanning tree, from the drift bound Simulation results 500 nodes (120 x 120) Target precision: 0.5 Duration: 10 hrs Centralized: 65% of all nodes request synchronization 4-5 synchronization operation on average per node Distributed: Average 26 pair-wise synchronization per node TS/MS Features Determining relative offset and drift between two nodes Sender-receiver bidirectional scheme Two clocks c1(t) and c2(t) are linearly related as Node 1 sends a probe message to node 2 time-stamped with t0 Node 2 generates timestamp tb and responds immediately Node 1 generates timestamp tr C1(t)=a12C2(t)+b12 The following inequalities are held: t0<a12tb+b12<tr TS/MS C1(t) = a12H2(t) + b12 C1(t) Sample 3 tr t0 Sample 1 b12 Node 1 t0 a12 Node 2 tb tr tb C2 (t) Parameter Estimation Relative drift a12 and offset b12 The tighter the bound, the higher the synchronization precision Requires high amount of data points and quite complex Algorithms precision increases with the increased number of data points. Difference Between TS and MS Different methods in selecting useful data points Tiny-Sync Keep only four constrains of all data points Does nor always give the best solution for the bounds Mini-Sync is an extension of Tiny-Sync More optimal solution with increased complexity Keeps also the data points which may be useful by some future data points to give tighter bounds A data point is discarded only if it is definitely useless Quite complex selection criterion. Reference Elson, Girod, Estrin, “Fine-Grained Network Time Synchronization using Reference Broadcasts” Sichitiu, Veerarittiphan, “Simple, Accurate Time Synchronization for Wireless Sensor Networks” Ganeriwal, Kumar, Srivastava, “Timing-Sync Protocol for Sensor Networks” Genunen, Rabaey, “Lightweight Time Synchronization for Wireless Sensor Networks” Li, Rus, “Global Clock Synchronization in Sensor Networks” Dai, Han, “TSync: A Lightweight Bidirectional Time Synchronization Service for Wireless Sensor Networks” Thank you