mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
Program synctest now working well.
This commit is contained in:
parent
0e069f7f3b
commit
82693d032f
@ -1,13 +1,11 @@
|
||||
program synctest
|
||||
|
||||
use wideband2_sync
|
||||
use timer_module, only: timer
|
||||
use timer_impl, only: init_timer, fini_timer
|
||||
parameter (MAX0=1000,MAX_CANDIDATES=20)
|
||||
parameter (NFFT=32768)
|
||||
parameter (MAX_CANDIDATES=20)
|
||||
real ss(4,322,NFFT),savg(4,NFFT)
|
||||
real candidate(MAX_CANDIDATES,5) !snr1,f0,xdt0,ipol,flip
|
||||
integer indx(NFFT)
|
||||
logical skip
|
||||
character*8 arg
|
||||
|
||||
open(50,file='50.a',form='unformatted',status='old')
|
||||
@ -24,46 +22,20 @@ program synctest
|
||||
call timer('synctest',0)
|
||||
|
||||
print*,nutc,npol
|
||||
ntone_spacing=1
|
||||
call timer('wb_sync ',0)
|
||||
call wb2_sync(ss,savg,ntone_spacing)
|
||||
call timer('wb_sync ',1)
|
||||
nfa=23 !144.100
|
||||
nfb=83 !144.16
|
||||
nts_jt65=2 !JT65B tone spacing
|
||||
nts_q65=1 !Q65-60A tone spacing
|
||||
call get_candidates(ss,savg,nfa,nfb,nts_jt65,nts_q65,candidate,ncand)
|
||||
|
||||
df3=96000.0/NFFT
|
||||
ia=nint(7000.0/df3)
|
||||
ib=nint(89000.0/df3)
|
||||
iz=ib-ia+1
|
||||
do i=ia,ib
|
||||
f0=0.001*i*df3
|
||||
write(13,1000) f0,sync_dat(i,2:5)
|
||||
1000 format(3f10.3,2f5.0)
|
||||
enddo
|
||||
|
||||
call timer('indexx ',0)
|
||||
call indexx(sync_dat(ia:ib,2),iz,indx)
|
||||
call timer('indexx ',1)
|
||||
|
||||
k=0
|
||||
do i=1,MAX0
|
||||
j=indx(iz+1-i) + ia - 1
|
||||
f0=0.001*j*df3
|
||||
snr1=sync_dat(j,2)
|
||||
if(snr1.lt.3.0) exit
|
||||
skip=.false.
|
||||
do n=1,k
|
||||
diffhz=1000.0*(f0-candidate(n,2))
|
||||
if(diffhz.gt.-10.0 .and. diffhz.lt.108.0) skip=.true.
|
||||
enddo
|
||||
if(skip) cycle
|
||||
k=k+1
|
||||
candidate(k,1)=snr1 !snr1
|
||||
candidate(k,2)=f0 !f0
|
||||
candidate(k,3)=sync_dat(j,3) !xdt0
|
||||
candidate(k,4)=sync_dat(j,4) !ipol
|
||||
candidate(k,5)=sync_dat(j,5) !flip
|
||||
write(*,1010) k,candidate(k,1:5)
|
||||
1010 format(i3,3f10.3,2f6.0)
|
||||
if(k.ge.MAX_CANDIDATES) exit
|
||||
do k=1,ncand
|
||||
snr1=candidate(k,1)
|
||||
f0=candidate(k,2)
|
||||
xdt0=candidate(k,3)
|
||||
ipol=nint(candidate(k,4))
|
||||
iflip=nint(candidate(k,5))
|
||||
write(*,1010) k,snr1,f0,f0+77,xdt0,ipol,iflip
|
||||
1010 format(i3,4f10.3,2i3,f8.3)
|
||||
enddo
|
||||
|
||||
999 call timer('synctest',1)
|
||||
@ -71,3 +43,59 @@ program synctest
|
||||
call fini_timer()
|
||||
|
||||
end program synctest
|
||||
|
||||
subroutine get_candidates(ss,savg,nfa,nfb,nts_q65,nts_jt65,candidate,ncand)
|
||||
|
||||
use wideband2_sync
|
||||
use timer_module, only: timer
|
||||
parameter (MAX0=1000,MAX_CANDIDATES=20)
|
||||
real ss(4,322,NFFT),savg(4,NFFT)
|
||||
real candidate(MAX_CANDIDATES,5) !snr1,f0,xdt0,ipol,flip
|
||||
integer indx(NFFT)
|
||||
logical skip
|
||||
|
||||
call timer('wb_sync ',0)
|
||||
call wb2_sync(ss,savg,nfa,nfb)
|
||||
call timer('wb_sync ',1)
|
||||
|
||||
df3=96000.0/NFFT
|
||||
ia=nint(1000*nfa/df3)
|
||||
ib=nint(1000*nfb/df3)
|
||||
iz=ib-ia+1
|
||||
do i=ia,ib
|
||||
f0=0.001*i*df3
|
||||
write(13,1000) f0,sync_dat(i,2:5)
|
||||
1000 format(3f10.3,2f5.0)
|
||||
enddo
|
||||
call indexx(sync_dat(ia:ib,2),iz,indx)
|
||||
|
||||
k=0
|
||||
do i=1,MAX0
|
||||
j=indx(iz+1-i) + ia - 1
|
||||
f0=0.001*j*df3
|
||||
snr1=sync_dat(j,2)
|
||||
if(snr1.lt.3.0) exit
|
||||
flip=sync_dat(j,5)
|
||||
bw=nts_q65*108.0
|
||||
if(flip.ne.0) bw=nts_jt65*177.0
|
||||
skip=.false.
|
||||
do n=1,k
|
||||
diffhz=1000.0*(f0-candidate(n,2))
|
||||
if(diffhz.gt.-10.0 .and. diffhz.lt.bw) skip=.true.
|
||||
enddo
|
||||
if(sync_dat(j,6).lt.3.0) skip=.true.
|
||||
if(skip) cycle
|
||||
k=k+1
|
||||
xdt0=sync_dat(j,3)
|
||||
ipol=nint(sync_dat(j,4))
|
||||
candidate(k,1)=snr1 !snr1
|
||||
candidate(k,2)=f0 !f0
|
||||
candidate(k,3)=xdt0
|
||||
candidate(k,4)=ipol
|
||||
candidate(k,5)=flip
|
||||
if(k.ge.MAX_CANDIDATES) exit
|
||||
enddo
|
||||
ncand=k
|
||||
|
||||
return
|
||||
end subroutine get_candidates
|
||||
|
@ -3,11 +3,12 @@ module wideband2_sync
|
||||
parameter (NFFT=32768)
|
||||
integer isync(22)
|
||||
integer nkhz_center
|
||||
real sync_dat(NFFT,5) !fkhz, ccfmax, xdt, ipol, flip
|
||||
real sync_dat(NFFT,6) !fkhz, ccfmax, xdt, ipol, flip
|
||||
real savg_med(4)
|
||||
|
||||
contains
|
||||
|
||||
subroutine wb2_sync(ss,savg,ntone_spacing)
|
||||
|
||||
subroutine wb2_sync(ss,savg,nfa,nfb)
|
||||
|
||||
! Compute "orange sync curve" using the Q65 sync pattern
|
||||
|
||||
@ -15,7 +16,6 @@ subroutine wb2_sync(ss,savg,ntone_spacing)
|
||||
real ss(4,322,NFFT)
|
||||
real savg(4,NFFT)
|
||||
logical first
|
||||
character*1 c1
|
||||
integer isync0(22)
|
||||
integer jsync0(63)
|
||||
! Q65 sync symbols
|
||||
@ -33,6 +33,7 @@ subroutine wb2_sync(ss,savg,ntone_spacing)
|
||||
enddo
|
||||
jz=j
|
||||
|
||||
|
||||
tstep=2048.0/11025.0 !0.185760 s: 0.5*tsym_jt65, 0.3096*tsym_q65
|
||||
if(first) then
|
||||
fac=0.6/tstep
|
||||
@ -45,11 +46,21 @@ subroutine wb2_sync(ss,savg,ntone_spacing)
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
df=96000.0/NFFT
|
||||
ia=nint(7000.0/df) !Flat frequency range for WSE converters
|
||||
ib=nint(89000.0/df)
|
||||
lagbest=-1
|
||||
ipolbest=-1
|
||||
df3=96000.0/NFFT
|
||||
ia=nint(1000*nfa/df3) !Flat frequency range for WSE converters
|
||||
ib=nint(1000*nfb/df3)
|
||||
|
||||
do i=1,4
|
||||
call pctile(savg(i,ia:ib),ib-ia+1,50,savg_med(i))
|
||||
enddo
|
||||
do i=ia,ib
|
||||
write(14,3014) 0.001*i*df3,savg(1:4,i)
|
||||
3014 format(5f10.3)
|
||||
enddo
|
||||
|
||||
lagbest=0
|
||||
ipolbest=1
|
||||
flip=0.
|
||||
|
||||
do i=ia,ib
|
||||
ccfmax=0.
|
||||
@ -85,13 +96,14 @@ subroutine wb2_sync(ss,savg,ntone_spacing)
|
||||
enddo ! lag
|
||||
enddo !ipol
|
||||
|
||||
fkhz=0.001*i*df + nkhz_center - 48.0
|
||||
fkhz=0.001*i*df3 + nkhz_center - 48.0
|
||||
xdt=lagbest*tstep-1.0
|
||||
sync_dat(i,1)=fkhz
|
||||
sync_dat(i,2)=ccfmax
|
||||
sync_dat(i,3)=xdt
|
||||
sync_dat(i,4)=ipolbest
|
||||
sync_dat(i,5)=flip
|
||||
sync_dat(i,6)=ccfmax/(savg(ipolbest,i)/savg_med(ipolbest))
|
||||
enddo
|
||||
|
||||
call pctile(sync_dat(ia:ib,2),ib-ia+1,50,base)
|
||||
|
Loading…
Reference in New Issue
Block a user