From 80787c0721c5d27ce46d92e79f684c3d7ec90099 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 8 Nov 2016 20:11:02 +0000 Subject: [PATCH] New sync pattern for QRA64; implement fast-fading algorithm for QRA64A-C. Several things in QRA64 still need attention, in addition to submodes D and E! git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7301 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/genqra64.f90 | 11 +++++++--- lib/qra/qra64/qra64_subs.c | 3 ++- lib/qra64a.f90 | 43 +++++++++++++++++++++++++++++++------- lib/spec64.f90 | 9 +++++++- lib/sync64.f90 | 6 +++++- mainwindow.cpp | 8 +++++++ mainwindow.h | 2 ++ 7 files changed, 68 insertions(+), 14 deletions(-) diff --git a/lib/genqra64.f90 b/lib/genqra64.f90 index 1b952a059..b9c660ac0 100644 --- a/lib/genqra64.f90 +++ b/lib/genqra64.f90 @@ -8,6 +8,7 @@ subroutine genqra64(msg0,ichk,msgsent,itone,itype) character*22 msgsent !Message as it will be received integer itone(84) character*3 cok !' ' or 'OOO' + logical old_qra_sync integer dgen(13) integer sent(63) integer icos7(0:6) @@ -39,11 +40,15 @@ subroutine genqra64(msg0,ichk,msgsent,itone,itype) if(ichk.ne.0) go to 999 !Return if checking only call qra64_enc(dgen,sent) !Encode using QRA64 - itone(1:7)=10*icos7 !Insert 7x7 Costas array in 3 places + nsync=10 + inquire(file='old_qra_sync',exist=old_qra_sync) + if(old_qra_sync) nsync=1 + + itone(1:7)=nsync*icos7 !Insert 7x7 Costas array in 3 places itone(8:39)=sent(1:32) - itone(40:46)=10*icos7 + itone(40:46)=nsync*icos7 itone(47:77)=sent(33:63) - itone(78:84)=10*icos7 + itone(78:84)=nsync*icos7 endif 999 return diff --git a/lib/qra/qra64/qra64_subs.c b/lib/qra/qra64/qra64_subs.c index dd01adfee..cb719f943 100644 --- a/lib/qra/qra64/qra64_subs.c +++ b/lib/qra/qra64/qra64_subs.c @@ -59,7 +59,7 @@ void qra64_dec_(float r[], int* nc1, int* nc2, int* ng2, int* APtype, if(*iset==0) { // *rc = qra64_decode(pqra64codec,&EbNodBEstimated,xdec,r); *rc = qra64_decode_fastfading(pqra64codec,&EbNodBEstimated,xdec,r, - nSubmode,b90,nFadingModel); + nSubmode,b90,nFadingModel); *snr = EbNodBEstimated - 31.0; #ifdef NICO_WANTS_SNR_DUMP @@ -69,3 +69,4 @@ void qra64_dec_(float r[], int* nc1, int* nc2, int* ng2, int* APtype, #endif } } + diff --git a/lib/qra64a.f90 b/lib/qra64a.f90 index a45f70dcd..918f73ce8 100644 --- a/lib/qra64a.f90 +++ b/lib/qra64a.f90 @@ -14,7 +14,9 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & real a(3) real dd(NMAX) !Raw data sampled at 12000 Hz real s3(LN) !Symbol spectra + real s3a(LN) !Symbol spectra integer dat4(12) !Decoded message (as 12 integers) + integer dat4x(12) data nc1z/-1/,nc2z/-1/,ng2z/-1/ save @@ -29,7 +31,7 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & call packgrid(hisgrid,ng2,ltext) nSubmode=nint(log(float(mode64)/log(2.0))) b90=1.0 - nFadingModel=1 + nFadingModel=0 if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then do naptype=0,5 call qra64_dec(s3,nc1,nc2,ng2,naptype,1,nSubmode,b90, & @@ -42,26 +44,51 @@ subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & maxf1=5 call sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snr1,c00) - + npts2=216000 naptype=4 LL=64*(mode64+2) NN=63 - do itry0=1,3 +! do itry0=1,3 + do itry0=1,1 idf0=itry0/2 if(mod(itry0,2).eq.0) idf0=-idf0 a(1)=-(f0+0.248*(idf0-0.33*kpk)) nfreq=nint(-a(1)) a(3)=0. - do itry1=1,3 +! do itry1=1,3 + do itry1=1,1 idf1=itry1/2 if(mod(itry1,2).eq.0) idf1=-idf1 a(2)=-0.67*(idf1 + 0.67*kpk) call twkfreq(c00,c0,npts2,4000.0,a) - call spec64(c0,npts2,mode64,jpk,s3,LL,NN) - call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, & - nFadingModel,dat4,snr2,irc) - decoded=' ' + call spec64(c0,npts2,mode64,jpk,s3a,LL,NN) + ircmin=99 + do iter=0,10 + b90=1.728**iter + s3(1:LL*NN)=s3a(1:LL*NN) + call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, & + nFadingModel,dat4,snr2,irc) + if(abs(snr2).gt.30.) snr2=-30.0 + if(irc.eq.0) go to 10 +! write(*,3001) iter,b90,snr2,irc +! write(72,3001) iter,b90,snr2,irc +!3001 format(i2,2f7.1,i4) + if(irc.ge.0 .and. irc.le.ircmin) then + dat4x=dat4 + b90x=b90 + snr2x=snr2 + ircmin=irc + endif + enddo + if(ircmin.ne.99) then + dat4=dat4x + b90=b90x + snr2=snr2x + irc=ircmin + endif +10 decoded=' ' +! write(73,3001) iter,b90,snr2,irc if(irc.ge.0) then call unpackmsg(dat4,decoded) !Unpack the user message call fmtmsg(decoded,iz) diff --git a/lib/spec64.f90 b/lib/spec64.f90 index 064329b2b..29e4c93b2 100644 --- a/lib/spec64.f90 +++ b/lib/spec64.f90 @@ -11,7 +11,7 @@ subroutine spec64(c0,npts2,mode64,jpk,s3,LL,NN) if(j.ge.32) jj=j+14 !Skip middle Costas array ja=jpk + (jj-1)*nfft6 jb=ja+nfft6-1 - cs(0:nfft6-1)=1.3e-8*c0(ja:jb) + cs(0:nfft6-1)=c0(ja:jb) call four2a(cs,nfft6,1,-1,1) do ii=1,LL i=ii-65 @@ -20,5 +20,12 @@ subroutine spec64(c0,npts2,mode64,jpk,s3,LL,NN) enddo enddo +! df=4000.0/nfft6 +! do i=1,LL +! freq=(i-65)*df +! write(73,3002) i-65,freq,(1.e-6*s3(i,j),j=1,5) +!3002 format(i5,6f10.3) +! enddo + return end subroutine spec64 diff --git a/lib/sync64.f90 b/lib/sync64.f90 index 11ab12acf..63741cf4a 100644 --- a/lib/sync64.f90 +++ b/lib/sync64.f90 @@ -10,6 +10,7 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0) real s0(0:NSPC-1) !Sum of s1+s2+s3 real s0a(0:NSPC-1) !Best synchromized spectrum (saved) real s0b(0:NSPC-1) !tmp + logical old_qra_sync integer icos7(0:6) !Costas 7x7 tones integer ipk0(1) complex cc(0:NSPC-1) !Costas waveform @@ -22,12 +23,15 @@ subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0) save if(mode64.ne.mode64z) then + nsync=10 + inquire(file='old_qra_sync',exist=old_qra_sync) + if(old_qra_sync) nsync=1 twopi=8.0*atan(1.0) dfgen=mode64*12000.0/6912.0 k=-1 phi=0. do j=0,6 !Compute complex Costas waveform - dphi=twopi*10.0*icos7(j)*dfgen/4000.0 + dphi=twopi*nsync*icos7(j)*dfgen/4000.0 do i=1,2304 phi=phi + dphi if(phi.gt.twopi) phi=phi-twopi diff --git a/mainwindow.cpp b/mainwindow.cpp index 04cb07434..69b235823 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -655,6 +655,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, "1 W","2 W","5 W","10 W","20 W","50 W","100 W","200 W","500 W","1 kW"}; m_msg[0][0]=0; + m_bQRAsyncWarned=false; for(int i=0; i<28; i++) { //Initialize dBm values float dbm=(10.0*i)/3.0 - 30.0; @@ -4186,6 +4187,13 @@ void MainWindow::on_actionQRA64_triggered() ui->sbSubmode->setValue(m_nSubMode); ui->actionInclude_averaging->setEnabled(false); ui->actionInclude_correlation->setEnabled(false); + + QFile f(m_appDir + "/old_qra_sync"); + if(f.exists() and !m_bQRAsyncWarned) { + MessageBox::warning_message (this, tr ("*** WARNING *** "), + "Using old QRA64 sync pattern."); + m_bQRAsyncWarned=true; + } } void MainWindow::on_actionISCAT_triggered() diff --git a/mainwindow.h b/mainwindow.h index 5f1a72a9a..ea0574b33 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -422,6 +422,8 @@ private: bool m_bFastDone; bool m_bAltV; bool m_bNoMoreFiles; + bool m_bQRAsyncWarned; + float m_pctZap; int m_ihsym; int m_nzap;