-
Notifications
You must be signed in to change notification settings - Fork 22
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
Decoded Epoch type often has wrong timescale #81
Comments
While working on this I also found a bug in hifitime relates to the GNSS time scales - nyx-space/hifitime#209 - so be sure to the dependency once thats fixes Also there isn't support for IRNSS/QZSS yet in hifitime - nyx-space/hifitime#210 - so might need to fall back to something else, for QZSS I would use GPS in the meantime. Seems like the decoder doesn't support IRNSS so not an immediate issue there. |
Hello @ljbade, I am not surprized by incorrect behaviors, due to the many possible cases, that you thoroughly described. |
OK, I will work on a small PR based on the changes I made. |
Started on a PR in https://github.com/ljbade/rinex/tree/time-scale I still need to check that it handles the different cases and add tests then I'll make a PR. |
I have got stuck fixing up the epoch formatting functions to match the parse functions. I can't figure out how to get the Gregorian format from a Basically I want to ensure the output RINEX formatted observation times are in the correct time scale for the type of file (e.g. GPS, Galileo, etc) to match the rules for parsing observation times. |
I'm sorry I won't be able to provide direct help to your branch until I get back from the week end, I can't access a build machine until then
From the Hifitime API, I only see these methods to answer your requirement let epoch = Epoch::default();
let new_epoch = epoch.in_time_scale(TimeScale::GST); // let's you convert into a timescale
// you also have this method, but it does not output an Epoch directly
let iso8601_formatted_str = epoch.to_gregorian_str(TimeScale::GST);
In the end, the best thing to do is to enhance the |
I initiated support for QZSST. GLONASST and IRNST will follow, it's easier to have them introduced one at a time |
I did find the Otherwise I might make a feature request on the hifitime page. |
Another option would be let epoch = Epoch::default();
let duration = epoch.to_duration();
// you also have this, to translate into another timescale at the same time
let duration = epoch.to_duration_time_scale(TimeScale::GST);
// and then use decompose
let (_sign, y, m, d, hh, mm, ss, nanos) = duration.decompose(); |
@ljbade yes, hifitime supports generic formatting like If you wish to format an epoch in Gregorian, the simplest should be Version 4 will provide better support: nyx-space/hifitime#231 . |
Hello @ljbade @ChristopherRabotin, I spent a little time on this, I'm preparing a In RINEX we're parsing datetimes like 2023-01-01 00:00:00, in otherwords, what Hifitime refers to as "Gregorian" datetimes, but they're expressed in GNSS time scales, in the case of Observation / Navigation RINEX. The easiest option would be to have Tweaks that might work in the mean time (diff between current stable & |
Would the work we've started on version 4 solve this issue? If so, I can prioritize it and split up the (rather large) milestone https://github.com/nyx-space/hifitime/milestone/14 into an alpha and beta version. One of the key differences in version 4 is that the epoch is kept in its initialization time scale all the time, even during serialization. I think we could also fix the Gregorian date parsing so that it's identical in all time scales. Could this leap second bug cause issues in the GNSS computations, nyx-space/hifitime#255 ? |
There is no emergency in solving those topics. As you can see, we can find workarounds as of today.
I've been thinking about this for a couple of weeks now and I come to the conclusion this behavior is fine. |
Hello @ljbade @ChristopherRabotin well this gets confusing and blocks the position solver topic to move forward at the moment. I thought I had a workaround in gnss-time but that "cannot" work: let me explain. The work around (gnsstime:src/epoch/mod.rs:parse_in_timescale) provides a solution to "Gregorian" datetime parsing, at the expense of little dirtiness (leap seconds). The "problem" that I did not expect, is due to the current (hifitime v3) .eq() implementation. 2023-01-01 T00:30:30 (sv E01) and if you're unlucky, 2023-01-01 T00:31:45:GPST is the same duration in TAI as 2023-01-01 T00:30:30:GAL (do you get it ?). Bottom line: impossible to have a method that proposes to the position solver the "correct" time representation easily. Yet another behavior that gets smoothed out if we define an Epoch from it's timescale T0 |
I'm not very familiar with the different GNSS clocks: is "sv E01" and "sv G31" supposed to be the same time scale but on different spacecraft, and exhibit their own internal drift? Or should they actually be the same epoch, even if the Gregorian representation is different? If both epochs in fact represent the same duration since reference epoch then |
Hello @ChristopherRabotin,
E01 and G31 are two satellite examples, with two different free running clocks onboard.
No, it's just a description of a free running clock, in the form of a timestamp/datetime.
It is important during positioning that we express the time as the number of seconds within the related timescale (past its T0). The algorithm basically solves [x, y, z, dt] where (x,y,z) are the radio receiver's location and dt its own onboard clock offset. For better and in depth explanations, you need to download Volume 1 at the bottom of this page.
we will not compensate for relativistic effects in V1, including ones that affect the clock offsets.
I can stick to dictionaries, it's just that we don't have means to parse gregorian datetimes correctly right now. And my "tweak" is not correct either. I can fix that by using Epoch::from_gpst_seconds() for example, which works totally fine, but requires me to first calculate the seconds past GPST_REF |
Okay, I think I understand the principle of the algorithm now, thanks. How do we fix this? Is the core issue that the Gregorian computation may be wrong in GNSS scales? Or is it that |
Hello @ChristopherRabotin,
Well, the current behavior is fine, I mean it simply matches the J1900 referencing. It's just it has this side effect that I did not see coming. For me it demonstrates the current definition is wrong. When you're talking about Epoch in a system, you expect something that is unique. By that I mean the Epoch happened at some point and will not happen again in the case of our free running clocks. Maybe that proves that the next Eq behavior should simply be : PartialEq()
a.duration == b.duration && a.time_scale == b.time_scale Otherwise this : PartialEq()
a.duration == b.into_time_scale(a.time_scale).duration Will produce this behavior :
In the case of this crate, that can be worked around by using another indexing method (like Vectors insteand of Dictionaries). |
I quite like this definition:
I think it's physically more correct than converting time scales, and it's significantly simpler to implement. I think however that there should be another method that performs the conversion quickly to quickly check if two epochs in different time scales match (or we could leave it up to the user to convert to whichever time scale is correct). @ljbade , what do you think? |
Hello, i'm happy to announce the workaround works fine. Basically I just construct an epoch using Epoch::from_str("Y:M:D HH:MM:SS {TS}"), to have the correct timestamp represented in that timescale. It's kind of cumbersome but all the maths after that are correct, which is want we want and the most important. For example, the Keplerian solver is not broken, which is quite a statement considering we test for millimeter errors, and a 1ns error means +/- 30cm. I will propose the |
I don't fully follow the discussion but I have always found it useful to convert all the different GNSS timescales to a single one e.g. GPS time and then do the solving with that. But the timescale conversion stuff is needed when computing satellite positions. |
The hifitime
Epoch
struct supports different timescales but the decoder often initialises them with the wrong types.For reference here is how each type of RINEX file should set the timescale:
TIME OF FIRST OBS
header lineG01
use GPS timescale,E01
use Galileo etcThe text was updated successfully, but these errors were encountered: