Open decoded.txt in append mode when redoing a decode pass.

Before the subsequent decodes on a period (nagain/=0) were truncating
the file and confusing JTAlert.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4047 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-04-20 02:44:47 +00:00
parent a80db10217
commit a1daf7afff

View File

@ -1,188 +1,193 @@
subroutine decoder(ss,id2) subroutine decoder(ss,id2)
! Decoder for JT9. ! Decoder for JT9.
use prog_args use prog_args
include 'constants.f90' include 'constants.f90'
real ss(184,NSMAX) real ss(184,NSMAX)
character*22 msg character*22 msg
character*20 datetime character*20 datetime
real*4 ccfred(NSMAX) real*4 ccfred(NSMAX)
real*4 red2(NSMAX) real*4 red2(NSMAX)
logical ccfok(NSMAX) logical ccfok(NSMAX)
logical done(NSMAX) logical done(NSMAX)
logical done65,baddata logical done65,baddata
integer*2 id2(NTMAX*12000) integer*2 id2(NTMAX*12000)
real*4 dd(NTMAX*12000) real*4 dd(NTMAX*12000)
integer*1 i1SoftSymbols(207) integer*1 i1SoftSymbols(207)
common/npar/nutc,ndiskdat,ntrperiod,nfqso,newdat,npts8,nfa,nfsplit,nfb, & common/npar/nutc,ndiskdat,ntrperiod,nfqso,newdat,npts8,nfa,nfsplit,nfb, &
ntol,kin,nzhsym,nsave,nagain,ndepth,ntxmode,nmode,datetime ntol,kin,nzhsym,nsave,nagain,ndepth,ntxmode,nmode,datetime
common/tracer/limtrace,lu common/tracer/limtrace,lu
save save
call system_clock(iclock0,iclock_rate,iclock_max) !### call system_clock(iclock0,iclock_rate,iclock_max) !###
nfreqs0=0 nfreqs0=0
nfreqs1=0 nfreqs1=0
ndecodes0=0 ndecodes0=0
ndecodes1=0 ndecodes1=0
open(13,file='decoded.txt',status='unknown') if (nagain .eq. 0) then
open(22,file='kvasd.dat',access='direct',recl=1024,status='unknown') open(13,file='decoded.txt',status='unknown')
else
npts65=52*12000 open(13,file='decoded.txt',status='unknown',position='append')
if(baddata(id2,npts65)) then end if
nsynced=0
ndecoded=0 open(22,file='kvasd.dat',access='direct',recl=1024,status='unknown')
go to 800
endif npts65=52*12000
if(baddata(id2,npts65)) then
ntol65=20 nsynced=0
done65=.false. ndecoded=0
if((nmode.eq.65 .or. nmode.eq.65+9) .and. ntxmode.eq.65) then go to 800
if(newdat.ne.0) dd(1:npts65)=id2(1:npts65) endif
nf1=nfa
nf2=nfb ntol65=20
if(nmode.eq.65+9) nf2=nfsplit done65=.false.
call jt65a(dd,npts65,newdat,nutc,nf1,nf2,nfqso,ntol65,nagain,ndecoded) if((nmode.eq.65 .or. nmode.eq.65+9) .and. ntxmode.eq.65) then
done65=.true. if(newdat.ne.0) dd(1:npts65)=id2(1:npts65)
endif nf1=nfa
nf2=nfb
if(nmode.eq.65) go to 800 if(nmode.eq.65+9) nf2=nfsplit
call jt65a(dd,npts65,newdat,nutc,nf1,nf2,nfqso,ntol65,nagain,ndecoded)
nsynced=0 done65=.true.
ndecoded=0 endif
nsps=0
if(nmode.eq.65) go to 800
nsps=6912 !Params for JT9-1
df3=1500.0/2048.0 nsynced=0
ndecoded=0
tstep=0.5*nsps/12000.0 !Half-symbol step (seconds) nsps=0
done=.false.
nsps=6912 !Params for JT9-1
nf0=0 df3=1500.0/2048.0
nf1=nfa
if(nmode.eq.65+9) nf1=nfsplit tstep=0.5*nsps/12000.0 !Half-symbol step (seconds)
ia=max(1,nint((nf1-nf0)/df3)) done=.false.
ib=min(NSMAX,nint((nfb-nf0)/df3))
lag1=-(2.5/tstep + 0.9999) nf0=0
lag2=5.0/tstep + 0.9999 nf1=nfa
if(newdat.ne.0) then if(nmode.eq.65+9) nf1=nfsplit
call timer('sync9 ',0) ia=max(1,nint((nf1-nf0)/df3))
call sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,red2,ipk) ib=min(NSMAX,nint((nfb-nf0)/df3))
call timer('sync9 ',1) lag1=-(2.5/tstep + 0.9999)
endif lag2=5.0/tstep + 0.9999
if(newdat.ne.0) then
nsps8=nsps/8 call timer('sync9 ',0)
df8=1500.0/nsps8 call sync9(ss,nzhsym,lag1,lag2,ia,ib,ccfred,red2,ipk)
dblim=db(864.0/nsps8) - 26.2 call timer('sync9 ',1)
endif
do nqd=1,0,-1
limit=1000 nsps8=nsps/8
ccflim=4.0 df8=1500.0/nsps8
red2lim=1.6 dblim=db(864.0/nsps8) - 26.2
schklim=2.2
if(ndepth.eq.2) then do nqd=1,0,-1
limit=10000 limit=1000
ccflim=3.5 ccflim=4.0
endif red2lim=1.6
if(ndepth.ge.3 .or. nqd.eq.1) then schklim=2.2
limit=100000 if(ndepth.eq.2) then
ccflim=2.5 limit=10000
endif ccflim=3.5
ccfok=.false. endif
if(ndepth.ge.3 .or. nqd.eq.1) then
if(nqd.eq.1) then limit=100000
nfa1=nfqso-ntol ccflim=2.5
nfb1=nfqso+ntol endif
ia=max(1,nint((nfa1-nf0)/df3)) ccfok=.false.
ib=min(NSMAX,nint((nfb1-nf0)/df3))
ccfok(ia:ib)=(ccfred(ia:ib).gt.(ccflim-2.0)) .and. & if(nqd.eq.1) then
(red2(ia:ib).gt.(red2lim-1.0)) nfa1=nfqso-ntol
ia1=ia nfb1=nfqso+ntol
ib1=ib ia=max(1,nint((nfa1-nf0)/df3))
else ib=min(NSMAX,nint((nfb1-nf0)/df3))
nfa1=nf1 ccfok(ia:ib)=(ccfred(ia:ib).gt.(ccflim-2.0)) .and. &
nfb1=nfb (red2(ia:ib).gt.(red2lim-1.0))
ia=max(1,nint((nfa1-nf0)/df3)) ia1=ia
ib=min(NSMAX,nint((nfb1-nf0)/df3)) ib1=ib
do i=ia,ib else
ccfok(i)=ccfred(i).gt.ccflim .and. red2(i).gt.red2lim nfa1=nf1
enddo nfb1=nfb
ccfok(ia1:ib1)=.false. ia=max(1,nint((nfa1-nf0)/df3))
endif ib=min(NSMAX,nint((nfb1-nf0)/df3))
do i=ia,ib
fgood=0. ccfok(i)=ccfred(i).gt.ccflim .and. red2(i).gt.red2lim
do i=ia,ib enddo
if(done(i) .or. (.not.ccfok(i))) cycle ccfok(ia1:ib1)=.false.
f=(i-1)*df3 endif
if(nqd.eq.1 .or. &
(ccfred(i).ge.ccflim .and. abs(f-fgood).gt.10.0*df8)) then fgood=0.
do i=ia,ib
if(nqd.eq.0) nfreqs0=nfreqs0+1 if(done(i) .or. (.not.ccfok(i))) cycle
if(nqd.eq.1) nfreqs1=nfreqs1+1 f=(i-1)*df3
if(nqd.eq.1 .or. &
call timer('softsym ',0) (ccfred(i).ge.ccflim .and. abs(f-fgood).gt.10.0*df8)) then
fpk=nf0 + df3*(i-1)
if(nqd.eq.0) nfreqs0=nfreqs0+1
call softsym(id2,npts8,nsps8,newdat,fpk,syncpk,snrdb,xdt, & if(nqd.eq.1) nfreqs1=nfreqs1+1
freq,drift,schk,i1SoftSymbols)
call timer('softsym ',1) call timer('softsym ',0)
fpk=nf0 + df3*(i-1)
! write(71,3001) nqd,i,f,fpk,ccfred(i),red2(i),schk
!3001 format(2i6,2f8.1,3f6.1) call softsym(id2,npts8,nsps8,newdat,fpk,syncpk,snrdb,xdt, &
! call flush(71) freq,drift,schk,i1SoftSymbols)
call timer('softsym ',1)
if(schk.lt.schklim) cycle
! write(71,3001) nqd,i,f,fpk,ccfred(i),red2(i),schk
call timer('decode9 ',0) !3001 format(2i6,2f8.1,3f6.1)
call decode9(i1SoftSymbols,limit,nlim,msg) ! call flush(71)
call timer('decode9 ',1)
if(schk.lt.schklim) cycle
sync=(syncpk+1)/4.0
if(sync.lt.0.0 .or. snrdb.lt.dblim-2.0) sync=0.0 call timer('decode9 ',0)
nsync=sync call decode9(i1SoftSymbols,limit,nlim,msg)
if(nsync.gt.10) nsync=10 call timer('decode9 ',1)
nsnr=nint(snrdb)
ndrift=nint(drift/df3) sync=(syncpk+1)/4.0
if(sync.lt.0.0 .or. snrdb.lt.dblim-2.0) sync=0.0
if(msg.ne.' ') then nsync=sync
if(nqd.eq.0) ndecodes0=ndecodes0+1 if(nsync.gt.10) nsync=10
if(nqd.eq.1) ndecodes1=ndecodes1+1 nsnr=nint(snrdb)
ndrift=nint(drift/df3)
write(*,1000) nutc,nsnr,xdt,nint(freq),msg
1000 format(i4.4,i4,f5.1,i5,1x,'@',1x,a22) if(msg.ne.' ') then
write(13,1002) nutc,nsync,nsnr,xdt,freq,ndrift,msg if(nqd.eq.0) ndecodes0=ndecodes0+1
1002 format(i4.4,i4,i5,f6.1,f8.0,i4,3x,a22,' JT9') if(nqd.eq.1) ndecodes1=ndecodes1+1
iaa=max(1,i-1) write(*,1000) nutc,nsnr,xdt,nint(freq),msg
ibb=min(NSMAX,i+22) 1000 format(i4.4,i4,f5.1,i5,1x,'@',1x,a22)
fgood=f write(13,1002) nutc,nsync,nsnr,xdt,freq,ndrift,msg
nsynced=1 1002 format(i4.4,i4,i5,f6.1,f8.0,i4,3x,a22,' JT9')
ndecoded=1
ccfok(iaa:ibb)=.false. iaa=max(1,i-1)
done(iaa:ibb)=.true. ibb=min(NSMAX,i+22)
call flush(6) fgood=f
endif nsynced=1
endif ndecoded=1
enddo ccfok(iaa:ibb)=.false.
call flush(6) done(iaa:ibb)=.true.
if(nagain.ne.0) exit call flush(6)
enddo endif
endif
if(nmode.ge.65 .and. (.not.done65)) then enddo
if(newdat.ne.0) dd(1:npts65)=id2(1:npts65) call flush(6)
nf1=nfa if(nagain.ne.0) exit
nf2=nfb enddo
call jt65a(dd,npts65,newdat,nutc,nf1,nf2,nfqso,ntol65,nagain,ndecoded)
endif if(nmode.ge.65 .and. (.not.done65)) then
if(newdat.ne.0) dd(1:npts65)=id2(1:npts65)
!### JT65 is not yet producing info for nsynced, ndecoded. nf1=nfa
800 write(*,1010) nsynced,ndecoded nf2=nfb
1010 format('<DecodeFinished>',2i4) call jt65a(dd,npts65,newdat,nutc,nf1,nf2,nfqso,ntol65,nagain,ndecoded)
call flush(6) endif
close(13)
close(22) !### JT65 is not yet producing info for nsynced, ndecoded.
800 write(*,1010) nsynced,ndecoded
return 1010 format('<DecodeFinished>',2i4)
end subroutine decoder call flush(6)
close(13)
close(22)
return
end subroutine decoder