Merge pull request #396 from jnunyez/leap-second-in-command
add -L option for leap event emulation
This commit is contained in:
commit
8cf4930b46
@ -79,6 +79,7 @@ Options:
|
|||||||
-g <nmea_gga> NMEA GGA stream (dynamic mode)
|
-g <nmea_gga> NMEA GGA stream (dynamic mode)
|
||||||
-c <location> ECEF X,Y,Z in meters (static mode) e.g. 3967283.15,1022538.18,4872414.48
|
-c <location> ECEF X,Y,Z in meters (static mode) e.g. 3967283.15,1022538.18,4872414.48
|
||||||
-l <location> Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100
|
-l <location> Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100
|
||||||
|
-L <wnslf,dn,dtslf> User leap future event in GPS week number, day number, next leap second e.g. 2347,3,19
|
||||||
-t <date,time> Scenario start time YYYY/MM/DD,hh:mm:ss
|
-t <date,time> Scenario start time YYYY/MM/DD,hh:mm:ss
|
||||||
-T <date,time> Overwrite TOC and TOE to scenario start time
|
-T <date,time> Overwrite TOC and TOE to scenario start time
|
||||||
-d <duration> Duration [sec] (dynamic mode max: 300 static mode max: 86400)
|
-d <duration> Duration [sec] (dynamic mode max: 300 static mode max: 86400)
|
||||||
|
42
gpssim.c
42
gpssim.c
@ -529,8 +529,8 @@ void eph2sbf(const ephem_t eph, const ionoutc_t ionoutc, unsigned long sbf[5][N_
|
|||||||
signed long alpha0,alpha1,alpha2,alpha3;
|
signed long alpha0,alpha1,alpha2,alpha3;
|
||||||
signed long beta0,beta1,beta2,beta3;
|
signed long beta0,beta1,beta2,beta3;
|
||||||
signed long A0,A1;
|
signed long A0,A1;
|
||||||
signed long dtls,dtlsf;
|
signed long dtls;
|
||||||
unsigned long tot,wnt,wnlsf,dn;
|
unsigned long tot,wnt,wnlsf,dtlsf,dn;
|
||||||
unsigned long sbf4_page18_svId = 56UL;
|
unsigned long sbf4_page18_svId = 56UL;
|
||||||
|
|
||||||
// FIXED: This has to be the "transmission" week number, not for the ephemeris reference time
|
// FIXED: This has to be the "transmission" week number, not for the ephemeris reference time
|
||||||
@ -578,13 +578,21 @@ void eph2sbf(const ephem_t eph, const ionoutc_t ionoutc, unsigned long sbf[5][N_
|
|||||||
dtls = (signed long)(ionoutc.dtls);
|
dtls = (signed long)(ionoutc.dtls);
|
||||||
tot = (unsigned long)(ionoutc.tot/4096);
|
tot = (unsigned long)(ionoutc.tot/4096);
|
||||||
wnt = (unsigned long)(ionoutc.wnt%256);
|
wnt = (unsigned long)(ionoutc.wnt%256);
|
||||||
// TO DO: Specify scheduled leap seconds in command options
|
|
||||||
// 2016/12/31 (Sat) -> WNlsf = 1929, DN = 7 (http://navigationservices.agi.com/GNSSWeb/)
|
// 2016/12/31 (Sat) -> WNlsf = 1929, DN = 7 (http://navigationservices.agi.com/GNSSWeb/)
|
||||||
// Days are counted from 1 to 7 (Sunday is 1).
|
// Days are counted from 1 to 7 (Sunday is 1).
|
||||||
|
if (ionoutc.leapen==TRUE)
|
||||||
|
{
|
||||||
|
wnlsf = (unsigned long)(ionoutc.wnlsf%256);
|
||||||
|
dn = (unsigned long)(ionoutc.dn);
|
||||||
|
dtlsf = (unsigned long)(ionoutc.dtlsf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
wnlsf = 1929%256;
|
wnlsf = 1929%256;
|
||||||
dn = 7;
|
dn = 7;
|
||||||
dtlsf = 18;
|
dtlsf = 18;
|
||||||
|
}
|
||||||
// Subframe 1
|
// Subframe 1
|
||||||
sbf[0][0] = 0x8B0000UL<<6;
|
sbf[0][0] = 0x8B0000UL<<6;
|
||||||
sbf[0][1] = 0x1UL<<8;
|
sbf[0][1] = 0x1UL<<8;
|
||||||
@ -871,6 +879,8 @@ int readRinexNavAll(ephem_t eph[][MAX_SAT], ionoutc_t *ionoutc, const char *fnam
|
|||||||
replaceExpDesignator(tmp, 12);
|
replaceExpDesignator(tmp, 12);
|
||||||
ionoutc->alpha3 = atof(tmp);
|
ionoutc->alpha3 = atof(tmp);
|
||||||
|
|
||||||
|
//read wntlsf, dn, and dtlsf from fil
|
||||||
|
|
||||||
flags |= 0x1;
|
flags |= 0x1;
|
||||||
}
|
}
|
||||||
else if (strncmp(str+60, "ION BETA", 8)==0)
|
else if (strncmp(str+60, "ION BETA", 8)==0)
|
||||||
@ -1703,6 +1713,7 @@ void usage(void)
|
|||||||
" -g <nmea_gga> NMEA GGA stream (dynamic mode)\n"
|
" -g <nmea_gga> NMEA GGA stream (dynamic mode)\n"
|
||||||
" -c <location> ECEF X,Y,Z in meters (static mode) e.g. 3967283.154,1022538.181,4872414.484\n"
|
" -c <location> ECEF X,Y,Z in meters (static mode) e.g. 3967283.154,1022538.181,4872414.484\n"
|
||||||
" -l <location> Lat, lon, height (static mode) e.g. 35.681298,139.766247,10.0\n"
|
" -l <location> Lat, lon, height (static mode) e.g. 35.681298,139.766247,10.0\n"
|
||||||
|
" -L <wnslf,dn,dtslf> User leap future event in GPS week number, day number, next leap second e.g. 2347,3,19\n"
|
||||||
" -t <date,time> Scenario start time YYYY/MM/DD,hh:mm:ss\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"
|
" -T <date,time> Overwrite TOC and TOE to scenario start time\n"
|
||||||
" -d <duration> Duration [sec] (dynamic mode max: %.0f, static mode max: %d)\n"
|
" -d <duration> Duration [sec] (dynamic mode max: %.0f, static mode max: %d)\n"
|
||||||
@ -1796,6 +1807,7 @@ int main(int argc, char *argv[])
|
|||||||
duration = (double)iduration/10.0; // Default duration
|
duration = (double)iduration/10.0; // Default duration
|
||||||
verb = FALSE;
|
verb = FALSE;
|
||||||
ionoutc.enable = TRUE;
|
ionoutc.enable = TRUE;
|
||||||
|
ionoutc.leapen = FALSE;
|
||||||
|
|
||||||
if (argc<3)
|
if (argc<3)
|
||||||
{
|
{
|
||||||
@ -1803,7 +1815,7 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((result=getopt(argc,argv,"e:u:x:g:c:l:o:s:b:T:t:d:ipv"))!=-1)
|
while ((result=getopt(argc,argv,"e:u:x:g:c:l:o:s:b:L:T:t:d:ipv"))!=-1)
|
||||||
{
|
{
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
@ -1857,6 +1869,26 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'L':
|
||||||
|
// enable custom Leap Event
|
||||||
|
ionoutc.leapen = TRUE;
|
||||||
|
sscanf(optarg,"%d,%d,%d", &ionoutc.wnlsf, &ionoutc.dn, &ionoutc.dtlsf);
|
||||||
|
if (ionoutc.dn<1 && ionoutc.dn>7)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Invalid GPS day number");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ionoutc.wnlsf<0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Invalid GPS week number");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ionoutc.dtlsf<-128 && ionoutc.dtlsf>127)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Invalid delta leap second");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
timeoverwrite = TRUE;
|
timeoverwrite = TRUE;
|
||||||
if (strncmp(optarg, "now", 3)==0)
|
if (strncmp(optarg, "now", 3)==0)
|
||||||
|
Loading…
Reference in New Issue
Block a user