mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 12:23:37 -05:00
Finish writing a usable version of program qra64code.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7328 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
120b2ea151
commit
5e90bd6d42
@ -2,56 +2,32 @@ program QRA64code
|
||||
|
||||
! Provides examples of message packing, bit and symbol ordering,
|
||||
! QRA (63,12) encoding, and other necessary details of the QRA64
|
||||
! protocol. Also permits simple simulations to measure performance
|
||||
! on an AWGN channel with secure time and frequency synchronization.
|
||||
|
||||
! Return codes from qra64_dec:
|
||||
! irc=0 [? ? ?] AP0 (decoding with no a-priori information)
|
||||
! irc=1 [CQ ? ?] AP27
|
||||
! irc=2 [CQ ? ] AP42
|
||||
! irc=3 [CALL ? ?] AP29
|
||||
! irc=4 [CALL ? ] AP44
|
||||
! irc=5 [CALL CALL ?] AP57
|
||||
! protocol.
|
||||
|
||||
use packjt
|
||||
character*22 msg,msg0,msg1,decoded,cok*3,msgtype*10,arg*12
|
||||
character*6 mycall
|
||||
logical ltext
|
||||
integer dgen(12),sent(63),dec(12)
|
||||
real s3(0:63,1:63)
|
||||
integer icos7(0:6)
|
||||
data icos7/2,5,6,0,4,1,3/ !Defines a 7x7 Costas array
|
||||
|
||||
include 'testmsg.f90'
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.lt.1) then
|
||||
print*,'Usage: qra64code "message" [snr2500] [Nrpt]'
|
||||
print*,' qra64code -t [snr2500]'
|
||||
print*,'Usage: qra64code "message"'
|
||||
print*,' qra64code -t'
|
||||
go to 999
|
||||
endif
|
||||
|
||||
call getarg(1,msg) !Get message from command line
|
||||
snr2500=10.0
|
||||
if(nargs.ge.2) then
|
||||
call getarg(2,arg)
|
||||
read(arg,*) snr2500
|
||||
endif
|
||||
sig=sqrt(2.0)*10.0**(0.05*(snr2500+29.7))
|
||||
nmsg=1
|
||||
nrpt=1
|
||||
if(msg(1:2).eq."-t") then
|
||||
nmsg=NTEST
|
||||
else
|
||||
if(nargs.ge.3) then
|
||||
call getarg(3,arg)
|
||||
read(arg,*) nrpt
|
||||
endif
|
||||
endif
|
||||
if(msg(1:2).eq."-t") nmsg=NTEST
|
||||
|
||||
write(*,1010)
|
||||
1010 format(" Message Decoded Err? Type rc"/77("-"))
|
||||
1010 format(" Message Decoded Err? Type"/74("-"))
|
||||
|
||||
ngood=0
|
||||
nbad=0
|
||||
do nn=1,nrpt
|
||||
do imsg=1,nmsg
|
||||
if(nmsg.gt.1) msg=testmsg(imsg)
|
||||
call fmtmsg(msg,iz) !To upper, collapse mult blanks
|
||||
@ -69,59 +45,22 @@ program QRA64code
|
||||
|
||||
call qra64_enc(dgen,sent) !Encode using QRA64
|
||||
|
||||
! Generate a simulated s3() array with moderately high S/N
|
||||
do j=1,63
|
||||
do i=0,63
|
||||
x=gran()
|
||||
y=gran()
|
||||
s3(i,j)=x*x + y*y
|
||||
enddo
|
||||
k=sent(j)
|
||||
x=gran() + sig
|
||||
y=gran()
|
||||
s3(k,j)=x*x + y*y
|
||||
enddo
|
||||
|
||||
i1=index(msg1,' ')
|
||||
mycall=' '
|
||||
if(i1.ge.4) mycall=msg(1:i1-1)
|
||||
call packcall(mycall,nmycall,ltext)
|
||||
call qra64_dec(s3,nmycall,dec,snr,irc) !Decode
|
||||
|
||||
decoded=" "
|
||||
if(irc.ge.0) then
|
||||
call unpackmsg(dec,decoded) !Unpack the user message
|
||||
call unpackmsg(dgen,decoded) !Unpack the user message
|
||||
call fmtmsg(decoded,iz)
|
||||
else
|
||||
dec=0
|
||||
endif
|
||||
|
||||
if(decoded.eq.msg0) then
|
||||
ngood=ngood+1
|
||||
else
|
||||
if(irc.ge.0) nbad=nbad+1
|
||||
endif
|
||||
ii=imsg
|
||||
if(nrpt.gt.1) ii=nn
|
||||
write(*,1020) ii,msg0,decoded,itype,msgtype,irc
|
||||
1020 format(i4,1x,a22,2x,a22,4x,i3,": ",a13,i3)
|
||||
write(*,1020) ii,msg0,decoded,itype,msgtype
|
||||
1020 format(i4,1x,a22,2x,a22,4x,i3,": ",a13)
|
||||
enddo
|
||||
|
||||
if(nmsg.eq.1 .and.nrpt.eq.1) then
|
||||
if(nmsg.eq.1) then
|
||||
write(*,1030) dgen
|
||||
1030 format(/'Packed message, 6-bit symbols ',12i3) !Display packed symbols
|
||||
1030 format(/'Packed message, 6-bit symbols: ',12i3) !Display packed symbols
|
||||
|
||||
write(*,1040) sent
|
||||
1040 format(/'Information-carrying channel symbols'/(i5,20i3))
|
||||
1040 format(/'Information-carrying channel symbols:'/(i5,29i3))
|
||||
|
||||
write(*,1050) dec
|
||||
1050 format(/'Received message, 6-bit symbols ',12i3) !Display packed symbols
|
||||
endif
|
||||
enddo
|
||||
|
||||
if(nrpt.gt.1) then
|
||||
write(*,1060) ngood,nrpt,nbad
|
||||
1060 format('Decoded messages:',i5,'/',i4,' Undetected errors:',i5)
|
||||
write(*,1050) 10*icos7,sent(1:32),10*icos7,sent(33:63),10*icos7
|
||||
1050 format(/'Channel symbols including sync:'/(i5,29i3))
|
||||
endif
|
||||
|
||||
999 end program QRA64code
|
||||
|
Loading…
Reference in New Issue
Block a user