diff --git a/makefile b/makefile index 4742545..ff9e01d 100644 --- a/makefile +++ b/makefile @@ -14,7 +14,7 @@ exec_prefix = $(prefix) bindir = $(exec_prefix)/bin all: - make rfedit rfplot rffft rfpng rffit rffind + make rfedit rfplot rffft rfpng rffit rffind rfdop rffit: rffit.o sgdp4.o satutl.o deep.o ferror.o dsmin.o simplex.o versafit.o gfortran -o rffit rffit.o sgdp4.o satutl.o deep.o ferror.o dsmin.o simplex.o versafit.o $(LFLAGS) @@ -22,6 +22,9 @@ rffit: rffit.o sgdp4.o satutl.o deep.o ferror.o dsmin.o simplex.o versafit.o rfpng: rfpng.o rftime.o rfio.o rftrace.o sgdp4.o satutl.o deep.o ferror.o gfortran -o rfpng rfpng.o rftime.o rfio.o rftrace.o sgdp4.o satutl.o deep.o ferror.o $(LFLAGS) +rfdop: rfdop.o rftrace.o rfio.o rftime.o sgdp4.o satutl.o deep.o ferror.o + $(CC) -o rfdop rfdop.o rftrace.o rfio.o rftime.o sgdp4.o satutl.o deep.o ferror.o -lm + rfedit: rfedit.o rfio.o rftime.o $(CC) -o rfedit rfedit.o rfio.o rftime.o -lm diff --git a/rfdop.c b/rfdop.c new file mode 100644 index 0000000..edeae70 --- /dev/null +++ b/rfdop.c @@ -0,0 +1,115 @@ +#include +#include +#include +#include +#include +#include "rfio.h" +#include "rftime.h" +#include "rftrace.h" + +void usage(void) +{ + printf("rfdop m:t:c:l:d:g:s:o:hi:\n\n"); + printf("m date/time (MJD)\n"); + printf("t date/time (yyyy-mm-ddThh:mm:ss.sss)\n"); + printf("i NORAD number\n"); + printf("c TLE catalog file\n"); + printf("s site (COSPAR)\n"); + printf("d time step [default: 10s]\n"); + printf("l trail length [default: 900s]\n"); + printf("g enable GRAVES\n"); + printf("H skip high orbits (<10 revs/day)\n"); + printf("o output file name\n"); + printf("h this help\n"); + + return; +} + +int main(int argc, char *argv[]) +{ + int i, n, satno=0; + double mjd0, *mjd, t; + float length=900.0, dt=10.0; + int site_id; + int graves=0,skiphigh=0; + char *env,tlefile[256],nfd[64],outfname[256]="out.dat"; + int arg=0; + + // Get defaults + env=getenv("ST_COSPAR"); + if (env!=NULL) { + site_id=atoi(env); + } + + if (argc>1) { + while ((arg=getopt(argc,argv,"m:t:c:i:l:d:gs:o:hH"))!=-1) { + switch (arg) { + case 't': + strcpy(nfd,optarg); + mjd0=nfd2mjd(nfd); + break; + + case 'm': + mjd0=(double) atof(optarg); + break; + + case 'c': + strcpy(tlefile,optarg); + break; + + case 'i': + satno=atoi(optarg); + break; + + case 'l': + length=atof(optarg); + break; + + case 'd': + dt=atof(optarg); + break; + + case 's': + site_id=atoi(optarg); + break; + + case 'g': + graves=1; + break; + + case 'H': + skiphigh=1; + break; + + case 'o': + strcpy(outfname,optarg); + break; + + case 'h': + usage(); + return 0; + + default: + usage(); + return 0; + } + } + } else { + usage(); + return 0; + } + + // Generate MJDs + n = (int) floor(length/dt); + mjd = (double *) malloc(sizeof(double)*n); + for (i=0;i