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|
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).
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