diff --git a/CMakeLists.txt b/CMakeLists.txt index 0db7a569e..ccb2f6d5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -512,6 +512,7 @@ set (wsjt_FSRCS lib/msk144signalquality.f90 lib/msk144sim.f90 lib/mskrtd.f90 + lib/nuttal_window.f90 lib/ft4/ft4sim.f90 lib/ft4/ft4sim_mult.f90 lib/ft4/ft4_decode.f90 diff --git a/lib/ft4/ft4_decode.f90 b/lib/ft4/ft4_decode.f90 index 8d40aa8cd..3a8c12f14 100644 --- a/lib/ft4/ft4_decode.f90 +++ b/lib/ft4/ft4_decode.f90 @@ -1,5 +1,5 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & - iwave,ndecodes,mycall,hiscall,nrx,line,data_dir) + iwave,ndecodes,mycall,hiscall,cqstr,nrx,line,data_dir) use packjt77 include 'ft4_params.f90' @@ -14,9 +14,9 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & character*12 mycall,hiscall character*12 mycall0,hiscall0 character*6 hhmmss + character*4 cqstr,cqstr0 complex cd2(0:NMAX/NDOWN-1) !Complex waveform -! complex cds(0:NMAX/NDOWN-1) !Complex waveform complex cb(0:NMAX/NDOWN-1) complex cd(0:NN*NSS-1) !Complex waveform complex ctwk(4*NSS),ctwk2(4*NSS) @@ -32,6 +32,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & real savg(NH1),sbase(NH1) integer apbits(2*ND) + integer apmy_ru(28),aphis_fd(28) integer nrxx(100) integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3) integer*2 iwave(NMAX) !Generated full-length waveform @@ -41,7 +42,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & integer ip(1) integer nappasses(0:5) ! # of decoding passes for QSO States 0-5 integer naptypes(0:5,4) ! nQSOProgress, decoding pass - integer mcq(29),mcqru(29),mcqfd(29),mcqtest(29) + integer mcq(29) integer mrrr(19),m73(19),mrr73(19) logical nohiscall,unpk77_success @@ -56,9 +57,6 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & data msg0/' '/ data first/.true./ data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/ - data mcqru/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0/ - data mcqfd/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0/ - data mcqtest/0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,1,0,1,1,1,1,1,1,0,0,1,0/ data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/ data m73/0,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,1/ data mrr73/0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1/ @@ -66,7 +64,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & 1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,1,1,1,0,0,1,0,1, & 0,1,0,1,0,1,1,0,1,1,1,1,1,0,0,0,1,0,1/ save fs,dt,tt,txt,twopi,h,one,first,nrxx,linex,apbits,nappasses,naptypes, & - mycall0,hiscall0,msg0 + mycall0,hiscall0,msg0,cqstr0 call clockit('ft4_deco',0) hhmmss=cdatetime0(8:13) @@ -85,10 +83,6 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & enddo enddo - mcq=2*mod(mcq+rvec(1:29),2)-1 - mcqfd=2*mod(mcqfd+rvec(1:29),2)-1 - mcqru=2*mod(mcqru+rvec(1:29),2)-1 - mcqtest=2*mod(mcqtest+rvec(1:29),2)-1 mrrr=2*mod(mrrr+rvec(59:77),2)-1 m73=2*mod(m73+rvec(59:77),2)-1 mrr73=2*mod(mrr73+rvec(59:77),2)-1 @@ -107,9 +101,6 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & ! 4 MyCall DxCall RRR (77 ap bits) ! 5 MyCall DxCall 73 (77 ap bits) ! 6 MyCall DxCall RR73 (77 ap bits) -!******** -! For this contest-oriented mode, OK to only look for RR73?? -! Currently, 2 AP passes in all Txn states except for Tx5. !******** naptypes(0,1:4)=(/1,2,0,0/) ! Tx6 selected (CQ) naptypes(1,1:4)=(/2,3,0,0/) ! Tx1 @@ -120,9 +111,26 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & mycall0='' hiscall0='' + cqstr0='' first=.false. endif + if(cqstr.ne.cqstr0) then + i0=index(cqstr,' ') + if(i0.le.1) then + message='CQ A1AA AA01' + else + message='CQ '//cqstr(1:i0-1)//' A1AA AA01' + endif + i3=-1 + n3=-1 + call pack77(message,i3,n3,c77) + call unpack77(c77,1,msgsent,unpk77_success) + read(c77,'(29i1)') mcq + mcq=2*mod(mcq+rvec(1:29),2)-1 + cqstr0=cqstr + endif + l1=index(mycall,char(0)) if(l1.ne.0) mycall(l1:)=" " l1=index(hiscall,char(0)) @@ -131,6 +139,8 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & apbits=0 apbits(1)=99 apbits(30)=99 + apmy_ru=0 + aphis_fd=0 if(len(trim(mycall)) .lt. 3) go to 10 @@ -147,6 +157,8 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & call unpack77(c77,1,msgsent,unpk77_success) if(i3.ne.1 .or. (message.ne.msgsent) .or. .not.unpk77_success) go to 10 read(c77,'(77i1)') message77 + apmy_ru=2*mod(message77(1:28)+rvec(2:29),2)-1 + aphis_fd=2*mod(message77(30:57)+rvec(29:56),2)-1 message77=mod(message77+rvec,2) call encode174_91(message77,cw) apbits=2*cw-1 @@ -366,15 +378,10 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & if(iaptype.ge.2 .and. apbits(1).gt.1) cycle ! No, or nonstandard, mycall if(iaptype.ge.3 .and. apbits(30).gt.1) cycle ! No, or nonstandard, dxcall - if(iaptype.eq.1) then ! CQ or CQ TEST + if(iaptype.eq.1) then ! CQ or CQ TEST or CQ FD or CQ RU or CQ SCC apmask=0 apmask(1:29)=1 - if(ncontest.eq.0) llrd(1:29)=apmag*mcq(1:29) - if(ncontest.eq.1) llrd(1:29)=apmag*mcqtest(1:29) - if(ncontest.eq.2) llrd(1:29)=apmag*mcqtest(1:29) - if(ncontest.eq.3) llrd(1:29)=apmag*mcqfd(1:29) - if(ncontest.eq.4) llrd(1:29)=apmag*mcqru(1:29) - if(ncontest.eq.6) llrd(1:29)=apmag*mcq(1:29) + llrd(1:29)=apmag*mcq(1:29) endif if(iaptype.eq.2) then ! MyCall,???,??? @@ -390,43 +397,31 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, & llrd(1:28)=apmag*apbits(1:28) else if(ncontest.eq.4) then apmask(2:29)=1 - llrd(2:29)=apmag*apbits(1:28) - else if(ncontest.eq.6) then ! ??? RR73; MyCall ??? - apmask(29:56)=1 - llrd(29:56)=apmag*apbits(1:28) + llrd(2:29)=apmag*apmy_ru(1:28) endif endif if(iaptype.eq.3) then ! MyCall,DxCall,??? apmask=0 - if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2.or.ncontest.eq.6) then + if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2) then apmask(1:58)=1 llrd(1:58)=apmag*apbits(1:58) else if(ncontest.eq.3) then ! Field Day apmask(1:56)=1 llrd(1:28)=apmag*apbits(1:28) - llrd(29:56)=apmag*apbits(30:57) + llrd(29:56)=apmag*aphis_fd(1:28) else if(ncontest.eq.4) then ! RTTY RU apmask(2:57)=1 - llrd(2:29)=apmag*apbits(1:28) + llrd(2:29)=apmag*apmy_ru(1:28) llrd(30:57)=apmag*apbits(30:57) endif endif - if(iaptype.eq.5.and.ncontest.eq.6) cycle !Hound if(iaptype.eq.4 .or. iaptype.eq.5 .or. iaptype.eq.6) then apmask=0 - if(ncontest.le.4 .or. (ncontest.eq.6.and.iaptype.eq.6)) then -! apmask(1:77)=1 ! mycall, hiscall, RRR|73|RR73 + if(ncontest.le.4) then apmask(1:91)=1 ! mycall, hiscall, RRR|73|RR73 - llrd(1:58)=apmag*apbits(1:58) - if(iaptype.eq.4) llrd(59:77)=apmag*mrrr - if(iaptype.eq.5) llrd(59:77)=apmag*m73 -! if(iaptype.eq.6) llrd(59:77)=apmag*mrr73 if(iaptype.eq.6) llrd(1:91)=apmag*apbits(1:91) - else if(ncontest.eq.6.and.iaptype.eq.4) then ! Hound listens for MyCall RR73;... - apmask(1:28)=1 - llrd(1:28)=apmag*apbits(1:28) endif endif diff --git a/lib/ft4/ft4d.f90 b/lib/ft4/ft4d.f90 index b92ff8711..7c17481b1 100644 --- a/lib/ft4/ft4d.f90 +++ b/lib/ft4/ft4d.f90 @@ -8,6 +8,7 @@ program ft4d character*12 hiscall character*80 infile character*61 line + character*4 cqstr real*8 fMHz integer ihdr(11) integer*2 iwave(180000) !15*12000 @@ -44,11 +45,12 @@ program ft4d endif nfa=0 nfb=4224 - ncontest=4 ndecodes=0 nfqso=1500 mycall="K9AN" hiscall="K1JT" + ncontest=4 + cqstr="RU " do ifile=iarg,nargs call getarg(ifile,infile) @@ -66,7 +68,7 @@ program ft4d i0=(n-1)*istep + 1 tbuf=(i0-1)/12000.0 call ft4_decode(cdatetime,tbuf,nfa,nfb,nQSOProgress,ncontest, & - nfqso,iwave(i0),ndecodes,mycall,hiscall,nrx,line,data_dir) + nfqso,iwave(i0),ndecodes,mycall,hiscall,cqstr,nrx,line,data_dir) do idecode=1,ndecodes call get_ft4msg(idecode,nrx,line) write(*,'(a61)') line diff --git a/lib/ft4/getcandidates4.f90 b/lib/ft4/getcandidates4.f90 index 424a7d297..9b5200845 100644 --- a/lib/ft4/getcandidates4.f90 +++ b/lib/ft4/getcandidates4.f90 @@ -20,8 +20,8 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, & if(first) then first=.false. pi=4.0*atan(1.) - window=0.5*(1-cos(pi*(/(i,i=1,NFFT1)/)/(NFFT1/2.0))) - window=window**2 + window=0. + call nuttal_window(window,NFFT1) endif ! Compute symbol spectra, stepping by NSTEP steps. @@ -69,19 +69,5 @@ subroutine getcandidates4(id,fa,fb,syncmin,nfqso,maxcand,savg,candidate, & endif enddo -! do i=1,maxcand -! ipk=maxloc(savsm(nfa:nfb)) -! ip=nfa-1+ipk(1) -! xmax=savsm(ip) -! savsm(max(1,ip-8):min(NH1,ip+8))=0.0 -! if(xmax.ge.syncmin) then -! ncand=ncand+1 -! candidate(1,ncand)=ip*df+f_offset -! candidate(2,ncand)=-99.9 -! candidate(3,ncand)=xmax -! else -! exit -! endif -! enddo return end subroutine getcandidates4 diff --git a/lib/nuttal_window.f90 b/lib/nuttal_window.f90 new file mode 100644 index 000000000..aa813b15d --- /dev/null +++ b/lib/nuttal_window.f90 @@ -0,0 +1,15 @@ +subroutine nuttal_window(win,n) + real win(n) + + pi=4.0*atan(1.0) + a0=0.3635819 + a1=-0.4891775; + a2=0.1365995; + a3=-0.0106411; + do i=1,n + win(i)=a0+a1*cos(2*pi*(i-1)/(n))+ & + a2*cos(4*pi*(i-1)/(n))+ & + a3*cos(6*pi*(i-1)/(n)) + enddo + return +end subroutine nuttal_window diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 78215e209..b9f5e2088 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -50,18 +50,8 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes, & if(nfft3.ne.nfft3z) then ! Compute new window pi=4.0*atan(1.0) -! Coefficients taken from equation 37 of NUSC report: -! "Some windows with very good sidelobe behavior: application to -! discrete Hilbert Transform, by Albert Nuttall" - a0=0.3635819 - a1=-0.4891775; - a2=0.1365995; - a3=-0.0106411; - do i=1,nfft3 - w3(i)=a0+a1*cos(2*pi*(i-1)/(nfft3))+ & - a2*cos(4*pi*(i-1)/(nfft3))+ & - a3*cos(6*pi*(i-1)/(nfft3)) - enddo + w3=0 + call nuttal_window(w3,nfft3) nfft3z=nfft3 endif diff --git a/lib/wsprd/Makefile b/lib/wsprd/Makefile index 920407349..c8e15723f 100644 --- a/lib/wsprd/Makefile +++ b/lib/wsprd/Makefile @@ -1,11 +1,10 @@ CC = gcc -#CC = clang-3.5 FC = gfortran -CFLAGS= -I/usr/include -Wall -Wno-missing-braces -O3 -ffast-math +CFLAGS= -I/usr/include -Wall -Wno-missing-braces -Wno-unused-result -O3 -ffast-math LDFLAGS = -L/usr/lib -FFLAGS = -O2 -Wall -Wno-conversion -LIBS = -lfftw3f -lm +FFLAGS = -O2 -Wall -Wno-conversion +LIBS = -lfftw3f -lm -lgfortran # Default rules %.o: %.c $(DEPS) @@ -14,21 +13,27 @@ LIBS = -lfftw3f -lm ${FC} ${FFLAGS} -c $< %.o: %.F ${FC} ${FFLAGS} -c $< -%.o: %.f90 +%.o: %.f90 ${FC} ${FFLAGS} -c $< %.o: %.F90 ${FC} ${FFLAGS} -c $< -all: wsprd wsprsim wsprd_exp +all: wsprd wsprsim DEPS = wsprsim_utils.h wsprd_utils.h fano.h jelinek.h nhash.h -OBJS1 = wsprd.o wsprsim_utils.o wsprd_utils.o tab.o fano.o jelinek.o nhash.o + +indexx.o: ../indexx.f90 + ${FC} -o indexx.o ${FFLAGS} -c ../indexx.f90 + +OBJS1 = wsprd.o wsprsim_utils.o wsprd_utils.o tab.o fano.o jelinek.o nhash.o indexx.o osdwspr.o + wsprd: $(OBJS1) $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LIBS) OBJS2 = wsprsim.o wsprsim_utils.o wsprd_utils.o tab.o fano.o nhash.o + wsprsim: $(OBJS2) $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS) $(LIBS) clean: - rm *.o wsprd wsprsim + $(RM) *.o wsprd wsprsim diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index be579deef..2f4c47db3 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -171,8 +171,8 @@ extern "C" { void ft4_decode_(char* cdatetime, float* tbuf, int* nfa, int* nfb, int* nQSOProgress, int* nContest, int* nfqso, short int id[], int* ndecodes, char* mycall, - char* hiscall, int* nrx, char* line, char* ddir, int len1, int len2, - int len3, int len4, int len5); + char* hiscall, char* cqstr, int* nrx, char* line, char* ddir, int len1, + int len2, int len3, int len4, int len5, int len6); void get_ft4msg_(int* idecode, int* nrx, char* line, int len); @@ -8714,8 +8714,17 @@ void MainWindow::ft4Data(int k) dataDir = m_config.writeable_data_dir ().absolutePath (); char ddir[512]; strncpy(ddir,dataDir.toLatin1(), sizeof (ddir) - 1); + char cqstr[4]; + strncpy(cqstr," ",4); + if(SpecOp::NA_VHF == m_config.special_op_id()) strncpy(cqstr,"TEST",4); + if(SpecOp::EU_VHF == m_config.special_op_id()) strncpy(cqstr,"TEST",4); + if(SpecOp::FIELD_DAY == m_config.special_op_id()) strncpy(cqstr,"FD",2); + if(SpecOp::RTTY == m_config.special_op_id()) { + if(m_config.RTTY_Exchange()!="SCC") strncpy(cqstr,"RU",2); + if(m_config.RTTY_Exchange()=="SCC") strncpy(cqstr,"SCC",3); + } ft4_decode_(cdatetime,&tbuf,&nfa,&nfb,&nQSOProgress,&nContest,&nfqso,id,&ndecodes,&mycall[0],&hiscall[0], - &nrx,&line[0],&ddir[0],17,12,12,61,512); + &cqstr[0],&nrx,&line[0],&ddir[0],17,12,12,4,61,512); line[60]=0; for (int idecode=1; idecode<=ndecodes; idecode++) { get_ft4msg_(&idecode,&nrx,&line[0],61);