osqzss / gps-sdr-sim

Software-Defined GPS Signal Simulator
MIT License
2.61k stars 761 forks source link

Two questions: 1. Calculated pseudorange is exceeding 26k km and what is meant by the start time in the code? #313

Open Imtiaz08 opened 2 years ago

Imtiaz08 commented 2 years ago

Hi, I am a little confused about the word start time

for example in the section

`double subGpsTime(gpstime_t g1, gpstime_t g0) { double dt;

dt = g1.sec - g0.sec;
dt += (double)(g1.week - g0.week) * SECONDS_IN_WEEK;

return (dt);

}

gpstime_t incGpsTime(gpstime_t g0, double dt) { gpstime_t g1;

g1.week = g0.week;
g1.sec = g0.sec + dt;

g1.sec = round(g1.sec * 1000.0) / 1000.0; // Avoid rounding error

while (g1.sec >= SECONDS_IN_WEEK)
{
    g1.sec -= SECONDS_IN_WEEK;
    g1.week++;
}

while (g1.sec < 0.0)
{
    g1.sec += SECONDS_IN_WEEK;
    g1.week--;
}

return (g1);

}`

what are the g0 and g1? I think g0 is the GPS time while the g1 is the time at which the signal was recorded right?

also, there are some sections where all of a sudden Rho0 appears, and sometimes there is rho1 but I don't where it is calculated.

Another thing that seems very confusing is the section where the pseudo-range is calculated. Why is the gpstime_t g stored in the same structre?