diff --git a/lib/sync64.f90 b/lib/sync64.f90 index d927af9c9..f6d438e32 100644 --- a/lib/sync64.f90 +++ b/lib/sync64.f90 @@ -5,14 +5,14 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & parameter (NMAX=60*12000) !Max size of raw data at 12000 Hz parameter (NSPS=3456) !Samples per symbol at 6000 Hz - parameter (NSPC=7*NSPS) !Samples per Costas array + parameter (NSPC=7*NSPS) !Samples per Costas waveform real s1(0:NSPC-1) !Power spectrum of Costas 1 real s2(0:NSPC-1) !Power spectrum of Costas 2 real s3(0:NSPC-1) !Power spectrum of Costas 3 real s0(0:NSPC-1) !Sum of s1+s2+s3 real s0a(0:NSPC-1) !Best synchromized spectrum (saved) real s0b(0:NSPC-1) !tmp - real a(5) + real a(5) !Parameters of Lorentzian fit integer icos7(0:6) !Costas 7x7 tones integer ipk0(1) complex cc(0:NSPC-1) !Costas waveform @@ -25,11 +25,12 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & save if(mode64.ne.mode64z) then +! Submode has changed, recompute the complex Costas waveform twopi=8.0*atan(1.0) dfgen=mode64*12000.0/6912.0 k=-1 phi=0. - do j=0,6 !Compute complex Costas waveform + do j=0,6 dphi=twopi*10.0*icos7(j)*dfgen/6000.0 do i=1,NSPS phi=phi + dphi @@ -42,7 +43,6 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & endif nfft3=NSPC - nh3=nfft3/2 df3=6000.0/nfft3 fa=max(nf1,nfqso-ntol) @@ -61,7 +61,7 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & smaxall=0. jpk=0 ja=0 - jb=(5.0+emedelay)*6000 + jb=(5.0+emedelay)*6000 !Bigger range than necessary? jstep=100 ipk=0 kpk=0 @@ -69,7 +69,7 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & if(mod(nadd,2).eq.0) nadd=nadd+1 !Make nadd odd nskip=max(49,nadd) - do j1=ja,jb,jstep + do j1=ja,jb,jstep !Loop over DT call timer('sync64_1',0) j2=j1 + 39*NSPS j3=j1 + 77*NSPS @@ -95,7 +95,7 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & s0(ia:ib)=s1(ia:ib) + s2(ia:ib) + s3(ia:ib) s0(:ia-1)=0. s0(ib+1:)=0. - if(nadd.ge.3) then + if(nadd.ge.3) then !Smooth the spectrum do ii=1,3 s0b(ia:ib)=s0(ia:ib) call smo(s0b(ia:ib),iz,s0(ia:ib),nadd) @@ -114,7 +114,7 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & f0=ip*df3 endif call timer('sync64_2',1) - enddo + enddo ! j1 (DT loop) s0a=s0a+2.0 ! write(17) ia,ib,s0a(ia:ib) !Save data for red curve @@ -141,7 +141,6 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & rewind 17 write(17,1110) 0.0,0.0 rewind 17 -! rewind 76 do i=2,iz-2*nskip-1,3 x=i z=(x-a(3))/(0.5*a(4)) @@ -155,11 +154,9 @@ subroutine sync64(c0,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk,sync, & ss=(s0a(j-1)+s0a(j)+s0a(j+1))/3.0 if(ss.gt.slimit) write(17,1110) freq,ss 1110 format(3f10.3) -! write(76,1110) freq,ss,yfit enddo flush(17) close(17) -! flush(76) return end subroutine sync64