Beispiel #1
0
/* main ----------------------------------------------------------------------*/
int main(int argc, char **argv)
{
    FILE *fp=stdout;
    nav_t nav={0};
    obs_t obs={0};
    double rr[3]={0};
    char *ifile[32],*ofile="";
    int i,j,n=0;
    
    for (i=1;i<argc;i++) {
        if (!strcmp(argv[i],"-r")&&i+3<argc) {
            for (j=0;j<3;j++) rr[j]=atof(argv[++i]);
        }
        else if (!strcmp(argv[i],"-o")&&i+1<argc) {
            ofile=argv[i];
        }
        else ifile[n++]=argv[i];
    }
    /* open output file */
    if (*ofile&&!(fp=fopen(ofile,"w"))) {
        fprintf(stderr,"output file open error: %s\n",ofile);
        return -1;
    }
    /* read rinex files */
    if (!readrnx(ifile,1,n,&obs,&nav,NULL)) {
        fprintf(stderr,"no observation data\n");
        return -1;
    }
    /* estimate ionosphere parameters */
    est_iono(&obs,&nav,rr,fp);
    
    fclose(fp);
    
    return 0;
}
Beispiel #2
0
/* main ----------------------------------------------------------------------*/
int main(int argc, char **argv)
{
    FILE *fp=stdout;
    pcvs_t pcvs={0};
    nav_t nav={0};
    obs_t obs={0};
    sta_t sta={{0}};
    pcv_t *pcv=NULL;
    gtime_t ts={0},te={0};
    double eps[6]={0},epe[6]={0},rr[3]={0},tint=30.0;
    char *ifile[32],*ofile="",*afile="",*dfile="",ant[64]="";
    int i,j,n=0;
    
    for (i=1;i<argc;i++) {
        if (!strcmp(argv[i],"-ts")&&i+2<argc) {
            sscanf(argv[++i],"%lf/%lf/%lf",eps,eps+1,eps+2);
            sscanf(argv[++i],"%lf:%lf:%lf",eps+3,eps+4,eps+5);
        }
        else if (!strcmp(argv[i],"-te")&&i+2<argc) {
            sscanf(argv[++i],"%lf/%lf/%lf",epe,epe+1,epe+2);
            sscanf(argv[++i],"%lf:%lf:%lf",epe+3,epe+4,epe+5);
        }
        else if (!strcmp(argv[i],"-ti")&&i+1<argc) {
            tint=atof(argv[++i]);
        }
        else if (!strcmp(argv[i],"-r")&&i+3<argc) {
            for (j=0;j<3;j++) rr[j]=atof(argv[++i]);
        }
        else if (!strcmp(argv[i],"-o")&&i+1<argc) ofile=argv[++i];
        else if (!strcmp(argv[i],"-a")&&i+1<argc) afile=argv[++i];
        else if (!strcmp(argv[i],"-d")&&i+1<argc) dfile=argv[++i];
        else ifile[n++]=argv[i];
    }
    /* open output file */
    if (*ofile&&!(fp=fopen(ofile,"w"))) {
        fprintf(stderr,"output file open error: %s\n",ofile);
        return -1;
    }
    if (eps[2]>=1.0) ts=epoch2time(eps);
    if (epe[2]>=1.0) te=epoch2time(epe);
    
    /* read rinex obs/nav */
    for (i=0;i<n;i++) {
        fprintf(stderr,"reading: %s\n",ifile[i]);
        
        readrnxt(ifile[i],1,ts,te,0.0,"",&obs,&nav,&sta);
        
        if (*sta.antdes) strcpy(ant,sta.antdes);
        if (norm(sta.pos,3)>0.0) matcpy(rr,sta.pos,3,1);
    }
    if (!sortobs(&obs)) {
        fprintf(stderr,"no observation data\n");
        return -1;
    }
    uniqnav(&nav);
    
    /* read antenna file */
    if (*afile&&*ant) {
        if (!readpcv(afile,&pcvs)) {
            fprintf(stderr,"antenna file open error: %s\n",afile);
            return -1;
        }
        /* search pcv */
        if (!(pcv=searchpcv(0,ant,obs.data[0].time,&pcvs))) {
            fprintf(stderr,"no antenna parmeter: %s\n",ant);
        }
    }
    /* read p1-c1 dcb parameters */
    if (*dfile) readdcb(dfile,&nav);
    
    /* set p1-p2 dcb parameters */
    for (i=0;i<MAXSAT;i++) {
        for (j=0;j<nav.n;j++) {
            if (nav.eph[j].sat!=i+1) continue;
            nav.cbias[i][0]=nav.eph[j].tgd[0]*CLIGHT;
            break;
        }
    }
    /* estimate ionosphere parameters */
    est_iono(&obs,&nav,pcv,rr,tint,fp);
    
    fclose(fp);
    
    if (*ofile) fprintf(stderr,"output: %s\n",ofile);
    
    return 0;
}