Skip to content

Commit 8037d29

Browse files
- Remove recent update to ddres() based on results of more extensive testing
- Increase observation variance if half cycle ambiguity flag set - Minor fix to init of base residual interpolation
1 parent 8e04ef6 commit 8037d29

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

src/rinex.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,14 @@ static void decode_obsh(FILE *fp, char *buff, double ver, int *tsys,
435435
if (i==5&&fabs(ver-3.02)<1e-3) {
436436
for (j=0;j<nt;j++) if (tobs[i][j][1]=='1') tobs[i][j][1]='2';
437437
}
438-
/* if unknown code in ver.3, set default code */
439-
for (j=0;j<nt;j++) {
438+
/* uncomment this code to convert unknown codes to defaults */
439+
/* for (j=0;j<nt;j++) {
440440
if (tobs[i][j][2]) continue;
441441
if (!(p=strchr(frqcodes,tobs[i][j][1]))) continue;
442442
tobs[i][j][2]=defcodes[i][(int)(p-frqcodes)];
443443
trace(2,"set default for unknown code: sys=%c code=%s\n",buff[0],
444444
tobs[i][j]);
445-
}
445+
} */
446446
}
447447
else if (strstr(label,"WAVELENGTH FACT L1/2")) ; /* opt ver.2 */
448448
else if (strstr(label,"# / TYPES OF OBSERV" )) { /* ver.2 */

src/rtklib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ typedef struct { /* RTK control/result type */
11771177
char errbuf[MAXERRMSG]; /* error message buffer */
11781178
prcopt_t opt; /* processing options */
11791179
int initial_mode; /* initial positioning mode */
1180+
int epoch; /* epoch number */
11801181
} rtk_t;
11811182

11821183
typedef struct { /* receiver raw data control type */

src/rtkpos.c

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,22 +1223,13 @@ static int ddres(rtk_t *rtk, const nav_t *nav, const obsd_t *obs, double dt, con
12231223
frq=f%nf;code=f<nf?0:1;
12241224

12251225
/* find reference satellite with highest elevation, set to i */
1226-
for (i=-1,hiqual=0,j=0;j<ns;j++) {
1226+
for (i=-1,j=0;j<ns;j++) {
12271227
sysi=rtk->ssat[sat[j]-1].sys;
12281228
if (!test_sys(sysi,m) || sysi==SYS_SBS) continue;
12291229
if (!validobs(iu[j],ir[j],f,nf,y)) continue;
1230-
/* skip this sat if el is lower than current ref sat */
1231-
if (i>-1&&azel[1+iu[j]*2]<azel[1+iu[i]*2]) continue;
1232-
/* skip low qual sat unless no other valid sat */
1233-
if ((rtk->ssat[sat[j]-1].slip[frq]&LLI_SLIP)||
1234-
(rtk->ssat[sat[j]-1].lock[frq]<=0)) {
1235-
if (hiqual>0) continue; /* don't use low qual ref sat if have high qual sat */
1236-
i=j; /* set ref sat (low quality) */
1237-
}
1238-
else {
1239-
hiqual=1; /* indicate high quality ref sat found */
1240-
i=j; /* set ref sat (hi quality) */
1241-
}
1230+
/* skip sat with slip unless no other valid sat */
1231+
if (i>=0&&rtk->ssat[sat[j]-1].slip[frq]&LLI_SLIP) continue;
1232+
if (i<0||azel[1+iu[j]*2]>=azel[1+iu[i]*2]) i=j;
12421233
}
12431234
if (i<0) continue;
12441235

@@ -1359,6 +1350,9 @@ static int ddres(rtk_t *rtk, const nav_t *nav, const obsd_t *obs, double dt, con
13591350
SNR_UNIT*rtk->ssat[sat[j]-1].snr_rover[frq],
13601351
SNR_UNIT*rtk->ssat[sat[j]-1].snr_base[frq],
13611352
bl,dt,f,opt,&obs[iu[j]]);
1353+
/* increase variance if half cycle flags set */
1354+
if (!code&&(obs[iu[i]].LLI[frq]&LLI_HALFC)) Ri[nv]+=0.01;
1355+
if (!code&&(obs[iu[j]].LLI[frq]&LLI_HALFC)) Rj[nv]+=0.01;
13621356

13631357
/* set valid data flags */
13641358
if (opt->mode>PMODE_DGPS) {
@@ -1416,10 +1410,10 @@ static double intpres(gtime_t time, const obsd_t *obs, int n, const nav_t *nav,
14161410
int i,j,k,nf=NF(opt);
14171411

14181412
tt=timediff(time,obs[0].time); /* time delta between rover obs and current base obs */
1419-
trace(3,"intpres : n=%d tt=%.1f\n",n,tt);
1413+
trace(3,"intpres : n=%d tt=%.1f, epoch=%d\n",n,tt,rtk->epoch);
14201414
/* use current base obs if first epoch or delta time between rover obs and
14211415
current base obs very small */
1422-
if (nb==0||fabs(tt)<DTTOL) {
1416+
if (nb==0||rtk->epoch==0||fabs(tt)<DTTOL) {
14231417
nb=n; for (i=0;i<n;i++) obsb[i]=obs[i]; /* current base obs -> previous base obs */
14241418
return tt;
14251419
}
@@ -1463,7 +1457,7 @@ static int ddidx(rtk_t *rtk, int *ix, int gps, int glo, int sbs)
14631457
int i,j,k,m,f,n,nb=0,na=rtk->na,nf=NF(&rtk->opt),nofix;
14641458
double fix[MAXSAT],ref[MAXSAT];
14651459

1466-
trace(3,"ddmat: gps=%d/%d glo=%d/%d sbs=%d\n",gps,rtk->opt.gpsmodear,glo,rtk->opt.glomodear,sbs);
1460+
trace(3,"ddidx: gps=%d/%d glo=%d/%d sbs=%d\n",gps,rtk->opt.gpsmodear,glo,rtk->opt.glomodear,sbs);
14671461

14681462
/* clear fix flag for all sats (1=float, 2=fix) */
14691463
for (i=0;i<MAXSAT;i++) for (j=0;j<NFREQ;j++) {
@@ -2086,7 +2080,7 @@ static int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
20862080
if (rtk->opt.mode==PMODE_STATIC_START) {
20872081
rtk->opt.mode=PMODE_KINEMA;
20882082
trace(3,"Fix and hold complete: switch to kinematic mode\n");
2089-
}
2083+
}
20902084
}
20912085
stat=SOLQ_FIX;
20922086
}
@@ -2133,8 +2127,8 @@ static int relpos(rtk_t *rtk, const obsd_t *obs, int nu, int nr,
21332127
rtk->sol.qv[5]=(float)rtk->P[5+3*rtk->nx];
21342128
}
21352129
rtk->nfix=0;
2136-
trace(3,"sol_rr= ");tracemat(3,rtk->sol.rr,1,6,15,3);
21372130
}
2131+
trace(3,"sol_rr= ");tracemat(3,rtk->sol.rr,1,6,15,3);
21382132
/* save phase measurements */
21392133
for (i=0;i<n;i++) for (j=0;j<nf;j++) {
21402134
if (obs[i].L[j]==0.0) continue;
@@ -2177,6 +2171,7 @@ extern void rtkinit(rtk_t *rtk, const prcopt_t *opt)
21772171
rtk->nx=opt->mode<=PMODE_FIXED?NX(opt):pppnx(opt);
21782172
rtk->na=opt->mode<=PMODE_FIXED?NR(opt):pppnx(opt);
21792173
rtk->tt=0.0;
2174+
rtk->epoch=0;
21802175
rtk->x=zeros(rtk->nx,1);
21812176
rtk->P=zeros(rtk->nx,rtk->nx);
21822177
rtk->xa=zeros(rtk->na,1);
@@ -2379,6 +2374,7 @@ extern int rtkpos(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav)
23792374
}
23802375
/* relative potitioning */
23812376
relpos(rtk,obs,nu,nr,nav);
2377+
rtk->epoch++;
23822378
outsolstat(rtk,nav);
23832379

23842380
return 1;

0 commit comments

Comments
 (0)