2012-11-21 12:42:53 -05:00
|
|
|
subroutine decoder(ss,c0)
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-11-13 10:55:03 -05:00
|
|
|
! Decoder for JT9.
|
2012-10-15 17:06:15 -04:00
|
|
|
|
|
|
|
parameter (NMAX=1800*12000) !Total sample intervals per 30 minutes
|
|
|
|
parameter (NDMAX=1800*1500) !Sample intervals at 1500 Hz rate
|
|
|
|
parameter (NSMAX=22000) !Max length of saved spectra
|
2012-11-21 12:42:53 -05:00
|
|
|
real ss(184,NSMAX)
|
2012-10-15 17:06:15 -04:00
|
|
|
character*22 msg
|
2012-10-29 13:58:33 -04:00
|
|
|
character*33 line
|
2012-11-15 18:40:57 -05:00
|
|
|
character*80 fmt,fmt14
|
2012-11-21 12:42:53 -05:00
|
|
|
character*20 datetime
|
2012-10-20 16:52:29 -04:00
|
|
|
real*4 ccfred(NSMAX)
|
2012-10-15 17:06:15 -04:00
|
|
|
integer*1 i1SoftSymbols(207)
|
|
|
|
integer*2 id2
|
2012-11-15 11:34:14 -05:00
|
|
|
integer ii(1)
|
2012-11-21 12:42:53 -05:00
|
|
|
complex c0(NDMAX)
|
2012-11-26 16:06:41 -05:00
|
|
|
complex c1(NDMAX)
|
2012-11-21 12:42:53 -05:00
|
|
|
common/npar/nutc,ndiskdat,ntrperiod,nfqso,newdat,npts8,nfa,nfb,ntol, &
|
|
|
|
kin,nzhsym,nsave,nagain,ndepth,nrxlog,nfsample,datetime
|
2012-11-14 10:30:21 -05:00
|
|
|
common/tracer/limtrace,lu
|
2012-10-26 12:52:04 -04:00
|
|
|
save
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-11-21 12:42:53 -05:00
|
|
|
call timer('decoder ',0)
|
|
|
|
|
|
|
|
ntrMinutes=ntrperiod/60
|
2012-10-15 17:06:15 -04:00
|
|
|
newdat=1
|
2012-10-30 12:49:24 -04:00
|
|
|
nsynced=0
|
|
|
|
ndecoded=0
|
2012-11-15 18:40:57 -05:00
|
|
|
limit=200
|
|
|
|
if(ndepth.ge.2) limit=2000
|
|
|
|
if(ndepth.ge.3) limit=20000
|
2012-10-15 17:06:15 -04:00
|
|
|
|
|
|
|
nsps=0
|
2012-10-20 13:25:46 -04:00
|
|
|
if(ntrMinutes.eq.1) then
|
|
|
|
nsps=6912
|
|
|
|
df3=1500.0/2048.0
|
2012-11-28 10:09:50 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.0,i4,3x,a22)'
|
|
|
|
fmt14='(i4.4,i4,i5,f6.1,f8.0,i4,3x,a22,i8,i3)'
|
2012-10-20 13:25:46 -04:00
|
|
|
else if(ntrMinutes.eq.2) then
|
2012-10-15 17:06:15 -04:00
|
|
|
nsps=15360
|
2012-10-20 13:25:46 -04:00
|
|
|
df3=1500.0/2048.0
|
2012-11-28 10:09:50 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22)'
|
|
|
|
fmt14='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22,i8,i3)'
|
2012-10-20 13:25:46 -04:00
|
|
|
else if(ntrMinutes.eq.5) then
|
|
|
|
nsps=40960
|
|
|
|
df3=1500.0/6144.0
|
2012-11-28 10:09:50 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22)'
|
|
|
|
fmt14='(i4.4,i4,i5,f6.1,f8.1,i4,3x,a22,i8,i3)'
|
2012-11-15 18:40:57 -05:00
|
|
|
else if(ntrMinutes.eq.10) then
|
2012-10-20 13:25:46 -04:00
|
|
|
nsps=82944
|
|
|
|
df3=1500.0/12288.0
|
2012-11-28 10:09:50 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22)'
|
|
|
|
fmt14='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22,i8,i3)'
|
2012-10-20 13:25:46 -04:00
|
|
|
else if(ntrMinutes.eq.30) then
|
|
|
|
nsps=252000
|
|
|
|
df3=1500.0/32768.0
|
2012-11-28 10:09:50 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22)'
|
|
|
|
fmt14='(i4.4,i4,i5,f6.1,f8.2,i4,3x,a22,i8,i3)'
|
2012-10-15 17:06:15 -04:00
|
|
|
endif
|
2012-10-20 13:25:46 -04:00
|
|
|
if(nsps.eq.0) stop 'Error: bad TRperiod' !Better: return an error code###
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-10-19 15:26:07 -04:00
|
|
|
kstep=nsps/2
|
2012-10-16 19:32:15 -04:00
|
|
|
tstep=kstep/12000.0
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('sync9 ',0)
|
2012-11-19 13:23:39 -05:00
|
|
|
call sync9(ss,nzhsym,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) !Compute ccfred
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('sync9 ',1)
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-11-21 12:42:53 -05:00
|
|
|
! open(13,file='decoded.txt',status='unknown')
|
|
|
|
! rewind 13
|
2012-10-27 10:09:34 -04:00
|
|
|
if(iand(nRxLog,2).ne.0) rewind 14
|
|
|
|
if(iand(nRxLog,1).ne.0) then
|
|
|
|
! Write date and time to lu 14
|
|
|
|
endif
|
2012-10-29 13:58:33 -04:00
|
|
|
|
2012-11-15 18:40:57 -05:00
|
|
|
nRxLog=0
|
2012-10-29 13:58:33 -04:00
|
|
|
fgood=0.
|
2012-11-26 16:06:41 -05:00
|
|
|
nsps8=nsps/8
|
|
|
|
df8=1500.0/nsps8
|
2012-11-27 15:49:33 -05:00
|
|
|
sbest=-1.0
|
|
|
|
dblim=db(864.0/nsps8) - 26.2
|
2012-11-15 11:34:14 -05:00
|
|
|
|
2012-11-19 13:49:21 -05:00
|
|
|
10 ii=maxloc(ccfred(ia:ib))
|
2012-11-15 11:34:14 -05:00
|
|
|
i=ii(1) + ia - 1
|
|
|
|
f=(i-1)*df3
|
|
|
|
if((i.eq.ipk .or. ccfred(i).ge.3.0) .and. abs(f-fgood).gt.10.0*df8) then
|
2012-11-26 16:06:41 -05:00
|
|
|
|
2012-11-27 10:38:03 -05:00
|
|
|
call timer('decode9a',0)
|
2012-11-26 16:06:41 -05:00
|
|
|
fpk=1000.0 + df3*(i-1)
|
|
|
|
c1(1:npts8)=conjg(c0(1:npts8))
|
2012-11-27 10:38:03 -05:00
|
|
|
call decode9a(c1,npts8,nsps8,fpk,syncpk,snrdb,xdt,freq,drift,i1SoftSymbols)
|
|
|
|
call timer('decode9a',1)
|
2012-11-15 11:34:14 -05:00
|
|
|
|
|
|
|
call timer('decode9 ',0)
|
|
|
|
call decode9(i1SoftSymbols,limit,nlim,msg)
|
|
|
|
call timer('decode9 ',1)
|
2012-11-15 18:40:57 -05:00
|
|
|
|
2012-11-26 16:06:41 -05:00
|
|
|
sync=(syncpk-1.0)/2.0
|
2012-11-27 15:49:33 -05:00
|
|
|
if(sync.lt.0.0 .or. snrdb.lt.dblim-2.0) sync=0.0
|
2012-11-15 11:34:14 -05:00
|
|
|
nsync=sync
|
|
|
|
if(nsync.gt.10) nsync=10
|
2012-11-26 16:06:41 -05:00
|
|
|
nsnr=nint(snrdb)
|
2012-11-28 10:09:50 -05:00
|
|
|
ndrift=nint(drift/df3)
|
2012-11-27 15:49:33 -05:00
|
|
|
|
2012-11-26 16:06:41 -05:00
|
|
|
if(sync.gt.sbest .and. fgood.eq.0.0) then
|
|
|
|
sbest=sync
|
2012-11-28 10:09:50 -05:00
|
|
|
write(line,fmt) nutc,nsync,nsnr,xdt,freq,ndrift
|
2012-11-15 11:34:14 -05:00
|
|
|
if(nsync.gt.0) nsynced=1
|
|
|
|
endif
|
|
|
|
|
|
|
|
if(msg.ne.' ') then
|
2012-11-28 10:09:50 -05:00
|
|
|
write(*,fmt) nutc,nsync,nsnr,xdt,freq,ndrift,msg
|
|
|
|
write(14,fmt14) nutc,nsync,nsnr,xdt,freq,ndrift,msg,nlim,ntrMinutes
|
2012-11-15 11:34:14 -05:00
|
|
|
fgood=f
|
|
|
|
nsynced=1
|
|
|
|
ndecoded=1
|
2012-11-19 19:48:41 -05:00
|
|
|
ccfred(max(ia,i-3):min(ib,i+11))=0.
|
2012-10-29 13:58:33 -04:00
|
|
|
endif
|
2012-11-15 11:34:14 -05:00
|
|
|
endif
|
2012-11-19 12:16:31 -05:00
|
|
|
ccfred(i)=0.
|
|
|
|
if(maxval(ccfred(ia:ib)).gt.3.0) go to 10
|
2012-10-29 13:58:33 -04:00
|
|
|
|
|
|
|
if(fgood.eq.0.0) then
|
2012-11-21 12:42:53 -05:00
|
|
|
write(*,1020) line
|
2012-10-29 13:58:33 -04:00
|
|
|
write(14,1020) line
|
|
|
|
1020 format(a33)
|
|
|
|
endif
|
|
|
|
|
2012-11-24 09:36:45 -05:00
|
|
|
write(*,1010) nsynced,ndecoded
|
2012-11-21 12:42:53 -05:00
|
|
|
1010 format('<DecodeFinished>',2i4)
|
|
|
|
flush(6)
|
|
|
|
|
|
|
|
call flush(6)
|
2012-10-26 12:52:04 -04:00
|
|
|
call flush(14)
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('decoder ',1)
|
2012-11-21 12:42:53 -05:00
|
|
|
if(nstandalone.eq.0) call timer('decoder ',101)
|
2012-11-14 10:30:21 -05:00
|
|
|
|
2012-10-15 17:06:15 -04:00
|
|
|
return
|
|
|
|
end subroutine decoder
|