diff --git a/libm65/Makefile b/libm65/Makefile new file mode 100644 index 000000000..ba2e88aa8 --- /dev/null +++ b/libm65/Makefile @@ -0,0 +1,71 @@ +CC = gcc +CXX = g++ +FC = gfortran + +FFLAGS = -O2 -fbounds-check -Wall -Wno-conversion +CFLAGS = -O2 -I. + +# Default rules +%.o: %.c + ${CC} ${CFLAGS} -c $< +%.o: %.f + ${FC} ${FFLAGS} -c $< +%.o: %.F + ${FC} ${FFLAGS} -c $< +%.o: %.f90 + ${FC} ${FFLAGS} -c $< +%.o: %.F90 + ${FC} ${FFLAGS} -c $< + +#all: qratest.exe tplt.exe +all: qra64d.exe + +OBJS1 = qratest.o qra64a.o sync64.o four2a.o smo.o smo121.o averms.o \ + packjt.o twkfreq.o spec64.o fmtmsg.o pctile.o \ + grid2deg.o deg2grid.o shell.o badmsg.o qra64_subs.o \ + qracodes.o npfwht.o pdmath.o qra12_63_64_irr_b.o \ + qra13_64_64_irr_e.o qra64.o \ + lorentzian.o fchisq0.o peakup.o + +qra64_subs.o: ../../wsjtx/lib/qra/qra64/qra64_subs.c + gcc -c -O2 -o qra64_subs.o ../../wsjtx/lib/qra/qra64/qra64_subs.c + +qracodes.o: ../../wsjtx/lib/qra/qracodes/qracodes.c + gcc -c -O2 -o qracodes.o ../../wsjtx/lib/qra/qracodes/qracodes.c + +qra64.o: ../../wsjtx/lib/qra/qra64/qra64.c + gcc -c -O2 -o qra64.o ../../wsjtx/lib/qra/qra64/qra64.c + +npfwht.o: ../../wsjtx/lib/qra/qracodes/npfwht.c + gcc -c -O2 -o npfwht.o ../../wsjtx/lib/qra/qracodes/npfwht.c + +pdmath.o: ../../wsjtx/lib/qra/qracodes/pdmath.c + gcc -c -O2 -o pdmath.o ../../wsjtx/lib/qra/qracodes/pdmath.c + +qra12_63_64_irr_b.o: ../../wsjtx/lib/qra/qracodes/qra12_63_64_irr_b.c + gcc -c -O2 -o qra12_63_64_irr_b.o ../../wsjtx/lib/qra/qracodes/qra12_63_64_irr_b.c + +qra13_64_64_irr_e.o: ../../wsjtx/lib/qra/qracodes/qra13_64_64_irr_e.c + gcc -c -O2 -o qra13_64_64_irr_e.o ../../wsjtx/lib/qra/qracodes/qra13_64_64_irr_e.c + +qratest.exe: $(OBJS1) + $(FC) -o qratest.exe $(OBJS1) C:\JTSDK\fftw3f\libfftw3f-3.dll + +OBJS2 = tplt.o zplt64.o image.o +tplt.exe: $(OBJS2) + $(FC) -o tplt.exe $(OBJS2) + +OBJS3 = qra64d.o qra64c.o qra64zap.o sync64.o four2a.o smo.o averms.o \ + timer.o packjt.o twkfreq.o spec64.o fmtmsg.o pctile.o dpol.o \ + grid2deg.o deg2grid.o shell.o badmsg.o moondop.o moon2.o \ + geocentric.o toxyz.o dot.o dcoord.o \ + qra64_subs.o qracodes.o npfwht.o pdmath.o qra12_63_64_irr_b.o \ + qra13_64_64_irr_e.o qra64.o lorentzian.o fchisq0.o + +qra64d.exe: $(OBJS3) + $(FC) -o qra64d.exe $(OBJS3) C:\JTSDK\fftw3f\libfftw3f-3.dll + +.PHONY : clean + +clean: + $(RM) *.o qratest.exe tplt.exe diff --git a/libm65/map65a.f90 b/libm65/map65a.f90 index 2c86cf2d0..474df469b 100644 --- a/libm65/map65a.f90 +++ b/libm65/map65a.f90 @@ -447,14 +447,18 @@ subroutine map65a(dd,ss,savg,newdat,nutc,fcenter,ntol,idphi,nfa,nfb, & endif endif endif - cmode='A ' - if(mode65.eq.2) cmode='B ' - if(mode65.eq.4) cmode='C ' + cmode='#A' + if(mode65.eq.2) cmode='#B' + if(mode65.eq.4) cmode='#C' write(26,1014) f0,ndf,ndf0,ndf1,ndf2,dt,npol,nsync1, & nsync2,nutc,decoded,cp,cmode - write(21,1014) f0,ndf,ndf0,ndf1,ndf2,dt,npol,nsync1, & - nsync2,nutc,decoded,cp,cmode 1014 format(f8.3,i5,3i3,f5.1,i4,i3,i4,i5.4,4x,a22,2x,a1,3x,a2) + write(21,1016) f0,ndf,dt,npol,nsync2,nutc,decoded,cp, & + cmode(1:1),cmode(2:2) +1016 format(f8.3,i5,f5.1,2i4,i5.4,2x,a22,2x,a1,3x,a1,1x,a1) + +! write(21,1014) f0,ndf,ndf0,ndf1,ndf2,dt,npol,nsync1, & +! nutc,decoded,cp,cmode endif endif diff --git a/libm65/qra64b.f90 b/libm65/qra64b.f90 index cde66aae4..fcf9b6bfa 100644 --- a/libm65/qra64b.f90 +++ b/libm65/qra64b.f90 @@ -23,13 +23,15 @@ subroutine qra64b(nutc,nqd,ikhz,mousedf,ntol,xpol,mycall_12,hiscall_12, & cy(nh+1:NFFT2-1)=cb(k0-nh+1:k0-1) cy=fac*cy +! write(60) cx,cy,nutc,nqd,ikhz,mousedf,ntol,xplo,mycall_12, & +! hiscall_12,hisgrid_6 + if(nzap.gt.0) call qra64zap(cx,cy,nzap) ! Transform back to time domain with sample rate 6000 Hz. call four2a(cx,NFFT2,1,-1,1) call four2a(cy,NFFT2,1,-1,1) -! write(67) nutc,cx,cy call qra64c(cx,cy,nutc,nqd,ikhz,mousedf,ntol,xplo,mycall_12, & hiscall_12,hisgrid_6,nwrite_qra64) close(17) diff --git a/libm65/qra64c.f90 b/libm65/qra64c.f90 index 74ba305fd..802417ef9 100644 --- a/libm65/qra64c.f90 +++ b/libm65/qra64c.f90 @@ -5,15 +5,11 @@ subroutine qra64c(cx,cy,nutc,nqd,ikhz,nfqso,ntol,xpol,mycall_12, & parameter (NFFT2=336000) !56*6000 (downsampled by 1/16) parameter (NMAX=60*12000,LN=1152*63) -! Required input data: -! nutc,cx,cy,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth,emedelay, -! mycall_12,hiscall_12,hisgrid_6 - character decoded*22 character*12 mycall_12,hiscall_12 - character*6 mycall,hiscall,hisgrid_6 + character*6 mycall,hiscall,hisgrid_6,grid character*4 hisgrid - character*1 cp,cmode + character cp*1,cmode*2 logical xpol,ltext complex cx(0:NFFT2-1),cy(0:NFFT2-1) complex c00(0:720000) !Complex spectrum of dd() @@ -51,6 +47,7 @@ subroutine qra64c(cx,cy,nutc,nqd,ikhz,nfqso,ntol,xpol,mycall_12, & if(mode64.eq.4) nSubmode=2 if(mode64.eq.8) nSubmode=3 if(mode64.eq.16) nSubmode=4 + cmode(2:2)=char(ichar('A')+nSubmode) b90=1.0 nFadingModel=1 maxaptype=4 @@ -72,9 +69,9 @@ subroutine qra64c(cx,cy,nutc,nqd,ikhz,nfqso,ntol,xpol,mycall_12, & do ip=0,3 if(ip.eq.0) c00(0:NFFT2-1)=conjg(cx) - if(ip.eq.1) c00(0:NFFT2-1)=conjg(cx+cy) + if(ip.eq.1) c00(0:NFFT2-1)=0.707*conjg(cx+cy) if(ip.eq.2) c00(0:NFFT2-1)=conjg(cy) - if(ip.eq.3) c00(0:NFFT2-1)=conjg(cx-cy) + if(ip.eq.3) c00(0:NFFT2-1)=0.707*conjg(cx-cy) call sync64(c00,nf1,nf2,nfqso,ntol,mode64,emedelay,dtx,f0,jpk0,sync, & sync2,width) @@ -173,20 +170,58 @@ subroutine qra64c(cx,cy,nutc,nqd,ikhz,nfqso,ntol,xpol,mycall_12, & if(nSubmode.eq.4) nsnr=nint(10.0*log10(sy)-24.0) !E endif - cp='H' +!### +! If Tx station's grid is in decoded message, compute optimum TxPol + i1=index(decoded,' ') + i2=index(decoded(i1+1:),' ') + i1 + grid=' ' + if(i2.ge.8 .and. i2.le.18) grid=decoded(i2+1:i2+4)//'mm' ntxpol=0 + cp=' ' + if(xpol) then + if(grid(1:1).ge.'A' .and. grid(1:1).le.'R' .and. & + grid(2:2).ge.'A' .and. grid(2:2).le.'R' .and. & + grid(3:3).ge.'0' .and. grid(3:3).le.'9' .and. & + grid(4:4).ge.'0' .and. grid(4:4).le.'9') then + ntxpol=mod(npol-nint(2.0*dpol(mygrid,grid))+720,180) + if(nxant.eq.0) then + cp='H' + if(ntxpol.gt.45 .and. ntxpol.le.135) cp='V' + else + cp='/' + if(ntxpol.ge.90 .and. ntxpol.lt.180) cp='\\' + endif + endif + endif +!### + +!### +! write(62,3010) ikHz,nfreq,npol,nutc,dtx,nsnr,cmode(1:1),decoded, & +! irc,sync,sync2 +!3010 format(i3,i5,i4,i6.4,f5.1,i5,1x,a1,1x,a22,i3,2f7.1) +!### + if(irc.ge.0) then - write(*,1010) ikHz,nfreq,npol,nutc,dtx,nsnr,cmode,decoded,irc,ntxpol,cp -1010 format('!',i3,i5,i4,i6.4,f5.1,i5,1x,a1,1x,a22,i2,i5,1x,a1) + write(*,1010) ikHz,nfreq,npol,nutc,dtx,nsnr,cmode(1:1),decoded, & + irc,ntxpol,cp +1010 format('!',i3,i5,i4,i6.4,f5.1,i5,1x,a1,1x,a22,i2,i5,6x,a1) nwrite_qra64=nwrite_qra64+1 freq=144.0 + 0.001*ikhz - write(21,1014) freq,nfreq,0,0,0,dtx,npol,int(sync1), & - int(sync2),nutc,decoded,cp,'$' -1014 format(f8.3,i5,3i3,f5.1,i4,i3,i4,i5.4,4x,a22,2x,a1,3x,a1) + write(21,1014) freq,nfreq,dtx,npol,nsnr,nutc,decoded,cp, & + cmode(1:1),cmode(2:2) +1014 format(f8.3,i5,f5.1,2i4,i5.4,2x,a22,2x,a1,3x,a1,1x,a1) + + if(index(decoded,' CQ ').gt.0 .or. index(decoded,' QRZ ').gt.0 .or. & + index(decoded,' QRT ').gt.0 .or. index(decoded,' CQV ').gt.0 .or. & + index(decoded,' CQH ').gt.0) then + write(19,1016) ikhz,nfreq,npol,nutc,dtx,nsnr,decoded,0,cmode +1016 format(i3,i5,i4,i5.4,f7.1,i4,2x,a22,i3,1x,a2) + flush(19) + endif else - write(*,1010) ikHz,nfreq,npol,nutc,dtx,nsnr,cmode + write(*,1010) ikHz,nfreq,npol,nutc,dtx,nsnr nwrite_qra64=nwrite_qra64+1 endif -999 return + return end subroutine qra64c diff --git a/libm65/qra64d.f90 b/libm65/qra64d.f90 new file mode 100644 index 000000000..e4a91fe8a --- /dev/null +++ b/libm65/qra64d.f90 @@ -0,0 +1,48 @@ +program qra64d + + use packjt + parameter (NFFT2=336000) !56*6000 (downsampled by 1/16) + parameter (NMAX=60*12000,LN=1152*63) + + character decoded*22 + character*12 mycall_12,hiscall_12 + character*6 mycall,hiscall,hisgrid_6 + character*4 hisgrid + character*1 cp + logical ltext + complex cx(0:NFFT2-1),cy(0:NFFT2-1) + complex c00(0:720000) !Complex spectrum of dd() + complex c0(0:720000) !Complex data for dd() + real a(3) + real s3(LN) !Symbol spectra + real s3a(LN) !Symbol spectra + integer dat4(12) !Decoded message (as 12 integers) + integer dat4x(12) + integer nap(0:11) + data nap/0,2,3,2,3,4,2,3,6,4,6,6/ + data nc1z/-1/,nc2z/-1/,ng2z/-1/,maxaptypez/-1/ + common/tracer/ limtrace,lu + + limtrace=0 + lu=12 + open(12,file='timer.out',status='unknown') + call timer('qra64d ',0) + nzap=1 + +1 read(60,end=900) cx,cy,nutc,nqd,ikhz,mousedf,ntol,xpol,mycall_12, & + hiscall_12,hisgrid_6 + +! Eliminate birdies: + if(nzap.gt.0) call qra64zap(cx,cy,nzap) + +! Transform back to time domain with sample rate 6000 Hz. + call four2a(cx,NFFT2,1,-1,1) + call four2a(cy,NFFT2,1,-1,1) + + call qra64c(cx,cy,nutc,nqd,ikhz,mousedf,ntol,xpol,mycall_12, & + hiscall_12,hisgrid_6,nwrite_qra64) + goto 1 +900 call timer('qra64d ',1) + call timer('qra64d ',101) + +end program qra64d