New versions of Fox test proigs.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8226 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2017-11-09 20:23:04 +00:00
parent 91518ffd19
commit abcf3706eb
6 changed files with 293 additions and 234 deletions

23
lib/dxped_fifo.f90 Normal file
View File

@ -0,0 +1,23 @@
subroutine dxped_fifo(cx,gx,isnrx)
parameter (NCALLS=268)
character*6 xcall(NCALLS)
character*4 xgrid(NCALLS)
integer isnr(NCALLS)
character cx*6,gx*4
common/dxpfifo/nc,isnr,xcall,xgrid
if(nc.lt.NCALLS) then
nc=nc+1
cx=xcall(nc)
gx=xgrid(nc)
isnrx=isnr(nc)
else
cx=' '
gx=' '
isnrx=0
endif
return
end subroutine dxped_fifo

View File

@ -1,151 +0,0 @@
module dxped_fox
parameter (MAXSIG=5,NSEQ=10,NCALLS=268)
character*6 cx(MAXSIG),xcall(NCALLS)
character*4 gx(MAXSIG),xgrid(NCALLS)
character*6 called(MAXSIG)
character*6 acknowledged(MAXSIG)
character*6 MyCall
character*4 MyGrid
integer nsig
integer isent(MAXSIG)
integer istate(2,MAXSIG)
integer isnr(NCALLS)
integer irpt(MAXSIG)
integer nlogged
integer nrx
integer nc
! istate
! 0 = Start QSO: call X (from FIFO) or CQ if FIFO is empty
! 1 = Sent report to X
! 2 = Received R+rpt from X
! 3 = Sent RR73 to X
! 4 = Logged -> Idle
contains
subroutine fox_tx(iseq)
character*32 txmsg(MAXSIG)
character*6 cy
character*4 gy
character*16 log
save txmsg
if(iseq.eq.0) nrx=nsig
do j=1,nsig
log=' '
js=istate(1,j)
if(js.eq.0) then
if(iseq.eq.0) then
txmsg(j)='CQ KH1DX AJ10'
else
! read(10,1002,end=1,err=999) cx(j),gx(j) !Grab next call from FIFO
!1002 format(a6,7x,a4)
nc=nc+1
if(nc.gt.NCALLS) go to 1
cx(j)=xcall(nc)
gx(j)=xgrid(NC)
! call random_number(x)
! irpt=-20+int(40*x)
irpt(j)=isnr(nc)
write(txmsg(j),1004) cx(j),mycall,irpt(j)
1004 format(a6,1x,a6,i4.2)
if(txmsg(j)(15:15).eq.' ') txmsg(j)(15:15)='+'
istate(1,j)=1
go to 2
1 txmsg(j)='CQ '//MyCall//' '//MyGrid//' '
2 continue
endif
endif
if(js.eq.2) then
! read(10,1002,end=3,err=999) cy,gy !Grab next call from FIFO
nc=nc+1
if(nc.gt.NCALLS) go to 3
cy=xcall(nc)
gy=xgrid(nc)
! call random_number(x)
! irpt=-20+int(40*x)
irpt(j)=isnr(nc)
isent(j)=irpt(j)
write(txmsg(j),1006) cx(j),cy,irpt(j)
1006 format(a6,' RR73; ',a6,1x,'<KH1DX>',i4.2)
if(txmsg(j)(29:29).eq.' ') txmsg(j)(29:29)='+'
write(log,1008) cx(j),gx(j),isent(j)
1008 format(a6,2x,a4,i4.2)
if(log(14:14).eq.' ') log(14:14)='+'
cx(j)=cy
gx(j)=gy
called(j)=cy
isent(j)=irpt(j)
istate(2,j)=1
go to 4
3 write(txmsg(j),1006) cx(j),'DE '
istate(2,j)=0
4 istate(1,j)=3
endif
! if(j.gt.nrx) print*,'a',nrx,j
! Encode txmsg, generate waveform, and transmit
if(log(1:1).ne.' ') then
nlogged=nlogged+1
nrate=0
if(iseq.gt.0) nrate=nint(nlogged*240.0/iseq)
write(*,1010) iseq,j,istate(1:2,j),txmsg(j),log,nlogged,nrate
1010 format(i4.4,i3,2i2,1x,a32,20x,a16,2i4)
else
! irpt=-20+int(40*x)
if(iseq.ge.2) write(txmsg(j),1004) cx(j),mycall,irpt(j)
write(*,1010) iseq,j,istate(1:2,j),txmsg(j)
endif
enddo
return
!999 stop '*** ERROR ***'
end subroutine fox_tx
subroutine fox_rx(iseq,rxmsg)
character*22 rxmsg
data iseq0/-1/
save iseq0,k
if(rxmsg(1:6).ne.MyCall) go to 900
if(iseq.lt.0) called=' '
nrx=nrx+1
if(iseq.ne.iseq0) k=0
iseq0=iseq
if(index(rxmsg,'R+').ge.8 .or. index(rxmsg,'R-').ge.8) then
j0=0
do j=1,nsig
if(rxmsg(8:13).eq.called(j)) j0=j
enddo
if(j0.ge.1) then
write(*,1000) iseq,j0,istate(1:2,j0),j0,rxmsg
1000 format(i4.4,i3,2i2,32x,i1,1x,a22)
istate(1,j0)=2
endif
go to 900
endif
if(k.le.nsig-1) then
k=k+1
called(k)=rxmsg(8:13)
write(*,1000) iseq,k,istate(1:2,k),j0,rxmsg
endif
! print*,'b',iseq,j0,k
900 return
end subroutine fox_rx
end module dxped_fox
!AA7UN KH1DX +19
!KH1DX AA7UN R+18
!AA7UN RR73; EA5YI <KH1DX> 16
!0004 AA7UN DN32 09
!0050 5 3 1 KA6A RR73; KB2M <KH1DX> -08 KA6A EM13 -08 86 413

View File

@ -1,83 +0,0 @@
program dxped_sim
! Simulates QSO exchanges using the proposed FT8 "DXpedition" mode.
use dxped_fox
character*22 rxmsg
character cxx*6,gxx*4
character*8 arg
integer ntot(5),irate(5)
ntot=0
irate=0
MyCall='KH1DX'
MyGrid='AJ10'
nargs=iargc()
ii1=1
ii2=5
jj1=0
jj2=5
if(nargs.eq.2) then
call getarg(1,arg)
read(arg,*) nsig
call getarg(2,arg)
read(arg,*) fail
ii1=nsig
ii2=nsig
jj1=nint(10*fail)
jj2=nint(10*fail)
endif
! Read a file with calls and grids; insert random S/N values.
open(10,file='xcall.txt',status='old')
do i=1,NCALLS
read(10,1000) xcall(i),xgrid(i)
1000 format(a6,7x,a4)
call random_number(x)
isnr(i)=-20+int(40*x)
enddo
close(10)
do jj=jj1,jj2
fail=0.1*jj
do ii=ii1,ii2
nc=0
nsig=ii
! Start with all istate = 0
istate=0
nlogged=0
! Open the file of callers (this will be a FIFO)
do iseq=0,80
if(iand(iseq,1).eq.0) call fox_tx(iseq)
if(iand(iseq,1).eq.1) then
nrx=0
do j=1,nsig
if(ichar(cx(j)(1:1)).ne.0) then
write(rxmsg,1001) MyCall,cx(j),isnr(j)
1001 format(a6,1x,a6,' R',i3.2)
if(rxmsg(16:16).eq.' ') rxmsg(16:16)='+'
endif
if(iseq.eq.1) then
nc=nc+1
cxx=xcall(nc)
gxx=xgrid(nc)
rxmsg='KH1DX '//cxx//' '//gxx
endif
call random_number(x)
if(x.ge.fail .and. cx(j)(1:1).ne.' ') call fox_rx(iseq,rxmsg)
enddo
if(iseq.eq.1) nc=0
endif
enddo
ntot(ii)=nlogged
irate(ii)=0
if(iseq.gt.0) irate(ii)=nint(nlogged*240.0/iseq)
write(*,3001) nsig,fail,nlogged
3001 format('Nsig:',i3,' Fail:',f4.1,' Logged QSOs:',i4)
enddo
write(13,1100) fail,ntot,irate
1100 format(f5.1,5i6,5x,5i6)
enddo
end program dxped_sim

62
lib/fox_rx.f90 Normal file
View File

@ -0,0 +1,62 @@
subroutine fox_rx(fail,called,fm,hm)
! Given fm, recently transmitted by Fox, determine hm -- the next
! message for Hound to transmit
parameter (MAXSIG=5,NCALLS=268)
character*6 xcall(NCALLS)
! character*8 mycall_plus
character*4 xgrid(NCALLS)
integer isnr(NCALLS)
character*32 fm
character*22 hm
character*6 cx,called,MyCall
character*4 gx
common/dxpfifo/nc,isnr,xcall,xgrid
data MyCall/'KH1DX'/
save
call random_number(r)
if(r.lt.fail) fm='' !Hound fails to copy
i1=index(fm,MyCall)
if(fm(1:3).eq.'CQ ' .and. i1.ge.4) then
call dxped_fifo(cx,gx,isnrx)
ntimes=1
write(hm,1000) MyCall,cx,gx
1000 format(a6,1x,a6,1x,a4)
endif
ia=index(fm,trim(cx))
ib=index(fm,';')
ic=index(fm,trim(called))
id=index(fm,'RR73;')
! print*,'rx a0 ',fm,' ',called,' ',cx,ia,ib,ic,id
if((ia.eq.1 .or. ic.eq.ib+2) .and. id.ge.4) then
i1=index(fm,';')+2
i2=index(fm,'<')-2
cx=fm(i1:i2)
! print*,'rx a2 ',fm,' ',called,' ',cx
write(hm,1004) MyCall,cx,isnrx
1004 format(a6,1x,a6,' R',i3.2)
if(hm(16:16).eq.' ') hm(16:16)='+'
endif
i1=index(fm,trim(called))
i2=index(fm,MyCall)
if(i1.eq.1 .and. i2.ge.5 .and. &
(index(fm,'+').ge.8 .or. index(fm,'-').ge.8)) then
write(hm,1004) MyCall,called,isnrx
if(hm(16:16).eq.' ') hm(16:16)='+'
endif
! Collapse multiple blanks in message
iz=len(trim(hm))
do iter=1,5
ib2=index(hm(1:iz),' ')
if(ib2.lt.1) exit
hm=hm(1:ib2)//hm(ib2+2:)
iz=iz-1
enddo
return
end subroutine fox_rx

126
lib/fox_sim.f90 Normal file
View File

@ -0,0 +1,126 @@
program fox_sim
! Simulates QSO exchanges using the proposed FT8 "DXpedition" mode.
parameter (MAXSIG=5,NCALLS=268)
character*6 xcall(NCALLS)
character*4 xgrid(NCALLS)
integer isnr(NCALLS)
character*32 fmsg(MAXSIG),fm
character*22 hmsg(MAXSIG),hm
character*16 log
character*6 called(MAXSIG)
character*4 gcalled(MAXSIG)
character*6 MyCall
character*4 MyGrid
character*8 arg
integer ntot(MAXSIG),irate(MAXSIG),ntimes(MAXSIG)
logical logit
common/dxpfifo/nc,isnr,xcall,xgrid
nargs=iargc()
if(nargs.ne.2 .and. nargs.ne.4) then
print*,'Usage: fox_sim nseq maxtimes'
print*,' fox_sim nseq maxtimes nsig fail'
go to 999
endif
ii1=1
ii2=5
jj1=0
jj2=5
nseq=80
if(nargs.ge.2) then
call getarg(1,arg)
read(arg,*) nseq
call getarg(2,arg)
read(arg,*) maxtimes
endif
if(nargs.eq.4) then
call getarg(3,arg)
read(arg,*) nsig
call getarg(4,arg)
read(arg,*) fail
ii1=nsig
ii2=nsig
jj1=nint(10*fail)
jj2=nint(10*fail)
endif
! Read a file with calls and grids; insert random S/N values.
! This is used in place of an operator-selected FIFO
open(10,file='xcall.txt',status='old')
do i=1,NCALLS
read(10,1000) xcall(i),xgrid(i)
1000 format(a6,7x,a4)
call random_number(x)
isnr(i)=-20+int(40*x)
enddo
close(10)
minutes=nseq/4
write(13,1002) nseq,minutes,maxtimes
1002 format(/'Nseq:',i4,' Minutes:',i3,' Maxtimes:',i2)
ntot=0
irate=0
MyCall='KH1DX'
MyGrid='AJ10'
do jj=jj1,jj2
fail=0.1*jj
do ii=ii1,ii2
nc=0 !Set FIFO pointer to top
ntimes=1
nsig=ii
nlogged=0
fmsg="CQ KH1DX AJ10"
hmsg=""
called=" "
do iseq=0,nseq
if(iand(iseq,1).eq.0) then
do j=1,nsig
fm=fmsg(j)
hm=hmsg(j)
call fox_tx(maxtimes,fail,called(j),gcalled(j),hm,fm, &
ntimes(j),log,logit)
fmsg(j)=fm
if(logit) then
nlogged=nlogged+1
nrate=0
if(iseq.gt.0) nrate=nint(nlogged*240.0/iseq)
write(*,1010) iseq,j,ntimes(j),fmsg(j),log,nlogged,nrate
1010 format(i4.4,2i2,1x,a32,20x,a16,2i4)
else
write(*,1010) iseq,j,ntimes(j),fmsg(j)
! write(fmsg(j),1004) cx(j),mycall,irpt(j)
! write(*,1010) iseq,j,istate(1:2,j),fmsg(j)
endif
! if(fm(1:3).eq.'2E0') print*,'tx a0',j,fm,called(j)
enddo
! call transmit
endif
if(iand(iseq,1).eq.1) then
do j=1,nsig
fm=fmsg(j)
! print*,'AA ',j,fm,called(j)
call fox_rx(fail,called(j),fm,hm)
hmsg(j)=hm
! print*,'BB ',j,fm,called(j),' ',hm
write(*,1020) iseq,j,hmsg(j)
1020 format(i4.4,i2,37x,a22)
enddo
endif
enddo
ntot(ii)=nlogged
irate(ii)=0
if(iseq.gt.0) irate(ii)=nint(nlogged*3600.0/(15*iseq))
write(*,3001) nsig,fail,nlogged
3001 format('Nsig:',i3,' Fail:',f4.1,' Logged QSOs:',i4)
enddo
write(13,1100) fail,ntot,irate
1100 format(f5.1,5i6,5x,5i6)
enddo
999 end program fox_sim

82
lib/fox_tx.f90 Normal file
View File

@ -0,0 +1,82 @@
subroutine fox_tx(maxtimes,fail,called,gcalled,hm,fm,ntimes,log,logit)
! Determine fm, the next message for Fox to transmit in this slot
character*32 fm
character*22 hm
character*4 g4,MyGrid,gcalled,gx,gy
character*6 MyCall,called,cx,cy
character*16 log
logical isgrid,logit
data MyCall/'KH1DX'/,MyGrid/'AJ10'/
save
isgrid(g4)=g4(1:1).ge.'A' .and. g4(1:1).le.'R' .and. g4(2:2).ge.'A' .and. &
g4(2:2).le.'R' .and. g4(3:3).ge.'0' .and. g4(3:3).le.'9' .and. &
g4(4:4).ge.'0' .and. g4(4:4).le.'9' .and. g4(1:4).ne.'RR73'
logit=.false.
call random_number(r)
if(r.lt.fail) hm=""
i2=len(trim(hm))
if(i2.gt.10) then
i1=index(hm,' ')
i3=index(hm(i1+1:),' ') + i1
cx=hm(i1+1:i3)
gx=hm(i2-3:i2)
i4=index(hm,MyCall)
! Check for a new caller
if(i4.eq.1 .and. isgrid(gx)) then
call random_number(r)
isent=nint(-20+40*r)
write(fm,1002) cx,MyCall,isent
1002 format(a6,1x,a6,i4.2)
if(fm(15:15).eq.' ') fm(15:15)='+'
called=cx
gcalled=gx
endif
log=''
! Check for message with R+rpt
if(i4.eq.1 .and. cx.eq.called .and. &
(index(hm,'R+').ge.8 .or. index(hm,'R-').ge.8)) then
write(log,1006) called,gcalled,isent !Format a log entry
1006 format(a6,2x,a4,i4.2)
if(log(14:14).eq.' ') log(14:14)='+'
logit=.true.
call dxped_fifo(cy,gy,isnry)
! If FIFO is empty we should call CQ in this slot
ntimes=1
write(fm,1008) cx,cy,isnry
1008 format(a6,' RR73; ',a6,1x,'<KH1DX>',i4.2)
if(fm(29:29).eq.' ') fm(29:29)='+'
called=cy
gcalled=gy
endif
endif
if(hm.eq.'') then
if(fm(1:3).ne.'CQ ') then
if(ntimes.lt.maxtimes) then
ntimes=ntimes+1
else
write(fm,1010) called,MyCall,isent
1010 format(a6,1x,a6,i4.2)
if(fm(15:15).eq.' ') fm(15:15)='+'
endif
endif
endif
! Collapse multiple blanks in message
iz=len(trim(fm))
do iter=1,5
ib2=index(fm(1:iz),' ')
if(ib2.lt.1) exit
fm=fm(1:ib2)//fm(ib2+2:)
iz=iz-1
enddo
! Generate waveform for fm
return
end subroutine fox_tx