From 4769bf45d2780010ee6b2c8488e8c843141bbd8f Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Sun, 3 Mar 2019 13:02:22 -0600 Subject: [PATCH] Make FT4 AP decoding work in RTTY RU and Field Day activities. Move Nuttal window to standalone subroutine nuttal_window.f90 and use Nuttal window in ft4/getcandidates4.f90. --- CMakeLists.txt | 1 + lib/ft4/ft4_decode.f90 | 31 ++++++++++--------------------- lib/ft4/getcandidates4.f90 | 18 ++---------------- lib/nuttal_window.f90 | 15 +++++++++++++++ lib/symspec.f90 | 14 ++------------ 5 files changed, 30 insertions(+), 49 deletions(-) create mode 100644 lib/nuttal_window.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0db7a569e..ccb2f6d5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -512,6 +512,7 @@ set (wsjt_FSRCS lib/msk144signalquality.f90 lib/msk144sim.f90 lib/mskrtd.f90 + lib/nuttal_window.f90 lib/ft4/ft4sim.f90 lib/ft4/ft4sim_mult.f90 lib/ft4/ft4_decode.f90 diff --git a/lib/ft4/ft4_decode.f90 b/lib/ft4/ft4_decode.f90 index 8d40aa8cd..89e219545 100644 --- a/lib/ft4/ft4_decode.f90 +++ b/lib/ft4/ft4_decode.f90 @@ -16,7 +16,6 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & character*6 hhmmss complex cd2(0:NMAX/NDOWN-1) !Complex waveform -! complex cds(0:NMAX/NDOWN-1) !Complex waveform complex cb(0:NMAX/NDOWN-1) complex cd(0:NN*NSS-1) !Complex waveform complex ctwk(4*NSS),ctwk2(4*NSS) @@ -32,6 +31,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & real savg(NH1),sbase(NH1) integer apbits(2*ND) + integer apmy_ru(28),aphis_fd(28) integer nrxx(100) integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3) integer*2 iwave(NMAX) !Generated full-length waveform @@ -107,9 +107,6 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & ! 4 MyCall DxCall RRR (77 ap bits) ! 5 MyCall DxCall 73 (77 ap bits) ! 6 MyCall DxCall RR73 (77 ap bits) -!******** -! For this contest-oriented mode, OK to only look for RR73?? -! Currently, 2 AP passes in all Txn states except for Tx5. !******** naptypes(0,1:4)=(/1,2,0,0/) ! Tx6 selected (CQ) naptypes(1,1:4)=(/2,3,0,0/) ! Tx1 @@ -131,6 +128,8 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & apbits=0 apbits(1)=99 apbits(30)=99 + apmy_ru=0 + aphis_fd=0 if(len(trim(mycall)) .lt. 3) go to 10 @@ -147,6 +146,8 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & call unpack77(c77,1,msgsent,unpk77_success) if(i3.ne.1 .or. (message.ne.msgsent) .or. .not.unpk77_success) go to 10 read(c77,'(77i1)') message77 + apmy_ru=2*mod(message77(1:28)+rvec(2:29),2)-1 + aphis_fd=2*mod(message77(30:57)+rvec(29:56),2)-1 message77=mod(message77+rvec,2) call encode174_91(message77,cw) apbits=2*cw-1 @@ -390,43 +391,31 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & llrd(1:28)=apmag*apbits(1:28) else if(ncontest.eq.4) then apmask(2:29)=1 - llrd(2:29)=apmag*apbits(1:28) - else if(ncontest.eq.6) then ! ??? RR73; MyCall ??? - apmask(29:56)=1 - llrd(29:56)=apmag*apbits(1:28) + llrd(2:29)=apmag*apmy_ru(1:28) endif endif if(iaptype.eq.3) then ! MyCall,DxCall,??? apmask=0 - if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2.or.ncontest.eq.6) then + if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2) then apmask(1:58)=1 llrd(1:58)=apmag*apbits(1:58) else if(ncontest.eq.3) then ! Field Day apmask(1:56)=1 llrd(1:28)=apmag*apbits(1:28) - llrd(29:56)=apmag*apbits(30:57) + llrd(29:56)=apmag*aphis_fd(1:28) else if(ncontest.eq.4) then ! RTTY RU apmask(2:57)=1 - llrd(2:29)=apmag*apbits(1:28) + llrd(2:29)=apmag*apmy_ru(1:28) llrd(30:57)=apmag*apbits(30:57) endif endif - if(iaptype.eq.5.and.ncontest.eq.6) cycle !Hound if(iaptype.eq.4 .or. iaptype.eq.5 .or. iaptype.eq.6) then apmask=0 - if(ncontest.le.4 .or. (ncontest.eq.6.and.iaptype.eq.6)) then -! apmask(1:77)=1 ! mycall, hiscall, RRR|73|RR73 + if(ncontest.le.4) then apmask(1:91)=1 ! mycall, hiscall, RRR|73|RR73 - llrd(1:58)=apmag*apbits(1:58) - if(iaptype.eq.4) llrd(59:77)=apmag*mrrr - if(iaptype.eq.5) llrd(59:77)=apmag*m73 -! if(iaptype.eq.6) llrd(59:77)=apmag*mrr73 if(iaptype.eq.6) llrd(1:91)=apmag*apbits(1:91) - else if(ncontest.eq.6.and.iaptype.eq.4) then ! Hound listens for MyCall RR73;... - apmask(1:28)=1 - llrd(1:28)=apmag*apbits(1:28) endif endif diff --git a/lib/ft4/getcandidates4.f90 b/lib/ft4/getcandidates4.f90 index 424a7d297..9b5200845 100644 --- a/lib/ft4/getcandidates4.f90 +++ b/lib/ft4/getcandidates4.f90 @@ -20,8 +20,8 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, & if(first) then first=.false. pi=4.0*atan(1.) - window=0.5*(1-cos(pi*(/(i,i=1,NFFT1)/)/(NFFT1/2.0))) - window=window**2 + window=0. + call nuttal_window(window,NFFT1) endif ! Compute symbol spectra, stepping by NSTEP steps. @@ -69,19 +69,5 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, & endif enddo -! do i=1,maxcand -! ipk=maxloc(savsm(nfa:nfb)) -! ip=nfa-1+ipk(1) -! xmax=savsm(ip) -! savsm(max(1,ip-8):min(NH1,ip+8))=0.0 -! if(xmax.ge.syncmin) then -! ncand=ncand+1 -! candidate(1,ncand)=ip*df+f_offset -! candidate(2,ncand)=-99.9 -! candidate(3,ncand)=xmax -! else -! exit -! endif -! enddo return end subroutine getcandidates4 diff --git a/lib/nuttal_window.f90 b/lib/nuttal_window.f90 new file mode 100644 index 000000000..aa813b15d --- /dev/null +++ b/lib/nuttal_window.f90 @@ -0,0 +1,15 @@ +subroutine nuttal_window(win,n) + real win(n) + + pi=4.0*atan(1.0) + a0=0.3635819 + a1=-0.4891775; + a2=0.1365995; + a3=-0.0106411; + do i=1,n + win(i)=a0+a1*cos(2*pi*(i-1)/(n))+ & + a2*cos(4*pi*(i-1)/(n))+ & + a3*cos(6*pi*(i-1)/(n)) + enddo + return +end subroutine nuttal_window diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 78215e209..b9f5e2088 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -50,18 +50,8 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes, & if(nfft3.ne.nfft3z) then ! Compute new window pi=4.0*atan(1.0) -! Coefficients taken from equation 37 of NUSC report: -! "Some windows with very good sidelobe behavior: application to -! discrete Hilbert Transform, by Albert Nuttall" - a0=0.3635819 - a1=-0.4891775; - a2=0.1365995; - a3=-0.0106411; - do i=1,nfft3 - w3(i)=a0+a1*cos(2*pi*(i-1)/(nfft3))+ & - a2*cos(4*pi*(i-1)/(nfft3))+ & - a3*cos(6*pi*(i-1)/(nfft3)) - enddo + w3=0 + call nuttal_window(w3,nfft3) nfft3z=nfft3 endif