Removed ndebug writes to lu 29.

Simplified and (I think) corrected recvpkt.F90.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@991 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2008-07-24 15:43:05 +00:00
parent 5ea44ad81a
commit df5cbcf1f4
5 changed files with 51 additions and 135 deletions

View File

@ -38,11 +38,6 @@ subroutine decode1(iarg)
kkk=kk
if(kbuf.eq.2) kkk=kk-5760000
n=Tsec
if(ndebug.eq.2 .and. n.ne.ns00) then
write(29,3101) nutc,mod(n,60),kbuf,kk,kkdone,ndecoding,newdat
3101 format('d1:',i5.4,i3.2,i5,2i10,2i3)
ns00=n
endif
if((ndiskdat.eq.1 .or. ndecoding.eq.0) .and. ((kkk-kkdone).gt.32768)) then
call symspec(id,kbuf,kk,kkdone,nutc,newdat)

View File

@ -1,4 +1,4 @@
#--------------------------------------------------------------------- MAP65
#-------------------------------------------------------------------- MAP65
# $Date$ $Revision$
#
from Tkinter import *
@ -977,9 +977,10 @@ def update():
ldate.configure(text=t)
t="Rx noise: %.1f dB" % Audio.gcom2.rxnoise
msg4.configure(text=t)
## t="Drop: %.2f %%" % Audio.gcom2.pctlost
## msg5.configure(text=t)
t="%d %d %d" % (Audio.datcom.kbuf,Audio.datcom.kk,Audio.datcom.kxp/96000)
t="Drop: %.2f %%" % Audio.gcom2.pctlost
msg5.configure(text=t)
## t="%d %.2f %.2f" % (Audio.datcom.kbuf,Audio.datcom.kk/(60.0*96000.0), \
## Audio.datcom.kxp/(60.0*96000.0))
msg5.configure(text=t)
root_geom=root.geometry()
try:

View File

@ -28,10 +28,6 @@ subroutine map65a(newdat)
nfoffset=nint(1000*(fcenter-144.125d0))
mfqso=mousefqso - nfoffset
pctlost=nlost/331.03
if(ndebug.eq.2) write(29,3001) nutc,mod(int(sec_midn()),60),nlost,pctlost
3001 format('m1:',i5.4,i3.2,i8,f7.2,' %')
rewind 11
rewind 12
if(nrw26.ne.0) then
@ -298,8 +294,6 @@ subroutine map65a(newdat)
call flushqqq(11)
ndecdone=1
t2=sec_midn()
if(ndebug.eq.2) write(29,3002) mod(int(t2),60)
3002 format('m2:'i8.2)
endif
if(nagain.eq.1) go to 999
enddo
@ -386,14 +380,6 @@ subroutine map65a(newdat)
if(kbuf.eq.1) kkdone=60*96000
if(kbuf.eq.2 .or. ndiskdat.eq.1) kkdone=0
kk=kkdone
if(nagain.eq.0) then
t3=sec_midn()
if(ndebug.eq.2) write(29,3003) mod(int(t3),60)
3003 format('m3:'i8.2)
if(ndebug.eq.1) write(*,3004) nutc,mod(t2,60.0),mod(t3,60.0), &
nlost,pctlost
3004 format('map65:',i5.4,1x,2f6.1,i6,f8.2,' %')
endif
nagain=0
return

View File

@ -8,68 +8,54 @@ subroutine recvpkt(iarg)
integer*1 userx_no,iusb
integer*2 nblock,nblock0
integer txnow
logical first
real*8 center_freq,buf8
common/plrscom/center_freq,msec,fqso,iptr,nblock,userx_no,iusb,buf8(174)
include 'datcom.f90'
include 'gcom1.f90'
include 'gcom2.f90'
equivalence (id,d8)
data nblock0/0/,first/.true./,kb/1/,npkt/0/,nw/0/,nseq/0/
data nblock0/0/,kb/1/,npkt/0/,nw/0/,ns0/99/
data sqave/0.0/,u/0.001/,rxnoise/0.0/,kbuf/1/,lost_tot/0/
data multicast0/-99/
save
1 call setup_rsocket(multicast) !Open socket for multicast/unicast data
nreset=-1
k=0
kk=0
kxp=0
kb=1
nsec0=-999
fcenter=144.125 !Default (startup) frequency)
multicast0=multicast
ntx=0
10 if(multicast.ne.multicast0) go to 1
call recv_pkt(center_freq)
! Should receive a new packet every 174/96000 = 0.0018125 s
npkt=npkt+1
nsec=mod(Tsec,86400.d0) !Time according to MAP65
nseclr=msec/1000 !Time according to Linrad
fcenter=center_freq
nsec=mod(Tsec,86400.d0)
! Wait for start of a minute to begin accepting Rx data.
! (Alternative: wreset buffer pointers at start of minute?)
if(nsec0.eq.-999) then
if(mod(nsec,60).ne.0) go to 10
nsec0=-998
endif
isec=sec_midn()
imin=isec/60
if(transmitting.eq.1) then
! Reset buffer pointers at start of minute.
ns=mod(nsec,60)
if(ns.lt.ns0) then
if(ntx.eq.0) kb=3-kb
k=(kb-1)*60*96000
ndone1=0
ndone2=0
ntx=0
lost_tot=0
kxp=k
npkt=0
endif
ns0=ns
if((monitoring.eq.0) .or. (lauto.eq.1 .and. mod(imin,2).eq.(1-TxFirst))) then
first=.true.
! If we're transmitting and were previously receiving in this minute,
! switch buffers to prepare for the next Rx minute.
if(lauto.eq.1 .and. mod(imin,2).eq.(1-TxFirst) .and. nreset.eq.1) then
nreset=0
kb=3-kb
k=0
if(kb.eq.2) k=NSMAX
lost_tot=0
ndone1=0
ndone2=0
endif
go to 10
endif
! If we get here, we're in Rx mode
if(transmitting.eq.1) ntx=1
! Check for lost packets
lost=nblock-nblock0-1
if(lost.ne.0 .and. .not.first) then
if(lost.ne.0) then
nb=nblock
if(nb.lt.0) nb=nb+65536
nb0=nblock0
@ -82,30 +68,13 @@ subroutine recvpkt(iarg)
endif
nblock0=nblock
if(mod(nsec,60).eq.1 .or. transmitting.eq.1) nreset=1
tdiff=mod(0.001d0*msec,60.d0)-mod(Tsec,60.d0)
if(tdiff.lt.-30.) tdiff=tdiff+60.
if(tdiff.gt.30.) tdiff=tdiff-60.
! If this is the start of a new minute, switch buffers
if(mod(nsec,60).eq.0 .and. nreset.eq.1) then
nreset=0
kb=3-kb
k=0
if(kb.eq.2) k=NSMAX
lost_tot=0
ndone1=0
ndone2=0
nseq=nseq+1
kxp=k
endif
! Test for buffer full
if((kb.eq.1 .and. (k+174).gt.NSMAX) .or. &
(kb.eq.2 .and. (k+174).gt.2*NSMAX)) then
print*,'Recvpkt:',kb,k,NSMAX
go to 20
endif
(kb.eq.2 .and. (k+174).gt.2*NSMAX)) go to 20
! Move data into Rx buffer and compute average signal level.
sq=0.
@ -118,69 +87,46 @@ subroutine recvpkt(iarg)
k2=k2-NSMAX
n=2
endif
sq=sq + float(int(id(1,k2,n)))**2 + float(int(id(1,k2,n)))**2 + &
float(int(id(1,k2,n)))**2 + float(int(id(1,k2,n)))**2
x1=id(1,k2,n)
x2=id(2,k2,n)
x3=id(3,k2,n)
x4=id(4,k2,n)
sq=sq + x1*x1 + x2*x2 + x3*x3 + x4*x4
enddo
sqave=sqave + u*(sq-sqave)
rxnoise=10.0*log10(sqave) - 48.0
kxp=k
if(k.lt.1 .or. k.gt.NSZ) then
print*,'Error in recvpkt: ',k,NSZ,NSMAX
stop
endif
! The following may be a bad idea because it uses non-reentrant Fortran I/O ???
if(mode.eq.'Measur') then
npkt=npkt+1
if(npkt.ge.551) then
npkt=0
nw=nw+1
rewind 11
write(11,1000) nw,rxnoise
1000 format(i6,f8.2)
write(11,*) '$EOF'
call flushqqq(11)
ndecdone=1
write(24,1000) nw,rxnoise
endif
else
nw=0
endif
20 if(nsec.ne.nsec0) then
nsec0=nsec
nseclr=msec/1000
mutch=nseclr/3600
mutcm=mod(nseclr/60,60)
mutc=100*mutch + mutcm
! See if it's time to start FFTs
ns=mod(nsec,60)
if(ns.ge.nt1 .and. ndone1.eq.0) then
nutc=mutc
fcenter=center_freq
kbuf=kb
kk=k
ndiskdat=0
ndone1=1
endif
! If we have not transmitted in this minute, see if it's time to start FFTs
if(ntx.eq.0) then
if(ns.ge.nt1 .and. ndone1.eq.0) then
nutc=mutc
fcenter=center_freq
kbuf=kb
kk=k
ndiskdat=0
ndone1=1
endif
! See if it's time to start second stage of processing
! if(ns.ge.nt2 .and. ndone2.eq.0) then
if(ns.ge.nt2) then
kk=k
ndone2=1
nlost=lost_tot ! Save stats for printout
if(ns.ge.nt2) then
kk=k
nlost=lost_tot ! Save stats for printout
endif
endif
! if(ns.le.5 .or. ns.ge.46) write(*,3001) ns,ndone1,ndone2,kb, &
! kbuf,nreset,kk,tdiff
!3001 format(6i4,i12,f8.2)
tt=npkt*174.0/96000.0
! if(ns.le.5 .or. ns.ge.46) write(*,3001) ns,ndone1,kb, &
! kbuf,ntx,kk,tdiff,tt
!3001 format(5i4,i11,2f8.2)
endif
first=.false.
go to 10
end subroutine recvpkt

View File

@ -14,13 +14,6 @@ subroutine symspec(id,kbuf,kk,kkdone,nutc,newdat)
kkk=kk
if(kbuf.eq.2) kkk=kk-5760000
! if(ndebug.gt.0) write(*,4001) 'A',nutc,mod(int(sec_midn()),60), &
! kbuf,kk,kkk,kkdone
!4001 format(a1,i5.4,2i3,3i9,i5)
if(ndebug.eq.2) write(29,3001) nutc,mod(int(sec_midn()),60), &
kbuf,kk,kkdone,ndecoding,newdat,n
3001 format('s1:',i5.4,i3.2,i5,2i10,2i3,i5)
fac=0.0002
hsym=2048.d0*96000.d0/11025.d0 !Samples per half symbol
npts=hsym !Integral samples per half symbol
@ -117,11 +110,6 @@ subroutine symspec(id,kbuf,kk,kkdone,nutc,newdat)
998 kkdone=i1-1
999 continue
! if(ndebug.gt.0) write(*,4001) 'B',nutc,mod(int(sec_midn()),60), &
! kbuf,kk,kkk,kkdone,n
if(ndebug.eq.2) write(29,3002) nutc,mod(int(sec_midn()),60), &
kbuf,kk,kkdone,ndecoding,newdat,n
3002 format('s2:',i5.4,i3.2,i5,2i10,2i3,i5)
return
end subroutine symspec