Mercurial > ublox > ublox8
changeset 74:e1866afc9b4d
print-state: don't assert that ephemeris t0 is monotonically increasing
There has been at least one instance, where the most recently received
ephemeris was 10 minutes older than the previous one.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Wed, 22 Jan 2020 12:53:06 -0500 |
parents | 0bfd3bbea386 |
children | 84848a472137 |
files | print-state.c |
diffstat | 1 files changed, 44 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/print-state.c Wed Jan 22 13:08:34 2020 -0500 +++ b/print-state.c Wed Jan 22 12:53:06 2020 -0500 @@ -110,7 +110,24 @@ return; } else { /* - * A different ephemeris - must have a newer t0. + * A different ephemeris. + * + * In theory it must have a newer t0. In practice, there + * have been instances where t0 has went backwards. For + * example, E31's ephemeris update on 2020-01-22 (at + * 644422793 GST) went from: + * + * iod = 242 + * t0e = 644422200 (GST) + * + * to: + * + * iod = 4 + * t0e = 644421600 (GST) + * + * Therefore, we cannot assert that t0 is monotonically + * increasing. Instead, we just accept the most recently + * received ephemeris but issue a warning. * * Note: It is tempting to assert that the iod has changed * (i.e., is not the same) but that would assume that we @@ -118,9 +135,33 @@ * to see two ephemeris updates in a row with the same iod * because we failed to receive all updates in between. */ - ASSERT3U(prev->t0.gst, <, new->t0.gst); + + if (prev->t0.gst >= new->t0.gst) { + printf("WARNING: E%02u ephemeris update is " + "%u s older than previous (GST t0 %u -> %u): " + "disco %f m @ prev t0, %f m @ new t0\n", new->sv, + prev->t0.gst - new->t0.gst, prev->t0.gst, + new->t0.gst, + calc_disco(prev, new, prev->t0.gst), + calc_disco(prev, new, new->t0.gst)); + galileo_print_eph(prev); + galileo_print_eph(new); - prev_age = new->t0.gst - prev->t0.gst; + /* + * Yes, we break the above rule about not assertig + * that iod changed. This is temporary, while we + * try to figure out why E07 on 2020-01-20 had an + * ephemeris update that was identical except that: + * + * omega0: 8.414103e-01 -> 8.409633e-01 + * i0: 9.532941e-01 -> 9.532922e-01 + * omega: 6.120841e-02 -> 7.349972e-02 + * idot: -1.300054e-10 -> 5.571661e-11 + */ + ASSERT3U(prev->iod, !=, new->iod); + } + + prev_age = (int32_t) (new->t0.gst - prev->t0.gst); /* calculate the discontinuity... */ /* ...at t0 for the new ephemeris */