Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions src/ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs,
for (i=0;i<n&&i<MAXOBS;i++) {
sat=obs[i].sat;

/* line-of-sight vector from receiver to satellite */
if ((r=geodist(rs+i*6,rr,e))<=0.0||
satazel(pos,e,azel+i*2)<opt->elmin) {
exc[i]=1;
Expand Down Expand Up @@ -1030,7 +1031,7 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs,
if (opt->ionoopt==IONOOPT_EST) {
if (rtk->x[II(sat,opt)]==0.0) continue;
/* The vertical iono delay is estimated, but the residual is
* in the direction of the slant, so apply the slat factor
* in the direction of the slant, so apply the slant factor
* mapping function. */
if (H) H[II(sat,opt)+nx*nv]=C*ionmapf(pos,azel+i*2);
}
Expand All @@ -1051,47 +1052,48 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs,

/* variance */
var[nv]=varerr(sat,sys,azel[1+i*2],
rtk->ssat[sat-1].snr_rover[frq],
j,opt,obs+i);
rtk->ssat[sat-1].snr_rover[frq],
j,opt,obs+i);
var[nv] +=vart+SQR(C)*vari+var_rs[i];
if (sys==SYS_GLO&&code==1) var[nv]+=VAR_GLO_IFB;

trace(3,"%s sat=%2d %s%d res=%9.4f sig=%9.4f el=%4.1f\n",str,sat,
code?"P":"L",frq+1,res,sqrt(var[nv]),azel[1+i*2]*R2D);
trace(3,"%s post=%2d sat=%2d %s%d res=%9.4f sig=%9.4f el=%4.1f\n",
str,post,sat,code?"P":"L",frq+1,res,sqrt(var[nv]),azel[1+i*2]*R2D);

/* reject satellite by pre-fit residuals */
if (!post&&opt->maxinno[code]>0.0&&fabs(res)>opt->maxinno[code]) {
double maxinno = (post==-1?1000:1)*opt->maxinno[code];
if (post<=0&&opt->maxinno[code]>0.0&&fabs(res)>maxinno) {
trace(2,"outlier (%d) rejected %s sat=%2d %s%d res=%9.4f el=%4.1f\n",
post,str,sat,code?"P":"L",frq+1,res,azel[1+i*2]*R2D);
exc[i]=1; rtk->ssat[sat-1].rejc[frq]++;
continue;
}
/* record large post-fit residuals */
if (post&&fabs(res)>sqrt(var[nv])*THRES_REJECT) {
if (post>0&&fabs(res)>sqrt(var[nv])*THRES_REJECT) {
obsi[ne]=i; frqi[ne]=j; ve[ne]=res; ne++;
}
if (code==0) rtk->ssat[sat-1].vsat[frq]=1;
nv++;
}
}
/* reject satellite with large and max post-fit residual */
if (post&&ne>0) {
if (post>0&&ne>0) {
vmax=ve[0]; maxobs=obsi[0]; maxfrq=frqi[0]; rej=0;
for (j=1;j<ne;j++) {
if (fabs(vmax)>=fabs(ve[j])) continue;
vmax=ve[j]; maxobs=obsi[j]; maxfrq=frqi[j]; rej=j;
}
sat=obs[maxobs].sat;
trace(2,"outlier (%d) rejected %s sat=%2d %s%d res=%9.4f el=%4.1f\n",
post,str,sat,maxfrq%2?"P":"L",maxfrq/2+1,vmax,azel[1+maxobs*2]*R2D);
post,str,sat,maxfrq%2?"P":"L",maxfrq/2+1,vmax,azel[1+maxobs*2]*R2D);
exc[maxobs]=1; rtk->ssat[sat-1].rejc[maxfrq%2]++; stat=0;
ve[rej]=0;
}
if (R) {
for (j=0;j<nv;j++) for (i=0;i<nv;i++) R[i+j*nv]=0.0;
for (i=0;i<nv;i++) R[i+i*nv]=var[i];
}
return post?stat:nv;
return post>0?stat:nv;
}
/* number of estimated states ------------------------------------------------*/
extern int pppnx(const prcopt_t *opt)
Expand Down Expand Up @@ -1225,8 +1227,11 @@ extern void pppos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
matcpy(xp,rtk->x,rtk->nx,1);
matcpy(Pp,rtk->P,rtk->nx,rtk->nx);

/* prefit residuals */
if (!(nv=ppp_res(0,obs,n,rs,dts,var,svh,dr,exc,nav,xp,rtk,v,H,R,azel))) {
/* prefit residuals
* NOTE: use different limit for pre-fit residuals in first iteration
* by using argument post = -1
*/
if (!(nv=ppp_res(i==0?-1:0,obs,n,rs,dts,var,svh,dr,exc,nav,xp,rtk,v,H,R,azel))) {
trace(2,"%s ppp (%d) no valid obs data\n",str,i+1);
break;
}
Expand Down