REC-SPb-ETU/Gpstk-old

Suspicious accuracy assignment in Rinex3NavData from EphemerisGPS

Closed this issue · 2 comments

@eugenyk @krestelev please look at https://github.com/jonyrock/Gpstk/blob/38f355122a8012f02eec9cf62d376b4e04294869/dev/ext/lib/FileHandling/RINEX3/Rinex3NavData.cpp#L148

also look at https://github.com/jonyrock/Gpstk/blob/38f355122a8012f02eec9cf62d376b4e04294869/dev/ext/lib/FileHandling/RINEX3/Rinex3NavData.cpp#L674

I suspect that here should be
accuracy = gpseph.accuracy;

Because

  • gpseph.accuracy is never used during construction
  • GPSEphemeris::accuracyFlag is short but Rinex3NavData::accuracy is double
    And because of description
double accuracy;     ///< SV accuracy (m)
short accuracyFlag;        ///< Accuracy flag (URA)
double accuracy;           ///< Accuracy in meters (from accuracyFlag)

see ftp://igscb.jpl.nasa.gov/pub/data/format/rinex211.txt Table A4

@krestelev @eugenyk I've made a simple test

#include "Rinex3NavData.hpp"
#include "Rinex3NavStream.hpp"
#include "GPSEphemeris.hpp"
#include "CivilTime.hpp"
#include <iostream>
#include <cassert>

using namespace gpstk;
using namespace std;

int main(int argc, char *argv[])
{
    GPSEphemeris gpse;

    // basic necessary fill 
    gpse.ctToc = GPSWeekSecond(123, 1239180.123, TimeSystem::GPS);
    gpse.ctToc.setTimeSystem(TimeSystem::GPS);
    gpse.ctToe = GPSWeekSecond(1231, 1239180.123, TimeSystem::GPS);
    gpse.ctToc.setTimeSystem(TimeSystem::GPS);
    gpse.transmitTime = GPSWeekSecond(123, 1239180.123, TimeSystem::GPS);
    gpse.transmitTime.setTimeSystem(TimeSystem::GPS);
    gpse.HOWtime = 10;
    // basic necessary fill

    gpse.Cic = 10;
    gpse.accuracy = 123.123;

    Rinex3NavData rnd(gpse);
    GPSEphemeris gpseConverted = static_cast<GPSEphemeris>(rnd);

    assert(gpse.Cic == gpseConverted.Cic); // OK
    cout << gpse.accuracy << " : " << gpseConverted.accuracy; // 123.123 : 6.95335e-310
    assert(gpse.accuracy == gpseConverted.accuracy); // fail

}

We can claim that gpse should be equal to gpseConverted, but it's not true.
I think that now we can conclude that it IS a bug.

But it is never used :)

User range accuracy should be used in solving having no doubt. But accuracy can be both in meters and in some units, maybe developers do some conversion later?