Changeset 1664 in ntrip for trunk/BNC/RTCM3


Ignore:
Timestamp:
Feb 27, 2009, 9:59:55 AM (16 years ago)
Author:
weber
Message:

* empty log message *

Location:
trunk/BNC/RTCM3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM3/clock_orbit_rtcm.c

    r1661 r1664  
    33        Name:           clock_orbit_rtcm.c
    44        Project:        RTCM3
    5         Version:        $Id: clock_orbit_rtcm.c,v 1.6 2009/02/04 08:19:20 mervart Exp $
     5        Version:        $Id: clock_orbit_rtcm.c,v 1.3 2009/02/12 11:56:16 stoecker Exp $
    66        Authors:        Dirk Stöcker
    77        Description:    state space approach for RTCM3
     
    1010#include <stdio.h>
    1111#include <string.h>
    12 
    13 #ifndef sparc
    1412#include <stdint.h>
    15 #endif
    16 
    17 #include <sys/types.h>
    1813#include "clock_orbit_rtcm.h"
    1914
     
    9085#define SCALEADDBITS(a, b, c) ADDBITS(a, (int64_t)(b*c))
    9186
    92 #if 0
    93 #define DEBUGSCALEADDBITS(n, a, b, c) \
    94   { \
    95     int64_t x = b*c, z; \
    96     uint64_t y; \
    97     y = (x&((1<<a)-1)); \
    98     z = ((int64_t)(y<<(64-a)))>>(64-a); \
    99     fprintf(stderr, "Type " # n " val %19.15f*%11.1f %16llX %16llX %16llX %s\n", \
    100     c, b, x, y, z, x != z ? "OVERFLOW" : "OK"); \
    101   } \
    102   SCALEADDBITS(a,b,c)
    103 #else
    104 #define DEBUGSCALEADDBITS(n, a, b, c) SCALEADDBITS(a,b,c)
    105 #endif
    106 
    10787/* standard values */
    10888#define T_MESSAGE_NUMBER(a)              ADDBITS(12, a) /* DF002 */
    109 #define T_RESERVED6                      ADDBITS(6, 0)  /* DF001 */
     89#define T_RESERVED5                      ADDBITS(5, 0)  /* DF001 */
    11090#define T_GPS_SATELLITE_ID(a)            ADDBITS(6, a)  /* DF068 */
    11191#define T_GPS_IODE(a)                    ADDBITS(8, a)  /* DF071 */
     
    11393
    11494/* defined values */
    115 #define T_MULTIPLE_MESSAGE_INDICATOR(a)  ADDBITS(1, a)
     95#define T_DELTA_RADIAL(a)                SCALEADDBITS(22, 10000.0, a)
     96#define T_DELTA_ALONG_TRACK(a)           SCALEADDBITS(22, 10000.0, a)
     97#define T_DELTA_CROSS_TRACK(a)           SCALEADDBITS(22, 10000.0, a)
     98#define T_DELTA_DOT_RADIAL(a)            SCALEADDBITS(21, 1000000.0, a)
     99#define T_DELTA_DOT_ALONG_TRACK(a)       SCALEADDBITS(21, 1000000.0, a)
     100#define T_DELTA_DOT_CROSS_TRACK(a)       SCALEADDBITS(21, 1000000.0, a)
     101#define T_DELTA_DOT_DOT_RADIAL(a)        SCALEADDBITS(27, 50000000.0, a)
     102#define T_DELTA_DOT_DOT_ALONG_TRACK(a)   SCALEADDBITS(27, 50000000.0, a)
     103#define T_DELTA_DOT_DOT_CROSS_TRACK(a)   SCALEADDBITS(27, 50000000.0, a)
     104#define T_SATELLITE_REFERENCE_POINT(a)   ADDBITS(1, a)
     105
     106#define T_SATELLITE_REFERENCE_DATUM(a)   ADDBITS(1, a)
     107#define T_DELTA_CLOCK_C0(a)              SCALEADDBITS(22, 10000.0, a)
     108#define T_DELTA_CLOCK_C1(a)              SCALEADDBITS(21, 1000000.0, a)
     109#define T_DELTA_CLOCK_C2(a)              SCALEADDBITS(27, 50000000.0, a)
     110#define T_NO_OF_CODE_BIASES(a)           ADDBITS(5, a)
     111#define T_GPS_SIGNAL_IDENTIFIER(a)       ADDBITS(5, a)
     112#define T_GLONASS_SIGNAL_IDENTIFIER(a)   ADDBITS(5, a)
     113#define T_GALILEO_SIGNAL_IDENTIFIER(a)   ADDBITS(5, a)
     114#define T_CODE_BIAS(a)                   SCALEADDBITS(14, 100.0, a)
     115#define T_GLONASS_SATELLITE_ID(a)        ADDBITS(5, a)
     116
    116117#define T_GPS_EPOCH_TIME(a)              ADDBITS(20, a)
    117118#define T_GLONASS_EPOCH_TIME(a)          ADDBITS(17, a)
    118 #define T_GLONASS_SATELLITE_ID(a)        ADDBITS(6, a)
    119 #define T_NO_OF_SATELLITES(a)            ADDBITS(5, a)
    120 #define T_SATELLITE_REFERENCE_POINT(a)   ADDBITS(1, a)
    121 #define T_SATELLITE_REFERENCE_DATUM(a)   ADDBITS(1, a)
    122 #define T_NO_OF_CODE_BIASES(a)           ADDBITS(5, a)
    123 #define T_GPS_CODE_TYPE(a)               ADDBITS(5, a)
    124 #define T_GLONASS_CODE_TYPE(a)           ADDBITS(5, a)
    125 
    126 /* yet undefined values */
    127 #define T_DELTA_RADIAL(a)                DEBUGSCALEADDBITS(dr, 20, 1000.0, a)
    128 #define T_DELTA_ALONG_TRACK(a)           DEBUGSCALEADDBITS(da, 20, 1000.0, a)
    129 #define T_DELTA_CROSS_TRACK(a)           DEBUGSCALEADDBITS(dc, 20, 1000.0, a)
    130 #define T_DELTA_DOT_RADIAL(a)            DEBUGSCALEADDBITS(Dr, 20, 100000.0, a)
    131 #define T_DELTA_DOT_ALONG_TRACK(a)       DEBUGSCALEADDBITS(Dr, 20, 100000.0, a)
    132 #define T_DELTA_DOT_CROSS_TRACK(a)       DEBUGSCALEADDBITS(Dr, 20, 100000.0, a)
    133 #define T_DELTA_DOT_DOT_RADIAL(a)        DEBUGSCALEADDBITS(DR, 20, 5000000.0, a)
    134 #define T_DELTA_DOT_DOT_ALONG_TRACK(a)   DEBUGSCALEADDBITS(DA, 20, 5000000.0, a)
    135 #define T_DELTA_DOT_DOT_CROSS_TRACK(a)   DEBUGSCALEADDBITS(DC, 20, 5000000.0, a)
    136 #define T_DELTA_A0(a)                    DEBUGSCALEADDBITS(A0, 20, 1000.0, a)
    137 #define T_DELTA_A1(a)                    DEBUGSCALEADDBITS(A1, 20, 100000.0, a)
    138 #define T_DELTA_A2(a)                    DEBUGSCALEADDBITS(A2, 20, 5000000.0, a)
    139 #define T_CODE_BIAS(a)                   DEBUGSCALEADDBITS(CB, 20, 100.0, a)
     119#define T_NO_OF_SATELLITES(a)            ADDBITS(6, a)
     120#define T_MULTIPLE_MESSAGE_INDICATOR(a)  ADDBITS(1, a)
     121#define T_SSR_URA(a)                     ADDBITS(4, a)
     122#define T_HR_CLOCK_CORRECTION(a)         SCALEADDBITS(22, 10000.0, a)
     123#define T_SSR_UPDATE_INTERVAL(a)         ADDBITS(4, a)
    140124
    141125size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
    142126int moremessagesfollow, char *buffer, size_t size)
    143127{
    144   int gpsor=0, gpscl=0, gpsco=0, gloor=0, glocl=0, gloco=0, mmi, i;
     128  int gpshr=0, gpsur=0, gpsor=0, gpscl=0, gpsco=0, glohr=0, glour=0, gloor=0,
     129  glocl=0, gloco=0, mmi, i;
    145130  STARTDATA
    146131
     132  if(co->NumberOfGPSSat && co->HRDataSupplied
     133  && (type == COTYPE_AUTO || type == COTYPE_GPSHR))
     134    gpshr = 1;
     135  if(co->NumberOfGPSSat && co->URADataSupplied
     136  && (type == COTYPE_AUTO || type == COTYPE_GPSURA))
     137    gpsur = 1;
    147138  if(co->NumberOfGPSSat && co->OrbitDataSupplied
    148139  && (type == COTYPE_AUTO || type == COTYPE_GPSORBIT))
     
    156147    gpsco = 1; gpsor = 0; gpscl = 0;
    157148  }
     149  if(co->NumberOfGLONASSSat && co->HRDataSupplied
     150  && (type == COTYPE_AUTO || type == COTYPE_GLONASSHR))
     151    glohr = 1;
     152  if(co->NumberOfGLONASSSat && co->URADataSupplied
     153  && (type == COTYPE_AUTO || type == COTYPE_GLONASSURA))
     154    glour = 1;
    158155  if(co->NumberOfGLONASSSat && co->OrbitDataSupplied
    159156  && (type == COTYPE_AUTO || type == COTYPE_GLONASSORBIT))
     
    168165  }
    169166
    170   mmi = gpsor+gpscl+gpsco+gloor+glocl+gloco; /* required for multimessage */
     167  mmi = gpshr+gpsur+gpsor+gpscl+gpsco+glohr+glour+gloor+glocl+gloco; /* required for multimessage */
    171168  if(!moremessagesfollow) --mmi;
    172169
     
    176173    T_MESSAGE_NUMBER(COTYPE_GPSORBIT)
    177174    T_GPS_EPOCH_TIME(co->GPSEpochTime)
    178     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    179     --mmi;
    180     T_RESERVED6
     175    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     176    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     177    --mmi;
     178    T_RESERVED5
    181179    T_NO_OF_SATELLITES(co->NumberOfGPSSat)
    182180    for(i = 0; i < co->NumberOfGPSSat; ++i)
     
    203201    T_MESSAGE_NUMBER(COTYPE_GPSCLOCK)
    204202    T_GPS_EPOCH_TIME(co->GPSEpochTime)
    205     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    206     --mmi;
    207     T_RESERVED6
     203    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     204    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     205    --mmi;
     206    T_RESERVED5
    208207    T_NO_OF_SATELLITES(co->NumberOfGPSSat)
    209208    for(i = 0; i < co->NumberOfGPSSat; ++i)
    210209    {
    211210      T_GPS_SATELLITE_ID(co->Sat[i].ID)
    212       T_GPS_IODE(co->Sat[i].IOD)
    213       T_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    214       T_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    215       T_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     211      T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     212      T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     213      T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
    216214    }
    217215    ENDBLOCK
     
    222220    T_MESSAGE_NUMBER(COTYPE_GPSCOMBINED)
    223221    T_GPS_EPOCH_TIME(co->GPSEpochTime)
    224     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    225     --mmi;
    226     T_RESERVED6
     222    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     223    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     224    --mmi;
     225    T_RESERVED5
    227226    T_NO_OF_SATELLITES(co->NumberOfGPSSat)
    228227    for(i = 0; i < co->NumberOfGPSSat; ++i)
     
    241240      T_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
    242241      T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
    243       T_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    244       T_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    245       T_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     242      T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     243      T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     244      T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
     245    }
     246    ENDBLOCK
     247  }
     248  if(gpshr)
     249  {
     250    INITBLOCK
     251    T_MESSAGE_NUMBER(COTYPE_GPSHR)
     252    T_GPS_EPOCH_TIME(co->GPSEpochTime)
     253    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     254    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     255    --mmi;
     256    T_RESERVED5
     257    T_NO_OF_SATELLITES(co->NumberOfGPSSat)
     258    for(i = 0; i < co->NumberOfGPSSat; ++i)
     259    {
     260      T_GPS_SATELLITE_ID(co->Sat[i].ID)
     261      T_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
     262    }
     263    ENDBLOCK
     264  }
     265  if(gpsur)
     266  {
     267    INITBLOCK
     268    T_MESSAGE_NUMBER(COTYPE_GPSURA)
     269    T_GPS_EPOCH_TIME(co->GPSEpochTime)
     270    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     271    --mmi;
     272    T_RESERVED5
     273    T_NO_OF_SATELLITES(co->NumberOfGPSSat)
     274    for(i = 0; i < co->NumberOfGPSSat; ++i)
     275    {
     276      T_GPS_SATELLITE_ID(co->Sat[i].ID)
     277      T_SSR_URA(co->Sat[i].URA)
    246278    }
    247279    ENDBLOCK
     
    252284    T_MESSAGE_NUMBER(COTYPE_GLONASSORBIT)
    253285    T_GLONASS_EPOCH_TIME(co->GLONASSEpochTime)
    254     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    255     --mmi;
    256     T_RESERVED6
     286    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     287    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     288    --mmi;
     289    T_RESERVED5
    257290    T_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
    258291    for(i = CLOCKORBIT_NUMGPS;
     
    280313    T_MESSAGE_NUMBER(COTYPE_GLONASSCLOCK)
    281314    T_GLONASS_EPOCH_TIME(co->GLONASSEpochTime)
    282     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    283     --mmi;
    284     T_RESERVED6
     315    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     316    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     317    --mmi;
     318    T_RESERVED5
    285319    T_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
    286320    for(i = CLOCKORBIT_NUMGPS;
     
    289323      T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
    290324      T_GLONASS_IOD(co->Sat[i].IOD)
    291       T_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    292       T_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    293       T_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     325      T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     326      T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     327      T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
    294328    }
    295329    ENDBLOCK
     
    300334    T_MESSAGE_NUMBER(COTYPE_GLONASSCOMBINED)
    301335    T_GLONASS_EPOCH_TIME(co->GLONASSEpochTime)
    302     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    303     --mmi;
    304     T_RESERVED6
     336    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     337    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     338    --mmi;
     339    T_RESERVED5
    305340    T_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
    306341    for(i = CLOCKORBIT_NUMGPS;
     
    320355      T_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
    321356      T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
    322       T_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    323       T_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    324       T_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     357      T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     358      T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     359      T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
     360    }
     361    ENDBLOCK
     362  }
     363  if(glohr)
     364  {
     365    INITBLOCK
     366    T_MESSAGE_NUMBER(COTYPE_GLONASSHR)
     367    T_GLONASS_EPOCH_TIME(co->GLONASSEpochTime)
     368    T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     369    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     370    --mmi;
     371    T_RESERVED5
     372    T_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
     373    for(i = CLOCKORBIT_NUMGPS;
     374    i < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat; ++i)
     375    {
     376      T_GPS_SATELLITE_ID(co->Sat[i].ID)
     377      T_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
     378    }
     379    ENDBLOCK
     380  }
     381  if(glour)
     382  {
     383    INITBLOCK
     384    T_MESSAGE_NUMBER(COTYPE_GLONASSURA)
     385    T_GLONASS_EPOCH_TIME(co->GLONASSEpochTime)
     386    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     387    --mmi;
     388    T_RESERVED5
     389    T_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
     390    for(i = CLOCKORBIT_NUMGPS;
     391    i < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat; ++i)
     392    {
     393      T_GPS_SATELLITE_ID(co->Sat[i].ID)
     394      T_SSR_URA(co->Sat[i].URA)
    325395    }
    326396    ENDBLOCK
     
    333403int moremessagesfollow, char *buffer, size_t size)
    334404{
    335   int gps = 0;
    336   int glo = 0;
    337   int mmi, i, j;
     405  int gps, glo, mmi, i, j;
    338406  STARTDATA
    339407
     
    351419    T_MESSAGE_NUMBER(BTYPE_GPS)
    352420    T_GPS_EPOCH_TIME(b->GPSEpochTime)
    353     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    354     --mmi;
    355     T_RESERVED6
     421    T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
     422    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     423    --mmi;
     424    T_RESERVED5
    356425    T_NO_OF_SATELLITES(b->NumberOfGPSSat)
    357426    for(i = 0; i < b->NumberOfGPSSat; ++i)
     
    361430      for(j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j)
    362431      {
    363         T_GPS_CODE_TYPE(b->Sat[i].Biases[j].Type)
     432        T_GPS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
    364433        T_CODE_BIAS(b->Sat[i].Biases[j].Bias)
    365434      }
     
    372441    T_MESSAGE_NUMBER(BTYPE_GLONASS)
    373442    T_GPS_EPOCH_TIME(b->GLONASSEpochTime)
    374     T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
    375     --mmi;
    376     T_RESERVED6
     443    T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
     444    T_MULTIPLE_MESSAGE_INDICATOR(mmi ? 1 :0)
     445    --mmi;
     446    T_RESERVED5
    377447    T_NO_OF_SATELLITES(b->NumberOfGLONASSSat)
    378448    for(i = CLOCKORBIT_NUMGPS;
     
    383453      for(j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j)
    384454      {
    385         T_GLONASS_CODE_TYPE(b->Sat[i].Biases[j].Type)
     455        T_GLONASS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
    386456        T_CODE_BIAS(b->Sat[i].Biases[j].Bias)
    387457      }
     
    392462  return ressize;
    393463}
     464
    394465#endif /* NOENCODE */
    395466
     
    435506#define G_SIZE(a)                        GETBITS(a, 10)
    436507#define G_MESSAGE_NUMBER(a)              GETBITS(a, 12) /* DF002 */
    437 #define G_RESERVED6                      SKIPBITS(6)    /* DF001 */
     508#define G_RESERVED5                      SKIPBITS(5)    /* DF001 */
    438509#define G_GPS_SATELLITE_ID(a)            {int temp; GETBITS(temp, 6) \
    439510 if(a && a != temp) return GCOBR_DATAMISMATCH; a = temp;}  /* DF068 */
     
    442513
    443514/* defined values */
    444 #define G_MULTIPLE_MESSAGE_INDICATOR(a)  GETBITS(a, 1)
     515#define G_DELTA_RADIAL(a)                GETFLOATSIGN(a, 22, 1/10000.0)
     516#define G_DELTA_ALONG_TRACK(a)           GETFLOATSIGN(a, 22, 1/10000.0)
     517#define G_DELTA_CROSS_TRACK(a)           GETFLOATSIGN(a, 22, 1/10000.0)
     518#define G_DELTA_DOT_RADIAL(a)            GETFLOATSIGN(a, 21, 1/1000000.0)
     519#define G_DELTA_DOT_ALONG_TRACK(a)       GETFLOATSIGN(a, 21, 1/1000000.0)
     520#define G_DELTA_DOT_CROSS_TRACK(a)       GETFLOATSIGN(a, 21, 1/1000000.0)
     521#define G_DELTA_DOT_DOT_RADIAL(a)        GETFLOATSIGN(a, 27, 1/50000000.0)
     522#define G_DELTA_DOT_DOT_ALONG_TRACK(a)   GETFLOATSIGN(a, 27, 1/50000000.0)
     523#define G_DELTA_DOT_DOT_CROSS_TRACK(a)   GETFLOATSIGN(a, 27, 1/50000000.0)
     524#define G_SATELLITE_REFERENCE_POINT(a)   GETBITS(a, 1)
     525
     526#define G_SATELLITE_REFERENCE_DATUM(a)   GETBITS(a, 1)
     527#define G_DELTA_CLOCK_C0(a)              GETFLOATSIGN(a, 22, 1/10000.0)
     528#define G_DELTA_CLOCK_C1(a)              GETFLOATSIGN(a, 21, 1/1000000.0)
     529#define G_DELTA_CLOCK_C2(a)              GETFLOATSIGN(a, 27, 1/50000000.0)
     530#define G_NO_OF_CODE_BIASES(a)           GETBITS(a, 5)
     531#define G_GPS_SIGNAL_IDENTIFIER(a)       GETBITS(a, 5)
     532#define G_GLONASS_SIGNAL_IDENTIFIER(a)   GETBITS(a, 5)
     533#define G_GALILEO_SIGNAL_IDENTIFIER(a)   GETBITS(a, 5)
     534#define G_CODE_BIAS(a)                   GETFLOATSIGN(a, 14, 1/100.0)
     535#define G_GLONASS_SATELLITE_ID(a)        {int temp; GETBITS(temp, 5) \
     536 if(a && a != temp) return GCOBR_DATAMISMATCH; a = temp;}
     537
    445538#define G_GPS_EPOCH_TIME(a, b)           {int temp; GETBITS(temp, 20) \
    446539 if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;}
    447540#define G_GLONASS_EPOCH_TIME(a, b)       {int temp; GETBITS(temp, 17) \
    448541 if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;}
    449 #define G_GLONASS_SATELLITE_ID(a)        {int temp; GETBITS(temp, 6) \
     542#define G_NO_OF_SATELLITES(a)            {int temp; GETBITS(temp, 6) \
    450543 if(a && a != temp) return GCOBR_DATAMISMATCH; a = temp;}
    451 #define G_NO_OF_SATELLITES(a)            {int temp; GETBITS(temp, 5) \
     544#define G_MULTIPLE_MESSAGE_INDICATOR(a)  GETBITS(a, 1)
     545#define G_SSR_URA(a)                     GETBITS(a, 4)
     546#define G_HR_CLOCK_CORRECTION(a)         GETFLOATSIGN(a, 22, 1/10000.0)
     547#define G_SSR_UPDATE_INTERVAL(a)         GETBITS(a, 4)
     548
     549#ifdef OLD
     550enum OldClockOrbitType { OLDCOTYPE_GPSORBIT=4050, OLDCOTYPE_GPSCLOCK=4051,
     551     OLDCOTYPE_GLONASSORBIT=4053, OLDCOTYPE_GLONASSCLOCK=4054,
     552     OLDCOTYPE_GPSCOMBINED=4056, OLDCOTYPE_GLONASSCOMBINED=4057};
     553enum OldBiasType { OLDBTYPE_GPS=4052, OLDBTYPE_GLONASS=4055};
     554#define OLD_G_RESERVED6                      SKIPBITS(6)    /* DF001 */
     555#define OLD_G_GLONASS_SATELLITE_ID(a)        {int temp; GETBITS(temp, 6) \
    452556 if(a && a != temp) return GCOBR_DATAMISMATCH; a = temp;}
    453 #define G_SATELLITE_REFERENCE_POINT(a)   GETBITS(a, 1)
    454 #define G_SATELLITE_REFERENCE_DATUM(a)   GETBITS(a, 1)
    455 #define G_NO_OF_CODE_BIASES(a)           GETBITS(a, 5)
    456 #define G_GPS_CODE_TYPE(a)               GETBITS(a, 5)
    457 #define G_GLONASS_CODE_TYPE(a)           GETBITS(a, 5)
    458 
    459 /* yet undefined values */
    460 #define G_DELTA_RADIAL(a)                GETFLOATSIGN(a, 20, 1/1000.0)
    461 #define G_DELTA_ALONG_TRACK(a)           GETFLOATSIGN(a, 20, 1/1000.0)
    462 #define G_DELTA_CROSS_TRACK(a)           GETFLOATSIGN(a, 20, 1/1000.0)
    463 #define G_DELTA_DOT_RADIAL(a)            GETFLOATSIGN(a, 20, 1/100000.0)
    464 #define G_DELTA_DOT_ALONG_TRACK(a)       GETFLOATSIGN(a, 20, 1/100000.0)
    465 #define G_DELTA_DOT_CROSS_TRACK(a)       GETFLOATSIGN(a, 20, 1/100000.0)
    466 #define G_DELTA_DOT_DOT_RADIAL(a)        GETFLOATSIGN(a, 20, 1/5000000.0)
    467 #define G_DELTA_DOT_DOT_ALONG_TRACK(a)   GETFLOATSIGN(a, 20, 1/5000000.0)
    468 #define G_DELTA_DOT_DOT_CROSS_TRACK(a)   GETFLOATSIGN(a, 20, 1/5000000.0)
    469 #define G_DELTA_A0(a)                    GETFLOATSIGN(a, 20, 1/1000.0)
    470 #define G_DELTA_A1(a)                    GETFLOATSIGN(a, 20, 1/100000.0)
    471 #define G_DELTA_A2(a)                    GETFLOATSIGN(a, 20, 1/5000000.0)
    472 #define G_CODE_BIAS(a)                   GETFLOATSIGN(a, 20, 1/100.0)
     557#define OLD_G_NO_OF_SATELLITES(a)            {int temp; GETBITS(temp, 5) \
     558 if(a && a != temp) return GCOBR_DATAMISMATCH; a = temp;}
     559#define OLD_G_DELTA_RADIAL(a)                GETFLOATSIGN(a, 20, 1/1000.0)
     560#define OLD_G_DELTA_ALONG_TRACK(a)           GETFLOATSIGN(a, 20, 1/1000.0)
     561#define OLD_G_DELTA_CROSS_TRACK(a)           GETFLOATSIGN(a, 20, 1/1000.0)
     562#define OLD_G_DELTA_DOT_RADIAL(a)            GETFLOATSIGN(a, 20, 1/100000.0)
     563#define OLD_G_DELTA_DOT_ALONG_TRACK(a)       GETFLOATSIGN(a, 20, 1/100000.0)
     564#define OLD_G_DELTA_DOT_CROSS_TRACK(a)       GETFLOATSIGN(a, 20, 1/100000.0)
     565#define OLD_G_DELTA_DOT_DOT_RADIAL(a)        GETFLOATSIGN(a, 20, 1/5000000.0)
     566#define OLD_G_DELTA_DOT_DOT_ALONG_TRACK(a)   GETFLOATSIGN(a, 20, 1/5000000.0)
     567#define OLD_G_DELTA_DOT_DOT_CROSS_TRACK(a)   GETFLOATSIGN(a, 20, 1/5000000.0)
     568#define OLD_G_DELTA_A0(a)                    GETFLOATSIGN(a, 20, 1/1000.0)
     569#define OLD_G_DELTA_A1(a)                    GETFLOATSIGN(a, 20, 1/100000.0)
     570#define OLD_G_DELTA_A2(a)                    GETFLOATSIGN(a, 20, 1/5000000.0)
     571#define OLD_G_CODE_BIAS(a)                   GETFLOATSIGN(a, 20, 1/100.0)
     572#endif
    473573
    474574enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
     
    502602    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
    503603    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
    504     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    505     G_RESERVED6
     604    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     605    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     606    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     607    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     608    G_RESERVED5
    506609    G_NO_OF_SATELLITES(co->NumberOfGPSSat)
    507610    if(co->OrbitDataSupplied)
     
    528631    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
    529632    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
    530     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    531     G_RESERVED6
     633    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     634    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     635    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     636    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     637    G_RESERVED5
    532638    G_NO_OF_SATELLITES(co->NumberOfGPSSat)
    533639    if(co->ClockDataSupplied)
     
    537643    {
    538644      G_GPS_SATELLITE_ID(co->Sat[i].ID)
    539       G_GPS_IODE(co->Sat[i].IOD)
    540       G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    541       G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    542       G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     645      G_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     646      G_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     647      G_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
    543648    }
    544649    break;
     
    546651    if(!co) return -5;
    547652    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
    548     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    549     G_RESERVED6
     653    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     654    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     655    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     656    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     657    G_RESERVED5
    550658    G_NO_OF_SATELLITES(co->NumberOfGPSSat)
    551659    if(co->ClockDataSupplied || co->OrbitDataSupplied)
     
    568676      G_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
    569677      G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
    570       G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    571       G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    572       G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     678      G_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     679      G_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     680      G_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
     681    }
     682    break;
     683  case COTYPE_GPSURA:
     684    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     685    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
     686    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     687    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     688    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     689    G_RESERVED5
     690    G_NO_OF_SATELLITES(co->NumberOfGPSSat)
     691    if(co->URADataSupplied)
     692      return GCOBR_DATAMISMATCH;
     693    co->URADataSupplied = 1;
     694    for(i = 0; i < co->NumberOfGPSSat; ++i)
     695    {
     696      G_GPS_SATELLITE_ID(co->Sat[i].ID)
     697      G_SSR_URA(co->Sat[i].URA)
     698    }
     699    break;
     700  case COTYPE_GPSHR:
     701    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     702    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
     703    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     704    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     705    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     706    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     707    G_RESERVED5
     708    G_NO_OF_SATELLITES(co->NumberOfGPSSat)
     709    if(co->HRDataSupplied)
     710      return GCOBR_DATAMISMATCH;
     711    co->HRDataSupplied = 1;
     712    for(i = 0; i < co->NumberOfGPSSat; ++i)
     713    {
     714      G_GPS_SATELLITE_ID(co->Sat[i].ID)
     715      G_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
    573716    }
    574717    break;
     
    576719    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
    577720    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
    578     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    579     G_RESERVED6
     721    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     722    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     723    G_RESERVED5
    580724    G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
    581725    if(co->OrbitDataSupplied)
     
    603747    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
    604748    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
    605     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    606     G_RESERVED6
     749    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     750    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     751    G_RESERVED5
    607752    G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
    608753    if(co->ClockDataSupplied)
     
    613758    {
    614759      G_GLONASS_SATELLITE_ID(co->Sat[i].ID)
    615       G_GLONASS_IOD(co->Sat[i].IOD)
    616       G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    617       G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    618       G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     760      G_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     761      G_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     762      G_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
    619763    }
    620764    break;
     
    622766    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
    623767    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
    624     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    625     G_RESERVED6
     768    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     769    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     770    G_RESERVED5
    626771    G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
    627772    if(co->ClockDataSupplied || co->OrbitDataSupplied)
     
    645790      G_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
    646791      G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
    647       G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
    648       G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
    649       G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     792      G_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
     793      G_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
     794      G_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
     795    }
     796    break;
     797  case COTYPE_GLONASSURA:
     798    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     799    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
     800    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     801    G_RESERVED5
     802    G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
     803    if(co->URADataSupplied)
     804      return GCOBR_DATAMISMATCH;
     805    co->URADataSupplied = 1;
     806    for(i = CLOCKORBIT_NUMGPS;
     807    i < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat; ++i)
     808    {
     809      G_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     810      G_SSR_URA(co->Sat[i].URA)
     811    }
     812    break;
     813  case COTYPE_GLONASSHR:
     814    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     815    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
     816    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     817    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     818    G_RESERVED5
     819    G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
     820    if(co->HRDataSupplied)
     821      return GCOBR_DATAMISMATCH;
     822    co->HRDataSupplied = 1;
     823    for(i = CLOCKORBIT_NUMGPS;
     824    i < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat; ++i)
     825    {
     826      G_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     827      G_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
    650828    }
    651829    break;
     
    653831    if(!b) return GCOBR_NOBIASPARAMETER;
    654832    G_GPS_EPOCH_TIME(b->GPSEpochTime, co->NumberOfGPSSat)
    655     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    656     G_RESERVED6
     833    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     834    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     835    G_RESERVED5
    657836    G_NO_OF_SATELLITES(b->NumberOfGPSSat)
    658837    for(i = 0; i < b->NumberOfGPSSat; ++i)
     
    662841      for(j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j)
    663842      {
    664         G_GPS_CODE_TYPE(b->Sat[i].Biases[j].Type)
     843        G_GPS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
    665844        G_CODE_BIAS(b->Sat[i].Biases[j].Bias)
    666845      }
     
    670849    if(!b) return GCOBR_NOBIASPARAMETER;
    671850    G_GPS_EPOCH_TIME(b->GLONASSEpochTime, co->NumberOfGLONASSSat)
    672     G_MULTIPLE_MESSAGE_INDICATOR(mmi)
    673     G_RESERVED6
     851    G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
     852    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     853    G_RESERVED5
    674854    G_NO_OF_SATELLITES(b->NumberOfGLONASSSat)
    675855    for(i = CLOCKORBIT_NUMGPS;
     
    680860      for(j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j)
    681861      {
    682         G_GLONASS_CODE_TYPE(b->Sat[i].Biases[j].Type)
     862        G_GLONASS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
    683863        G_CODE_BIAS(b->Sat[i].Biases[j].Bias)
    684864      }
    685865    }
    686866    break;
     867#ifdef OLD
     868  case OLDCOTYPE_GPSORBIT:
     869    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     870    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
     871    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     872    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     873    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     874    OLD_G_RESERVED6
     875    OLD_G_NO_OF_SATELLITES(co->NumberOfGPSSat)
     876    if(co->OrbitDataSupplied)
     877      return GCOBR_DATAMISMATCH;
     878    co->OrbitDataSupplied = 1;
     879    for(i = 0; i < co->NumberOfGPSSat; ++i)
     880    {
     881      G_GPS_SATELLITE_ID(co->Sat[i].ID)
     882      G_GPS_IODE(co->Sat[i].IOD)
     883      OLD_G_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
     884      OLD_G_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
     885      OLD_G_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
     886      OLD_G_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
     887      OLD_G_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
     888      OLD_G_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
     889      OLD_G_DELTA_DOT_DOT_RADIAL(co->Sat[i].Orbit.DotDotDeltaRadial)
     890      OLD_G_DELTA_DOT_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDotDeltaAlongTrack)
     891      OLD_G_DELTA_DOT_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDotDeltaCrossTrack)
     892      G_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
     893      G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
     894    }
     895    break;
     896  case OLDCOTYPE_GPSCLOCK:
     897    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     898    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
     899    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     900    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     901    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     902    OLD_G_RESERVED6
     903    OLD_G_NO_OF_SATELLITES(co->NumberOfGPSSat)
     904    if(co->ClockDataSupplied)
     905      return GCOBR_DATAMISMATCH;
     906    co->ClockDataSupplied = 1;
     907    for(i = 0; i < co->NumberOfGPSSat; ++i)
     908    {
     909      G_GPS_SATELLITE_ID(co->Sat[i].ID)
     910      G_GPS_IODE(co->Sat[i].IOD)
     911      OLD_G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
     912      OLD_G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
     913      OLD_G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     914    }
     915    break;
     916  case OLDCOTYPE_GPSCOMBINED:
     917    if(!co) return -5;
     918    G_GPS_EPOCH_TIME(co->GPSEpochTime, co->NumberOfGPSSat)
     919    co->epochGPS[co->epochSize] = co->GPSEpochTime;   /* Weber, for latency */
     920    if(co->epochSize < 100) {co->epochSize += 1;}     /* Weber, for latency */
     921    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     922    OLD_G_RESERVED6
     923    OLD_G_NO_OF_SATELLITES(co->NumberOfGPSSat)
     924    if(co->ClockDataSupplied || co->OrbitDataSupplied)
     925      return GCOBR_DATAMISMATCH;
     926    co->OrbitDataSupplied = 1;
     927    co->ClockDataSupplied = 1;
     928    for(i = 0; i < co->NumberOfGPSSat; ++i)
     929    {
     930      G_GPS_SATELLITE_ID(co->Sat[i].ID)
     931      G_GPS_IODE(co->Sat[i].IOD)
     932      OLD_G_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
     933      OLD_G_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
     934      OLD_G_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
     935      OLD_G_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
     936      OLD_G_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
     937      OLD_G_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
     938      OLD_G_DELTA_DOT_DOT_RADIAL(co->Sat[i].Orbit.DotDotDeltaRadial)
     939      OLD_G_DELTA_DOT_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDotDeltaAlongTrack)
     940      OLD_G_DELTA_DOT_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDotDeltaCrossTrack)
     941      G_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
     942      G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
     943      OLD_G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
     944      OLD_G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
     945      OLD_G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     946    }
     947    break;
     948  case OLDCOTYPE_GLONASSORBIT:
     949    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     950    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
     951    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     952    OLD_G_RESERVED6
     953    OLD_G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
     954    if(co->OrbitDataSupplied)
     955      return GCOBR_DATAMISMATCH;
     956    co->OrbitDataSupplied = 1;
     957    for(i = CLOCKORBIT_NUMGPS;
     958    i < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat; ++i)
     959    {
     960      OLD_G_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     961      G_GLONASS_IOD(co->Sat[i].IOD)
     962      OLD_G_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
     963      OLD_G_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
     964      OLD_G_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
     965      OLD_G_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
     966      OLD_G_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
     967      OLD_G_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
     968      OLD_G_DELTA_DOT_DOT_RADIAL(co->Sat[i].Orbit.DotDotDeltaRadial)
     969      OLD_G_DELTA_DOT_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDotDeltaAlongTrack)
     970      OLD_G_DELTA_DOT_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDotDeltaCrossTrack)
     971      G_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
     972      G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
     973    }
     974    break;
     975  case OLDCOTYPE_GLONASSCLOCK:
     976    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     977    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
     978    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     979    OLD_G_RESERVED6
     980    OLD_G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
     981    if(co->ClockDataSupplied)
     982      return GCOBR_DATAMISMATCH;
     983    co->ClockDataSupplied = 1;
     984    for(i = CLOCKORBIT_NUMGPS;
     985    i < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat; ++i)
     986    {
     987      OLD_G_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     988      G_GLONASS_IOD(co->Sat[i].IOD)
     989      OLD_G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
     990      OLD_G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
     991      OLD_G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     992    }
     993    break;
     994  case OLDCOTYPE_GLONASSCOMBINED:
     995    if(!co) return GCOBR_NOCLOCKORBITPARAMETER;
     996    G_GLONASS_EPOCH_TIME(co->GLONASSEpochTime, co->NumberOfGLONASSSat)
     997    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     998    OLD_G_RESERVED6
     999    OLD_G_NO_OF_SATELLITES(co->NumberOfGLONASSSat)
     1000    if(co->ClockDataSupplied || co->OrbitDataSupplied)
     1001      return GCOBR_DATAMISMATCH;
     1002    co->OrbitDataSupplied = 1;
     1003    co->ClockDataSupplied = 1;
     1004    for(i = CLOCKORBIT_NUMGPS;
     1005    i < CLOCKORBIT_NUMGPS+co->NumberOfGLONASSSat; ++i)
     1006    {
     1007      OLD_G_GLONASS_SATELLITE_ID(co->Sat[i].ID)
     1008      G_GLONASS_IOD(co->Sat[i].IOD)
     1009      OLD_G_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
     1010      OLD_G_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
     1011      OLD_G_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
     1012      OLD_G_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
     1013      OLD_G_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
     1014      OLD_G_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
     1015      OLD_G_DELTA_DOT_DOT_RADIAL(co->Sat[i].Orbit.DotDotDeltaRadial)
     1016      OLD_G_DELTA_DOT_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDotDeltaAlongTrack)
     1017      OLD_G_DELTA_DOT_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDotDeltaCrossTrack)
     1018      G_SATELLITE_REFERENCE_POINT(co->SatRefPoint)
     1019      G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
     1020      OLD_G_DELTA_A0(co->Sat[i].Clock.DeltaA0)
     1021      OLD_G_DELTA_A1(co->Sat[i].Clock.DeltaA1)
     1022      OLD_G_DELTA_A2(co->Sat[i].Clock.DeltaA2)
     1023    }
     1024    break;
     1025  case OLDBTYPE_GPS:
     1026    if(!b) return GCOBR_NOBIASPARAMETER;
     1027    G_GPS_EPOCH_TIME(b->GPSEpochTime, co->NumberOfGPSSat)
     1028    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     1029    OLD_G_RESERVED6
     1030    OLD_G_NO_OF_SATELLITES(b->NumberOfGPSSat)
     1031    for(i = 0; i < b->NumberOfGPSSat; ++i)
     1032    {
     1033      G_GPS_SATELLITE_ID(b->Sat[i].ID)
     1034      G_NO_OF_CODE_BIASES(b->Sat[i].NumberOfCodeBiases)
     1035      for(j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j)
     1036      {
     1037        G_GPS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
     1038        OLD_G_CODE_BIAS(b->Sat[i].Biases[j].Bias)
     1039      }
     1040    }
     1041    break;
     1042  case OLDBTYPE_GLONASS:
     1043    if(!b) return GCOBR_NOBIASPARAMETER;
     1044    G_GPS_EPOCH_TIME(b->GLONASSEpochTime, co->NumberOfGLONASSSat)
     1045    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
     1046    OLD_G_RESERVED6
     1047    OLD_G_NO_OF_SATELLITES(b->NumberOfGLONASSSat)
     1048    for(i = CLOCKORBIT_NUMGPS;
     1049    i < CLOCKORBIT_NUMGPS+b->NumberOfGLONASSSat; ++i)
     1050    {
     1051      OLD_G_GLONASS_SATELLITE_ID(b->Sat[i].ID)
     1052      G_NO_OF_CODE_BIASES(b->Sat[i].NumberOfCodeBiases)
     1053      for(j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j)
     1054      {
     1055        G_GLONASS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
     1056        OLD_G_CODE_BIAS(b->Sat[i].Biases[j].Bias)
     1057      }
     1058    }
     1059    break;
     1060#endif
    6871061  default:
    6881062    return GCOBR_UNKNOWNTYPE;
  • trunk/BNC/RTCM3/clock_orbit_rtcm.h

    r1661 r1664  
    66        Name:           clock_orbit_rtcm.h
    77        Project:        RTCM3
    8         Version:        $Id: clock_orbit_rtcm.h,v 1.4 2009/02/04 08:19:20 mervart Exp $
     8        Version:        $Id: clock_orbit_rtcm.h,v 1.3 2009/02/12 11:56:16 stoecker Exp $
    99        Authors:        Dirk Stöcker
    1010        Description:    state space approach for RTCM3
     
    1515enum SatelliteReferenceDatum { DATUM_ITRF=0, DATUM_LOCAL=1 };
    1616enum SatelliteReferencePoint { POINT_IONOFREE=0, POINT_CENTER=1 };
    17 enum ClockOrbitType { COTYPE_GPSORBIT=4050, COTYPE_GPSCLOCK=4051,
    18      COTYPE_GLONASSORBIT=4053, COTYPE_GLONASSCLOCK=4054,
    19      COTYPE_GPSCOMBINED=4056, COTYPE_GLONASSCOMBINED=4057,
     17enum ClockOrbitType {
     18     COTYPE_GPSORBIT=4060, COTYPE_GPSCLOCK=4061,
     19     COTYPE_GPSCOMBINED=4063, COTYPE_GPSURA=4064, COTYPE_GPSHR=4065,
     20
     21     COTYPE_GLONASSORBIT=4066, COTYPE_GLONASSCLOCK=4067,
     22     COTYPE_GLONASSCOMBINED=4069, COTYPE_GLONASSURA=4070, COTYPE_GLONASSHR=4071,
     23
    2024     COTYPE_AUTO=0 };
    21 enum BiasType { BTYPE_GPS=4052, BTYPE_GLONASS=4055, BTYPE_AUTO = 0 };
     25enum BiasType { BTYPE_GPS=4062, BTYPE_GLONASS=4068, BTYPE_AUTO = 0 };
    2226
    2327enum COR_CONSTANTS {
     
    5155  int NumberOfGLONASSSat;           /* 0 .. 24 */
    5256  int ClockDataSupplied;            /* boolean */
     57  int HRDataSupplied;               /* boolean */
    5358  int OrbitDataSupplied;            /* boolean */
     59  int URADataSupplied;              /* boolean */
     60  int epochGPS[101];                /* Weber, for latency */
     61  int epochSize;                    /* Weber, for latency */
     62  int UpdateInterval;
    5463  enum SatelliteReferencePoint SatRefPoint;
    5564  enum SatelliteReferenceDatum SatRefDatum;
     
    5766    int ID; /* GPS or GLONASS */
    5867    int IOD; /* GPS or GLONASS */
     68    int URA;
     69    double hrclock;
    5970    struct OrbitPart
    6071    {
     
    8495  int NumberOfGPSSat;               /* 0 .. 32 */
    8596  int NumberOfGLONASSSat;           /* 0 .. 24 */
     97  int UpdateInterval;
    8698  struct BiasSat
    8799  {
Note: See TracChangeset for help on using the changeset viewer.