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
ncand=0
nfa=375
nfb=3000
syncmin=1.0
fa=375.0
fb=3000.0
syncmin=1.2
maxcand=100
! 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
do icand=1,ncand
f0=candidate(1,icand)-35.0
f0=candidate(1,icand)
xsnr=10*log10(candidate(3,icand))-15.0
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
@ -81,26 +81,43 @@ subroutine ft4_decode(cdatetime0,nfqso,iwave,ndecodes,mycall,hiscall,nrx,line)
if(sum2.gt.0.0) cd2=cd2/sqrt(sum2)
! 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
smax=-99.
dfbest=-1.
do idf=-30,+30,2
df=idf
idfbest=0
do idf=idfmin,idfmax,idfstp
a=0.
a(1)=df
a(1)=real(idf)
ctwk=1.
call twkfreq1(ctwk,4*NSS,fs,a,ctwk2)
do istart=0,374
do istart=ibmin,ibmax,ibstp
call sync4d(cd2,istart,ctwk2,1,sync)
if(sync.gt.smax) then
smax=sync
ibest=istart
dfbest=df
idfbest=idf
endif
enddo
enddo
enddo
f0=f0+dfbest
f0=f0+real(idfbest)
call ft4_downsample(iwave,f0,cb) ! downsample from 320s/Symbol to 20s/Symbol
sum2=sum(abs(cb)**2)/(real(NSS)*NN)
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)
cs(0:3,k)=csymb(1:4)
s4(0:3,k)=abs(csymb(1:4))
!write(*,'(i4,4f8.1)') k, s4(0:3,k)
enddo
! 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/))
nsync_qual=ns1+ns2+ns3+ns4
if(nsync.lt.8 .or. nsync_qual.lt. 20) then
cycle
endif
scalefac=2.83
llra( 1: 58)=bmeta( 9: 66)
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)
integer*2 id(NMAX)
integer indx(NH1)
integer ipk(1)
equivalence (x,cx)
! 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
enddo
savsm=0.
do i=6,NH1-5
savsm(i)=sum(savg(i-5:i+5))/11.
do i=8,NH1-7
savsm(i)=sum(savg(i-7:i+7))/15.
enddo
nfa=fa/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)
xn=savsm(nfa+indx(nint(0.3*np)))
savsm=savsm/xn
imax=-1
xmax=-99.
do i=2,NH1-1
if(savsm(i).gt.savsm(i-1).and. &
savsm(i).gt.savsm(i+1).and. &
savsm(i).gt.xmax) then
xmax=savsm(i)
imax=i
endif
enddo
f0=imax*df
if(xmax.gt.1.2) then
ncand=0
f_offset = -1.5*12000/512
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)=f0
candidate(1,ncand)=ip*df+f_offset
candidate(2,ncand)=-99.9
candidate(3,ncand)=xmax
else
exit
endif
enddo
return
end subroutine getcandidates4