mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-22 03:58:50 -04:00
Separate generation of SuperFox sync LO, and rationalize frequencies used in gen_sfox.f90 and hard_symbols.f90.
This commit is contained in:
parent
6310419a4d
commit
c24a0d3c72
@ -590,6 +590,7 @@ set (wsjt_FSRCS
|
||||
lib/superfox/gen_sfox.f90
|
||||
lib/superfox/sync_sf.f90
|
||||
lib/superfox/hard_symbols.f90
|
||||
lib/superfox/gen_sf_clo.f90
|
||||
lib/superfox/ran1.f90
|
||||
)
|
||||
|
||||
|
26
lib/superfox/gen_sf_clo.f90
Normal file
26
lib/superfox/gen_sf_clo.f90
Normal file
@ -0,0 +1,26 @@
|
||||
subroutine gen_sf_clo(fsample,syncwidth,clo)
|
||||
|
||||
! Generate complex LO for the SuperFox sync signal
|
||||
|
||||
use sfox_mod
|
||||
complex clo(NMAX) !Complex Local Oscillator
|
||||
complex w,wstep
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
tsync=NS*NSPS/fsample
|
||||
w=1.0
|
||||
a0=1500.0+ syncwidth/2.0 !Frequency at midpoint of LO waveform
|
||||
a2=2.0*syncwidth/tsync !Frequency drift rate
|
||||
x0=0.5*(nsync+1)
|
||||
s=2.0/nsync
|
||||
do i=1,nsync
|
||||
if(i.eq.nsync/2+1) a2=-a2 !Reverse sign of drift at midpoint
|
||||
x=s*(i-x0)
|
||||
dphi=(a0 + x*a2)*(twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
w=w*wstep
|
||||
clo(i)=conjg(w)
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine gen_sf_clo
|
@ -1,39 +1,22 @@
|
||||
subroutine gen_sfox(idat,f0,fsample,syncwidth,cdat,clo)
|
||||
subroutine gen_sfox(idat,f0,fsample,syncwidth,cdat)
|
||||
|
||||
use sfox_mod
|
||||
! include "sfox_params.f90"
|
||||
complex cdat(NMAX) !Generated complex waveform
|
||||
complex clo(NMAX) !Complex Local Oscillator
|
||||
complex w,wstep
|
||||
integer idat(ND)
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
tsync=NS*NSPS/fsample
|
||||
|
||||
! Generate complex LO for SuperFox sync
|
||||
w=1.0
|
||||
a0=1500.0+ syncwidth/2.0 !Frequency at midpoint of LO waveform
|
||||
a2=2.0*syncwidth/tsync !Frequency drift rate
|
||||
x0=0.5*(nsync+1)
|
||||
s=2.0/nsync
|
||||
do i=1,nsync
|
||||
if(i.eq.nsync/2+1) a2=-a2 !Reverse sign of drift at midpoint
|
||||
x=s*(i-x0)
|
||||
dphi=(a0 + x*a2)*(twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
w=w*wstep
|
||||
clo(i)=conjg(w)
|
||||
enddo
|
||||
|
||||
! Generate complex SuperFox waveform
|
||||
|
||||
df=fsample/NSPS
|
||||
w=1.0
|
||||
j=0
|
||||
k=0
|
||||
i0=NQ/2
|
||||
! First group of data symbols:
|
||||
do n=1,ND1
|
||||
k=k+1
|
||||
dphi=(f0 + (idat(k)-65)*df)*(twopi/fsample)
|
||||
dphi=(f0 + (idat(k)-i0)*df)*(twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
do i=1,NSPS
|
||||
j=j+1
|
||||
@ -45,6 +28,8 @@ subroutine gen_sfox(idat,f0,fsample,syncwidth,cdat,clo)
|
||||
! Sync waveform
|
||||
a1=f0 + syncwidth/2.0 !Frequency at midpoint of sync waveform
|
||||
a2=2.0*syncwidth/tsync !Frequency drift rate
|
||||
x0=0.5*(nsync+1)
|
||||
s=2.0/nsync
|
||||
do i=1,nsync
|
||||
j=j+1
|
||||
if(i.eq.nsync/2+1) a2=-a2 !Reverse sign of drift at midpoint
|
||||
@ -58,7 +43,7 @@ subroutine gen_sfox(idat,f0,fsample,syncwidth,cdat,clo)
|
||||
! Final group of data symbols:
|
||||
do n=1,ND2
|
||||
k=k+1
|
||||
dphi=(f0 + (idat(k)-65)*df)*(twopi/fsample)
|
||||
dphi=(f0 + (idat(k)-i0)*df)*(twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
do i=1,NSPS
|
||||
j=j+1
|
||||
|
@ -1,16 +1,16 @@
|
||||
subroutine hard_symbols(crcvd,f,t,jdat)
|
||||
subroutine hard_symbols(crcvd,f,t,chansym)
|
||||
|
||||
use sfox_mod
|
||||
! include "sfox_params.f90"
|
||||
complex crcvd(NMAX) !Signal as received
|
||||
complex c(0:NSPS-1) !Work array, one symbol long
|
||||
real s(0:NSPS-1) !Power spectrum
|
||||
integer jdat(NN) !Recovered hard-decision symbols
|
||||
real s(0:NQ-1) !Power spectrum
|
||||
integer chansym(NN) !Recovered hard-decision symbols
|
||||
integer ipk(1)
|
||||
|
||||
i0=nint(12000.0*t)
|
||||
df=12000.0/NSPS
|
||||
j0=nint(f/df)-128
|
||||
j0=nint(f/df)-NQ/2
|
||||
do n=1,ND !Loop over all symbols
|
||||
ib=n*NSPS + i0
|
||||
if(n.gt.ND1) ib=(NS+n)*NSPS + i0
|
||||
@ -18,8 +18,8 @@ subroutine hard_symbols(crcvd,f,t,jdat)
|
||||
if(ia.lt.1 .or. ib.gt.NMAX) cycle
|
||||
c=crcvd(ia:ib)
|
||||
call four2a(c,NSPS,1,-1,1) !Compute symbol spectrum
|
||||
do i=0,NSPS-1
|
||||
s(i)=real(c(i))**2 + aimag(c(i))**2
|
||||
do j=0,NQ-1
|
||||
s(j)=real(c(j0+j))**2 + aimag(c(j0+j))**2
|
||||
enddo
|
||||
|
||||
! Could we measure fspread, perhaps in the sync routine, and use that to
|
||||
@ -27,13 +27,8 @@ subroutine hard_symbols(crcvd,f,t,jdat)
|
||||
! call smo121(s,NSPS) !Helps for LD, HM propagation...
|
||||
! call smo121(s,NSPS)
|
||||
|
||||
ipk=maxloc(s)
|
||||
ipk(1)=ipk(1)-j0
|
||||
if(ipk(1).ge.64) then
|
||||
jdat(n)=ipk(1)-64
|
||||
else
|
||||
jdat(n)=ipk(1)+256-64
|
||||
endif
|
||||
ipk=maxloc(s(0:NQ-1))
|
||||
chansym(n)=ipk(1) - 1
|
||||
enddo
|
||||
|
||||
return
|
||||
|
@ -80,11 +80,15 @@ program sfoxtest
|
||||
h=default_header(12000,NMAX)
|
||||
idummy=0
|
||||
bandwidth_ratio=2500.0/6000.0
|
||||
fgood0=1.0
|
||||
|
||||
! Generate a message
|
||||
msg0=0
|
||||
do i=1,KK-2
|
||||
msg0(i)=i
|
||||
! msg0(i)=i-1
|
||||
msg0(i)=int(NQ*ran1(idummy))
|
||||
! msg0(i)=0
|
||||
! if(i.gt.ND1) msg0(i)=NQ-1
|
||||
enddo
|
||||
! Append a CRC here ...
|
||||
|
||||
@ -92,10 +96,12 @@ program sfoxtest
|
||||
call rs_encode_sf(msg0,parsym) !Compute parity symbols
|
||||
chansym0(1:kk)=msg0(1:kk)
|
||||
chansym0(kk+1:nn)=parsym(1:nn-kk)
|
||||
fgood0=1.0
|
||||
|
||||
! Generate cdat (SuperFox waveform) and clo (LO for sync detection)
|
||||
call gen_sfox(chansym0,f0,fsample,syncwidth,cdat,clo)
|
||||
! Generate clo, the LO for sync detection
|
||||
call gen_sf_clo(fsample,syncwidth,clo)
|
||||
|
||||
! Generate cdat, the SuperFox waveform
|
||||
call gen_sfox(chansym0,f0,fsample,syncwidth,cdat)
|
||||
|
||||
do isnr=0,-20,-1
|
||||
snr=isnr
|
||||
@ -154,6 +160,7 @@ program sfoxtest
|
||||
call twkfreq(crcvd,crcvd,NMAX,12000.0,a)
|
||||
f=1500.0
|
||||
call hard_symbols(crcvd,f,t,chansym) !Get hard symbol values
|
||||
|
||||
nera=0
|
||||
chansym=mod(chansym,nq) !Enforce 0 to nq-1
|
||||
nharderr=count(chansym.ne.chansym0) !Count hard errors
|
||||
|
Loading…
Reference in New Issue
Block a user