1. wspr_fsk8_sim.f90: Add Watterson channel model. Fading is applied only to .c4 files. 2. wspr_fsk8d.f90: Add the capability to read and process .c4 files.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7697 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2017-05-26 15:07:27 +00:00
parent a5054c7d5d
commit c001d11c57
2 changed files with 76 additions and 20 deletions

View File

@ -8,14 +8,17 @@ program wspr_fsk8_sim
type(hdr) h !Header for .wav file
character arg*12,fname*16
character msg*22,msgsent*22
complex c0(0:NZ-1)
complex c(0:NZ-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.5) then
print*,'Usage: wspr_fsk8_sim "message" f0 DT nfiles snr'
print*,'Example: wspr_fsk8_sim "K1ABC FN42 30" 1640 0.0 10 -33'
if(nargs.ne.8) then
print*,'Usage: wspr5sim "message" f0 DT fsp del nwav nfiles snr'
print*,'Example: wspr5sim "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
@ -24,8 +27,14 @@ program wspr_fsk8_sim
call getarg(3,arg)
read(arg,*) xdt !Time offset from nominal (s)
call getarg(4,arg)
read(arg,*) nfiles !Number of files
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 *.c4 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)
@ -45,15 +54,53 @@ program wspr_fsk8_sim
1000 format('f0:',f9.3,' DT:',f6.2,' TxT:',f6.1,' SNR:',f6.1, &
' BW:',f4.1,2x,a22)
phi=0.0
c0=0.
k=-1 + nint(xdt/dt)
do j=1,NN !Generate OQPSK waveform from itone
dphi=twopi*(f0+itone(j)*baud)*dt
if(k.eq.0) phi=-dphi
do i=1,NSPS
k=k+1
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
xphi=phi
if(k.ge.0 .and. k.lt.NZ) c0(k)=cmplx(cos(xphi),sin(xphi))
enddo
enddo
if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then
call watterson(c0,NZ,fs,delay,fspread)
endif
c0=sig*c0 !Scale to requested sig level
do ifile=1,nfiles
call wspr_fsk8_wav(baud,xdt,f0,itone,snrdb,iwave)
h=default_header(12000,NMAX)
write(fname,1102) ifile
1102 format('000000_',i4.4,'.wav')
open(10,file=fname,status='unknown',access='stream')
write(10) h,iwave !Save to *.wav file
close(10)
write(*,1110) ifile,xdt,f0,snrdb,fname
if(nwav.eq.0) then
if( snrdb.lt.90) then
do i=0,NZ-1
xnoise=gran()
ynoise=gran()
c(i)=c0(i)+cmplx(xnoise,ynoise)
enddo
endif
write(fname,1100) ifile
1100 format('000000_',i4.4,'.c4')
open(10,file=fname,status='unknown',access='stream')
fMHz=1.866d0
nmin=4
write(10) fname,nmin,fMHz,c
else
call wspr_fsk8_wav(baud,xdt,f0,itone,snrdb,iwave)
h=default_header(12000,NMAX)
write(fname,1102) ifile
1102 format('000000_',i4.4,'.wav')
open(10,file=fname,status='unknown',access='stream')
write(10) h,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

View File

@ -15,7 +15,7 @@ program wspr_fsk8d
! Still to do: find and decode more than one signal in the specified passband.
include 'wspr_fsk8_params.f90'
character arg*8,message*22,cbits*50,infile*80,datetime*11
character arg*8,message*22,cbits*50,infile*80,fname*16,datetime*11
character*120 data_dir
complex csync(0:N7-1) !Sync symbols for Costas 7x7 array
complex c1(0:2*N7-1)
@ -81,14 +81,23 @@ program wspr_fsk8d
do ifile=7,nargs
call getarg(ifile,infile)
open(10,file=infile,status='old',access='stream')
read(10,end=999) ihdr,iwave
close(10)
j1=index(infile,'.c4')
j2=index(infile,'.wav')
read(infile(j2-4:j2-1),*) nutc
datetime=infile(j2-11:j2-1)
if(degrade.gt.0.0) call degrade_snr(iwave,NMAX,degrade,rxbw)
call wspr_fsk8_downsample(iwave,c)
if(j1.gt.0) then
read(10,end=999) fname,ntrmin,fMHz,c(0:NZ-1)
read(fname(8:11),*) nutc
write(datetime,'(i11)') nutc
else if(j2.gt.0) then
read(10,end=999) ihdr,iwave
read(infile(j2-4:j2-1),*) nutc
datetime=infile(j2-11:j2-1)
if(degrade.gt.0.0) call degrade_snr(iwave,NMAX,degrade,rxbw)
call wspr_fsk8_downsample(iwave,c)
else
print*,'Wrong file format?'
go to 999
endif
close(10)
pmax=0.
df1=fs/(2*N7)
ia=nint(100.0/df1)