From fd0336f234fceb7d8786cc44d2d32ef8d066b97d Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 1 Jan 2024 15:48:24 -0500 Subject: [PATCH] Optimize calling the QMAP decoder for different sub-sequence tasks. --- qmap/libqmap/CMakeLists.txt | 2 +- qmap/libqmap/chkstat.f90 | 21 ++++++++++----------- qmap/libqmap/decode0.f90 | 6 +++--- qmap/libqmap/getcand2.f90 | 8 ++++---- qmap/libqmap/q65c.f90 | 21 ++++++++++++++------- qmap/libqmap/qmapa.f90 | 12 ++++++------ 6 files changed, 38 insertions(+), 32 deletions(-) diff --git a/qmap/libqmap/CMakeLists.txt b/qmap/libqmap/CMakeLists.txt index 4ec580ea5..c24aec1c3 100644 --- a/qmap/libqmap/CMakeLists.txt +++ b/qmap/libqmap/CMakeLists.txt @@ -6,7 +6,7 @@ set (libq65_FSRCS astro0.f90 astrosub.f90 cfom.f90 -# chkstat.f90 + chkstat.f90 dcoord.f90 decode0.f90 dot.f90 diff --git a/qmap/libqmap/chkstat.f90 b/qmap/libqmap/chkstat.f90 index 0bb7051e5..760aa47df 100644 --- a/qmap/libqmap/chkstat.f90 +++ b/qmap/libqmap/chkstat.f90 @@ -1,23 +1,22 @@ -subroutine chkstat(dd,ihsym,bSkip) +subroutine chkstat(dd,nhsym,dbdiff) real dd(2,5760000) - real power(60) - logical*1 bSkip + sq0=0. + sq1=0. k=0 do i=1,60 sq=0. do j=1,96000 k=k+1 sq=sq + dd(1,k)*dd(1,k) + dd(2,k)*dd(2,k) - enddo - power(i)=sq/(2.0*96000.0) + enddo + if(i.ge.12 .and. i.le.24) sq0=sq0+sq + if(i.ge.42 .and. i.le.54) sq1=sq1+sq enddo - bSkip=.false. - n1=count(power(1:30).lt.15.0) - n2=count(power(31:60).lt.15.0) - if(ihsym.le.200 .and. n1.gt.15) bSkip=.true. - if(ihsym.gt.200 .and. n2.gt.15) bSkip=.true. - + db0=db(1.0+sq0) + db1=db(1.0+sq1) + dbdiff=db0-db1 + return end subroutine chkstat diff --git a/qmap/libqmap/decode0.f90 b/qmap/libqmap/decode0.f90 index 5f6cee741..806eccd9b 100644 --- a/qmap/libqmap/decode0.f90 +++ b/qmap/libqmap/decode0.f90 @@ -43,9 +43,9 @@ subroutine decode0(dd,ss,savg) hisgrid0=hisgrid call timer('qmapa ',0) - call qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & - mousedf,mousefqso,nagain,nfshift,max_drift,offset, & - nfcal,mycall,hiscall,hisgrid,nfsample,nmode,ndepth, & + call qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & + mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, & + nfcal,mycall,hiscall,hisgrid,nfsample,nmode,ndepth, & datetime,ndop00,fselected,bAlso30,nhsym,NCFOM) call timer('qmapa ',1) diff --git a/qmap/libqmap/getcand2.f90 b/qmap/libqmap/getcand2.f90 index 47b7720c4..212b97e39 100644 --- a/qmap/libqmap/getcand2.f90 +++ b/qmap/libqmap/getcand2.f90 @@ -1,5 +1,5 @@ -subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntol,f0_selected, & - bAlso30,cand,ncand) +subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntx30a,ntx30b, & + ntol,f0_selected,bAlso30,cand,ncand) ! Get candidates for Q65 decodes, based on presence of sync tone. @@ -74,7 +74,7 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntol,f0_selected, & if(.not.bAlso30) cycle ntrperiod=30 - if(nhsym.le.200) then + if(nhsym.le.200 .and. ntx30a.le.5) then call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) if(sync_ok) then ! Sync tone is present, we have a candidate for decoding @@ -92,7 +92,7 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntol,f0_selected, & endif iseq=1 - if(nhsym.ge.330) then + if(nhsym.ge.330 .and. ntx30b.le.5) then call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) if(sync_ok) then ! Sync tone is present, we have a candidate for decoding diff --git a/qmap/libqmap/q65c.f90 b/qmap/libqmap/q65c.f90 index 3f3829eba..e2f700e2d 100644 --- a/qmap/libqmap/q65c.f90 +++ b/qmap/libqmap/q65c.f90 @@ -12,7 +12,7 @@ subroutine q65c(itimer) real*8 fcenter integer nparams0(NJUNK+3),nparams(NJUNK+3) logical first - logical*1 bAlso30,bSkip + logical*1 bAlso30 character*12 mycall,hiscall character*6 mygrid,hisgrid character*20 datetime @@ -41,21 +41,28 @@ subroutine q65c(itimer) npatience=1 newdat=1 !Always on ?? + call chkstat(dd,nhsym,dbdiff) +! if(nhsym.eq.390) write(*,3001) nutc,nhsym,dbdiff +!3001 format(i4.4,i6,f7.1) + + if(dbdiff.gt.5.0) ntx30b=30 + if(dbdiff.lt.-5.0) ntx30a=30 + if(ntx30a.gt.5) then dd(1:2,1:30*96000)=0. ss(1:200,1:NFFT)=0. + do i=1,NFFT + savg(i)=sum(ss(201:400,i)) + enddo endif if(ntx30b.gt.5) then dd(1:2,30*96000+1:60*96000)=0. ss(201:400,1:NFFT)=0. + do i=1,NFFT + savg(i)=sum(ss(1:200,i)) + enddo endif -! call chkstat(dd,nhsym,bSkip) -! if(bSkip .and. nagain.eq.0) then -! print*,'A',nhsym,ntx30a,ntx30b,ntx60,junk1,junk2,bAlso30 -! return -! endif - call timer('decode0 ',0) call decode0(dd,ss,savg) call timer('decode0 ',1) diff --git a/qmap/libqmap/qmapa.f90 b/qmap/libqmap/qmapa.f90 index c8b2e6ad2..e5322193e 100644 --- a/qmap/libqmap/qmapa.f90 +++ b/qmap/libqmap/qmapa.f90 @@ -1,7 +1,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & - mousedf,mousefqso,nagain,nfshift,max_drift,offset,nfcal,mycall, & - hiscall,hisgrid,nfsample,nBaseSubmode,ndepth,datetime,ndop00, & - fselected,bAlso30,nhsym,nCFOM) + mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, & + nfcal,mycall,hiscall,hisgrid,nfsample,nBaseSubmode,ndepth, & + datetime,ndop00,fselected,bAlso30,nhsym,nCFOM) ! Processes timf2 data received from Linrad to find and decode Q65 signals. @@ -32,7 +32,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & common/decodes/ndecodes,ncand,nQDecoderDone,nWDecoderBusy, & nWTransmitting,result(50) save - + tsec0=sec_midn() if(nagain.eq.1) ndepth=3 !Use full depth for click-to-decode nkhz_center=nint(1000.0*(fcenter-int(fcenter))) @@ -44,8 +44,8 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & call timer('get_cand',0) ! Get a list of decoding candidates - call getcand2(ss,savg,nts_q65,nagain,nhsym,ntol,f0_selected,bAlso30, & - cand,ncand) + call getcand2(ss,savg,nts_q65,nagain,nhsym,ntx30a,ntx30b,ntol, & + f0_selected,bAlso30,cand,ncand) call timer('get_cand',1) nwrite_q65=0