# CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.

## Presentation on theme: "CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch."— Presentation transcript:

CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch

Discrete Algs for Mobile Wireless Sys2 Lecture 6  Topics: Time Synchronization  Sources: Elson et al. paper Karp et al. paper MIT 6.885 Fall 2008 slides

Discrete Algs for Mobile Wireless Sys3 Clock Synchronization  Nodes have individual clocks  Synchronizing the time on the various clocks is essential for many applications Coordination of wake-up and sleeping times (energy efficiency) TDMA schedules Ordering of collected sensor data/events Co-operation of multiple sensor nodes (e.g. object tracking) Estimation of position information

Discrete Algs for Mobile Wireless Sys4 The Clock Synchronization Problem  Every node has a local (hardware) clock  Logical clock is some function of the hardware clock add some computed value to hardware clock  Goal: Compute local logical clocks to Compensate for offset or skew between clocks: values are not the same Compensate for drift between clocks: rates are not the same

Discrete Algs for Mobile Wireless Sys5 Clock Synchronization Algorithm  Distributed algorithm that computes logical local clock for every node  Logical clocks should be as close together as possible  Logical clocks should also run at approximately the same rate as the hardware clocks Don't keep them always synchronized to time 0

Discrete Algs for Mobile Wireless Sys6 External vs. Internal Synchronization  External synchronization: Nodes synchronize with an external clock source Ex: GPS  Internal synchronization: Nodes synchronize to a common time within themselves to a leader, to an averaged time, or to anything else

Discrete Algs for Mobile Wireless Sys7 Other Types of Clock Synchronization  One-shot versus periodic synchronization Periodic synchronization required to compensate for clock drift  A-priori versus a-posteriori A-posteriori clock synchronization triggered by an event  Local versus global synchronization

Discrete Algs for Mobile Wireless Sys8 Clock Sources  Radio Clock Signal: Clock signal from a reference source (atomic clock) is transmitted over a longwave radio signal WWVB station in Colorado transmits at 60 kHz, can be received all over US Accuracy limited by the distance to the sender Special antenna/receiver hardware required

Discrete Algs for Mobile Wireless Sys9 Clock Sources  Global Positioning System (GPS): Satellites continuously transmit own position and time code Line of sight between satellite and receiver required Special antenna/receiver hardware required Accuracy: a few 100 ns

Discrete Algs for Mobile Wireless Sys10 Clock Devices in Sensor Nodes  Structure External oscillator with a nominal frequency (e.g. 32 kHz) Counter register which is incremented with oscillator pulses Works also when CPU is in sleep state Oscillator

Discrete Algs for Mobile Wireless Sys11 Clock Devices in Sensor Nodes  Accuracy Clock drift: random deviation from the nominal rate dependent on power supply, temperature, etc. E.g. TinyNodes have a maximum drift of 30-50 ppm at room temp. temperature This is a drift of up to 50 μs per second or 0.18s per hour

Discrete Algs for Mobile Wireless Sys12 GPS?  What if all nodes had a GPS receiver? High accuracy Nodes would even get position information for free…  Problems: GPS needs unobstructed access to satellite (e.g., GPS does not work indoors) Too complex hardware, too expensive for small, simple wireless (sensor) devices

Discrete Algs for Mobile Wireless Sys13 Time Synchronization in the Internet with NTP Several levels of time servers Servers on same level coordinate among themselves and with servers on adjacent levels Round-trip time used to get estimate on latency Heuristic method to best compute time estimate based on different estimates Jitter buffer to account for variance in message delays Clients connect to NTP server(s) Accuracy at clients highly dependent on symmetry of message delay between client and server (typical: 1 – 30 ms) Figure: Wikipedia

Discrete Algs for Mobile Wireless Sys14 Su, Akyildiz Time-Diffusion  Practical paper, does not give theoretical guarantees  Uses similar ideas as NTP but adapted to wireless scenario: Multi-hop network (topology cannot be “chosen”) Dynamic, possibly mobile network Nodes might fail often Energy constraints (e.g., need load balancing) Should be a more symmetric protocol

Discrete Algs for Mobile Wireless Sys15 Su, Akyildiz Time-Diffusion  Two cases: With / without outside sources of time.  With: Outside sources tell the time to some special “master” nodes, who diffuse it through the network.  Without: Master nodes broadcast their timing info to their neighbors, who continue the time diffusion.

Discrete Algs for Mobile Wireless Sys16 Su, Akyildiz Time-Diffusion  Load Balancing / Fault Tolerance: Master nodes are elected by random decisions Frequent reelection of master nodes  Time information is propagated in an “ad-hoc” way through the network  Nodes adjacent to master/leader nodes may be chosen as leader nodes to further diffuse the info  Use statistical heuristics to compute time estimates based on info of neighbors (cf. NTP)  Also uses jitter buffers to compensate for varying msg. delays

Discrete Algs for Mobile Wireless Sys17 Sender/Receiver Synchronization  Roundtrip-Based Synchronization  Message delays: d 1, d 2 unknown to A and B  Clock offset (B – A): t 2 – (t 1 + d 1 ) = t 3 – (t 4 – d 2 )  Average the two expressions and rearrange terms to get (t 2 – t 1 + t 3 – t 4 )/2 + (d 2 – d 1 )/2  Approximating it with (t 2 – t 1 + t 3 – t 4 )/2 gives an estimate of B – A whose error is half the difference in the delays d1d1 d2d2

Discrete Algs for Mobile Wireless Sys18 Influences on Packet Latency –Sending Time S (up to 100ms) –Medium Access Time A(up to 500ms) –Transmission Time T(tens of ms, depending on size) –Propagation Time P A,B (  s, depending on distance) –Reception Time R(up to 100ms) Asymmetric packet delays due to non-determinism Solution: timestamp packets at MAC layer S A T R P A,B Critical path Timestamp T A Timestamp T B

Discrete Algs for Mobile Wireless Sys19 Reference Broadcast Synchronization (RBS) [Elson,Girod,Estrin]  Observation: sender side delay > receiver side delay  Also much higher variability on sender side (needs to wait for free channel)  Exploit local broadcast nature of wireless communication  Each signal simultaneously received by many nodes  Synchronize between receivers of the same message (instead of between sender and receiver)  Large part of delay is the same for all receivers

Discrete Algs for Mobile Wireless Sys20 Reference Broadcast Synchronization A sender synchronizes a set of receivers with one another Point of reference: beacon’s arrival time Only sensitive to the difference in propagation and reception time Time stamping at the interrupt time when a beacon is received After a beacon is sent, all receivers exchange their reception times to calculate their clock offset A BS

Discrete Algs for Mobile Wireless Sys21 RBS Extensions  Idea can be used to synchronize over many hops  Synchronization can be improved by doing several broadcasts.  Clock Drift: Paper assumes that each local clock runs at a fixed rate (rates of different clocks can be different)  Uses least-squares linear regression to cope with clock drift  Experiments of Elson et al. indicate that the variation in receive time roughly follows a Gaussian distribution

Discrete Algs for Mobile Wireless Sys22 RBS: Discussion  RBS gives method to synchronize between two receivers of the same message  Synchronization by nodes without common neighbor done by considering path of receiver-pairs  Skew proportional to length of path  Method does not give globally consistent estimates of pair- wise clock offsets L j (t)  L i (t)*a i,j + b i,j and L k (t)  L j (t)*a j,k + b j,k and L k (t)  L i (t)*a i,k + b i,k but a i,j *a j,k ≠ a i,k and b i,j *a j,k + b j,k ≠ b i,k  Pairwise synchronizations are not optimally precise (do not have minimal variance from the truth)

Discrete Algs for Mobile Wireless Sys23 Global Synchronization of Sensornets [Karp, Elson,Papadimitriou,Shenker]  Tries to exploit full potential of reference broadcasts, ensure globally consistent pairwise translations and optimal precision  Model: No clock drift (only clock offsets) Given: set of receiver-broadcast pairs (r i, s k ) (r i : receiver node, s k : signal) Offset of clock of node r i : T i (offset w.r.t. universal time) Signal s k sent at real time U k, received by r i at clock time y i,k = U k + T i + e i,k The e i,k are independent random variables with zero mean and variance V i,k  Goal: Find best globally consistent estimate of offsets T i

Discrete Algs for Mobile Wireless Sys24 Two Problems  To find the optimal (minimum-variance) pairwise synchronization between nodes i and j, find the minimum-variance estimate of T j – T i. Can be posed as a flow problem  To produce a globally consistent synchronization, esimate all the T i 's independently and find a maximum likelihood joint choice of all the T i 's. Can be reduced to a linear system of least-squares equations  These two problems have the same solution!

Discrete Algs for Mobile Wireless Sys25 Minimum Variance Pairwise Synchronization  Goal: Estimate T 1 – T 2. Use differences in receive times of signals  Consider signal s k received by r 1 and r 2. Estimate T 1 – T 2 with y 1,k – y 2,k = (T 1 – T 2 ) + (e 1,k – e 2,k ) r1r1 r2r2 sksk

Discrete Algs for Mobile Wireless Sys26 Minimum Variance Pairwise Synchronization  Consider signal s k1 received by r 1 and r i, and signal s k2 received by r i and r 2. Since T 1 – T 2 = (T 1 – T i ) + (T i – T 2 ), estimate T 1 – T 2 with y 1,k1 – y i,k1 + y i,k2 – y 2,k2 = (T 1 – T 2 ) + (e 1,k1 – e 2,k1 ) + (e i,k2 – e 2,k2 ) r1r1 riri s k1 r2r2 s k2

Discrete Algs for Mobile Wireless Sys27 Minimum Variance Pairwise Synchronization  Similarly, if you have an arbitrary length chain of alternating receivers and signals, the error is the expression given at top of p. 5 of paper.  Since each e i,k has zero mean, this estimator is unbiased.  By considering all possible paths between a pair of receivers, and weighting them appropriately, we get an estimator with much lower variance than any single path can provide.  This approach is pursued using flow theory on a corresponding resistor network  Show that the minimum variance estimators for pairs are globally consistent.

Discrete Algs for Mobile Wireless Sys28 Maximum Likelihood Offset Assignment  Find the maximally likely set of offset assignments T i Will be globally consistent, but why should they be minimum variance?  Assume y i,k 's (local clock time when r i receives signal s k ) are independent Gaussian random variables with mean U k + T i and variance V i,k  Show the joint probability density of the y i,k 's is an expression involving the U k 's and T i 's  Derive a system of linear equations for the T i 's that maximize this joint probability density  Show that a solution to the linear system is obtained when T i is set equal to the value from the resistor network formulation

Discrete Algs for Mobile Wireless Sys29 Computing the Estimators  Set up and solve system of linear equations for quantities in the resistive network corresponding to the minimum variance estimators OR  Use a new approximation algorithm based on minimum-cost flow presented in the paper

Discrete Algs for Mobile Wireless Sys30 Use in Practice?  Estimator for two nodes at distance L in infinite grid has variance O(log L), exponential improvement over RBS, which uses only one path and thus has variance O(L)  An efficient PTAS for computing the effective resistance is given by the paper.  Not clear whether this can be made distributed  Cost seems to be rather high

Download ppt "CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch."

Similar presentations