-------- Pluess, Tobias writes: > However in the other plot "gpsdo-outliers" we can see that there are huge > outliers in the phase error. At these times, we had huge thunderstorms here > in Switzerland at my place and I believe that the GPS signal quality was so > bad at these times that the GPS time pulse did not work reliably. (what > other reasons could there be for these 1PPS timing outliers?)
Thunderstorms, in particular in regions with high ground resistance (= mountains) causes electrostatic fields which can cause trouble. One of the lesser known kinds of this trouble is induced voltages in high impedance CMOS inputs. Therefore: make sure that all unused CMOS pins are either tied to something with a suitably low resistance. On microcontrollers one can configure unused pins as outputs and drive them low. > Obviously, the "magic" of a GPSDO control algorithm is in the filtering of > these outliers! so far, my control code (src/cntl.c on Github) does not > seem to filter these outliers good enough In general median filters are probably the most robust way to deal with outliers, but if you do them the naiive way, they cause a usually unacceptable time-delay. When the outliers are less than half of samples, and always wrong, running the median filter in "gate mode" works well. Since the output from the median filter only defines a "gate" which input signals must pass, it causes no time-delay in the control loop. Something like: NMEDIAN = 300 GATE = 1e-3 median_filter = [None] def new_measurement(x): median = sorted(median_filter)[len(median_filter)//2] if median is None or median - GATE < x < median + GATE: ok_measurement(x) if len(median_filter) >= NMEDIAN: median_filter.pop(0) median_filter.append(x) This will reliably discard any sample which are more than 1e-3 from the median of the previous 300 samples. If the outliers are sometimes true, ie, where step-changes are to be expected and sensibly handled, median filters are not so swell and Kalman filters may be indicated. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@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. _______________________________________________ time-nuts mailing list -- time-nuts@lists.febo.com -- To unsubscribe send an email to time-nuts-le...@lists.febo.com To unsubscribe, go to and follow the instructions there.