Help keep this site free:

# FAQ #2: Clock stability analysis and prediction, Allan Deviation

The following was an exchange on the [time-nuts] mailing list.

### Question

Hi,

For a while now I've got a growing interest in clocks, stability and specifically GPSDOs (mostly quartz). My education started out with the NIST Tech Note 1337 (Ref [3]). After studying the largest part of the document I felt that this was probably not a bad starting point. This document explained the various issues involved with characterizing clocks (Allan deviation and phase noise) and I bet that most of you are familiar with it.

From latter I've learnt that clocks can be characterized in both the time and frequency domain. Also, that the Allan deviation and phase noise plots are the recommended performance measures to compare clocks in the respective domains. Another cool thing is that there is an empirical link between the two and that one can switch between the two with reasonable accuracy.

If one took two Allan deviation (or phase noise) plots one can compare two clocks directly. Both the phase noise and Allan deviation measures are statistical in nature and are respectively frequency and time dependent. I also know that one can get a grip on the phase noise plot by integrating under the curve for a specific frequency range. This answer can then be scaled to seconds to give the integrated jitter over the frequency range involved. What I don't understand is how does one use the Allan deviation to predict how much a clock will drift on a certain time scale. For example, 500ps over a period of 1us. Or 1s for each day.

Initially I was convinced that the Allan deviation was very nifty because one can easily identify the different noise types. And, of course to directly compare clocks in the time domain. However, there seems to be an easy to read off by how much a clock will drift after a certain period in time? It would be much appreciated if someone could elaborate a bit on this topic. Or point me to a previous thread that already did.

Regards,

Stephan

### Response

Stephan,

Sounds like you've done some good research already.

Ignore Allan deviation for a moment and work through the process with me for a minute. Imagine checking the time error of a nice quartz clock each minute.

Let's say your first phase reading, P0, is 10 us, and the second reading a minute later, P1, is 21 us. What do you know so far?

Well, you know the time error (also called phase error) between your clock and your reference is a couple tens of microseconds. That tells you how "on time" the clock is. You now know your clock isn't perfectly on time. Close, but not perfect. What else do you know?

With just two points, you know that your clock has drifted in time by 11 us in a minute. Congratulations, you have now determined the frequency error of the clock. It is 11 us / 1 minute = 11e-6 s / 60 s = 0.18 ppm = 1.83e-7. A drift in time is the same thing as frequency offset, also called frequency error. F1 = (P1 - P0) / 60 s. So your clock is not only not perfectly on time, it is also not keeping perfect time. Close, but not perfect.

Now, based on just those two readings, what would you expect; what would you guess; what would you bet that reading P2 will be?

I think you would agree that since your clock appears to be drifting in time by 11 us per reading that P2 should be about 32 us, right? The expected gain is P1-P0, or 11 us. The last reading was P1 = 21 us, so your guess is simply P1 + (P1 - P0) = 2 P1 - P0 = 32 us. Right?

OK, you wait a minute and P2 is 35 us. Your guess was close. That's good. If the clock were perfectly stable, it should have read 32 us, but it was off by a bit. Not only is your clock off a bit in time, and off a bit in frequency, it is also off a bit in predictability, in stability. Close, but not perfect.

What do you know now? Well, based on points P1 and P2 the frequency error for this reading, F2 = 35-21 = 14us/min = 0.23 ppm = 2.33e-7. So you now have two frequency readings. You can no longer boldly claim the frequency error of your clock is exactly 1.83e-7; you are more inclined to say it is 2e-7 because you realize both readings differ, and are imprecise, but both close to 2e-7. You sense an average would be a better measure.

You also know that your prediction was off by 3 us. Why? Your prediction P2' was 32. The actual P2 was 35. The error in your guess, E2 = P2 - P2' is
E2 = P2 - [ P1 + (P1 - P0) ] = P2 - 2 P1 + P0

Are you with me so far? Imagine keeping this up for a while and making many predictions and collecting many actual phase readings. Each new phase reading gives you a new frequency measure; you hope they continue to average to a nice value that you can write on your oscillator. Each new phase reading gives you another chance to see how well your prediction matches. You hope the errors of your prediction stay pretty small. This time it was 3 us. Next perhaps 2, or 4, or -3, or -1, or 5, etc. These are the small errors in your ability to predict the phase error of the next reading.

After a batch of N phase readings you have collected N-1 Fi and so your average frequency error is the sum of all Fi divided by N-1. You are also curious how confident you are in your frequency average. You could compute the standard deviation.

You are also curious how small your errors of prediction are. You have collected N-2 Ei and it would be good to compute the standard deviation of this too.

When it comes to an oscillator like this, the initial phase error is usually no problem (you can correct for this). And even a frequency error is not a problem (you can correct for this in hardware or software).

What really gets you is the uncertainty in the frequency; the jitter; the instability; the limitations of the clock in meeting your predictions. This, you cannot correct for and so it is a measure of how intrinsically good your clock is.

Do you remember the square root sum of squares formula for stdev? Take a look now at the formula for Allan Variance or Allan Deviation. Can you see that it is just the standard deviation of all those P2 - 2 P1 + P0 phase prediction error terms? So Allan Deviation is not some magic formula; it's just a regular old standard deviation formula used in a special case.

And this is why the Allan Deviation can be used as a predictor of time drift; by definition, it is a measure of the expected deviation of time drift.

/tvb

An non-technical ADEV summary from USNO: Clock Performance and Performance Measures, tycho.usno.navy.mil/mclocks2.html

A scholarly paper on ADEV is found here: The Basics of Frequency Stability Analysis, www.wriley.com/paper2ht.htm

This is an all-time classic: The Science of Timekeeping. Application Note 1289, www.allanstime.com/Publications/DWA/Science_Timekeeping/

This a nice write-up from NIST: Properties of Oscillator Signals and Measurement Methods, tf.nist.gov/phase/Properties/main.htm

Many of my plots are made with Bill Riley's Stable32: www.wriley.com, But even if you don't need to buy his software you can enjoy all his papers.

### Extra Credit

Here's extra credit for some of you:

(1) With one point you get phase, or time error.

(2) With two points you get change in phase over time, or frequency.

(3) With three points you get change in frequency over time, or drift. The standard deviation of the frequency prediction errors is called the Allan Deviation.

This is a measure of frequency stability; the better the predicted frequency matches the actual frequency the lower the errors. A little bit of noise or any drift causes the errors to increase; the ADEV to increase. In the summation you'll see terms like P2 - 2*P1 + P0. You can see why constant phase offset or frequency offset doesn't affect the sum.

(4) With four points you get change in drift over time. The standard deviation of the drift prediction errors is called the Hadamard Deviation.

This is a measure of stability where even drift, as long as it's constant, is not a bad thing. In the summation you'll see P3 - 3*P2 + 3*P1 - P0. You can see why constant phase, frequency, or even drift doesn't affect the sum.

----

So imagine a situation where you're making a GPSDO and very long-term holdover performance is a key design feature. What OCXO spec is important?

In this application phase error is easy to fix - you just reset the epoch.

Frequency error is easy to fix. After some minutes or perhaps hours you get a good idea of the frequency offset. You then just set the EFC DAC to a calculated value and maintain it during hold-over. In this case the OCXO with the lowest drift rate (best Allan Deviation) is the one to choose.

But with a little programming even drift is also easy to fix. After some days or perhaps weeks you get a pretty good idea of frequency drift over time and so you ramp the EFC DAC over time to compensate.

The only limitation to extended hold-over performance in such a GPDO is irregularity in drift rate.

In this example, the Hadamard Deviation would be a good statistic to use to qualify the OCXO you need. Drift, as long as it's constant (e.g., fixed, linear, even log, or other prediction model) is not the limitation.

/tvb

### Illustration

John,

A few minutes in paint and here's a cool graphic for you:

Frame 1) shows a generic phase record (black); ignore all units.

Frame 2) shows taking a phase measurement at regular intervals (red).

Frame 3) shows that frequency is calculated from adjacent phase points (green). The slope (phase rise over interval run) is the frequency.

Frame 4) you can predict clock behavior based on most recent phase and frequency (extrapolated phase in blue).

Frame 5) and on the next measurement interval you can see how close your predictions were (prediction errors in red).

You can go through individual frames at:

Enjoy.

/tvb

Brooke wrote:

> Hi Tom:
>
> Is there a way to use the Allan plot to predict the variation in a reading?
> For example if you use the plot comparing the 1 PPS from a GPS receiver
> to a good Cesium frequency standard, then:
> (1) what size of variation would you expect if the Cesium standard was
> divided down to 1 kHz and that was compared to the GPS 1 PPS, or
> (2) what size of variation would you expect if the Cesium standard was
> divided down to 1 Pulse/1,000 seconds?
>
> Have Fun,
>
> Brooke
>
Brooke

To answer this you will need to know the Allan deviation as a function of tau for both the Caesium frequency standard and the GPS receiver output. The Allan variance of the measurement will be equal to the sum of the Allan variances of the GPS receiver and the Caesium standard for each tau.

The resultant Allan deviation will be equal to the square root of the Allan variance.

This assumes that the 2 sources are uncorrelated. Eventually for a long enough tau some correlation will be found as variations in room temperature produces correlated phase shifts/delays in the Caesium standard (and any associated dividers) and the GPS receiver.

For most GPS timing receivers the Allan deviation of the receiver output will dominate until tau is around 1 day or so for a high quality GPS timing receiver.

The value of tau at which the Allan deviations of both the Caesium standard and the GPS timing receiver are comparable will be much longer for most older generation GPS timing receivers.

For example a Caesium frequency standard with a standard tube will have worst case timing errors as listed below:

```Tau      timing error
=======  ============
1        120ps
10        85ps
100      270ps
1000     850ps
1 day     17ns
```

Whereas a high quality GPS timing receiver will have an rms timing error under favourable conditions of a little better than 10ns for tau < 1 day.

A carrier phase tracking GPS receiver will do much better than a typical high quality GPS timing receiver for small values of tau (< 1000 sec or so), however it will eventually be limited by the stability of the transmitted GPS carrier. A high quality quartz oscillator disciplined by a GPS carrier phase tracking receiver will outperform a Caesium frequency standard with a standard tube, for tau < 1 day, eventually it is limited by the GPS Allan deviation floor of around 5E-14 at tau = 1 day.

Bruce

Tom Van Baak wrote:

Brooke,

Maybe this helps. The clock prediction into the future is based on the past history and the current point. If the measured ADEV for a clock is, say 1e-13, for a measurement interval of 1 day (tau), then the prediction, within one standard deviation, is that you'll be within 1e-13 tomorrow. 1e-13 at one day is about 9 ns. I think this is right. Can someone double check?

It shouldn't matter what your divider does -- 9 ns of time error is 9 ns regardless if it's the zero-crossing of a 5 MHz RF output of the leading edge of a 1PPS signal.

A divider postpones cycle wrapping but doesn't affect clock accuracy or stability (other than the obvious introduction of passive & active component noise in the signal path).

/tvb

## Notes:

1. GPSDO: GPS Disciplined Oscillator, a precision oscillator that is compared to GPS timing signals and periodically adjusted to compensate for long term drift.
GPS signals have good long term stability (> several hours) but short term stability is affected by propagation conditions, atmospheric conditions, receiving antenna effects, multipath and other short term impairements.
A quality, oven controlled crystal oscillator such as the HP 10811, has excellent short term stability but is affected by drift due to aging and other effects.
A GPSDO uses a stable crystal oscillator and a GPS receiver optimized for timing, and combines the good short term stability of the crystal with the good long term stability of the GPS signal to provide the best of both worlds.