diff --git a/gpssim.c b/gpssim.c index 8db9682..73dc1d5 100644 --- a/gpssim.c +++ b/gpssim.c @@ -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 RINEX navigation file for GPS ephemerides (required)\n" " -u User motion file (dynamic mode)\n" " -g NMEA GGA stream (dynamic mode)\n" - " -l Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100\n" + " -l Lat,Lon,Hgt (static mode) e.g. 35.681298,139.766247,10.0\n" " -t Scenario start time YYYY/MM/DD,hh:mm:ss\n" " -T Overwrite TOC and TOE to scenario start time\n" " -d 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 diff --git a/gpssim.h b/gpssim.h index e642827..ea9b5c7 100644 --- a/gpssim.h +++ b/gpssim.h @@ -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) */