From aff22a904d8f2494e940404ac2959b4d0be3702a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 4 Aug 2020 11:51:40 -0400 Subject: [PATCH 1/4] Better marking of QRA66 Rx freq range and Tol on Wide Graph. --- widgets/plotter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index 15057f4a8..fde2a707b 100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -508,13 +508,13 @@ void CPlotter::DrawOverlay() //DrawOverlay() or m_mode=="QRA64" or m_mode=="QRA66" or m_mode=="FT8" or m_mode=="FT4" or m_mode.startsWith("FST4")) { - if(m_mode=="QRA64" or (m_mode=="JT65" and m_bVHF)) { + if(m_mode=="QRA64" or m_mode=="QRA66" or (m_mode=="JT65" and m_bVHF)) { painter0.setPen(penGreen); x1=XfromFreq(m_rxFreq-m_tol); x2=XfromFreq(m_rxFreq+m_tol); - painter0.drawLine(x1,28,x2,28); + painter0.drawLine(x1,27,x2,27); x1=XfromFreq(m_rxFreq); - painter0.drawLine(x1,24,x1,30); + painter0.drawLine(x1,21,x1,27); if(m_mode=="JT65") { painter0.setPen(penOrange); @@ -527,7 +527,7 @@ void CPlotter::DrawOverlay() //DrawOverlay() } painter0.setPen(penGreen); x6=XfromFreq(m_rxFreq+bw); //Highest tone - painter0.drawLine(x6,24,x6,30); + painter0.drawLine(x6,21,x6,27); } else { // Draw the green "goal post" From 668631180d68bd1c9686ddba51245509bc4d1caa Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 4 Aug 2020 11:52:29 -0400 Subject: [PATCH 2/4] Code cleanup. --- lib/decoder.f90 | 5 ++--- lib/qra66_decode.f90 | 49 +++++++++++--------------------------------- 2 files changed, 14 insertions(+), 40 deletions(-) diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 41f1d0f7e..de2a31df5 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -197,9 +197,8 @@ subroutine multimode_decoder(ss,id2,params,nfsample) if(params%nmode.eq.66) then ! We're in QRA66 mode call timer('decqra66',0) - call my_qra66%decode(qra66_decoded,id2,params%nutc,params%nfa, & - params%nfb,params%nfqso,params%ndepth,logical(params%lapcqonly), & - mycall,hiscall,hisgrid) + call my_qra66%decode(qra66_decoded,id2,params%nutc,params%nfqso, & + params%ntol,params%ndepth,mycall,hiscall,hisgrid) call timer('decqra66',1) go to 800 endif diff --git a/lib/qra66_decode.f90 b/lib/qra66_decode.f90 index b24dd9cd9..ade80d638 100644 --- a/lib/qra66_decode.f90 +++ b/lib/qra66_decode.f90 @@ -28,7 +28,7 @@ module qra66_decode contains - subroutine decode(this,callback,iwave,nutc,nfa,nfb,nfqso,ndepth,lapdx, & + subroutine decode(this,callback,iwave,nutc,nfqso,ntol,ndepth, & mycall,hiscall,hisgrid) use timer_module, only: timer @@ -41,12 +41,9 @@ contains character(len=6) :: hisgrid character*37 decoded integer*2 iwave(NFFT1) !Raw data - integer ipk(1) integer dat4(12) logical lapdx,ltext - complex c00(0:NFFT1-1) !Spectrum, then analytic signal - complex c0(0:NFFT1-1) !Snalytic signal - real s(900) + complex c0(0:NFFT1-1) !Analytic signal, 6000 S/s real s3(-64:127,63) real a(5) data nc1z/-1/,nc2z/-1/,ng2z/-1/,maxaptypez/-1/ @@ -67,12 +64,11 @@ contains b90=20.0 !8 to 25 is OK; not very critical nFadingModel=1 -! These probably need work: +! AP control could be done differently, but this works well: maxaptype=0 if(ndepth.eq.2) maxaptype=3 if(ndepth.eq.3) maxaptype=5 -! Prime the decoder for possible AP decoding if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z .or. & maxaptype.ne.maxaptypez) then do naptype=0,maxaptype @@ -87,60 +83,39 @@ contains endif naptype=maxaptype -! Compute the full-length spectrum +! Downsample to give complex data at 6000 S/s fac=2.0/NFFT1 c0=fac*iwave call four2a(c0,NFFT1,1,-1,1) !Forward c2c FFT - - nadd=101 - nh=nadd/2 - df2=nh*df1 - iz=3000.0/df2 - do i=1,iz !Compute smoothed spectrum - s(i)=0. - j0=nh*i - do j=j0-nh,j0+nh - s(i)=s(i) + real(c0(j))**2 + aimag(c0(j))**2 - enddo - enddo - call smo121(s,iz) - ia=1450/df2 - ib=1550/df2 - s(:ia)=0. - s(ib:)=0. - ipk=maxloc(s) - f0=df2*ipk(1) - 0.5*baud !Candidate sync frequency - c0(NFFT2/2+1:NFFT2)=0. !Zero the top half c0(0)=0.5*c0(0) call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT ntol=100 call sync66a(iwave,15*12000,nsps,nfqso,ntol,xdt,f0,snr1) - jpk=(xdt+0.5)*6000 - 384 !### Empirical ### + jpk=(xdt+0.5)*6000 - 384 !### Empirical ### if(jpk.lt.0) jpk=0 - c00=c0 a=0. - a(1)=-(f0 + 2.0*baud) !For sync66a - call twkfreq(c00,c0,15*6000,6000.0,a) + a(1)=-(f0 + 2.0*baud) !Data tones start 2 bins higher + call twkfreq(c0,c0,15*6000,6000.0,a) xdt=jpk/6000.0 - 0.5 call spec66(c0(jpk:jpk+85*NSPS/2-1),s3) - do j=1,63 + do j=1,63 !Normalize to symbol baseline call pctile(s3(:,j),192,40,base) s3(:,j)=s3(:,j)/base enddo -! Apply AGC s3max=20.0 - do j=1,63 + do j=1,63 !Apply AGC to suppress pings xx=maxval(s3(-64:127,j)) if(xx.gt.s3max) s3(-64:127,j)=s3(-64:127,j)*s3max/xx enddo - + +!Call Nico's QRA64 decoder call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, & nFadingModel,dat4,snr2,irc) - snr2=snr2 + 6.0 + snr2=snr2 + 5.563 !10*log(6912/1920) if(irc.gt.0) call badmsg(irc,dat4,nc1,nc2,ng2) decoded=' ' From 902bb4d5e070196d5ce17299ddbf6724936a57fd Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 4 Aug 2020 11:58:09 -0400 Subject: [PATCH 3/4] Add timer calls in qra66_decode. --- lib/qra66_decode.f90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/qra66_decode.f90 b/lib/qra66_decode.f90 index ade80d638..ecef6a870 100644 --- a/lib/qra66_decode.f90 +++ b/lib/qra66_decode.f90 @@ -92,7 +92,9 @@ contains call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT ntol=100 + call timer('sync66 ',0) call sync66a(iwave,15*12000,nsps,nfqso,ntol,xdt,f0,snr1) + call timer('sync66 ',1) jpk=(xdt+0.5)*6000 - 384 !### Empirical ### if(jpk.lt.0) jpk=0 a=0. @@ -113,8 +115,10 @@ contains enddo !Call Nico's QRA64 decoder + call timer('qra64_de',0) call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, & nFadingModel,dat4,snr2,irc) + call timer('qra64_de',1) snr2=snr2 + 5.563 !10*log(6912/1920) if(irc.gt.0) call badmsg(irc,dat4,nc1,nc2,ng2) From 88102af49d72337e34754e8c4cd5c6488cb92d36 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 4 Aug 2020 12:53:37 -0400 Subject: [PATCH 4/4] Fic the transfer of ntol from GUI to qra66_decode(). --- lib/qra66_decode.f90 | 1 - widgets/plotter.cpp | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/qra66_decode.f90 b/lib/qra66_decode.f90 index ecef6a870..8892769d0 100644 --- a/lib/qra66_decode.f90 +++ b/lib/qra66_decode.f90 @@ -91,7 +91,6 @@ contains c0(0)=0.5*c0(0) call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT - ntol=100 call timer('sync66 ',0) call sync66a(iwave,15*12000,nsps,nfqso,ntol,xdt,f0,snr1) call timer('sync66 ',1) diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index fde2a707b..d3416db02 100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -512,22 +512,22 @@ void CPlotter::DrawOverlay() //DrawOverlay() painter0.setPen(penGreen); x1=XfromFreq(m_rxFreq-m_tol); x2=XfromFreq(m_rxFreq+m_tol); - painter0.drawLine(x1,27,x2,27); + painter0.drawLine(x1,26,x2,26); x1=XfromFreq(m_rxFreq); - painter0.drawLine(x1,21,x1,27); + painter0.drawLine(x1,20,x1,26); if(m_mode=="JT65") { painter0.setPen(penOrange); x3=XfromFreq(m_rxFreq+20.0*bw/65.0); //RO - painter0.drawLine(x3,24,x3,30); + painter0.drawLine(x3,20,x3,26); x4=XfromFreq(m_rxFreq+30.0*bw/65.0); //RRR - painter0.drawLine(x4,24,x4,30); + painter0.drawLine(x4,20,x4,26); x5=XfromFreq(m_rxFreq+40.0*bw/65.0); //73 - painter0.drawLine(x5,24,x5,30); + painter0.drawLine(x5,20,x5,26); } painter0.setPen(penGreen); x6=XfromFreq(m_rxFreq+bw); //Highest tone - painter0.drawLine(x6,21,x6,27); + painter0.drawLine(x6,20,x6,26); } else { // Draw the green "goal post"