Fix a bug in sync8d.f90. Switching between Costas arrays should work now.

This commit is contained in:
Steve Franke 2018-06-06 10:59:49 -05:00
parent 48b60eab71
commit badc639777

View File

@ -1,19 +1,20 @@
subroutine sync8d(cd0,i0,ctwk,itwk,itype,sync)
! Compute sync power for a complex, downsampled FT8 signal.
! itype specifies which Costas array to use
parameter(NP2=2812,NDOWN=60)
complex cd0(3125)
complex csync(0:6,32)
complex csync(0:6,32),csync_1(0:6,32),csync_2(0:6,32)
complex csync2(32)
complex ctwk(32)
complex z1,z2,z3
logical first
integer icos7_1(0:6),icos7_2(0:6),icos7(0:6)
integer icos7_1(0:6),icos7_2(0:6)
data icos7_1/2,5,6,0,4,1,3/
data icos7_2/3,1,4,0,6,5,2/
data first/.true./
save first,twopi,fs2,dt2,taus,baud,csync
save first,twopi,fs2,dt2,taus,baud,csync_1,csync_2
p(z1)=real(z1)**2 + aimag(z1)**2 !Statement function for power
@ -25,28 +26,30 @@ subroutine sync8d(cd0,i0,ctwk,itwk,itype,sync)
taus=32*dt2 !Symbol duration
baud=1.0/taus !Keying rate
do i=0,6
phi=0.0
dphi=twopi*icos7(i)*baud*dt2
phi1=0.0
phi2=0.0
dphi1=twopi*icos7_1(i)*baud*dt2
dphi2=twopi*icos7_2(i)*baud*dt2
do j=1,32
csync(i,j)=cmplx(cos(phi),sin(phi)) !Waveform for 7x7 Costas array
phi=mod(phi+dphi,twopi)
csync_1(i,j)=cmplx(cos(phi1),sin(phi1)) !Waveform for 7x7 Costas array
csync_2(i,j)=cmplx(cos(phi2),sin(phi2)) !Waveform for 7x7 Costas array
phi1=mod(phi1+dphi1,twopi)
phi2=mod(phi2+dphi2,twopi)
enddo
enddo
first=.false.
endif
if(itype.eq.1) then
icos7=icos7_1
else
icos7=icos7_2
endif
sync=0
do i=0,6 !Sum over 7 Costas frequencies and
i1=i0+i*32 !three Costas arrays
i2=i1+36*32
i3=i1+72*32
csync2=csync(i,1:32)
if(itype.eq.1) then
csync2=csync_1(i,1:32)
else
csync2=csync_2(i,1:32)
endif
if(itwk.eq.1) csync2=ctwk*csync2 !Tweak the frequency
z1=0.
z2=0.