From 6e5af1137589426f8c211d3f0c35736ed2253ac2 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 3 Oct 2012 17:47:55 +0000 Subject: [PATCH] Working on peakups for DF and DT. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2642 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/Makefile.MinGW | 7 ++++--- lib/peakdf9.f90 | 37 +++++++++++++++++++++++++++++++++++++ lib/peakdt9.f90 | 38 ++++++++++++++++++++++++++++++++++++++ lib/spec9.f90 | 16 ++++++++-------- mainwindow.cpp | 2 +- 5 files changed, 88 insertions(+), 12 deletions(-) create mode 100644 lib/peakdf9.f90 create mode 100644 lib/peakdt9.f90 diff --git a/lib/Makefile.MinGW b/lib/Makefile.MinGW index 802eeabb8..0bccb1844 100644 --- a/lib/Makefile.MinGW +++ b/lib/Makefile.MinGW @@ -27,15 +27,16 @@ OBJS1 = trimlist.o pctile.o sort.o indexx.o ssort.o graycode.o \ grid2k.o unpacktext.o getpfx2.o packmsg.o deg2grid.o \ packtext.o getpfx1.o packcall.o k2grid.o packgrid.o \ nchar.o four2a.o grid2deg.o pfxdump.o f77_wisdom.o \ - symspecx.o timf2x.o analytic.o db.o genjt9.o ptt.o \ + symspec.o timf2.o analytic.o db.o genjt9.o ptt.o \ packbits.o unpackbits.o encode232.o interleave9.o \ - entail.o fano232.o gran.o spec9.o decode9.o + entail.o fano232.o gran.o spec9.o sync9.o decode9.o \ + peakdt9.o peakdf9.o libjt9.a: $(OBJS1) ar cr libjt9.a $(OBJS1) ranlib libjt9.a -OBJS2 = jt9.o symspec.o timf2x.o sync9.o +OBJS2 = jt9.o jt9.exe: $(OBJS2) libjt9.a $(FC) -o jt9.exe $(OBJS2) libjt9.a ../libfftw3f_win.a diff --git a/lib/peakdf9.f90 b/lib/peakdf9.f90 new file mode 100644 index 000000000..9d4c68731 --- /dev/null +++ b/lib/peakdf9.f90 @@ -0,0 +1,37 @@ +subroutine peakdf9(c0,npts8,nsps8,istart,foffset,xdf) + + complex c0(0:npts8-1) + complex zsum + integer ii(16) !Locations of sync symbols + data ii/1,6,11,16,21,26,31,39,45,51,57,63,69,75,81,85/ + + twopi=8.0*atan(1.0) + df=1500.0/nsps8 + smax=0. + do idf=-10,10 + f0=foffset + 0.1*df*idf + dphi=twopi*f0/1500.0 + sum=0. + do j=1,16 + i1=(ii(j)-1)*nsps8 + istart + phi=0. + zsum=0. + do i=i1,i1+nsps8-1 + if(i.lt.0) cycle + phi=phi + dphi + zsum=zsum + c0(i) * cmplx(cos(phi),-sin(phi)) + enddo + sum=sum + real(zsum)**2 + aimag(zsum)**2 + enddo + if(sum.gt.smax) then + idfpk=idf + fpk=f0 + smax=sum + endif + enddo + + write(*,3001) idfpk,fpk,smax +3001 format('DF:'i5,f8.2,f12.3) + + return +end subroutine peakdf9 diff --git a/lib/peakdt9.f90 b/lib/peakdt9.f90 new file mode 100644 index 000000000..0d635ada1 --- /dev/null +++ b/lib/peakdt9.f90 @@ -0,0 +1,38 @@ +subroutine peakdt9(c0,npts8,nsps8,istart,foffset,idt) + + complex c0(0:npts8-1) + complex zsum + integer ii(16) !Locations of sync symbols + data ii/1,6,11,16,21,26,31,39,45,51,57,63,69,75,81,85/ + + twopi=8.0*atan(1.0) + smax=0. + + f0=foffset + dphi=twopi*f0/1500.0 + do idt=-10,10 + i0=istart + 0.1*nsps8*idt + sum=0. + do j=1,16 + i1=(ii(j)-1)*nsps8 + i0 + phi=0. + zsum=0. + do i=i1,i1+nsps8-1 + if(i.lt.0) cycle + phi=phi + dphi + zsum=zsum + c0(i) * cmplx(cos(phi),-sin(phi)) + enddo + sum=sum + real(zsum)**2 + aimag(zsum)**2 + enddo + if(sum.gt.smax) then + idtpk=idt + smax=sum + endif + enddo + + tpk=idtpk/1500.0 + write(*,3001) idtpk,tpk,smax +3001 format('DT:'i5,f8.2,f12.3) + + return +end subroutine peakdt9 diff --git a/lib/spec9.f90 b/lib/spec9.f90 index 14aeea605..2c1fc212d 100644 --- a/lib/spec9.f90 +++ b/lib/spec9.f90 @@ -2,7 +2,6 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk,i1SoftSymbols) parameter (MAXFFT=31500) complex c0(0:npts8-1) - real s(0:MAXFFT-1) real ssym(0:7,69) complex c(0:MAXFFT-1) integer*1 i1SoftSymbolsScrambled(207) @@ -21,17 +20,19 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk,i1SoftSymbols) save nsps8=nsps/8 + foffset=fpk-f0a + istart=1520 + idt=0 + xdf=0. - idt=-400 - idf=0. - fshift=fpk-f0a + 0.1*idf + call peakdf9(c0,npts8,nsps8,istart,foffset,xdf) + call peakdt9(c0,npts8,nsps8,istart,foffset,idt) + + fshift=foffset + xdf twopi=8.0*atan(1.0) dphi=twopi*fshift/1500.0 nfft=nsps8 - s=0. -! istart=lagpk*nsps8 + idt - istart=1520 nsym=min((npts8-istart)/nsps8,85) k=0 @@ -52,7 +53,6 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk,i1SoftSymbols) do i=0,nfft-1 sx=real(c(i))**2 + aimag(c(i))**2 if(i.ge.1 .and. i.le.8) ssym(ig(i-1),k)=sx - s(i)=s(i) + sx enddo enddo diff --git a/mainwindow.cpp b/mainwindow.cpp index b96be69b8..2bf4637f1 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -12,7 +12,7 @@ short int iwave[30*48000]; //Wave file for Tx audio int nwave; //Length of Tx waveform bool btxok; //True if OK to transmit double outputLatency; //Latency in seconds -qint16 id[30*48000]; +//qint16 id[30*48000]; WideGraph* g_pWideGraph = NULL;