First cut at identifying multiple candidates for decoding. Needs work.

This commit is contained in:
Steve Franke 2019-01-27 19:19:47 -06:00
parent 134da155b6
commit 57cf69e6ad
2 changed files with 62 additions and 41 deletions

View File

@ -64,16 +64,16 @@ subroutine ft4_decode(cdatetime0,nfqso,iwave,ndecodes,mycall,hiscall,nrx,line)
candidate=0.0 candidate=0.0
ncand=0 ncand=0
nfa=375 fa=375.0
nfb=3000 fb=3000.0
syncmin=1.0 syncmin=1.2
maxcand=100 maxcand=100
! call syncft4(iwave,nfa,nfb,syncmin,nfqso,maxcand,s,candidate,ncand,sbase) ! call syncft4(iwave,nfa,nfb,syncmin,nfqso,maxcand,s,candidate,ncand,sbase)
call getcandidates4(iwave,375.0,3000.0,0.2,2200.0,100,savg,candidate,ncand,sbase) call getcandidates4(iwave,fa,fb,syncmin,nfqso,100,savg,candidate,ncand,sbase)
ndecodes=0 ndecodes=0
do icand=1,ncand do icand=1,ncand
f0=candidate(1,icand)-35.0 f0=candidate(1,icand)
xsnr=10*log10(candidate(3,icand))-15.0 xsnr=10*log10(candidate(3,icand))-15.0
if( f0.le.375.0 .or. f0.ge.(5000.0-375.0) ) cycle if( f0.le.375.0 .or. f0.ge.(5000.0-375.0) ) cycle
call ft4_downsample(iwave,f0,cd2) ! downsample from 320 Sa/Symbol to 20 Sa/Symbol call ft4_downsample(iwave,f0,cd2) ! downsample from 320 Sa/Symbol to 20 Sa/Symbol
@ -81,26 +81,43 @@ subroutine ft4_decode(cdatetime0,nfqso,iwave,ndecodes,mycall,hiscall,nrx,line)
if(sum2.gt.0.0) cd2=cd2/sqrt(sum2) if(sum2.gt.0.0) cd2=cd2/sqrt(sum2)
! 750 samples/second here ! 750 samples/second here
do isync=1,2
if(isync.eq.1) then
idfmin=-50
idfmax=50
idfstp=3
ibmin=0
ibmax=374
ibstp=4
else
idfmin=idfbest-5
idfmax=idfbest+5
idfstp=1
ibmin=max(0,ibest-5)
ibmax=min(ibest+5,NMAX/NDOWN-1)
ibstp=1
endif
ibest=-1 ibest=-1
smax=-99. smax=-99.
dfbest=-1. idfbest=0
do idf=-30,+30,2 do idf=idfmin,idfmax,idfstp
df=idf
a=0. a=0.
a(1)=df a(1)=real(idf)
ctwk=1. ctwk=1.
call twkfreq1(ctwk,4*NSS,fs,a,ctwk2) call twkfreq1(ctwk,4*NSS,fs,a,ctwk2)
do istart=0,374 do istart=ibmin,ibmax,ibstp
call sync4d(cd2,istart,ctwk2,1,sync) call sync4d(cd2,istart,ctwk2,1,sync)
if(sync.gt.smax) then if(sync.gt.smax) then
smax=sync smax=sync
ibest=istart ibest=istart
dfbest=df idfbest=idf
endif endif
enddo enddo
enddo enddo
enddo
f0=f0+dfbest f0=f0+real(idfbest)
call ft4_downsample(iwave,f0,cb) ! downsample from 320s/Symbol to 20s/Symbol call ft4_downsample(iwave,f0,cb) ! downsample from 320s/Symbol to 20s/Symbol
sum2=sum(abs(cb)**2)/(real(NSS)*NN) sum2=sum(abs(cb)**2)/(real(NSS)*NN)
if(sum2.gt.0.0) cb=cb/sqrt(sum2) if(sum2.gt.0.0) cb=cb/sqrt(sum2)
@ -111,7 +128,6 @@ subroutine ft4_decode(cdatetime0,nfqso,iwave,ndecodes,mycall,hiscall,nrx,line)
call four2a(csymb,NSS,1,-1,1) call four2a(csymb,NSS,1,-1,1)
cs(0:3,k)=csymb(1:4) cs(0:3,k)=csymb(1:4)
s4(0:3,k)=abs(csymb(1:4)) s4(0:3,k)=abs(csymb(1:4))
!write(*,'(i4,4f8.1)') k, s4(0:3,k)
enddo enddo
! sync quality check ! sync quality check
@ -189,6 +205,10 @@ subroutine ft4_decode(cdatetime0,nfqso,iwave,ndecodes,mycall,hiscall,nrx,line)
ns4=count(hbits(199:206).eq.(/0,0,0,1,1,0,1,1/)) ns4=count(hbits(199:206).eq.(/0,0,0,1,1,0,1,1/))
nsync_qual=ns1+ns2+ns3+ns4 nsync_qual=ns1+ns2+ns3+ns4
if(nsync.lt.8 .or. nsync_qual.lt. 20) then
cycle
endif
scalefac=2.83 scalefac=2.83
llra( 1: 58)=bmeta( 9: 66) llra( 1: 58)=bmeta( 9: 66)
llra( 59:116)=bmeta( 75:132) llra( 59:116)=bmeta( 75:132)

View File

@ -10,6 +10,7 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
real candidate(3,maxcand) real candidate(3,maxcand)
integer*2 id(NMAX) integer*2 id(NMAX)
integer indx(NH1) integer indx(NH1)
integer ipk(1)
equivalence (x,cx) equivalence (x,cx)
! Compute symbol spectra, stepping by NSTEP steps. ! Compute symbol spectra, stepping by NSTEP steps.
@ -29,8 +30,8 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
savg=savg + s(1:NH1,j) !Average spectrum savg=savg + s(1:NH1,j) !Average spectrum
enddo enddo
savsm=0. savsm=0.
do i=6,NH1-5 do i=8,NH1-7
savsm(i)=sum(savg(i-5:i+5))/11. savsm(i)=sum(savg(i-7:i+7))/15.
enddo enddo
nfa=fa/df nfa=fa/df
nfb=fb/df nfb=fb/df
@ -39,22 +40,22 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
call indexx(savsm(nfa:nfb),np,indx) call indexx(savsm(nfa:nfb),np,indx)
xn=savsm(nfa+indx(nint(0.3*np))) xn=savsm(nfa+indx(nint(0.3*np)))
savsm=savsm/xn savsm=savsm/xn
imax=-1
xmax=-99. ncand=0
do i=2,NH1-1 f_offset = -1.5*12000/512
if(savsm(i).gt.savsm(i-1).and. & do i=1,maxcand
savsm(i).gt.savsm(i+1).and. & ipk=maxloc(savsm(nfa:nfb))
savsm(i).gt.xmax) then ip=nfa-1+ipk(1)
xmax=savsm(i) xmax=savsm(ip)
imax=i savsm(max(1,ip-8):min(NH1,ip+8))=0.0
endif if(xmax.ge.syncmin) then
enddo
f0=imax*df
if(xmax.gt.1.2) then
ncand=ncand+1 ncand=ncand+1
candidate(1,ncand)=f0 candidate(1,ncand)=ip*df+f_offset
candidate(2,ncand)=-99.9 candidate(2,ncand)=-99.9
candidate(3,ncand)=xmax candidate(3,ncand)=xmax
else
exit
endif endif
enddo
return return
end subroutine getcandidates4 end subroutine getcandidates4