Better logic for message averaging.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@2543 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-08-30 18:21:41 +00:00
parent d3d956b54c
commit ed03e0003d
4 changed files with 45 additions and 34 deletions

View File

@ -18,7 +18,7 @@
character decoded*22 character decoded*22
character mycall*12,hiscall*12,hisgrid*6 character mycall*12,hiscall*12,hisgrid*6
data first/.true./,jjjmin/1000/,jjjmax/-1000/ data first/.true./,jjjmin/1000/,jjjmax/-1000/
data nutc0/-999/,nkhz0/-999/ data nutc0/-999/,nhz0/-9999999/
save save
! Mix sync tone to baseband, low-pass filter, downsample to 1378.125 Hz ! Mix sync tone to baseband, low-pass filter, downsample to 1378.125 Hz
@ -133,17 +133,18 @@
call timer('dec65b ',1) call timer('dec65b ',1)
if(nqd.eq.1 .and. nkv.eq.0) then if(nqd.eq.1 .and. nkv.eq.0) then
if(nutc.ne.nutc0 .or. nkhz.ne.nkhz0) syncbest=0. nhz=1000*nkhz + ndf
if(nutc.ne.nutc0 .or. abs(nhz-nhz0).ge.1000) syncbest=0. !### 1000 ??
if(sync2.gt.syncbest) then if(sync2.gt.syncbest) then
if(nutc.eq.nutc0 .and. nkhz.eq.nkhz0) nsave=nsave-1 nsave=nsave+1
if(nkhz.ne.nkhz0) nsave=0 nsave=mod(nsave-1,64)+1
nkhz0=nkhz
nsave=min(32,nsave+1)
nsave=max(1,nsave)
npol=nint(57.296*pol) npol=nint(57.296*pol)
call s3avg(nsave,mode65,nutc,ndf,dt+0.8,npol,s3,nsum, xdt=dt+0.8
call s3avg(nsave,mode65,nutc,nhz,xdt,npol,s3,nsum,
+ nkv,decoded) + nkv,decoded)
syncbest=sync2 syncbest=sync2
nhz0=nhz
endif endif
nutc0=nutc nutc0=nutc
endif endif

View File

@ -37,6 +37,7 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, &
mousefqso0=mousefqso mousefqso0=mousefqso
xpol=(nxpol.ne.0) xpol=(nxpol.ne.0)
if(.not.xpol) ndphi=0 if(.not.xpol) ndphi=0
nsum=0
!### Should use AppDir! ### !### Should use AppDir! ###
! open(23,file='release/CALL3.TXT',status='unknown') ! open(23,file='release/CALL3.TXT',status='unknown')

View File

@ -1,39 +1,54 @@
subroutine s3avg(nsave,mode65,nutc,ndf,xdt,npol,s3,nsum,nkv,decoded) subroutine s3avg(nsave,mode65,nutc,nhz,xdt,npol,s3,nsum,nkv,decoded)
! Save the current synchronized spectra, s3(64,63), for possible ! Save the current synchronized spectra, s3(64,63), for possible
! decoding of average. ! decoding of average.
real s3(64,63) !Synchronized spectra for 63 symbols real s3(64,63) !Synchronized spectra for 63 symbols
real s3a(64,63,32) !Saved spectra real s3a(64,63,64) !Saved spectra
real s3b(64,63) !Average real s3b(64,63) !Average spectra
integer iutc(32),idf(32),ipol(32) integer iutc(64),ihz(64),ipol(64)
real dt(32) real dt(64)
character*22 decoded character*22 decoded
logical ltext logical ltext,first
data first/.true./
save save
if(first) then
iutc=-1
ihz=0
ipol=0
first=.false.
ihzdiff=100
dtdiff=0.2
endif
do i=1,64
if(nutc.eq.iutc(i) .and. abs(nhz-ihz(i)).lt.ihzdiff) then
nsave=mod(nsave-1+64,64)+1
go to 900
endif
enddo
iutc(nsave)=nutc !Save UTC iutc(nsave)=nutc !Save UTC
idf(nsave)=ndf !Save DF ihz(nsave)=nhz !Save freq in Hz
ipol(nsave)=npol !Save pol ipol(nsave)=npol !Save pol
dt(nsave)=xdt !Save DT dt(nsave)=xdt !Save DT
s3a(1:64,1:63,nsave)=s3 !Save the spectra s3a(1:64,1:63,nsave)=s3 !Save the spectra
write(71,3001) nsave,nutc,ndf,npol,xdt
3001 format(4i5,f8.1)
flush(71)
s3b=0. s3b=0.
nsum=0 do i=1,64 !Accumulate avg spectra
idfdiff=100 if(iutc(i).lt.0) cycle
dtdiff=0.2 if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only same sequence
do i=1,nsave !Accumulate avg spectra if(abs(nhz-ihz(i)).gt.ihzdiff) cycle !Freq must match
if(mod(iutc(i),2).ne.mod(nutc,2)) cycle !Use only 1st or 2nd sequence
if(abs(ndf-idf(i)).gt.idfdiff) cycle !DF must match
if(abs(xdt-dt(i)).gt.dtdiff) cycle !DT must match if(abs(xdt-dt(i)).gt.dtdiff) cycle !DT must match
s3b=s3b + s3a(1:64,1:63,i) s3b=s3b + s3a(1:64,1:63,i)
nsum=nsum+1 nsum=nsum+1
enddo enddo
! write(71,3001) nutc,nsave,nhz,npol,xdt
!3001 format(4i8,1f8.1)
! flush(71)
decoded=' ' decoded=' '
if(nsum.ge.2) then !Try decoding the sverage if(nsum.ge.2) then !Try decoding the sverage
nadd=mode65*nsum nadd=mode65*nsum
@ -45,5 +60,5 @@ subroutine s3avg(nsave,mode65,nutc,ndf,xdt,npol,s3,nsum,nkv,decoded)
endif endif
endif endif
return 900 return
end subroutine s3avg end subroutine s3avg

View File

@ -822,7 +822,7 @@ void MainWindow::createStatusBar() //createStatusBar
lab5->setFrameStyle(QFrame::Panel | QFrame::Sunken); lab5->setFrameStyle(QFrame::Panel | QFrame::Sunken);
statusBar()->addWidget(lab5); statusBar()->addWidget(lab5);
lab6 = new QLabel("Avg: 0/0"); lab6 = new QLabel("Avg: 0");
lab6->setAlignment(Qt::AlignHCenter); lab6->setAlignment(Qt::AlignHCenter);
lab6->setMinimumSize(QSize(50,10)); lab6->setMinimumSize(QSize(50,10));
lab6->setFrameStyle(QFrame::Panel | QFrame::Sunken); lab6->setFrameStyle(QFrame::Panel | QFrame::Sunken);
@ -1264,7 +1264,7 @@ void MainWindow::readFromStdout() //readFromStdout
m_nsum=t.mid(17,4).toInt(); m_nsum=t.mid(17,4).toInt();
m_nsave=t.mid(21,4).toInt(); m_nsave=t.mid(21,4).toInt();
QString t2; QString t2;
t2.sprintf("Avg: %d/%d",m_nsum,m_nsave); t2.sprintf("Avg: %d",m_nsum);
lab6->setText(t2); lab6->setText(t2);
} }
if(t.indexOf("<DecodeFinished>") >= 0) { if(t.indexOf("<DecodeFinished>") >= 0) {
@ -1337,7 +1337,6 @@ void MainWindow::guiUpdate()
static int nc1=1; static int nc1=1;
static char msgsent[23]; static char msgsent[23];
static int nsendingsh=0; static int nsendingsh=0;
static int fQSOz=-1;
int khsym=0; int khsym=0;
double tx1=0.0; double tx1=0.0;
@ -1504,11 +1503,6 @@ void MainWindow::guiUpdate()
QDateTime t = QDateTime::currentDateTimeUtc(); QDateTime t = QDateTime::currentDateTimeUtc();
int fQSO=g_pWideGraph->QSOfreq(); int fQSO=g_pWideGraph->QSOfreq();
if(fQSO != fQSOz) {
qDebug() << fQSOz << fQSO << m_nutc0;
m_nsave=0;
fQSOz=fQSO;
}
g_pAstro->astroUpdate(t, m_myGrid, m_hisGrid, fQSO, m_setftx, g_pAstro->astroUpdate(t, m_myGrid, m_hisGrid, fQSO, m_setftx,
m_txFreq, m_azelDir); m_txFreq, m_azelDir);
m_setftx=0; m_setftx=0;