/* post-processing positioning ------------------------------------------------- * post-processing positioning * args : gtime_t ts I processing start time (ts.time==0: no limit) * : gtime_t te I processing end time (te.time==0: no limit) * double ti I processing interval (s) (0:all) * double tu I processing unit time (s) (0:all) * prcopt_t *popt I processing options * solopt_t *sopt I solution options * filopt_t *fopt I file options * char **infile I input files (see below) * int n I number of input files * char *outfile I output file ("":stdout, see below) * char *rov I rover id list (separated by " ") * char *base I base station id list (separated by " ") * return : status (0:ok,0>:error,1:aborted) * notes : input files should contain observation data, navigation data, precise * ephemeris/clock (optional), sbas log file (optional), ssr message * log file (optional) and tec grid file (optional). only the first * observation data file in the input files is recognized as the rover * data. * * the type of an input file is recognized by the file extention as ] * follows: * .sp3,.SP3,.eph*,.EPH*: precise ephemeris (sp3c) * .sbs,.SBS,.ems,.EMS : sbas message log files (rtklib or ems) * .lex,.LEX : qzss lex message log files * .rtcm3,.RTCM3 : ssr message log files (rtcm3) * .*i,.*I : tec grid files (ionex) * others : rinex obs, nav, gnav, hnav, qnav or clock * * inputs files can include wild-cards (*). if an file includes * wild-cards, the wild-card expanded multiple files are used. * * inputs files can include keywords. if an file includes keywords, * the keywords are replaced by date, time, rover id and base station * id and multiple session analyses run. refer reppath() for the * keywords. * * the output file can also include keywords. if the output file does * not include keywords. the results of all multiple session analyses * are output to a single output file. * * ssr corrections are valid only for forward estimation. *-----------------------------------------------------------------------------*/ extern int postpos(gtime_t ts, gtime_t te, double ti, double tu, const prcopt_t *popt, const solopt_t *sopt, const filopt_t *fopt, char **infile, int n, char *outfile, const char *rov, const char *base) { gtime_t tts,tte,ttte; double tunit,tss; int i,j,k,nf,stat=0,week,flag=1,index[MAXINFILE]={0}; char *ifile[MAXINFILE],ofile[1024],*ext; trace(3,"postpos : ti=%.0f tu=%.0f n=%d outfile=%s\n",ti,tu,n,outfile); /* open processing session */ if (!openses(popt,sopt,fopt,&navs,&pcvss,&pcvsr)) return -1; if (ts.time!=0&&te.time!=0&&tu>=0.0) { if (timediff(te,ts)<0.0) { showmsg("error : no period"); closeses(&navs,&pcvss,&pcvsr); return 0; } for (i=0;i<MAXINFILE;i++) { if (!(ifile[i]=(char *)malloc(1024))) { for (;i>=0;i--) free(ifile[i]); closeses(&navs,&pcvss,&pcvsr); return -1; } } if (tu==0.0||tu>86400.0*MAXPRCDAYS) tu=86400.0*MAXPRCDAYS; settspan(ts,te); tunit=tu<86400.0?tu:86400.0; tss=tunit*(int)floor(time2gpst(ts,&week)/tunit); for (i=0;;i++) { /* for each periods */ tts=gpst2time(week,tss+i*tu); tte=timeadd(tts,tu-DTTOL); if (timediff(tts,te)>0.0) break; if (timediff(tts,ts)<0.0) tts=ts; if (timediff(tte,te)>0.0) tte=te; strcpy(proc_rov ,""); strcpy(proc_base,""); if (checkbrk("reading : %s",time_str(tts,0))) { stat=1; break; } for (j=k=nf=0;j<n;j++) { ext=strrchr(infile[j],'.'); if (ext&&(!strcmp(ext,".rtcm3")||!strcmp(ext,".RTCM3"))) { strcpy(ifile[nf++],infile[j]); } else { /* include next day precise ephemeris or rinex brdc nav */ ttte=tte; if (ext&&(!strcmp(ext,".sp3")||!strcmp(ext,".SP3")|| !strcmp(ext,".eph")||!strcmp(ext,".EPH"))) { ttte=timeadd(ttte,3600.0); } else if (strstr(infile[j],"brdc")) { ttte=timeadd(ttte,7200.0); } nf+=reppaths(infile[j],ifile+nf,MAXINFILE-nf,tts,ttte,"",""); } while (k<nf) index[k++]=j; if (nf>=MAXINFILE) { trace(2,"too many input files. trancated\n"); break; } } if (!reppath(outfile,ofile,tts,"","")&&i>0) flag=0; /* execute processing session */ stat=execses_b(tts,tte,ti,popt,sopt,fopt,flag,ifile,index,nf,ofile, rov,base); if (stat==1) break; } for (i=0;i<MAXINFILE;i++) free(ifile[i]); } else if (ts.time!=0) { for (i=0;i<n&&i<MAXINFILE;i++) { if (!(ifile[i]=(char *)malloc(1024))) { for (;i>=0;i--) free(ifile[i]); return -1; } reppath(infile[i],ifile[i],ts,"",""); index[i]=i; } reppath(outfile,ofile,ts,"",""); /* execute processing session */ stat=execses_b(ts,te,ti,popt,sopt,fopt,1,ifile,index,n,ofile,rov, base); for (i=0;i<n&&i<MAXINFILE;i++) free(ifile[i]); } else { for (i=0;i<n;i++) index[i]=i; /* execute processing session */ stat=execses_b(ts,te,ti,popt,sopt,fopt,1,infile,index,n,outfile,rov, base); } /* close processing session */ closeses(&navs,&pcvss,&pcvsr); return stat; }
/* reppaths() */ void utest3(void) { gtime_t t0={0},t1,t2,t3,t4; double ep1[]={2010, 7,31,21,36,50.00000}; double ep2[]={2010, 8, 1, 4, 0, 0.00000}; double ep3[]={2010, 8,31, 0, 0, 0.00000}; double ep4[]={2012, 1,31, 0, 0, 0.00000}; char path0[]="01234567890123456789"; char path1[]="abcde_%Y/%m/%d_%h:%M:%S_%Y%m%d%h%M%S"; char path2[]="%r_%b_%r_%b_%y%n_%W%D%H_%ha%hb%hc"; char path4[]="YEAR=%Y GPSWEEK=%W"; char *paths[100]; int i,n,stat; t1=epoch2time(ep1); t2=epoch2time(ep2); t3=epoch2time(ep3); t4=epoch2time(ep4); for (i=0;i<100;i++) paths[i]=(char *)malloc(1024); n=reppaths(path1,paths,10,t0,t1,"ROV","BASE"); assert(n==0); n=reppaths(path1,paths,10,t1,t0,"ROV","BASE"); assert(n==0); n=reppaths(path1,paths, 0,t1,t2,"ROV","BASE"); assert(n==0); n=reppaths(path1,paths,10,t2,t1,"ROV","BASE"); assert(n==0); n=reppaths(path0,paths,10,t1,t2,"ROV","BASE"); assert(n==1); stat=strcmp(paths[0],path0); assert(stat==0); n=reppaths(path1,paths,100,t1,t2,"ROV","BASE"); for (i=0;i<n;i++) printf("paths[%2d]=%s\n",i,paths[i]); printf("\n"); assert(n==27); stat=strcmp(paths[ 0],"abcde_2010/07/31_21:30:00_20100731213000"); assert(stat==0); stat=strcmp(paths[26],"abcde_2010/08/01_04:00:00_20100801040000"); assert(stat==0); n=reppaths(path2,paths,100,t1,t3,"ROV","BASE"); for (i=0;i<n;i++) printf("paths[%2d]=%s\n",i,paths[i]); printf("\n"); assert(n==100); stat=strcmp(paths[ 0],"ROV_BASE_ROV_BASE_10212_15946v_211812"); assert(stat==0); stat=strcmp(paths[99],"ROV_BASE_ROV_BASE_10217_15954a_000000"); assert(stat==0); n=reppaths(path4,paths,100,t1,t4,"ROV","BASE"); for (i=0;i<n;i++) printf("paths[%2d]=%s\n",i,paths[i]); printf("\n"); assert(n==81); stat=strcmp(paths[ 0],"YEAR=2010 GPSWEEK=1594"); assert(stat==0); stat=strcmp(paths[80],"YEAR=2012 GPSWEEK=1673"); assert(stat==0); for (i=0;i<100;i++) free(paths[i]); printf("%s utset3 : OK\n",__FILE__); }