Skip to content
Snippets Groups Projects
Commit 833285ca authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

chisquare check if raim

parent 3f0bb15e
No related branches found
No related tags found
No related merge requests found
...@@ -335,7 +335,7 @@ static int rescode(int iter, const obsd_t *obs, int n, const double *rs, ...@@ -335,7 +335,7 @@ static int rescode(int iter, const obsd_t *obs, int n, const double *rs,
/* validate solution ---------------------------------------------------------*/ /* validate solution ---------------------------------------------------------*/
static int valsol(const double *azel, const int *vsat, int n, static int valsol(const double *azel, const int *vsat, int n,
const prcopt_t *opt, const double *v, int nv, int nx, 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; double azels[MAXOBS*2],dop[4],vv;
int i,ns; int i,ns;
...@@ -346,7 +346,7 @@ static int valsol(const double *azel, const int *vsat, int n, ...@@ -346,7 +346,7 @@ static int valsol(const double *azel, const int *vsat, int n,
vv=dot(v,v,nv); vv=dot(v,v,nv);
if (nv>nx&&vv>chisqr[nv-nx-1]) { 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]); 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 */ /* large gdop check */
for (i=ns=0;i<n;i++) { for (i=ns=0;i<n;i++) {
...@@ -362,11 +362,12 @@ static int valsol(const double *azel, const int *vsat, int n, ...@@ -362,11 +362,12 @@ static int valsol(const double *azel, const int *vsat, int n,
} }
return 1; return 1;
} }
/* estimate receiver position ------------------------------------------------*/ /* estimate receiver position ------------------------------------------------*/
static int estpos(const obsd_t *obs, int n, const double *rs, const double *dts, 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 double *vare, const int *svh, const nav_t *nav,
const prcopt_t *opt, const ssat_t *ssat, sol_t *sol, double *azel, 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; double x[NX]={0},dx[NX],Q[NX*NX],*v,*H,*var,sig;
int i,j,k,info,stat,nv,ns; 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, ...@@ -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; sol->age=sol->ratio=0.0;
/* validate solution */ /* 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; sol->stat=opt->sateph==EPHOPT_SBAS?SOLQ_SBAS:SOLQ_SINGLE;
} }
free(v); free(H); free(var); free(v); free(H); free(var);
...@@ -461,7 +462,7 @@ static int raim_fde(const obsd_t *obs, int n, const double *rs, ...@@ -461,7 +462,7 @@ static int raim_fde(const obsd_t *obs, int n, const double *rs,
} }
/* estimate receiver position without a satellite */ /* 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, 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); trace(3,"raim_fde: exsat=%2d (%s)\n",obs[i].sat,msg);
continue; continue;
} }
...@@ -633,7 +634,7 @@ extern int pntpos(const obsd_t *obs, int n, const nav_t *nav, ...@@ -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); satposs(sol->time,obs,n,nav,opt_.sateph,rs,dts,var,svh);
/* estimate receiver position with pseudorange */ /* 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 */ /* raim fde */
if (!stat&&n>=6&&opt->posopt[4]) { if (!stat&&n>=6&&opt->posopt[4]) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment