[time-nuts] Choosing an Oscillator...

Poul-Henning Kamp phk at phk.freebsd.dk
Sat Jul 28 16:33:04 EDT 2007


In message <55252.87.227.52.225.1185649946.squirrel at webmail.lysator.liu.se>, =?
iso-8859-1?Q?Bj=F6rn_Gabrielsson?= writes:
>> Almost any OCXO (even much simpler ones than the HP '811 or '544)
>> will get you microsecond stability on your NTP server.
>
>Can you elaborate a little on your tests of NTP server stability vs
>oscillator choice? How useful/reliable are the internal NTP statistics?

To be brutally honest:  I consider the PLL and its statistics in the
ntp.org NTPD uselessly bogus below the millisecond level.

The first problem which will drive a time-nut up the wall is that it
spends hours not converging on anything close to a microseconds.

The second problem is that once it finally gets down there, it
performs a highly maddening random walk as the various odd hacks
for long pollrates fight each other and all the "common sense
constants" in there.

The third problem is that once you compare to real time standards,
you find that the statistics are meaningless at that level.

It's fine for the regular user, they'll tend to get overly optimistic
statistics, but once you throw real clocks at it, the cracks begin
to show.


I ended up writing my own NTP software "NTPns" for high-precision
S1-NTP servers to get the performance and reporting facilities I
needed for a particular customer.

For a number of reasons, not least political, I have not beaten the
drum much for NTPns, but it would be unfair to people in this forum
who want to build a S1 NTP server, to not let them know that there is
an alternative, even if it has a lot of rough edges.

NTPns reports statistics correctly down to at least the nanosecond
level, and will report things like allan variances for your clocks
and servers (obviously, the allan variance is calculated relative to
the disciplined clock, but you know what that mean)

One of my servers use a PLL to turn 10MHz from a Rb into 33.333... MHz
for a NET4501.  For reasons I can't remember, the kernel thinks this
is 33333332.000... MHz.  NTPns correctly settles on and reports the
40 PPB frequency offset.

It also has a PLL that will converge in a minute or two and then
gradually tighten up until it finds the point where it realizes
it got too tight for the clock (ie: first time you open the door/window
box :-), will recatch and not go that far next time.

PLL, source selection and reference clocks are all pluggable software
modules.  Statistics can be exported in real-time via a simple UDP
protocol (for instance to RRDtool) and SNMP support allows for
monitoring both server and client performance.

Finally, you can telnet to it, and configure and interrogate it
while it runs.  I have attached a session from gps.dix.dk below.

Presently NTPns run only on FreeBSD and with the oncore GPS
or DCF77 inputs and I don't have much time to develop on it.

NTPns is available at http://phk.freebsd.dk/phkrel and I welcome
co-developers and patches.


Poul-Henning


   gps# telnet localhost ntp
   Trying ::1...
   Trying 127.0.0.1...
   Connected to localhost.
   Escape character is '^]'.
   NTPns > show source
   Source oncore_0: votes 9.000000 flags <UTC> los 0/15 update 1 SELECTED
	   limit 1.280000e-01              No leapsecond at end of today
	   stratum 0                       refid [GPS]
	   delay 0.000000000               dispersion 0.000000072
	   last_ts 1185653410.000000201    last_delta 0.000000202
   NTPns > show source oncore_0 allan
   Source oncore_0: votes 9.000000 flags <UTC> los 0/15 update 1 SELECTED
	   limit 1.280000e-01              No leapsecond at end of today
	   stratum 0                       refid [GPS]
	   delay 0.000000000               dispersion 0.000000072
	   last_ts 1185653414.999999751    last_delta -0.000000248
	1: 11111111  0.000000086 1.284e-07
	2: 11111111  0.000000039 1.368e-07
	4: 11111111  0.000000004 8.268e-08
	8: 11111111 -0.000000050 4.757e-08
       16: 11111111  0.000000024 1.595e-08
       32: 11111111  0.000000034 5.793e-09
       64: 11111111  0.000000050 3.471e-09
      128: 11111111  0.000000037 8.969e-10
      256: 11111111  0.000000016 7.875e-10
      512: 11111111 -0.000000043 6.900e-10
     1024: 11111111  0.000000024 3.272e-10
     2048: 11111111  0.000000051 5.656e-11
     4096: 11111111  0.000000071 3.932e-11
     8192: 11111111  0.000000097 2.662e-11
    16384: 11111111  0.000000117 7.250e-12
    32768: 11111111  0.000000082 1.180e-11
    65536: 11111111  0.000000007 8.301e-12
   131072: 11111111  0.000000012 9.908e-13
   262144: 11111111  0.000000036 1.298e-12
   524288: 11111111 -0.000000001 6.066e-13
   NTPns > show ntpv4 0 partner
   IP number         port leap v m  s  p   P         offset refid
   Max partners:           10000
		      total   ours others
   partners            2026   1166    860
   partners good       1771   1135    636
   partners bad         255     31    224
   partners > 1s        164      6    158
   partners < 1s        110     35     75
   partners < 100ms     239     94    145
   partners < 10ms      681    386    295
   partners < 1ms       832    645    187
   NTPns > show ntpv4 0 partner 130.225.240/20
   IP number         port leap v m  s  p   P         offset refid
   130.225.247.82     123 no   4 3  2 10 -19   -0.001145161 [192.38.7.240] = ours
   130.225.244.222    123 no   4 3  2 10 -17   -0.000240054 [192.168.63.2]
   130.225.244.166    123 no   4 3  2 10 -20   -0.000038399 [192.38.7.240] = ours
   130.225.254.101    123 no   4 3  2 10 -19    0.001017861 [192.38.7.240] = ours
   NTPns > show ntpv4 0 partner 130.225.247.82
   IP number         port leap v m  s  p   P         offset refid
   130.225.247.82     123 no   4 3  2 10 -19   -0.001145161 [192.38.7.240] = ours
	   Delay            7.43e-03
	   Dispersion       4.71e-02
	   Our Rx          1185575185.325752188 (78396s ago)
	   Reference       1185574161.329412609
	   Originate       1185574161.326719194
	   Receive         1185574161.329412609
	   Transmit        1185575185.320768452
   NTPns > show pllmath
   st                4*    PLL state
   a        2.8247e-10     1. order correction
   b       -1.3862e-07     2. order correction
   c        0.0000e+00     3. order correction
   z       -1.3833e-07     Total correction
   wa       3.8152e-03     1. order ratio
   wb       1.4556e-05     2. order ratio (wa**be)
   wc       2.1187e-10     3. order ratio (wa**ce)
   j              8078     Averaging factor
   mj             8078     Max averaging factor
   dl              300     Delay timer
   zc                1     Zero Cross timer
   y        7.4038e-08     Phase error measurement
   ly       7.4038e-08     Last y
   my      -8.5244e-12     Averaged y
   lmy     -8.5244e-12     Last my
   dy       2.6104e-07     Two-sample y difference
   ddy     -2.2804e-07     Previous dy
   sdy      1.3880e-07     Average magnitude of dy
   ay       4.8908e-07     Avar sigma=1
   say      2.3860e-07     Averaged ay
   mj0      8.0000e+00*    Initial mj
   dl0      1.0000e+01*    Initial dl
   wa0      1.0000e-01*    Initial wa
   wamin    3.8629e-03*    limit 1. order ratio
   wamax    1.0000e-01*    limit 1. order ratio
   b0       0.0000e+00*    Configured frequency (b) offset
   be       2.0000e+00*    2. order exponent
   ce       4.0000e+00*    3. order exponent
   go3      1.0000e-03*    wa threshold for 3. order
   t3       1.0000e+01*    dl expansion in 3. order mode
   NTPns > show oncore 0
   serial port = /dev/cuad4        serial number = P05YWT
   state = 12      visible/track/lock = 9/9/9      dop = 0.0 [m]
   raim_limit 0.000001000/0.000001000 mask angle 10/10
   2007-07-28 20:15:06.000915753
   Leap second info: 2006-01-01 00:00:00 NONE
	       -49580107 seconds from now
   lat = 200823902 (55.784417), lon = 45071628 (12.519897), ht 8879 (88.79)
   http://maps.google.com/maps?ll=55.784417,12.519897&spn=0.03,0.08&t=k
   flat = 200823902, flon = 45071628, fht 8879
   rcv_status = 0x8400 = PosHold NarrowTrack AntOK
   raim_solution = OK, raim_status = detection+isolation
   raim_removed = 00000000 raim_1sigma = 0.000000036 [s]   raim_sawtooth = 9 [ns]
   clock_bias = -6 [ns]    osc_offset = 90237 [Hz] osc_temp = 30.0 [C]
   utc_status = 0xce = enabled decoded     utc_offset = 14
   site_survey = 0 (~0 sec left)
   Sat Dopler Elev Azi Health Mode SigStr IODE Status Offset
     6  -1352   66  89   00     8    51    158   8a0  0.000858469
     7   -783   75  94   00     8    50      2   8a0  0.000858467
    10    167   23  57   00     8    43     49   8a0  0.000858480
    13    -33   10 340   00     8    44    200   8a0  0.000858463
    16   2490   42 295   00     8    49      3   8a1  0.000858480
    21   2526   47 175   00     8    51    169   8a0  0.000858472
    24    -54   60 106   00     8    53      0   8a1  0.000858472
    30  -3693   22 135   00     8    44    142   8a1  0.000858483
    31  -2357   37 229   00     8    49     84   8a0  0.000858488
   NTPns > 

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the time-nuts mailing list