Add SV health to navigation message

This commit is contained in:
OSQZSS 2017-02-02 11:12:05 +09:00
parent 8369c5e7ae
commit 6bf0b6175d
2 changed files with 25 additions and 5 deletions

View File

@ -514,6 +514,8 @@ void eph2sbf(const ephem_t eph, const ionoutc_t ionoutc, unsigned long sbf[5][N_
long af1;
long af2;
long tgd;
int svhlth;
int codeL2;
unsigned long ura = 0UL;
unsigned long dataId = 1UL;
@ -556,6 +558,8 @@ void eph2sbf(const ephem_t eph, const ionoutc_t ionoutc, unsigned long sbf[5][N_
af1 = (long)(eph.af1/POW2_M43);
af2 = (long)(eph.af2/POW2_M55);
tgd = (long)(eph.tgd/POW2_M31);
svhlth = (unsigned long)(eph.svhlth);
codeL2 = (unsigned long)(eph.codeL2);
wna = (unsigned long)(eph.toe.week%256);
toa = (unsigned long)(eph.toe.sec/4096.0);
@ -583,7 +587,7 @@ void eph2sbf(const ephem_t eph, const ionoutc_t ionoutc, unsigned long sbf[5][N_
// Subframe 1
sbf[0][0] = 0x8B0000UL<<6;
sbf[0][1] = 0x1UL<<8;
sbf[0][2] = ((wn&0x3FFUL)<<20) | (ura<<14) | (((iodc>>8)&0x3UL)<<6);
sbf[0][2] = ((wn&0x3FFUL)<<20) | ((codeL2&0x3UL)<<18) | ((ura&0xFUL)<<14) | ((svhlth&0x3FUL)<<8) | (((iodc>>8)&0x3UL)<<6);
sbf[0][3] = 0UL;
sbf[0][4] = 0UL;
sbf[0][5] = 0UL;
@ -1111,6 +1115,11 @@ int readRinexNavAll(ephem_t eph[][MAX_SAT], ionoutc_t *ionoutc, const char *fnam
replaceExpDesignator(tmp, 19);
eph[ieph][sv].idot = atof(tmp);
strncpy(tmp, str+22, 19);
tmp[19] = 0;
replaceExpDesignator(tmp, 19);
eph[ieph][sv].codeL2 = (int)atof(tmp);
strncpy(tmp, str+41, 19);
tmp[19] = 0;
replaceExpDesignator(tmp, 19);
@ -1120,6 +1129,13 @@ int readRinexNavAll(ephem_t eph[][MAX_SAT], ionoutc_t *ionoutc, const char *fnam
if (NULL==fgets(str, MAX_CHAR, fp))
break;
strncpy(tmp, str+22, 19);
tmp[19] = 0;
replaceExpDesignator(tmp, 19);
eph[ieph][sv].svhlth = (int)atof(tmp);
if ((eph[ieph][sv].svhlth>0) && (eph[ieph][sv].svhlth<32))
eph[ieph][sv].svhlth += 32; // Set MSB to 1
strncpy(tmp, str+41, 19);
tmp[19] = 0;
replaceExpDesignator(tmp, 19);
@ -1636,7 +1652,7 @@ void usage(void)
" -e <gps_nav> RINEX navigation file for GPS ephemerides (required)\n"
" -u <user_motion> User motion file (dynamic mode)\n"
" -g <nmea_gga> NMEA GGA stream (dynamic mode)\n"
" -l <location> Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100\n"
" -l <location> Lat,Lon,Hgt (static mode) e.g. 35.681298,139.766247,10.0\n"
" -t <date,time> Scenario start time YYYY/MM/DD,hh:mm:ss\n"
" -T <date,time> Overwrite TOC and TOE to scenario start time\n"
" -d <duration> Duration [sec] (max: %.0f)\n"
@ -1839,9 +1855,11 @@ int main(int argc, char *argv[])
if (umfile[0]==0 && !staticLocationMode)
{
printf("ERROR: User motion file / NMEA GGA stream is not specified.\n");
printf("You may use -l to specify the static location directly.\n");
exit(1);
// Default static location; Tokyo
staticLocationMode = TRUE;
llh[0] = 35.681298 / R2D;
llh[1] = 139.766247 / R2D;
llh[2] = 10.0;
}
// Buffer size

View File

@ -119,6 +119,8 @@ typedef struct
double af1; /*!< rate (sec/sec) */
double af2; /*!< acceleration (sec/sec^2) */
double tgd; /*!< Group delay L2 bias */
int svhlth;
int codeL2;
// Working variables follow
double n; /*!< Mean motion (Average angular velocity) */
double sq1e2; /*!< sqrt(1-e^2) */