[ntp:questions] Slow convergence of NTP with GPS/PPS

Unruh unruh-spam at physics.ubc.ca
Wed Oct 22 23:17:34 UTC 2008


"Richard B. Gilbert" <rgilbert88 at comcast.net> writes:

>Unruh wrote:
>> "Richard B. Gilbert" <rgilbert88 at comcast.net> writes:
>> 
>>> Nicola Berndt wrote:
>>>> Unruh schrieb:
>>>>
>>>>>>>   
>>>>>> I see, that's too bad then.. :( I am already using minpoll 4 maxpoll 4
>>>>> OK, But that should have a convergence of minutes not hours. Mind you NTPs
>>>>> habit of throwing away 7 out of 8 queries of the clock does not help.
>>>>> (clock filter). Especially for a pps that is pretty extreme.
>>>> Today I moved the computer to a different location to work there and I 
>>>> found it to set its clock right after start and keep it within ms-range! 
>>>> I didn't change anything, just shut down, drove there and turned it on, 
>>>> so I am really confused about that. Both locations are normal rooms with 
>>>> normal room-temerature. Well, I duplicated the system (that was why I 
>>>> was there..) and came back home with mine and tomorrow I will see if it 
>>>> behaves different again. Very very weird! It looks as if all of a sudden 
>>>> the driftfile was used and before not! This is also very strange, since 
>>>> the driftfile was (re)written yesterday, so ntp knew about it yesterday. 
>>>> My ntp.conf also includes the driftfile location.
>>>>
>>>>>> No, the Soekris will run linux an d ntpd and the oscillator will just be 
>>>>>> on an external little board. The computer is residing in an airport 
>>>>>> hangar for MONTH sometimes with no powersource at all! There is 
>>>>> Hard for it to be on all the time then. Or for it to have anthing like an
>>>>> accurate time. And that ovenized oscillator will also be pretty useless (
>>>>> much worse than the GPS) since it will have no power either and the crystal
>>>>> will not be oscillating nor the oven keeping the temp constant. 
>>>> Oh, so I got the word ovenized wrong: I understood it to be very immune 
>>>> against varying temperature. Ok, so if it needs an heater and all, it's 
>>>> useless in my case.
>>>>
>>>>> So, what you have is a free standing computer which must come out of a cold
>>>>> shutdown (ie the oscillator frequency on startup will be way off its
>>>>> frequency in steady state because it is cold) so will be far from
>>>>> equilibrium. What is your time error requirement? Seconds, milliseconds,
>>>>> microseconds? In such a situation ntp would probably give you a few
>>>>> milliseconds. But it certainly is NOT designed to give you good accuracy in
>>>>> such a situation during startup.  What are you finding?
>>>> Well, one thing I can of course always do is to boot hte machine, let it 
>>>> run for a flittle while and reboot it, so it boots with a warmed up 
>>>> oscillator. This would give trouble with the driftfile, though..
>>>>
>>>> We target for millisecond accuracy. As I understand, the oscillators on 
>>>> standard PCs are mostly cheapest crap and there are way better 
>>>> oscillators I could use to replace the original. Is that correct?
>>>>
>> 
>>> The clock in a PC is basically the guts of a cheap "Quartz" watch.  It 
>>> wouldn't surprise me if the manufacturers bought the crystals rejected 
>>> by the watch makers.  I suspect that the clock exists MOSTLY so the 
>>> machine will have the correct date for things like letters and checks.
>> 
>>> Replacing ANYTHING on the PC mother board will void your warranty.  It 
>>> may also cause your PC to cease functioning!!
>> 
>>> If you need a real clock in your PC, you can buy a board that plugs into 
>>> the PCI bus and is equipped with an OCXO (Oven Controlled Xtal (Crystal) 
>>> Oscillator).  Some will take a signal from GPS satellites and fine tune 
>>> the crystal.  Such boards are available from Meinberg Funkurhen and
>>> Symmetricom (BC635PCI/637PCI) for a great deal of money ($1200 to $2400 
>>> US) the last time I looked.  If you have lots of money and need a REALLY 
>>> accurate clock, even without full time access to GPS, you might want to 
>>> look at these products.
>> 
>> That was what he suggested. Unfortunately his computer must be switched
>> off, in hostile environments (eg winter) with no power at all for sometimes
>> months. Ie, the oven controlled crystal is pretty useless to bring up the
>> clock with accurate frequency and offset withing 10 of seconds to minutes of switchon.. 
>> I suspect an oven will take many minutes to hours to stabilize.
>> A termistor on the crystal on the other hand might be useful to compensate
>> the temperature ( there is an alteration of ntp which also calculates the
>> temp compensation of the crystal and uses that to calculate the required
>> drift rate.-- unfortunately I do not remember its name of location on the
>> web)
>> 
>> Unfortunately with ntp itself, even if he had gps, the fact thatt the drift
>> rate changes relatively rapidly on startup would still result in a offset
>> and overshoot by ntp. Since you could do a minpoll=maxpoll=4 it would be
>> relatively quick to settle in, but of course since ntp only uses 1/8 of the
>> measurements, that would be of the order of 5 min to settle down.

>Is it just my imagination or is he asking for something pretty 
>unrealistic?  NTP will not do it.   Chrony might but I'm not familiar 
>with it and can't say for sure.  Serious timekeeping equipment is 
>generally operated 24x365 in a controlled environment.

No I do not believe it is unrealistic. ntp certainly cannot do it, because
of its design, but certainly if y ou think about it, it should not take
more than a minute to a) determine what the remote correct time is via ntp
packet exchange, and b) estimate the drift rate of your own clock to at
least a few 10s of PPM, then over the next few minutes you could refine
that estimate. Ie, one should be able to get the clock phase correct in
seconds to better than ms ( the ntp exchange protocol on a good network
will do that easily) and the drift rate withing minutes ( to 1PPM type
level). If I handed you 5 packets exhanged with a host over a minute, you
could use that to estimate both the offest and the drift rate to that kind
of accuracy ( assuming that the network noise is at the 100us type level). 

If you can do that by hand, the computer should be able to automate it. 



>To turn your equipment on after months of downtime and expect it to lock 
>on to the correct time with millisecond accuracy within seconds is 
>asking for a hell of a lot.

Assuming the network noise is the 100us level, (which it is for example
between me and Regina 3000km away) you should get the accuracy easily to
1ms in 1 sec. if all you want is the phase error. One packet exchange will
give it to you. 



>My best suggestion is to turn the thing on two or three days before he 
>needs it!  Alternatively he could spend $50,000 US and up on an atomic 
>clock of his very own. . . .

That would not help if he had to turn it off for months at a time. 
That 50000 atomic clock would take a long time to get into phase. A GPS
receiver would be better, especially if it know its location. Then within
seconds it would know the time to nanoseconds. If it has to diiscover its
location it could take a lot longer.  A cheap GPS is $60. and is go to
better than usec. Ie, his demands are now adays basically trivial. The
problem is not with the problem but with trying to use ntp as the solution.






More information about the questions mailing list