Title: Chapter 11: Time Synchronization
1Chapter 11Time Synchronization
2Time Synchronization
What is time synchronization in sensor networks?
HHMMSS
120110
120110
120110
Objective Allow all sensor nodes to maintain the
same time frame
3Time Synchronization
- Temporal relations play an important role in
sensor fusion ? Which event happened first? - Physical time is itself part of information
- Estimation of target position Direction, Speed
- Providing fire breaking time
- Due to the clock drift, the local clock needs to
be periodically synchronized to maintain an
accurate global time
4Time Synchronization Challenges
- Why is it so difficult to synchronize the sensor
nodes? - Low-end clock crystals are used
- Clock drifting may be significant and clock
jitters may occur often - Communication links are noisy
- Some sensor nodes may become unsynchronized
- Node failures occur often
- Cannot depend on a single sensor node to be the
master clock
5Factors Influencing Time Synchronization
- Temperature
- Temperature variations during day may cause the
clock speed up or down (a few ?sec/day). - Phase Noise
- Access fluctuation at the hardware interface,
response variation of the operating system to
interrupts, jitter in delay, etc. - Frequency Noise
- The frequency spectrum of a crystal has large
sidebands on adjacent frequencies.
6Factors Influencing Time Synchronization
- Asymmetric Delay
- The delay of a path may be different for each
direction - Clock Glitches
- Hardware or software anomalies may cause sudden
jumps in time
7Sources of Time Synchronization Error
- Sending Time (Time spent at the sender to
construct the message) - Kernel protocol processing
- Variable delays caused by OS
- Transfer within the host to NIC
- Access Time (Delay caused to wait for access to
the channel) - Specific to MAC protocol
8Sources of Time Synchronization Error
- Propagation Time
- Can be neglected for air
- Important for underground, underwater
- Receiving Time
- Processing required for the antenna to receive
the message from the channel and notify the
processor of its arrival (A/D conversion) - Common Denominator non-deterministic!!!!
9Further Difficulties
- Periodic message exchange is not guaranteed to
occur among nodes - Transmission delay between two nodes is hard to
estimate
10TERMINOLOGY
- FREQUENCY
- The rate at which a clock progresses.
- CLOCK OFFSET
- Difference between the time reported by a clock
and the real time. - SKEW OF A CLOCK
- Difference in the frequencies of the clock and
the perfect clock. - DRIFT (RATE) of a CLOCK
- Second derivative of the clock value with respect
to time.
11Traditional Synchronization
Problem for SYNCH Many sources of unknown,
nondeterministic delays (send time, access time,
propagation time and receive time) between sender
and receiver
Sender
Receiver
Send Time
Receive Time
At t1
Radio
Radio
Access Time
Physical Media
Propagation Time
12Reference Broadcast Synchronization (RBS)J.
Elson, et. al., Fine-Grained Network Time
Synchronization using Reference Broadcasts,
Proc. of the Fifth Symp. on Operating Systems
Design and Implementation (OSDI 2002), Boston,
December 2002.
Does not try to sync Sender Receiver Tries to
sync receivers
Sender
Receiver
Receiver
Receive Time
Radio
Radio
Radio
I saw it at t4
I saw it at t5
Physical Media
Propagation Time
13TRADITIONAL SYNCH vs RBS
Radio
Radio
Sender
Sender
Receiver
Receiver 1
Receiver 2
Time
Critical Path
Critical Path
Traditional Critical Path From the time the
sender reads its clock, to when the receiver
reads its clock Nondeterministic delay Send
time and Access time. Receiver time small.
RBS Only sensitive to the differences in receive
time and propagation delay Critical path length
is shortened to include only the time from the
injection of the packet into the channel to the
last clock read. (Send time and Access time
are eliminated!)
14Reference-Broadcast Synchronization (RBS)
- Algorithm to Estimate the Phase Offset between
the Clocks of Two Receivers - A transmitter broadcasts a reference packet to
two (or more) receivers - Each receiver records the time at which the
packet was received according to its local clock
15Reference-Broadcast Synchronization (RBS)
- 3. The receivers exchange the observed times at
- which they received the packet.
- 4. The clock offset between two receivers is
- computed as the difference of the local times
at - which the receivers received the same message.
16Observations about RBS
- RBS removes SEND and ACCESS TIME errors
- Broadcast packet is used as a relative time
reference
17Observations about RBS
- Each receiver synchronizing to a reference packet
- Ref. packet is injected into the channel at the
same instant for all receivers - Broadcast packet does not contain timestamp
- Almost any broadcast packet can be used, e.g ARP,
RTS/CTS, route discovery packets, etc
18Phase Offset Estimation
- RBS can produce highly accurate results if
- Message reception by each receiver is high
- Each receiver can record its local clock reading
as soon as the message is received.
19Phase Offset Estimation
- Messages can be corrupted.
- Receiving node may not be able to record the time
of the message arrival promptly (maybe busy with
other computations) - Solution Use a sequence of reference messages
from the same sender rather than a single message
20Phase Offset Estimation
- Receiver i will compute its offset relative to
any other receiver j as the average of clock
differences for each packet received by nodes i
and j - Result For all i,j ? n
- m
- Offseti,j 1/m ? (Tj,k - Ti,k)
- k1
n Number of receivers m Number of reference
broadcasts Ti,k Node is clock when it received
the broadcast k
21RBS Phase Offset Estimation Performance
Evaluation
- In each trial, n nodes were given random clock
offsets, m message transmission times were
selected at random. - Each synchronization message was delivered to
every receiver and time-stamped using the
receivers clock.
22RBS Phase Offset Estimation Performance
Evaluation
- Since every receiver computes its offset with
every other receiver, O(n2) offsets were computed
and then compared with the real/actual offsets. - The maximum difference between computed and
actual offsets was considered to be the Group
Dispersion.
23RBS Phase Offset Estimation Numerical Analysis
Results
- 2-receiver case
- 30 ref broadcasts improve precision from 11 ?sec
to 1.6 ?sec - 20-receiver case
- Dispersion reduced down to 5.6 ?sec
24RBS - Multi-hop Communication
Features
- Use nodes that receive two or more reference
- broadcasts from different transmitters as
- translation nodes
Receivers
Transmitter
Translation Nodes
25RBS - Multi-hop Communication
- Multiple hops could introduce a high degree of
variability in message transmission time between
multiple receivers of the same message ? RBS
would lose its accuracy - To avoid loss of precision
- Two nodes located in different neighborhoods are
synchronized using a third node lying in the
intersection of the two neighborhoods
26Time Routing
- Compute a time route -gt dynamically determine a
series of nodes through which time can be
converted to reach a desired final time-base - The physical topology can be easily converted to
a logical topology links represent possible
clock conversions
27Time Routing
1
2
5
1
2
5
A
B
6
6
3
4
7
3
4
7
C
8
9
8
9
D
10
11
10
11
Use shortest path search to find a time
route Edges can be weighted by error estimates
28TIME ROUTING
- The nodes A,B,C,D send synchronization packets.
- Other nodes are receivers.
- The transmission radii are shown by circles
29TIME ROUTING
- Logical Topology e.g., E1(R1)-gtE1(R4)-gtE1(R8)-gtE1
(R10) - Edges are drawn between nodes that have received
a common broadcast and therefore have enough
information to relate their clocks to each other. - Receivers 8 and 9 share two logical links because
they have two receptions in common from C and D.
30ADVANTAGES OF THE RBS SCHEME
- Largest sources of error (send and access times)
are removed from the critical path by decoupling
the sender from the receivers. - Clock offset and skew are estimated independently
of each other - In addition, clock correction does not interfere
with either estimation because local clocks are
never modified
31ADVANTAGES OF THE RBS SCHEME
- Post-facto synchronization prevents energy from
being wasted on expensive clock updates - Multi-hop support is provided by using nodes
belonging to multiple neighborhoods (i.e.,
broadcasting domains) as gateways
32DISADVANTAGES of the RBS SCHEME
- For a single-hop network of n nodes, it requires
O(n2) message exchanges (computationally
expensive for dense networks) - Convergence time can be high due to large number
of message exchanges.
33DISADVANTAGES of the RBS SCHEME
- Reference sender is left unsynchronized in this
method. - If reference sender needs to be synchronized, it
will lead to a significant waste of energy
34DISADVANTAGES of the RBS SCHEME
- Limited to only one broadcast domain
- Translation errors and forwarding delays make
RBS impractical and time difference may occur - Different time-of-occurrences may occur at
different sinks
35Timing-Sync Protocol for Sensor Networks (TPSN)
S. Ganeriwal, et.al., Timing-Sync Protocol for
Sensor Networks, ACM SenSys, November 2003.
Features
- Have many root nodes
- Organize into multiple level hierarchy
- Synchronize level-by-level
Root Nodes
A
B synchronizes to A C synchronizes to B
B
C
36TPSN Basic Concept
- First create a hierarchical topology in the level
discovery phase - As a result, each node is assigned a unique
level 0 (root node)?1?2??N
37TPSN Basic Concept
- A time synchronization phase is initialized by
the root node - Each node synchs to the node which is one level
lower than itself
38TPSN Algorithms
- Level Discovery
- Time Synchronization
- New Node Level Request
- Root Node Dies Local Leader Election
39TPSN Level Discovery
- Root node assigned level 0
- Root node initiates the phase by broadcasting a
level-discovery packet - Upon receiving the packet, each node assigns
itself a 1 level and broadcasts its own new
level-discovery packet
40TPSN Level Discovery
- Eventually each node in the network is assigned a
unique level - Once a nodes level has been decided, it ignores
- all such packets in the future.
41TPSN Time Synchronization
- Root node starts this phase by broadcasting a
time_synch packet - Nodes in level one wait for some random time and
start a two way message exchange to synch their
local clocks - This is carried out throughout the whole network
42TPSN Time Synchronization
T2
T3
- 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
- T2 T1 D d
- D clock drift between the two nodes
- d propagation delay
-
Node B
Node A
T1
T4
- At time T3, B sends back an acknowledgement
packet to - A with values of T1, T2, T3 and level of B.
43TPSN Time Synchronization
A can calculate the phase (clock) offset D (clock
drift) and delay d as
(T2-T1) (T4-T3)
(T2-T1) - (T4-T3)
d
D
2
2
Node A corrects its clock to synchronize with
node B, based on the computed offset.
44TPSN
- When a new node joins a network or when it does
not get a level discovery packet - The node waits for some time to be assigned a
level (listens for a level discovery packet). - If it is not assigned a level within that period,
it times out and broadcasts a level-request
packet. - The neighbors reply to this request by sending
their own level and the new node defines its
level to be one greater than the level it
received.
45TPSN When a node i loses all itsneighbors with
level i1
- Protocol is vulnerable to node failures
- When this happens, it is possible for a node at
level i not to have a neighbor (i.e., a
synchronization server) at level i-1 - In such cases, the node at level i would not
receive an ACK to its synchronization message.
46TPSN
- Node retransmits a message for a fixed number of
times before assuming that it has lost all its
neighbors - If the node does not receive any responses to its
synchronization messages, it broadcasts a
level-request packet with a new level
47TPSN
- Maximum number of retransmissions of a
synchronization message is subject to two
constraints. - If too large, it will increase the time taken for
synchronization (i.e., the convergence time) - If too small, a node may erroneously conclude
that its server has died - Unnecessary message flooding in the network
(optimal number of retransmissions is four!)
48TPSN When the root node dies
- Level 1 nodes will time-out 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
until all nodes get reassigned their new level.
49TPSN vs RBS
TPSN RBS
Average error (µs) 16.9 29.13
Worst case error (µs) 44 93
Best case error (µs) 0 0
Percentage of time error is less than or equal to average error 64 53
50ADVANTAGES TPSN
- Scalable
- Synchronization accuracy does not degrade
significantly as the size of the network is
increased - Network-wide synchronization is effectively
achieved - Computationally less expensive
51 DRAWBACKSTPSN
- Energy conservation is not very effective
- Requires a physical clock correction to be
performed on local clocks of sensors while
achieving synchronization - Requires a hierarchical infrastructure
- Unsuitable for applications with highly mobile
nodes - Support for multi-hop communication is not
provided
52DRAWBACKS TPSN
- Forms islands of time
- Whole network does not have the same time frame
- Nodes become unsynchronized when mobile
- All nodes are predefined in a hierarchy.
- No end-to-end common time frame
- Assumed the end users will be able to interpret
the time gathered from the network - Requires a pre-defined reliable hierarchy of
nodes.
53Time-Diffusion Synchronization Protocol W. Su
and I.F. Akyildiz, Time-Diffusion
Synchronization Protocol for Sensor Networks,
IEEE/ACM Transactions on Networking, April 2005
- Principle problem with other protocols
- Rely on particular nodes to be time servers or
masters - Need for a robust solution that
- automatically self-configures
- sensitive to energy requirements
54Time-Diffusion Synchronization Protocol
- CASE 1
- Precise time servers (sinks act) are present
- Sinks broadcast a reference time to all master
nodes which are randomly elected to synchronize
their neighbors - Master nodes in turn use the received reference
time to synchronize their neighbor nodes. - Goal Equilibrium time that the sensor network
reaches is the reference time broadcast by the
sinks
55Time-Diffusion Synchronization Protocol
- CASE 2
- No precise time servers are present
- Sinks cannot be used as time servers
- Line-of-sight or connection to all master nodes
from sinks may not be possible - The sensor network should still synchronize on a
consistent time.
56Time-Diffusion Synchronization Protocol
Translates the TDP time to the time used by the
users.
Focus on TDP
57Time-Diffusion Synchronization Protocol
- All sensors have a local time that is within a
small bounded time deviation from the
network-wide equilibrium time. - Protocol operates in alternating active and
inactive phases. - Within each active phase there are multiple
cycles (iterations), each cycle lasting a
duration t.
58TDP SCHEDULING
- Protocol operates in alternating active and
inactive phases - Active period depends on the convergence time
- Inactive period depends on the tolerance range
due to local clock drifting - Performs several iterations (cycles t) frequently
re-electing master nodes in active periods. - Does nothing in inactive period.
59Time-Diffusion Synchronization Protocol
- Every iteration is made of several subparts
- Election/Re-election of Leaders
- False Ticker Isolation
- Load Distribution
- Peer Evaluation
- Time Diffusion
- Time Adjustment
60Flow Chart of TDP
61Entire Protocol Operation During One Cycle
- Peer evaluation procedure (PEP) in each cycle is
performed - To determine the master node eligibility for the
next cycle - Diffused leader responsibility for the remainder
of the current cycle
62Entire Protocol Operation During One Cycle
- Step 1 A master (level 1) and its neighbors
- Master sends a large number timestamped scan
messages to its neighbors - Neighbors send back ACKs containing the 2-sample
Allen variance of the local clock from the
masters clock
63Entire Protocol Operation During One Cycle
- Based on the received samples, master calculates
- i) an outlier ratio gyz for itself y and each
neighbor z. - ii) average of Allen variances
- iii) average of Allen deviations.
- All of these are sent to each neighbor z in a
RESULT message. - STEP j (j2,3,,n)
- Repeat the above between each level j diffused
leader node and its neighbors
64Entire Protocol Operation During One Cycle
- RESULT All sensors will get their outlier ratios
and average Allen deviation which are used to
evaluate the quality of their clocks with respect
to their neighbors. - If outlier ratio is gt 1, its local clock deviates
from the clocks of its neighbors by more than
twice the Allen variance - Node does not become a diffused leader during the
Time Diffusion Procedure of the current cycle or
a master in the next cycle.
65Entire Protocol Operation During One Cycle
- Nodes eligible for becoming masters in the next
cycle, will be decided based on their energy
availability (threshold) - Same with diffused leaders in the current cycle
depends on their energy level
66Entire Protocol Operation During One Cycle
- STEP 3
- TDP performs the main function of diffusing the
time from each master in a tree-like manner for n
hops where n is some pre-determined parameter
67Entire Protocol Operation During One Cycle
- Message M (tM,I,n,bM,k)
- tM,I is the diffused time of the master M to
which the nodes synchronize in round I - n is the number of levels (i.e., depth) to which
the timing information is to be diffused. - bM,k is the deviation of the corresponding tM,I
at a node k hops from the master M (used by time
adjustment algorithm (TAA) the weight for the
diffused time tM,I at level k.)
68Entire Protocol Operation During One Cycle
- Do broadcast for each round i
- 1. Master (level 1) and its neighbors
- i) Send a timing message M (tM,I,n,bM,k) to
neighboring nodes - ii) Elected diffused leaders at the next level
respond with a time-stamped ACK message
69Entire Protocol Operation During One Cycle
- iii) Master computes D average (Dj) where Dj is
the round trip time between master and diffused
leader j. - Diffused time from master node
- tM,i tM,i D/2 d
- d is the amount of time that the nodes wait
(relative to tM,i) before adjusting their clocks
at the end of the round.
70Entire Protocol Operation During One Cycle
- Standard deviation a of the rtt Dj gives an
estimate of the quality of diffused time tM,i,
and is accumulated in bM,k at each hop from the
master. - The accumulated deviation is
- bM,k bM,k-1 a
- where kltn is the number of hops from the master
71Entire Protocol Operation During One Cycle
- b) On receiving a timing message M (tM,I,n,bM,k)
for j2,3,..,n - Repeat the above between the elected diffused
leaders at level j and their neighbors. - In each round, each node builds a TABLE with
rows - ltmaster_ID M, bM,k, tM,igt
- and populates it with the information received
within that round.
72Entire Protocol Operation During One Cycle
- After each round i within a cycle, each node
resets its time to ti, the weighted sum of the
times tM,i in its table, - ti is based on the values of all the messages
received in this round from different master
initiators - ti is recorded in the local TABLE
- The table is cleared at the end of each round i
73Entire Protocol Operation During One Cycle
?
ti
( ßM,k , tM,i ) in Table
? ßM,k ßM,k
ßM,k in Table
tM,i
? ßM,k ßM,k
?
( ßM,k , tM,i ) in Table
ßM,k in Table
74Entire Protocol Operation During One Cycle
- For any tM,I
- i) The numerator of the weight is the sum of all
the deviations of all the diffusion messages,
less the deviation for this particular message - ii) The denominator of the weight is the sum of
all such numerators for all the timing entries in
the table.
75Entire Protocol Operation During One Cycle
- Thus, the value of each clock is set to the
weighted average of the clock values of the
different master nodes of that round - After averaging the data collected from multiple
messages received within that round. - Due to the weighted averaging all the nodes tend
towards a common equilibrium time
76ADVANTAGESTime-Diffusion Synchronization
Protocol
- The protocol achieves a system-wide equilibrium
time across all nodes, - Computed using an iterative weighted averaging
technique - Involves all the nodes in the synchronization
process
77ADVANTAGESTime-Diffusion Synchronization
Protocol
- Although there is a hierarchical structure, that
is neutralized by having multiple master nodes
distributed across the network - Designed to be robust to node failures
78ADVANTAGESTime-Diffusion Synchronization
Protocol
- Network-wide time converges for both static and
mobile environment - Small variation in network-wide time
- Small energy variation throughout the network
- Better performance than TPSN
79DRAWBACKSTime-Diffusion Synchronization Protocol
- High complexity
- Each active period has multiple cycles, and each
cycle has multiple rounds, in each of which a
diffusion broadcast is initiated by multiple
masters
80DRAWBACKSTime-Diffusion Synchronization Protocol
- The convergence time tends to be high when no
external precise time servers are used - However, if the servers are used, the convergence
time is comparable to a server-based technique