From 397e48abff7d992123795e61216c94de659d3953 Mon Sep 17 00:00:00 2001 From: Igor Chernikov Date: Tue, 15 Feb 2022 22:07:52 +0300 Subject: [PATCH] calculate forcedt in decoder --- lib/agccft8.f90 | 104 ++++++++++++++++++++++++++--------------------- lib/decoder.f90 | 10 ++--- lib/ft8_mod1.f90 | 2 +- 3 files changed, 64 insertions(+), 52 deletions(-) diff --git a/lib/agccft8.f90 b/lib/agccft8.f90 index 232a57ec..8984a6b1 100644 --- a/lib/agccft8.f90 +++ b/lib/agccft8.f90 @@ -1,7 +1,4 @@ -! This source code file was last time modified by Igor UA3DJY on 20191103 -! All changes are shown in the patch file coming together with the full JTDX source code. - -subroutine agccft8(nfa,nfb) +subroutine agccft8(nfa,nfb,lforcesync,forcedt) use ft8_mod1, only : dd8,twopi,lagccbail integer, parameter :: NFFT=1024,NSZ=426,NHSYM=178,NHSTEP=960 !3413 = NFFT*5000/12000 @@ -12,6 +9,7 @@ subroutine agccft8(nfa,nfb) integer, intent(in) :: nfa,nfb complex c11(0:NFFT/2) logical(1) first + logical(1), intent(in) :: lforcesync equivalence (x11,c11) data first/.true./ save first,w11 @@ -29,56 +27,70 @@ subroutine agccft8(nfa,nfb) nf1=NFFT*nfa/12000+1; nf2=NFFT*nfblim/12000 nmed=(nf2-nf1)/2; nsb=nf2-nf1+1 - allocate(sa33(nsb), STAT = nAllocateStatus1) - if(nAllocateStatus1.ne.0) STOP "Not enough memory" - allocate(indx(nsb), STAT = nAllocateStatus1) - if(nAllocateStatus1.ne.0) STOP "Not enough memory" - - do j=1,10 - i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT) - call four2a(c11,NFFT,1,-1,0) !r2c forward FFT - do i=nf1,nf2 - s33=ABS(c11(i)); ss33(i)=SQRT(s33) + if(lforcesync) then + jmin=0; specmin=1.E10 + do j=1,175 + i0=(j-1)*NFFT; x11=fac1*w11*dd8(i0+1:i0+NFFT) + call four2a(c11,NFFT,1,-1,0) !r2c forward FFT + spec=0. + do i=nf1,nf2 + s33=abs(c11(i)); spec=spec+s33 + enddo + if(spec.gt.0.001 .and. spec.lt.specmin) then; specmin=spec; jmin=j; endif enddo - sa33(1:nsb)=ss33(nf1:nf2) - call indexx(sa33(1:nsb),nsb,indx) - smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif - enddo + forcedt=15.*jmin/175; if(forcedt.gt.7.5) forcedt=forcedt-15. + else + allocate(sa33(nsb), STAT = nAllocateStatus1) + if(nAllocateStatus1.ne.0) STOP "Not enough memory" + allocate(indx(nsb), STAT = nAllocateStatus1) + if(nAllocateStatus1.ne.0) STOP "Not enough memory" - do j=169,178 - i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT) - call four2a(c11,NFFT,1,-1,0) !r2c forward FFT - do i=nf1,nf2 - s33=ABS(c11(i)); ss33(i)=SQRT(s33) + do j=1,10 + i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT) + call four2a(c11,NFFT,1,-1,0) !r2c forward FFT + do i=nf1,nf2 + s33=ABS(c11(i)); ss33(i)=SQRT(s33) + enddo + sa33(1:nsb)=ss33(nf1:nf2) + call indexx(sa33(1:nsb),nsb,indx) + smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif enddo - sa33(1:nsb)=ss33(nf1:nf2) - call indexx(sa33(1:nsb),nsb,indx) - smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif - enddo - deallocate (sa33, STAT = nDeAllocateStatus1) - if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' - deallocate (indx, STAT = nDeAllocateStatus1) - if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + do j=169,178 + i0=(j-1)*nhstep; x11=fac1*w11*dd8(i0+1:i0+NFFT) + call four2a(c11,NFFT,1,-1,0) !r2c forward FFT + do i=nf1,nf2 + s33=ABS(c11(i)); ss33(i)=SQRT(s33) + enddo + sa33(1:nsb)=ss33(nf1:nf2) + call indexx(sa33(1:nsb),nsb,indx) + smed=sa33(indx(nmed)); if(smed.gt.1.e-6) then; s3(j)=smed; else; s3(j)=1.0; endif + enddo - s3min1=minval(s3(1:10)); s3min2=minval(s3(169:178)); s3min=min(s3min1,s3min2) - s3max1=maxval(s3(1:10)); s3max2=maxval(s3(169:178)); s3max=max(s3max1,s3max2) - if(s3min.lt.0.1) then; s3min=1.0; s3max=1.0; endif - s3ratio=s3max/s3min + deallocate (sa33, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' + deallocate (indx, STAT = nDeAllocateStatus1) + if (nDeAllocateStatus1.ne.0) print *, 'failed to release memory' - lagccbail=.false. + s3min1=minval(s3(1:10)); s3min2=minval(s3(169:178)); s3min=min(s3min1,s3min2) + s3max1=maxval(s3(1:10)); s3max2=maxval(s3(169:178)); s3max=max(s3max1,s3max2) + if(s3min.lt.0.1) then; s3min=1.0; s3max=1.0; endif + s3ratio=s3max/s3min + + lagccbail=.false. ! 2.0dB delta - if(s3ratio.lt.1.26) then; lagccbail=.true.; return; endif + if(s3ratio.lt.1.26) then; lagccbail=.true.; return; endif - k=1 - do j=1,10 - dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960 - enddo - k=1+168*960 - do j=169,178 - dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960 - enddo - dd8(170881:171650)=dd8(170881:171650)/s3(178); dd8(171651:180000)=0. + k=1 + do j=1,10 + dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960 + enddo + k=1+168*960 + do j=169,178 + dd8(k:k+959)=dd8(k:k+959)/s3(j); k=k+960 + enddo + dd8(170881:171650)=dd8(170881:171650)/s3(178); dd8(171651:180000)=0. + endif return end subroutine agccft8 \ No newline at end of file diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 736e5640..4b71500b 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -10,7 +10,7 @@ subroutine multimode_decoder(params) use ft8_decode use ft4_decode use ft8_mod1, only : ndecodes,allmessages,allsnrs,allfreq,mycall12_0,mycall12_00,hiscall12_0,nmsg,odd,even,oddcopy, & - evencopy,nlasttx,lqsomsgdcd,mycalllen1,msgroot,msgrootlen,lapmyc,lagcc,sumxdtt,avexdt,lforcesync, & + evencopy,nlasttx,lqsomsgdcd,mycalllen1,msgroot,msgrootlen,lapmyc,lagcc,sumxdtt,avexdt, & nfawide,nfbwide,mycall,hiscall,lhound,mybcall,hisbcall,lenabledxcsearch,lwidedxcsearch,hisgrid4, & lmultinst,dd8,nft8cycles,nft8swlcycles,lskiptx1,ncandallthr,nincallthr,incall,msgincall,xdtincall, & maskincallthr,ltxing @@ -138,9 +138,9 @@ subroutine multimode_decoder(params) if(params%nmode.eq.8) then mycalllen1=len_trim(mycall)+1 msgroot=''; msgroot=trim(mycall)//' '//trim(hiscall)//' '; msgrootlen=len_trim(msgroot) - lcommonft8b=params%lcommonft8b; lagcc=params%nagcc; lhound=params%lhound; lforcesync=params%lforcesync - nft8cycles=params%nft8cycles; nft8swlcycles=params%nft8swlcycles - if(params%nagcc) call agccft8(params%nfa,params%nfb) + lcommonft8b=params%lcommonft8b; lagcc=params%nagcc; lhound=params%lhound + nft8cycles=params%nft8cycles; nft8swlcycles=params%nft8swlcycles; forcedt=0. + if(params%nagcc .or. params%lforcesync) call agccft8(params%nfa,params%nfb,params%lforcesync,forcedt) if((hiscall.ne.hiscall12_0 .and. hiscall.ne.' ') & .or. (mycall.ne.mycall12_0 .and. mycall.ne.' ') .or. (lhound.neqv.lhoundprev)) then if(hiscall.ne.' ') then @@ -2308,10 +2308,10 @@ endif else if(nFT8decd.eq.2) then; avexdt=(1.5*avexdt+0.5*sumxdt/nFT8decd)/2 endif endif + if(params%lforcesync .and. nFT8decd.eq.0) avexdt=forcedt endif call fillhash(numthreads,.true.) ncandall=sum(ncandallthr(1:numthreads)) - lforcesync=.false. ! call timer('decft8 ',1) go to 800 endif diff --git a/lib/ft8_mod1.f90 b/lib/ft8_mod1.f90 index 898d456e..30241ff6 100644 --- a/lib/ft8_mod1.f90 +++ b/lib/ft8_mod1.f90 @@ -19,7 +19,7 @@ module ft8_mod1 apsymdxnsr73(77),apsymdxns732(77),apsymmynsrrr(77),idtonedxcns73(58),idtonefox73(58),idtonespec(58) integer*1 gen(91,174) logical one(0:511,0:8),lqsomsgdcd,first_osd - logical(1) lapmyc,lagcc,lagccbail,lhound,lenabledxcsearch,lwidedxcsearch,lmultinst,lskiptx1,ltxing,lforcesync + logical(1) lapmyc,lagcc,lagccbail,lhound,lenabledxcsearch,lwidedxcsearch,lmultinst,lskiptx1,ltxing data maskincallthr/0,30,45,55,65,75,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175/ data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/ data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/