SVN r8748

This commit is contained in:
Jordan Sherer
2018-06-14 21:27:34 -04:00
parent 419c039d08
commit 4f1fe4fc94
581 changed files with 69338 additions and 39836 deletions
@@ -0,0 +1,109 @@
program wsprcpmsim
! Generate simulated data for a 2-minute "WSPR-LF" mode. Output is saved
! to a *.c2 or *.wav file.
use wavhdr
include 'wsprcpm_params.f90' !Set various constants
parameter (NMAX=120*12000)
type(hdr) hwav !Header for .wav file
character arg*12,fname*16
character msg*22,msgsent*22
complex c0(0:NMAX/NDOWN-1)
complex c(0:NMAX/NDOWN-1)
real*8 fMHz
integer itone(NN)
integer*2 iwave(NMAX) !Generated full-length waveform
! Get command-line argument(s)
nargs=iargc()
if(nargs.ne.8) then
print*,'Usage: wsprmsksim "message" f0 DT fsp del nwav nfiles snr'
print*,'Example: wsprmsksim "K1ABC FN42 30" 50 0.0 0.1 1.0 1 10 -33'
go to 999
endif
call getarg(1,msg) !Message to be transmitted
call getarg(2,arg)
read(arg,*) f0 !Freq relative to WSPR-band center (Hz)
call getarg(3,arg)
read(arg,*) xdt !Time offset from nominal (s)
call getarg(4,arg)
read(arg,*) fspread !Watterson frequency spread (Hz)
call getarg(5,arg)
read(arg,*) delay !Watterson delay (ms)
call getarg(6,arg)
read(arg,*) nwav !1 for *.wav file, 0 for *.c2 file
call getarg(7,arg)
read(arg,*) nfiles !Number of files
call getarg(8,arg)
read(arg,*) snrdb !SNR_2500
twopi=8.0*atan(1.0)
fs=12000.0/NDOWN !
dt=1.0/fs !Sample interval (s)
tt=NSPS*dt !Duration of "itone" symbols (s)
baud=1.0/tt !Keying rate for "itone" symbols (baud)
txt=NZ*dt !Transmission length (s)
bandwidth_ratio=2500.0/(fs/2.0)
sig=sqrt(bandwidth_ratio) * 10.0**(0.05*snrdb)
if(snrdb.gt.90.0) sig=1.0
txt=NN*NSPS0/12000.0
call genwsprcpm(msg,msgsent,itone) !Encode the message, get itone
write(*,1000) f0,xdt,txt,snrdb,fspread,delay,nfiles,msgsent
1000 format('f0:',f9.3,' DT:',f6.2,' txt:',f6.1,' SNR:',f6.1, &
' fspread:',f6.1,' delay:',f6.1,' nfiles:',i3,2x,a22)
h=1.00
c0=0.
k=-1 + nint(xdt/dt)
do j=1,NN
dp=twopi*(f0+itone(j)*(h/2.0)*baud)*dt
do i=1,NSPS
k=k+1
phi=mod(phi+dp,twopi)
if(k.ge.0 .and. k.lt.NMAX/NDOWN) c0(k)=cmplx(cos(phi),sin(phi))
enddo
enddo
call sgran()
do ifile=1,nfiles
c=c0
if(nwav.eq.0) then
if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then
call watterson(c,NMAX/NDOWN,fs,delay,fspread)
endif
!do i=0,NMAX/NDOWN-1
!write(23,*) i,real(c(i)),imag(c(i))
!enddo
c=c*sig
if(snrdb.lt.90) then
do i=0,NMAX/NDOWN-1 !Add gaussian noise at specified SNR
xnoise=gran()
ynoise=gran()
c(i)=c(i) + cmplx(xnoise,ynoise)
enddo
endif
write(fname,1100) ifile
1100 format('000000_',i4.4,'.c2')
open(10,file=fname,status='unknown',access='stream')
fMHz=10.1387d0
nmin=2
write(10) fname,nmin,fMHz,c !Save to *.c2 file
close(10)
!do i=0,NMAX/NDOWN-1
!write(57,*) i,real(c(i)),imag(c(i))
!enddo
else
call wsprcpm_wav(baud,xdt,h,f0,itone,snrdb,iwave)
hwav=default_header(12000,NMAX)
write(fname,1102) ifile
1102 format('000000_',i4.4,'.wav')
open(10,file=fname,status='unknown',access='stream')
write(10) hwav,iwave !Save to *.wav file
close(10)
endif
write(*,1110) ifile,xdt,f0,snrdb,fname
1110 format(i4,f7.2,f8.2,f7.1,2x,a16)
enddo
999 end program wsprcpmsim
@@ -1,99 +0,0 @@
<HTML><HEAD>
<TITLE> Detailed Decoding Trace Information </TITLE>
</HEAD><BODY>
<H1> Detailed Decoding Trace Information </H1>
The <B>-T</B> option to <A HREF="decoding.html#decode"><TT>decode</TT></A>
causes a detailed trace of information on the process of decoding to
be written to standard output, in a multi-column format, with the first
line containing the headers for each column. This format is suitable
for reading into S-Plus or R.
The first column is always the number of the block being decoded;
several lines may be output for each block. The other columns vary
with the decoding method used, as described below.
<H2>Enum-bit and Enum-block decoding methods</H2>
For source messages with <I>K</I> bits, 2<SUP><I>K</I></SUP> lines are output
for each block, containing the following information:
<BLOCKQUOTE>
<TABLE>
<tr align="left" valign="top">
<td> <B>block</B> </td>
<td>The number of the block, from zero</td></tr>
<tr align="left" valign="top">
<td> <B>decoding</B> </td>
<td>A possible decoding for the message bits, expressed as a hexadecimal
number. The other bits are determined by the message bits.</td></tr>
<tr align="left" valign="top">
<td> <B>likelihood</B> </td>
<td>The likelihood for this decoding (ie, the probability of obtaining
the data received if this was the message sent).</td></tr>
</TABLE>
</BLOCKQUOTE>
For these methods, the number of "iterations" (output with the
<B>-t</B> option) is always 2<SUP><I>K</I></SUP>.
<H2>Prprp decoding method</H2>
Each block results in one line of output for the initial state (based
on individual likelihood ratios), and one line for each subsequent
iteration, containing the following information:
<BLOCKQUOTE>
<TABLE>
<tr align="left" valign="top">
<td> <B>block</B> </td>
<td>The number of the block, from zero</td></tr>
<tr align="left" valign="top">
<td> <B>iter</B> </td>
<td>The number of an iteration, zero for the initial state.</td></tr>
<tr align="left" valign="top">
<td> <B>changed</B> </td>
<td>The number of bits in the decoding that differ from the bit that would
be chosen based just on the likelihood ratio for that bit. Bits whose
likelihood ratios are exactly one contribute 0.5 to this
count. (Likelihood ratios of exactly one can arise when the output
of an AWGN channel rounds to exactly 0.00.)</td></tr>
<tr align="left" valign="top">
<td> <B>perrs</B> </td>
<td>The number of parity check errors in the current tentative
decoding.</td></tr>
<tr align="left" valign="top">
<td> <B>loglik</B> </td>
<td>The log likelihood of the current tentative decoding.</td></tr>
<tr align="left" valign="top">
<td> <B>Eperrs</B> </td>
<td>The expected number of parity check errors in a decoding found
by randomly picking a value for each bit, independently, according
to the current bit probabilities.</td></tr>
<tr align="left" valign="top">
<td> <B>Eloglik</B> </td>
<td>The expected log likelihood of a decoding found by randomly picking
a value for each bit, independently, according to the current bit
probabilities.
</td></tr>
<tr align="left" valign="top">
<td> <B>entropy</B> </td>
<td>The entropy (in bits) of the distribution defined by the current bit
probablities, assumed to apply to bits independently.</td></tr>
</TABLE>
</BLOCKQUOTE>
The number of "iterations" (output with the <B>-t</B> option) is
the obvious count of probability propagation iterations. The
initial state does not count as an iteration.
<HR>
<A HREF="decoding.html">Back to decoding documentation</A><BR>
<A HREF="index.html">Back to index for LDPC software</A>
</BODY></HTML>