2013-07-08 09:17:22 -04:00
|
|
|
subroutine decoder(ss,id2)
|
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
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
include 'constants.f90'
|
2012-11-21 12:42:53 -05:00
|
|
|
real ss(184,NSMAX)
|
2012-10-15 17:06:15 -04:00
|
|
|
character*22 msg
|
2012-11-21 12:42:53 -05:00
|
|
|
character*20 datetime
|
2012-10-20 16:52:29 -04:00
|
|
|
real*4 ccfred(NSMAX)
|
2013-05-16 12:02:00 -04:00
|
|
|
real*4 red2(NSMAX)
|
2013-03-19 13:26:45 -04:00
|
|
|
logical ccfok(NSMAX)
|
2013-04-15 19:42:42 -04:00
|
|
|
logical done(NSMAX)
|
2014-01-27 16:28:54 -05:00
|
|
|
logical done65,baddata
|
2013-07-08 09:17:22 -04:00
|
|
|
integer*2 id2(NTMAX*12000)
|
|
|
|
real*4 dd(NTMAX*12000)
|
2012-10-15 17:06:15 -04:00
|
|
|
integer*1 i1SoftSymbols(207)
|
2013-08-09 13:22:08 -04:00
|
|
|
common/npar/nutc,ndiskdat,ntrperiod,nfqso,newdat,npts8,nfa,nfsplit,nfb, &
|
|
|
|
ntol,kin,nzhsym,nsave,nagain,ndepth,ntxmode,nmode,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
|
|
|
|
2013-05-14 10:29:01 -04:00
|
|
|
call system_clock(iclock0,iclock_rate,iclock_max) !###
|
|
|
|
nfreqs0=0
|
|
|
|
nfreqs1=0
|
|
|
|
ndecodes0=0
|
|
|
|
ndecodes1=0
|
|
|
|
|
2013-04-02 09:49:52 -04:00
|
|
|
open(13,file='decoded.txt',status='unknown')
|
2013-07-08 09:17:22 -04:00
|
|
|
open(22,file='kvasd.dat',access='direct',recl=1024,status='unknown')
|
|
|
|
|
|
|
|
npts65=52*12000
|
2014-01-27 16:28:54 -05:00
|
|
|
if(baddata(id2,npts65)) then
|
|
|
|
nsynced=0
|
|
|
|
ndecoded=0
|
|
|
|
go to 800
|
|
|
|
endif
|
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
ntol65=20
|
|
|
|
done65=.false.
|
|
|
|
if(nmode.ge.65 .and. ntxmode.eq.65) then
|
|
|
|
if(newdat.ne.0) dd(1:npts65)=id2(1:npts65)
|
2013-08-09 13:22:08 -04:00
|
|
|
nf1=nfa
|
|
|
|
nf2=nfb
|
|
|
|
if(nmode.eq.65+9) nf2=nfsplit
|
|
|
|
call jt65a(dd,npts65,newdat,nutc,nf1,nf2,nfqso,ntol65,nagain,ndecoded)
|
2013-07-08 09:17:22 -04:00
|
|
|
done65=.true.
|
|
|
|
endif
|
|
|
|
|
|
|
|
if(nmode.eq.65) go to 800
|
|
|
|
|
2012-10-30 12:49:24 -04:00
|
|
|
nsynced=0
|
|
|
|
ndecoded=0
|
2012-10-15 17:06:15 -04:00
|
|
|
nsps=0
|
2013-04-09 11:16:34 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
nsps=6912 !Params for JT9-1
|
|
|
|
df3=1500.0/2048.0
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2013-04-22 11:43:02 -04:00
|
|
|
tstep=0.5*nsps/12000.0 !Half-symbol step (seconds)
|
2013-04-15 19:42:42 -04:00
|
|
|
done=.false.
|
2012-10-15 17:06:15 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
nf0=0
|
2013-08-09 13:22:08 -04:00
|
|
|
nf1=nfa
|
|
|
|
if(nmode.eq.65+9) nf1=nfsplit
|
|
|
|
ia=max(1,nint((nf1-nf0)/df3))
|
2013-07-08 09:17:22 -04:00
|
|
|
ib=min(NSMAX,nint((nfb-nf0)/df3))
|
2013-05-16 12:02:00 -04:00
|
|
|
lag1=-(2.5/tstep + 0.9999)
|
|
|
|
lag2=5.0/tstep + 0.9999
|
2013-07-08 09:17:22 -04:00
|
|
|
if(newdat.ne.0) then
|
|
|
|
call timer('sync9 ',0)
|
|
|
|
call sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,red2,ipk)
|
|
|
|
call timer('sync9 ',1)
|
|
|
|
endif
|
2013-05-16 15:01:16 -04:00
|
|
|
|
|
|
|
nsps8=nsps/8
|
|
|
|
df8=1500.0/nsps8
|
|
|
|
dblim=db(864.0/nsps8) - 26.2
|
2013-05-16 12:02:00 -04:00
|
|
|
|
2013-04-03 16:21:00 -04:00
|
|
|
do nqd=1,0,-1
|
2013-05-15 07:37:25 -04:00
|
|
|
limit=1000
|
2013-04-17 10:53:58 -04:00
|
|
|
ccflim=4.0
|
2013-05-16 15:01:16 -04:00
|
|
|
red2lim=1.6
|
|
|
|
schklim=2.2
|
2013-05-15 07:37:25 -04:00
|
|
|
if(ndepth.eq.2) then
|
|
|
|
limit=10000
|
|
|
|
ccflim=3.5
|
2013-04-09 11:16:34 -04:00
|
|
|
endif
|
2013-07-17 15:13:36 -04:00
|
|
|
if(ndepth.ge.3 .or. nqd.eq.1) then
|
2013-05-15 07:37:25 -04:00
|
|
|
limit=100000
|
2013-05-16 12:02:00 -04:00
|
|
|
ccflim=2.5
|
2013-04-09 11:16:34 -04:00
|
|
|
endif
|
2013-05-16 15:01:16 -04:00
|
|
|
ccfok=.false.
|
2013-04-09 11:16:34 -04:00
|
|
|
|
2013-04-03 16:21:00 -04:00
|
|
|
if(nqd.eq.1) then
|
|
|
|
nfa1=nfqso-ntol
|
|
|
|
nfb1=nfqso+ntol
|
2013-07-08 09:17:22 -04:00
|
|
|
ia=max(1,nint((nfa1-nf0)/df3))
|
|
|
|
ib=min(NSMAX,nint((nfb1-nf0)/df3))
|
2013-07-16 14:17:20 -04:00
|
|
|
ccfok(ia:ib)=(ccfred(ia:ib).gt.(ccflim-2.0)) .and. &
|
|
|
|
(red2(ia:ib).gt.(red2lim-1.0))
|
2013-04-03 16:21:00 -04:00
|
|
|
ia1=ia
|
|
|
|
ib1=ib
|
|
|
|
else
|
2013-08-09 13:22:08 -04:00
|
|
|
nfa1=nf1
|
2013-05-16 15:01:16 -04:00
|
|
|
nfb1=nfb
|
2013-07-08 09:17:22 -04:00
|
|
|
ia=max(1,nint((nfa1-nf0)/df3))
|
|
|
|
ib=min(NSMAX,nint((nfb1-nf0)/df3))
|
2013-05-14 13:42:25 -04:00
|
|
|
do i=ia,ib
|
2013-05-16 12:02:00 -04:00
|
|
|
ccfok(i)=ccfred(i).gt.ccflim .and. red2(i).gt.red2lim
|
2013-04-03 16:21:00 -04:00
|
|
|
enddo
|
|
|
|
ccfok(ia1:ib1)=.false.
|
|
|
|
endif
|
2013-03-19 13:26:45 -04:00
|
|
|
|
2013-04-03 16:21:00 -04:00
|
|
|
fgood=0.
|
|
|
|
do i=ia,ib
|
2013-07-16 14:17:20 -04:00
|
|
|
if(done(i) .or. (.not.ccfok(i))) cycle
|
2013-04-03 16:21:00 -04:00
|
|
|
f=(i-1)*df3
|
2013-04-15 19:42:42 -04:00
|
|
|
if(nqd.eq.1 .or. &
|
2013-04-16 14:33:38 -04:00
|
|
|
(ccfred(i).ge.ccflim .and. abs(f-fgood).gt.10.0*df8)) then
|
2013-05-14 10:29:01 -04:00
|
|
|
|
|
|
|
if(nqd.eq.0) nfreqs0=nfreqs0+1
|
|
|
|
if(nqd.eq.1) nfreqs1=nfreqs1+1
|
|
|
|
|
2013-04-22 11:43:02 -04:00
|
|
|
call timer('softsym ',0)
|
2013-07-08 09:17:22 -04:00
|
|
|
fpk=nf0 + df3*(i-1)
|
2013-07-16 14:17:20 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
call softsym(id2,npts8,nsps8,newdat,fpk,syncpk,snrdb,xdt, &
|
|
|
|
freq,drift,schk,i1SoftSymbols)
|
2013-04-22 11:43:02 -04:00
|
|
|
call timer('softsym ',1)
|
2013-03-21 18:58:16 -04:00
|
|
|
|
2013-07-16 14:17:20 -04:00
|
|
|
! write(71,3001) nqd,i,f,fpk,ccfred(i),red2(i),schk
|
|
|
|
!3001 format(2i6,2f8.1,3f6.1)
|
|
|
|
! call flush(71)
|
|
|
|
|
|
|
|
if(schk.lt.schklim) cycle
|
2013-05-15 11:17:36 -04:00
|
|
|
|
2013-07-16 14:17:20 -04:00
|
|
|
call timer('decode9 ',0)
|
|
|
|
call decode9(i1SoftSymbols,limit,nlim,msg)
|
|
|
|
call timer('decode9 ',1)
|
2013-05-15 11:17:36 -04:00
|
|
|
|
2013-07-16 14:17:20 -04:00
|
|
|
sync=(syncpk+1)/4.0
|
|
|
|
if(sync.lt.0.0 .or. snrdb.lt.dblim-2.0) sync=0.0
|
|
|
|
nsync=sync
|
|
|
|
if(nsync.gt.10) nsync=10
|
|
|
|
nsnr=nint(snrdb)
|
|
|
|
ndrift=nint(drift/df3)
|
2013-05-15 11:17:36 -04:00
|
|
|
|
2013-07-16 14:17:20 -04:00
|
|
|
if(msg.ne.' ') then
|
|
|
|
if(nqd.eq.0) ndecodes0=ndecodes0+1
|
|
|
|
if(nqd.eq.1) ndecodes1=ndecodes1+1
|
2013-05-15 11:17:36 -04:00
|
|
|
|
2013-07-16 14:17:20 -04:00
|
|
|
write(*,1000) nutc,nsnr,xdt,nint(freq),msg
|
|
|
|
1000 format(i4.4,i4,f5.1,i5,1x,'@',1x,a22)
|
|
|
|
write(13,1002) nutc,nsync,nsnr,xdt,freq,ndrift,msg
|
|
|
|
1002 format(i4.4,i4,i5,f6.1,f8.0,i4,3x,a22,' JT9')
|
|
|
|
|
|
|
|
iaa=max(1,i-1)
|
|
|
|
ibb=min(NSMAX,i+22)
|
|
|
|
fgood=f
|
|
|
|
nsynced=1
|
|
|
|
ndecoded=1
|
|
|
|
ccfok(iaa:ibb)=.false.
|
|
|
|
done(iaa:ibb)=.true.
|
|
|
|
call flush(6)
|
2013-04-03 16:21:00 -04:00
|
|
|
endif
|
2013-03-21 18:58:16 -04:00
|
|
|
endif
|
2013-04-03 16:21:00 -04:00
|
|
|
enddo
|
|
|
|
call flush(6)
|
2013-04-08 17:01:30 -04:00
|
|
|
if(nagain.ne.0) exit
|
2013-03-21 18:58:16 -04:00
|
|
|
enddo
|
2012-10-29 13:58:33 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
if(nmode.ge.65 .and. (.not.done65)) then
|
|
|
|
if(newdat.ne.0) dd(1:npts65)=id2(1:npts65)
|
2013-08-09 19:11:05 -04:00
|
|
|
nf1=nfa
|
|
|
|
nf2=nfb
|
2013-08-09 13:22:08 -04:00
|
|
|
call jt65a(dd,npts65,newdat,nutc,nf1,nf2,nfqso,ntol65,nagain,ndecoded)
|
2013-07-08 09:17:22 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
!### JT65 is not yet producing info for nsynced, ndecoded.
|
|
|
|
800 write(*,1010) nsynced,ndecoded
|
2012-11-21 12:42:53 -05:00
|
|
|
1010 format('<DecodeFinished>',2i4)
|
|
|
|
call flush(6)
|
2013-04-02 09:49:52 -04:00
|
|
|
close(13)
|
2013-07-08 09:17:22 -04:00
|
|
|
close(22)
|
2013-05-14 10:29:01 -04:00
|
|
|
|
2012-10-15 17:06:15 -04:00
|
|
|
return
|
|
|
|
end subroutine decoder
|