More Q65 cleanup. Single-digit at end of line.

This commit is contained in:
Joe Taylor 2020-11-30 14:13:37 -05:00
parent 5c947178ce
commit adc4c3d78a
3 changed files with 60 additions and 120 deletions

View File

@ -794,12 +794,12 @@ contains
if(ntrperiod.lt.60) then if(ntrperiod.lt.60) then
write(*,1001) nutc,nsnr,dt,nint(freq),decoded,idec write(*,1001) nutc,nsnr,dt,nint(freq),decoded,idec
1001 format(i6.6,i4,f5.1,i5,' + ',1x,a37,1x,i3.3) 1001 format(i6.6,i4,f5.1,i5,' + ',1x,a37,1x,i1)
write(13,1002) nutc,nint(sync),nsnr,dt,freq,0,decoded write(13,1002) nutc,nint(sync),nsnr,dt,freq,0,decoded
1002 format(i6.6,i4,i5,f6.1,f8.0,i4,3x,a37,' Q65') 1002 format(i6.6,i4,i5,f6.1,f8.0,i4,3x,a37,' Q65')
else else
write(*,1003) nutc,nsnr,dt,nint(freq),decoded,idec write(*,1003) nutc,nsnr,dt,nint(freq),decoded,idec
1003 format(i4.4,i4,f5.1,i5,' + ',1x,a37,1x,i3.3) 1003 format(i4.4,i4,f5.1,i5,' + ',1x,a37,1x,i1)
write(13,1004) nutc,nint(sync),nsnr,dt,freq,0,decoded write(13,1004) nutc,nint(sync),nsnr,dt,freq,0,decoded
1004 format(i4.4,i4,i5,f6.1,f8.0,i4,3x,a37,' Q65') 1004 format(i4.4,i4,i5,f6.1,f8.0,i4,3x,a37,' Q65')

View File

@ -63,7 +63,6 @@ contains
id1=0 id1=0
id2=0 id2=0
id3=0
mode65=2**nsubmode mode65=2**nsubmode
npts=ntrperiod*12000 npts=ntrperiod*12000
nfft1=ntrperiod*12000 nfft1=ntrperiod*12000
@ -140,19 +139,17 @@ contains
endif endif
endif endif
call timer('q65loops',0) call timer('q65loops',0)
call q65_loops(c00,nutc,npts/2,nsps/2,nmode,mode65,nsubmode, & call q65_loops(c00,npts/2,nsps/2,nmode,mode65,nsubmode, &
nFadingModel,ndepth,jpk0,xdt,f0,iaptype,apmask,apsymbols, & nFadingModel,ndepth,jpk0,xdt,f0,iaptype,apmask,apsymbols, &
codewords,snr1,xdt1,f1,snr2,dat4,id2,id3) xdt1,f1,snr2,dat4,id2)
call timer('q65loops',1) call timer('q65loops',1)
snr2=snr2 + db(6912.0/nsps) snr2=snr2 + db(6912.0/nsps)
if(id2+id3.gt.0) exit if(id2.gt.0) exit
enddo enddo
100 decoded=' ' 100 decoded=' '
idec=100*id1 + 10*id2 + id3 if(id1.gt.0 .or. id2.gt.0) then
write(71,3071) nutc,id1,id2,id3,irc idec=id1+id2
3071 format(5i6)
if(idec.gt.0) then
write(c77,1000) dat4(1:12),dat4(13)/2 write(c77,1000) dat4(1:12),dat4(13)/2
1000 format(12b6.6,b5.5) 1000 format(12b6.6,b5.5)
call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent
@ -162,6 +159,7 @@ contains
else else
! Report sync, even if no decode. ! Report sync, even if no decode.
nsnr=db(snr1) - 35.0 nsnr=db(snr1) - 35.0
idec=-1
call this%callback(nutc,sync,nsnr,xdt1,f1,decoded, & call this%callback(nutc,sync,nsnr,xdt1,f1,decoded, &
idec,ntrperiod) idec,ntrperiod)
endif endif

View File

@ -1,23 +1,17 @@
subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode_q65,nsubmode,nFadingModel, & subroutine q65_loops(c00,npts2,nsps,mode,mode_q65,nsubmode,nFadingModel, &
ndepth,jpk0,xdt0,f0,iaptype,APmask,APsymbols,codewords,snr1, & ndepth,jpk0,xdt0,f0,iaptype,APmask,APsymbols,xdt1,f1,snr2,dat4,id2)
xdt1,f1,snr2,dat4,id2,id3)
use packjt77 use packjt77
use timer_module, only: timer use timer_module, only: timer
parameter (NN=63) parameter (NN=63)
parameter (LN=1152*63) !LN=LL*NN; LL=64*(mode_q65+2), NN=63 parameter (LN=1152*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 complex c00(0:npts2-1) !Analytic representation of dd(), 6000 Hz
complex ,allocatable :: c0(:) !Ditto, with freq shift complex ,allocatable :: c0(:) !Ditto, with freq shift
real a(3) !twkfreq params f,f1,f2 real a(3) !twkfreq params f,f1,f2
real s3(LN) !Symbol spectra real s3(LN) !Symbol spectra
real s3avg(LN) !Averaged symbol spectra
real s3prob(64*NN) !Symbol-value probabilities real s3prob(64*NN) !Symbol-value probabilities
logical unpk77_success
integer APmask(13) integer APmask(13)
integer APsymbols(13) integer APsymbols(13)
integer codewords(63,64)
integer cw4(63) integer cw4(63)
integer dat4(13) !Decoded message (as 13 six-bit integers) integer dat4(13) !Decoded message (as 13 six-bit integers)
integer nap(0:11) !AP return codes integer nap(0:11) !AP return codes
@ -27,10 +21,7 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode_q65,nsubmode,nFadingModel, &
51,51,42,42,50,25,31,35,57,30, 1,54,54,10,10,22,44,58,57,40, & 51,51,42,42,50,25,31,35,57,30, 1,54,54,10,10,22,44,58,57,40, &
21,21,19/ 21,21,19/
save nsave,s3avg id2=-1
id2=0
id3=0
ircbest=9999 ircbest=9999
allocate(c0(0:npts2-1)) allocate(c0(0:npts2-1))
irc=-99 irc=-99
@ -55,113 +46,64 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode_q65,nsubmode,nFadingModel, &
xdt1=xdt0 xdt1=xdt0
f1=f0 f1=f0
maxavg=0 do idf=1,idfmax
if(iand(ndepth,16).ne.0) maxavg=1 ndf=idf/2
do iavg=0,maxavg if(mod(idf,2).eq.0) ndf=-ndf
if(iavg.eq.1) then a=0.
idfmax=1 a(1)=-(f0+0.5*baud*ndf)
idtmax=1 call twkfreq(c00,c0,npts2,6000.0,a)
endif do idt=1,idtmax
do idf=1,idfmax ndt=idt/2
ndf=idf/2 if(iaptype.eq.0) then
if(mod(idf,2).eq.0) ndf=-ndf if(mod(idt,2).eq.0) ndt=-ndt
a=0. jpk=jpk0 + nsps*ndt/16 !tsym/16
a(1)=-(f0+0.5*baud*ndf) if(jpk.lt.0) jpk=0
call twkfreq(c00,c0,npts2,6000.0,a) call timer('spec64 ',0)
do idt=1,idtmax call spec64(c0,nsps,mode,mode_q65,jpk,s3,LL,NN)
ndt=idt/2 call timer('spec64 ',1)
if(iaptype.eq.0 .and. iavg.eq.0) then call pctile(s3,LL*NN,40,base)
if(mod(idt,2).eq.0) ndt=-ndt s3=s3/base
jpk=jpk0 + nsps*ndt/16 !tsym/16 where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim
if(jpk.lt.0) jpk=0 endif
call timer('spec64 ',0) do ibw=ibwmin,ibwmax
call spec64(c0,nsps,mode,mode_q65,jpk,s3,LL,NN) nbw=ibw
call timer('spec64 ',1) ndist=ndf**2 + ndt**2 + ((nbw-2))**2
call pctile(s3,LL*NN,40,base) if(ndist.gt.maxdist) cycle
s3=s3/base ! b90=1.728**ibw
where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim b90=3.0**nbw
endif if(b90.gt.230.0) cycle
kavg=0 call timer('q65_intr',0)
if(iavg.eq.1 .and. nsave.ge.2) then b90ts = b90/baud
s3(1:LL*NN)=s3avg(1:LL*NN) call q65_intrinsics_ff(s3,nsubmode,b90ts,nFadingModel,s3prob)
kavg=nsave call timer('q65_intr',1)
endif call timer('q65_dec ',0)
do ibw=ibwmin,ibwmax call q65_dec(s3,s3prob,APmask,APsymbols,esnodb,dat4,irc)
nbw=ibw call timer('q65_dec ',1)
ndist=ndf**2 + ndt**2 + ((nbw-2))**2 if(irc.ge.0) id2=iaptype+2
if(ndist.gt.maxdist) cycle if(irc.ge.0) go to 100
! b90=1.728**ibw
b90=3.0**nbw
if(b90.gt.230.0) cycle
call timer('q65_intr',0)
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,4,esnodb, &
dat4,plog,irc)
call timer('q65_apli',1)
if(irc.ge.0) id2=4
else
call timer('q65_dec ',0)
call q65_dec(s3,s3prob,APmask,APsymbols,esnodb,dat4,irc)
call timer('q65_dec ',1)
if(irc.ge.0) id2=iaptype
endif
! write(71,3071) 100*nutc,0.0,ndf,ndt,nbw,ndist,irc,iaptype, &
! kavg,nsave
!3071 format(i6.6,f8.4,8i5)
if(irc.ge.0) go to 100
! irc > 0 ==> number of iterations required to decode ! irc > 0 ==> number of iterations required to decode
! -1 = invalid params ! -1 = invalid params
! -2 = decode failed ! -2 = decode failed
! -3 = CRC mismatch ! -3 = CRC mismatch
enddo ! ibw (b90 loop) enddo ! ibw (b90 loop)
enddo ! idt (DT loop) enddo ! idt (DT loop)
enddo ! idf (f0 loop) enddo ! idf (f0 loop)
if(iaptype.eq.0 .and. iavg.eq.0) then if(iaptype.eq.0) then
a=0. a=0.
a(1)=-f0 a(1)=-f0
call twkfreq(c00,c0,npts2,6000.0,a) call twkfreq(c00,c0,npts2,6000.0,a)
jpk=3000 !### Are these definitions OK? jpk=3000 !### Are these definitions OK?
if(nsps.ge.3600) jpk=6000 !### TR >= 60 s if(nsps.ge.3600) jpk=6000 !### TR >= 60 s
call spec64(c0,nsps,mode,mode_q65,jpk,s3,LL,NN) call spec64(c0,nsps,mode,mode_q65,jpk,s3,LL,NN)
call pctile(s3,LL*NN,40,base) call pctile(s3,LL*NN,40,base)
s3=s3/base s3=s3/base
where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim
s3avg(1:LL*NN)=s3avg(1:LL*NN) + s3(1:LL*NN) endif
nsave=nsave+1
endif
if(iavg.eq.0 .and. nsave.lt.2) exit
enddo ! iavg
100 if(irc.ge.0) then 100 if(irc.ge.0) then
navg=nsave
snr2=esnodb - db(2500.0/baud) snr2=esnodb - db(2500.0/baud)
if(kavg.eq.0) navg=0
xdt1=xdt0 + nsps*ndt/(16.0*6000.0) xdt1=xdt0 + nsps*ndt/(16.0*6000.0)
f1=f0 + 0.5*baud*ndf f1=f0 + 0.5*baud*ndf
!### For tests only:
! open(53,file='fort.53',status='unknown',position='append')
! write(c77,1100) dat4(1:12),dat4(13)/2
!1100 format(12b6.6,b5.5)
! call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent
! m=nutc
! if(nsps.ge.3600) m=100*m
! ihr=m/10000
! imin=mod(m/100,100)
! isec=mod(m,100)
! hours=ihr + imin/60.0 + isec/3600.0
! write(53,3053) m,hours,ndf,ndt,nbw,ndist,irc,iaptype,kavg,snr1, &
! xdt1,f1,snr2,trim(decoded)
!3053 format(i6.6,f8.4,4i3,i4,2i3,f6.1,f6.2,f7.1,f6.1,1x,a)
! close(53)
!###
nsave=0
s3avg=0.
irc=irc + 100*navg
endif endif
return return