From 5fe6a539b6eef3b40cd680b5a3317f77a520e9a1 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 11 Nov 2020 15:06:24 -0500 Subject: [PATCH] Fix an error in defining dat4(13) in Q65 mode. Not backward compatible! Also fix AP and message averaging for Q65. --- lib/q65_decode.f90 | 29 ++++++++++++++++++++--------- lib/qra/q65/genq65.f90 | 1 + lib/qra/q65/q65_ap.f90 | 3 ++- lib/qra/q65/q65_loops.f90 | 25 +++++++++++++++---------- lib/qra/q65/q65sim.f90 | 4 ++-- 5 files changed, 40 insertions(+), 22 deletions(-) diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 6566924e2..9e4bf38d8 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -88,8 +88,7 @@ contains this%callback => callback if(nutc.eq.-999) print*,lapdx,nfa,nfb,nfqso !Silence warning nFadingModel=1 - call qra_params(ndepth,maxaptype,idfmax,idtmax,ibwmin,ibwmax,maxdist) - +! call qra_params(ndepth,maxaptype,idfmax,idtmax,ibwmin,ibwmax,maxdist) call timer('sync_q65',0) call sync_q65(iwave,ntrperiod*12000,mode65,nsps,nfqso,ntol,xdt,f0, & snr1,width) @@ -112,35 +111,47 @@ contains if(nQSOprogress.eq.3 .or.nQSOprogress.eq.4) npasses=4 if(nQSOprogress.eq.5) npasses=3 if(lapcqonly) npasses=1 + iaptype=0 do ipass=0,npasses +! write(54,3000) nQSOprogress,ipass +!3000 format(i1,i2) apmask=0 apsymbols=0 if(ipass.ge.1) then - call q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,apsym0,apmask1, & - apsymbols1) + call q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, & + apsym0,apmask1,apsymbols1) write(c78,1050) apmask1 1050 format(78i1) read(c78,1060) apmask 1060 format(13b6.6) write(c78,1050) apsymbols1 read(c78,1060) apsymbols - apsymbols(13)=apsymbols(13)/2 !Fixup for c77-->c78 +! write(54,3001) iaptype,c78 +!3001 format('a',i2,1x,a78) endif +! write(54,3002) apmask,apsymbols +!3002 format('b ',13b6.6/4x,13b6.6) call timer('q65loops',0) call q65_loops(c00,npts/2,nsps/2,nmode,mode65,nsubmode,nFadingModel, & - ndepth,jpk0,xdt,f0,width,ipass,apmask,apsymbols,snr1,snr2,irc,dat4) + ndepth,jpk0,xdt,f0,width,iaptype,apmask,apsymbols,snr1,snr2, & + irc,dat4) call timer('q65loops',1) snr2=snr2 + db(6912.0/nsps) - if(irc.ge.0) exit + if(irc.ge.0) then +! write(54,3003) dat4,dat4 +!3003 format('c ',13b6.6,13i3) + exit + endif enddo 100 decoded=' ' if(irc.ge.0) then !### navg=irc/100 - irc=100*navg + ipass +! irc=100*navg + ipass + irc=100*navg + iaptype !### - write(c77,1000) dat4 + write(c77,1000) dat4(1:12),dat4(13)/2 1000 format(12b6.6,b5.5) call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent nsnr=nint(snr2) diff --git a/lib/qra/q65/genq65.f90 b/lib/qra/q65/genq65.f90 index 21c96bfaf..300cbf070 100644 --- a/lib/qra/q65/genq65.f90 +++ b/lib/qra/q65/genq65.f90 @@ -29,6 +29,7 @@ subroutine genq65(msg0,ichk,msgsent,itone,i3,n3) call unpack77(c77,0,msgsent,unpk77_success) !Unpack to get msgsent read(c77,1001) dgen 1001 format(12b6.6,b5.5) + dgen(13)=2*dgen(13) !Convert 77-bit to 78-bit payload if(ichk.eq.1) go to 999 !Return if checking only call q65_enc(dgen,sent) !Encode message, dgen(1:13) ==> sent(1:63) diff --git a/lib/qra/q65/q65_ap.f90 b/lib/qra/q65/q65_ap.f90 index 1c9fe1517..f0cfd72a2 100644 --- a/lib/qra/q65/q65_ap.f90 +++ b/lib/qra/q65/q65_ap.f90 @@ -1,4 +1,5 @@ -subroutine q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,apsym0,apmask,apsymbols) +subroutine q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, & + apsym0,apmask,apsymbols) integer apsym0(58),aph10(10) integer apmask(78),apsymbols(78) diff --git a/lib/qra/q65/q65_loops.f90 b/lib/qra/q65/q65_loops.f90 index e72b38dbb..e10f0a624 100644 --- a/lib/qra/q65/q65_loops.f90 +++ b/lib/qra/q65/q65_loops.f90 @@ -1,5 +1,5 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & - ndepth,jpk0,xdt,f0,width,ipass,APmask,APsymbols,snr1,snr2,irc,dat4) + ndepth,jpk0,xdt,f0,width,iaptype,APmask,APsymbols,snr1,snr2,irc,dat4) use packjt77 use timer_module, only: timer @@ -24,11 +24,16 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & allocate(c0(0:npts2-1)) irc=-99 s3lim=20. - ibwmax=11 - if(mode64.le.4) ibwmax=9 - ibwmin=ibwmax - idtmax=3 - call qra_params(ndepth,maxaptype,idfmax,idtmax,ibwmin,ibwmax,maxdist) +! ibwmax=11 +! if(mode64.le.4) ibwmax=9 +! ibwmin=ibwmax +! idtmax=3 +! call qra_params(ndepth,maxaptype,idfmax,idtmax,ibwmin,ibwmax,maxdist) + idfmax=5 + idtmax=5 + ibwmin=1 + ibwmax=2 + maxdist=15 LL=64*(mode64+2) NN=63 napmin=99 @@ -49,7 +54,7 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & call twkfreq(c00,c0,npts2,6000.0,a) do idt=1,idtmax ndt=idt/2 - if(ipass.eq.0 .and. iavg.eq.0) then + if(iaptype.eq.0 .and. iavg.eq.0) then if(mod(idt,2).eq.0) ndt=-ndt jpk=jpk0 + nsps*ndt/16 !tsym/16 if(jpk.lt.0) jpk=0 @@ -86,7 +91,7 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & enddo ! ibw (b90 loop) enddo ! idt (DT loop) enddo ! idf (f0 loop) - if(ipass.eq.0 .and. iavg.eq.0) then + if(iaptype.eq.0 .and. iavg.eq.0) then a=0. a(1)=-f0 call twkfreq(c00,c0,npts2,6000.0,a) @@ -108,10 +113,10 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & if(iavg.eq.0) navg=0 !### For tests only: open(53,file='fort.53',status='unknown',position='append') - write(c77,1100) dat4 + 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 - write(53,3053) ndf,ndt,nbw,b90,xdt,f0,snr2,ndist,irc,ipass,navg, & + write(53,3053) ndf,ndt,nbw,b90,xdt,f0,snr2,ndist,irc,iaptype,navg, & snr1,trim(decoded) 3053 format(3i4,f6.1,f6.2,f7.1,f6.1,4i4,f7.2,1x,a) close(53) diff --git a/lib/qra/q65/q65sim.f90 b/lib/qra/q65/q65sim.f90 index 762c9ef87..f99ab4f1d 100644 --- a/lib/qra/q65/q65sim.f90 +++ b/lib/qra/q65/q65sim.f90 @@ -85,8 +85,8 @@ program q65sim y(j)=itone(i)-1 endif enddo - write(*,1001) y(1:13) -1001 format('Generated message:'/13i3) + write(*,1001) y(1:13),y(1:13) +1001 format('Generated message'/'6-bit: ',13i3/'binary: ',13b6.6) write(*,1002) y 1002 format(/'Codeword:'/(20i3)) write(*,1003) itone