From 94ee6ea8a1cd9703e9654e809af8f48e424659e1 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sun, 13 Nov 2016 20:36:27 +0000 Subject: [PATCH] Sorry, I did not intend to commit changes to these routines. Revert to 7305. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7307 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/jt65_decode.f90 | 2 +- lib/qra/qra64/qra64sim.f90 | 4 +-- lib/qra64a.f90 | 55 +++++++++++++++++--------------------- lib/spec64.f90 | 17 ++++++------ lib/sync64.f90 | 37 +++++++++++++------------ 5 files changed, 53 insertions(+), 62 deletions(-) diff --git a/lib/jt65_decode.f90 b/lib/jt65_decode.f90 index 71d0b42a2..8067183d6 100644 --- a/lib/jt65_decode.f90 +++ b/lib/jt65_decode.f90 @@ -99,7 +99,7 @@ contains if(nsubmode.ge.100) then ! This is QRA64 mode mode64=2**(nsubmode-100) - call qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall,hiscall, & + call qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall,hiscall, & hisgrid,sync,nsnr,dtx,nfreq,decoded,nft) if (associated(this%callback)) then ndrift=0 diff --git a/lib/qra/qra64/qra64sim.f90 b/lib/qra/qra64/qra64sim.f90 index 3d77bced7..43d90e7d1 100644 --- a/lib/qra/qra64/qra64sim.f90 +++ b/lib/qra/qra64/qra64sim.f90 @@ -38,8 +38,7 @@ program qra64sim read(arg,*) nfiles call getarg(7,arg) read(arg,*) snrdb - - if(mode64.ge.8) nsigs=1 + rms=100. fsample=12000.d0 !Sample rate (Hz) dt=1.d0/fsample !Sample interval (s) @@ -70,7 +69,6 @@ program qra64sim do isig=1,nsigs !Generate requested number of sigs if(mod(nsigs,2).eq.0) f0=1500.0 + dfsig*(isig-0.5-nsigs/2) if(mod(nsigs,2).eq.1) f0=1500.0 + dfsig*(isig-(nsigs+1)/2) - if(mode64.ge.8) f0=700.0 xsnr=snrdb if(snrdb.eq.0.0) xsnr=-20 - isig diff --git a/lib/qra64a.f90 b/lib/qra64a.f90 index f9573110b..918f73ce8 100644 --- a/lib/qra64a.f90 +++ b/lib/qra64a.f90 @@ -1,15 +1,15 @@ -subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & +subroutine qra64a(dd,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & hisgrid_6,sync,nsnr,dtx,nfreq,decoded,nft) use packjt - parameter (NMAX=60*12000,LN=1152*63) + parameter (NFFT=2*6912,NZ=5760,NMAX=60*12000,LN=1152*63) character decoded*22 character*12 mycall_12,hiscall_12 character*6 mycall,hiscall,hisgrid_6 character*4 hisgrid logical ltext - complex c00(0:720000) !Complex spectrum of dd() - complex c0(0:720000) !Complex data for dd() + complex c00(0:360000) !Complex spectrum of dd() + complex c0(0:360000) !Complex spectrum of dd() ! integer*8 count0,count1,clkfreq real a(3) real dd(NMAX) !Raw data sampled at 12000 Hz @@ -30,7 +30,8 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & call packcall(hiscall,nc2,ltext) call packgrid(hisgrid,ng2,ltext) nSubmode=nint(log(float(mode64)/log(2.0))) - nFadingModel=1 + b90=1.0 + nFadingModel=0 if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then do naptype=0,5 call qra64_dec(s3,nc1,nc2,ng2,naptype,1,nSubmode,b90, & @@ -41,32 +42,18 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & ng2z=ng2 endif - maxf1=0 - call sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snr1,c00) - npts2=npts/2 - -!### -! dtx=0. -! f0=1500.0 -! jpk=6000 -! kpk=0 -! if(mode64.ge.8) f0=700.0 -!### + maxf1=5 + call sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snr1,c00) - itz=10 - if(mode64.eq.4) itz=9 - if(mode64.eq.2) itz=7 - if(mode64.eq.1) itz=5 - + npts2=216000 naptype=4 LL=64*(mode64+2) NN=63 - do itry0=1,7 -! do itry0=1,1 +! do itry0=1,3 + do itry0=1,1 idf0=itry0/2 if(mod(itry0,2).eq.0) idf0=-idf0 -! a(1)=-(f0+0.248*(idf0-0.33*kpk)) - a(1)=-(f0+1.736*(idf0-0.33*kpk)) + a(1)=-(f0+0.248*(idf0-0.33*kpk)) nfreq=nint(-a(1)) a(3)=0. ! do itry1=1,3 @@ -74,18 +61,19 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & idf1=itry1/2 if(mod(itry1,2).eq.0) idf1=-idf1 a(2)=-0.67*(idf1 + 0.67*kpk) - call twkfreq(c00,c0,npts2,6000.0,a) + call twkfreq(c00,c0,npts2,4000.0,a) call spec64(c0,npts2,mode64,jpk,s3a,LL,NN) ircmin=99 - do iter=itz,0,-1 + do iter=0,10 b90=1.728**iter s3(1:LL*NN)=s3a(1:LL*NN) call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, & nFadingModel,dat4,snr2,irc) - if(irc.ge.0) write(*,3333) iter,idf0,-a(1),b90,irc -3333 format(i2,i3,2f8.1,i3) if(abs(snr2).gt.30.) snr2=-30.0 -! if(irc.eq.0) go to 10 + if(irc.eq.0) go to 10 +! write(*,3001) iter,b90,snr2,irc +! write(72,3001) iter,b90,snr2,irc +!3001 format(i2,2f7.1,i4) if(irc.ge.0 .and. irc.le.ircmin) then dat4x=dat4 b90x=b90 @@ -109,7 +97,12 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,mycall_12,hiscall_12, & else snr2=0. endif -! if(irc.ge.0) go to 900 +! write(78,3900) nutc,snr1,snr2,dtx,nfreq,kpk,idf0,idf1,irc,decoded +!3900 format(i4.4,2f6.1,f6.2,i5,4i3,1x,a22) +! flush(78) +! write(*,3006) idf0,idf1,nfreq,jpk,kpk,irc,decoded +!3006 format(2i4,i6,i7,2i4,2x,a22) + if(irc.ge.0) go to 900 enddo enddo 900 continue diff --git a/lib/spec64.f90 b/lib/spec64.f90 index b44e5c12a..29e4c93b2 100644 --- a/lib/spec64.f90 +++ b/lib/spec64.f90 @@ -1,30 +1,31 @@ subroutine spec64(c0,npts2,mode64,jpk,s3,LL,NN) - parameter (NSPS=3456) !Samples per symbol at 6000 Hz + parameter (NSPS=2304) !Samples per symbol at 4000 Hz complex c0(0:360000) !Complex spectrum of dd() complex cs(0:NSPS-1) !Complex symbol spectrum real s3(LL,NN) !Synchronized symbol spectra nfft6=nsps - fac=1.0/nfft6 do j=1,63 jj=j+7 !Skip first Costas array if(j.ge.32) jj=j+14 !Skip middle Costas array ja=jpk + (jj-1)*nfft6 jb=ja+nfft6-1 - cs(0:nfft6-1)=fac*c0(ja:jb) + cs(0:nfft6-1)=c0(ja:jb) call four2a(cs,nfft6,1,-1,1) - smax=0. do ii=1,LL i=ii-65 if(i.lt.0) i=i+nfft6 s3(ii,j)=real(cs(i))**2 + aimag(cs(i))**2 - if(s3(ii,j).gt.smax) then - smax=s3(ii,j) - ipk=ii-65 - endif enddo enddo +! df=4000.0/nfft6 +! do i=1,LL +! freq=(i-65)*df +! write(73,3002) i-65,freq,(1.e-6*s3(i,j),j=1,5) +!3002 format(i5,6f10.3) +! enddo + return end subroutine spec64 diff --git a/lib/sync64.f90 b/lib/sync64.f90 index 079934838..63741cf4a 100644 --- a/lib/sync64.f90 +++ b/lib/sync64.f90 @@ -1,8 +1,7 @@ -subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & - snrdb,c0) +subroutine sync64(dd,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk,snrdb,c0) parameter (NMAX=60*12000) !Max size of raw data at 12000 Hz - parameter (NSPS=3456) !Samples per symbol at 6000 Hz + parameter (NSPS=2304) !Samples per symbol at 4000 Hz parameter (NSPC=7*NSPS) !Samples per Costas array real dd(NMAX) !Raw data real s1(0:NSPC-1) !Power spectrum of Costas 1 @@ -15,7 +14,7 @@ subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & integer icos7(0:6) !Costas 7x7 tones integer ipk0(1) complex cc(0:NSPC-1) !Costas waveform - complex c0(0:720000) !Complex spectrum of dd() + complex c0(0:360000) !Complex spectrum of dd() complex c1(0:NSPC-1) !Complex spectrum of Costas 1 complex c2(0:NSPC-1) !Complex spectrum of Costas 2 complex c3(0:NSPC-1) !Complex spectrum of Costas 3 @@ -32,8 +31,8 @@ subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & k=-1 phi=0. do j=0,6 !Compute complex Costas waveform - dphi=twopi*nsync*icos7(j)*dfgen/6000.0 - do i=1,NSPS + dphi=twopi*nsync*icos7(j)*dfgen/4000.0 + do i=1,2304 phi=phi + dphi if(phi.gt.twopi) phi=phi-twopi k=k+1 @@ -43,20 +42,20 @@ subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & mode64z=mode64 endif + npts0=54*12000 nfft1=672000 - nfft2=nfft1/2 + nfft2=nfft1/3 df1=12000.0/nfft1 fac=2.0/nfft1 - c0(0:npts-1)=fac*dd(1:npts) - c0(npts:nfft1)=0. - call four2a(c0,nfft1,1,-1,1) !Forward c2c FFT - c0(nfft2/2+1:nfft2)=0. - c0(0)=0.5*c0(0) + do i=0,nfft1/2 !Load real data into c0 + c0(i)=fac*cmplx(dd(1+2*i),dd(2+2*i)) + enddo + call four2a(c0,nfft1,1,-1,0) !Forward r2c FFT call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT; c0 is analytic sig - npts2=npts/2 !Downsampled complex data length + npts2=npts0/3 !Downsampled complex data length nfft3=NSPC nh3=nfft3/2 - df3=6000.0/nfft3 + df3=4000.0/nfft3 fa=max(nf1,nfqso-ntol) fb=min(nf2,nfqso+ntol) ia=max(maxf1,nint(fa/df3)) @@ -65,7 +64,7 @@ subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & snr=0. jpk=0 ja=0 - jb=6*6000 + jb=6*4000 jstep=200 ka=-maxf1 kb=maxf1 @@ -73,8 +72,8 @@ subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & kpk=0 do iter=1,2 do j1=ja,jb,jstep - j2=j1 + 39*NSPS - j3=j1 + 77*NSPS + j2=j1 + 39*2304 + j3=j1 + 77*2304 c1=1.e-4*c0(j1:j1+NSPC-1) * conjg(cc) call four2a(c1,nfft3,1,-1,1) c2=1.e-4*c0(j2:j2+NSPC-1) * conjg(cc) @@ -96,7 +95,7 @@ subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & s0b(:ia-1)=0. s0b(ib+1:)=0. nadd=(7*mode64)/2 - if(mod(nadd,2).eq.0) nadd=nadd+1 !Make nadd odd + if(mod(nadd,2).eq.1) nadd=nadd+1 !Make nadd odd if(nadd.ge.3) call smo(s0b(ia:ib),iz,s0(ia:ib),nadd) call smo121(s0(ia:ib),iz) nskip=max(14,2*mode64) @@ -106,7 +105,7 @@ subroutine sync64(dd,npts,nf1,nf2,nfqso,ntol,mode64,maxf1,dtx,f0,jpk,kpk, & jpk=j1 s0a=s0/rms snr=s - dtx=jpk/6000.0 - 1.0 + dtx=jpk/4000.0 - 1.0 ipk0=maxloc(s0(ia:ib)) ipk=ipk0(1) f0=(ipk+ia-1)*df3