An experiment with software-based temperature compensation.

The accuracy of a stratum 2 timeserver is usually more influenced by the uplink quality than by moderate temperature changes. However, our four nearest upstream servers (6-10 hops away) have rtt < 2.5 ms and thus the temperature changes have become the main source of an offset scatter. As long as the changes are slow, the PLL compensates well for them. However, such conditions are not satisfied in our environment. Moreover, the situation becomes even worse when using the air-conditioning.

An interesting and transparent approach to software-based temperature compensation has already been described. However, this approach requires a change in the ntpd's source code.

The experiment described here relies on usage of the ntptime utility. The clock frequency is periodically read off and corrected according to the temperature changes. It is important in this approach that the temperature dependence is applied differentially, i.e. as a frequency correction only. Otherwise the PLL adjustements would be vetoed.

The frequency is approximated by a quadratic temperature dependence:

(1)f(T) = f0 + k . (T-T0) + q . (T-T0)2

Each correction applied by ntptime is calculated (assuming it's small enough) according to the formula:

(2)Δf = [ k + 2q . (T-T0) ] . ΔT

Current status

The first graph shows that part of the frequency which is tuned up by PLL. Ideally, the green curve would be a horizontal straight line. At least, the correlations with temperature would be small. Possible vertical bars correspond to the instants when the k,q parameters have been changed and/or the ntpd restarted. As one can see, the frequency varies between narrower boundaries when compared with an overall frequency range for the same time period (see the next graph).

Preliminary results

RS232 temperature probe (based on Dallas Semiconductors DS18B20 sensor) feeds the RR database every 10 seconds. The probe has 0.1ºC resolution. The values of ΔT are obtained from 1 minute averages computed by RRDtools.

K. Sandler, November '06