mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-23 18:02:29 -04:00
Revert to old-style sync scheme, using symbol length same as for data.
This commit is contained in:
parent
b1e2a54f91
commit
0c03b9fc00
@ -590,7 +590,6 @@ set (wsjt_FSRCS
|
||||
lib/superfox/sfox_gen.f90
|
||||
lib/superfox/sfox_sync.f90
|
||||
lib/superfox/sfox_demod.f90
|
||||
lib/superfox/sfox_clo.f90
|
||||
lib/superfox/sym_prob.f90
|
||||
lib/superfox/getpp3.f90
|
||||
lib/superfox/ftrsd3.f90
|
||||
|
@ -1,41 +0,0 @@
|
||||
subroutine sfox_clo(fsample,syncwidth,clo)
|
||||
|
||||
! Generate complex LO for the SuperFox sync signal
|
||||
|
||||
use sfox_mod
|
||||
complex clo(NSYNC) !Complex Local Oscillator
|
||||
complex w
|
||||
|
||||
w=1.0
|
||||
call sweep(1500.0,syncwidth,fsample,w,clo,nsync)
|
||||
clo=conjg(clo)
|
||||
|
||||
return
|
||||
end subroutine sfox_clo
|
||||
|
||||
subroutine sweep(f0,syncwidth,fsample,w,c,iz)
|
||||
|
||||
complex c(iz)
|
||||
complex w,wstep
|
||||
|
||||
twopi=8.0*atan(1.0)
|
||||
ttot=iz/fsample
|
||||
a0=f0 + syncwidth/2.0 !Frequency at midpoint of LO waveform
|
||||
a2=2.0*syncwidth/ttot !Frequency drift rate
|
||||
x0=0.5*(iz+1)
|
||||
s=2.0/iz
|
||||
do i=1,iz
|
||||
if(i.eq.iz/2+1) a2=-a2 !Reverse sign of drift at midpoint
|
||||
x=s*(i-x0)
|
||||
dphi=(a0 + x*a2)*(twopi/fsample)
|
||||
j=(i-1)/(4*1024)
|
||||
a0a=a0 + (j-2.5)*200.0
|
||||
a2a=a2*(1.0 + (j-2.5)/10.0)
|
||||
dphi=(a0a + x*a2a)*(twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
w=w*wstep
|
||||
c(i)=w
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine sweep
|
@ -1,8 +1,7 @@
|
||||
subroutine sfox_gen(idat,f0,fsample,syncwidth,cdat)
|
||||
subroutine sfox_gen(idat,f0,fsample,cdat)
|
||||
|
||||
use sfox_mod
|
||||
complex cdat(NMAX) !Generated complex waveform
|
||||
complex ctmp(NSYNC)
|
||||
complex w,wstep
|
||||
integer idat(NN)
|
||||
|
||||
@ -25,11 +24,18 @@ subroutine sfox_gen(idat,f0,fsample,syncwidth,cdat)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! Calculate and insert sync waveform
|
||||
call sweep(f0,syncwidth,fsample,w,ctmp,nsync)
|
||||
cdat(j:j+nsync-1)=ctmp
|
||||
j=j+nsync
|
||||
! Insert sync symbols
|
||||
do n=1,NS
|
||||
dphi=(f0 + (isync(n)-i0)*df)*(twopi/fsample)
|
||||
wstep=cmplx(cos(dphi),sin(dphi))
|
||||
do i=1,NSPS
|
||||
j=j+1
|
||||
w=w*wstep
|
||||
cdat(j)=w
|
||||
enddo
|
||||
enddo
|
||||
|
||||
|
||||
! Final group of data symbols:
|
||||
do n=1,ND2
|
||||
k=k+1
|
||||
|
@ -2,6 +2,7 @@ module sfox_mod
|
||||
|
||||
parameter (NMAX=15*12000) !Samples in iwave (180,000)
|
||||
integer MM,NQ,NN,KK,ND1,ND2,NFZ,NSPS,NS,NSYNC,NZ,NFFT,NFFT1
|
||||
integer isync(24)
|
||||
|
||||
contains
|
||||
subroutine sfox_init(mm0,nn0,kk0,itu,fspread,delay,fsample)
|
||||
|
@ -1,52 +1,58 @@
|
||||
subroutine sfox_sync(crcvd,clo,nv,f,t)
|
||||
subroutine sfox_sync(crcvd,nv,f,t)
|
||||
|
||||
use sfox_mod
|
||||
parameter (MMAX=150,JMAX=300)
|
||||
real s(-MMAX:MMAX,-JMAX:JMAX) !s(DT,dFreq)
|
||||
parameter (NFFT2=2048,NH=NFFT2/2)
|
||||
parameter (NSZ=562) !Number of 1/8-symbol steps
|
||||
complex clo(NMAX) !Complex Local Oscillator
|
||||
complex crcvd(NMAX) !Signal as received
|
||||
complex c(0:NFFT-1) !Work array
|
||||
integer ipk(2)
|
||||
character*1 line(-30:30),mark(0:5)
|
||||
data mark/' ','.','-','+','X','$'/
|
||||
complex c(0:NFFT2-1) !Work array
|
||||
real s(NH/2,NSZ)
|
||||
! character*1 line(-30:30),mark(0:5)
|
||||
! data mark/' ','.','-','+','X','$'/
|
||||
|
||||
s=0.
|
||||
df=12000.0/NFFT !0.366211 Hz
|
||||
lagstep=100
|
||||
i1=ND1*nsps
|
||||
do m=-MMAX,MMAX
|
||||
lag=lagstep*m
|
||||
c(0:nsync-1)=crcvd(i1+1+lag:i1+nsync+lag)*clo(1:nsync)
|
||||
c(nsync:)=0.
|
||||
call four2a(c,NFFT,1,-1,1)
|
||||
do j=-JMAX,JMAX
|
||||
k=j
|
||||
if(k.lt.0) k=k+NFFT
|
||||
s(m,j)=real(c(k))**2 + aimag(c(k))**2
|
||||
df=12000.0/NFFT2 !5.86 Hz
|
||||
istep=NH/8
|
||||
tstep=istep/12000.0 !0.0107 s
|
||||
ia=1-istep
|
||||
fac=1.0/NFFT2
|
||||
do j=1,NSZ
|
||||
ia=ia+istep
|
||||
ib=ia+NH-1
|
||||
c(0:NSPS-1)=fac*crcvd(ia:ib)
|
||||
c(NSPS:)=0.
|
||||
call four2a(c,NFFT2,1,-1,1)
|
||||
do i=1,NH/2
|
||||
s(i,j)=real(c(i))**2 + aimag(c(i))**2
|
||||
enddo
|
||||
enddo
|
||||
|
||||
s=s/maxval(s)
|
||||
ipk=maxloc(s)
|
||||
ipk(1)=ipk(1)-MMAX-1
|
||||
ipk(2)=ipk(2)-JMAX-1
|
||||
if(iand(nv,2).ne.0) then
|
||||
ma=max(-MMAX,ipk(1)-10)
|
||||
mb=min(MMAX,ipk(1)+10)
|
||||
ja=max(-JMAX,ipk(2)-30)
|
||||
jb=min(JMAX,ipk(2)+30)
|
||||
do m=ma,mb
|
||||
do j=ja,jb
|
||||
k=5.999*s(m,j)
|
||||
line(j-ipk(2))=mark(k)
|
||||
pmax=0.
|
||||
ntol=100
|
||||
iz=nint(ntol/df)
|
||||
i0=nint(1500.0/df)
|
||||
ipk=-999
|
||||
jpk=-999
|
||||
do j=1,NSZ-8*NS
|
||||
do i=-iz,iz
|
||||
p=0.
|
||||
do k=1,NS
|
||||
ii=i0+i+(2*(isync(k)-NQ/2))
|
||||
jj=j + 8*(k-1)
|
||||
p=p + s(ii,jj)
|
||||
enddo
|
||||
write(*,1300) m/120.0,line
|
||||
1300 format(f6.3,2x,61a1)
|
||||
if(p.gt.pmax) then
|
||||
pmax=p
|
||||
ipk=i
|
||||
jpk=j
|
||||
endif
|
||||
enddo
|
||||
endif
|
||||
t=ipk(1)*lagstep/12000.0
|
||||
dfreq=ipk(2)*df
|
||||
enddo
|
||||
|
||||
dfreq=ipk*df
|
||||
f=1500.0+dfreq
|
||||
t=(jpk-201)*128.0/12000.0
|
||||
! write(*,4001) ipk,jpk,pmax,dfreq,t
|
||||
!4001 format(2i8,3f10.3)
|
||||
|
||||
return
|
||||
end subroutine sfox_sync
|
||||
|
@ -13,7 +13,6 @@ program sfoxtest
|
||||
real*4 xnoise(NMAX) !Random noise
|
||||
real*4 dat(NMAX) !Generated real data
|
||||
complex cdat(NMAX) !Generated complex waveform
|
||||
complex clo(NMAX) !Complex Local Oscillator
|
||||
complex cnoise(NMAX) !Complex noise
|
||||
complex crcvd(NMAX) !Signal as received
|
||||
real a(3)
|
||||
@ -32,18 +31,17 @@ program sfoxtest
|
||||
character fname*17,arg*12,itu*2
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.11) then
|
||||
print*,'Usage: sfoxtest f0 DT ITU M N K sw v hs nfiles snr'
|
||||
print*,'Example: sfoxtest 1500 0.15 MM 8 74 44 100 0 F 10 -10'
|
||||
if(nargs.ne.10) then
|
||||
print*,'Usage: sfoxtest f0 DT ITU M N K v hs nfiles snr'
|
||||
print*,'Example: sfoxtest 1500 0.15 MM 8 74 44 0 F 10 -10'
|
||||
print*,' f0=0 means f0, DT will assume suitable random values'
|
||||
print*,' LQ: Low Latitude Quiet'
|
||||
print*,' MM: Mid Latitude Moderate'
|
||||
print*,' HD: High Latitude Disturbed'
|
||||
print*,' ... and similarly for LM LD MQ MD HQ HM'
|
||||
print*,' sw = width of Sync sweep, in Hz'
|
||||
print*,' v=1 for .wav files, 2 for verbose output, 3 for both'
|
||||
print*,' hs = T for hard-wired sync'
|
||||
print*,' snr=0 means loop over SNRs 0 to -25 dB'
|
||||
print*,' snr=0 means loop over SNRs'
|
||||
go to 999
|
||||
endif
|
||||
call getarg(1,arg)
|
||||
@ -58,14 +56,12 @@ program sfoxtest
|
||||
call getarg(6,arg)
|
||||
read(arg,*) kk0
|
||||
call getarg(7,arg)
|
||||
read(arg,*) syncwidth
|
||||
call getarg(8,arg)
|
||||
read(arg,*) nv
|
||||
call getarg(9,arg)
|
||||
call getarg(8,arg)
|
||||
hard_sync=arg(1:1).eq.'T'
|
||||
call getarg(10,arg)
|
||||
call getarg(9,arg)
|
||||
read(arg,*) nfiles
|
||||
call getarg(11,arg)
|
||||
call getarg(10,arg)
|
||||
read(arg,*) snrdb
|
||||
|
||||
call init_timer ('timer.out')
|
||||
@ -106,6 +102,11 @@ program sfoxtest
|
||||
bandwidth_ratio=2500.0/fsample
|
||||
fgood0=1.0
|
||||
|
||||
! Generate a sync pattern
|
||||
do i=1,NS
|
||||
isync(i)=NQ*ran1(idummy)
|
||||
enddo
|
||||
|
||||
! Generate a message
|
||||
msg0=0
|
||||
do i=1,KK
|
||||
@ -118,14 +119,9 @@ program sfoxtest
|
||||
chansym0(kk:nn-1)=parsym(1:nn-kk)
|
||||
! chansym0=NQ/2 !### TEMPORARY, for SNR calibration ###
|
||||
|
||||
! Generate clo, the LO for sync detection
|
||||
call timer('clo ',0)
|
||||
call sfox_clo(fsample,syncwidth,clo)
|
||||
call timer('clo ',1)
|
||||
|
||||
! Generate cdat, the SuperFox waveform
|
||||
call timer('gen ',0)
|
||||
call sfox_gen(chansym0,f0,fsample,syncwidth,cdat)
|
||||
call sfox_gen(chansym0,f0,fsample,cdat)
|
||||
call timer('gen ',1)
|
||||
isnr0=-8
|
||||
|
||||
@ -156,10 +152,10 @@ program sfoxtest
|
||||
|
||||
f1=f0
|
||||
if(f0.eq.0.0) then
|
||||
f1=1500.0 + 200.0*(ran1(idummy)-0.5)
|
||||
f1=1500.0 + 20.0*(ran1(idummy)-0.5)
|
||||
xdt=0.3*ran1(idummy)
|
||||
call timer('gen ',0)
|
||||
call sfox_gen(chansym0,f1,fsample,syncwidth,cdat)
|
||||
call sfox_gen(chansym0,f1,fsample,cdat)
|
||||
call timer('gen ',1)
|
||||
endif
|
||||
|
||||
@ -177,12 +173,12 @@ program sfoxtest
|
||||
if(snr.lt.90.0) iwave(1:NMAX)=nint(rms*dat(1:NMAX))
|
||||
|
||||
if(hard_sync) then
|
||||
f=f1
|
||||
t=xdt
|
||||
f=f1 ! + 5.0*(ran1(idummy)-0.5)
|
||||
t=xdt ! + 0.01*(ran1(idummy)-0.5)
|
||||
else
|
||||
! Find signal freq and DT
|
||||
call timer('sync ',0)
|
||||
call sfox_sync(crcvd,clo,nv,f,t)
|
||||
call sfox_sync(crcvd,nv,f,t)
|
||||
call timer('sync ',1)
|
||||
endif
|
||||
ferr=f-f1
|
||||
@ -195,6 +191,11 @@ program sfoxtest
|
||||
sqf=sqf + ferr*ferr
|
||||
endif
|
||||
|
||||
write(50,3050) ifile,ferr/baud,terr/tsym
|
||||
3050 format(i8,2f10.4)
|
||||
flush(50)
|
||||
! write(51) snr,f1,xdt,crcvd(1:76000)
|
||||
|
||||
a=0.
|
||||
a(1)=1500.0-f
|
||||
call timer('twkfreq ',0)
|
||||
@ -249,7 +250,7 @@ program sfoxtest
|
||||
endif
|
||||
fgood0=fgood
|
||||
if(snrdb.ne.0.0) exit
|
||||
if(fgood.eq.0.0) exit
|
||||
! if(fgood.eq.0.0) exit
|
||||
if(fgoodsync.lt.0.5) exit
|
||||
enddo ! isnr
|
||||
if(snrdb.eq.0.0) write(*,1320) threshold
|
||||
|
Loading…
x
Reference in New Issue
Block a user