Bring ldpcsim40.f90 up to date and add coherent averaging option to both ldpcsim144 and ldpcsim40. These routines simulate only the performance of the code and the hash/CRC.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7580 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2017-02-26 20:14:51 +00:00
parent 9a895361cf
commit fa45380b51
2 changed files with 30 additions and 19 deletions

View File

@ -14,7 +14,7 @@ integer*1 i1hash(4)
integer*1 msgbits(80)
integer*4 i4Msg6BitWords(13)
integer ihash
real*8, allocatable :: lratio(:), rxdata(:)
real*8, allocatable :: lratio(:), rxdata(:), rxavgd(:)
real, allocatable :: yy(:), llr(:)
equivalence(ihash,i1hash)
@ -24,14 +24,14 @@ enddo
nargs=iargc()
if(nargs.ne.4) then
print*,'Usage: ldpcsim niter ndither #trials s '
print*,'Usage: ldpcsim niter navg #trials s '
print*,'eg: ldpcsim 10 1 1000 0.75'
return
endif
call getarg(1,arg)
read(arg,*) max_iterations
call getarg(2,arg)
read(arg,*) max_dither
read(arg,*) navg
call getarg(3,arg)
read(arg,*) ntrials
call getarg(4,arg)
@ -44,10 +44,10 @@ rate=real(K)/real(N)
write(*,*) "rate: ",rate
write(*,*) "niter= ",max_iterations," ndither= ",max_dither," s= ",s
write(*,*) "niter= ",max_iterations," navg= ",navg," s= ",s
allocate ( codeword(N), decoded(K), message(K) )
allocate ( lratio(N), rxdata(N), yy(N), llr(N) )
allocate ( lratio(N), rxdata(N), rxavgd(N), yy(N), llr(N) )
msg="K9AN K1JT EN50"
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
@ -95,11 +95,16 @@ do idb = -6, 14
nbadhash=0
do itrial=1, ntrials
call sgran()
rxavgd=0d0
do iav=1,navg
call sgran()
! Create a realization of a noisy received word
do i=1,N
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
do i=1,N
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
enddo
rxavgd=rxavgd+rxdata
enddo
rxdata=rxavgd
! Correct signal normalization is important for this decoder.
rxav=sum(rxdata)/N

View File

@ -7,39 +7,41 @@ use packjt
character*22 msg,msgsent,msgreceived
character*8 arg
integer*1, allocatable :: codeword(:), decoded(:), message(:)
real*8, allocatable :: lratio(:), rxdata(:)
real*8, allocatable :: rxdata(:), rxavgd(:)
real, allocatable :: llr(:)
integer ihash
integer*1 hardbits(32)
nargs=iargc()
if(nargs.ne.4) then
print*,'Usage: ldpcsim niter ndither #trials s '
print*,'Usage: ldpcsim niter navg #trials s '
print*,'eg: ldpcsim 10 1 1000 0.75'
return
endif
call getarg(1,arg)
read(arg,*) max_iterations
call getarg(2,arg)
read(arg,*) max_dither
read(arg,*) navg
call getarg(3,arg)
read(arg,*) ntrials
call getarg(4,arg)
read(arg,*) s
n=32
K=16
N=32
!rate=real(K)/real(N)
! don't count hash bits as data bits
rate=4.0/real(N)
write(*,*) "rate: ",rate
write(*,*) "niter= ",max_iterations," ndither= ",max_dither," s= ",s
write(*,*) "niter= ",max_iterations,"navg= ",navg," s= ",s
allocate ( codeword(N), decoded(K), message(K) )
allocate ( lratio(N), rxdata(N), llr(N) )
allocate ( rxdata(N), rxavgd(N), llr(N) )
msg="K1JT K9AN"
irpt=14
call fmtmsg(msg,iz)
call hash(msg,22,ihash)
irpt=14
ihash=iand(ihash,4095) !12-bit hash
ig=16*ihash + irpt !4-bit report
write(*,*) irpt,ihash,ig
@ -62,11 +64,16 @@ do idb = 0, 30
itsum=0
do itrial=1, ntrials
call sgran()
rxavgd=0d0
do iav=1,navg
call sgran()
! Create a realization of a noisy received word
do i=1,N
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
do i=1,N
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
enddo
rxavgd=rxavgd+rxdata
enddo
rxdata=rxavgd
! Correct signal normalization is important for this decoder.
rxav=sum(rxdata)/N
@ -80,7 +87,6 @@ do idb = 0, 30
endif
llr=2.0*rxdata/(ss*ss)
lratio=exp(llr)
call bpdecode40(llr, max_iterations, decoded, niterations)
! If the decoder finds a valid codeword, niterations will be .ge. 0.