mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-20 19:19:02 -04:00
Allow q65sim toi generate multiple signals.
This commit is contained in:
parent
37cd5b3ede
commit
6877a87fe4
@ -8,6 +8,7 @@ program q65sim
|
||||
type(hdr) h !Header for .wav file
|
||||
integer*2 iwave(NMAX) !Generated waveform
|
||||
integer itone(85) !Channel symbols (values 0-65)
|
||||
integer ntone(85,10) !Channel symbols for up to 10 messages
|
||||
integer y(63) !Codeword
|
||||
integer istart !averaging compatible start seconds
|
||||
integer imins !minutes for 15s period timestamp
|
||||
@ -18,18 +19,19 @@ program q65sim
|
||||
complex cspread(0:NMAX-1) !Complex amplitude for Rayleigh fading
|
||||
complex z
|
||||
real*8 f0,dt,twopi,phi,dphi,baud,fsample,freq
|
||||
character msg*37,fname*17,csubmode*1,arg*12
|
||||
character msgsent*37
|
||||
character fname*17,csubmode*1,arg*12,c2*2
|
||||
character*37 msg,msgsent,imsg(10)
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.10) then
|
||||
print*,'Usage: q65sim "msg" A-E freq fDop DT f1 Stp TRp Nfile SNR'
|
||||
print*,'Example: q65sim "K1ABC W9XYZ EN37" A 1500 0.0 0.0 0.0 1 60 1 -26'
|
||||
if(nargs.ne.11) then
|
||||
print*,'Usage: q65sim "msg" A-E freq fDop DT f1 Stp TRp Nsig Nfile SNR'
|
||||
print*,'Example: q65sim "K1ABC W9XYZ EN37" A 1500 0.0 0.0 0.0 1 60 1 1 -26'
|
||||
print*,'Example: q65sim "ST" A 1500 0.0 0.0 0.0 1 60 1 -26'
|
||||
print*,' fDop = Doppler spread'
|
||||
print*,' f1 = Drift or Doppler rate (Hz/min)'
|
||||
print*,' Stp = Step size (Hz)'
|
||||
print*,' Stp = 0 implies no Doppler tracking'
|
||||
print*,' Nsig = number of generated signals, 1 - 10'
|
||||
print*,' Creates filenames which increment to permit averaging in first period'
|
||||
print*,' If msg = ST program produces a single tone at freq'
|
||||
go to 999
|
||||
@ -50,8 +52,10 @@ program q65sim
|
||||
call getarg(8,arg)
|
||||
read(arg,*) ntrperiod
|
||||
call getarg(9,arg)
|
||||
read(arg,*) nfiles
|
||||
read(arg,*) nsig
|
||||
call getarg(10,arg)
|
||||
read(arg,*) nfiles
|
||||
call getarg(11,arg)
|
||||
read(arg,*) snrdb
|
||||
|
||||
if(ntrperiod.eq.15) then
|
||||
@ -79,22 +83,39 @@ program q65sim
|
||||
nsym=85 !Number of channel symbols
|
||||
mode65=2**(ichar(csubmode) - ichar('A'))
|
||||
|
||||
ichk=0
|
||||
call genq65(msg,ichk,msgsent,itone,i3,n3)
|
||||
|
||||
imsg(1)=msg
|
||||
if(nsig.ge.2) then
|
||||
i0=index(msg,' ')
|
||||
i0=i0 + index(msg(i0+1:),' ')-2
|
||||
do i=1,nsig
|
||||
c2=char(ichar('A')+i-1)//char(ichar('A')+i-1)
|
||||
imsg(i)=msg(1:i0-1)//c2//msg(i0+2:)
|
||||
enddo
|
||||
endif
|
||||
|
||||
j=0
|
||||
do i=1,85
|
||||
if(itone(i).gt.0) then
|
||||
j=j+1
|
||||
y(j)=itone(i)-1
|
||||
endif
|
||||
ichk=0
|
||||
do i=1,nsig
|
||||
msg=imsg(i)
|
||||
call genq65(msg,ichk,msgsent,itone,i3,n3)
|
||||
ntone(:,i)=itone
|
||||
enddo
|
||||
write(*,1001) y(1:13),y(1:13)
|
||||
|
||||
if(nsig.eq.1) then
|
||||
j=0
|
||||
do i=1,85
|
||||
if(itone(i).gt.0) then
|
||||
j=j+1
|
||||
y(j)=itone(i)-1
|
||||
endif
|
||||
enddo
|
||||
write(*,1001) y(1:13),y(1:13)
|
||||
1001 format('Generated message'/'6-bit: ',13i3/'binary: ',13b6.6)
|
||||
write(*,1002) y
|
||||
write(*,1002) y
|
||||
1002 format(/'Codeword:'/(20i3))
|
||||
write(*,1003) itone
|
||||
write(*,1003) itone
|
||||
1003 format(/'Channel symbols:'/(20i3))
|
||||
endif
|
||||
|
||||
baud=12000.d0/nsps !Keying rate (6.67 baud fot 15-s sequences)
|
||||
h=default_header(12000,npts)
|
||||
@ -116,43 +137,53 @@ program q65sim
|
||||
|
||||
open(10,file=trim(fname),access='stream',status='unknown')
|
||||
xnoise=0.
|
||||
cdat=0.
|
||||
if(snrdb.lt.90) then
|
||||
do i=1,npts
|
||||
xnoise(i)=gran() !Generate gaussian noise
|
||||
enddo
|
||||
endif
|
||||
cdat=0.
|
||||
|
||||
bandwidth_ratio=2500.0/6000.0
|
||||
sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*snrdb)
|
||||
if(snrdb.gt.90.0) sig=1.0
|
||||
write(*,1020) ifile,ntrperiod,f0,csubmode,snrdb,fspread,xdt,f1,nstp,trim(msgsent)
|
||||
1020 format(i4,i6,f7.1,2x,a1,2x,f5.1,1x,f6.2,2f6.1,i4,2x,a)
|
||||
phi=0.d0
|
||||
dphi=0.d0
|
||||
k=(xdt+0.5)*12000 !Start audio at t=xdt+0.5 s (TR=15 and 30 s)
|
||||
if(ntrperiod.ge.60) k=(xdt+1.0)*12000 !TR 60+ at t = xdt + 1.0 s
|
||||
isym0=-99
|
||||
do i=1,npts !Add this signal into cdat()
|
||||
isym=i/nsps + 1
|
||||
if(isym.gt.nsym) exit
|
||||
if(isym.ne.isym0) then
|
||||
freq_drift=f1*i*dt/60.0
|
||||
if(nstp.ne.0) freq_drift=freq_drift - nstp*nint(freq_drift/nstp)
|
||||
if (msg(1:2).eq.'ST') then
|
||||
freq = f0 + freq_drift
|
||||
else
|
||||
freq = f0 + freq_drift + itone(isym)*baud*mode65
|
||||
endif
|
||||
dphi=twopi*freq*dt
|
||||
isym0=isym
|
||||
1020 format(i4,i6,f7.1,2x,a1,2x,f5.1,1x,f6.2,2f6.1,i4,2x,a)
|
||||
|
||||
n=65.0*baud*mode65/100.0 + 0.9999
|
||||
nfstep=100*n
|
||||
nf1=1500 - nfstep*nsig/2
|
||||
do n=1,nsig
|
||||
if(nsig.ge.2) then
|
||||
f0=nf1 + (n-1)*nfstep
|
||||
itone=ntone(:,n)
|
||||
endif
|
||||
phi=phi + dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
xphi=phi
|
||||
z=cmplx(cos(xphi),sin(xphi))
|
||||
k=k+1
|
||||
if(k.ge.1) cdat(k)=cdat(k) + sig*z
|
||||
phi=0.d0
|
||||
dphi=0.d0
|
||||
k=(xdt+0.5)*12000 !Start audio at t=xdt+0.5 s (TR=15 and 30 s)
|
||||
if(ntrperiod.ge.60) k=(xdt+1.0)*12000 !TR 60+ at t = xdt + 1.0 s
|
||||
isym0=-99
|
||||
do i=1,npts !Add this signal into cdat()
|
||||
isym=i/nsps + 1
|
||||
if(isym.gt.nsym) exit
|
||||
if(isym.ne.isym0) then
|
||||
freq_drift=f1*i*dt/60.0
|
||||
if(nstp.ne.0) freq_drift=freq_drift - nstp*nint(freq_drift/nstp)
|
||||
if (msg(1:2).eq.'ST') then
|
||||
freq = f0 + freq_drift
|
||||
else
|
||||
freq = f0 + freq_drift + itone(isym)*baud*mode65
|
||||
endif
|
||||
dphi=twopi*freq*dt
|
||||
isym0=isym
|
||||
endif
|
||||
phi=phi + dphi
|
||||
if(phi.gt.twopi) phi=phi-twopi
|
||||
xphi=phi
|
||||
z=cmplx(cos(xphi),sin(xphi))
|
||||
k=k+1
|
||||
if(k.ge.1) cdat(k)=cdat(k) + sig*z
|
||||
enddo
|
||||
enddo
|
||||
|
||||
if(fspread.ne.0) then !Apply specified Doppler spread
|
||||
|
@ -35,7 +35,7 @@ program sumsim
|
||||
fac=1.0/nargs
|
||||
iwave(1:npts)=nint(fac*wave(1:npts))
|
||||
|
||||
open(12,file='000000_0000.wav',access='stream',status='unknown')
|
||||
open(12,file='000001_0000.wav',access='stream',status='unknown')
|
||||
write(12) h,iwave(1:npts)
|
||||
close(12)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user