diff --git a/src/pntpos.c b/src/pntpos.c index e125ebc96b3a4ce99e9d39c87cb6c5750e0e8cd2..dffafceadafeb9b0355ed1dfba9152b6d309664b 100644 --- a/src/pntpos.c +++ b/src/pntpos.c @@ -335,7 +335,7 @@ static int rescode(int iter, const obsd_t *obs, int n, const double *rs, /* validate solution ---------------------------------------------------------*/ static int valsol(const double *azel, const int *vsat, int n, const prcopt_t *opt, const double *v, int nv, int nx, - char *msg) + char *msg, int chi_sq_check) { double azels[MAXOBS*2],dop[4],vv; int i,ns; @@ -346,7 +346,7 @@ static int valsol(const double *azel, const int *vsat, int n, vv=dot(v,v,nv); if (nv>nx&&vv>chisqr[nv-nx-1]) { sprintf(msg,"Warning: large chi-square error nv=%d vv=%.1f cs=%.1f",nv,vv,chisqr[nv-nx-1]); - /* return 0; */ /* threshold too strict for all use cases, report error but continue on */ + if (chi_sq_check) return 0; /* threshold too strict for all use cases, report error but continue on */ } /* large gdop check */ for (i=ns=0;i<n;i++) { @@ -362,11 +362,12 @@ static int valsol(const double *azel, const int *vsat, int n, } return 1; } + /* estimate receiver position ------------------------------------------------*/ static int estpos(const obsd_t *obs, int n, const double *rs, const double *dts, const double *vare, const int *svh, const nav_t *nav, const prcopt_t *opt, const ssat_t *ssat, sol_t *sol, double *azel, - int *vsat, double *resp, char *msg) + int *vsat, double *resp, char *msg, int chi_sq_check) { double x[NX]={0},dx[NX],Q[NX*NX],*v,*H,*var,sig; int i,j,k,info,stat,nv,ns; @@ -416,7 +417,7 @@ static int estpos(const obsd_t *obs, int n, const double *rs, const double *dts, sol->age=sol->ratio=0.0; /* validate solution */ - if ((stat=valsol(azel,vsat,n,opt,v,nv,NX,msg))) { + if ((stat=valsol(azel,vsat,n,opt,v,nv,NX,msg,chi_sq_check))) { sol->stat=opt->sateph==EPHOPT_SBAS?SOLQ_SBAS:SOLQ_SINGLE; } free(v); free(H); free(var); @@ -461,7 +462,7 @@ static int raim_fde(const obsd_t *obs, int n, const double *rs, } /* estimate receiver position without a satellite */ if (!estpos(obs_e,n-1,rs_e,dts_e,vare_e,svh_e,nav,opt,ssat,&sol_e,azel_e, - vsat_e,resp_e,msg_e)) { + vsat_e,resp_e,msg_e,1)) { trace(3,"raim_fde: exsat=%2d (%s)\n",obs[i].sat,msg); continue; } @@ -633,7 +634,7 @@ extern int pntpos(const obsd_t *obs, int n, const nav_t *nav, satposs(sol->time,obs,n,nav,opt_.sateph,rs,dts,var,svh); /* estimate receiver position with pseudorange */ - stat=estpos(obs,n,rs,dts,var,svh,nav,&opt_,ssat,sol,azel_,vsat,resp,msg); + stat=estpos(obs,n,rs,dts,var,svh,nav,&opt_,ssat,sol,azel_,vsat,resp,msg,n>=6&&opt->posopt[4]);// check chi-square if afterwards RAIM can be called /* raim fde */ if (!stat&&n>=6&&opt->posopt[4]) {