Some code cleanup.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8225 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2017-11-08 14:37:51 +00:00
parent c88c485325
commit 91518ffd19
2 changed files with 53 additions and 29 deletions

View File

@ -1,9 +1,9 @@
module dxped_fox
parameter (MAXSIG=5,NSEQ=10)
parameter (MAXSIG=5,NSEQ=10,NCALLS=268)
character*6 cx(MAXSIG)
character*4 gx(MAXSIG)
character*6 cx(MAXSIG),xcall(NCALLS)
character*4 gx(MAXSIG),xgrid(NCALLS)
character*6 called(MAXSIG)
character*6 acknowledged(MAXSIG)
character*6 MyCall
@ -11,8 +11,11 @@ module dxped_fox
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
@ -39,11 +42,16 @@ contains
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)
call random_number(x)
irpt=-20+int(40*x)
write(txmsg(j),1004) cx(j),mycall,irpt
! 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
@ -54,11 +62,17 @@ contains
endif
if(js.eq.2) then
read(10,1002,end=3,err=999) cy,gy !Grab next call from FIFO
call random_number(x)
irpt=-20+int(40*x)
isent(j)=irpt
write(txmsg(j),1006) cx(j),cy,irpt
! 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)
@ -67,7 +81,7 @@ contains
cx(j)=cy
gx(j)=gy
called(j)=cy
isent(j)=irpt
isent(j)=irpt(j)
istate(2,j)=1
go to 4
3 write(txmsg(j),1006) cx(j),'DE '
@ -84,14 +98,14 @@ contains
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
! 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 ***'
!999 stop '*** ERROR ***'
end subroutine fox_tx
subroutine fox_rx(iseq,rxmsg)

View File

@ -1,12 +1,13 @@
program driver
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)
open(10,file='xcall.txt',status='old')
ntot=0
irate=0
MyCall='KH1DX'
@ -26,11 +27,21 @@ program driver
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
rewind 10
nc=0
nsig=ii
! Start with all istate = 0
istate=0
@ -43,21 +54,20 @@ program driver
nrx=0
do j=1,nsig
if(ichar(cx(j)(1:1)).ne.0) then
call random_number(x)
irpt=-20+int(40*x)
write(rxmsg,1000) MyCall,cx(j),irpt
1000 format(a6,1x,a6,' R',i3.2)
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
read(10,1002) cxx,gxx
1002 format(a6,7x,a4)
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) rewind 10
if(iseq.eq.1) nc=0
endif
enddo
ntot(ii)=nlogged
@ -70,4 +80,4 @@ program driver
1100 format(f5.1,5i6,5x,5i6)
enddo
end program driver
end program dxped_sim