diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 86d9264ab..9fffe9530 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -91,8 +91,8 @@ contains if(nutc.eq.-999) print*,lapdx,nfa,nfb,nfqso !Silence warning nFadingModel=1 call timer('sync_q65',0) - call sync_q65(iwave,ntrperiod*12000,mode65,nsps,nfqso,ntol,xdt,f0, & - snr1,width) + call sync_q65(iwave,ntrperiod*12000,mode65,nQSOprogress,nsps,nfqso, & + ntol,xdt,f0,snr1,width) call timer('sync_q65',1) irc=-9 diff --git a/lib/qra/q65/q65_loops.f90 b/lib/qra/q65/q65_loops.f90 index 72eade730..e1eac4e0e 100644 --- a/lib/qra/q65/q65_loops.f90 +++ b/lib/qra/q65/q65_loops.f90 @@ -1,10 +1,10 @@ -subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & +subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode_q65,nsubmode,nFadingModel, & ndepth,jpk0,xdt0,f0,width,iaptype,APmask,APsymbols,codewords,snr1, & xdt1,f1,snr2,irc,dat4) use packjt77 use timer_module, only: timer - parameter (LN=2176*63) !LN=LL*NN; LL = 64*(mode64+2) + parameter (LN=2176*63) !LN=LL*NN; LL=64*(mode_q65+2), NN=63 character*37 decoded character*77 c77 complex c00(0:npts2-1) !Analytic representation of dd(), 6000 Hz @@ -17,9 +17,15 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & integer APmask(13) integer APsymbols(13) integer codewords(63,64) +! integer cw4(63) integer dat4(13) !Decoded message (as 13 six-bit integers) integer nap(0:11) !AP return codes data nap/0,2,3,2,3,4,2,3,6,4,6,6/,nsave/0/ +! data cw4/0, 0, 0, 0, 8, 4,60,35,17,48,33,25,34,43,43,43,35,15,46,30, & +! 54,24,26,26,57,57,42, 3,23,11,49,49,16, 2, 6, 6,55,21,39,51, & +! 51,51,42,42,50,25,31,35,57,30, 1,54,54,10,10,22,44,58,57,40, & +! 21,21,19/ + save nsave,s3avg ircbest=9999 @@ -40,7 +46,7 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & if(iand(ndepth,3).eq.3) then ibwmax=5 endif - LL=64*(mode64+2) + LL=64*(mode_q65+2) NN=63 napmin=99 baud=6000.0/nsps @@ -67,7 +73,7 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & jpk=jpk0 + nsps*ndt/16 !tsym/16 if(jpk.lt.0) jpk=0 call timer('spec64 ',0) - call spec64(c0,nsps,mode,mode64,jpk,s3,LL,NN) + call spec64(c0,nsps,mode,mode_q65,jpk,s3,LL,NN) call timer('spec64 ',1) call pctile(s3,LL*NN,40,base) s3=s3/base @@ -85,10 +91,11 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & if(b90.gt.230.0) cycle ! if(b90.lt.0.15*width) exit call timer('q65_intr',0) - b90ts = b90/baud + b90ts = b90/baud call q65_intrinsics_ff(s3,nsubmode,b90ts,nFadingModel,s3prob) call timer('q65_intr',1) if(iaptype.eq.4) then +! codewords(1:63,4)=cw4 call timer('q65_apli',0) call q65_dec_fullaplist(s3,s3prob,codewords,3,esnodb,dat4,irc) call timer('q65_apli',1) @@ -111,7 +118,7 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & call twkfreq(c00,c0,npts2,6000.0,a) jpk=3000 !### Are these definitions OK? if(nsps.ge.3600) jpk=6000 !### TR >= 60 s - call spec64(c0,nsps,mode,mode64,jpk,s3,LL,NN) + call spec64(c0,nsps,mode,mode_q65,jpk,s3,LL,NN) call pctile(s3,LL*NN,40,base) s3=s3/base where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim diff --git a/lib/sync_q65.f90 b/lib/sync_q65.f90 index 1839aab0a..c802c27b0 100644 --- a/lib/sync_q65.f90 +++ b/lib/sync_q65.f90 @@ -1,4 +1,5 @@ -subroutine sync_q65(iwave,nmax,mode65,nsps,nfqso,ntol,xdt,f0,snr1,width) +subroutine sync_q65(iwave,nmax,mode65,nQSOprogress,nsps,nfqso,ntol, & + xdt,f0,snr1,width) ! Detect and align with the Q65 sync vector, returning time and frequency ! offsets and SNR estimate. @@ -13,6 +14,7 @@ subroutine sync_q65(iwave,nmax,mode65,nsps,nfqso,ntol,xdt,f0,snr1,width) ! snr1 Relative SNR of sync signal parameter (NSTEP=8) !Step size nsps/NSTEP + parameter (LN=2176*63) !LN=LL*NN; LL=64*(mode_q65+2), NN=63 character*37 msg,msgsent integer*2 iwave(0:nmax-1) !Raw data integer isync(22) !Indices of sync symbols @@ -20,7 +22,9 @@ subroutine sync_q65(iwave,nmax,mode65,nsps,nfqso,ntol,xdt,f0,snr1,width) real, allocatable :: s1(:,:) !Symbol spectra, quarter-symbol steps real, allocatable :: ccf(:,:) !CCF(freq,lag) real, allocatable :: ccf1(:) !CCF(freq) at best lag - real sync(85) !sync vector + real sync(85) !sync vector + real s3(LN) !Symbol spectra + real s3prob(LN) !Symbol-value probabilities complex, allocatable :: c0(:) !Complex spectrum of symbol data isync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/ data sync(1)/99.0/ @@ -147,14 +151,15 @@ subroutine sync_q65(iwave,nmax,mode65,nsps,nfqso,ntol,xdt,f0,snr1,width) width=i*1.414*df !### Experimental: - nQSOprogress=3 if(nQSOprogress.lt.1) go to 900 ! "Deep Likelihood" decode attempt - do imsg=1,3 + snr1a_best=0. + do imsg=1,4 ccf=0. msg='K1ABC W9XYZ RRR' if(imsg.eq.2) msg='K1ABC W9XYZ RR73' if(imsg.eq.3) msg='K1ABC W9XYZ 73' + if(imsg.eq.4) msg='CQ K9AN EN50' call genq65(msg,0,msgsent,itone,i3,n3) do lag=lag1,lag2 @@ -196,19 +201,33 @@ subroutine sync_q65(iwave,nmax,mode65,nsps,nfqso,ntol,xdt,f0,snr1,width) rms=sqrt(sq/nsq) smax=ccf(ipk,jpk) snr1a=smax/rms - write(57,3001) imsg,xdt,xdta,f0,f0a,snr1,snr1a -3001 format(i1,6f8.2) + if(snr1a.gt.snr1a_best) then + snr1a_best=snr1a + imsg_best=imsg + xdta_best=xdta + f0a_best=f0a + endif +! write(57,3001) imsg,xdt,xdta,f0,f0a,snr1,snr1a +!3001 format(i1,6f8.2) - do j=lag1,lag2 - write(55,3055) j,j*dtstep,ccf(ipk,j)/rms -3055 format(i5,f8.3,f10.3) - enddo +! do j=lag1,lag2 +! write(55,3055) j,j*dtstep,ccf(ipk,j)/rms +!3055 format(i5,f8.3,f10.3) +! enddo - do i=-ia,ia - write(56,3056) i*df,ccf(i,jpk)/rms -3056 format(2f10.3) - enddo +! do i=-ia,ia +! write(56,3056) i*df,ccf(i,jpk)/rms +!3056 format(2f10.3) +! enddo enddo + if(snr1a_best.gt.2.0) then + xdt=xdta_best + f0=f0a_best + snr1=1.4*snr1a_best + endif + +! write(58,3006) xdta_best,f0a_best,snr1a_best,imsg_best +!3006 format(3f8.2,i3) 900 return end subroutine sync_q65