[time-nuts] Sample "R" script for ADEV under Linux wanted

Tom Van Baak tvb at LeapSecond.com
Mon Feb 3 11:14:11 EST 2014

In mathematics and engineering it's common to use the word "phase" to mean angle, with units of degrees or radians, often modulo 360 or 2 pi. In the time & frequency world, the word "phase" almost always refers to a time difference (time error), with units of time (seconds), and unbounded.

To further complicate things, one can sometimes see "wrap" when measuring time error using a time interval counter on signals that are high in repetition rate or too different in frequency. The most common form of this is if you measure two slightly drifting 10 MHz signals using time interval mode; the numbers you get will always be 0 to 99 ns. In that case you have to manually unwrap the cycles to get a true time error series.

This is normal. But it can be a hassle and introduce experimental ambiguity so that's why most people avoid the problem by just using lower frequencies for their comparison, like 1 kHz or 1 Hz (1PPS). Even that doesn't guarantee no wrapping in all cases. The other trick is to artificially advance the start or retard the stop channel to avoid negative numbers or wrapping.

In your case, as long as you are comparing at 10 MHz and your references are not closely locked in phase your counter will give you numbers that wrap. You must take care of this before you apply the numbers to an ADEV calculation or use them to compute frequency.

Computing phase deltas does not help, since a phase wrap just turns into a frequency spike.


----- Original Message ----- 
From: "Bob Stewart" <bob at evoria.net>
To: "Discussion of precise time and frequency measurement" <time-nuts at febo.com>
Sent: Sunday, February 02, 2014 8:31 PM
Subject: Re: [time-nuts] Sample "R" script for ADEV under Linux wanted

"That code, like most ADEV calculations, assumes you have phase data..."

In my case, the phase data wraps at each DAC change. Do I need to unwrap it, or change it to delta values? I haven't read enough about ADEV to get a feel of what I want, or what this group means when someone say ADEV of xx. I suspect that I need phase deltas from sample to sample to get the allan deviation of the phase changes? Since mine wraps, I'm not sure if an ADEV even means anything.


> From: Tom Van Baak <tvb at LeapSecond.com>
>To: Discussion of precise time and frequency measurement <time-nuts at febo.com> 
>Sent: Sunday, February 2, 2014 10:23 PM
>Subject: Re: [time-nuts] Sample "R" script for ADEV under Linux wanted
>>I suggest to use the TVB's
>> http://www.leapsecond.com/tools/adev1.c
>> C source and derive your script from it... but first, your GPSDO has
>> to put out the time interval error samples or you have a reference and
>> a TIC to measure your GPSDO (better this last setup).
>Correct. That code, like most ADEV calculations, assumes you have phase data, and so it uses the "x" form of 
>the formula. If the data is period or frequency then you use the "y" form of the formula. See: http://www.wriley.com/paper2ht.htm for details on both equations.
>See also: http://leapsecond.com/tools/adev_lib.c which computes ADEV, MDEV, and HDEV from phase.

More information about the time-nuts mailing list