[chrony-dev] temperature compensation |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
Here is a patch that adds support for a simple temperature
compensation. It doesn't try to find the compensation coefficients
automatically, they have to be specified in the config file.
It can be configured with a new tempcomp directive like this:
tempcomp /sys/class/hwmon/hwmon1/device/temp2_input 30 26000 0.0 0.000183 0.0
log tempcomp
The parameters are filename, update interval (in seconds), and
compensation coefficients T0, k0, k1, k2. The correction is calculated
(in ppm) as k0 + (T - T0) * k1 + (T - T0)^2 * k2, and it's substracted
from clock frequency directly in local module.
Any changes in frequency are transparent to upper layers. Depending on
how well it works the offset and frequency reported in tracking.log
should be smaller.
I've been using it for a few weeks on my home machine. The mainboard
has an integrated sensor supported by Linux, but it has only 1 degree
resolution. When running with poll interval 10, the improvement seems
to be around factor 2. Not that great, but maybe with a better sensor
placed closer to the crystal the results could be better.
I'd be very interested in hearing how it works for others.
A question is how should users find out good coefficients. I did an
eyeball estimate from frequency and temperature plots, but something
automated and more accurate would be nice. Maybe a perl script that
would go through tracking.log and tempcomp.log, search for points with
minimal skew and make a linear fit. If there is a lot of data maybe
try to make a quadratic coefficient. Suggestions?
--
Miroslav Lichvar