From 91e3dbdf20b9ece72d945aeca8db7bae60a71c4f Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Sat, 2 Feb 2019 16:29:17 -0600 Subject: [PATCH] New scheme for finding candidates. Speed up sync. Improved SNR calibration. --- lib/ft4/ft4_decode.f90 | 15 ++++++++++----- lib/ft4/ft4_params.f90 | 4 ++-- lib/ft4/getcandidates4.f90 | 39 +++++++++++++++++++++++++------------- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/lib/ft4/ft4_decode.f90 b/lib/ft4/ft4_decode.f90 index f5a3174ad..7b4edcf79 100644 --- a/lib/ft4/ft4_decode.f90 +++ b/lib/ft4/ft4_decode.f90 @@ -78,7 +78,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nfqso,iwave,ndecodes,mycall, & ndecodes=0 do icand=1,ncand f0=candidate(1,icand) - xsnr=10*log10(candidate(3,icand))-18.0 + snr=candidate(3,icand)-1.0 if( f0.le.375.0 .or. f0.ge.(5000.0-375.0) ) cycle call clockit('ft4_down',0) call ft4_downsample(iwave,f0,cd2) !Downsample from 512 to 32 Sa/Symbol @@ -89,15 +89,15 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nfqso,iwave,ndecodes,mycall, & ! Sample rate is now 12000/16 = 750 samples/second do isync=1,2 if(isync.eq.1) then - idfmin=-50 - idfmax=50 + idfmin=-12 + idfmax=12 idfstp=3 ibmin=0 ibmax=374 ibstp=4 else - idfmin=idfbest-5 - idfmax=idfbest+5 + idfmin=idfbest-4 + idfmax=idfbest+4 idfstp=1 ibmin=max(0,ibest-5) ibmax=min(ibest+5,NMAX/NDOWN-1) @@ -265,6 +265,11 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nfqso,iwave,ndecodes,mycall, & if(idupe.eq.1) exit ndecodes=ndecodes+1 decodes(ndecodes)=message + if(snr.gt.0.0) then + xsnr=10*log10(snr)-14.0 + else + xsnr=-18.0 + endif nsnr=nint(xsnr) freq=f0 tsig=mod(tbuf + ibest/750.0,100.0) diff --git a/lib/ft4/ft4_params.f90 b/lib/ft4/ft4_params.f90 index bcc7f7404..02d9de655 100644 --- a/lib/ft4/ft4_params.f90 +++ b/lib/ft4/ft4_params.f90 @@ -11,6 +11,6 @@ parameter (NZ=NSPS*NN) !Sync and Data samples (52736) parameter (NZ2=NSPS*NN2) !Total samples in shaped waveform (53760) parameter (NMAX=5*12000) !Samples in iwave (60,000) parameter (NFFT1=2048, NH1=NFFT1/2) !Length of FFTs for symbol spectra -parameter (NSTEP=NSPS/4) !Coarse time-sync step size -parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps) +parameter (NSTEP=NSPS) !Coarse time-sync step size +parameter (NHSYM=(NMAX-NFFT1)/NSTEP) !Number of symbol spectra (1/4-sym steps) parameter (NDOWN=16) !Downsample factor diff --git a/lib/ft4/getcandidates4.f90 b/lib/ft4/getcandidates4.f90 index 402116a27..47b08d426 100644 --- a/lib/ft4/getcandidates4.f90 +++ b/lib/ft4/getcandidates4.f90 @@ -56,19 +56,32 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, & 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)=ip*df+f_offset - candidate(2,ncand)=-99.9 - candidate(3,ncand)=xmax - else - exit - endif + do i=nfa+1,nfb-1 + if(savsm(i).ge.savsm(i-1) .and. savsm(i).ge.savsm(i+1) .and. savsm(i).ge.syncmin) then + del=0.5*(savsm(i-1)-savsm(i+1))/(savsm(i-1)-2*savsm(i)+savsm(i+1)) + fpeak=(i+del)*df+f_offset + speak=savsm(i) - 0.25*(savsm(i-1)-savsm(i+1))*del + ncand=ncand+1 + if(ncand.gt.maxcand) exit + candidate(1,ncand)=fpeak + candidate(2,ncand)=-99.99 + candidate(3,ncand)=speak + 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