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