From 62af4029783ecd6653a37404aa6d0dfc93a9fea5 Mon Sep 17 00:00:00 2001 From: AndreHauschild Date: Fri, 20 Feb 2026 17:39:30 +0100 Subject: [PATCH 1/2] Use different limit for pre-fit residuals in first iteration of PPP --- src/ppp.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/ppp.c b/src/ppp.c index 385dc9990..a5121638d 100644 --- a/src/ppp.c +++ b/src/ppp.c @@ -958,6 +958,7 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs, for (i=0;ielmin) { exc[i]=1; @@ -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); } @@ -1051,23 +1052,24 @@ 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:10*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; @@ -1075,7 +1077,7 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs, } } /* 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=fabs(ve[j])) continue; @@ -1083,7 +1085,7 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs, } 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; } @@ -1091,7 +1093,7 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs, for (j=0;j0?stat:nv; } /* number of estimated states ------------------------------------------------*/ extern int pppnx(const prcopt_t *opt) @@ -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; } From 6a3d71105402653d393f7468a8e712744e97bf53 Mon Sep 17 00:00:00 2001 From: AndreHauschild Date: Tue, 24 Feb 2026 14:15:17 +0100 Subject: [PATCH 2/2] Revise threshold adjustment --- src/ppp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ppp.c b/src/ppp.c index a5121638d..c85773881 100644 --- a/src/ppp.c +++ b/src/ppp.c @@ -1061,7 +1061,7 @@ static int ppp_res(int post, const obsd_t *obs, int n, const double *rs, str,post,sat,code?"P":"L",frq+1,res,sqrt(var[nv]),azel[1+i*2]*R2D); /* reject satellite by pre-fit residuals */ - double maxinno = (post==-1?1000:10*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);