Ejemplo n.º 1
0
/* readrnxt() */
void utest2(void)
{
    gtime_t t0={0},ts,te;
    double ep1[]={2005,4,2,1,0,0},ep2[]={2005,4,2,2,0,0};
    char file1[]="../data/rinex/07590920.05o";
    char file2[]="../data/rinex/07590920.05n";
    int n;
    obs_t obs={0};
    nav_t nav={0};
    sta_t sta={""};
    
    ts=epoch2time(ep1);
    te=epoch2time(ep2);
    n=readrnxt(file1,1,ts,te,0.0,"",&obs,&nav,&sta);
    printf("\n\nn=%d\n",n);
    n=readrnxt(file2,1,ts,te,0.0,"",&obs,&nav,&sta);
    dumpobs(&obs);
    free(obs.data); obs.data=NULL; obs.n=obs.nmax=0;
    n=readrnxt(file1,1,t0,t0,240.0,"",&obs,&nav,&sta);
    printf("\n\nn=%d\n",n);
    dumpobs(&obs);
    free(obs.data);
    
    printf("%s utset2 : OK\n",__FILE__);
}
Ejemplo n.º 2
0
// get time -----------------------------------------------------------------
void __fastcall TMainWindow::GetTime(gtime_t *ts, gtime_t *te, double *tint,
        double *tunit)
{
    AnsiString TimeY1_Text=TimeY1->Text,TimeH1_Text=TimeH1->Text;
    AnsiString TimeY2_Text=TimeY2->Text,TimeH2_Text=TimeH2->Text;
    AnsiString TimeInt_Text=TimeInt->Text,TimeUnit_Text=TimeUnit->Text;
    double eps[]={2000,1,1,0,0,0},epe[]={2000,1,1,0,0,0};
    
    if (TimeStartF->Checked) {
        sscanf(TimeY1_Text.c_str(),"%lf/%lf/%lf",eps,eps+1,eps+2);
        sscanf(TimeH1_Text.c_str(),"%lf:%lf:%lf",eps+3,eps+4,eps+5);
        *ts=epoch2time(eps);
    }
    if (TimeEndF->Checked) {
        sscanf(TimeY2_Text.c_str(),"%lf/%lf/%lf",epe,epe+1,epe+2);
        sscanf(TimeH2_Text.c_str(),"%lf:%lf:%lf",epe+3,epe+4,epe+5);
        *te=epoch2time(epe);
    }
    if (TimeIntF->Checked) {
        sscanf(TimeInt_Text.c_str(),"%lf",tint);
    }
    if (TimeUnitF->Checked) {
        if (sscanf(TimeUnit_Text.c_str(),"%lf",tunit)>=1) *tunit*=3600.0;
    }
}
Ejemplo n.º 3
0
/* main ----------------------------------------------------------------------*/
int main(int argc, char **argv)
{
    gtime_t ts={0},te={0};
    obs_t obs={0};
    nav_t nav={0};
    sta_t sta={{0}};
    double es[6]={0},ee[6]={0},tint=0.0;
    char *infile[16]={0},*outfile="",buff[1024],*p;
    int i,n=0,m=0,type[16],trlevel=0,staid=0,ret=0;
    
    for (i=1;i<argc;i++) {
        if (!strcmp(argv[i],"-ts")&&i+2<argc) {
            sscanf(argv[++i],"%lf/%lf/%lf",es  ,es+1,es+2);
            sscanf(argv[++i],"%lf:%lf:%lf",es+3,es+4,es+6);
        }
        else if (!strcmp(argv[i],"-te")&&i+2<argc) {
            sscanf(argv[++i],"%lf/%lf/%lf",ee  ,ee+1,ee+2);
            sscanf(argv[++i],"%lf:%lf:%lf",ee+3,ee+4,ee+5);
        }
        else if (!strcmp(argv[i],"-ti" )&&i+1<argc) tint =atof(argv[++i]);
        else if (!strcmp(argv[i],"-sta")&&i+1<argc) staid=atoi(argv[++i]);
        else if (!strcmp(argv[i],"-out")&&i+1<argc) outfile=argv[++i];
        else if (!strcmp(argv[i],"-typ")&&i+1<argc) {
            strcpy(buff,argv[++i]);
            for (p=strtok(buff,",");p;p=strtok(NULL,",")) type[m++]=atoi(p);
        }
        else if (!strcmp(argv[i],"-x"  )&&i+1<argc) trlevel=atoi(argv[++i]);
        else if (!strncmp(argv[i],"-",1)) print_help();
        else infile[n++]=argv[i];
    }
    if (trlevel>0) {
        traceopen(TRACEFILE);
        tracelevel(trlevel);
    }
    if (es[0]>0.0) ts=epoch2time(es);
    if (ee[0]>0.0) te=epoch2time(ee);
    
    /* read rinex files */
    for (i=0;i<n;i++) {
        readrnxt(infile[i],0,ts,te,tint,"",&obs,&nav,&sta);
    }
    sortobs(&obs);
    uniqnav(&nav);
    
    /* convert to rtcm messages */
    if (!conv_rtcm(type,m,outfile,&obs,&nav,&sta,staid)) ret=-1;
    
    free(obs.data);
    freenav(&nav,0xFF);
    
    if (trlevel>0) {
        traceclose();
    }
    return ret;
}
Ejemplo n.º 4
0
/* utc2gpst(), gpst2utc() */
void utest8(void)
{
    double ep0[]={1980, 1, 6, 0, 0, 0.000000};
    double ep1[]={2010,12,31,23,59,59.999999};
    gtime_t t0,t1,t2,t3;
    t0=epoch2time(ep0);
    t1=epoch2time(ep1);
    while (t0.time<t1.time) {
        t2=utc2gpst(t0); t3=gpst2utc(t2); assert(t0.time==t3.time&&t0.sec==t3.sec);
        t0.time+=86400.0;
    }
    
    printf("%s utset8 : OK\n",__FILE__);
}
Ejemplo n.º 5
0
/* time2str() */
void utest9(void)
{
    double ep0[]={1970,12,31,23,59,59.1234567890123456};
    double ep1[]={2004, 1, 1, 0, 0, 0.0000000000000000};
    double ep2[]={2006, 2,28,23,59,59.9999995000000000};
    char s[128];
    int ret;
    time2str(epoch2time(ep0),s,0);
        ret=strcmp(s,"1970/12/31 23:59:59");
        assert(!ret);
    time2str(epoch2time(ep0),s,-1);
        ret=strcmp(s,"1970/12/31 23:59:59");
        assert(!ret);
    time2str(epoch2time(ep0),s,10);
        ret=strcmp(s,"1970/12/31 23:59:59.1234567890");
        assert(!ret);
    time2str(epoch2time(ep1),s,0);
        ret=strcmp(s,"2004/01/01 00:00:00");
        assert(!ret);
    time2str(epoch2time(ep1),s,16);
        ret=strcmp(s,"2004/01/01 00:00:00.000000000000");
        assert(!ret);
    time2str(epoch2time(ep2),s,0);
        ret=strcmp(s,"2006/03/01 00:00:00");
        assert(!ret);
    time2str(epoch2time(ep2),s,6);
        ret=strcmp(s,"2006/03/01 00:00:00.000000");
        assert(!ret);
    time2str(epoch2time(ep2),s,7);
        ret=strcmp(s,"2006/02/28 23:59:59.9999995");
        assert(!ret);
    
    printf("%s utset9 : OK\n",__FILE__);
}
Ejemplo n.º 6
0
/* ionmodel() */
void utest1(void)
{
    double e1[]={2007,1,16, 1,0,0};
    double e2[]={2007,1,16,13,0,0};
    double e3[]={2007,1,16,22,0,0};
    double ion1[]={
         0.2E-7,-0.8e-8,-0.5e-7, 0.1e-6, 0.2E+6, 0.2e+6,-0.1e+6,-0.1e+7
    };
    double ion2[]={
         0.2E-7,-0.8e-8,-0.5e-7, 0.1e-6, 0.2E+6, 0.2e+6,-0.1e+6,-0.1e+7
    };
    double pos1 []={ 35*D2R, 140*D2R, 100.0};
    double pos2 []={-80*D2R,-170*D2R,1000.0};
    double pos3 []={ 10*D2R,  30*D2R,   0.0};
    double azel1[]={ 60*D2R, 75*D2R};
    double azel2[]={190*D2R,  3*D2R};
    double azel3[]={350*D2R, 60*D2R};
    double azel4[]={  0*D2R, 90*D2R};
    gtime_t t1=epoch2time(e1),t2=epoch2time(e2),t3=epoch2time(e3);
    double dion;
    
    dion=ionmodel(t1,ion1,pos1,azel1);
        assert(fabs(dion-6.73590532099438)<1e-8);
    
    dion=ionmodel(t1,ion1,pos2,azel1);
        assert(fabs(dion-3.56895382197387)<1e-8);
    
    dion=ionmodel(t1,ion1,pos3,azel1);
        assert(fabs(dion-3.80716435655161)<1e-8);
    
    dion=ionmodel(t2,ion1,pos1,azel1);
        assert(fabs(dion-5.21796954585452)<1e-8);
    
    dion=ionmodel(t3,ion1,pos1,azel1);
        assert(fabs(dion-5.90190539264777)<1e-8);
    
    dion=ionmodel(t1,ion1,pos1,azel2);
        assert(fabs(dion-21.6345415123632)<1e-8);
    
    dion=ionmodel(t1,ion1,pos1,azel3);
        assert(fabs(dion-7.33844278822561)<1e-8);
    
    dion=ionmodel(t1,ion1,pos1,azel4);
        assert(fabs(dion-6.58339711400694)<1e-8);
    
    dion=ionmodel(t1,ion2,pos1,azel1);
        assert(fabs(dion-6.73590532099438)<1e-8);
    
    printf("%s utest1 : OK\n",__FILE__);
}
Ejemplo n.º 7
0
/* decode solution time ------------------------------------------------------*/
static char *decode_soltime(char *buff, const solopt_t *opt, gtime_t *time)
{
    double v[MAXFIELD];
    char *p,*q,s[64]=" ";
    int n,len;
    
    trace(4,"decode_soltime:\n");
    
    if (!strcmp(opt->sep,"\\t")) strcpy(s,"\t");
    else if (*opt->sep) strcpy(s,opt->sep);
    len=(int)strlen(s);
    
    /* yyyy/mm/dd hh:mm:ss or yyyy mm dd hh:mm:ss */
    if (sscanf(buff,"%lf/%lf/%lf %lf:%lf:%lf",v,v+1,v+2,v+3,v+4,v+5)>=6) {
        if (v[0]<100.0) {
            v[0]+=v[0]<80.0?2000.0:1900.0;
        }
        *time=epoch2time(v);
        if (opt->times==TIMES_UTC) {
            *time=utc2gpst(*time);
        }
        else if (opt->times==TIMES_JST) {
            *time=utc2gpst(timeadd(*time,-9*3600.0));
        }
        if (!(p=strchr(buff,':'))||!(p=strchr(p+1,':'))) return NULL;
        for (p++;isdigit((int)*p)||*p=='.';) p++;
        return p+len;
    }
    if (opt->posf==SOLF_GSIF) {
        if (sscanf(buff,"%lf %lf %lf %lf:%lf:%lf",v,v+1,v+2,v+3,v+4,v+5)<6) {
            return NULL;
        }
        *time=timeadd(epoch2time(v),-12.0*3600.0);
        if (!(p=strchr(buff,':'))||!(p=strchr(p+1,':'))) return NULL;
        for (p++;isdigit((int)*p)||*p=='.';) p++;
        return p+len;
    }
    /* wwww ssss */
    for (p=buff,n=0;n<2;p=q+len) {
        if ((q=strstr(p,s))) *q='\0'; 
        if (*p) v[n++]=atof(p);
        if (!q) break;
    }
    if (n>=2&&0.0<=v[0]&&v[0]<=3000.0&&0.0<=v[1]&&v[1]<604800.0) {
        *time=gpst2time((int)v[0],v[1]);
        return p;
    }
    return NULL;
}
Ejemplo n.º 8
0
//---------------------------------------------------------------------------
void __fastcall TConvDialog::BtnConvertClick(TObject *Sender)
{
	AnsiString TimeY1_Text=TimeY1->Text,TimeH1_Text=TimeH1->Text;
	AnsiString TimeY2_Text=TimeY2->Text,TimeH2_Text=TimeH2->Text;
	AnsiString InputFile_Text=InputFile->Text,OutputFile_Text=OutputFile->Text;
	int stat;
	char cmd[1024],file[1024],kmlfile[1024],*p;
	double offset[3]={0},es[6]={1970,1,1},ee[6]={2038,1,1},tint=0.0;
	gtime_t ts={0},te={0};
	ShowMsg("");
	if (InputFile->Text==""||OutputFile->Text=="") return;
	ShowMsg("converting ...");
	if (TimeSpan->Checked) {
		sscanf(TimeY1_Text.c_str(),"%lf/%lf/%lf",es  ,es+1,es+2);
		sscanf(TimeH1_Text.c_str(),"%lf:%lf:%lf",es+3,es+4,es+5);
		sscanf(TimeY2_Text.c_str(),"%lf/%lf/%lf",ee  ,ee+1,ee+2);
		sscanf(TimeH2_Text.c_str(),"%lf:%lf:%lf",ee+3,ee+4,ee+5);
		ts=epoch2time(es);
		te=epoch2time(ee);
	}
	if (AddOffset->Checked) {
		offset[0]=str2dbl(Offset1->Text);
		offset[1]=str2dbl(Offset2->Text);
		offset[2]=str2dbl(Offset3->Text);
	}
	if (TimeIntF->Checked) tint=str2dbl(TimeInt->Text);
	strcpy(file,InputFile_Text.c_str());
	strcpy(kmlfile,file);
	if (!(p=strrchr(kmlfile,'.'))) p=kmlfile+strlen(kmlfile);
	strcpy(p,".kml");
	if((stat=convkml(file,Compress->Checked?kmlfile:OutputFile_Text.c_str(),
	                 ts,te,tint,QFlags->ItemIndex,offset,
	                 TrackColor->ItemIndex,PointColor->ItemIndex,
	                 OutputAlt->ItemIndex,OutputTime->ItemIndex))<0) {
		if      (stat==-1) ShowMsg("error : read input file");
		else if (stat==-2) ShowMsg("error : input file format");
		else if (stat==-3) ShowMsg("error : no data in input file");
		else               ShowMsg("error : write kml file");
		return;
	}
	if (Compress->Checked) {
		sprintf(cmd,"zip.exe -j -m %s %s",OutputFile->Text.c_str(),kmlfile);
		if (!ExecCmd(cmd)) {
			ShowMsg("error : zip execution");
			return;
		}
	}
	ShowMsg("done");
}
Ejemplo n.º 9
0
//---------------------------------------------------------------------------
void __fastcall TSpanDialog::BtnOkClick(TObject *Sender)
{
	double eps[]={2000,1,1,0,0,0},epe[]={2000,1,1,0,0,0};
	
	TimeEna[0]=TimeStartF->Checked;
	TimeEna[1]=TimeEndF  ->Checked;
	TimeEna[2]=TimeIntF  ->Checked;
	sscanf(TimeY1->Text.c_str(),"%lf/%lf/%lf",eps,eps+1,eps+2);
	sscanf(TimeH1->Text.c_str(),"%lf:%lf:%lf",eps+3,eps+4,eps+5);
	sscanf(TimeY2->Text.c_str(),"%lf/%lf/%lf",epe,epe+1,epe+2);
	sscanf(TimeH2->Text.c_str(),"%lf:%lf:%lf",epe+3,epe+4,epe+5);
	TimeStart=epoch2time(eps);
	TimeEnd=epoch2time(epe);
	TimeInt=str2dbl(EditTimeInt->Text);
}
Ejemplo n.º 10
0
/* time2doy() */
void utest11(void)
{
    double ep1[]={2004,1,1,0,0,0};
    double ep2[]={2004,12,31,0,0,0};
    double ep3[]={2005,12,31,12,0,0};
    double doy1,doy2,doy3;
    doy1=time2doy(epoch2time(ep1));
    doy2=time2doy(epoch2time(ep2));
    doy3=time2doy(epoch2time(ep3));
    assert(fabs(doy1-1.0)<1E-6);
    assert(fabs(doy2-366.0)<1E-6);
    assert(fabs(doy3-365.5)<1E-6);
    
    printf("%s utset11 : OK\n",__FILE__);
}
Ejemplo n.º 11
0
/* reppath() */
void utest2(void)
{
    gtime_t t0={0},t1,t2;
    double ep1[]={1990, 1, 1, 0, 0, 0.00000};
    double ep2[]={2010,12,31,23,59,59.99999};
    char path0[]="01234567890123456789";
    char path1[]="abcde_%Y/%m/%d_%h:%M:%S_%Y%m%d%h%M%S";
    char path2[]="abcde_%y%n_%W%D%H_%ha%hb%hc";
    char path3[]="rover %r %r base %b %b";
    char path4[]="%a %b %c";
    char rpath[1024];
    char rov[]="RRRRRRRR",base[]="BBBBBBBB";
    int stat;
    
    t1=epoch2time(ep1);
    t2=epoch2time(ep2);
    
    stat=reppath(path0,rpath,t1,"","");
        assert(stat==0);
    stat=strcmp(rpath,path0);
        assert(stat==0);
    stat=reppath(path0,rpath,t0,rov,base);
        assert(stat==0);
    stat=strcmp(rpath,path0);
        assert(stat==0);
    stat=reppath(path0,rpath,t1,rov,base);
        assert(stat==0);
    stat=strcmp(rpath,path0);
        assert(stat==0);
    stat=reppath(path1,rpath,t1,"","");
        assert(stat==1);
    stat=strcmp(rpath,"abcde_1990/01/01_00:00:00_19900101000000");
        assert(stat==0);
    stat=reppath(path2,rpath,t2,rov,base);
        assert(stat==1);
    stat=strcmp(rpath,"abcde_10365_16165x_211812");
        assert(stat==0);
    stat=reppath(path3,rpath,t0,rov,base);
        assert(stat==1);
    stat=strcmp(rpath,"rover RRRRRRRR RRRRRRRR base BBBBBBBB BBBBBBBB");
        assert(stat==0);
    stat=reppath(path4,rpath,t1,rov,"");
        assert(stat==0);
    stat=strcmp(rpath,"%a %b %c");
        assert(stat==0);
    
    printf("%s utset2 : OK\n",__FILE__);
}
Ejemplo n.º 12
0
/* main ----------------------------------------------------------------------*/
int main(int argc, char **argv)
{
    gtime_t time;
    double ep[6]= {0};
    int i,page=1;

    time2epoch(utc2gpst(timeget()),ep);
    ep[4]=ep[5]=0.0;

    for (i=1; i<argc; i++) {
        if (!strcmp(argv[i],"-t")&&i+2<argc) {
            sscanf(argv[++i],"%lf/%lf/%lf",ep  ,ep+1,ep+2);
            sscanf(argv[++i],"%lf:%lf:%lf",ep+3,ep+4,ep+5);
        }
        else if (!strcmp(argv[i],"-p")&&i+1<argc) page=atoi(argv[++i]);
    }
    time=epoch2time(ep);

    switch (page) {
    case 1:
        gen_page1(time,TEMP1,PAGE1);
        break;
    case 2:
        gen_page2(time,TEMP2,PAGE2);
        break;
    case 3:
        gen_page3(time,TEMP3,PAGE3);
        break;
    }
    return 0;
}
Ejemplo n.º 13
0
/* decode solution -----------------------------------------------------------*/
static int decode_gw10sol(raw_t *raw)
{
    gtime_t time;
    double ep[6]={0},sec;
    unsigned char *p=raw->buff+6;
    
    trace(4,"decode_gw10sol : len=%d\n",raw->len);
    
    if (U2(p+42)&0xC00) { /* time valid? */
        trace(2,"gw10 sol time/day invalid\n");
        return 0;
    }
    sec=U4(p+27)/16384.0;
    sec=floor(sec*1000.0+0.5)/1000.0;
    ep[2]=bcd2num(p[31]);
    ep[1]=bcd2num(p[32]);
    ep[0]=bcd2num(p[33])*100+bcd2num(p[34]);
    time=utc2gpst(timeadd(epoch2time(ep),sec));
    
    /* set time if no time available */
    if (raw->time.time==0) {
        raw->time=time;
    }
    return 0;
}
Ejemplo n.º 14
0
/* convert glonass time to time  -----------------------------------------------
* convert glonass time in ephemeris to gtime_t struct
* args   : int      nt      I   current day
*          int      n4      I   4 year interval
*          int      h       I   hour
*          int      m       I   minute
*          int      s       I   second
* return : gtime_t struct
* note   : Reference: GLONASS ICD A.3.1.3
*-----------------------------------------------------------------------------*/
gtime_t glot2time(int nt, int n4, int h, int m, int s)
{
    double ep[6];
    int j=0,year,mon,day=0,doy=0;
    int doys[]= {1,32,60,91,121,152,182,213,244,274,305,335}; /* day of year */
    int doysl[]={1,32,61,92,122,153,183,214,245,275,306,336}; /* leap year */
    
    ep[3]=h; ep[4]=m; ep[5]=s;

    if     (nt<= 366) {j=1; doy=nt;}
    else if(nt<= 731) {j=2; doy=nt-366+1;}
    else if(nt<=1096) {j=3; doy=nt-731+1;}
    else if(nt<=1461) {j=4; doy=nt-1096+1;}

    /* current year */
    year=1996+4*(n4-1)+(j-1);
    
    /* compute current month and day */
    for (mon=1;mon<12;mon++) {
        if (j==1) {
            if (doy<doysl[mon]) {
                day=doy-doysl[mon-1];
                break;
            }
        } else {
            if (doy<doys[ mon]) {
                day=doy-doys[mon-1];
                break;
            }
        }
    }
    ep[0]=year; ep[1]=mon; ep[2]=day;
    return utc2gpst(epoch2time(ep)); /* convert to gtime_t */
}
Ejemplo n.º 15
0
/* decode binex mesaage 0x7f: gnss data prototyping --------------------------*/
static int decode_bnx_7f(raw_t *raw, unsigned char *buff, int len)
{
    const static double gpst0[]={1980,1,6,0,0,0};
    char *msg;
    unsigned char *p=buff;
    unsigned int srec,min,msec;
    
    srec=U1(p); p+=1; /* subrecord id */
    min =U4(p); p+=4;
    msec=U2(p); p+=2;
    raw->time=timeadd(epoch2time(gpst0),min*60.0+msec*0.001);
    
    if (raw->outtype) {
        msg=raw->msgtype+strlen(raw->msgtype);
        sprintf(msg," subrec=%02X time%s",srec,time_str(raw->time,3));
    }
    switch (srec) {
        case 0x00: return decode_bnx_7f_00(raw,buff+7,len-7);
        case 0x01: return decode_bnx_7f_01(raw,buff+7,len-7);
        case 0x02: return decode_bnx_7f_02(raw,buff+7,len-7);
        case 0x03: return decode_bnx_7f_03(raw,buff+7,len-7);
        case 0x04: return decode_bnx_7f_04(raw,buff+7,len-7);
        case 0x05: return decode_bnx_7f_05(raw,buff+7,len-7);
    }
    return 0;
}
Ejemplo n.º 16
0
/* tle_pos() -----------------------------------------------------------------*/
static void utest2(void)
{
    const char *file2="../data/tle/tle_sgp4.txt";
    const double ep0[6]={1980,1,1};
    tle_t tle={0};
    gtime_t epoch;
    double min,rs[6];
    int i,stat;
    
    epoch=utc2gpst(timeadd(epoch2time(ep0),274.98708465*86400.0));
    
    stat=tle_read(file2,&tle);
        assert(stat);
    
    stat=tle_pos(epoch,"TEST_ERR","","",&tle,NULL,rs);
        assert(!stat);
    
    for (i=0;i<5;i++) {
        min=360.0*i;
        
        stat=tle_pos(timeadd(epoch,min*60.0),"TEST_SAT","","",&tle,NULL,rs);
            assert(stat);
        
        fprintf(OUT,"%4.0f: %14.8f %14.8f %14.8f  %11.8f %11.8f %11.8f\n",min,
                rs[0]/1e3,rs[1]/1e3,rs[2]/1e3,rs[3]/1e3,rs[4]/1e3,rs[5]/1e3);
    }
    fprintf(OUT,"%s utest2 : OK\n",__FILE__);
}
Ejemplo n.º 17
0
/* displacement by ocean tide loading (ref [2] 7) ----------------------------*/
static void tide_oload(gtime_t tut, const double *odisp, double *denu)
{
    const double args[][5]={
        {1.40519E-4, 2.0,-2.0, 0.0, 0.00},  /* M2 */
        {1.45444E-4, 0.0, 0.0, 0.0, 0.00},  /* S2 */
        {1.37880E-4, 2.0,-3.0, 1.0, 0.00},  /* N2 */
        {1.45842E-4, 2.0, 0.0, 0.0, 0.00},  /* K2 */
        {0.72921E-4, 1.0, 0.0, 0.0, 0.25},  /* K1 */
        {0.67598E-4, 1.0,-2.0, 0.0,-0.25},  /* O1 */
        {0.72523E-4,-1.0, 0.0, 0.0,-0.25},  /* P1 */
        {0.64959E-4, 1.0,-3.0, 1.0,-0.25},  /* Q1 */
        {0.53234E-5, 0.0, 2.0, 0.0, 0.00},  /* Mf */
        {0.26392E-5, 0.0, 1.0,-1.0, 0.00},  /* Mm */
        {0.03982E-5, 2.0, 0.0, 0.0, 0.00}   /* Ssa */
    };
    const double ep1975[]={1975,1,1,0,0,0};
    double ep[6],fday,days,t,t2,t3,a[5],ang,dp[3]={0};
    int i,j;
    
    trace(3,"tide_oload:\n");
    
    /* angular argument: see subroutine arg.f for reference [1] */
    time2epoch(tut,ep);
    fday=ep[3]*3600.0+ep[4]*60.0+ep[5];
    ep[3]=ep[4]=ep[5]=0.0;
    days=timediff(epoch2time(ep),epoch2time(ep1975))/86400.0;
    t=(27392.500528+1.000000035*days)/36525.0;
    t2=t*t; t3=t2*t;
    
    a[0]=fday;
    a[1]=(279.69668+36000.768930485*t+3.03E-4*t2)*D2R; /* H0 */
    a[2]=(270.434358+481267.88314137*t-0.001133*t2+1.9E-6*t3)*D2R; /* S0 */
    a[3]=(334.329653+4069.0340329577*t+0.010325*t2-1.2E-5*t3)*D2R; /* P0 */
    a[4]=2.0*PI;
    
    /* displacements by 11 constituents */
    for (i=0;i<11;i++) {
        ang=0.0;
        for (j=0;j<5;j++) ang+=a[j]*args[i][j];
        for (j=0;j<3;j++) dp[j]+=odisp[j+i*6]*cos(ang-odisp[j+3+i*6]*D2R);
    }
    denu[0]=-dp[1];
    denu[1]=-dp[2];
    denu[2]= dp[0];
    
    trace(5,"tide_oload: denu=%.3f %.3f %.3f\n",denu[0],denu[1],denu[2]);
}
Ejemplo n.º 18
0
//---------------------------------------------------------------------------
void __fastcall TStartDialog::BtnOkClick(TObject *Sender)
{
	AnsiString TimeY1_Text=TimeY1->Text,TimeH1_Text=TimeH1->Text;
	double ep[]={2000,1,1,0,0,0};
	sscanf(TimeY1_Text.c_str(),"%lf/%lf/%lf",ep,ep+1,ep+2);
	sscanf(TimeH1_Text.c_str(),"%lf:%lf:%lf",ep+3,ep+4,ep+5);
	Time=epoch2time(ep);
}
Ejemplo n.º 19
0
void utest4(void)
{
    double mapfd,mapfw;
    double e1[]={2007,1,16,6,0,0},e2[]={2030,12,31,23,59,59};
    double pos1 []={ 35*D2R, 140*D2R, 100.0};
    double pos2 []={-80*D2R,-170*D2R,1000.0};
    double pos3 []={ 10*D2R,  30*D2R,   0.0};
    double azel1[]={ 60*D2R, 75*D2R};
    double azel2[]={190*D2R,  3*D2R};
    double azel3[]={350*D2R, 60*D2R};
    double azel4[]={  0*D2R, 90*D2R};
    gtime_t t1=epoch2time(e1),t2=epoch2time(e2);

    mapfd=tropmapf(t1,pos1,azel1,&mapfw);
        assert(fabs(mapfd-1.035184526466435)<1e-8);
        assert(fabs(mapfw-1.035233787448654)<1e-8);
    
    mapfd=tropmapf(t1,pos1,azel2,&mapfw);
        assert(fabs(mapfd-14.643271711748200)<1e-8);
        assert(fabs(mapfw-16.455045694559484)<1e-8);
    
    mapfd=tropmapf(t1,pos1,azel3,&mapfw);
        assert(fabs(mapfd-1.154226397147367)<1e-8);
        assert(fabs(mapfw-1.154481126139610)<1e-8);
    
    mapfd=tropmapf(t1,pos1,azel4,&mapfw);
        assert(fabs(mapfd-1.000000000000000)<1e-8);
        assert(fabs(mapfw-1.000000000000000)<1e-8);
    
    mapfd=tropmapf(t2,pos1,azel1,&mapfw);
        assert(fabs(mapfd-1.035184415128022)<1e-8);
        assert(fabs(mapfw-1.035233787448654)<1e-8);
    
    mapfd=tropmapf(t1,pos2,azel1,&mapfw);
        assert(fabs(mapfd-1.035186155749051)<1e-8);
        assert(fabs(mapfw-1.035230548304367)<1e-8);
    
    mapfd=tropmapf(t1,pos3,azel1,&mapfw);
        assert(fabs(mapfd-1.035181919429758)<1e-8);
        assert(fabs(mapfw-1.035233200318210)<1e-8);
    
    mapfd=tropmapf(t1,pos1,azel1,NULL);
        assert(fabs(mapfd-1.035184526466435)<1e-8);
    
    printf("%s utest4 : OK\n",__FILE__);
}
Ejemplo n.º 20
0
//---------------------------------------------------------------------------
void __fastcall TSpanDialog::BtnTime2Click(TObject *Sender)
{
	double ep[]={2000,1,1,0,0,0};
	sscanf(TimeY2->Text.c_str(),"%lf/%lf/%lf",ep,ep+1,ep+2);
	sscanf(TimeH2->Text.c_str(),"%lf:%lf:%lf",ep+3,ep+4,ep+5);
	TimeDialog->Time=epoch2time(ep);
	TimeDialog->ShowModal();
}
Ejemplo n.º 21
0
/* decode binex mesaage 0x00: site/monument/marker/ref point/setup metadata --*/
static int decode_bnx_00(raw_t *raw, unsigned char *buff, int len)
{
    const static double gpst0[]={1980,1,6,0,0,0};
    char *msg;
    unsigned char *p=buff;
    unsigned int min,qsec,src,fid;
    int n=6;
    
    min =U4(p); p+=4;
    qsec=U1(p); p+=1;
    src =U1(p); p+=1;
    n+=getbnxi(p,&fid);
    raw->time=timeadd(epoch2time(gpst0),min*60.0+qsec*0.25);
    
    if (raw->outtype) {
        msg=raw->msgtype+strlen(raw->msgtype);
        sprintf(msg," fid=%02X time=%s src=%d",fid,time_str(raw->time,0),src);
    }
    switch (fid) {
        case 0x00: return decode_bnx_00_00(raw,buff+n,len-n);
        case 0x01: return decode_bnx_00_01(raw,buff+n,len-n);
        case 0x02: return decode_bnx_00_02(raw,buff+n,len-n);
        case 0x03: return decode_bnx_00_03(raw,buff+n,len-n);
        case 0x04: return decode_bnx_00_04(raw,buff+n,len-n);
        case 0x05: return decode_bnx_00_05(raw,buff+n,len-n);
        case 0x06: return decode_bnx_00_06(raw,buff+n,len-n);
        case 0x07: return decode_bnx_00_07(raw,buff+n,len-n);
        case 0x08: return decode_bnx_00_08(raw,buff+n,len-n);
        case 0x09: return decode_bnx_00_09(raw,buff+n,len-n);
        case 0x0A: return decode_bnx_00_0a(raw,buff+n,len-n);
        case 0x0B: return decode_bnx_00_0b(raw,buff+n,len-n);
        case 0x0C: return decode_bnx_00_0c(raw,buff+n,len-n);
        case 0x0D: return decode_bnx_00_0d(raw,buff+n,len-n);
        case 0x0E: return decode_bnx_00_0e(raw,buff+n,len-n);
        case 0x0F: return decode_bnx_00_0f(raw,buff+n,len-n);
        case 0x10: return decode_bnx_00_10(raw,buff+n,len-n);
        case 0x11: return decode_bnx_00_11(raw,buff+n,len-n);
        case 0x12: return decode_bnx_00_12(raw,buff+n,len-n);
        case 0x13: return decode_bnx_00_13(raw,buff+n,len-n);
        case 0x14: return decode_bnx_00_14(raw,buff+n,len-n);
        case 0x15: return decode_bnx_00_15(raw,buff+n,len-n);
        case 0x16: return decode_bnx_00_16(raw,buff+n,len-n);
        case 0x17: return decode_bnx_00_17(raw,buff+n,len-n);
        case 0x18: return decode_bnx_00_18(raw,buff+n,len-n);
        case 0x19: return decode_bnx_00_19(raw,buff+n,len-n);
        case 0x1A: return decode_bnx_00_1a(raw,buff+n,len-n);
        case 0x1B: return decode_bnx_00_1b(raw,buff+n,len-n);
        case 0x1C: return decode_bnx_00_1c(raw,buff+n,len-n);
        case 0x1D: return decode_bnx_00_1d(raw,buff+n,len-n);
        case 0x1E: return decode_bnx_00_1e(raw,buff+n,len-n);
        case 0x1F: return decode_bnx_00_1f(raw,buff+n,len-n);
        case 0x20: return decode_bnx_00_20(raw,buff+n,len-n);
        case 0x21: return decode_bnx_00_21(raw,buff+n,len-n);
        case 0x22: return decode_bnx_00_22(raw,buff+n,len-n);
        case 0x7F: return decode_bnx_00_7f(raw,buff+n,len-n);
    }
    return 0;
}
Ejemplo n.º 22
0
/* gpst2utc() */
void utest7(void)
{
    double ep0[]={1980, 1, 6, 0, 0, 0.000000};
    double ep1[]={1992, 7, 1, 0, 0, 6.999999};
    double ep2[]={1992, 7, 1, 0, 0, 7.000000};
    double ep3[]={1992, 7, 1, 0, 0, 8.000000};
    double ep4[]={2004,12,31,23,59,59.999999};
    double ep5[]={2006, 1, 1, 0, 0, 0.000000};
    double ep6[]={2038, 1, 1, 0, 0, 0.000000};
    gtime_t t;
    double ep[6];
    t=gpst2utc(epoch2time(ep0)); time2epoch(t,ep);
        assert(ep[0]==1980&&ep[1]==1&&ep[2]==6&&ep[3]==0&&ep[4]==0&&ep[5]==0.0);
    t=gpst2utc(epoch2time(ep1)); time2epoch(t,ep);
        assert(ep[0]==1992&&ep[1]==6&&ep[2]==30&&ep[3]==23&&ep[4]==59&&fabs(ep[5]-59.999999)<1E-14);
    t=gpst2utc(epoch2time(ep2)); time2epoch(t,ep);
        assert(ep[0]==1992&&ep[1]==7&&ep[2]==1&&ep[3]==0&&ep[4]==0&&ep[5]==0.0);
    t=gpst2utc(epoch2time(ep3)); time2epoch(t,ep);
        assert(ep[0]==1992&&ep[1]==7&&ep[2]==1&&ep[3]==0&&ep[4]==0&&ep[5]==0.0);
    t=gpst2utc(epoch2time(ep4)); time2epoch(t,ep);
        assert(ep[0]==2004&&ep[1]==12&&ep[2]==31&&ep[3]==23&&ep[4]==59&&fabs(ep[5]-46.999999)<1E-14);
    t=gpst2utc(epoch2time(ep5)); time2epoch(t,ep);
        assert(ep[0]==2005&&ep[1]==12&&ep[2]==31&&ep[3]==23&&ep[4]==59&&ep[5]==47.0);
    t=gpst2utc(epoch2time(ep6)); time2epoch(t,ep);
        assert(ep[0]==2037&&ep[1]==12&&ep[2]==31&&ep[3]==23&&ep[4]==59&&ep[5]==44.0);

    printf("%s utset7 : OK\n",__FILE__);
}
Ejemplo n.º 23
0
/* decode nmea gpgga: fix information ----------------------------------------*/
static int decode_nmeagga(char **val, int n, sol_t *sol)
{
    gtime_t time;
    double tod=0.0,lat=0.0,lon=0.0,hdop=0.0,alt=0.0,msl=0.0,ep[6],tt;
    double pos[3]={0};
    char ns='N',ew='E',ua=' ',um=' ';
    int i,solq=0,nrcv=0;
    
    trace(4,"decode_nmeagga: n=%d\n",n);
    
    for (i=0;i<n;i++) {
        switch (i) {
            case  0: tod =atof(val[i]); break; /* time in utc (hhmmss) */
            case  1: lat =atof(val[i]); break; /* latitude (ddmm.mmm) */
            case  2: ns  =*val[i];      break; /* N=north,S=south */
            case  3: lon =atof(val[i]); break; /* longitude (dddmm.mmm) */
            case  4: ew  =*val[i];      break; /* E=east,W=west */
            case  5: solq=atoi(val[i]); break; /* fix quality */
            case  6: nrcv=atoi(val[i]); break; /* # of satellite tracked */
            case  7: hdop=atof(val[i]); break; /* hdop */
            case  8: alt =atof(val[i]); break; /* altitude in msl */
            case  9: ua  =*val[i];      break; /* unit (M) */
            case 10: msl =atof(val[i]); break; /* height of geoid */
            case 11: um  =*val[i];      break; /* unit (M) */
        }
    }
    if ((ns!='N'&&ns!='S')||(ew!='E'&&ew!='W')) {
        trace(2,"invalid nmea gpgga format\n");
        return 0;
    }
    if (sol->time.time==0.0) {
        trace(2,"no date info for nmea gpgga\n");
        return 0;
    }
    pos[0]=(ns=='N'?1.0:-1.0)*dmm2deg(lat)*D2R;
    pos[1]=(ew=='E'?1.0:-1.0)*dmm2deg(lon)*D2R;
    pos[2]=alt+msl;
    
    time2epoch(sol->time,ep);
    septime(tod,ep+3,ep+4,ep+5);
    time=utc2gpst(epoch2time(ep));
    tt=timediff(time,sol->time);
    if      (tt<-43200.0) sol->time=timeadd(time, 86400.0);
    else if (tt> 43200.0) sol->time=timeadd(time,-86400.0);
    else sol->time=time;
    pos2ecef(pos,sol->rr);
    sol->stat=0<=solq&&solq<=8?solq_nmea[solq]:SOLQ_NONE;
    sol->ns=nrcv;
    
    sol->type=0; /* postion type = xyz */
    
    trace(5,"decode_nmeagga: %s rr=%.3f %.3f %.3f stat=%d ns=%d hdop=%.1f ua=%c um=%c\n",
          time_str(sol->time,0),sol->rr[0],sol->rr[1],sol->rr[2],sol->stat,sol->ns,
          hdop,ua,um);
    
    return 1;
}
Ejemplo n.º 24
0
/* adjust daily rollover of time ---------------------------------------------*/
static gtime_t adjday(gtime_t time, double tod)
{
    double ep[6],tod_p;
    time2epoch(time,ep);
    tod_p=ep[3]*3600.0+ep[4]*60.0+ep[5];
    if      (tod<tod_p-43200.0) tod+=86400.0;
    else if (tod>tod_p+43200.0) tod-=86400.0;
    ep[3]=ep[4]=ep[5]=0.0;
    return timeadd(epoch2time(ep),tod);
}
Ejemplo n.º 25
0
/* timeadd() */
void utest5(void)
{
    double ep0[]={2003,12,31,23,59,59.000000};
    double ep1[]={2004, 1, 1, 0, 0, 1.000000};
    double ep2[]={2004, 2,28, 0, 0, 0.000000};
    double ep3[]={2004, 2,29, 0, 0, 0.000000};
    gtime_t t;
    double ep[6];
    t=timeadd(epoch2time(ep0),3.0); time2epoch(t,ep);
        assert(ep[0]==2004&&ep[1]==1&&ep[2]==1&&ep[3]==0&&ep[4]==0&&ep[5]==2.0);
    t=timeadd(epoch2time(ep1),-3.0); time2epoch(t,ep);
        assert(ep[0]==2003&&ep[1]==12&&ep[2]==31&&ep[3]==23&&ep[4]==59&&ep[5]==58.0);
    t=timeadd(epoch2time(ep2),86400.0); time2epoch(t,ep);
        assert(ep[0]==2004&&ep[1]==2&&ep[2]==29&&ep[3]==0&&ep[4]==0&&ep[5]==0.0);
    t=timeadd(epoch2time(ep2),86400.0*2); time2epoch(t,ep);
        assert(ep[0]==2004&&ep[1]==3&&ep[2]==1&&ep[3]==0&&ep[4]==0&&ep[5]==0.0);
    t=timeadd(epoch2time(ep3),86400.0*2); time2epoch(t,ep);
        assert(ep[0]==2004&&ep[1]==3&&ep[2]==2&&ep[3]==0&&ep[4]==0&&ep[5]==0.0);
    
    printf("%s utset5 : OK\n",__FILE__);
}
Ejemplo n.º 26
0
/* timediff() */
void utest6(void)
{
    double ep0[]={2003,12,31,23,59,59.000000};
    double ep1[]={2004, 1, 1, 0, 0, 1.000000};
    double ep2[]={2004, 2,28, 0, 0, 0.000000};
    double ep3[]={2004, 2,29, 0, 0, 0.000000};
    double ep4[]={2004, 3, 1, 0, 0, 0.000000};
    double sec;
    sec=timediff(epoch2time(ep1),epoch2time(ep0));
        assert(sec==2.0);
    sec=timediff(epoch2time(ep0),epoch2time(ep1));
        assert(sec==-2.0);
    sec=timediff(epoch2time(ep3),epoch2time(ep2));
        assert(sec==86400.0);
    sec=timediff(epoch2time(ep4),epoch2time(ep2));
        assert(sec==86400.0*2);
    sec=timediff(epoch2time(ep3),epoch2time(ep4));
        assert(sec==-86400.0);
    
    printf("%s utset6 : OK\n",__FILE__);
}
Ejemplo n.º 27
0
// clear data ---------------------------------------------------------------
void __fastcall TPlot::Clear(void)
{
    AnsiString s;
    double ep[]={2010,1,1,0,0,0};
    int i;
    
    trace(3,"Clear\n");
    
    Week=NObs=0;
    
    for (i=0;i<2;i++) {
        freesolbuf(SolData+i);
        free(SolStat[i].data);
        SolStat[i].n=0;
        SolStat[i].data=NULL;
    }
    freeobs(&Obs);
    freenav(&Nav,0xFF);
    delete [] IndexObs;
    delete [] Az;
    delete [] El;
    IndexObs=NULL;
    Az=NULL;
    El=NULL;
    SolFiles[0]->Clear();
    SolFiles[1]->Clear();
    ObsFiles->Clear();
    NavFiles->Clear();
    NObs=0;
    SolIndex[0]=SolIndex[1]=ObsIndex=0;
    
    for (i=0;i<3;i++) {
        TimeEna[i]=0;
    }
    TimeStart=TimeEnd=epoch2time(ep);
    BtnAnimate->Down=false;
    
    if (PlotType>PLOT_NSAT) {
        UpdateType(PLOT_TRK);
    }
    if (!ConnectState) {
        initsolbuf(SolData  ,0,0);
        initsolbuf(SolData+1,0,0);
        Caption=Title!=""?Title:s.sprintf("%s ver.%s",PRGNAME,VER_RTKLIB);
    }
    else {
        initsolbuf(SolData  ,1,RtBuffSize+1);
        initsolbuf(SolData+1,1,RtBuffSize+1);
    }
    UpdateTime();
    UpdatePlot();
}
Ejemplo n.º 28
0
/* merge ephmeris data ---------------------------------------------------------
* merge separated ephmeris data to ephemeris struct
* args   : sdreph_t *eph    I/O sdr ephemeris structure
* return : none
*-----------------------------------------------------------------------------*/
void merge_g1(sdreph_t *eph)
{
    double ep[6]; 

    eph->geph.tof=glot2time(eph->nt,eph->n4,eph->tk[0],eph->tk[1],eph->tk[2]);
    
    /* compute current tow (tk is time of word 1) */
    eph->tow_gpst=time2gpst(eph->geph.tof,&eph->eph.week)+eph->s1cnt*2.0;
    eph->week_gpst=eph->eph.week;
    
    ep[3]=0;ep[4]=eph->geph.iode-60*3;ep[5]=0; /* 3 hour bias in UTC-GPST */
    eph->geph.toe=utc2gpst(epoch2time(ep)); /* time of ephemeris */
}
Ejemplo n.º 29
0
/* tle_pos() accuracy --------------------------------------------------------*/
static void utest3(void)
{
    const char *file1="../data/tle/brdc3050.12*";
    const char *file2="../data/tle/TLE_GNSS_20121101.txt";
    const char *file3="../data/tle/igs17127.erp";
    const double ep[6]={2012,10,31,0,0,0};
    nav_t nav={0};
    erp_t erp={0};
    tle_t tle={0};
    gtime_t time;
    char sat[32];
    double rs1[6],rs2[6],ds[6],dts[2],var;
    int i,j,k,stat,svh;
    
    readrnx(file1,0,"",NULL,&nav,NULL);
        assert(nav.n>0);
    
    stat=readerp(file3,&erp);
        assert(stat);
    
    stat=tle_read(file2,&tle);
        assert(stat);
    
    for (i=0;i<MAXSAT;i++) {
        satno2id(i+1,sat);
        
        fprintf(OUT,"SAT=%s\n",sat);
        
        for (j=0;j<96;j++) {
            time=timeadd(epoch2time(ep),900.0*j);
            
            if (!satpos(time,time,i+1,EPHOPT_BRDC,&nav,rs1,dts,&var,&svh)) continue;
            
            if (satsys(i+1,NULL)==SYS_QZS) svh&=0xFE;
            
            if (svh) continue;
            
            stat=tle_pos(time,sat,"","",&tle,&erp,rs2);
                assert(stat);
            
            for (k=0;k<3;k++) ds[k]=rs2[k]-rs1[k];
            
            fprintf(OUT,"%6.0f %11.3f %11.3f %11.3f %11.3f\n",900.0*j,
                    ds[0]/1e3,ds[1]/1e3,ds[2]/1e3,norm(ds,3)/1e3);
                
                assert(norm(ds,3)/1e3<300.0);
        }
        fprintf(OUT,"\n");
    }
    fprintf(OUT,"%s utest3 : OK\n",__FILE__);
}
Ejemplo n.º 30
0
/* decode nmea gprmc: recommended minumum data for gps -----------------------*/
static int decode_nmearmc(char **val, int n, sol_t *sol)
{
    double tod=0.0,lat=0.0,lon=0.0,vel=0.0,dir=0.0,date=0.0,ang=0.0,ep[6];
    double pos[3]={0};
    char act=' ',ns='N',ew='E',mew='E',mode='A';
    int i;
    
    trace(4,"decode_nmearmc: n=%d\n",n);
    
    for (i=0;i<n;i++) {
        switch (i) {
            case  0: tod =atof(val[i]); break; /* time in utc (hhmmss) */
            case  1: act =*val[i];      break; /* A=active,V=void */
            case  2: lat =atof(val[i]); break; /* latitude (ddmm.mmm) */
            case  3: ns  =*val[i];      break; /* N=north,S=south */
            case  4: lon =atof(val[i]); break; /* longitude (dddmm.mmm) */
            case  5: ew  =*val[i];      break; /* E=east,W=west */
            case  6: vel =atof(val[i]); break; /* speed (knots) */
            case  7: dir =atof(val[i]); break; /* track angle (deg) */
            case  8: date=atof(val[i]); break; /* date (ddmmyy) */
            case  9: ang =atof(val[i]); break; /* magnetic variation */
            case 10: mew =*val[i];      break; /* E=east,W=west */
            case 11: mode=*val[i];      break; /* mode indicator (>nmea 2) */
                                      /* A=autonomous,D=differential */
                                      /* E=estimated,N=not valid,S=simulator */
        }
    }
    if ((act!='A'&&act!='V')||(ns!='N'&&ns!='S')||(ew!='E'&&ew!='W')) {
        trace(2,"invalid nmea gprmc format\n");
        return 0;
    }
    pos[0]=(ns=='S'?-1.0:1.0)*dmm2deg(lat)*D2R;
    pos[1]=(ew=='W'?-1.0:1.0)*dmm2deg(lon)*D2R;
    septime(date,ep+2,ep+1,ep);
    septime(tod,ep+3,ep+4,ep+5);
    ep[0]+=ep[0]<80.0?2000.0:1900.0;
    sol->time=utc2gpst(epoch2time(ep));
    pos2ecef(pos,sol->rr);
    sol->stat=mode=='D'?SOLQ_DGPS:SOLQ_SINGLE;
    sol->ns=0;
    
    sol->type=0; /* postion type = xyz */
    
    trace(5,"decode_nmearmc: %s rr=%.3f %.3f %.3f stat=%d ns=%d vel=%.2f dir=%.0f ang=%.0f mew=%c mode=%c\n",
          time_str(sol->time,0),sol->rr[0],sol->rr[1],sol->rr[2],sol->stat,sol->ns,
          vel,dir,ang,mew,mode);
    
    return 1;
}