2012-11-01 15:54:40 -04:00
|
|
|
subroutine decoder(ntrSeconds,ndepth,nRxLog,c00)
|
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
|
|
|
|
character*22 msg
|
2012-10-29 13:58:33 -04:00
|
|
|
character*33 line
|
2012-11-12 13:28:28 -05:00
|
|
|
character*80 fmt
|
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-01 15:54:40 -04:00
|
|
|
complex c0(NDMAX),c00(NDMAX)
|
|
|
|
common/jt9com/ss0(184,NSMAX),savg(NSMAX),id2(NMAX),nutc0,ndiskdat, &
|
2012-11-12 11:33:45 -05:00
|
|
|
ntr,nfqso,newdat,npts80,nfb,ntol,kin,nsynced,ndecoded
|
2012-11-01 15:54:40 -04:00
|
|
|
common/jt9comB/ss(184,NSMAX),c0
|
2012-11-14 10:30:21 -05:00
|
|
|
common/tracer/limtrace,lu
|
2012-10-26 12:52:04 -04:00
|
|
|
logical first
|
|
|
|
data first/.true./
|
|
|
|
save
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-11-14 10:30:21 -05:00
|
|
|
if(first) then
|
|
|
|
limtrace=0
|
|
|
|
lu=12
|
|
|
|
open(12,file='timer.out',status='unknown')
|
|
|
|
open(14,file='wsjtx_rx.log',status='unknown',position='append')
|
|
|
|
first=.false.
|
|
|
|
endif
|
|
|
|
|
|
|
|
call timer('decoder ',0)
|
|
|
|
|
2012-11-01 15:54:40 -04:00
|
|
|
if(newdat.ne.0) then
|
|
|
|
ss=ss0
|
|
|
|
c0=c00
|
|
|
|
nutc=nutc0
|
|
|
|
npts8=npts80
|
|
|
|
endif
|
|
|
|
|
2012-10-15 17:06:15 -04:00
|
|
|
ntrMinutes=ntrSeconds/60
|
|
|
|
newdat=1
|
2012-10-30 12:49:24 -04:00
|
|
|
nsynced=0
|
|
|
|
ndecoded=0
|
2012-10-31 14:33:56 -04:00
|
|
|
limit=1000
|
|
|
|
if(ndepth.ge.2) limit=20000
|
|
|
|
if(ndepth.ge.3) limit=100000
|
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-14 10:30:21 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.0,f6.1,3x,a22)'
|
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-12 13:28:28 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.1,f6.2,3x,a22)'
|
2012-10-20 13:25:46 -04:00
|
|
|
else if(ntrMinutes.eq.5) then
|
|
|
|
nsps=40960
|
|
|
|
df3=1500.0/6144.0
|
2012-11-12 13:28:28 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.1,f6.2,3x,a22)'
|
2012-10-20 13:25:46 -04:00
|
|
|
else if(ntrMinutes.eq.10) then
|
|
|
|
nsps=82944
|
|
|
|
df3=1500.0/12288.0
|
2012-11-12 13:28:28 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22)'
|
2012-10-20 13:25:46 -04:00
|
|
|
else if(ntrMinutes.eq.30) then
|
|
|
|
nsps=252000
|
|
|
|
df3=1500.0/32768.0
|
2012-11-12 13:28:28 -05:00
|
|
|
fmt='(i4.4,i4,i5,f6.1,f8.2,f6.2,3x,a22)'
|
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-12 11:33:45 -05:00
|
|
|
call sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) ! Get sync, approx freq
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('sync9 ',1)
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-10-26 12:52:04 -04: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
|
|
|
|
|
|
|
fgood=0.
|
|
|
|
df8=1500.0/(nsps/8)
|
|
|
|
sbest=0.
|
|
|
|
do i=ia,ib
|
|
|
|
f=(i-1)*df3
|
2012-10-31 14:33:56 -04:00
|
|
|
if((i.eq.ipk .or. ccfred(i).ge.3.0) .and. f.gt.fgood+10.0*df8) then
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('spec9 ',0)
|
2012-11-13 10:55:03 -05:00
|
|
|
call spec9(c0,npts8,nsps,f,fpk,xdt,snr,i1SoftSymbols)
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('spec9 ',1)
|
|
|
|
|
|
|
|
call timer('decode9 ',0)
|
2012-10-31 14:33:56 -04:00
|
|
|
call decode9(i1SoftSymbols,limit,nlim,msg)
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('decode9 ',1)
|
2012-10-30 11:02:27 -04:00
|
|
|
sync=ccfred(i) - 2.0
|
2012-10-29 13:58:33 -04:00
|
|
|
if(sync.lt.0.0) sync=0.0
|
|
|
|
nsync=sync
|
|
|
|
if(nsync.gt.10) nsync=10
|
|
|
|
nsnr=nint(snr)
|
2012-11-13 10:55:03 -05:00
|
|
|
drift=0.0
|
2012-10-29 13:58:33 -04:00
|
|
|
|
|
|
|
if(ccfred(i).gt.sbest .and. fgood.eq.0.0) then
|
|
|
|
sbest=ccfred(i)
|
2012-11-13 10:55:03 -05:00
|
|
|
write(line,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift
|
2012-10-30 12:49:24 -04:00
|
|
|
if(nsync.gt.0) nsynced=1
|
2012-10-29 13:58:33 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
if(msg.ne.' ') then
|
2012-11-14 12:02:54 -05:00
|
|
|
write(13,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg
|
|
|
|
write(14,fmt) nutc,nsync,nsnr,xdt,1000.0+fpk,drift,msg
|
2012-10-29 13:58:33 -04:00
|
|
|
fgood=f
|
2012-10-30 12:49:24 -04:00
|
|
|
nsynced=1
|
|
|
|
ndecoded=1
|
2012-10-29 13:58:33 -04:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
|
|
|
if(fgood.eq.0.0) then
|
|
|
|
write(13,1020) line
|
|
|
|
write(14,1020) line
|
|
|
|
1020 format(a33)
|
|
|
|
endif
|
|
|
|
|
|
|
|
call flush(13)
|
2012-10-26 12:52:04 -04:00
|
|
|
call flush(14)
|
2012-10-29 13:58:33 -04:00
|
|
|
close(13)
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2012-11-14 10:30:21 -05:00
|
|
|
call timer('decoder ',1)
|
|
|
|
call timer('decoder ',101)
|
|
|
|
|
2012-10-15 17:06:15 -04:00
|
|
|
return
|
|
|
|
end subroutine decoder
|