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.
This commit is contained in:
Steve Franke 2019-03-03 13:02:22 -06:00
parent 3176c1d3ef
commit 4769bf45d2
5 changed files with 30 additions and 49 deletions

View File

@ -512,6 +512,7 @@ set (wsjt_FSRCS
lib/msk144signalquality.f90 lib/msk144signalquality.f90
lib/msk144sim.f90 lib/msk144sim.f90
lib/mskrtd.f90 lib/mskrtd.f90
lib/nuttal_window.f90
lib/ft4/ft4sim.f90 lib/ft4/ft4sim.f90
lib/ft4/ft4sim_mult.f90 lib/ft4/ft4sim_mult.f90
lib/ft4/ft4_decode.f90 lib/ft4/ft4_decode.f90

View File

@ -16,7 +16,6 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, &
character*6 hhmmss character*6 hhmmss
complex cd2(0:NMAX/NDOWN-1) !Complex waveform complex cd2(0:NMAX/NDOWN-1) !Complex waveform
! complex cds(0:NMAX/NDOWN-1) !Complex waveform
complex cb(0:NMAX/NDOWN-1) complex cb(0:NMAX/NDOWN-1)
complex cd(0:NN*NSS-1) !Complex waveform complex cd(0:NN*NSS-1) !Complex waveform
complex ctwk(4*NSS),ctwk2(4*NSS) 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) real savg(NH1),sbase(NH1)
integer apbits(2*ND) integer apbits(2*ND)
integer apmy_ru(28),aphis_fd(28)
integer nrxx(100) integer nrxx(100)
integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3) integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3)
integer*2 iwave(NMAX) !Generated full-length waveform 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) ! 4 MyCall DxCall RRR (77 ap bits)
! 5 MyCall DxCall 73 (77 ap bits) ! 5 MyCall DxCall 73 (77 ap bits)
! 6 MyCall DxCall RR73 (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(0,1:4)=(/1,2,0,0/) ! Tx6 selected (CQ)
naptypes(1,1:4)=(/2,3,0,0/) ! Tx1 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=0
apbits(1)=99 apbits(1)=99
apbits(30)=99 apbits(30)=99
apmy_ru=0
aphis_fd=0
if(len(trim(mycall)) .lt. 3) go to 10 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) call unpack77(c77,1,msgsent,unpk77_success)
if(i3.ne.1 .or. (message.ne.msgsent) .or. .not.unpk77_success) go to 10 if(i3.ne.1 .or. (message.ne.msgsent) .or. .not.unpk77_success) go to 10
read(c77,'(77i1)') message77 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) message77=mod(message77+rvec,2)
call encode174_91(message77,cw) call encode174_91(message77,cw)
apbits=2*cw-1 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) llrd(1:28)=apmag*apbits(1:28)
else if(ncontest.eq.4) then else if(ncontest.eq.4) then
apmask(2:29)=1 apmask(2:29)=1
llrd(2:29)=apmag*apbits(1:28) llrd(2:29)=apmag*apmy_ru(1:28)
else if(ncontest.eq.6) then ! ??? RR73; MyCall <???> ???
apmask(29:56)=1
llrd(29:56)=apmag*apbits(1:28)
endif endif
endif endif
if(iaptype.eq.3) then ! MyCall,DxCall,??? if(iaptype.eq.3) then ! MyCall,DxCall,???
apmask=0 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 apmask(1:58)=1
llrd(1:58)=apmag*apbits(1:58) llrd(1:58)=apmag*apbits(1:58)
else if(ncontest.eq.3) then ! Field Day else if(ncontest.eq.3) then ! Field Day
apmask(1:56)=1 apmask(1:56)=1
llrd(1:28)=apmag*apbits(1:28) 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 else if(ncontest.eq.4) then ! RTTY RU
apmask(2:57)=1 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) llrd(30:57)=apmag*apbits(30:57)
endif endif
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 if(iaptype.eq.4 .or. iaptype.eq.5 .or. iaptype.eq.6) then
apmask=0 apmask=0
if(ncontest.le.4 .or. (ncontest.eq.6.and.iaptype.eq.6)) then if(ncontest.le.4) then
! apmask(1:77)=1 ! mycall, hiscall, RRR|73|RR73
apmask(1:91)=1 ! mycall, hiscall, RRR|73|RR73 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) 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
endif endif

View File

@ -20,8 +20,8 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
if(first) then if(first) then
first=.false. first=.false.
pi=4.0*atan(1.) pi=4.0*atan(1.)
window=0.5*(1-cos(pi*(/(i,i=1,NFFT1)/)/(NFFT1/2.0))) window=0.
window=window**2 call nuttal_window(window,NFFT1)
endif endif
! Compute symbol spectra, stepping by NSTEP steps. ! Compute symbol spectra, stepping by NSTEP steps.
@ -69,19 +69,5 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
endif endif
enddo 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 return
end subroutine getcandidates4 end subroutine getcandidates4

15
lib/nuttal_window.f90 Normal file
View File

@ -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

View File

@ -50,18 +50,8 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes, &
if(nfft3.ne.nfft3z) then if(nfft3.ne.nfft3z) then
! Compute new window ! Compute new window
pi=4.0*atan(1.0) pi=4.0*atan(1.0)
! Coefficients taken from equation 37 of NUSC report: w3=0
! "Some windows with very good sidelobe behavior: application to call nuttal_window(w3,nfft3)
! 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
nfft3z=nfft3 nfft3z=nfft3
endif endif