mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-24 02:12:37 -04:00
Change wspr5d frequency dither to a search over a list of the top npeak peaks in squared-signal spectrum.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7699 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
e6150df623
commit
f8a673077b
@ -1,11 +1,9 @@
|
|||||||
subroutine getfc1w(c,fs,fa,fb,fc1,xsnr)
|
subroutine getfc1w(c,fs,fa,fb,fc1,xsnr)
|
||||||
|
|
||||||
include 'wsprlf_params.f90'
|
include 'wsprlf_params.f90'
|
||||||
|
|
||||||
complex c(0:NZ-1) !Complex waveform
|
complex c(0:NZ-1) !Complex waveform
|
||||||
complex c2(0:NFFT1-1) !Short spectra
|
complex c2(0:NFFT1-1) !Short spectra
|
||||||
real s(-NH1+1:NH1) !Coarse spectrum
|
real s(-NH1+1:NH1) !Coarse spectrum
|
||||||
|
|
||||||
nspec=NZ/NFFT1
|
nspec=NZ/NFFT1
|
||||||
df1=fs/NFFT1
|
df1=fs/NFFT1
|
||||||
s=0.
|
s=0.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
subroutine getfc2w(c,csync,fs,fc1,fc2,fc3)
|
subroutine getfc2w(c,csync,npeaks,fs,fc1,fpks)
|
||||||
|
|
||||||
include 'wsprlf_params.f90'
|
include 'wsprlf_params.f90'
|
||||||
|
|
||||||
@ -6,6 +6,8 @@ subroutine getfc2w(c,csync,fs,fc1,fc2,fc3)
|
|||||||
complex cs(0:NZ-1) !For computing spectrum
|
complex cs(0:NZ-1) !For computing spectrum
|
||||||
complex csync(0:NZ-1) !Sync symbols only, from cbb
|
complex csync(0:NZ-1) !Sync symbols only, from cbb
|
||||||
real a(5)
|
real a(5)
|
||||||
|
real freqs(413),sp2(413),fpks(npeaks)
|
||||||
|
integer pkloc(1)
|
||||||
|
|
||||||
df=fs/NZ
|
df=fs/NZ
|
||||||
baud=fs/NSPS
|
baud=fs/NSPS
|
||||||
@ -15,18 +17,28 @@ subroutine getfc2w(c,csync,fs,fc1,fc2,fc3)
|
|||||||
|
|
||||||
! Filter, square, then FFT to get refined carrier frequency fc2.
|
! Filter, square, then FFT to get refined carrier frequency fc2.
|
||||||
call four2a(cs,NZ,1,-1,1) !To freq domain
|
call four2a(cs,NZ,1,-1,1) !To freq domain
|
||||||
|
|
||||||
ia=nint(0.75*baud/df)
|
ia=nint(0.75*baud/df)
|
||||||
cs(ia:NZ-1-ia)=0. !Save only freqs around fc1
|
cs(ia:NZ-1-ia)=0. !Save only freqs around fc1
|
||||||
|
! do i=1,NZ/2
|
||||||
|
! filt=1/(1+((i*df)**2/(0.50*baud)**2)**8)
|
||||||
|
! cs(i)=cs(i)*filt
|
||||||
|
! cs(NZ+1-i)=cs(NZ+1-i)*filt
|
||||||
|
! enddo
|
||||||
call four2a(cs,NZ,1,1,1) !Back to time domain
|
call four2a(cs,NZ,1,1,1) !Back to time domain
|
||||||
cs=cs/NZ
|
cs=cs/NZ
|
||||||
|
!do i=0,NZ-1
|
||||||
|
!write(51,*) i,real(cs(i)),imag(cs(i))
|
||||||
|
!enddo
|
||||||
cs=cs*cs !Square the data
|
cs=cs*cs !Square the data
|
||||||
call four2a(cs,NZ,1,-1,1) !Compute squared spectrum
|
call four2a(cs,NZ,1,-1,1) !Compute squared spectrum
|
||||||
|
|
||||||
! Find two peaks separated by baud
|
! Find two peaks separated by baud
|
||||||
pmax=0.
|
pmax=0.
|
||||||
fc2=0.
|
fc2=0.
|
||||||
ic=nint(baud/df)
|
ja=nint(0.3*baud/df)
|
||||||
ja=nint(0.5*baud/df)
|
! ja=nint(0.5*baud/df)
|
||||||
|
k=1
|
||||||
do j=-ja,ja
|
do j=-ja,ja
|
||||||
f2=j*df
|
f2=j*df
|
||||||
ia=nint((f2-0.5*baud)/df)
|
ia=nint((f2-0.5*baud)/df)
|
||||||
@ -38,10 +50,25 @@ subroutine getfc2w(c,csync,fs,fc1,fc2,fc3)
|
|||||||
pmax=p
|
pmax=p
|
||||||
fc2=0.5*f2
|
fc2=0.5*f2
|
||||||
endif
|
endif
|
||||||
|
freqs(k)=0.5*f2
|
||||||
|
sp2(k)=p
|
||||||
|
k=k+1
|
||||||
! write(52,1200) f2,p,db(p)
|
! write(52,1200) f2,p,db(p)
|
||||||
!1200 format(f10.3,2f15.3)
|
!1200 format(f10.3,2f15.3)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
do i=1,npeaks
|
||||||
|
pkloc=maxloc(sp2)
|
||||||
|
ipk=pkloc(1)
|
||||||
|
fpks(i)=freqs(ipk)
|
||||||
|
ipk0=max(1,ipk-1)
|
||||||
|
ipk1=min(413,ipk+1)
|
||||||
|
! ipk0=ipk
|
||||||
|
! ipk1=ipk
|
||||||
|
sp2(ipk0:ipk1)=0.0
|
||||||
|
!write(*,*) i,fpks(i),fc2
|
||||||
|
enddo
|
||||||
|
|
||||||
a(1)=-fc1
|
a(1)=-fc1
|
||||||
a(2:5)=0.
|
a(2:5)=0.
|
||||||
call twkfreq1(c,NZ,fs,a,cs) !Mix down by fc1
|
call twkfreq1(c,NZ,fs,a,cs) !Mix down by fc1
|
||||||
|
@ -170,7 +170,7 @@ do idb = 20,-16,-1
|
|||||||
! max_iterations is max number of belief propagation iterations
|
! max_iterations is max number of belief propagation iterations
|
||||||
call bpdecode300(llr, apmask, max_iterations, decoded, niterations, cw)
|
call bpdecode300(llr, apmask, max_iterations, decoded, niterations, cw)
|
||||||
if( niterations .lt. 0 ) then
|
if( niterations .lt. 0 ) then
|
||||||
norder=4
|
norder=3
|
||||||
call osd300(llr, norder, decoded, niterations, cw)
|
call osd300(llr, norder, decoded, niterations, cw)
|
||||||
endif
|
endif
|
||||||
n2err=0
|
n2err=0
|
||||||
|
@ -30,6 +30,7 @@ program wspr5d
|
|||||||
real pp(2*NSPS) !Shaped pulse for OQPSK
|
real pp(2*NSPS) !Shaped pulse for OQPSK
|
||||||
real a(5) !For twkfreq1
|
real a(5) !For twkfreq1
|
||||||
real aa(20),bb(20) !Fitted polyco's
|
real aa(20),bb(20) !Fitted polyco's
|
||||||
|
real fpks(20)
|
||||||
integer id(NS+ND) !NRZ values (+/-1) for Sync and Data
|
integer id(NS+ND) !NRZ values (+/-1) for Sync and Data
|
||||||
integer ierror(NS+ND)
|
integer ierror(NS+ND)
|
||||||
integer isync(48) !Long sync vector
|
integer isync(48) !Long sync vector
|
||||||
@ -124,10 +125,10 @@ program wspr5d
|
|||||||
fa=102.0
|
fa=102.0
|
||||||
fb=150.0
|
fb=150.0
|
||||||
call getfc1w(c,fs,fa,fb,fc1,xsnr) !First approx for freq
|
call getfc1w(c,fs,fa,fb,fc1,xsnr) !First approx for freq
|
||||||
call getfc2w(c,csync,fs,fc1,fc2,fc3) !Refined freq
|
npeaks=20
|
||||||
|
call getfc2w(c,csync,npeaks,fs,fc1,fpks) !Refined freq
|
||||||
|
|
||||||
!NB: Measured performance is about equally good using fc2 or fc3 here:
|
a(1)=-fc1
|
||||||
a(1)=-(fc1+fc2)
|
|
||||||
a(2:5)=0.
|
a(2:5)=0.
|
||||||
call twkfreq1(c,NZ,fs,a,c) !Mix c down by fc1+fc2
|
call twkfreq1(c,NZ,fs,a,c) !Mix c down by fc1+fc2
|
||||||
|
|
||||||
@ -157,23 +158,19 @@ program wspr5d
|
|||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
xdt=jpk/fs
|
xdt=jpk/fs
|
||||||
|
xdt=1.0
|
||||||
|
jpk=fs*xdt
|
||||||
do i=0,NZ-1
|
do i=0,NZ-1
|
||||||
j=i+jpk
|
j=i+jpk
|
||||||
if(j.ge.0 .and. j.lt.NZ) c1(i)=c(j)
|
if(j.ge.0 .and. j.lt.NZ) c1(i)=c(j)
|
||||||
enddo
|
enddo
|
||||||
! print*,fc1,fc1+fc2,xdt,amax
|
|
||||||
!-----------------------------------------------------------------
|
|
||||||
|
|
||||||
nterms=maxn
|
nterms=maxn
|
||||||
! c1=c
|
do itry=1,npeaks
|
||||||
! do itry=1,1000
|
|
||||||
do itry=1,20
|
|
||||||
idf=itry/2
|
|
||||||
if(mod(itry,2).eq.0) idf=-idf
|
|
||||||
nhard0=0
|
nhard0=0
|
||||||
nhardsync0=0
|
nhardsync0=0
|
||||||
ifer=1
|
ifer=1
|
||||||
a(1)=idf*0.00085
|
a(1)=-fpks(itry)
|
||||||
a(2:5)=0.
|
a(2:5)=0.
|
||||||
call twkfreq1(c1,NZ,fs,a,c) !Mix c1 into c
|
call twkfreq1(c1,NZ,fs,a,c) !Mix c1 into c
|
||||||
call cpolyfitw(c,pp,id,maxn,aa,bb,zz,nhs)
|
call cpolyfitw(c,pp,id,maxn,aa,bb,zz,nhs)
|
||||||
@ -204,12 +201,13 @@ program wspr5d
|
|||||||
idat(7)=ishft(idat(7),6)
|
idat(7)=ishft(idat(7),6)
|
||||||
call wqdecode(idat,message,itype)
|
call wqdecode(idat,message,itype)
|
||||||
nsnr=nint(xsnr)
|
nsnr=nint(xsnr)
|
||||||
freq=fMHz + 1.d-6*(fc1+fc2)
|
! freq=fMHz + 1.d-6*(fc1+fc2)
|
||||||
|
freq=fMHz + 1.d-6*(fc1+fpks(itry))
|
||||||
nfdot=0
|
nfdot=0
|
||||||
write(13,1110) datetime,0,nsnr,xdt,freq,message,nfdot
|
write(13,1110) datetime,0,nsnr,xdt,freq,message,nfdot
|
||||||
1110 format(a11,2i4,f6.2,f12.7,2x,a22,i3)
|
1110 format(a11,2i4,f6.2,f12.7,2x,a22,i3)
|
||||||
write(*,1112) datetime(8:11),nsnr,xdt,freq,nfdot,message
|
write(*,1112) datetime(8:11),nsnr,xdt,freq,nfdot,message,itry
|
||||||
1112 format(a4,i4,f5.1,f11.6,i3,2x,a22)
|
1112 format(a4,i4,f5.1,f11.6,i3,2x,a22,i4)
|
||||||
endif
|
endif
|
||||||
enddo ! ifile loop
|
enddo ! ifile loop
|
||||||
write(*,1120)
|
write(*,1120)
|
||||||
|
@ -19,6 +19,7 @@ program wspr5d
|
|||||||
real rxdata(ND),llr(ND) !Soft symbols
|
real rxdata(ND),llr(ND) !Soft symbols
|
||||||
real pp(32) !Shaped pulse for OQPSK
|
real pp(32) !Shaped pulse for OQPSK
|
||||||
real ps(0:7),sbits(412)
|
real ps(0:7),sbits(412)
|
||||||
|
real fpks(20)
|
||||||
integer id(NS+ND) !NRZ values (+/-1) for Sync and Data
|
integer id(NS+ND) !NRZ values (+/-1) for Sync and Data
|
||||||
integer isync(48) !Long sync vector
|
integer isync(48) !Long sync vector
|
||||||
integer ib13(13) !Barker 13 code
|
integer ib13(13) !Barker 13 code
|
||||||
@ -114,12 +115,15 @@ program wspr5d
|
|||||||
fa=100.0
|
fa=100.0
|
||||||
fb=170.0
|
fb=170.0
|
||||||
call getfc1w(c,fs,fa,fb,fc1,xsnr) !First approx for freq
|
call getfc1w(c,fs,fa,fb,fc1,xsnr) !First approx for freq
|
||||||
call getfc2w(c,csync,fs,fc1,fc2,fc3) !Refined freq
|
! call getfc2w(c,csync,fs,fc1,fc2,fc3) !Refined freq
|
||||||
|
npeaks=5
|
||||||
|
call getfc2w(c,csync,npeaks,fs,fc1,fpks) !Refined freq
|
||||||
|
|
||||||
!write(*,*) fc1+fc2
|
!write(*,*) fc1+fc2
|
||||||
call downsample(c,fc1+fc2,cd)
|
do ipks=1,npeaks
|
||||||
|
call downsample(c,fc1+fpks(ipks),cd)
|
||||||
|
|
||||||
do ncoh=1,0,-1
|
do ncoh=1,1,-1
|
||||||
do is=0,9
|
do is=0,9
|
||||||
idt=is/2
|
idt=is/2
|
||||||
if( mod(is,2).eq. 1 ) idt=-is/2
|
if( mod(is,2).eq. 1 ) idt=-is/2
|
||||||
@ -178,12 +182,13 @@ program wspr5d
|
|||||||
nfdot=0
|
nfdot=0
|
||||||
write(13,1210) datetime,0,nsnr,xdt,freq,message,nfdot
|
write(13,1210) datetime,0,nsnr,xdt,freq,message,nfdot
|
||||||
1210 format(a11,2i4,f6.2,f12.7,2x,a22,i3)
|
1210 format(a11,2i4,f6.2,f12.7,2x,a22,i3)
|
||||||
write(*,1212) datetime(8:11),nsnr,xdt,freq,nfdot,message,'*'
|
write(*,1212) datetime(8:11),nsnr,xdt,freq,nfdot,message,'*',ipks
|
||||||
1212 format(a4,i4,f5.1,f11.6,i3,2x,a22,a1)
|
1212 format(a4,i4,f5.1,f11.6,i3,2x,a22,a1,i4)
|
||||||
goto 888
|
goto 888
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
enddo ! fpeaks loop
|
||||||
888 enddo
|
888 enddo
|
||||||
|
|
||||||
write(*,1120)
|
write(*,1120)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user