Changeset 1842 in ntrip for trunk/clock_and_orbit


Ignore:
Timestamp:
May 14, 2009, 3:24:41 PM (13 years ago)
Author:
stoecker
Message:

fixed a set of decoding bugs

Location:
trunk/clock_and_orbit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/clock_and_orbit/clock_orbit_rtcm.c

    r1840 r1842  
    33        Name:           clock_orbit_rtcm.c
    44        Project:        RTCM3
    5         Version:        $Id: clock_orbit_rtcm.c,v 1.13 2009/05/06 14:02:39 stoecker Exp $
     5        Version:        $Id: clock_orbit_rtcm.c,v 1.15 2009/05/14 13:24:13 stoecker Exp $
    66        Authors:        Dirk Stöcker
    77        Description:    state space approach for RTCM3
     
    573573    return GCOBR_SHORTBUFFER;
    574574
     575#ifdef DEBUG
     576fprintf(stderr, "GetClockOrbitBias START: size %d, numbits %d\n",size, numbits);
     577#endif
     578
    575579  G_HEADER(h)
    576580  G_RESERVEDH(rs)
     
    605609    co->OrbitDataSupplied |= 1;
    606610#ifdef DEBUG
    607 fprintf(stderr, "epochtime %d ui %d mmi %d sats %d\n",co->GPSEpochTime,co->UpdateInterval,mmi,co->NumberOfGPSSat);
     611fprintf(stderr, "epochtime %d ui %d mmi %d sats %d/%d\n",co->GPSEpochTime,
     612co->UpdateInterval,mmi,co->NumberOfGPSSat,nums);
    608613#endif
    609614    for(i = 0; i < nums; ++i)
     
    653658    G_NO_OF_SATELLITES(nums)
    654659    co->ClockDataSupplied |= 1;
     660#ifdef DEBUG
     661fprintf(stderr, "epochtime %d ui %d mmi %d sats %d/%d\n",co->GPSEpochTime,
     662co->UpdateInterval,mmi,co->NumberOfGPSSat,nums);
     663#endif
    655664    for(i = 0; i < nums; ++i)
    656665    {
     
    665674      G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
    666675      G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
     676#ifdef DEBUG
     677fprintf(stderr, "id %2d c0 %8.3f c1 %8.3f c2 %8.3f\n",
     678co->Sat[pos].ID, co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1,
     679co->Sat[pos].Clock.DeltaA2);
     680#endif
    667681    }
    668682    break;
     
    755769    G_NO_OF_SATELLITES(nums)
    756770    co->OrbitDataSupplied |= 2;
     771#ifdef DEBUG
     772fprintf(stderr, "epochtime %d ui %d mmi %d sats %d/%d\n",co->GLONASSEpochTime,
     773co->UpdateInterval,mmi,co->NumberOfGLONASSSat,nums);
     774#endif
    757775    for(i = 0; i < nums; ++i)
    758776    {
    759777      G_GLONASS_SATELLITE_ID(id)
    760       for(pos = CLOCKORBIT_NUMGPS; pos < co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
     778      for(pos = CLOCKORBIT_NUMGPS; pos < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
    761779        ;
    762780      if(pos >= CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS) return GCOBR_DATAMISMATCH;
    763       else if(pos == co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
     781      else if(pos == CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
    764782      co->Sat[pos].ID = id;
    765783
    766       G_GLONASS_SATELLITE_ID(co->Sat[pos].ID)
    767784      G_GLONASS_IOD(co->Sat[pos].IOD)
    768785      G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
     
    777794      G_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
    778795      G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
     796#ifdef DEBUG
     797fprintf(stderr, "id %2d iod %3d dr %8.3f da %8.3f dc %8.3f dr %8.3f da %8.3f dc %8.3f dr %8.3f da %8.3f dc %8.3f rp %d rd %d\n",
     798co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
     799co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
     800co->Sat[pos].Orbit.DotDeltaRadial,
     801co->Sat[pos].Orbit.DotDeltaAlongTrack,
     802co->Sat[pos].Orbit.DotDeltaCrossTrack,
     803co->Sat[pos].Orbit.DotDotDeltaRadial,
     804co->Sat[pos].Orbit.DotDotDeltaAlongTrack,
     805co->Sat[pos].Orbit.DotDotDeltaCrossTrack,
     806co->SatRefPoint,
     807co->SatRefDatum);
     808#endif
    779809    }
    780810    break;
     
    787817    G_NO_OF_SATELLITES(nums)
    788818    co->ClockDataSupplied |= 2;
     819#ifdef DEBUG
     820fprintf(stderr, "epochtime %d ui %d mmi %d sats %d/%d\n",co->GLONASSEpochTime,
     821co->UpdateInterval,mmi,co->NumberOfGLONASSSat,nums);
     822#endif
    789823    for(i = 0; i < nums; ++i)
    790824    {
    791825      G_GLONASS_SATELLITE_ID(id)
    792       for(pos = CLOCKORBIT_NUMGPS; pos < co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
     826      for(pos = CLOCKORBIT_NUMGPS; pos < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
    793827        ;
    794828      if(pos >= CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS) return GCOBR_DATAMISMATCH;
    795       else if(pos == co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
     829      else if(pos == CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
    796830      co->Sat[pos].ID = id;
    797831
     
    799833      G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
    800834      G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
     835#ifdef DEBUG
     836fprintf(stderr, "id %2d c0 %8.3f c1 %8.3f c2 %8.3f\n",
     837co->Sat[pos].ID, co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1,
     838co->Sat[pos].Clock.DeltaA2);
     839#endif
    801840    }
    802841    break;
     
    813852    {
    814853      G_GLONASS_SATELLITE_ID(id)
    815       for(pos = CLOCKORBIT_NUMGPS; pos < co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
     854      for(pos = CLOCKORBIT_NUMGPS; pos < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
    816855        ;
    817856      if(pos >= CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS) return GCOBR_DATAMISMATCH;
    818       else if(pos == co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
     857      else if(pos == CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
    819858      co->Sat[pos].ID = id;
    820859
     
    846885    {
    847886      G_GLONASS_SATELLITE_ID(id)
    848       for(pos = CLOCKORBIT_NUMGPS; pos < co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
     887      for(pos = CLOCKORBIT_NUMGPS; pos < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
    849888        ;
    850889      if(pos >= CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS) return GCOBR_DATAMISMATCH;
    851       else if(pos == co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
     890      else if(pos == CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
    852891      co->Sat[pos].ID = id;
    853892
     
    866905    {
    867906      G_GLONASS_SATELLITE_ID(id)
    868       for(pos = CLOCKORBIT_NUMGPS; pos < co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
     907      for(pos = CLOCKORBIT_NUMGPS; pos < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
    869908        ;
    870909      if(pos >= CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS) return GCOBR_DATAMISMATCH;
    871       else if(pos == co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
     910      else if(pos == CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
    872911      co->Sat[pos].ID = id;
    873912
     
    877916  case BTYPE_GPS:
    878917    if(!b) return GCOBR_NOBIASPARAMETER;
    879     G_GPS_EPOCH_TIME(b->GPSEpochTime, co->NumberOfGPSSat)
    880     G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     918    G_GPS_EPOCH_TIME(b->GPSEpochTime, b->NumberOfGPSSat)
     919    G_SSR_UPDATE_INTERVAL(b->UpdateInterval)
    881920    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    882921    G_RESERVED5
     
    885924    {
    886925      G_GPS_SATELLITE_ID(id)
    887       for(pos = 0; pos < co->NumberOfGPSSat && co->Sat[pos].ID != id; ++pos)
     926      for(pos = 0; pos < b->NumberOfGPSSat && b->Sat[pos].ID != id; ++pos)
    888927        ;
    889928      if(pos >= CLOCKORBIT_NUMGPS) return GCOBR_DATAMISMATCH;
    890       else if(pos == co->NumberOfGPSSat) ++co->NumberOfGPSSat;
    891       co->Sat[pos].ID = id;
     929      else if(pos == b->NumberOfGPSSat) ++b->NumberOfGPSSat;
     930      b->Sat[pos].ID = id;
    892931
    893932      G_NO_OF_CODE_BIASES(b->Sat[pos].NumberOfCodeBiases)
     
    901940  case BTYPE_GLONASS:
    902941    if(!b) return GCOBR_NOBIASPARAMETER;
    903     G_GPS_EPOCH_TIME(b->GLONASSEpochTime, co->NumberOfGLONASSSat)
    904     G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     942    G_GLONASS_EPOCH_TIME(b->GLONASSEpochTime, b->NumberOfGLONASSSat)
     943    G_SSR_UPDATE_INTERVAL(b->UpdateInterval)
    905944    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    906945    G_RESERVED5
     
    909948    {
    910949      G_GLONASS_SATELLITE_ID(id)
    911       for(pos = CLOCKORBIT_NUMGPS; pos < co->NumberOfGLONASSSat && co->Sat[pos].ID != id; ++pos)
     950      for(pos = CLOCKORBIT_NUMGPS; pos < b->NumberOfGLONASSSat && b->Sat[pos].ID != id; ++pos)
    912951        ;
    913952      if(pos >= CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS) return GCOBR_DATAMISMATCH;
    914       else if(pos == co->NumberOfGLONASSSat) ++co->NumberOfGLONASSSat;
    915       co->Sat[pos].ID = id;
     953      else if(pos == b->NumberOfGLONASSSat) ++b->NumberOfGLONASSSat;
     954      b->Sat[pos].ID = id;
    916955
    917956      G_NO_OF_CODE_BIASES(b->Sat[pos].NumberOfCodeBiases)
     
    924963    break;
    925964  default:
     965    if(bytesused)
     966      *bytesused = sizeofrtcmblock+6;
    926967    return GCOBR_UNKNOWNTYPE;
    927968  }
    928969#ifdef DEBUG
    929 for(type = 0; type < size && (unsigned char)buffer[type] != 0xD3; ++type)
     970for(type = 0; type < (int)size && (unsigned char)buffer[type] != 0xD3; ++type)
    930971  numbits += 8;
    931972fprintf(stderr, "numbits left %d\n",numbits);
  • trunk/clock_and_orbit/clock_orbit_rtcm.h

    r1840 r1842  
    66        Name:           clock_orbit_rtcm.h
    77        Project:        RTCM3
    8         Version:        $Id: clock_orbit_rtcm.h,v 1.9 2009/04/24 09:19:10 weber Exp $
     8        Version:        $Id: clock_orbit_rtcm.h,v 1.11 2009/05/14 13:24:13 stoecker Exp $
    99        Authors:        Dirk Stöcker
    1010        Description:    state space approach for RTCM3
     
    122122  GCOBR_UNKNOWNDATA = -2,
    123123  GCOBR_CRCMISMATCH = -3,
     124  GCOBR_SHORTMESSAGE = -4,
    124125  /* failed to do the work */
    125126  GCOBR_NOCLOCKORBITPARAMETER = -10,
     
    130131  /* not enough data - can decode the block completely */
    131132  GCOBR_SHORTBUFFER = -30,
    132   GCOBR_MISSINGBITS = -31,
    133   GCOBR_MESSAGEEXCEEDSBUFFER = -32,
    134   GCOBR_SHORTMESSAGE = -33
    135 };
     133  GCOBR_MESSAGEEXCEEDSBUFFER = -31};
    136134
    137135/* NOTE: When an error message has been emitted, the output structures may have been modified. Make a copy of the previous variant before calling the
Note: See TracChangeset for help on using the changeset viewer.