Work in progress for Q65 decoder.

This commit is contained in:
Joe Taylor 2020-12-28 18:53:13 -05:00
parent 62074ab58f
commit 520a0c7cc0
5 changed files with 29 additions and 34 deletions

View File

@ -153,16 +153,16 @@ contains
endif endif
call timer('q65loops',0) call timer('q65loops',0)
call q65_loops(c00,npts/2,nsps/2,mode65,nsubmode, & call q65_loops(c00,npts/2,nsps/2,mode65,nsubmode,ndepth,jpk0, &
nFadingModel,ndepth,jpk0,xdt,f0,width,iaptype,apmask,apsymbols, & xdt,f0,width,iaptype,xdt1,f1,snr2,dat4,id2)
xdt1,f1,snr2,dat4,id2)
call timer('q65loops',1) call timer('q65loops',1)
if(id2.gt.0) exit !Exit main loop after a successful decode if(id2.gt.0) exit !Exit main loop after a successful decode
enddo enddo
! No single-transmission decode. ! No single-transmission decode.
! if(iand(ndepth,16).eq.16) call q65_avg2 ! if(iand(ndepth,16).eq.16) call q65_avg2
! print*,'AAA: try for avg',navg
100 decoded=' ' 100 decoded=' '
if(id1.gt.0 .or. id2.gt.0) then if(id1.gt.0 .or. id2.gt.0) then
! Unpack decoded message for display to user ! Unpack decoded message for display to user

View File

@ -7,6 +7,7 @@ module q65
integer iseq(MAXAVE) integer iseq(MAXAVE)
integer listutc(10) integer listutc(10)
integer apmask(13),apsymbols(13) integer apmask(13),apsymbols(13)
integer navg
real f0save(MAXAVE) real f0save(MAXAVE)
real xdtsave(MAXAVE) real xdtsave(MAXAVE)
real snr1save(MAXAVE) real snr1save(MAXAVE)

View File

@ -1,4 +1,4 @@
subroutine q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, & subroutine q65_avg(nutc,ntrperiod,LL,ntol,lclearave, &
baud,nsubmode,ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3) baud,nsubmode,ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3)
! Accumulate Q65 spectra s3(LL,63) and associated parameters for ! Accumulate Q65 spectra s3(LL,63) and associated parameters for
@ -7,15 +7,13 @@ subroutine q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, &
use q65 use q65
use packjt77 use packjt77
character*37 avemsg character*37 avemsg
character*1 csync,cused(MAXAVE) character*1 cused(MAXAVE)
character*6 cutc character*6 cutc
character*77 c77
real s3(-64:LL-65,63) !Symbol spectra real s3(-64:LL-65,63) !Symbol spectra
real s3prob(0:63,63) !Symbol-value probabilities
integer iused(MAXAVE) integer iused(MAXAVE)
integer dat4(13) integer dat4(13)
integer codewords(63,206) integer codewords(63,206)
logical first,lclearave,unpk77_success logical first,lclearave
data first/.true./ data first/.true./
save save
@ -71,7 +69,7 @@ subroutine q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, &
snr1sum=0. snr1sum=0.
xdtsum=0. xdtsum=0.
fsum=0. fsum=0.
nsum=0 navg=0
s3avg=0. s3avg=0.
! Find previously saved spectra that should be averaged with this one ! Find previously saved spectra that should be averaged with this one
@ -90,19 +88,19 @@ subroutine q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, &
snr1sum=snr1sum + snr1save(i) snr1sum=snr1sum + snr1save(i)
xdtsum=xdtsum + xdtsave(i) xdtsum=xdtsum + xdtsave(i)
fsum=fsum + f0save(i) fsum=fsum + f0save(i)
nsum=nsum+1 navg=navg+1
iused(nsum)=i iused(navg)=i
enddo enddo
if(nsum.lt.MAXAVE) iused(nsum+1)=0 if(navg.lt.MAXAVE) iused(navg+1)=0
! Find averages of snr1, xdt, and f0 used in this decoding attempt. ! Find averages of snr1, xdt, and f0 used in this decoding attempt.
snr1ave=0. snr1ave=0.
xdtave=0. xdtave=0.
fave=0. fave=0.
if(nsum.gt.0) then if(navg.gt.0) then
snr1ave=snr1sum/nsum snr1ave=snr1sum/navg
xdtave=xdtsum/nsum xdtave=xdtsum/navg
fave=fsum/nsum fave=fsum/navg
endif endif
! Write parameters for display to User in the Message Averaging (F7) window. ! Write parameters for display to User in the Message Averaging (F7) window.
@ -114,9 +112,9 @@ subroutine q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, &
xdtsave(i),f0save(i) xdtsave(i),f0save(i)
1001 format(a1,i5.4,f6.1,f6.2,f7.1) 1001 format(a1,i5.4,f6.1,f6.2,f7.1)
enddo enddo
! if(nsum.lt.2) go to 900 !Must have at least 2 ! if(navg.lt.2) go to 900 !Must have at least 2
s3avg=s3avg/nsum s3avg=s3avg/navg
nFadingModel=1 nFadingModel=1
do ibw=ibwa,ibwb do ibw=ibwa,ibwb
b90=1.72**ibw b90=1.72**ibw
@ -125,7 +123,7 @@ subroutine q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, &
if(irc.ge.0 .and. plog.ge.PLOG_MIN) then if(irc.ge.0 .and. plog.ge.PLOG_MIN) then
snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment
id1=1 !### id1=1 !###
print*,'B dec1 ',ibw,irc,avemsg ! print*,'B dec1 ',ibw,irc,avemsg
exit exit
endif endif
enddo enddo
@ -139,10 +137,10 @@ subroutine q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, &
call q65_dec2(s3,nsubmode,b90ts,esnodb,irc,dat4,avemsg) call q65_dec2(s3,nsubmode,b90ts,esnodb,irc,dat4,avemsg)
if(irc.ge.0) then if(irc.ge.0) then
id2=iaptype+2 id2=iaptype+2
print*,'C dec2 ',ibw,irc,avemsg ! print*,'C dec2 ',ibw,irc,avemsg
exit exit
endif endif
enddo ! ibw (b90 loop) enddo ! ibw (b90 loop)
900 return return
end subroutine q65_avg end subroutine q65_avg

View File

@ -1,5 +1,5 @@
subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,nFadingModel, & subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,ndepth,jpk0, &
ndepth,jpk0,xdt0,f0,width,iaptype,APmask,APsymbols,xdt1,f1,snr2,dat4,id2) xdt0,f0,width,iaptype,xdt1,f1,snr2,dat4,id2)
use packjt77 use packjt77
use timer_module, only: timer use timer_module, only: timer
@ -10,9 +10,6 @@ subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,nFadingModel, &
character decoded*37 character decoded*37
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 s3prob(64*NN) !Symbol-value probabilities
integer APmask(13)
integer APsymbols(13)
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
@ -82,7 +79,7 @@ subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,nFadingModel, &
! -3 = CRC mismatch ! -3 = CRC mismatch
if(irc.ge.0) then if(irc.ge.0) then
id2=iaptype+2 id2=iaptype+2
print*,'D dec2 ',ibw,irc,decoded ! print*,'D dec2 ',ibw,irc,id2,decoded
go to 100 go to 100
endif endif
enddo ! ibw (b90 loop) enddo ! ibw (b90 loop)

View File

@ -29,7 +29,6 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
real, allocatable :: s3(:,:) !Data-symbol energies s3(LL,63) real, allocatable :: s3(:,:) !Data-symbol energies s3(LL,63)
real, allocatable :: ccf(:,:) !CCF(freq,lag) real, allocatable :: ccf(:,:) !CCF(freq,lag)
real, allocatable :: ccf1(:) !CCF(freq) at best lag real, allocatable :: ccf1(:) !CCF(freq) at best lag
real s3prob(0:63,63) !Symbol-value probabilities
real sync(85) !sync vector real sync(85) !sync vector
complex, allocatable :: c0(:) !Complex spectrum of symbol 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 isync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/
@ -183,7 +182,7 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
call q65_dec1(s3,nsubmode,b90ts,codewords,ncw,esnodb,irc,dat4,decoded) call q65_dec1(s3,nsubmode,b90ts,codewords,ncw,esnodb,irc,dat4,decoded)
! irc=-99 !### TEMPORARY ### ! irc=-99 !### TEMPORARY ###
if(irc.ge.0) then if(irc.ge.0) then
print*,'A dec1 ',ibw,irc,decoded ! print*,'A dec1 ',ibw,irc,decoded
snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment
id1=1 id1=1
ic=ia2/4; ic=ia2/4;
@ -191,8 +190,8 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
ccf1=ccf1-base ccf1=ccf1-base
smax=maxval(ccf1) smax=maxval(ccf1)
if(smax.gt.10.0) ccf1=10.0*ccf1/smax if(smax.gt.10.0) ccf1=10.0*ccf1/smax
go to 100 !### TEMPORARY ### ! go to 100 !### TEMPORARY ###
! go to 200 go to 200
endif endif
enddo enddo
@ -252,7 +251,7 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
enddo enddo
! write(*,3002) 'B',xdt,f0,sum(s3) ! write(*,3002) 'B',xdt,f0,sum(s3)
!3002 format(a1,f7.2,2f8.1) !3002 format(a1,f7.2,2f8.1)
call q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave, & call q65_avg(nutc,ntrperiod,LL,ntol,lclearave, &
baud,nsubmode,ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3) baud,nsubmode,ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3)
endif endif
endif endif
@ -266,7 +265,7 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
if(i2.eq.-9999 .and. ccf1(-i).ge.0.5*smax) i2=-i if(i2.eq.-9999 .and. ccf1(-i).ge.0.5*smax) i2=-i
enddo enddo
do i=-ia2,ia2 do i=-ia2,ia2
freq=nfqso + (i-mode_q65)*df freq=nfqso + i*df
write(17,1100) freq,ccf1(i),xdt write(17,1100) freq,ccf1(i),xdt
1100 format(3f10.3) 1100 format(3f10.3)
enddo enddo