Skip to content

Commit

Permalink
Modified carrier phase calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
taroz committed Aug 20, 2014
1 parent 746b404 commit 93e51d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/sdrout.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void writelog_header(FILE *fp, sdrtrk_t *trk)
for (i=0;i<2*trk->corrn+1;i++) fprintf(fp,",I(%d)",(int)trk->corrx[i]);
fprintf(fp,",Code Freq,Code Err,Code NCO");
fprintf(fp,",Carr Freq,Carr Err,Carr NCO");
fprintf(fp,",Freq Err");
fprintf(fp,",Freq Err,Carrier Phase");
fprintf(fp,",Flag Sync,Flag Syncf,Flag TOW,Flag Dec");
fprintf(fp,"\n");
}
Expand All @@ -426,7 +426,7 @@ extern void writelog(FILE *fp, sdrtrk_t *trk,sdrnav_t *nav)
for (i=0;i<2*trk->corrn+1;i++) fprintf(fp,",%f",trk->II[i]);
fprintf(fp,",%f,%f,%f",trk->codefreq,trk->codeErr,trk->codeNco);
fprintf(fp,",%f,%f,%f",trk->carrfreq,trk->carrErr,trk->carrNco);
fprintf(fp,",%f",trk->freqErr);
fprintf(fp,",%f,%f",trk->freqErr,trk->L[0]);
fprintf(fp,",%d,%d,%d,%d",
nav->flagsync,nav->flagsyncf,nav->flagtow,nav->flagdec);
fprintf(fp,"\n");
Expand Down
16 changes: 11 additions & 5 deletions src/sdrtrk.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,26 @@ extern void setobsdata(sdrch_t *sdr, uint64_t buffloc, uint64_t cnt,
trk->remcout[0]=trk->oldremcode*sdr->f_sf/trk->codefreq;

/* doppler */
trk->D[0]=trk->carrfreq-sdr->f_if-sdr->foffset;
trk->D[0]=-(trk->carrfreq-sdr->f_if-sdr->foffset);

/* carrier phase */
if (!trk->flagremcarradd) {
trk->L[0]+=trk->remcarr/DPI;
trk->flagpolarityadd=ON;
trk->L[0]-=trk->remcarr/DPI;
SDRPRINTF("%s cnt=%llu inicarrier=%f m\n",sdr->satstr,cnt,CLIGHT/FREQ1*trk->remcarr/DPI);
trk->flagremcarradd=ON;
}

if (sdr->nav.flagsyncf&&!trk->flagpolarityadd) {
if (sdr->nav.polarity==-1) { trk->L[0]+=0.5; }
if (sdr->nav.polarity==1) {
trk->L[0]+=0.5;
SDRPRINTF("%s cnt=%llu polarity=0.5\n",sdr->satstr,cnt);
} else {
SDRPRINTF("%s cnt=%llu polarity=0.0\n",sdr->satstr,cnt);
}
trk->flagpolarityadd=ON;
}

trk->L[0]+=trk->D[0]*(double)trk->loopms/1000;
trk->L[0]+=trk->D[0]*(trk->loopms*sdr->currnsamp/sdr->f_sf);

trk->Isum+=fabs(trk->sumI[0]);
if (snrflag) {
Expand Down

0 comments on commit 93e51d1

Please sign in to comment.