79
Chapter 6 Time synchronization Time synchronization

Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

  • Upload
    others

  • View
    15

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Chapter 6Time synchronizationTime synchronization

Page 2: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Outline

� 6.1. The Problems of Time Synchronization

� 6.2. Protocols Based on Sender/Receiver Synchronization� 6.2.1. Network Time Protocol (NTP)

� 6.2.2. Timing-sync Protocol for Sensor Networks (TPSN)

� 6.2.3. Flooding Time Synchronization Protocol (FTSP)� 6.2.3. Flooding Time Synchronization Protocol (FTSP)

� 6.2.4. Ratio-based time Synchronization Protocol (RSP)

� 6.3. Protocols Based on Receiver/Receiver Synchronization� 6.3.1. Reference Broadcast Synchronization (RBS)

� 6.3.2 Hierarchy Referencing Time Synchronization (HRTS)

� 6.4. Summary

Page 3: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.1. The problems of Time SynchronizationTime Synchronization

Page 4: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

The Problems of Time Synchronization� Why Need for Time Synchronization?

� Many of the applications of WSN needs the event with time stamp

� Ordering of the samples for reporting

� Events are reported by multiple nodes

� When WSN is energy save enabled, it need all nodes to be in sync in order to be in Idle or Active mode

� Medium Access Layer (MAC) Scheduling

� Order of messages may change while transmission

Page 5: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

The Problems of Time Synchronization� Affecting factors on Time Synchronization scheme

� Communication Overhead

� Available Bandwidth

� Accuracy Requirements

� Scalability

� Infrastructure Requirement

Page 6: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

The Problems of Time Synchronization

� Source of Synchronization Error� Clock Drift

� Major influence in WSN where communication is infrequent.

� Typical value 1 ~ 100 µs per second

� Communication Message Delay� Send Time� Send Time

� Access Time

� Propagation Time (Negligible for most of the cases)

� Receive Time

Page 7: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

The Problems of Time Synchronization� Types of Clock

� Digital Clock � Changes in Supply Voltage, Temperature can drift the rate

� Constant, Bounded, or Bounded Variation Drifts

� Software Clock� Value of counter converted in Time� Value of counter converted in Time

� Offset time value can be added/subtracted to achieve time synchronization

Page 8: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.2. Protocols Based on Sender/Receiver SynchronizationSender/Receiver Synchronization

Page 9: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Protocols Based on Sender/Receiver Synchronization

� In this kind of protocols, a receiver synchronizes to the clock of a sender

� The classical Network Time Protocol (NTP) belongs to this class

� We have to consider two steps:� We have to consider two steps:� Pair-wise synchronization:

� How does a single receiver synchronize to a single sender?� Network wide synchronization:

� How to figure out who synchronizes with whom to keep the whole network / parts of it synchronized?

Page 10: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.2.1. Network Time Protocol (NTP)6.2.1. Network Time Protocol (NTP)

Page 11: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Synchronizing Physical Clocks

� Computer Clocks in distributed system not in agreement� Need to synchronize clocks

� External synchronization (ES)� Synchronized with an external authoritative time source S� |S - C| < D, where C is computer’s clock|S - C| < D, where C is computer’s clock

� Internal synchronization (IS)� Synchronized with other computer in the distributed system� | Ci - Cj| < D

� IS does not imply ES� Clock Ci and Cj may drift collectively

� ES implies IS� Within bound 2D

Page 12: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Distributed System Type

� Synchronous distributed system � Known upper bound on transmission delay� Simplifies synchronization� One process p1 sends its local time t to process p2 in a message m,� p2 could set its clock to t + Ttrans

� where Ttrans is transmission delay from p1 to p2� where Ttrans is transmission delay from p1 to p2� Ttrans is unknown but min ≤ Ttrans ≤ max

� Set clock to t + (max - min)/2 then skew ≤ u/2

� Asynchronous distributed system� Internet is asynchronous system

� Ttrans = min + x where x ≥ 0

Page 13: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Cristian’s method (1989) for an asynchronous system� A time server S receives signals from a UTC source

� Process p requests time in mr and receives t in mt from S� p sets its clock to t + Tround/2� Accuracy ± (Tround/2 - min) :

� because the earliest time S puts t in message mt is min after p sent mr.

the latest time was min before m arrived at pt r

� the latest time was min before mt arrived at p

� the time by S’s clock when mt arrives is in the range [t + min, t + Tround- min]� Tround is observed RTT� min is minimum delay between p and S

mr

mt

p Time server,S

Page 14: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Issues with Christian’s Algorithms

� A single time server might fail, so they suggest the use of a group of synchronized servers

� It does not deal with faulty servers� No authentication mechanism

� Inaccuracy increases if the delay between messages is non-� Inaccuracy increases if the delay between messages is non-negligible

Page 15: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)

� A time service for the Internet - synchronizes clients to UTC

Reliability from redundant paths, scalable, authenticates time sources

Primary servers are connected to UTC sourcesSecondary servers are synchronized to primary servers

1

2

3

2

3 3

Synchronization subnet - lowest level servers in users’ computers

Page 16: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Synchronisation of servers

� The synchronization subnet can reconfigure if failures occur, e.g.� a primary that loses its UTC source can become a secondary

� a secondary that loses its primary can use another primary

� Modes of synchronization:

Multicast � Multicast � A server within a high speed LAN multicasts time to others which set

clocks assuming some delay (not very accurate)

� Procedure call� A server accepts requests from other computers (like Cristiain’s algorithm).

Higher accuracy. Useful if no hardware multicast.

� Symmetric � Pairs of servers exchange messages containing time information

� Used where very high accuracies are needed (e.g. for higher levels)

Page 17: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Messages exchanged between a pair of NTP peers

� All modes use UDP

� Each message bears timestamps of recent events:� Local times of Send and Receive of previous message

� Local times of Send of current message

Recipient notes the time of receipt T ( we have T , T , T , T )� Recipient notes the time of receipt Ti ( we have Ti-3, Ti-2, Ti-1, Ti)

� In symmetric mode there can be a non-negligible delay between messages

Ti

Ti-1Ti-2

Ti- 3

Server B

Server A

Time

m m'

Time

Page 18: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Accuracy of NTP

� For each pair of messages between two servers, � NTP estimates an offset oi between the two clocks and a delay di

(total time for the two messages, which take t and t’)� Ti-2 = Ti-3 + t + o and Ti = Ti-1 + t’ - o

� This gives us (by adding the equations) :d = t + t’ = T - T + T - T� di = t + t’ = Ti-2 - Ti-3 + Ti - Ti-1

� Also (by subtracting the equations) � o = oi + (t’ - t )/2 where oi = (Ti-2 - Ti-3 + Ti-1 - Ti)/2

� Using the fact that t, t’>0 it can be shown that� oi - di /2 ≤ o ≤ oi + di /2 .� Thus oi is an estimate of the offset and di is a measure of the

accuracy

Page 19: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Network Time Protocol (NTP)� Techniques to Improve Accuracy

� NTP servers filter pairs <oi, di>, estimating reliability from variation, allowing them to select peers � High variability in successive pairs implies unreliable data

� Accuracy depends on the delay between the NTP servers� Accuracy of 10s of millisecs over Internet paths (1 on LANs)Accuracy of 10s of millisecs over Internet paths (1 on LANs)

� Peer selection � Lower stratum peer favoured over higher stratum server� Peer with lower synchronization dispersion preferred

� synchronization dispersion is the sum of variability in data from the server to the root

Page 20: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.2.2. Timing-sync Protocol for Sensor Networks (TPSN)Sensor Networks (TPSN)

Page 21: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)� Introduction

� We present a Timing-sync Protocol for Sensor Networks (TPSN) that works on the conventional approach of sender-receiver synchronization

� Pairwise-protocol similar to LTS, but timestamping at node i happens immediately before first bit appears on the medium, and timestamping at node j happens in interrupt medium, and timestamping at node j happens in interrupt routine

� Comparison with “Reference Broadcast Synchronization (RBS)”

Page 22: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)

�� Network ModelNetwork Model� The network is “always-on”� Every node maintains 16-bit register as clock� Sensor has unique ID� Build hierarchical topology for the network� Node at level i can connect with at least one node at level i-1� Node at level i can connect with at least one node at level i-1

Page 23: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)�� Level discovery PhaseLevel discovery Phase

� Trivial

�� Synchronization PhaseSynchronization Phase� Pair-wise sync is performed along the edge of hierarchical � Pair-wise sync is performed along the edge of hierarchical

structure

Page 24: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)� Level discovery Phase

� The root node is assigned a level 0 and it initiates this phase by broadcasting a level_discovery packet

� level_discovery packet contains the identity and the level of the sender

� The immediate neighbors of the root node receive this packet and assign themselves a level (level = level +1)

� This process is continued and eventually every node in the network is assigned a level. On being assigned a level, a node neglects any such future packets. This makes sure that no flooding congestion takes place in this phase

Page 25: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)� Synchronization Phase

� T1: A is sender, starting sync by sending synchronization_pulse packet to B

� T2 = T1 + ∆ + d where � ∆ is the clock drift� d is propagation delay� d is propagation delay

� T3: B replies acknowledgement containing T1, T2, T3

� T4: A receive Ack and T4 = T3 -∆ + d. So:

� ∆ = [(T2 - T1) - (T4 - T3)] / 2� d = [(T2 - T1) + (T4 - T3)] / 2

Page 26: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)

� Synchronization Phase

T2 T1,T2,T3

T1: A is sender, starting sync by sending synchronization_pulse packet to B with timestamp T1T2: B receive the synchronization _pulse packet and timestamping immediately B replies acknowledgement containing T1,T2,T3

A receive an Ack and get timestamp T4

A

B

T1

T2 T1,T2,T3

T4

At time t1At time t4At time t2At time t3

Page 27: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)

� Simulation and Comparison

Page 28: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Timing-sync Protocol for Sensor Networks (TPSN)

� Simulation and Comparison

Page 29: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.2.3. Flooding Time Synchronization Protocol (FTSP)Synchronization Protocol (FTSP)

Page 30: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Flooding Time Synchronization Protocol (FTSP)� Introduction

� The FTSP synchronizes the time to possibly multiple receivers utilizing a single radio message

� Linear regression is used in FTSP to compensate for clock drift drift

Page 31: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Flooding Time Synchronization Protocol (FTSP)� Network Model

� Every node in the network has a unique ID

� Each synchronization message contains three fields:� timeStamp

� rootID

� seqNum� seqNum

� The node with the smallest ID will be only one root in the whole network

Page 32: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Flooding Time Synchronization Protocol (FTSP)

� The root election phase� FTSP utilizes a simple election process based on unique node

IDs

� Synchronization phase

Page 33: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Flooding Time Synchronization Protocol (FTSP)� The root election phase

� When a node does not receive new time synchronization messages for a number of message broadcast periods� The node declares itself to be the root

� Whenever a node receives a message, the node with higher IDs give up being rootIDs give up being root

� Eventually there will be only one root

Page 34: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Flooding Time Synchronization Protocol (FTSP)� Synchronization phase

� Root and synchronized node broadcast synchronization message

� Nodes receive synchronization message from root or synchronized node

� When a node collects enough synchronization message, it � When a node collects enough synchronization message, it estimates the offset and becomes synchronized

Page 35: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Flooding Time Synchronization Protocol (FTSP)

Root

A

Timestamp rootID seqNum

Timestamp rootID seqNum

Timestamp rootID seqNum

B

C

Synchronized

Node

Unsynchronized

node

Page 36: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Flooding Time Synchronization Protocol (FTSP)� Simulation and Conclusion

Page 37: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.2.4. Ratio-based time Synchronization Protocol (RSP)Synchronization Protocol (RSP)

Page 38: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Ratio-based time Synchronization Protocol (RSP)� The RSP use two synchronization messages to

synchronize the clock of the receiver with that of sender

� The RSP also can extend to multi-hop synchronization

� The nodes in the wireless sensor network construct a � The nodes in the wireless sensor network construct a tree structure and the root of this tree is the synchronization root

� The global time of the root is flooding out to the nodes through the tree structure

Page 39: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Ratio-based time Synchronization Protocol (RSP)The local clock time of a sensor device is provided by the quartz oscillator inside itself

transformation formula between t and Ci (t):

: the local clock time of a sensor node i.

t : the Coordinated Universal Time (UTC).

(1)

t : the Coordinated Universal Time (UTC).: the drift ratio.

: the offset of node i’s clock at time t .

By (1), the local clock times of two sensor nodes i and j have the following relationship:

(2)

: relative drift ratio: offset between the clocks of nodes i and j

Page 40: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Ratio-based time Synchronization Protocol (RSP)

Reference node

Sensor node

calculate the clock drift ratio

θ = (T3 − T1)/(T4 −T2).

Page 41: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

According to the ratio, each node can estimate the local time of reference

Reference node

Sensor node

Ratio-based time Synchronization Protocol (RSP)

According to the ratio, each node can estimate the local time of reference node in the following way.

: the local time of sensor node

:the corresponding local time of the reference node.

: the initial offset between reference node and sensor node.

(3)

Page 42: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

It can be calculated using linear interpolation with the four time-stamps

Ratio-based time Synchronization Protocol (RSP)

the can be derived as follows

(4)

Page 43: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Therefore, we can derive (5) from (3) and (4):

Ratio-based time Synchronization Protocol (RSP)

each sensor node can estimate the local time of reference node, that is, the global time of the network

(5)

Page 44: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference node

Sensor node

Ratio-based time Synchronization Protocol (RSP)

R S

(T1)(T3)

Page 45: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Ratio-based time Synchronization Protocol (RSP)� But the clock drift (θ) is unstable and changed with

time

� As using a large time interval , the relative drift ratio of two sensor nodes will become unreliableof two sensor nodes will become unreliable

� Therefore, the time-stamps of (5) are needed to be refreshed if the time interval is larger than a threshold α

Page 46: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Assume the synchronization message is sent by the reference node per 3 minutes, and α is set to 10 minutes

3 minutes

Ratio-based time Synchronization Protocol (RSP)

When time of t5 :

T9 – T1 = 12 > 10 mins

The reference point must be changed, but the new reference point mustSatisfy the condition of T9 – Tnew larger than a threshold β

Assume threshold β is set to 3 minutes

Page 47: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

3 minutes

T9 – Tnew ≥ 3 minutes

Ratio-based time Synchronization Protocol (RSP)

So, the new point is changed into time of t4 and do the sameoperations, and calculate 、 again.

: relative drift ratio.: offset between the clocks of nodes i and j

Page 48: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

multi-hop :

R node and A node are already synchronized above method.But B node and R node are not neighborhood, so:

(B node calculated clock drift and offset )

Ratio-based time Synchronization Protocol (RSP)

R A B

(Using local time of A node can estimate global time)

Msg.1Msg.2

(B node calculated clock drift and offset )

Page 49: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.3. Protocols Based on Receiver/Receiver SynchronizationReceiver/Receiver Synchronization

Page 50: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Protocols Based on Receiver/Receiver Synchronization

� In this class of schemes� The receivers of packets synchronize among each other, not

with the transmitter of the packet

� Reference Broadcast Synchronization (RBS)� Synchronize receivers within a single broadcast domain

� RBS does not modify the local clocks of nodes, but computes a table of conversion parameters for each peer in a broadcast domain

Page 51: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.3.1. Reference Broadcast Synchronization (RBS)(RBS)

Page 52: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

� Introduction� Reference broadcasts do not have an explicit timestamp

� Receivers use reference broadcast’s arrival time as a point of reference for comparing nodes’ clocks

� Receivers synchronizes with one another using the message’s timestamp (which is different from one receiver to another)timestamp (which is different from one receiver to another)

Page 53: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)� Types of errors in Traditional Synchronization

protocol� Send Time Latency

� time spent at the sender to construct the message

� Access Time Latency� time spent at the sender to wait for access to transmit the message� time spent at the sender to wait for access to transmit the message

� Prorogation Time Latency� time spent by the message in traveling from the sender to the receiver

� Receive Time Latency� time spent at the receiver to receive the message from the channel and

to notify the host

Page 54: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

� Types of errors in RBS� Phase error

� due to nodes’ clock that contains different times

� Clock skew� due to nodes’ clock that run at different rate� due to nodes’ clock that run at different rate

Page 55: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

� Difference between RBS & Traditional Synchronization protocol� RBS

� Synchronizes a set of receivers with one another

� Supports both single hop and multi hop networks

� Traditional � Senders synchronizes with receivers

� mostly supports only single hop networks

Page 56: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

� The phase offset with the clock skew is estimated by:� Least-squares linear regression graph

� From the best-fit line of the graph, following can be inferred:� Slope of the line : Clock skew of the nodes’ clock

� Intercept of the line : Phase of the nodes’ clock

Page 57: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

� Basic idea to estimate phase offset and clock skew for non-deterministic receivers:� Transmitter broadcasts m reference packets

� Each of the n receivers records the time that the reference was received, according to its local clock

The receivers exchange their observation� The receivers exchange their observation

� Each Receiver i can compute its phase offset to any other receiver j

Page 58: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)� Formula for calculating the phase offset and clock

skew of receiver r1 with other receiver r2:

Tr,b : r’s clock when it received broadcast b,

for each pulse k that was received by receivers r and r ,for each pulse k that was received by receivers r1 and r2 ,we plot a graph :

x = Tr1, k

y = Tr2,k – Tr1,k

� Diagonal line drawn through the points represents the best linear fit to the data

Page 59: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

� Diagonal line minimizes the residual error (RMS)

� Therefore, we go for calculating the slope and intercept of the diagonal line

� Time value of r1 is converted to time value of r2 by combining the slope and intercept data obtainedcombining the slope and intercept data obtained

Page 60: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

Step1: Transmitter broadcasts Step2: Receiver records its

local clock, and exchange observation

Step3:Use Least-squares linear regression to estimate

phase offsetReference

PacketReference

Packet Finish RBS

BA

Transmitter

Receiver

A:Local time

B:Local time

Page 61: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Reference Broadcast Synchronization (RBS)

� Conclusion� Advantages of RBS

� Can be used without external timescales� Does not require tight coupling between sender and its network

interface� Largest resources of latency (that exists in Traditional Time � Largest resources of latency (that exists in Traditional Time

Synchronization Protocol) is removed from critical path

� Limitations of RBS� Does not support point to point communication

Page 62: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.3.2 Hierarchy Referencing Time Synchronization (HRTS)Synchronization (HRTS)

Page 63: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

� Goal :� Synchronize the vast majority of a WSN in a lightweight

manner

� Idea � Idea � Combine the benefits of LTS and RBS

Page 64: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

� LTS : Lightweight Time Synchronization� Goal

� Synchronize the clocks of all sensor nodes of a subset of nodes to one reference clock

� It considers only phase shifts and does not try to correct different drift ratesdifferent drift rates

Page 65: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

� LTS : Pairwise Synchronization

n1

At time t1

n2

At time t2At time t3At time t4

n1

Sync packet

n2Record t2

Reply packet

Record t1Record t4 Record t3

In this packet contains t2 and t3

Page 66: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

Page 67: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

� LTS : Pairwise Synchronization� Offset : [Li(t8)+ Li(t1)- Li(t6)- Li(t5)] / 2

� Benefit : only two packet transmission with each pair

Page 68: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

� Benefit of RBS� Idea : ignore transmission delay

� By this idea, one packet can synchronize every node in one hop

Page 69: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

� Combining the two protocol’s benefit, the HRTS finds good solution to synchronize nodes in hierarchical way

Page 70: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

Page 71: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

� First step : R broadcast packet

� Second step : i reply packet ( For R and i, the two step is like LTS.)

� Third step : R calculate offset and broadcast packet

� Forth step : i and j calculate the offset ( For j, it’s like RBS.)

Page 72: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Hierarchy Referencing Time Synchronization (HRTS)

Page 73: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

6.4. Summary6.4. Summary

Page 74: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Summary� Time synchronization is important for both WSN

applications and protocols

� Using hardware like GPS receivers is typically not an option, so extra protocols are needed

� Post-facto synchronization allows for time � Post-facto synchronization allows for time synchronization on demand, otherwise clock drifts would require frequent resynchronization and thus a constant energy drain

Page 75: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Summary� Some of the presented protocols take significant

advantage of WSN peculiarity like:� small propagation delays� the ability to influence the node firmware to

timestamp outgoing packets late, incoming packets timestamp outgoing packets late, incoming packets early

Page 76: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

References[1] Ed. Ivan Stojmenovic, Handbook of Sensor Networks Algorithms and

Architectures, 2005.

[2] F. Sivrikaya,and B.Yener, Time Synchronization in Sensor Networks: A Survey,2004. (www.cs.rpi.edu/~yener/PAPERS/WINET/timesync04.pdf)

[2] J. Elson, L. Girod, and D. Estrin ,Fine-Grained Network Time Synchronization using Reference Broadcasts. (In Proceedings of the Fifth Symposium on OSDI 2002)Symposium on OSDI 2002)

[3] S. Ganeriwal, R. Kumar, and M. Srivastava, Timing-Sync Protocol for Sensor Networks. (SenSys ’03)

[5] D. L. Mills. Network Time Protocol (Version 3) Specification,

Implementation and Analysis. RFC 1305, 1992.

[6] D. L. Mills. Improved Algorithms for Synchronizing Computer Network Clocks. IEEE/ACM Transactions on Networking, 3(3): 245–254, 1995.

[7] D. L. Mills. Adaptive Hybrid Clock Discipline Algorithm for the Network Time Protocol. IEEE/ACM Transactions on Networking, 6(5): 505–514, 1998.

Page 77: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

References[8] S. Ganeriwal, R. Kumar, S. Adlakha, and M. Srivastava. Network-Wide

Time Synchronization in Sensor Networks. Technical Report NESL 01-01-2003, Networked and Embedded Systems Lab (NESL), University of California, Los Angeles (UCLA), 2003.

[9] S. Ganeriwal, R. Kumar, and M. B. Srivastava. Timing-Sync Protocol for Sensor Networks. In Proceedings of the 1st ACM International Conference on Embedded Networked Sensor Systems (SenSys), pages 138–149, Los Angeles, CA, November 2003.138–149, Los Angeles, CA, November 2003.

[10] Miklós Maróti , Branislav Kusy , Gyula Simon , Ákos Lédeczi, The Flooding Time Synchronization Protocol, In Proceedings of the 2ed ACM International Conference on Embedded Networked Sensor Systems (SenSys), pages 39 – 49, Baltimore, MD, USA, 2004 .

[11] J.-P. Sheu, W.-K. Hu, and J.-C. Lin, Ratio-Based Time Synchronization Protocol in Wireless Sensor Networks, Telecommunication Systems, Vol. 39, No. 1, pp. 25-35, Sep. 2008.

[12] J. Elson, L. Girod, and D. 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.

Page 78: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

References� [13] H. Dai and R. Han. TSync: A Lightweight Bidirectional Time

Synchronization Service for Wireless Sensor Networks. ACM SIGMOBILE

Mobile Computing and Communications Review, 8(1): 125–139, 2004.

Page 79: Chapter 6 Time synchronizationhscc.cs.nthu.edu.tw/~sheujp/lecture_note/10wsn/wsn06.pdf · Network Time Protocol (NTP) Cristian’s method (1989) for an asynchronous system A time

Recommend Reading� Particular Challenges and Constraints for Time

Synchronization Algorithms in WSN� J. Elson and K. R¨omer. Wireless Sensor Networks: A New

Regime for Time Synchronization. In Proceedings of the First Workshop on Hot Topics In Networks (HotNets-I), Princeton, NJ, October 2002.J. E. Elson. Time Synchronization in Wireless Sensor � J. E. Elson. Time Synchronization in Wireless Sensor Networks. PhD dissertation, University of California, Los Angeles, CA, Department of Computer Science, 2003.

� Other Time Synchronization Protocol� Lightweight time synchronization protocol (LTS)

� J. V. Greunen and J. Rabaey. Lightweight Time Synchronization for Sensor Networks. In Proceedings of the 2nd ACM International Workshop on Wireless Sensor Networks and Applications (WSNA), San Diego, CA, September 2003.