diff --git a/README.md b/README.md index 6101f6f..52b8699 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Options: -l Lat,Lon,Hgt (static mode) e.g. 30.286502,120.032669,100 -t Scenario start time YYYY/MM/DD,hh:mm:ss -T Overwrite TOC and TOE to scenario start time - -d Duration [sec] (max: 300) + -d Duration [sec] (dynamic mode max: 300 static mode max: 86400) -o I/Q sampling data file (default: gpssim.bin) -s Sampling frequency [Hz] (default: 2600000) -b I/Q data format [1/8/16] (default: 16) diff --git a/gpssim.c b/gpssim.c index 73dc1d5..9f3e68b 100644 --- a/gpssim.c +++ b/gpssim.c @@ -1655,13 +1655,13 @@ void usage(void) " -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" + " -d Duration [sec] (dynamic mode max: %.0f static mode max: %d)\n" " -o I/Q sampling data file (default: gpssim.bin)\n" " -s Sampling frequency [Hz] (default: 2600000)\n" " -b I/Q data format [1/8/16] (default: 16)\n" " -i Disable ionospheric delay for spacecraft scenario\n" " -v Show details about simulated channels\n", - ((double)USER_MOTION_SIZE)/10.0); + ((double)USER_MOTION_SIZE) / 10.0, STATIC_MAX_DURATION); return; } @@ -1825,12 +1825,6 @@ int main(int argc, char *argv[]) break; case 'd': duration = atof(optarg); - if (duration<0.0 || duration>((double)USER_MOTION_SIZE)/10.0) - { - printf("ERROR: Invalid duration.\n"); - exit(1); - } - iduration = (int)(duration*10.0+0.5); break; case 'i': ionoutc.enable = FALSE; // Disable ionospheric correction @@ -1862,6 +1856,13 @@ int main(int argc, char *argv[]) llh[2] = 10.0; } + if (duration<0.0 || duration>((double)USER_MOTION_SIZE) / 10.0 && !staticLocationMode || duration>STATIC_MAX_DURATION && staticLocationMode) + { + printf("ERROR: Invalid duration.\n"); + exit(1); + } + iduration = (int)(duration*10.0 + 0.5); + // Buffer size samp_freq = floor(samp_freq/10.0); iq_buff_size = (int)samp_freq; // samples per 0.1sec @@ -1904,13 +1905,6 @@ int main(int argc, char *argv[]) llh2xyz(llh,xyz[0]); // Convert llh to xyz numd = iduration; - - for (iumd=1; iumd