Date post: | 12-Jan-2016 |

Category: | ## Documents |

View: | 71 times |

Download: | 2 times |

Share this document with a friend

Description:

Clock Synchronisation for RTS. Importance of RTS Clocks. RealTime implies need for accurate timekeeping Examples Hard RTS Distributed Control Systems Power System / Fly-by-wire Soft/Firm RTS TDM within GSM/POTS POTS : SONET/SDH Synchronous Opt. Network /Synch. Digital Hierarchy - PowerPoint PPT Presentation

Transcript:

Clock Synchronisation for RTS

Dr. Hugh Melvin, Dept. of IT, NUI,G

Importance of RTS ClocksRealTime implies need for accurate timekeepingExamplesHard RTSDistributed Control SystemsPower System / Fly-by-wireSoft/Firm RTSTDM within GSM/POTSPOTS : SONET/SDHSynchronous Opt. Network /Synch. Digital HierarchyMM applications

Dr. Hugh Melvin, Dept. of IT, NUI,G

Power System ControlAS stationToken Bus Synchronisation via Master ClockCritical for chronological data logging / fault diagnosisTimeslicing for token managementSynchronising 2v3 voter systemsNeed to deliver verdicts simultaneouslyFault DiagnosisImpossible without Chronological DataGenerator Earth Fault / Overcurrent .. Which came first .. msec level data required Power Line Fault MonitoringNoise burst travels in both directions .. usec level synch

Dr. Hugh Melvin, Dept. of IT, NUI,G

Token Bus : Master Clock126N-BKBus 0123N-UHRM-Clock121N16OS254112N8AS220E111N8AS220E110N8AS220E109N8AS220E160NS5NATPG750133N8AS EHF132N8AS EHF131N8AS EHF128N8AS231125N16R30141NAT-24SynogateU/IAMasterClock

Dr. Hugh Melvin, Dept. of IT, NUI,G

Soft-Firm RTSPOTS operation based on TDMPCME1E2..E4 SDH/SONETPrecise synchronisation reqd throughout the network for correct system operationGSM : FDM + TDMEach FDM channel divided out to 8 users via TDM Multimedia ApplicationsDelay / Jitter Measurement increasingly imp in packet (IP) networksMore advanced QoS through synchronised timeRecall G.1010Basis of SLA measurement importantSkew Issues between various system/media clocks

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

Audio-System Clock Skew

Dr. Hugh Melvin, Dept. of IT, NUI,G

Computer ClocksMost commonly consist of quartz crystal and a counterCrystal oscillates at defined rate (Hz) which generates a consistent tick and increments a software counter Counter value translated to time standardUTC (Univ. Coord. Time) .. Based on GMTPrimary Source: Atomic Clocks TAI (International Atomic Time)But requires leap seconds every few years!UTC = TAI + Leap_SecondsCrystal Quality described by Accuracy & Stability

Dr. Hugh Melvin, Dept. of IT, NUI,G

Computer ClocksAccuracy relates to how close the crystal freq is to rated valueDetermined by manufacturing processGet what you pay for!Stability relates to how frequency varies Influenced by parameters such as:Temperature .. Eg. 2ppm /CAgeingEg. Cesium Beam: 3 x 10-12 / yearNoise

Dr. Hugh Melvin, Dept. of IT, NUI,G

Computer ClocksImproved Quality Timekeeping ?Option A: Stick with crystalsPrecision manufacturing costlyTemperature Compensated Crystal Osc.(TCXO)Oven Controlled Crystal Osc.(OCXO)Option B: Buy an Atomic Clock .. or GPS Receiver (based on atomic clock) Most popular approach to providing accurate/stable timeOption C : Cheaper ApproachSoftware based approach to discipline cheap crystal clocks

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clock TerminologyConfusion with terms in literaturePaxson/Mills terminology used hereOffsetDifference between time reported by clock C, C(t) and true clock (UTC) at true time t.Also relative offset between clocks C1and C2 C1(t) - C2(t) SkewDifference in frequency between clock C and a true clock (UTC) , C(t)Defined in ppm (usec per sec)+/-12 ppm approx = +/- 1 sec/dayAlso relative skew between clocks C1and C2 C1(t) - C2(t)

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clock TerminologySkew A large skew rate rapidly increasing offset frequent resynchronisationIf specify max abs skew rate for clock C of

Clock should operate within cone of acceptabilityDriftRate of change of frequency C(t)Eg. Ageing influence or change in temperatureNot usually that significant except over long timescalesNote linear relationship in previous slide

Dr. Hugh Melvin, Dept. of IT, NUI,G

Cone of AcceptabilityReal TimeClock TimeSlope = 1 = True ClockSlope = 1 - Slope = 1 +

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clock SynchronisationPerfect clocks do not exist Eg. PC System Clock NTP Server GPS Receiver GPS Atomic Clock GPS Master Atomic Clock ??Examine two separate scenariosLocalised Cluster of ClocksEg. Power System Control / Fly-by-wire SystemsAlso widely distributed clocks over deterministic network Propagation time known (can be compensated for)Eg. POTSWidely distributed clocks over non-deterministic networkMore difficult scenarioEg. Internet Synchronisation

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clock SynchronisationSome General PrinciplesFault Tolerance criticalIdentify and isolate faulty clocksNote: A faulty clock is one that does not operate within cone of acceptabilityCf Clock Quality: May be stable but inaccurateAvoid setting clocks backwardEvent processing nightmareOS problems eg. Timers / timeslicing Avoid large step changesAmortize the required change (+/-) over a series of short intervals (eg. over multiple ticks)

Dr. Hugh Melvin, Dept. of IT, NUI,G

Localised Cluster of ClocksHardware-based Phase Locked Loops (PLL)Oscillator output is aligned to the input signal.Input signal can come from a Master Clock Combination of outputs from all other clocksInput signal used to drive its PLLCan also compensate for Propagation Delay variationsExpensive but precise approachSimilar approach used in widely distributed scenarioGPS / POTS / GSM all use variants of this approach

Dr. Hugh Melvin, Dept. of IT, NUI,G

PLLVCOComparatorInput SignalVCO = Voltage Controlled Oscillator Freq controlled by applied input voltage

Dr. Hugh Melvin, Dept. of IT, NUI,G

Widely Distributed ClocksMore difficult environment if underlying network non deterministicExpense of hardware based approach cannot be justified for many Soft-Firm RTSCheap software based approachNetwork Time Protocol (NTP)RFC 1305 (www.ietf.org)

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clock Synchronisation : NTPNetwork Time Protocol (NTP) synchronises clocks of hosts and routers in the InternetIncreasingly deployed in the InternetIncreased need for time synchronisationFacilitated via always-on Internet connection Provides nominal accuracies of low milliseconds on WANs, submilliseconds on LANs, and submicroseconds on workstations using a precision time source such as a cesium oscillator or GPS receiverUnix-based NTP daemon now ported to most OS

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTPThe NTP architecture, protocol and algorithms have evolved over the last twenty years to the latest NTP Version 4Internet standard protocol for time synchronisation and coordinated time distribution using UTCFault tolerant protocol automatically selects the best of several available time sources to synchronise withHighly scalable nodes form a hierarchical structure with reference clock(s) at the topStratum 0: Time Reference SourceGPS / GOES (GeoSat) / LORC (LoranC) / ATOM / DTSStratum 1: Primary Time Server

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP Operation

Complex Software comprising various algorithmsFiltering Alg.Clustering and Intersection Alg.Combining Alg.Clock Discipline

NTP MessagesPeer 1Peer 2Filter 1Peer 3Filter 2Filter 3IntersectionandClusteringAlgorithmsCombiningAlgorithmLoop FilterVFOP/F-Lock Loop

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP OperationNTP Algorithms act upon a set of variablesOffset / Delay / DispersionDispersion

w = 0.75These are relative to both peer and root Offset DelayDispersion

Dr. Hugh Melvin, Dept. of IT, NUI,G

Client Server ModeUDP/IP packets for data transferSeveral packet exchanges between client/serverClientoriginate timestamp A within packet being sent.Server receives such a packet: receive timestamp B transmit timestamp CClientProcesses A,B,C as well as final packet arrival DDetermine offset and Round Trip Delay (RTD) Note: RTD != RTT

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP Operation C 3.59.022D 3.59.032B 3.59.020A 3.59.00015 ms15 msSymmetric Network : 15 ms each way (actual delay)RTD = (D - A) (C B) = 32 2 = 30 msec (RTT =?)Offset = [(B-A) - (D-C)] = (20 10)/2 = 5 ms

Dr. Hugh Melvin, Dept. of IT, NUI,G

Filtering Algorithm Filtering algorithm looks at last 8 samples Chooses sample with min RTD Reduces offset errors by a factor of about ten Effective at removing spikes

Dr. Hugh Melvin, Dept. of IT, NUI,G

Intersection Algorithm

Clocks 1, 2 ,3 are truechimers4 is a falseticker3214 Selects a subset of peers Based on intersection of confidence intervals Identifies truechimers & falsetickers eg. From 1,2,3,4 above

X1X2

Dr. Hugh Melvin, Dept. of IT, NUI,G

Intersection Algorithm

Estimated offset to each clock is mid pt But: Any point in each confidence interval may represent actual time as seen by that peerIf clocks 14 are correct, there must exist a common intersection Clock 4 most likely incorrect.. disregardInterval X1 = smallest intersection containing points from 1,2,3But also include the max no of interval midpointsSelect X2 interval Could select mid pt of X2 .. or refine further

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clustering (Clock Selection)Sort surviving clocks by stratum and incr synch distance (RTD/2 + disp), S1 S2 S3 Remove outliers that have significant dispersion relative to other survisorsCompute Select Dispersion of each clockWeighted sum of differences to other clocksCompute Sample Dispersion of each clockWeighted sum of diff relative to past samples of same clocks If Max SelDisp > Min SamDispRemove this survivor and repeatFavours candidates at start of sorted list Favours lowest stratum / delay

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clustering algorithmnoyesFor each survivor si, compute the select dispersion (weighted sum of clock difference) between si and all others.Let smax be the survivor with max select dispersion (relative to all other survivors) and smin the survivor with min sample dispersion (clock differences relative to past samples of the same survivor).smax smin or n nmin?Delete the survivor smax; reduce n by oneThe resulting survivors are processed by the combining algorithm to produce a weighted average used as the final offset adjustmentSort survivors of intersection algorithm by increasing synchronization distance(RTD/2 + dispersion). Let n = no of survivors and nmin a lower limit (eg.3).

Dr. Hugh Melvin, Dept. of IT, NUI,G

Combining AlgorithmCombine result from survivors of selection algorithmWeighted offset determined based onOffset of survivors Synchronisation distance Eg. 2 survivors (S1,S2) with parameters

Final Offset =

Dr. Hugh Melvin, Dept. of IT, NUI,G

Combining Algorithm Example

S1,S2 where S1 = (2 ms, 30) and S2 = (3 ms, 10)Final Adjustment =(2(10) + 3(30)) / (30 + 10) = 110 / 40 = 2.75 msecImplemented via the Clock Discipline

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clock DisciplineRecallNo time reversal!Avoid step changesHybrid phase/frequency-lock (PLL/FLL) feedback loopPLL/FLL Mode: Depends on polling interval

Dr. Hugh Melvin, Dept. of IT, NUI,G

PLL and FLL weight factors Weight factors (not to scale) PLL predict (red) most important at shorter poll intervals to 24 s FLL predict (blue) most important at longer poll intervals to 217 s

Dr. Hugh Melvin, Dept. of IT, NUI,G

Clock ModelsUnix Clock Modelsettimeofday( ), adjtime( )Kernel variables tick , tickadjadjtime adjusts clock every tickCan amortise reqd change gradually by making adjustment every tick eg. every 10 msecNote: Newer Unix/Linux kernels 1000Hz 1msec3 clock ratesNormal rate .. Add 10 msec every tick (100 Hz)Normal Rate +/- tickadj Eg. If tickadj = 5us Normal Rate +/- 500 ppm

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP Operation NTP adjusts every sec via adjtimeEg. If clock skew is +100 ppm & tickadj=5usNTP will operate to keep clock effectively running at correct rateNormal Rate - 500 ppm over 0.2 secNormal Rate for 0.8 sec Effective skew = 0 ppmResults in sawtooth patternNewer Unix Kernels have advanced NTP featuresntp_adjtime( ), ntp_gettime()Eliminates the sawtooth pattern

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP ImplementationInstall NTP Set up ntp.conf fileList of servers that you wish to connect toRedundancy & Path Diversity & Low RTDStart up NTP daemon ntpdFile ntp.drift records clock skewOther utilitiesntpq, ntpdateSee www.ntp.org

Dr. Hugh Melvin, Dept. of IT, NUI,G

Refid:DCF: 77.5 KHz Radio SignalPTB: German time signal

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

Time difference

Dr. Hugh Melvin, Dept. of IT, NUI,G

Server Detailswhen: no of sec since last responsepoll : interval between queriesreach : Reachability in octal11111111 = 3778 = max11101110 = 3568 last + 5th probe lostSymbol to LHS of server* : Synch Source survivor with smallest dispersion+ :other candidates included in final combination alg - : Discarded by clustering algx : Falseticker acc to intersection alg

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP Robustness IssuesRedundancyPath DiversitySymmetric NetworksProximity to Primary Reference SourcesSee resultsOS & Network LoadPlatform Dependencies

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP Operation : Asymmetry C 3.59.017D 3.59.032B 3.59.015A 3.59.00010 ms20 msOffset still 5 ms but Asymmetric Network RTD = (D - A) (C B) = 32 2 = 30 msec Offset = [(B-A) - (D-C)] = (15 15)/2 = 0 ms .. Error

Dr. Hugh Melvin, Dept. of IT, NUI,G

NTP Operation : AsymmetryC 3.59.017D 3.59.032B 3.59.015A 3.59.00015 ms15 msNTPs Symmetric view of Asymmetric Network RTD = (D - A) (C B) = 32 2 = 30 msec Offset = [(B-A) - (D-C)] = (15 15)/2 = 0 ms !Exercise: What is the maximum error in this calculation?

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

Dr. Hugh Melvin, Dept. of IT, NUI,G

Server Offsets: Problem?

Dr. Hugh Melvin, Dept. of IT, NUI,G

of 41/41

Dr. Hugh Melvin, Dept. of IT, NU I,G 1 Clock Synchronisation for RTS

Embed Size (px)

Recommended