2020-09-25 15:38:20 -04:00
|
|
|
program test_qra65
|
2020-08-06 14:23:39 -04:00
|
|
|
|
2020-09-26 16:49:06 -04:00
|
|
|
character*71 cmd1,cmd2,line
|
2020-08-06 14:23:39 -04:00
|
|
|
character*22 msg
|
|
|
|
character*8 arg
|
2020-10-03 08:25:17 -04:00
|
|
|
character*1 csubmode
|
2020-08-06 14:23:39 -04:00
|
|
|
integer nretcode(0:11)
|
|
|
|
logical decok
|
|
|
|
|
|
|
|
nargs=iargc()
|
2020-10-03 08:25:17 -04:00
|
|
|
if(nargs.ne.9) then
|
|
|
|
print*,'Usage: test_qra65 "msg" A-D depth freq DT fDop TRp nfiles SNR'
|
|
|
|
print*,'Example: test_qra65 "K1ABC W9XYZ EN37" A 3 1500 0.0 5.0 60 100 -20'
|
2020-08-06 14:23:39 -04:00
|
|
|
print*,' SNR = 0 to loop over all relevant SNRs'
|
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
call getarg(1,msg)
|
2020-10-03 08:25:17 -04:00
|
|
|
call getarg(2,csubmode)
|
2020-08-06 14:23:39 -04:00
|
|
|
call getarg(3,arg)
|
2020-10-03 08:25:17 -04:00
|
|
|
read(arg,*) ndepth
|
2020-08-06 14:23:39 -04:00
|
|
|
call getarg(4,arg)
|
2020-10-03 08:25:17 -04:00
|
|
|
read(arg,*) nf0
|
2020-08-06 14:23:39 -04:00
|
|
|
call getarg(5,arg)
|
2020-10-03 08:25:17 -04:00
|
|
|
read(arg,*) dt
|
2020-08-06 14:23:39 -04:00
|
|
|
call getarg(6,arg)
|
2020-10-03 08:25:17 -04:00
|
|
|
read(arg,*) fDop
|
2020-08-06 14:23:39 -04:00
|
|
|
call getarg(7,arg)
|
2020-10-03 08:25:17 -04:00
|
|
|
read(arg,*) ntrperiod
|
2020-09-26 16:49:06 -04:00
|
|
|
call getarg(8,arg)
|
2020-10-03 08:25:17 -04:00
|
|
|
read(arg,*) nfiles
|
|
|
|
call getarg(9,arg)
|
2020-08-06 14:23:39 -04:00
|
|
|
read(arg,*) nsnr
|
|
|
|
|
2020-09-26 16:49:06 -04:00
|
|
|
if(ntrperiod.eq.15) then
|
|
|
|
nsps=1800
|
|
|
|
i50=-21
|
|
|
|
else if(ntrperiod.eq.30) then
|
|
|
|
nsps=3600
|
|
|
|
i50=-24
|
|
|
|
else if(ntrperiod.eq.60) then
|
|
|
|
nsps=7680
|
|
|
|
i50=-28
|
|
|
|
else if(ntrperiod.eq.120) then
|
|
|
|
nsps=16000
|
|
|
|
i50=-31
|
|
|
|
else if(ntrperiod.eq.300) then
|
|
|
|
nsps=41472
|
|
|
|
i50=-35
|
|
|
|
else
|
|
|
|
stop 'Invalid TR period'
|
|
|
|
endif
|
|
|
|
ia=i50 + 8
|
|
|
|
ib=i50 - 5
|
|
|
|
if(nsnr.ne.0) then
|
|
|
|
ia=nsnr
|
|
|
|
ib=nsnr
|
|
|
|
endif
|
|
|
|
|
|
|
|
baud=12000.0/nsps
|
|
|
|
tsym=1.0/baud
|
|
|
|
|
|
|
|
! 1 2 3 4 5 6 7
|
|
|
|
! 12345678901234567890123456789012345678901234567890123456789012345678901'
|
|
|
|
cmd1='qra65sim "K1ABC W9XYZ EN37 " A 1500 5.0 0.0 60 100 -10 > junk0'
|
2020-10-03 08:25:17 -04:00
|
|
|
cmd2='jt9 -3 -p 15 -L 300 -H 3000 -d 3 -b A *.wav > junk'
|
2020-08-06 14:23:39 -04:00
|
|
|
|
|
|
|
write(cmd1(10:33),'(a)') '"'//msg//'"'
|
2020-10-03 08:25:17 -04:00
|
|
|
cmd1(35:35)=csubmode
|
2020-08-06 14:23:39 -04:00
|
|
|
write(cmd1(37:40),'(i4)') nf0
|
2020-09-26 16:49:06 -04:00
|
|
|
write(cmd1(41:45),'(f5.1)') fDop
|
2020-08-06 14:23:39 -04:00
|
|
|
write(cmd1(46:50),'(f5.2)') dt
|
2020-09-26 16:49:06 -04:00
|
|
|
write(cmd1(51:54),'(i4)') ntrperiod
|
|
|
|
write(cmd1(55:59),'(i5)') nfiles
|
|
|
|
write(cmd2(11:13),'(i3)') ntrperiod
|
|
|
|
write(cmd2(33:33),'(i1)') ndepth
|
2020-10-03 08:25:17 -04:00
|
|
|
cmd2(38:38)=csubmode
|
2020-08-06 14:23:39 -04:00
|
|
|
call system('rm -f *.wav')
|
|
|
|
|
|
|
|
write(*,1000) (j,j=0,11)
|
|
|
|
write(12,1000) (j,j=0,11)
|
2020-09-26 16:49:06 -04:00
|
|
|
1000 format(/'SNR d Dop Sync Dec1 DecN Bad',i6,11i4,' tdec dtavg dtrms'/97('-'))
|
|
|
|
|
2020-10-06 10:29:03 -04:00
|
|
|
dterr=tsym/4.0
|
|
|
|
nferr=max(1,nint(0.5*baud),nint(fdop/3.0))
|
|
|
|
ndecodes0=nfiles
|
2020-08-06 14:23:39 -04:00
|
|
|
|
|
|
|
do nsnr=ia,ib,-1
|
|
|
|
nsync=0
|
|
|
|
ndecodes=0
|
|
|
|
nfalse=0
|
|
|
|
nretcode=0
|
|
|
|
navg=0
|
2020-09-26 16:49:06 -04:00
|
|
|
write(cmd1(61:63),'(i3)') nsnr
|
2020-08-06 14:23:39 -04:00
|
|
|
call system(cmd1)
|
|
|
|
call sec0(0,tdec)
|
|
|
|
call system(cmd2)
|
|
|
|
call sec0(1,tdec)
|
|
|
|
open(10,file='junk',status='unknown')
|
|
|
|
n=0
|
|
|
|
do iline=1,9999
|
2020-09-26 16:49:06 -04:00
|
|
|
read(10,'(a71)',end=10) line
|
2020-10-06 10:29:03 -04:00
|
|
|
if(index(line,'<Decode').eq.1) cycle
|
2020-08-06 14:23:39 -04:00
|
|
|
read(line(11:20),*) xdt,nf
|
2020-10-06 10:29:03 -04:00
|
|
|
if(ntrperiod.ge.60) xdt=xdt-0.5 !### TEMPORARY ###
|
2020-08-06 14:23:39 -04:00
|
|
|
decok=index(line,'W9XYZ').gt.0
|
2020-10-06 10:29:03 -04:00
|
|
|
if((abs(xdt-dt).le.dterr .and. abs(nf-nf0).le.nferr) .or. decok) then
|
|
|
|
nsync=nsync+1
|
|
|
|
endif
|
|
|
|
irc=-1
|
|
|
|
if(line(23:23).ne.' ') read(line(60:),*) irc,iavg
|
|
|
|
if(irc.lt.0) cycle
|
2020-08-06 14:23:39 -04:00
|
|
|
if(decok) then
|
|
|
|
i=irc
|
|
|
|
if(i.le.11) then
|
|
|
|
ndecodes=ndecodes + 1
|
|
|
|
navg=navg + 1
|
|
|
|
else
|
|
|
|
i=mod(i,10)
|
|
|
|
navg=navg + 1
|
|
|
|
endif
|
|
|
|
nretcode(i)=nretcode(i) + 1
|
|
|
|
else
|
|
|
|
nfalse=nfalse + 1
|
|
|
|
print*,'False: ',line
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
10 close(10)
|
2020-09-26 16:49:06 -04:00
|
|
|
xdt_avg=0.
|
|
|
|
xdt_rms=0.
|
|
|
|
write(*,1100) nsnr,ndepth,fDop,nsync,ndecodes,navg,nfalse,nretcode, &
|
2020-10-06 10:29:03 -04:00
|
|
|
tdec/nfiles
|
2020-09-26 16:49:06 -04:00
|
|
|
write(12,1100) nsnr,ndepth,fDop,nsync,ndecodes,navg,nfalse,nretcode, &
|
2020-10-06 10:29:03 -04:00
|
|
|
tdec/nfiles
|
|
|
|
1100 format(i3,i2,f5.1,3i5,i4,i6,11i4,f6.2)
|
|
|
|
if(ndecodes.lt.nfiles/2 .and. ndecodes0.ge.nfiles/2) then
|
|
|
|
snr_thresh=nsnr + float(nfiles/2 - ndecodes)/(ndecodes0-ndecodes)
|
|
|
|
write(13,1200) ndepth,fdop,csubmode,snr_thresh
|
|
|
|
1200 format(i1,f6.1,2x,a1,f7.1)
|
|
|
|
flush(13)
|
|
|
|
endif
|
2020-08-08 09:14:12 -04:00
|
|
|
flush(6)
|
|
|
|
flush(12)
|
2020-10-06 10:29:03 -04:00
|
|
|
ndecodes0=ndecodes
|
|
|
|
enddo ! nsnr
|
2020-08-06 14:23:39 -04:00
|
|
|
|
2020-09-25 15:38:20 -04:00
|
|
|
999 end program test_qra65
|
2020-08-06 14:23:39 -04:00
|
|
|
|
|
|
|
include 'sec0.f90'
|
|
|
|
|