1.readobsnav(ts,te,ti,fopt->inf,index,MAXINFILE,popt,&obss,&navs,stas))
首先存储观测数据,结构体,有两个,obs_t obsd_t
typedef struct { /* observation data */
int n,nmax; /* number of obervation data/allocated */
obsd_t *data; /* observation data records */
} obs_t;
typedef struct { /* observation data record */
gtime_t time; /* receiver sampling time (GPST) */
unsigned char sat,rcv; /* satellite/receiver number */
unsigned char SNR [NFREQ+NEXOBS]; /* signal strength (0.25 dBHz) */
unsigned char LLI [NFREQ+NEXOBS]; /* loss of lock indicator */
unsigned char code[NFREQ+NEXOBS]; /* code indicator (CODE_???) */
char *type[NFREQ];
double L[NFREQ+NEXOBS]; /* observation data carrier-phase (cycle) */
double P[NFREQ+NEXOBS]; /* observation data pseudorange (m) */
float D[NFREQ+NEXOBS]; /* observation data doppler frequency (Hz) */
} obsd_t;
2. if (!readobsnav(ts,te,ti,fopt->inf,index,MAXINFILE,popt,&obss,&navs,stas))
obs的初始化
3.
nep=readrnxt(infile[i],rcv,ts,te,ti,prcopt->rnxopt,obs,nav,rcv<=2?sta+rcv-1:NULL);
//读取文件。
4. stat=readrnxfile(file,ts,te,tint,opt,0,rcv,&type,obs,nav,sta);
建立指针,打开文件。
FILE *fp;
fp=fopen(file,"r");
5.
stat=readrnxfp(fp,ts,te,tint,opt,flag,index,type,obs,nav,sta);
6. /* read rinex header */
if (!readrnxh(fp,&ver,type,&sys,&tsys,tobs,nav,sta)) return 0;
/* flag=0:except for clock,1:clock */
if ((!flag&&*type=='C')||(flag&&*type!='C')) return 0;
/* read rinex body */
switch (*type)
{
case 'O': return readrnxobs(fp,ts,te,tint,opt,index,ver,tsys,tobs,obs);
case 'N': return readrnxnav(fp,opt,ver,sys ,nav);
case 'G': return readrnxnav(fp,opt,ver,SYS_GLO,nav);
case 'J': return readrnxnav(fp,opt,ver,SYS_QZS,nav); /* extension */
case 'L': return readrnxnav(fp,opt,ver,SYS_GAL,nav); /* extension */
case 'C': return readrnxclk(fp,opt,index,nav);
}
case 'O': return readrnxobs(fp,ts,te,tint,opt,index,ver,tsys,tobs,obs);
7. obs_t *obs
obs是指针
obsd_t *data;
data也是指针
if (!(data=(obsd_t *)malloc(sizeof(obsd_t)*MAXOBS))) return 0;
/* read rinex obs data body */
while ((n=readrnxobsb(fp,opt,ver,tobs,&flag,data))>=0&&stat>=0)
//读取单个历元进行循环。
{
for (i=0;i
{
/* utc -> gpst */
if (tsys==TSYS_UTC) data[i].time=utc2gpst(data[i].time);
/* save cycle-slip */
saveslips(slips,data+i);
}
/* screen data by time */
if (n>0&&!screent(data[0].time,ts,te,tint)) continue;
for (i=0;i
{
/* restore cycle-slip */
restslips(slips,data+i);
data[i].rcv=(unsigned char)rcv;
/* save obs data */
if ((stat=addobsdata(obs,data+i))<0) break;
}
//完成单个历元的叠加
}
//完成整个文件的diej叠加