Move s3, s3a arrays into qra_loops.

This commit is contained in:
Joe Taylor 2020-10-09 14:12:34 -04:00
parent a4ba64a5fa
commit 538b0b91ab
2 changed files with 46 additions and 60 deletions

View File

@ -56,10 +56,8 @@ contains
logical ltext
complex, allocatable :: c00(:) !Analytic signal, 6000 Sa/s
complex, allocatable :: c0(:) !Analytic signal, 6000 Sa/s
real, allocatable, save :: s3(:,:) !Synchronized symbol spectra
real, allocatable, save :: s3a(:,:) !Symbol spectra for avg messages
data nc1z/-1/,nc2z/-1/,ng2z/-1/,maxaptypez/-1/,nsubmodez/-1/
save nc1z,nc2z,ng2z,maxaptypez,nsave,nsubmodez
save nc1z,nc2z,ng2z,maxaptypez,nsubmodez
mode65=2**nsubmode
nfft1=ntrperiod*12000
@ -67,13 +65,6 @@ contains
allocate (c00(0:nfft1-1))
allocate (c0(0:nfft1-1))
if(nsubmode.ne.nsubmodez) then
if(allocated(s3)) deallocate(s3)
if(allocated(s3a)) deallocate(s3a)
allocate(s3(-64:64*mode65+63,63))
allocate(s3a(-64:64*mode65+63,63))
endif
if(ntrperiod.eq.15) then
nsps=1800
else if(ntrperiod.eq.30) then
@ -85,67 +76,62 @@ contains
else if(ntrperiod.eq.300) then
nsps=41472
else
stop 'Invalid TR period'
endif
npts=ntrperiod*12000
baud=12000.0/nsps
df1=12000.0/nfft1
this%callback => callback
if(nutc.eq.-999) print*,lapdx,nfa,nfb,nfqso !Silence warning
stop 'Invalid TR period'
endif
npts=ntrperiod*12000
baud=12000.0/nsps
df1=12000.0/nfft1
this%callback => callback
if(nutc.eq.-999) print*,lapdx,nfa,nfb,nfqso !Silence warning
! Prime the QRA decoder for possible use of AP
call packcall(mycall(1:6),nc1,ltext)
call packcall(hiscall(1:6),nc2,ltext)
call packgrid(hisgrid(1:4),ng2,ltext)
b90=20.0 !8 to 25 is OK; not very critical
nFadingModel=1
call packcall(mycall(1:6),nc1,ltext)
call packcall(hiscall(1:6),nc2,ltext)
call packgrid(hisgrid(1:4),ng2,ltext)
b90=20.0 !8 to 25 is OK; not very critical
nFadingModel=1
! AP control could be done differently, but this works well:
maxaptype=0
if(ndepth.eq.2) maxaptype=3
if(ndepth.eq.3) maxaptype=5
maxaptype=0
if(ndepth.eq.2) maxaptype=3
if(ndepth.eq.3) maxaptype=5
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z .or. &
maxaptype.ne.maxaptypez) then
do naptype=0,maxaptype
if(naptype.eq.2 .and. maxaptype.eq.4) cycle
call qra64_dec(s3,nc1,nc2,ng2,naptype,1,nSubmode,b90, &
nFadingModel,dat4,snr2,irc)
enddo
nc1z=nc1
nc2z=nc2
ng2z=ng2
maxaptypez=maxaptype
s3a=0.
nsave=0
endif
naptype=maxaptype
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z .or. &
maxaptype.ne.maxaptypez) then
do naptype=0,maxaptype
if(naptype.eq.2 .and. maxaptype.eq.4) cycle
call qra64_dec(s3dummy,nc1,nc2,ng2,naptype,1,nSubmode,b90, &
nFadingModel,dat4,snr2,irc)
enddo
nc1z=nc1
nc2z=nc2
ng2z=ng2
maxaptypez=maxaptype
endif
naptype=maxaptype
call timer('sync_q65',0)
call sync_qra65(iwave,ntrperiod*12000,mode65,nsps,nfqso,ntol,xdt,f0,snr1)
call timer('sync_q65',1)
call timer('sync_q65',0)
call sync_qra65(iwave,ntrperiod*12000,mode65,nsps,nfqso,ntol,xdt,f0,snr1)
call timer('sync_q65',1)
jpk0=(xdt+1.0)*6000 !###
if(jpk0.lt.0) jpk0=0
jpk0=(xdt+1.0)*6000 !###
if(jpk0.lt.0) jpk0=0
fac=1.0/32767.0
dd=fac*iwave
! npts=648000
minsync=-2
nmode=65
fac=1.0/32767.0
dd=fac*iwave
minsync=-2
nmode=65
call ana64(dd,npts,c00)
call timer('qraloops',0)
call qra_loops(c00,npts/2,nmode,mode65,nsubmode,nFadingModel,minsync, &
ndepth,nc1,nc2,ng2,naptype,jpk0,xdt,f0,width,snr2,s3,irc,dat4)
if(nmode.eq.65) xdt=xdt+0.4 !### Empirical WHY ??? ###
call timer('qraloops',1)
call ana64(dd,npts,c00)
call timer('qraloops',0)
call qra_loops(c00,npts/2,nmode,mode65,nsubmode,nFadingModel,minsync, &
ndepth,nc1,nc2,ng2,naptype,jpk0,xdt,f0,width,snr2,irc,dat4)
call timer('qraloops',1)
xdt=xdt+0.4 !### Empirical -- WHY ??? ###
snr2=snr2 + db(6912.0/nsps)
decoded=' '
if(irc.ge.0) then
nsave=0
s3a=0.
call unpackmsg(dat4,decoded) !Unpack the user message
call fmtmsg(decoded,iz)
if(index(decoded,"000AAA ").ge.1) then

View File

@ -1,5 +1,5 @@
subroutine qra_loops(c00,npts2,mode,mode64,nsubmode,nFadingModel,minsync, &
ndepth,nc1,nc2,ng2,naptype,jpk0,xdt,f0,width,snr2,s3,irc,dat4)
ndepth,nc1,nc2,ng2,naptype,jpk0,xdt,f0,width,snr2,irc,dat4)
use timer_module, only: timer
parameter (LN=1152*63)