Further work on code comparisons.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6452 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2016-01-31 16:11:50 +00:00
parent 5d6a502a87
commit 541168cb15

View File

@ -8,7 +8,7 @@ program JTMSKfer
use iso_c_binding, only: c_loc,c_size_t use iso_c_binding, only: c_loc,c_size_t
use hashing use hashing
use packjt use packjt
character msg*22,decoded*22,msgtype*13 character msg*22,decoded*22
integer*4 i4tone(234) !Channel symbols (values 0-1) integer*4 i4tone(234) !Channel symbols (values 0-1)
integer*1 e1(201) integer*1 e1(201)
integer*4 r1(201) integer*4 r1(201)
@ -18,7 +18,6 @@ program JTMSKfer
integer*1 i1hash(4) integer*1 i1hash(4)
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
character*72 c72 character*72 c72
! real*8 twopi,dt,f0,f1,f,phi,dphi
real xp(29) real xp(29)
equivalence (ihash,i1hash) equivalence (ihash,i1hash)
data xp/0.500000, 0.401241, 0.309897, 0.231832, 0.168095, & data xp/0.500000, 0.401241, 0.309897, 0.231832, 0.168095, &
@ -27,7 +26,6 @@ program JTMSKfer
0.002481, 0.001710, 0.001052, 0.000789, 0.000469, & 0.002481, 0.001710, 0.001052, 0.000789, 0.000469, &
0.000329, 0.000225, 0.000187, 0.000086, 0.000063, & 0.000329, 0.000225, 0.000187, 0.000086, 0.000063, &
0.000017, 0.000091, 0.000032, 0.000045/ 0.000017, 0.000091, 0.000032, 0.000045/
include 'testmsg.f90'
nmsg=1 nmsg=1
@ -50,79 +48,72 @@ program JTMSKfer
mettab(256-i,1)=mettab(i,0) mettab(256-i,1)=mettab(i,0)
enddo enddo
rdscale=2.0 ! empirically optiized rdscale=2.0 ! empirically optimized
ntrials=1000000 ntrials=1000000
rate=72.0/198.0 rate=72.0/198.0
msg="123" msg="123"
call fmtmsg(msg,iz) !To upper case, collapse multiple blanks
ichk=0
call genmsk(msg,ichk,decoded,i4tone,itype) !Encode message into tone #s
! Extract the data symbols, skipping over sync and parity bits
n1=35
n2=69
n3=94
r1(1:n1)=i4tone(11+1:11+n1)
r1(n1+1:n1+n2)=i4tone(23+n1+1:23+n1+n2)
r1(n1+n2+1:n1+n2+n3)=i4tone(35+n1+n2+1:35+n1+n2+n3)
! call sgran() ! call sgran()
do idb=0,10 do idb=0,11
db=idb/2.0-0.5 ! Eb/N0=1/(2*R*sigma^2), so sigma= sqrt( 1/(2*R*Eb/N0) ) db=idb/2.0-0.5 ! Eb/N0=1/(2*R*sigma^2), so sigma= sqrt( 1/(2*R*Eb/N0) )
sigma=1/sqrt( 2*rate*(10**(db/10.0)) ) sigma=1/sqrt( 2*rate*(10**(db/10.0)) )
call fmtmsg(msg,iz) !To upper case, collapse multiple blanks ngood=0 ! decoded = msg
ichk=0 ngoodhash=0 ! will include undetected errors plus actual good ones
call genmsk(msg,ichk,decoded,i4tone,itype) !Encode message into tone #s
msgtype=""
if(itype.eq.1) msgtype="Std Msg"
if(itype.eq.2) msgtype="Type 1 prefix"
if(itype.eq.3) msgtype="Type 1 suffix"
if(itype.eq.4) msgtype="Type 2 prefix"
if(itype.eq.5) msgtype="Type 2 suffix"
if(itype.eq.6) msgtype="Free text"
! Extract the data symbols, skipping over sync and parity bits do itrial=1,ntrials
n1=35 do i=1,n1+n2+n3
n2=69 tmp=( 2.0 * ( r1(i)-0.5 ) + sigma*gran() )*rdscale
n3=94 if( tmp .lt. 0 ) then
rd(i)=min(127.0,-tmp)
elseif( tmp .gt.0 ) then
rd(i)=max(-tmp,-127.0)
endif
enddo
r1(1:n1)=i4tone(11+1:11+n1) j=0
r1(n1+1:n1+n2)=i4tone(23+n1+1:23+n1+n2) do i=1,99
r1(n1+n2+1:n1+n2+n3)=i4tone(35+n1+n2+1:35+n1+n2+n3)
ngood=0 ! decoded = msg
ngoodhash=0 ! will include undetected errors plus actual good ones
do itrial=1,ntrials
do i=1,n1+n2+n3
tmp=( 2.0 * ( r1(i)-0.5 ) + sigma*gran() )*rdscale
if( tmp .lt. 0 ) then
rd(i)=min(127.0,-tmp)
elseif( tmp .gt.0 ) then
rd(i)=max(-tmp,-127.0)
endif
enddo
j=0
do i=1,99
j=j+1 j=j+1
e1(j)=rd(i) e1(j)=rd(i)
j=j+1 j=j+1
e1(j)=rd(i+99) e1(j)=rd(i+99)
enddo enddo
nb1=87 nb1=87
call vit213(e1,nb1,mettab,d8,metric) call vit213(e1,nb1,mettab,d8,metric)
igoodhash=0 igoodhash=0
ihash=nhash(c_loc(d8),int(9,c_size_t),146) ihash=nhash(c_loc(d8),int(9,c_size_t),146)
ihash=2*iand(ihash,32767) ihash=2*iand(ihash,32767)
decoded=" " decoded=" "
if(d8(10).eq.i1hash(2) .and. d8(11).eq.i1hash(1)) then if(d8(10).eq.i1hash(2) .and. d8(11).eq.i1hash(1)) then
igoodhash=1 igoodhash=1
write(c72,1012) d8(1:9) write(c72,1012) d8(1:9)
1012 format(9b8.8) 1012 format(9b8.8)
read(c72,1014) i4Msg6BitWords read(c72,1014) i4Msg6BitWords
1014 format(12b6.6) 1014 format(12b6.6)
call unpackmsg(i4Msg6BitWords,decoded) !Unpack to get msgsent call unpackmsg(i4Msg6BitWords,decoded) !Unpack to get msgsent
endif endif
if( igoodhash .eq. 1) ngoodhash=ngoodhash+1 if( igoodhash .eq. 1) ngoodhash=ngoodhash+1
if( decoded .eq. msg ) ngood=ngood+1 if( decoded .eq. msg ) ngood=ngood+1
enddo enddo
write(*,1023) db,sigma,ntrials,ngood,ngoodhash-ngood write(*,1023) db,sigma,ntrials,ngood,ngoodhash-ngood
1023 format("db:",f6.2," sigma:",f6.2," ntot:",i8," good:",i8," undet:",i8) 1023 format("db:",f6.2," sigma:",f6.2," ntot:",i8," good:",i8," undet:",i8)
enddo enddo
999 end program JTMSKfer end program JTMSKfer