refclock: don't include average dispersion in unfiltered samples
The dispersion of refclock samples before filtering now includes only offset correction error and precision. This should fix a problem where locked PPS got stuck with large average dispersion and didn't accept new samples due failing check of offset and dispersion.
This commit is contained in:
parent
b745b6d546
commit
26e00ffbeb
1 changed files with 4 additions and 4 deletions
|
@ -351,7 +351,7 @@ RCL_AddSample(RCL_Instance instance, struct timeval *sample_time, double offset,
|
||||||
|
|
||||||
LCL_GetOffsetCorrection(sample_time, &correction, &dispersion);
|
LCL_GetOffsetCorrection(sample_time, &correction, &dispersion);
|
||||||
UTI_AddDoubleToTimeval(sample_time, correction, &cooked_time);
|
UTI_AddDoubleToTimeval(sample_time, correction, &cooked_time);
|
||||||
dispersion += instance->precision + filter_get_avg_sample_dispersion(&instance->filter);
|
dispersion += instance->precision;
|
||||||
|
|
||||||
if (!valid_sample_time(instance, sample_time))
|
if (!valid_sample_time(instance, sample_time))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -391,7 +391,7 @@ RCL_AddPulse(RCL_Instance instance, struct timeval *pulse_time, double second)
|
||||||
leap = LEAP_Normal;
|
leap = LEAP_Normal;
|
||||||
LCL_GetOffsetCorrection(pulse_time, &correction, &dispersion);
|
LCL_GetOffsetCorrection(pulse_time, &correction, &dispersion);
|
||||||
UTI_AddDoubleToTimeval(pulse_time, correction, &cooked_time);
|
UTI_AddDoubleToTimeval(pulse_time, correction, &cooked_time);
|
||||||
dispersion += instance->precision + filter_get_avg_sample_dispersion(&instance->filter);
|
dispersion += instance->precision;
|
||||||
|
|
||||||
if (!valid_sample_time(instance, pulse_time))
|
if (!valid_sample_time(instance, pulse_time))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -418,6 +418,8 @@ RCL_AddPulse(RCL_Instance instance, struct timeval *pulse_time, double second)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ref_dispersion += filter_get_avg_sample_dispersion(&refclocks[instance->lock_ref].filter);
|
||||||
|
|
||||||
UTI_DiffTimevalsToDouble(&sample_diff, &cooked_time, &ref_sample_time);
|
UTI_DiffTimevalsToDouble(&sample_diff, &cooked_time, &ref_sample_time);
|
||||||
if (fabs(sample_diff) >= 2.0 / rate) {
|
if (fabs(sample_diff) >= 2.0 / rate) {
|
||||||
DEBUG_LOG(LOGF_Refclock, "refclock pulse ignored samplediff=%.9f",
|
DEBUG_LOG(LOGF_Refclock, "refclock pulse ignored samplediff=%.9f",
|
||||||
|
@ -829,8 +831,6 @@ filter_get_sample(struct MedianFilter *filter, struct timeval *sample_time, doub
|
||||||
y /= n;
|
y /= n;
|
||||||
e /= n;
|
e /= n;
|
||||||
|
|
||||||
e -= sqrt(filter->avg_var);
|
|
||||||
|
|
||||||
if (n >= 4) {
|
if (n >= 4) {
|
||||||
double b0, b1, s2, sb0, sb1;
|
double b0, b1, s2, sb0, sb1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue