-
Notifications
You must be signed in to change notification settings - Fork 8
apply sat clock correction to query time for sat position computation #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Another thought: Is there a way to compare ephemeris IODs? Although if that was the issue we'd see probably large errors in cross-track and radial. |
src/prx/rinex_nav/evaluate.py
Outdated
| per_signal_query = compute_clock_offsets(per_signal_query) | ||
|
|
||
| # Apply sat clock correction to the query time for satellite position computation | ||
| per_signal_query.query_time_wrt_ephemeris_reference_time_s -= ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're making the hypothesis here that clock error changes so slowly, that computing it at the time of emission biased by sat clock error introduces negligible error, right? Or do we need a loop here that iteratively computes a corrected time of emission?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a 2-iteration refinement of the toe, but the results are identical. I'll still keep this, since it's implemented as such in rtklib.
src/prx/rinex_nav/evaluate.py
Outdated
| per_signal_query = compute_clock_offsets(per_signal_query) | ||
|
|
||
| # Apply sat clock correction to the query time for satellite position computation | ||
| per_signal_query.query_time_wrt_ephemeris_reference_time_s -= ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the difference get larger when doing += here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried with a += and it was worse. -= should be correct.
Not easily. I am using the same RINEX NAV file, and the OBS data span only 5 minutes. I'd guess that we would choose the same ephemeris set... |
|
I think the impact of the difference is minimal, since we are using the along-track is orthogonal to the line-of-sight vector. But it still bother me to not understand precisely why we have this difference. I'll let the PR open a few more days to think about it. |
|
I also wonder - assuming that rtklib is wrong, would anyone even notice? How is rtklib testing the orbit computations? Does anyone do PPP using rtklib? And even then, given that the line-of-sight diff is so small, would a PPP user notice? I guess the only way to really know is to run rtklib in debug mode (or add a few Can it be time datatype resolution? We use a pandas Timestamp/Timedelta which is backed by a nanosecond-resolution uint64 I believe, and we are looking at an issue of the order of milliseconds here, so probably not. What about the line where we divide pseudorange by the speed of light to remove time of flight - can that introduce a floating-point resolution issue, given that both numbers are pretty big ones? |
|
Running
gives me |
|
@plutonheaven It looks like the difference is exactly 0 (or just very small?) for one of the QZSS satellites - can we use that to better understand this by looking at what is different between J03 and J07? |
|
I see unit tests for GLONASS ephemerides here https://github.com/tomojitakasu/RTKLIB/blob/c033e62bcd311e4b3dcb8430a89597cc21be9f0b/test/utest/t_gloeph.c, nothing that compares with an expected broadcast orbit position though. And even then, if time of emission is off, a test of that kind wouldn't catch it. Still looking for where rtklib computes time-of-emission. |
|
The toe computation in rtklib is here: https://github.com/tomojitakasu/RTKLIB/blob/71db0ffa0d9735697c6adfd06fdf766d0e5ce807/src/ephemeris.c#L739 There is a python version of rtklib, which is quite reliable and the toe is computed there: https://github.com/rtklibexplorer/rtklib-py/blob/5d8968d85902b94e29e5b221e5f7ba35b22ca8a4/src/ephemeris.py#L265 |
|
About the order of magnitude of the error on the toe, 1.6 m on the along-track axis of a satellite moving at 4 km/s is 1.6 / 4e6 = 4e-7 seconds (0.4 µs). Converted in meters, this would relate to 4e-7 * 3e8 = 120 meters. |
|
@jtec I found the error: I was processing 2 different files 🤦 So much time wasted, i'm SO DUMB!!!!! |
|
Still, it's worth applying the sat clk correction for toe computation. It reduces the error by a few meters, so a useful update. I'll write a nice test to complete the PR. |
|
@plutonheaven That's great news pretty cool that we get the same positions after all! And definitely intriguing that one of the GPS sats still has 70 cm of difference - any idea what might be going on there? A satellite maneuvering and prx ignoring the ephemeris health bit or something? |
|
I bet on different iode |
|
Ok, I've seen where this difference comes from. The concerned satellite is G15 at epochs around 08:20:00. In the RINEX NAV file, there are two ephemerides sets, one valid at 08:00:00 and the other at 07:59:44. When I force @jtec: Any ideas why there are two so closely-spaced ephemerides in the NAV file ? |
|
I opened an issue on rtklib's repo: tomojitakasu/RTKLIB#765 |
|
Ok, I had some useful information from rtklib developers (Tomoji Takasu and Taro Suzuki!!) on rtklib's repository. What happened in this file is that an ephemerides set was transmitted a few hours before, and later updated. However, the time of ephemerides A process to remove "duplicate" ephemerides based on the closeness of the |
# Conflicts: # src/prx/rinex_nav/evaluate.py
| } | ||
| ) | ||
| query_with_ephemerides = select_ephemerides(ephemerides, query) | ||
| # The selected ephemerides should be the second one (ephemeris_hash=2), based on t_oe comparison, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we'd want to emulate the behaviour of real-time ephemeris evaluation we'd select the one transmitted later, correct? Would that be a change we can make to achieve the same outcome?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. In the ephemeris selection, we would have to take into account both t_oe and TransTime. But in select_ephemerides, we implemented a really fast ephemeris selection, assuming that the t_oe is sorted.
So that is why I implemented the duplicate (or rather very close) ephemeris.
…orrect_time_of_emission
- compare the 4 different solutions for ephemeris selection
… by the satellite clock offset" This reverts commit a46a929
|
Hi @jtec, I revert the latest commits to focus only on the correction of the time of emission. |
@plutonheaven I have a PR up that implements selecting ephemerides by time of transmission, there are still a few rough edges: https://github.com/jtec/prx/pull/179/files |
When comparing satellite position computed by
prxandrtklib, some meter-level difference was observed, mainly present in the along-track direction.This may be due to ignoring satellite clock offset in the query time for satellite position computation.
edit after solving the issue:
The difference is due to 2 factors:
time of ephemeridesandtime of transmissionin GPS ephemerides datasets.Only the first issue will be solved in this PR. The other will be dealt with in another one.