2016-11-15 16:39:55 -05:00
|
|
|
subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,mycall_12, &
|
|
|
|
hiscall_12,hisgrid_6,sync,nsnr,dtx,nfreq,decoded,nft)
|
2016-06-30 16:38:36 -04:00
|
|
|
|
|
|
|
use packjt
|
2016-11-15 16:39:55 -05:00
|
|
|
use timer_module, only: timer
|
|
|
|
|
2016-11-14 14:56:13 -05:00
|
|
|
parameter (NMAX=60*12000,LN=1152*63)
|
2016-07-19 09:16:10 -04:00
|
|
|
character decoded*22
|
|
|
|
character*12 mycall_12,hiscall_12
|
|
|
|
character*6 mycall,hiscall,hisgrid_6
|
|
|
|
character*4 hisgrid
|
2016-06-30 16:38:36 -04:00
|
|
|
logical ltext
|
2016-11-14 14:56:13 -05:00
|
|
|
complex c00(0:720000) !Complex spectrum of dd()
|
|
|
|
complex c0(0:720000) !Complex data for dd()
|
2016-07-26 12:04:57 -04:00
|
|
|
! integer*8 count0,count1,clkfreq
|
|
|
|
real a(3)
|
2016-07-26 12:44:35 -04:00
|
|
|
real dd(NMAX) !Raw data sampled at 12000 Hz
|
2016-11-07 11:47:40 -05:00
|
|
|
real s3(LN) !Symbol spectra
|
2016-11-08 15:11:02 -05:00
|
|
|
real s3a(LN) !Symbol spectra
|
2016-07-26 12:44:35 -04:00
|
|
|
integer dat4(12) !Decoded message (as 12 integers)
|
2016-11-08 15:11:02 -05:00
|
|
|
integer dat4x(12)
|
2016-07-20 11:38:29 -04:00
|
|
|
data nc1z/-1/,nc2z/-1/,ng2z/-1/
|
2016-06-30 16:38:36 -04:00
|
|
|
save
|
|
|
|
|
2016-11-15 16:39:55 -05:00
|
|
|
call timer('qra64a ',0)
|
|
|
|
decoded=' '
|
2016-08-05 10:14:24 -04:00
|
|
|
if(nfqso.lt.nf1 .or. nfqso.gt.nf2) go to 900
|
2016-07-01 11:25:41 -04:00
|
|
|
nft=99
|
2016-07-01 11:16:00 -04:00
|
|
|
nsnr=-30
|
2016-06-30 16:38:36 -04:00
|
|
|
mycall=mycall_12(1:6) !### May need fixing ###
|
2016-07-19 09:16:10 -04:00
|
|
|
hiscall=hiscall_12(1:6)
|
|
|
|
hisgrid=hisgrid_6(1:4)
|
2016-07-20 11:38:29 -04:00
|
|
|
call packcall(mycall,nc1,ltext)
|
|
|
|
call packcall(hiscall,nc2,ltext)
|
|
|
|
call packgrid(hisgrid,ng2,ltext)
|
2016-11-14 14:20:13 -05:00
|
|
|
nSubmode=0
|
|
|
|
if(mode64.eq.2) nSubmode=1
|
|
|
|
if(mode64.eq.4) nSubmode=2
|
|
|
|
if(mode64.eq.8) nSubmode=3
|
|
|
|
if(mode64.eq.16) nSubmode=4
|
2016-11-13 15:36:27 -05:00
|
|
|
b90=1.0
|
2016-11-14 14:20:13 -05:00
|
|
|
nFadingModel=1
|
2016-07-20 11:38:29 -04:00
|
|
|
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then
|
2016-07-21 08:38:26 -04:00
|
|
|
do naptype=0,5
|
2016-11-07 11:58:37 -05:00
|
|
|
call qra64_dec(s3,nc1,nc2,ng2,naptype,1,nSubmode,b90, &
|
|
|
|
nFadingModel,dat4,snr2,irc)
|
2016-07-20 11:38:29 -04:00
|
|
|
enddo
|
|
|
|
nc1z=nc1
|
|
|
|
nc2z=nc2
|
|
|
|
ng2z=ng2
|
|
|
|
endif
|
2016-07-19 11:49:06 -04:00
|
|
|
|
2016-11-14 14:56:13 -05:00
|
|
|
maxf1=0
|
2016-11-15 16:39:55 -05:00
|
|
|
! write(60) npts,dd(1:npts),nf1,nf2,nfqso,ntol,mode64,maxf1
|
|
|
|
call timer('sync64 ',0)
|
|
|
|
call sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,sync,c00)
|
|
|
|
call timer('sync64 ',1)
|
|
|
|
irc=-99
|
|
|
|
if(sync.lt.float(minsync)) go to 900
|
|
|
|
|
2016-11-14 14:56:13 -05:00
|
|
|
npts2=npts/2
|
|
|
|
itz=10
|
|
|
|
if(mode64.eq.4) itz=9
|
|
|
|
if(mode64.eq.2) itz=7
|
|
|
|
if(mode64.eq.1) itz=5
|
|
|
|
|
2016-07-19 16:52:51 -04:00
|
|
|
naptype=4
|
2016-11-07 11:47:40 -05:00
|
|
|
LL=64*(mode64+2)
|
|
|
|
NN=63
|
2016-11-13 15:36:27 -05:00
|
|
|
! do itry0=1,3
|
|
|
|
do itry0=1,1
|
2016-07-26 12:04:57 -04:00
|
|
|
idf0=itry0/2
|
|
|
|
if(mod(itry0,2).eq.0) idf0=-idf0
|
2016-11-13 15:36:27 -05:00
|
|
|
a(1)=-(f0+0.248*(idf0-0.33*kpk))
|
2016-07-26 12:04:57 -04:00
|
|
|
nfreq=nint(-a(1))
|
|
|
|
a(3)=0.
|
2016-11-08 15:11:02 -05:00
|
|
|
! do itry1=1,3
|
|
|
|
do itry1=1,1
|
2016-07-26 12:04:57 -04:00
|
|
|
idf1=itry1/2
|
|
|
|
if(mod(itry1,2).eq.0) idf1=-idf1
|
2016-07-27 16:49:30 -04:00
|
|
|
a(2)=-0.67*(idf1 + 0.67*kpk)
|
2016-11-14 14:56:13 -05:00
|
|
|
call twkfreq(c00,c0,npts2,6000.0,a)
|
2016-11-08 15:11:02 -05:00
|
|
|
call spec64(c0,npts2,mode64,jpk,s3a,LL,NN)
|
|
|
|
ircmin=99
|
2016-11-14 14:56:13 -05:00
|
|
|
do iter=itz,0,-1
|
2016-11-08 15:11:02 -05:00
|
|
|
b90=1.728**iter
|
|
|
|
s3(1:LL*NN)=s3a(1:LL*NN)
|
2016-11-15 16:39:55 -05:00
|
|
|
call timer('qra64_de',0)
|
2016-11-08 15:11:02 -05:00
|
|
|
call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, &
|
|
|
|
nFadingModel,dat4,snr2,irc)
|
2016-11-15 16:39:55 -05:00
|
|
|
call timer('qra64_de',1)
|
2016-11-08 15:11:02 -05:00
|
|
|
if(abs(snr2).gt.30.) snr2=-30.0
|
2016-11-13 15:36:27 -05:00
|
|
|
if(irc.eq.0) go to 10
|
2016-11-14 14:56:13 -05:00
|
|
|
if(irc.gt.0 .and. irc.le.ircmin) then
|
2016-11-08 15:11:02 -05:00
|
|
|
dat4x=dat4
|
|
|
|
b90x=b90
|
|
|
|
snr2x=snr2
|
|
|
|
ircmin=irc
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
if(ircmin.ne.99) then
|
|
|
|
dat4=dat4x
|
|
|
|
b90=b90x
|
|
|
|
snr2=snr2x
|
|
|
|
irc=ircmin
|
|
|
|
endif
|
|
|
|
10 decoded=' '
|
|
|
|
! write(73,3001) iter,b90,snr2,irc
|
2016-07-26 12:04:57 -04:00
|
|
|
if(irc.ge.0) then
|
|
|
|
call unpackmsg(dat4,decoded) !Unpack the user message
|
|
|
|
call fmtmsg(decoded,iz)
|
|
|
|
nft=100 + irc
|
|
|
|
nsnr=nint(snr2)
|
|
|
|
else
|
|
|
|
snr2=0.
|
|
|
|
endif
|
2016-07-21 11:23:32 -04:00
|
|
|
enddo
|
|
|
|
enddo
|
2016-07-26 12:04:57 -04:00
|
|
|
900 continue
|
2016-08-16 15:17:45 -04:00
|
|
|
if(index(decoded,"000AAA ").ge.1) then
|
|
|
|
! Suppress a certain type of garbage decode.
|
|
|
|
decoded=' '
|
|
|
|
irc=-1
|
|
|
|
endif
|
2016-11-15 16:39:55 -05:00
|
|
|
if(irc.lt.0) then
|
|
|
|
sy=max(1.0,sync+1.0)
|
|
|
|
if(nSubmode.eq.0) nsnr=nint(10.0*log10(sy)-38.0) !A
|
|
|
|
if(nSubmode.eq.1) nsnr=nint(10.0*log10(sy)-36.0) !B
|
|
|
|
if(nSubmode.eq.2) nsnr=nint(10.0*log10(sy)-34.0) !C
|
|
|
|
if(nSubmode.eq.3) nsnr=nint(10.0*log10(sy)-29.0) !D
|
|
|
|
if(nSubmode.eq.4) nsnr=nint(10.0*log10(sy)-24.0) !E
|
|
|
|
endif
|
|
|
|
|
|
|
|
! write(70,3303) sync,snr2,nsnr,irc
|
|
|
|
!3303 format(2f8.1,2i5)
|
|
|
|
|
|
|
|
call timer('qra64a ',1)
|
2016-07-21 11:23:32 -04:00
|
|
|
|
|
|
|
return
|
2016-07-26 12:04:57 -04:00
|
|
|
end subroutine qra64a
|