diff options
Diffstat (limited to 'lib/ft4')
| -rwxr-xr-x | lib/ft4/clockit.f90 | 222 | ||||
| -rwxr-xr-x | lib/ft4/ft4_downsample.f90 | 96 | ||||
| -rwxr-xr-x | lib/ft4/ft4_testmsg.f90 | 100 | ||||
| -rwxr-xr-x | lib/ft4/ft4code.f90 | 204 | ||||
| -rwxr-xr-x | lib/ft4/ft4sim.f90 | 250 | ||||
| -rwxr-xr-x | lib/ft4/ft4sim_mult.f90 | 206 | ||||
| -rwxr-xr-x | lib/ft4/gen_ft4wave.f90 | 132 | ||||
| -rwxr-xr-x | lib/ft4/genft4.f90 | 180 | ||||
| -rwxr-xr-x | lib/ft4/get_ft4_bitmetrics.f90 | 232 | ||||
| -rwxr-xr-x | lib/ft4/getcandidates4.f90 | 166 | ||||
| -rwxr-xr-x | lib/ft4/messages.txt | 324 | ||||
| -rwxr-xr-x | lib/ft4/subtractft4.f90 | 132 | ||||
| -rwxr-xr-x | lib/ft4/sync4d.f90 | 192 |
13 files changed, 1218 insertions, 1218 deletions
diff --git a/lib/ft4/clockit.f90 b/lib/ft4/clockit.f90 index eb3e7d8b..9315ae5d 100755 --- a/lib/ft4/clockit.f90 +++ b/lib/ft4/clockit.f90 @@ -1,111 +1,111 @@ -subroutine clockit(dname,k) - -! Times procedure number n between a call with k=0 (tstart) and with -! k=1 (tstop). Accumulates sums of these times in array ut (user time). -! Also traces all calls (for debugging purposes) if limtrace.gt.0 - - character*8 dname,name(50),space,ename - character*16 sname - character*512 data_dir,fname - logical first,on(50) - real ut(50),ut0(50),dut(50),tt(2) - integer ncall(50),nlevel(50),nparent(50) - integer onlevel(0:10) - data first/.true./,eps/0.000001/,ntrace/0/ - data level/0/,nmax/0/,space/' '/ - data limtrace/0/,lu/29/,ntimer/1/ -! data limtrace/1000000/,lu/29/,ntimer/1/ - save - - if(ntimer.eq.0) return - if(lu.lt.1) lu=6 - if(k.gt.1) go to 40 !Check for "all done" (k>1) - onlevel(0)=0 - - do n=1,nmax !Check for existing name - if(name(n).eq.dname) go to 20 - enddo - - nmax=nmax+1 !This is a new one - n=nmax - ncall(n)=0 - on(n)=.false. - ut(n)=eps - name(n)=dname - -20 if(k.eq.0) then !Get start times (k=0) - if(on(n)) print*,'Error in timer: ',dname,' already on.' - level=level+1 !Increment the level - on(n)=.true. - ut0(n)=etime(tt) - ncall(n)=ncall(n)+1 - if(ncall(n).gt.1.and.nlevel(n).ne.level) then - nlevel(n)=-1 - else - nlevel(n)=level - endif - nparent(n)=onlevel(level-1) - onlevel(level)=n - - else if(k.eq.1) then !Get stop times and accumulate sums. (k=1) - if(on(n)) then - on(n)=.false. - ut1=etime(tt) - ut(n)=ut(n)+ut1-ut0(n) - endif - level=level-1 - endif - - ntrace=ntrace+1 - if(ntrace.lt.limtrace) write(28,1020) ntrace,dname,k,level,nparent(n) -1020 format(i8,': ',a8,3i5) - return - -! Write out the timer statistics - -40 open(lu,file=trim(fname),status='unknown') - write(lu,1040) -1040 format(/' name time frac dtime', & - ' dfrac calls level parent'/73('-')) - - if(k.gt.100) then - ndiv=k-100 - do i=1,nmax - ncall(i)=ncall(i)/ndiv - ut(i)=ut(i)/ndiv - enddo - endif - - total=ut(1) - sum=0. - sumf=0. - do i=1,nmax - dut(i)=ut(i) - do j=i,nmax - if(nparent(j).eq.i) dut(i)=dut(i)-ut(j) - enddo - utf=ut(i)/total - dutf=dut(i)/total - sum=sum+dut(i) - sumf=sumf+dutf - kk=nlevel(i) - sname=space(1:kk)//name(i)//space(1:8-kk) - ename=space - if(i.ge.2) ename=name(nparent(i)) - write(lu,1060) float(i),sname,ut(i),utf,dut(i),dutf, & - ncall(i),nlevel(i),ename -1060 format(f4.0,a16,2(f10.2,f6.2),i7,i5,2x,a8) - enddo - - write(lu,1070) sum,sumf -1070 format(/36x,f10.2,f6.2) - close(lu) - return - - entry clockit2(data_dir) - l1=index(data_dir,char(0))-1 - if(l1.ge.1) data_dir(l1+1:l1+1)='/' - fname=data_dir(1:l1+1)//'clockit.out' - return - -end subroutine clockit +subroutine clockit(dname,k)
+
+! Times procedure number n between a call with k=0 (tstart) and with
+! k=1 (tstop). Accumulates sums of these times in array ut (user time).
+! Also traces all calls (for debugging purposes) if limtrace.gt.0
+
+ character*8 dname,name(50),space,ename
+ character*16 sname
+ character*512 data_dir,fname
+ logical first,on(50)
+ real ut(50),ut0(50),dut(50),tt(2)
+ integer ncall(50),nlevel(50),nparent(50)
+ integer onlevel(0:10)
+ data first/.true./,eps/0.000001/,ntrace/0/
+ data level/0/,nmax/0/,space/' '/
+ data limtrace/0/,lu/29/,ntimer/1/
+! data limtrace/1000000/,lu/29/,ntimer/1/
+ save
+
+ if(ntimer.eq.0) return
+ if(lu.lt.1) lu=6
+ if(k.gt.1) go to 40 !Check for "all done" (k>1)
+ onlevel(0)=0
+
+ do n=1,nmax !Check for existing name
+ if(name(n).eq.dname) go to 20
+ enddo
+
+ nmax=nmax+1 !This is a new one
+ n=nmax
+ ncall(n)=0
+ on(n)=.false.
+ ut(n)=eps
+ name(n)=dname
+
+20 if(k.eq.0) then !Get start times (k=0)
+ if(on(n)) print*,'Error in timer: ',dname,' already on.'
+ level=level+1 !Increment the level
+ on(n)=.true.
+ ut0(n)=etime(tt)
+ ncall(n)=ncall(n)+1
+ if(ncall(n).gt.1.and.nlevel(n).ne.level) then
+ nlevel(n)=-1
+ else
+ nlevel(n)=level
+ endif
+ nparent(n)=onlevel(level-1)
+ onlevel(level)=n
+
+ else if(k.eq.1) then !Get stop times and accumulate sums. (k=1)
+ if(on(n)) then
+ on(n)=.false.
+ ut1=etime(tt)
+ ut(n)=ut(n)+ut1-ut0(n)
+ endif
+ level=level-1
+ endif
+
+ ntrace=ntrace+1
+ if(ntrace.lt.limtrace) write(28,1020) ntrace,dname,k,level,nparent(n)
+1020 format(i8,': ',a8,3i5)
+ return
+
+! Write out the timer statistics
+
+40 open(lu,file=trim(fname),status='unknown')
+ write(lu,1040)
+1040 format(/' name time frac dtime', &
+ ' dfrac calls level parent'/73('-'))
+
+ if(k.gt.100) then
+ ndiv=k-100
+ do i=1,nmax
+ ncall(i)=ncall(i)/ndiv
+ ut(i)=ut(i)/ndiv
+ enddo
+ endif
+
+ total=ut(1)
+ sum=0.
+ sumf=0.
+ do i=1,nmax
+ dut(i)=ut(i)
+ do j=i,nmax
+ if(nparent(j).eq.i) dut(i)=dut(i)-ut(j)
+ enddo
+ utf=ut(i)/total
+ dutf=dut(i)/total
+ sum=sum+dut(i)
+ sumf=sumf+dutf
+ kk=nlevel(i)
+ sname=space(1:kk)//name(i)//space(1:8-kk)
+ ename=space
+ if(i.ge.2) ename=name(nparent(i))
+ write(lu,1060) float(i),sname,ut(i),utf,dut(i),dutf, &
+ ncall(i),nlevel(i),ename
+1060 format(f4.0,a16,2(f10.2,f6.2),i7,i5,2x,a8)
+ enddo
+
+ write(lu,1070) sum,sumf
+1070 format(/36x,f10.2,f6.2)
+ close(lu)
+ return
+
+ entry clockit2(data_dir)
+ l1=index(data_dir,char(0))-1
+ if(l1.ge.1) data_dir(l1+1:l1+1)='/'
+ fname=data_dir(1:l1+1)//'clockit.out'
+ return
+
+end subroutine clockit
diff --git a/lib/ft4/ft4_downsample.f90 b/lib/ft4/ft4_downsample.f90 index a6305c83..d01986bd 100755 --- a/lib/ft4/ft4_downsample.f90 +++ b/lib/ft4/ft4_downsample.f90 @@ -1,48 +1,48 @@ -subroutine ft4_downsample(dd,newdata,f0,c) - - include 'ft4_params.f90' - parameter (NFFT2=NMAX/NDOWN) - real dd(NMAX) - complex c(0:NMAX/NDOWN-1) - complex c1(0:NFFT2-1) - complex cx(0:NMAX/2) - real x(NMAX), window(0:NFFT2-1) - equivalence (x,cx) - logical first, newdata - data first/.true./ - save first,window,x - - df=12000.0/NMAX - baud=12000.0/NSPS - if(first) then - bw_transition = 0.5*baud - bw_flat = 4*baud - iwt = bw_transition / df - iwf = bw_flat / df - pi=4.0*atan(1.0) - window(0:iwt-1) = 0.5*(1+cos(pi*(/(i,i=iwt-1,0,-1)/)/iwt)) - window(iwt:iwt+iwf-1)=1.0 - window(iwt+iwf:2*iwt+iwf-1) = 0.5*(1+cos(pi*(/(i,i=0,iwt-1)/)/iwt)) - window(2*iwt+iwf:)=0.0 - iws = baud / df - window=cshift(window,iws) - first=.false. - endif - - if(newdata) then - x=dd - call four2a(cx,NMAX,1,-1,0) !r2c FFT to freq domain - endif - i0=nint(f0/df) - c1=0. - if(i0.ge.0 .and. i0.le.NMAX/2) c1(0)=cx(i0) - do i=1,NFFT2/2 - if(i0+i.ge.0 .and. i0+i.le.NMAX/2) c1(i)=cx(i0+i) - if(i0-i.ge.0 .and. i0-i.le.NMAX/2) c1(NFFT2-i)=cx(i0-i) - enddo - c1=c1*window/NFFT2 - call four2a(c1,NFFT2,1,1,1) !c2c FFT back to time domain - c=c1(0:NMAX/NDOWN-1) - - return -end subroutine ft4_downsample +subroutine ft4_downsample(dd,newdata,f0,c)
+
+ include 'ft4_params.f90'
+ parameter (NFFT2=NMAX/NDOWN)
+ real dd(NMAX)
+ complex c(0:NMAX/NDOWN-1)
+ complex c1(0:NFFT2-1)
+ complex cx(0:NMAX/2)
+ real x(NMAX), window(0:NFFT2-1)
+ equivalence (x,cx)
+ logical first, newdata
+ data first/.true./
+ save first,window,x
+
+ df=12000.0/NMAX
+ baud=12000.0/NSPS
+ if(first) then
+ bw_transition = 0.5*baud
+ bw_flat = 4*baud
+ iwt = bw_transition / df
+ iwf = bw_flat / df
+ pi=4.0*atan(1.0)
+ window(0:iwt-1) = 0.5*(1+cos(pi*(/(i,i=iwt-1,0,-1)/)/iwt))
+ window(iwt:iwt+iwf-1)=1.0
+ window(iwt+iwf:2*iwt+iwf-1) = 0.5*(1+cos(pi*(/(i,i=0,iwt-1)/)/iwt))
+ window(2*iwt+iwf:)=0.0
+ iws = baud / df
+ window=cshift(window,iws)
+ first=.false.
+ endif
+
+ if(newdata) then
+ x=dd
+ call four2a(cx,NMAX,1,-1,0) !r2c FFT to freq domain
+ endif
+ i0=nint(f0/df)
+ c1=0.
+ if(i0.ge.0 .and. i0.le.NMAX/2) c1(0)=cx(i0)
+ do i=1,NFFT2/2
+ if(i0+i.ge.0 .and. i0+i.le.NMAX/2) c1(i)=cx(i0+i)
+ if(i0-i.ge.0 .and. i0-i.le.NMAX/2) c1(NFFT2-i)=cx(i0-i)
+ enddo
+ c1=c1*window/NFFT2
+ call four2a(c1,NFFT2,1,1,1) !c2c FFT back to time domain
+ c=c1(0:NMAX/NDOWN-1)
+
+ return
+end subroutine ft4_downsample
diff --git a/lib/ft4/ft4_testmsg.f90 b/lib/ft4/ft4_testmsg.f90 index 0d700ead..3c00d6f6 100755 --- a/lib/ft4/ft4_testmsg.f90 +++ b/lib/ft4/ft4_testmsg.f90 @@ -1,50 +1,50 @@ - parameter (MAXTEST=75,NTEST=47) - character*37 testmsg(MAXTEST) - data testmsg(1:NTEST)/ & - "TNX BOB 73 GL", & ! 0.0 - "PA9XYZ 590003 IO91NP", & ! 0.2 - "G4ABC/P R 570007 JO22DB", & ! 0.2 - "K1ABC W9XYZ 6A WI", & ! 0.3 - "W9XYZ K1ABC R 17B EMA", & ! 0.3 - "123456789ABCDEF012", & ! 0.5 - "CQ K1ABC FN42", & ! 1. - "K1ABC W9XYZ EN37", & ! 1. - "W9XYZ K1ABC -11", & ! 1. - "K1ABC W9XYZ R-09", & ! 1. - "W9XYZ K1ABC RRR", & ! 1. - "K1ABC W9XYZ 73", & ! 1. - "K1ABC W9XYZ RR73", & ! 1. - "CQ FD K1ABC FN42", & ! 1. - "CQ TEST K1ABC/R FN42", & ! 1. - "K1ABC/R W9XYZ EN37", & ! 1. - "W9XYZ K1ABC/R R FN42", & ! 1. - "K1ABC/R W9XYZ RR73", & ! 1. - "CQ TEST K1ABC FN42", & ! 1. - "W9XYZ <PJ4/K1ABC> -11", & ! 1. - "<PJ4/K1ABC> W9XYZ R-09", & ! 1. - "CQ W9XYZ EN37", & ! 1. - "<YW18FIFA> W9XYZ -11", & ! 1. - "W9XYZ <YW18FIFA> R-09", & ! 1. - "<YW18FIFA> KA1ABC", & ! 1. - "KA1ABC <YW18FIFA> -11", & ! 1. - "<YW18FIFA> KA1ABC R-17", & ! 1. - "<YW18FIFA> KA1ABC 73", & ! 1. - "CQ G4ABC/P IO91", & ! 2. - "G4ABC/P PA9XYZ JO22", & ! 2. - "PA9XYZ G4ABC/P RR73", & ! 2. - "K1ABC W9XYZ 579 WI", & ! 3. - "W9XYZ K1ABC R 589 MA", & ! 3. - "K1ABC KA0DEF 559 MO", & ! 3. - "TU; KA0DEF K1ABC R 569 MA", & ! 3. - "KA1ABC G3AAA 529 0013", & ! 3. - "TU; G3AAA K1ABC R 559 MA", & ! 3. - "CQ KH1/KH7Z", & ! 4. - "CQ PJ4/K1ABC", & ! 4. - "PJ4/K1ABC <W9XYZ>", & ! 4. - "<W9XYZ> PJ4/K1ABC RRR", & ! 4. - "PJ4/K1ABC <W9XYZ> 73", & ! 4. - "<W9XYZ> YW18FIFA", & ! 4. - "YW18FIFA <W9XYZ> RRR", & ! 4. - "<W9XYZ> YW18FIFA 73", & ! 4. - "CQ YW18FIFA", & ! 4. - "<KA1ABC> YW18FIFA RR73"/ + parameter (MAXTEST=75,NTEST=47)
+ character*37 testmsg(MAXTEST)
+ data testmsg(1:NTEST)/ &
+ "TNX BOB 73 GL", & ! 0.0
+ "PA9XYZ 590003 IO91NP", & ! 0.2
+ "G4ABC/P R 570007 JO22DB", & ! 0.2
+ "K1ABC W9XYZ 6A WI", & ! 0.3
+ "W9XYZ K1ABC R 17B EMA", & ! 0.3
+ "123456789ABCDEF012", & ! 0.5
+ "CQ K1ABC FN42", & ! 1.
+ "K1ABC W9XYZ EN37", & ! 1.
+ "W9XYZ K1ABC -11", & ! 1.
+ "K1ABC W9XYZ R-09", & ! 1.
+ "W9XYZ K1ABC RRR", & ! 1.
+ "K1ABC W9XYZ 73", & ! 1.
+ "K1ABC W9XYZ RR73", & ! 1.
+ "CQ FD K1ABC FN42", & ! 1.
+ "CQ TEST K1ABC/R FN42", & ! 1.
+ "K1ABC/R W9XYZ EN37", & ! 1.
+ "W9XYZ K1ABC/R R FN42", & ! 1.
+ "K1ABC/R W9XYZ RR73", & ! 1.
+ "CQ TEST K1ABC FN42", & ! 1.
+ "W9XYZ <PJ4/K1ABC> -11", & ! 1.
+ "<PJ4/K1ABC> W9XYZ R-09", & ! 1.
+ "CQ W9XYZ EN37", & ! 1.
+ "<YW18FIFA> W9XYZ -11", & ! 1.
+ "W9XYZ <YW18FIFA> R-09", & ! 1.
+ "<YW18FIFA> KA1ABC", & ! 1.
+ "KA1ABC <YW18FIFA> -11", & ! 1.
+ "<YW18FIFA> KA1ABC R-17", & ! 1.
+ "<YW18FIFA> KA1ABC 73", & ! 1.
+ "CQ G4ABC/P IO91", & ! 2.
+ "G4ABC/P PA9XYZ JO22", & ! 2.
+ "PA9XYZ G4ABC/P RR73", & ! 2.
+ "K1ABC W9XYZ 579 WI", & ! 3.
+ "W9XYZ K1ABC R 589 MA", & ! 3.
+ "K1ABC KA0DEF 559 MO", & ! 3.
+ "TU; KA0DEF K1ABC R 569 MA", & ! 3.
+ "KA1ABC G3AAA 529 0013", & ! 3.
+ "TU; G3AAA K1ABC R 559 MA", & ! 3.
+ "CQ KH1/KH7Z", & ! 4.
+ "CQ PJ4/K1ABC", & ! 4.
+ "PJ4/K1ABC <W9XYZ>", & ! 4.
+ "<W9XYZ> PJ4/K1ABC RRR", & ! 4.
+ "PJ4/K1ABC <W9XYZ> 73", & ! 4.
+ "<W9XYZ> YW18FIFA", & ! 4.
+ "YW18FIFA <W9XYZ> RRR", & ! 4.
+ "<W9XYZ> YW18FIFA 73", & ! 4.
+ "CQ YW18FIFA", & ! 4.
+ "<KA1ABC> YW18FIFA RR73"/
diff --git a/lib/ft4/ft4code.f90 b/lib/ft4/ft4code.f90 index dae55245..51b16460 100755 --- a/lib/ft4/ft4code.f90 +++ b/lib/ft4/ft4code.f90 @@ -1,102 +1,102 @@ -program ft4code - -! Provides examples of message packing, LDPC(174,91) encoding, bit and -! symbol ordering, and other details of the FT8 protocol. - - use packjt77 - include 'ft4_params.f90' !Set various constants - include 'ft4_testmsg.f90' - parameter (NWAVE=NN*NSPS) - - character*37 msg,msgsent - character*77 c77 - character*9 comment - character bad*1,msgtype*18 - integer itone(NN) - integer*1 msgbits(77),rvec(77),codeword(174) - data rvec/0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0, & - 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/ - -! Get command-line argument(s) - nargs=iargc() - if(nargs.ne.1 .and. nargs.ne.3) then - print* - print*,'Program ft4code: Provides examples of message packing, ', & - 'LDPC(174,91) encoding,' - print*,'bit and symbol ordering, and other details of the FT4 protocol.' - print* - print*,'Usage: ft4code [-c grid] "message" # Results for specified message' - print*,' ft4code -t # Examples of all message types' - go to 999 - endif - - call getarg(1,msg) !Message to be transmitted - if(len(trim(msg)).eq.2 .and. msg(1:2).eq.'-t') then - nmsg=NTEST - else - call fmtmsg(msg,iz) !To upper case; collapse multiple blanks - nmsg=1 - endif - - write(*,1010) -1010 format(4x,'Message',31x,'Decoded',29x,'Err i3.n3'/100('-')) - - do imsg=1,nmsg - if(nmsg.gt.1) msg=testmsg(imsg) - -! Generate msgsent, msgbits, and itone - i3=-1 - n3=-1 - call pack77(msg,i3,n3,c77) - call genft4(msg,0,msgsent,msgbits,itone) - call encode174_91(msgbits,codeword) - msgtype="" - if(i3.eq.0) then - if(n3.eq.0) msgtype="Free text" - if(n3.eq.1) msgtype="DXpedition mode" - if(n3.eq.2) msgtype="EU VHF Contest" - if(n3.eq.3) msgtype="ARRL Field Day" - if(n3.eq.4) msgtype="ARRL Field Day" - if(n3.eq.5) msgtype="Telemetry" - if(n3.ge.6) msgtype="Undefined type" - endif - if(i3.eq.1) msgtype="Standard msg" - if(i3.eq.2) msgtype="EU VHF Contest" - if(i3.eq.3) msgtype="ARRL RTTY Roundup" - if(i3.eq.4) msgtype="Nonstandard calls" - if(i3.eq.5) msgtype="EU VHF Contest" - if(i3.ge.6) msgtype="Undefined msg type" - if(i3.ge.1) n3=-1 - bad=" " - comment=' ' - if(msg.ne.msgsent) bad="*" - if(n3.ge.0) then - write(*,1020) imsg,msg,msgsent,bad,i3,n3,msgtype,comment -1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a18,1x,a9) - else - write(*,1022) imsg,msg,msgsent,bad,i3,msgtype,comment -1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a18,1x,a9) - endif - enddo - - if(nmsg.eq.1) then - write(*,1030) ieor(msgbits,rvec) -1030 format(/'Source-encoded message before scrambling, 77 bits: ',/77i1) - write(*,1032) rvec -1032 format(/'Scrambling vector, 77 bits: ',/77i1) - write(*,1034) msgbits -1034 format(/'Source-encoded message after scrambling, 77 bits:'/77i1) - write(*,1036) codeword(78:91) -1036 format(/'14-bit CRC: ',/14i1) - write(*,1038) codeword(92:174) -1038 format(/'83 Parity bits: ',/83i1) - write(*,1040) 0,itone,0 -1040 format(/'Channel symbols (105 tones):'/ & - 'R Sync',13x,'Data',13x, & - ' Sync',13x,'Data',13x, & - ' Sync',13x,'Data',13x,' Sync R'/ & - i1,1x,4i1,1x,29i1,1x,4i1,1x,29i1,1x,4i1,1x,29i1,1x,4i1,i2) - endif - -999 end program ft4code +program ft4code
+
+! Provides examples of message packing, LDPC(174,91) encoding, bit and
+! symbol ordering, and other details of the FT8 protocol.
+
+ use packjt77
+ include 'ft4_params.f90' !Set various constants
+ include 'ft4_testmsg.f90'
+ parameter (NWAVE=NN*NSPS)
+
+ character*37 msg,msgsent
+ character*77 c77
+ character*9 comment
+ character bad*1,msgtype*18
+ integer itone(NN)
+ integer*1 msgbits(77),rvec(77),codeword(174)
+ data rvec/0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0, &
+ 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/
+
+! Get command-line argument(s)
+ nargs=iargc()
+ if(nargs.ne.1 .and. nargs.ne.3) then
+ print*
+ print*,'Program ft4code: Provides examples of message packing, ', &
+ 'LDPC(174,91) encoding,'
+ print*,'bit and symbol ordering, and other details of the FT4 protocol.'
+ print*
+ print*,'Usage: ft4code [-c grid] "message" # Results for specified message'
+ print*,' ft4code -t # Examples of all message types'
+ go to 999
+ endif
+
+ call getarg(1,msg) !Message to be transmitted
+ if(len(trim(msg)).eq.2 .and. msg(1:2).eq.'-t') then
+ nmsg=NTEST
+ else
+ call fmtmsg(msg,iz) !To upper case; collapse multiple blanks
+ nmsg=1
+ endif
+
+ write(*,1010)
+1010 format(4x,'Message',31x,'Decoded',29x,'Err i3.n3'/100('-'))
+
+ do imsg=1,nmsg
+ if(nmsg.gt.1) msg=testmsg(imsg)
+
+! Generate msgsent, msgbits, and itone
+ i3=-1
+ n3=-1
+ call pack77(msg,i3,n3,c77)
+ call genft4(msg,0,msgsent,msgbits,itone)
+ call encode174_91(msgbits,codeword)
+ msgtype=""
+ if(i3.eq.0) then
+ if(n3.eq.0) msgtype="Free text"
+ if(n3.eq.1) msgtype="DXpedition mode"
+ if(n3.eq.2) msgtype="EU VHF Contest"
+ if(n3.eq.3) msgtype="ARRL Field Day"
+ if(n3.eq.4) msgtype="ARRL Field Day"
+ if(n3.eq.5) msgtype="Telemetry"
+ if(n3.ge.6) msgtype="Undefined type"
+ endif
+ if(i3.eq.1) msgtype="Standard msg"
+ if(i3.eq.2) msgtype="EU VHF Contest"
+ if(i3.eq.3) msgtype="ARRL RTTY Roundup"
+ if(i3.eq.4) msgtype="Nonstandard calls"
+ if(i3.eq.5) msgtype="EU VHF Contest"
+ if(i3.ge.6) msgtype="Undefined msg type"
+ if(i3.ge.1) n3=-1
+ bad=" "
+ comment=' '
+ if(msg.ne.msgsent) bad="*"
+ if(n3.ge.0) then
+ write(*,1020) imsg,msg,msgsent,bad,i3,n3,msgtype,comment
+1020 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',i1,1x,a18,1x,a9)
+ else
+ write(*,1022) imsg,msg,msgsent,bad,i3,msgtype,comment
+1022 format(i2,'.',1x,a37,1x,a37,1x,a1,2x,i1,'.',1x,1x,a18,1x,a9)
+ endif
+ enddo
+
+ if(nmsg.eq.1) then
+ write(*,1030) ieor(msgbits,rvec)
+1030 format(/'Source-encoded message before scrambling, 77 bits: ',/77i1)
+ write(*,1032) rvec
+1032 format(/'Scrambling vector, 77 bits: ',/77i1)
+ write(*,1034) msgbits
+1034 format(/'Source-encoded message after scrambling, 77 bits:'/77i1)
+ write(*,1036) codeword(78:91)
+1036 format(/'14-bit CRC: ',/14i1)
+ write(*,1038) codeword(92:174)
+1038 format(/'83 Parity bits: ',/83i1)
+ write(*,1040) 0,itone,0
+1040 format(/'Channel symbols (105 tones):'/ &
+ 'R Sync',13x,'Data',13x, &
+ ' Sync',13x,'Data',13x, &
+ ' Sync',13x,'Data',13x,' Sync R'/ &
+ i1,1x,4i1,1x,29i1,1x,4i1,1x,29i1,1x,4i1,1x,29i1,1x,4i1,i2)
+ endif
+
+999 end program ft4code
diff --git a/lib/ft4/ft4sim.f90 b/lib/ft4/ft4sim.f90 index cef22303..e7df86e3 100755 --- a/lib/ft4/ft4sim.f90 +++ b/lib/ft4/ft4sim.f90 @@ -1,125 +1,125 @@ -program ft4sim - -! Generate simulated signals for experimental "FT4" mode - - use wavhdr - use packjt77 - include 'ft4_params.f90' !Set various constants - type(hdr) h !Header for .wav file - character arg*12,fname*17 - character msg37*37,msgsent37*37 - character c77*77 - complex c0(0:NMAX-1) - complex c(0:NMAX-1) - real wave(NMAX) - integer itone(NN) - integer*1 msgbits(77) - integer*2 iwave(NMAX) !Generated full-length waveform - integer icos4(4) - data icos4/0,1,3,2/ - -! Get command-line argument(s) - nargs=iargc() - if(nargs.ne.7) then - print*,'Usage: ft4sim "message" f0 DT fdop del nfiles snr' - print*,'Examples: ft4sim "CQ W9XYZ EN37" 1500 0.0 0.1 1.0 10 -15' - print*,' ft4sim "K1ABC W9XYZ R 539 WI" 1500 0.0 0.1 1.0 10 -15' - go to 999 - endif - call getarg(1,msg37) !Message to be transmitted - call getarg(2,arg) - read(arg,*) f0 !Frequency (only used for single-signal) - call getarg(3,arg) - read(arg,*) xdt !Time offset from nominal (s) - call getarg(4,arg) - read(arg,*) fspread !Watterson frequency spread (Hz) - call getarg(5,arg) - read(arg,*) delay !Watterson delay (ms) - call getarg(6,arg) - read(arg,*) nfiles !Number of files - call getarg(7,arg) - read(arg,*) snrdb !SNR_2500 - - nfiles=abs(nfiles) - twopi=8.0*atan(1.0) - fs=12000.0 !Sample rate (Hz) - dt=1.0/fs !Sample interval (s) - hmod=1.0 !Modulation index (0.5 is MSK, 1.0 is FSK) - tt=NSPS*dt !Duration of symbols (s) - baud=1.0/tt !Keying rate (baud) - txt=NZ2*dt !Transmission length (s) - - bandwidth_ratio=2500.0/(fs/2.0) - sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*snrdb) - if(snrdb.gt.90.0) sig=1.0 - - ! Source-encode, then get itone() - i3=-1 - n3=-1 - call pack77(msg37,i3,n3,c77) - read(c77,'(77i1)') msgbits - call genft4(msg37,0,msgsent37,msgbits,itone) - write(*,*) - write(*,'(a9,a37,3x,a7,i1,a1,i1)') 'Message: ',msgsent37,'i3.n3: ',i3,'.',n3 - write(*,1000) f0,xdt,txt,snrdb -1000 format('f0:',f9.3,' DT:',f6.2,' TxT:',f6.1,' SNR:',f6.1) - write(*,*) - if(i3.eq.1) then - write(*,*) ' mycall hiscall hisgrid' - write(*,'(28i1,1x,i1,1x,28i1,1x,i1,1x,i1,1x,15i1,1x,3i1)') msgbits(1:77) - else - write(*,'(a14)') 'Message bits: ' - write(*,'(77i1)') msgbits - endif - write(*,*) - write(*,'(a17)') 'Channel symbols: ' - write(*,'(76i1)') itone - write(*,*) - - call sgran() - - fsample=12000.0 - icmplx=1 - call gen_ft4wave(itone,NN,NSPS,fsample,f0,c0,wave,icmplx,NMAX) - - k=nint((xdt+0.5)/dt)-NSPS - c0=cshift(c0,-k) - if(k.gt.0) c0(0:k-1)=0.0 - if(k.lt.0) c0(NMAX+k:NMAX-1)=0.0 - - do ifile=1,nfiles - c=c0 - if(fspread.ne.0.0 .or. delay.ne.0.0) call watterson(c,NMAX,NZ,fs,delay,fspread) - c=sig*c - wave=real(c) - peak=maxval(abs(wave)) - nslots=1 - - if(snrdb.lt.90) then - do i=1,NMAX !Add gaussian noise at specified SNR - xnoise=gran() - wave(i)=wave(i) + xnoise - enddo - endif - - gain=100.0 - if(snrdb.lt.90.0) then - wave=gain*wave - else - datpk=maxval(abs(wave)) - fac=32766.9/datpk - wave=fac*wave - endif - if(any(abs(wave).gt.32767.0)) print*,"Warning - data will be clipped." - iwave=nint(wave) - h=default_header(12000,NMAX) - write(fname,1102) ifile -1102 format('000000_',i6.6,'.wav') - open(10,file=fname,status='unknown',access='stream') - write(10) h,iwave !Save to *.wav file - close(10) - write(*,1110) ifile,xdt,f0,snrdb,fname -1110 format(i4,f7.2,f8.2,f7.1,2x,a17) - enddo - -999 end program ft4sim +program ft4sim
+
+! Generate simulated signals for experimental "FT4" mode
+
+ use wavhdr
+ use packjt77
+ include 'ft4_params.f90' !Set various constants
+ type(hdr) h !Header for .wav file
+ character arg*12,fname*17
+ character msg37*37,msgsent37*37
+ character c77*77
+ complex c0(0:NMAX-1)
+ complex c(0:NMAX-1)
+ real wave(NMAX)
+ integer itone(NN)
+ integer*1 msgbits(77)
+ integer*2 iwave(NMAX) !Generated full-length waveform
+ integer icos4(4)
+ data icos4/0,1,3,2/
+
+! Get command-line argument(s)
+ nargs=iargc()
+ if(nargs.ne.7) then
+ print*,'Usage: ft4sim "message" f0 DT fdop del nfiles snr'
+ print*,'Examples: ft4sim "CQ W9XYZ EN37" 1500 0.0 0.1 1.0 10 -15'
+ print*,' ft4sim "K1ABC W9XYZ R 539 WI" 1500 0.0 0.1 1.0 10 -15'
+ go to 999
+ endif
+ call getarg(1,msg37) !Message to be transmitted
+ call getarg(2,arg)
+ read(arg,*) f0 !Frequency (only used for single-signal)
+ call getarg(3,arg)
+ read(arg,*) xdt !Time offset from nominal (s)
+ call getarg(4,arg)
+ read(arg,*) fspread !Watterson frequency spread (Hz)
+ call getarg(5,arg)
+ read(arg,*) delay !Watterson delay (ms)
+ call getarg(6,arg)
+ read(arg,*) nfiles !Number of files
+ call getarg(7,arg)
+ read(arg,*) snrdb !SNR_2500
+
+ nfiles=abs(nfiles)
+ twopi=8.0*atan(1.0)
+ fs=12000.0 !Sample rate (Hz)
+ dt=1.0/fs !Sample interval (s)
+ hmod=1.0 !Modulation index (0.5 is MSK, 1.0 is FSK)
+ tt=NSPS*dt !Duration of symbols (s)
+ baud=1.0/tt !Keying rate (baud)
+ txt=NZ2*dt !Transmission length (s)
+
+ bandwidth_ratio=2500.0/(fs/2.0)
+ sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*snrdb)
+ if(snrdb.gt.90.0) sig=1.0
+
+ ! Source-encode, then get itone()
+ i3=-1
+ n3=-1
+ call pack77(msg37,i3,n3,c77)
+ read(c77,'(77i1)') msgbits
+ call genft4(msg37,0,msgsent37,msgbits,itone)
+ write(*,*)
+ write(*,'(a9,a37,3x,a7,i1,a1,i1)') 'Message: ',msgsent37,'i3.n3: ',i3,'.',n3
+ write(*,1000) f0,xdt,txt,snrdb
+1000 format('f0:',f9.3,' DT:',f6.2,' TxT:',f6.1,' SNR:',f6.1)
+ write(*,*)
+ if(i3.eq.1) then
+ write(*,*) ' mycall hiscall hisgrid'
+ write(*,'(28i1,1x,i1,1x,28i1,1x,i1,1x,i1,1x,15i1,1x,3i1)') msgbits(1:77)
+ else
+ write(*,'(a14)') 'Message bits: '
+ write(*,'(77i1)') msgbits
+ endif
+ write(*,*)
+ write(*,'(a17)') 'Channel symbols: '
+ write(*,'(76i1)') itone
+ write(*,*)
+
+ call sgran()
+
+ fsample=12000.0
+ icmplx=1
+ call gen_ft4wave(itone,NN,NSPS,fsample,f0,c0,wave,icmplx,NMAX)
+
+ k=nint((xdt+0.5)/dt)-NSPS
+ c0=cshift(c0,-k)
+ if(k.gt.0) c0(0:k-1)=0.0
+ if(k.lt.0) c0(NMAX+k:NMAX-1)=0.0
+
+ do ifile=1,nfiles
+ c=c0
+ if(fspread.ne.0.0 .or. delay.ne.0.0) call watterson(c,NMAX,NZ,fs,delay,fspread)
+ c=sig*c
+ wave=real(c)
+ peak=maxval(abs(wave))
+ nslots=1
+
+ if(snrdb.lt.90) then
+ do i=1,NMAX !Add gaussian noise at specified SNR
+ xnoise=gran()
+ wave(i)=wave(i) + xnoise
+ enddo
+ endif
+
+ gain=100.0
+ if(snrdb.lt.90.0) then
+ wave=gain*wave
+ else
+ datpk=maxval(abs(wave))
+ fac=32766.9/datpk
+ wave=fac*wave
+ endif
+ if(any(abs(wave).gt.32767.0)) print*,"Warning - data will be clipped."
+ iwave=nint(wave)
+ h=default_header(12000,NMAX)
+ write(fname,1102) ifile
+1102 format('000000_',i6.6,'.wav')
+ open(10,file=fname,status='unknown',access='stream')
+ write(10) h,iwave !Save to *.wav file
+ close(10)
+ write(*,1110) ifile,xdt,f0,snrdb,fname
+1110 format(i4,f7.2,f8.2,f7.1,2x,a17)
+ enddo
+
+999 end program ft4sim
diff --git a/lib/ft4/ft4sim_mult.f90 b/lib/ft4/ft4sim_mult.f90 index d93978e5..3eae91dc 100755 --- a/lib/ft4/ft4sim_mult.f90 +++ b/lib/ft4/ft4sim_mult.f90 @@ -1,103 +1,103 @@ -program ft4sim_mult - -! Generate simulated signals for experimental "FT4" mode - - use wavhdr - use packjt77 - include 'ft4_params.f90' !FT4 protocol constants - parameter (NWAVE=NN*NSPS) - parameter (NZZ=72576) !Length of .wav file (21*3456) - type(hdr) h !Header for .wav file - character arg*12,fname*17,cjunk*4 - character msg37*37,msgsent37*37,c77*77 - complex cwave0((NN+2)*NSPS) - real wave0((NN+2)*NSPS) - real wave(NZZ) - real tmp(NZZ) - integer itone(NN) - integer*1 msgbits(77) - integer*2 iwave(NZZ) !Generated full-length waveform - -! Get command-line argument(s) - nargs=iargc() - if(nargs.ne.2) then - print*,'Usage: ft4sim_mult nsigs nfiles' - print*,'Example: ft4sim_mult 20 8 ' - go to 999 - endif - call getarg(1,arg) - read(arg,*) nsigs !Number of signals - call getarg(2,arg) - read(arg,*) nfiles !Number of files - - twopi=8.0*atan(1.0) - fs=12000.0 !Sample rate (Hz) - dt=1.0/fs !Sample interval (s) - hmod=1.0 !Modulation index (0.5 is MSK, 1.0 is FSK) - tt=NSPS*dt !Duration of unsmoothed symbols (s) - baud=1.0/tt !Keying rate (baud) - txt=NZ*dt !Transmission length (s) without ramp up/down - bandwidth_ratio=2500.0/(fs/2.0) - txt=NN*NSPS/12000.0 - open(10,file='messages.txt',status='old',err=998) - - do ifile=1,nfiles -1 read(10,1001,end=999) cjunk,n -1001 format(a4,i2) - if(cjunk.ne.'File' .or. n.ne.ifile) go to 1 - wave=0. - write(fname,1002) ifile -1002 format('000000_',i6.6,'.wav') - - do isig=1,nsigs - read(10,1003,end=100) cjunk,isnr,xdt0,ifreq,msg37 -1003 format(a4,30x,i3,f5.1,i5,1x,a37) - if(cjunk.eq.'File') go to 100 - if(isnr.lt.-17) isnr=-17 - f0=ifreq*960.0/576.0 - call random_number(r) - xdt=r-0.5 -! Source-encode, then get itone() - i3=-1 - n3=-1 - call pack77(msg37,i3,n3,c77) - call genft4(msg37,0,msgsent37,msgbits,itone) - nwave0=(NN+2)*NSPS - icmplx=0 - call gen_ft4wave(itone,NN,NSPS,12000.0,f0,cwave0,wave0,icmplx,nwave0) - - k0=nint((xdt+0.5)/dt) - if(k0.lt.1) k0=1 - tmp(:k0-1)=0.0 - tmp(k0:k0+nwave0-1)=wave0 - tmp(k0+nwave0:)=0.0 - - ! Insert this signal into wave() array - sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*isnr) - wave=wave + sig*tmp - write(*,1100) fname(1:13),isig,isnr,xdt,nint(f0),msg37 -1100 format(a13,i4,i5,f5.1,i6,2x,a37) - enddo ! isig - -100 backspace 10 - - do i=1,NZZ !Add gaussian noise at specified SNR - xnoise=gran() - wave(i)=wave(i) + xnoise - enddo - - gain=30.0 - wave=gain*wave - if(any(abs(wave).gt.32767.0)) print*,"Warning - data will be clipped." - iwave=nint(wave) - h=default_header(12000,NZZ) - open(12,file=fname,status='unknown',access='stream') - write(12) h,iwave !Save to *.wav file - close(12) - print*,' ' - enddo ! ifile - go to 999 - -998 print*,'Cannot open file "messages.txt"' - -999 end program ft4sim_mult +program ft4sim_mult
+
+! Generate simulated signals for experimental "FT4" mode
+
+ use wavhdr
+ use packjt77
+ include 'ft4_params.f90' !FT4 protocol constants
+ parameter (NWAVE=NN*NSPS)
+ parameter (NZZ=72576) !Length of .wav file (21*3456)
+ type(hdr) h !Header for .wav file
+ character arg*12,fname*17,cjunk*4
+ character msg37*37,msgsent37*37,c77*77
+ complex cwave0((NN+2)*NSPS)
+ real wave0((NN+2)*NSPS)
+ real wave(NZZ)
+ real tmp(NZZ)
+ integer itone(NN)
+ integer*1 msgbits(77)
+ integer*2 iwave(NZZ) !Generated full-length waveform
+
+! Get command-line argument(s)
+ nargs=iargc()
+ if(nargs.ne.2) then
+ print*,'Usage: ft4sim_mult nsigs nfiles'
+ print*,'Example: ft4sim_mult 20 8 '
+ go to 999
+ endif
+ call getarg(1,arg)
+ read(arg,*) nsigs !Number of signals
+ call getarg(2,arg)
+ read(arg,*) nfiles !Number of files
+
+ twopi=8.0*atan(1.0)
+ fs=12000.0 !Sample rate (Hz)
+ dt=1.0/fs !Sample interval (s)
+ hmod=1.0 !Modulation index (0.5 is MSK, 1.0 is FSK)
+ tt=NSPS*dt !Duration of unsmoothed symbols (s)
+ baud=1.0/tt !Keying rate (baud)
+ txt=NZ*dt !Transmission length (s) without ramp up/down
+ bandwidth_ratio=2500.0/(fs/2.0)
+ txt=NN*NSPS/12000.0
+ open(10,file='messages.txt',status='old',err=998)
+
+ do ifile=1,nfiles
+1 read(10,1001,end=999) cjunk,n
+1001 format(a4,i2)
+ if(cjunk.ne.'File' .or. n.ne.ifile) go to 1
+ wave=0.
+ write(fname,1002) ifile
+1002 format('000000_',i6.6,'.wav')
+
+ do isig=1,nsigs
+ read(10,1003,end=100) cjunk,isnr,xdt0,ifreq,msg37
+1003 format(a4,30x,i3,f5.1,i5,1x,a37)
+ if(cjunk.eq.'File') go to 100
+ if(isnr.lt.-17) isnr=-17
+ f0=ifreq*960.0/576.0
+ call random_number(r)
+ xdt=r-0.5
+! Source-encode, then get itone()
+ i3=-1
+ n3=-1
+ call pack77(msg37,i3,n3,c77)
+ call genft4(msg37,0,msgsent37,msgbits,itone)
+ nwave0=(NN+2)*NSPS
+ icmplx=0
+ call gen_ft4wave(itone,NN,NSPS,12000.0,f0,cwave0,wave0,icmplx,nwave0)
+
+ k0=nint((xdt+0.5)/dt)
+ if(k0.lt.1) k0=1
+ tmp(:k0-1)=0.0
+ tmp(k0:k0+nwave0-1)=wave0
+ tmp(k0+nwave0:)=0.0
+
+ ! Insert this signal into wave() array
+ sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*isnr)
+ wave=wave + sig*tmp
+ write(*,1100) fname(1:13),isig,isnr,xdt,nint(f0),msg37
+1100 format(a13,i4,i5,f5.1,i6,2x,a37)
+ enddo ! isig
+
+100 backspace 10
+
+ do i=1,NZZ !Add gaussian noise at specified SNR
+ xnoise=gran()
+ wave(i)=wave(i) + xnoise
+ enddo
+
+ gain=30.0
+ wave=gain*wave
+ if(any(abs(wave).gt.32767.0)) print*,"Warning - data will be clipped."
+ iwave=nint(wave)
+ h=default_header(12000,NZZ)
+ open(12,file=fname,status='unknown',access='stream')
+ write(12) h,iwave !Save to *.wav file
+ close(12)
+ print*,' '
+ enddo ! ifile
+ go to 999
+
+998 print*,'Cannot open file "messages.txt"'
+
+999 end program ft4sim_mult
diff --git a/lib/ft4/gen_ft4wave.f90 b/lib/ft4/gen_ft4wave.f90 index 13018242..23536bc2 100755 --- a/lib/ft4/gen_ft4wave.f90 +++ b/lib/ft4/gen_ft4wave.f90 @@ -1,66 +1,66 @@ -subroutine gen_ft4wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave) - - real wave(nwave) - complex cwave(nwave) - real pulse(6912) !576*4*3 - real dphi(0:250000-1) - integer itone(nsym) - logical first - data first/.true./ - save pulse,first,twopi,dt,hmod - - if(first) then - twopi=8.0*atan(1.0) - dt=1.0/fsample - hmod=1.0 -! Compute the smoothed frequency-deviation pulse - do i=1,3*nsps - tt=(i-1.5*nsps)/real(nsps) - pulse(i)=gfsk_pulse(1.0,tt) - enddo - first=.false. - endif - -! Compute the smoothed frequency waveform. -! Length = (nsym+2)*nsps samples, zero-padded - dphi_peak=twopi*hmod/real(nsps) - dphi=0.0 - do j=1,nsym - ib=(j-1)*nsps - ie=ib+3*nsps-1 - dphi(ib:ie) = dphi(ib:ie) + dphi_peak*pulse(1:3*nsps)*itone(j) - enddo - -! Calculate and insert the audio waveform - phi=0.0 - dphi = dphi + twopi*f0*dt !Shift frequency up by f0 - wave=0. - if(icmplx.eq.1) cwave=0. - k=0 - do j=0,(nsym+2)*nsps-1 - k=k+1 - if(icmplx.eq.0) then - wave(k)=sin(phi) - else - cwave(k)=cmplx(cos(phi),sin(phi)) - endif - phi=mod(phi+dphi(j),twopi) - enddo - -! Compute the ramp-up and ramp-down symbols - if(icmplx.eq.0) then - wave(1:nsps)=wave(1:nsps) * & - (1.0-cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0 - k1=(nsym+1)*nsps+1 - wave(k1:k1+nsps-1)=wave(k1:k1+nsps-1) * & - (1.0+cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0 - else - cwave(1:nsps)=cwave(1:nsps) * & - (1.0-cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0 - k1=(nsym+1)*nsps+1 - cwave(k1:k1+nsps-1)=cwave(k1:k1+nsps-1) * & - (1.0+cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0 - endif - - return -end subroutine gen_ft4wave +subroutine gen_ft4wave(itone,nsym,nsps,fsample,f0,cwave,wave,icmplx,nwave)
+
+ real wave(nwave)
+ complex cwave(nwave)
+ real pulse(6912) !576*4*3
+ real dphi(0:250000-1)
+ integer itone(nsym)
+ logical first
+ data first/.true./
+ save pulse,first,twopi,dt,hmod
+
+ if(first) then
+ twopi=8.0*atan(1.0)
+ dt=1.0/fsample
+ hmod=1.0
+! Compute the smoothed frequency-deviation pulse
+ do i=1,3*nsps
+ tt=(i-1.5*nsps)/real(nsps)
+ pulse(i)=gfsk_pulse(1.0,tt)
+ enddo
+ first=.false.
+ endif
+
+! Compute the smoothed frequency waveform.
+! Length = (nsym+2)*nsps samples, zero-padded
+ dphi_peak=twopi*hmod/real(nsps)
+ dphi=0.0
+ do j=1,nsym
+ ib=(j-1)*nsps
+ ie=ib+3*nsps-1
+ dphi(ib:ie) = dphi(ib:ie) + dphi_peak*pulse(1:3*nsps)*itone(j)
+ enddo
+
+! Calculate and insert the audio waveform
+ phi=0.0
+ dphi = dphi + twopi*f0*dt !Shift frequency up by f0
+ wave=0.
+ if(icmplx.eq.1) cwave=0.
+ k=0
+ do j=0,(nsym+2)*nsps-1
+ k=k+1
+ if(icmplx.eq.0) then
+ wave(k)=sin(phi)
+ else
+ cwave(k)=cmplx(cos(phi),sin(phi))
+ endif
+ phi=mod(phi+dphi(j),twopi)
+ enddo
+
+! Compute the ramp-up and ramp-down symbols
+ if(icmplx.eq.0) then
+ wave(1:nsps)=wave(1:nsps) * &
+ (1.0-cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
+ k1=(nsym+1)*nsps+1
+ wave(k1:k1+nsps-1)=wave(k1:k1+nsps-1) * &
+ (1.0+cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
+ else
+ cwave(1:nsps)=cwave(1:nsps) * &
+ (1.0-cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
+ k1=(nsym+1)*nsps+1
+ cwave(k1:k1+nsps-1)=cwave(k1:k1+nsps-1) * &
+ (1.0+cos(twopi*(/(i,i=0,nsps-1)/)/(2.0*nsps)))/2.0
+ endif
+
+ return
+end subroutine gen_ft4wave
diff --git a/lib/ft4/genft4.f90 b/lib/ft4/genft4.f90 index 66e70a61..96e8d7dc 100755 --- a/lib/ft4/genft4.f90 +++ b/lib/ft4/genft4.f90 @@ -1,90 +1,90 @@ -subroutine genft4(msg0,ichk,msgsent,msgbits,i4tone) - -! Encode an FT4 message -! Input: -! - msg0 requested message to be transmitted -! - ichk if ichk=1, return only msgsent -! - msgsent message as it will be decoded -! - i4tone array of audio tone values, {0,1,2,3} - -! Frame structure: -! s16 + 87symbols + 2 ramp up/down = 105 total channel symbols -! r1 + s4 + d29 + s4 + d29 + s4 + d29 + s4 + r1 - -! Message duration: TxT = 105*576/12000 = 5.04 s - -! use iso_c_binding, only: c_loc,c_size_t - - use packjt77 - include 'ft4_params.f90' - character*37 msg0 - character*37 message !Message to be generated - character*37 msgsent !Message as it will be received - character*77 c77 - integer*4 i4tone(NN),itmp(ND) - integer*1 codeword(2*ND) - integer*1 msgbits(77),rvec(77) - integer icos4a(4),icos4b(4),icos4c(4),icos4d(4) - logical unpk77_success - data icos4a/0,1,3,2/ - data icos4b/1,0,2,3/ - data icos4c/2,3,1,0/ - data icos4d/3,2,0,1/ - data rvec/0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0, & - 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/ - message=msg0 - - do i=1, 37 - if(ichar(message(i:i)).eq.0) then - message(i:37)=' ' - exit - endif - enddo - do i=1,37 !Strip leading blanks - if(message(1:1).ne.' ') exit - message=message(i+1:) - enddo - - i3=-1 - n3=-1 - call pack77(message,i3,n3,c77) - call unpack77(c77,0,msgsent,unpk77_success) !Unpack to get msgsent - - if(ichk.eq.1) go to 999 - read(c77,'(77i1)',err=1) msgbits - if(unpk77_success) go to 2 -1 msgbits=0 - itone=0 - msgsent='*** bad message *** ' - go to 999 - -entry get_ft4_tones_from_77bits(msgbits,i4tone) - -2 msgbits=mod(msgbits+rvec,2) - call encode174_91(msgbits,codeword) - -! Grayscale mapping: -! bits tone -! 00 0 -! 01 1 -! 11 2 -! 10 3 - - do i=1,ND - is=codeword(2*i)+2*codeword(2*i-1) - if(is.le.1) itmp(i)=is - if(is.eq.2) itmp(i)=3 - if(is.eq.3) itmp(i)=2 - enddo - - i4tone(1:4)=icos4a - i4tone(5:33)=itmp(1:29) - i4tone(34:37)=icos4b - i4tone(38:66)=itmp(30:58) - i4tone(67:70)=icos4c - i4tone(71:99)=itmp(59:87) - i4tone(100:103)=icos4d - -999 return -end subroutine genft4 +subroutine genft4(msg0,ichk,msgsent,msgbits,i4tone)
+
+! Encode an FT4 message
+! Input:
+! - msg0 requested message to be transmitted
+! - ichk if ichk=1, return only msgsent
+! - msgsent message as it will be decoded
+! - i4tone array of audio tone values, {0,1,2,3}
+
+! Frame structure:
+! s16 + 87symbols + 2 ramp up/down = 105 total channel symbols
+! r1 + s4 + d29 + s4 + d29 + s4 + d29 + s4 + r1
+
+! Message duration: TxT = 105*576/12000 = 5.04 s
+
+! use iso_c_binding, only: c_loc,c_size_t
+
+ use packjt77
+ include 'ft4_params.f90'
+ character*37 msg0
+ character*37 message !Message to be generated
+ character*37 msgsent !Message as it will be received
+ character*77 c77
+ integer*4 i4tone(NN),itmp(ND)
+ integer*1 codeword(2*ND)
+ integer*1 msgbits(77),rvec(77)
+ integer icos4a(4),icos4b(4),icos4c(4),icos4d(4)
+ logical unpk77_success
+ data icos4a/0,1,3,2/
+ data icos4b/1,0,2,3/
+ data icos4c/2,3,1,0/
+ data icos4d/3,2,0,1/
+ data rvec/0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,1,0,0,0,1,0,0,1,1,0,1,1,0, &
+ 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/
+ message=msg0
+
+ do i=1, 37
+ if(ichar(message(i:i)).eq.0) then
+ message(i:37)=' '
+ exit
+ endif
+ enddo
+ do i=1,37 !Strip leading blanks
+ if(message(1:1).ne.' ') exit
+ message=message(i+1:)
+ enddo
+
+ i3=-1
+ n3=-1
+ call pack77(message,i3,n3,c77)
+ call unpack77(c77,0,msgsent,unpk77_success) !Unpack to get msgsent
+
+ if(ichk.eq.1) go to 999
+ read(c77,'(77i1)',err=1) msgbits
+ if(unpk77_success) go to 2
+1 msgbits=0
+ itone=0
+ msgsent='*** bad message *** '
+ go to 999
+
+entry get_ft4_tones_from_77bits(msgbits,i4tone)
+
+2 msgbits=mod(msgbits+rvec,2)
+ call encode174_91(msgbits,codeword)
+
+! Grayscale mapping:
+! bits tone
+! 00 0
+! 01 1
+! 11 2
+! 10 3
+
+ do i=1,ND
+ is=codeword(2*i)+2*codeword(2*i-1)
+ if(is.le.1) itmp(i)=is
+ if(is.eq.2) itmp(i)=3
+ if(is.eq.3) itmp(i)=2
+ enddo
+
+ i4tone(1:4)=icos4a
+ i4tone(5:33)=itmp(1:29)
+ i4tone(34:37)=icos4b
+ i4tone(38:66)=itmp(30:58)
+ i4tone(67:70)=icos4c
+ i4tone(71:99)=itmp(59:87)
+ i4tone(100:103)=icos4d
+
+999 return
+end subroutine genft4
diff --git a/lib/ft4/get_ft4_bitmetrics.f90 b/lib/ft4/get_ft4_bitmetrics.f90 index 9c8a4ab4..5c78193b 100755 --- a/lib/ft4/get_ft4_bitmetrics.f90 +++ b/lib/ft4/get_ft4_bitmetrics.f90 @@ -1,116 +1,116 @@ -subroutine get_ft4_bitmetrics(cd,bitmetrics,badsync) - - include 'ft4_params.f90' - parameter (NSS=NSPS/NDOWN,NDMAX=NMAX/NDOWN) - complex cd(0:NN*NSS-1) - complex cs(0:3,NN) - complex csymb(NSS) - integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3) - integer graymap(0:3) - integer ip(1) - logical one(0:255,0:7) ! 256 4-symbol sequences, 8 bits - logical first - logical badsync - real bitmetrics(2*NN,3) - real s2(0:255) - real s4(0:3,NN) - - data icos4a/0,1,3,2/ - data icos4b/1,0,2,3/ - data icos4c/2,3,1,0/ - data icos4d/3,2,0,1/ - data graymap/0,1,3,2/ - data first/.true./ - save first,one - - if(first) then - one=.false. - do i=0,255 - do j=0,7 - if(iand(i,2**j).ne.0) one(i,j)=.true. - enddo - enddo - first=.false. - endif - - do k=1,NN - i1=(k-1)*NSS - csymb=cd(i1:i1+NSS-1) - call four2a(csymb,NSS,1,-1,1) - cs(0:3,k)=csymb(1:4) - s4(0:3,k)=abs(csymb(1:4)) - enddo - -! Sync quality check - is1=0 - is2=0 - is3=0 - is4=0 - badsync=.false. - ibmax=0 - - do k=1,4 - ip=maxloc(s4(:,k)) - if(icos4a(k-1).eq.(ip(1)-1)) is1=is1+1 - ip=maxloc(s4(:,k+33)) - if(icos4b(k-1).eq.(ip(1)-1)) is2=is2+1 - ip=maxloc(s4(:,k+66)) - if(icos4c(k-1).eq.(ip(1)-1)) is3=is3+1 - ip=maxloc(s4(:,k+99)) - if(icos4d(k-1).eq.(ip(1)-1)) is4=is4+1 - enddo - nsync=is1+is2+is3+is4 !Number of correct hard sync symbols, 0-16 - if(nsync .lt. 8) then - badsync=.true. - return - endif - - do nseq=1,3 !Try coherent sequences of 1, 2, and 4 symbols - if(nseq.eq.1) nsym=1 - if(nseq.eq.2) nsym=2 - if(nseq.eq.3) nsym=4 - nt=2**(2*nsym) - do ks=1,NN-nsym+1,nsym !87+16=103 symbols. - amax=-1.0 - do i=0,nt-1 - i1=i/64 - i2=iand(i,63)/16 - i3=iand(i,15)/4 - i4=iand(i,3) - if(nsym.eq.1) then - s2(i)=abs(cs(graymap(i4),ks)) - elseif(nsym.eq.2) then - s2(i)=abs(cs(graymap(i3),ks)+cs(graymap(i4),ks+1)) - elseif(nsym.eq.4) then - s2(i)=abs(cs(graymap(i1),ks ) + & - cs(graymap(i2),ks+1) + & - cs(graymap(i3),ks+2) + & - cs(graymap(i4),ks+3) & - ) - else - print*,"Error - nsym must be 1, 2, or 4." - endif - enddo - ipt=1+(ks-1)*2 - if(nsym.eq.1) ibmax=1 - if(nsym.eq.2) ibmax=3 - if(nsym.eq.4) ibmax=7 - do ib=0,ibmax - bm=maxval(s2(0:nt-1),one(0:nt-1,ibmax-ib)) - & - maxval(s2(0:nt-1),.not.one(0:nt-1,ibmax-ib)) - if(ipt+ib.gt.2*NN) cycle - bitmetrics(ipt+ib,nseq)=bm - enddo - enddo - enddo - - bitmetrics(205:206,2)=bitmetrics(205:206,1) - bitmetrics(201:204,3)=bitmetrics(201:204,2) - bitmetrics(205:206,3)=bitmetrics(205:206,1) - - call normalizebmet(bitmetrics(:,1),2*NN) - call normalizebmet(bitmetrics(:,2),2*NN) - call normalizebmet(bitmetrics(:,3),2*NN) - return - -end subroutine get_ft4_bitmetrics +subroutine get_ft4_bitmetrics(cd,bitmetrics,badsync)
+
+ include 'ft4_params.f90'
+ parameter (NSS=NSPS/NDOWN,NDMAX=NMAX/NDOWN)
+ complex cd(0:NN*NSS-1)
+ complex cs(0:3,NN)
+ complex csymb(NSS)
+ integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3)
+ integer graymap(0:3)
+ integer ip(1)
+ logical one(0:255,0:7) ! 256 4-symbol sequences, 8 bits
+ logical first
+ logical badsync
+ real bitmetrics(2*NN,3)
+ real s2(0:255)
+ real s4(0:3,NN)
+
+ data icos4a/0,1,3,2/
+ data icos4b/1,0,2,3/
+ data icos4c/2,3,1,0/
+ data icos4d/3,2,0,1/
+ data graymap/0,1,3,2/
+ data first/.true./
+ save first,one
+
+ if(first) then
+ one=.false.
+ do i=0,255
+ do j=0,7
+ if(iand(i,2**j).ne.0) one(i,j)=.true.
+ enddo
+ enddo
+ first=.false.
+ endif
+
+ do k=1,NN
+ i1=(k-1)*NSS
+ csymb=cd(i1:i1+NSS-1)
+ call four2a(csymb,NSS,1,-1,1)
+ cs(0:3,k)=csymb(1:4)
+ s4(0:3,k)=abs(csymb(1:4))
+ enddo
+
+! Sync quality check
+ is1=0
+ is2=0
+ is3=0
+ is4=0
+ badsync=.false.
+ ibmax=0
+
+ do k=1,4
+ ip=maxloc(s4(:,k))
+ if(icos4a(k-1).eq.(ip(1)-1)) is1=is1+1
+ ip=maxloc(s4(:,k+33))
+ if(icos4b(k-1).eq.(ip(1)-1)) is2=is2+1
+ ip=maxloc(s4(:,k+66))
+ if(icos4c(k-1).eq.(ip(1)-1)) is3=is3+1
+ ip=maxloc(s4(:,k+99))
+ if(icos4d(k-1).eq.(ip(1)-1)) is4=is4+1
+ enddo
+ nsync=is1+is2+is3+is4 !Number of correct hard sync symbols, 0-16
+ if(nsync .lt. 8) then
+ badsync=.true.
+ return
+ endif
+
+ do nseq=1,3 !Try coherent sequences of 1, 2, and 4 symbols
+ if(nseq.eq.1) nsym=1
+ if(nseq.eq.2) nsym=2
+ if(nseq.eq.3) nsym=4
+ nt=2**(2*nsym)
+ do ks=1,NN-nsym+1,nsym !87+16=103 symbols.
+ amax=-1.0
+ do i=0,nt-1
+ i1=i/64
+ i2=iand(i,63)/16
+ i3=iand(i,15)/4
+ i4=iand(i,3)
+ if(nsym.eq.1) then
+ s2(i)=abs(cs(graymap(i4),ks))
+ elseif(nsym.eq.2) then
+ s2(i)=abs(cs(graymap(i3),ks)+cs(graymap(i4),ks+1))
+ elseif(nsym.eq.4) then
+ s2(i)=abs(cs(graymap(i1),ks ) + &
+ cs(graymap(i2),ks+1) + &
+ cs(graymap(i3),ks+2) + &
+ cs(graymap(i4),ks+3) &
+ )
+ else
+ print*,"Error - nsym must be 1, 2, or 4."
+ endif
+ enddo
+ ipt=1+(ks-1)*2
+ if(nsym.eq.1) ibmax=1
+ if(nsym.eq.2) ibmax=3
+ if(nsym.eq.4) ibmax=7
+ do ib=0,ibmax
+ bm=maxval(s2(0:nt-1),one(0:nt-1,ibmax-ib)) - &
+ maxval(s2(0:nt-1),.not.one(0:nt-1,ibmax-ib))
+ if(ipt+ib.gt.2*NN) cycle
+ bitmetrics(ipt+ib,nseq)=bm
+ enddo
+ enddo
+ enddo
+
+ bitmetrics(205:206,2)=bitmetrics(205:206,1)
+ bitmetrics(201:204,3)=bitmetrics(201:204,2)
+ bitmetrics(205:206,3)=bitmetrics(205:206,1)
+
+ call normalizebmet(bitmetrics(:,1),2*NN)
+ call normalizebmet(bitmetrics(:,2),2*NN)
+ call normalizebmet(bitmetrics(:,3),2*NN)
+ return
+
+end subroutine get_ft4_bitmetrics
diff --git a/lib/ft4/getcandidates4.f90 b/lib/ft4/getcandidates4.f90 index 8ff80642..8e9fbd03 100755 --- a/lib/ft4/getcandidates4.f90 +++ b/lib/ft4/getcandidates4.f90 @@ -1,83 +1,83 @@ -subroutine getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, & - ncand,sbase) - - include 'ft4_params.f90' - real s(NH1,NHSYM) - real savg(NH1),savsm(NH1) - real sbase(NH1) - real x(NFFT1) - real window(NFFT1) - complex cx(0:NH1) - real candidate(2,maxcand),candidatet(2,maxcand) - real dd(NMAX) - equivalence (x,cx) - logical first - data first/.true./ - save first,window - - if(first) then - first=.false. - pi=4.0*atan(1.) - window=0. - call nuttal_window(window,NFFT1) - endif - -! Compute symbol spectra, stepping by NSTEP steps. - savg=0. - df=12000.0/NFFT1 - fac=1.0/300.0 - do j=1,NHSYM - ia=(j-1)*NSTEP + 1 - ib=ia+NFFT1-1 - if(ib.gt.NMAX) exit - x=fac*dd(ia:ib)*window - call four2a(x,NFFT1,1,-1,0) !r2c FFT - s(1:NH1,j)=abs(cx(1:NH1))**2 - savg=savg + s(1:NH1,j) !Average spectrum - enddo - savg=savg/NHSYM - savsm=0. - do i=8,NH1-7 - savsm(i)=sum(savg(i-7:i+7))/15. - enddo - - nfa=fa/df - if(nfa.lt.nint(200.0/df)) nfa=nint(200.0/df) - nfb=fb/df - if(nfb.gt.nint(4910.0/df)) nfb=nint(4910.0/df) - call ft4_baseline(savg,nfa,nfb,sbase) - if(any(sbase(nfa:nfb).le.0)) return - savsm(nfa:nfb)=savsm(nfa:nfb)/sbase(nfa:nfb) - f_offset = -1.5*12000.0/NSPS - ncand=0 - candidatet=0 - do i=nfa+1,nfb-1 - if(savsm(i).ge.savsm(i-1) .and. savsm(i).ge.savsm(i+1) .and. & - savsm(i).ge.syncmin) then - den=savsm(i-1)-2*savsm(i)+savsm(i+1) - del=0. - if(den.ne.0.0) del=0.5*(savsm(i-1)-savsm(i+1))/den - fpeak=(i+del)*df+f_offset - if(fpeak.lt.200.0 .or. fpeak.gt.4910.0) cycle - speak=savsm(i) - 0.25*(savsm(i-1)-savsm(i+1))*del - ncand=ncand+1 - candidatet(1,ncand)=fpeak - candidatet(2,ncand)=speak - if(ncand.eq.maxcand) exit - endif - enddo - candidate=0 - nq=count(abs(candidatet(1,1:ncand)-nfqso).le.20.0) - n1=1 - n2=nq+1 - do i=1,ncand - if(abs(candidatet(1,i)-nfqso).le.20.0) then - candidate(1:2,n1)=candidatet(1:2,i) - n1=n1+1 - else - candidate(1:2,n2)=candidatet(1:2,i) - n2=n2+1 - endif - enddo -return -end subroutine getcandidates4 +subroutine getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
+ ncand,sbase)
+
+ include 'ft4_params.f90'
+ real s(NH1,NHSYM)
+ real savg(NH1),savsm(NH1)
+ real sbase(NH1)
+ real x(NFFT1)
+ real window(NFFT1)
+ complex cx(0:NH1)
+ real candidate(2,maxcand),candidatet(2,maxcand)
+ real dd(NMAX)
+ equivalence (x,cx)
+ logical first
+ data first/.true./
+ save first,window
+
+ if(first) then
+ first=.false.
+ pi=4.0*atan(1.)
+ window=0.
+ call nuttal_window(window,NFFT1)
+ endif
+
+! Compute symbol spectra, stepping by NSTEP steps.
+ savg=0.
+ df=12000.0/NFFT1
+ fac=1.0/300.0
+ do j=1,NHSYM
+ ia=(j-1)*NSTEP + 1
+ ib=ia+NFFT1-1
+ if(ib.gt.NMAX) exit
+ x=fac*dd(ia:ib)*window
+ call four2a(x,NFFT1,1,-1,0) !r2c FFT
+ s(1:NH1,j)=abs(cx(1:NH1))**2
+ savg=savg + s(1:NH1,j) !Average spectrum
+ enddo
+ savg=savg/NHSYM
+ savsm=0.
+ do i=8,NH1-7
+ savsm(i)=sum(savg(i-7:i+7))/15.
+ enddo
+
+ nfa=fa/df
+ if(nfa.lt.nint(200.0/df)) nfa=nint(200.0/df)
+ nfb=fb/df
+ if(nfb.gt.nint(4910.0/df)) nfb=nint(4910.0/df)
+ call ft4_baseline(savg,nfa,nfb,sbase)
+ if(any(sbase(nfa:nfb).le.0)) return
+ savsm(nfa:nfb)=savsm(nfa:nfb)/sbase(nfa:nfb)
+ f_offset = -1.5*12000.0/NSPS
+ ncand=0
+ candidatet=0
+ do i=nfa+1,nfb-1
+ if(savsm(i).ge.savsm(i-1) .and. savsm(i).ge.savsm(i+1) .and. &
+ savsm(i).ge.syncmin) then
+ den=savsm(i-1)-2*savsm(i)+savsm(i+1)
+ del=0.
+ if(den.ne.0.0) del=0.5*(savsm(i-1)-savsm(i+1))/den
+ fpeak=(i+del)*df+f_offset
+ if(fpeak.lt.200.0 .or. fpeak.gt.4910.0) cycle
+ speak=savsm(i) - 0.25*(savsm(i-1)-savsm(i+1))*del
+ ncand=ncand+1
+ candidatet(1,ncand)=fpeak
+ candidatet(2,ncand)=speak
+ if(ncand.eq.maxcand) exit
+ endif
+ enddo
+ candidate=0
+ nq=count(abs(candidatet(1,1:ncand)-nfqso).le.20.0)
+ n1=1
+ n2=nq+1
+ do i=1,ncand
+ if(abs(candidatet(1,i)-nfqso).le.20.0) then
+ candidate(1:2,n1)=candidatet(1:2,i)
+ n1=n1+1
+ else
+ candidate(1:2,n2)=candidatet(1:2,i)
+ n2=n2+1
+ endif
+ enddo
+return
+end subroutine getcandidates4
diff --git a/lib/ft4/messages.txt b/lib/ft4/messages.txt index 16329fce..7c7faa8d 100755 --- a/lib/ft4/messages.txt +++ b/lib/ft4/messages.txt @@ -1,162 +1,162 @@ -File 1 -190106_000015 7.080 Rx FT8 -15 0.2 178 N1TRK N4FKH 569 VA -190106_000015 7.080 Rx FT8 -13 -0.1 253 N1TRK KB7RUQ 539 UT -190106_000015 7.080 Rx FT8 10 0.2 389 W0ZF N3LFC RR73 -190106_000015 7.080 Rx FT8 -10 0.1 450 PY4AZ KF7YED 559 MT -190106_000015 7.080 Rx FT8 -3 0.2 507 N1TRK WA4DYD 559 GA -190106_000015 7.080 Rx FT8 14 0.2 689 KB0VHA KA1YQC R 539 MA -190106_000015 7.080 Rx FT8 -5 0.1 984 W9JA N9OY RR73 -190106_000015 7.080 Rx FT8 -12 0.1 1123 VA2CZ K8GNG RR73 -190106_000015 7.080 Rx FT8 2 0.1 1240 CQ RU K7RL CN88 -190106_000015 7.080 Rx FT8 -11 0.5 1293 K4ZMW K7VZ RR73 -190106_000015 7.080 Rx FT8 2 0.1 1387 WD9IGY KX1X 73 -190106_000015 7.080 Rx FT8 -10 0.1 1536 CQ RU W0FRC DM79 -190106_000015 7.080 Rx FT8 -2 0.1 1635 K4SQC VE3RX 549 ON -190106_000030 7.080 Rx FT8 -11 0.2 1745 CQ RU K1LOG FN56 -190106_000030 7.080 Rx FT8 3 0.8 1798 WD5DAX WS4WW 73 -190106_000030 7.080 Rx FT8 12 0.1 1895 DJ6GI KG4W 73 -190106_000030 7.080 Rx FT8 -14 0.2 2119 KF7YED KF5ZNQ 549 TX -190106_000030 7.080 Rx FT8 -5 0.1 336 CQ RU AB5XS EM12 -190106_000030 7.080 Rx FT8 0 0.0 1415 W3KIT AA8SW RR73 -190106_000030 7.080 Rx FT8 -13 0.3 1540 NI6G W7DRW 579 AZ -190106_000030 7.080 Rx FT8 -10 0.1 312 SHIFT W9JA -190106_000030 7.080 Rx FT8 -16 0.1 1447 W7BOB KJ7G 549 WA -File 2 -190106_000045 7.080 Rx FT8 -9 0.1 178 N1TRK N4FKH 569 VA -190106_000045 7.080 Rx FT8 -9 -0.1 253 N1TRK KB7RUQ RR73 -190106_000045 7.080 Rx FT8 -8 0.1 336 CQ RU AB5XS EM12 -190106_000045 7.080 Rx FT8 16 0.3 689 KB0VHA KA1YQC R 539 MA -190106_000045 7.080 Rx FT8 -3 0.1 984 CQ RU N9OY EN43 -190106_000045 7.080 Rx FT8 -10 0.1 1146 K1JT WB4HXE 559 GA -190106_000045 7.080 Rx FT8 6 0.1 1240 VE3LON K7RL R 549 WA -190106_000045 7.080 Rx FT8 -1 0.1 1386 WD9IGY KX1X 73 -190106_000045 7.080 Rx FT8 -12 0.1 1536 CQ RU W0FRC DM79 -190106_000045 7.080 Rx FT8 3 0.1 1635 K4SQC VE3RX RR73 -190106_000045 7.080 Rx FT8 -5 0.1 1688 CQ RU W1QA FN32 -190106_000045 7.080 Rx FT8 1 0.8 1797 CQ RU WS4WW FM17 -190106_000045 7.080 Rx FT8 14 0.1 1895 HB9BUN KG4W R 549 VA -190106_000100 7.080 Rx FT8 -7 0.1 2002 W9TO KN3ILZ 529 PA -190106_000100 7.080 Rx FT8 -9 0.1 312 W9JA PY2APK RRR -190106_000100 7.080 Rx FT8 -12 0.1 436 NZ7P WA7JAY 589 CA -190106_000100 7.080 Rx FT8 -13 -0.1 1380 AC6BW KR9A R 559 WI -190106_000100 7.080 Rx FT8 -17 0.1 1448 W7BOB KJ7G RR73 -190106_000100 7.080 Rx FT8 -7 0.3 1540 NI6G W7DRW 569 AZ -File 3 -190106_000115 7.080 Rx FT8 -13 0.2 178 N1TRK N4FKH 569 VA -190106_000115 7.080 Rx FT8 -14 -0.1 253 N1TRK KB7RUQ RR73 -190106_000115 7.080 Rx FT8 -5 0.1 336 CQ RU AB5XS EM12 -190106_000115 7.080 Rx FT8 -7 0.1 449 NI6G KF7YED 569 MT -190106_000115 7.080 Rx FT8 14 0.2 689 KB0VHA KA1YQC 73 -190106_000115 7.080 Rx FT8 11 0.4 852 W9TO N4QWF 569 VA -190106_000115 7.080 Rx FT8 -3 0.1 984 W4EMB N9OY R 529 WI -190106_000115 7.080 Rx FT8 -14 0.1 1117 WB4FAY K7PDW 549 UT -190106_000115 7.080 Rx FT8 3 0.2 1240 VE3LON K7RL R 559 WA -190106_000115 7.080 Rx FT8 -18 0.1 1380 AC6BW KR9A R 559 WI -190106_000115 7.080 Rx FT8 4 0.1 1475 K4KCL KB4S 559 VA -190106_000130 7.080 Rx FT8 -5 0.1 1612 K1JT WB4HXE RR73 -190106_000115 7.080 Rx FT8 -1 0.1 1688 KW4RTR W1QA R 539 MA -190106_000115 7.080 Rx FT8 -15 0.2 1745 CQ RU K1LOG FN56 -190106_000115 7.080 Rx FT8 3 0.8 1798 WA1T WS4WW R 579 VA -190106_000115 7.080 Rx FT8 14 0.1 1895 HB9BUN KG4W R 549 VA -190106_000115 7.080 Rx FT8 -9 0.2 2125 CQ RU NF3R FN20 -190106_000130 7.080 Rx FT8 -8 0.4 976 AG1T K7VZ 569 AZ -190106_000130 7.080 Rx FT8 -7 0.1 1434 Z36W N4KMC 529 FL -File 4 -190106_000145 7.080 Rx FT8 -8 0.1 335 CQ RU AB5XS EM12 -190106_000145 7.080 Rx FT8 -11 0.2 388 W0ZF WW4LL 559 ME -190106_000145 7.080 Rx FT8 -10 0.1 449 NI6G KF7YED 569 MT -190106_000145 7.080 Rx FT8 10 0.3 689 CQ RU KA1YQC FN42 -190106_000145 7.080 Rx FT8 12 0.4 852 W9TO N4QWF RR73 -190106_000145 7.080 Rx FT8 -2 0.1 984 W4EMB N9OY R 529 WI -190106_000145 7.080 Rx FT8 -12 0.1 1117 WB4FAY K7PDW 549 UT -190106_000145 7.080 Rx FT8 4 0.2 1240 VE3LON K7RL 73 -190106_000145 7.080 Rx FT8 -13 0.1 1348 WW5M KO9V 559 NC -190106_000145 7.080 Rx FT8 -14 0.1 1380 AC6BW KR9A R 559 WI -190106_000145 7.080 Rx FT8 2 0.1 1475 K4KCL KB4S RR73 -190106_000145 7.080 Rx FT8 -9 0.1 1536 KC1HTT W0FRC 73 -190106_000145 7.080 Rx FT8 1 0.1 1688 KW4RTR W1QA R 539 MA -190106_000200 7.080 Rx FT8 1 0.8 1797 WA1T WS4WW R 569 VA -190106_000200 7.080 Rx FT8 15 0.1 1895 CQ RU KG4W FM17 -190106_000200 7.080 Rx FT8 -6 0.2 2125 CQ RU NF3R FN20 -190106_000200 7.080 Rx FT8 -7 0.1 311 PD8DX PY2APK 539 0081 -190106_000200 7.080 Rx FT8 -3 0.5 976 AG1T K7VZ RR73 -190106_000200 7.080 Rx FT8 -5 0.1 1432 Z36W N4KMC 529 FL -190106_000200 7.080 Rx FT8 -7 0.3 1540 N7BT W7DRW 559 AZ -190106_000200 7.080 Rx FT8 -16 0.3 2124 N3KCR ON9COP 529 0053 -190106_000200 7.080 Rx FT8 -12 0.1 1448 K2DH KJ7G 549 WA -File 5 -190106_000215 7.080 Rx FT8 11 0.1 435 K1JT WV8WA 569 WV -190106_000215 7.080 Rx FT8 -4 0.1 335 CQ RU AB5XS EM12 -190106_000215 7.080 Rx FT8 10 0.5 689 CQ RU KA1YQC FN42 -190106_000215 7.080 Rx FT8 -10 0.1 843 CQ RU AE5JH EL07 -190106_000215 7.080 Rx FT8 -3 0.1 984 W4EMB N9OY R 529 WI -190106_000215 7.080 Rx FT8 -10 0.1 1118 WB4FAY W5MO 539 TX -190106_000215 7.080 Rx FT8 -16 0.1 1170 K1JT K8GNG 569 MI -190106_000215 7.080 Rx FT8 6 0.1 1240 CQ RU K7RL CN88 -190106_000215 7.080 Rx FT8 -8 0.1 1348 WW5M KO9V RR73 -190106_000215 7.080 Rx FT8 -12 0.1 1432 Z36W N4KMC 529 FL -190106_000215 7.080 Rx FT8 2 0.1 1490 KA6BIM KB4S 529 VA -190106_000230 7.080 Rx FT8 -1 0.1 1688 CQ RU W1QA FN32 -190106_000230 7.080 Rx FT8 15 0.1 1895 DD5ZZ KG4W R 539 VA -190106_000230 7.080 Rx FT8 -8 0.2 2125 CQ RU NF3R FN20 -190106_000230 7.080 Rx FT8 -13 0.1 1380 AC6BW KR9A R 559 WI -190106_000230 7.080 Rx FT8 -4 0.1 1536 CQ RU W0FRC DM79 -190106_000230 7.080 Rx FT8 -8 0.3 1540 N7BT W7DRW 559 AZ -File 6 -190106_000245 7.080 Rx FT8 6 0.1 635 K1JT WV8WA RR73 -190106_000245 7.080 Rx FT8 -12 0.1 335 VE3RX AB5XS R 589 TX -190106_000245 7.080 Rx FT8 -16 0.1 423 WA1T PY2APK 529 0081 -190106_000245 7.080 Rx FT8 9 0.4 507 N1TRK N4QWF RR73 -190106_000245 7.080 Rx FT8 -10 0.1 869 W7BOB W3KIT 539 MD -190106_000245 7.080 Rx FT8 -7 0.1 984 W4EMB N9OY R 529 WI -190106_000245 7.080 Rx FT8 -13 0.1 1170 K1JT K8GNG 569 MI -190106_000245 7.080 Rx FT8 5 0.1 1240 W6GMT K7RL R 569 WA -190106_000245 7.080 Rx FT8 2 0.1 1490 KA6BIM KB4S 529 VA -190106_000245 7.080 Rx FT8 -1 0.1 1688 CQ RU W1QA FN32 -190106_000245 7.080 Rx FT8 1 0.7 1798 N3KCR WS4WW R 599 VA -190106_000245 7.080 Rx FT8 17 0.1 1895 DD5ZZ KG4W 73 -190106_000300 7.080 Rx FT8 -10 0.2 2125 CQ RU NF3R FN20 -190106_000300 7.080 Rx FT8 8 0.1 546 W7BOB W4DHE 539 KY -190106_000300 7.080 Rx FT8 -9 0.2 844 CQ RU AE5JH EL07 -190106_000300 7.080 Rx FT8 -5 0.1 1536 W9WLX W0FRC R 549 CO -File 7 -190106_000315 7.080 Rx FT8 -5 0.1 335 VE3RX AB5XS 73 -190106_000315 7.080 Rx FT8 -13 0.1 424 WA1T PY2APK 529 0081 -190106_000315 7.080 Rx FT8 6 0.1 545 W7BOB W4DHE 539 KY -190106_000315 7.080 Rx FT8 -7 0.4 600 K2DH K7VZ 549 AZ -190106_000315 7.080 Rx FT8 9 0.1 689 VE3LON KA1YQC 73 -190106_000315 7.080 Rx FT8 -8 0.1 869 W7BOB W3KIT 539 MD -190106_000315 7.080 Rx FT8 -1 0.1 984 W4EMB N9OY R 529 WI -190106_000315 7.080 Rx FT8 -15 -0.1 1117 WB4FAY KB7RUQ 529 UT -190106_000315 7.080 Rx FT8 7 -0.2 1240 W6GMT K7RL 73 -190106_000315 7.080 Rx FT8 -5 0.2 1581 VA3WW WA4DYD 559 GA -190106_000315 7.080 Rx FT8 -8 0.1 1688 DD5ZZ W1QA R 569 MA -190106_000315 7.080 Rx FT8 4 0.7 1798 N3KCR WS4WW 73 -190106_000315 7.080 Rx FT8 16 0.1 1895 CQ RU KG4W FM17 -190106_000315 7.080 Rx FT8 -11 0.2 2125 CQ RU NF3R FN20 -190106_000330 7.080 Rx FT8 -8 0.1 1170 K1JT K8GNG RR73 -190106_000330 7.080 Rx FT8 -13 -0.1 454 NZ7P KM7S R 549 CA -190106_000330 7.080 Rx FT8 1 0.1 941 KW4RTR KO9V 559 NC -190106_000330 7.080 Rx FT8 -16 0.3 1034 W9JA W9OY 539 FL -190106_000330 7.080 Rx FT8 -2 0.1 1240 K2DH KD2GXL 559 NY -190106_000330 7.080 Rx FT8 -5 0.1 1536 W9WLX W0FRC 73 -190106_000330 7.080 Rx FT8 -2 -0.1 918 KF6JXM W5BT 529 TX -File 8 -190106_000345 7.080 Rx FT8 -5 0.1 335 CQ RU AB5XS EM12 -190106_000345 7.080 Rx FT8 -13 0.1 423 WA1T PY2APK 529 0081 -190106_000345 7.080 Rx FT8 6 0.2 689 CQ RU KA1YQC FN42 -190106_000345 7.080 Rx FT8 -16 0.1 852 W9TO KM4LFT RR73 -190106_000345 7.080 Rx FT8 -4 -0.1 918 KF6JXM W5BT 529 TX -190106_000345 7.080 Rx FT8 2 0.1 984 W4EMB N9OY R 529 WI -190106_000345 7.080 Rx FT8 -15 0.3 1034 W9JA W9OY RR73 -190106_000345 7.080 Rx FT8 -7 0.1 1175 K2DH KD2GXL 559 NY -190106_000345 7.080 Rx FT8 6 -0.1 1240 CQ RU K7RL CN88 -190106_000345 7.080 Rx FT8 -10 0.1 1536 CQ RU W0FRC DM79 -190106_000345 7.080 Rx FT8 -7 0.2 1581 VA3WW WA4DYD RR73 -190106_000345 7.080 Rx FT8 -9 0.1 1688 DD5ZZ W1QA 73 -190106_000345 7.080 Rx FT8 17 0.1 1895 CQ RU KG4W FM17 -190106_000345 7.080 Rx FT8 -9 0.1 2002 K2DH KN3ILZ 549 PA -190106_000400 7.080 Rx FT8 -5 0.7 2052 CQ RU WS4WW FM17 -190106_000400 7.080 Rx FT8 -9 0.2 2125 NV4G NF3R R 549 PA -190106_000400 7.080 Rx FT8 -5 0.0 941 KW4RTR KO9V RR73 -190106_000400 7.080 Rx FT8 -7 0.2 1744 KC1HTT K1LOG R 569 ME +File 1
+190106_000015 7.080 Rx FT8 -15 0.2 178 N1TRK N4FKH 569 VA
+190106_000015 7.080 Rx FT8 -13 -0.1 253 N1TRK KB7RUQ 539 UT
+190106_000015 7.080 Rx FT8 10 0.2 389 W0ZF N3LFC RR73
+190106_000015 7.080 Rx FT8 -10 0.1 450 PY4AZ KF7YED 559 MT
+190106_000015 7.080 Rx FT8 -3 0.2 507 N1TRK WA4DYD 559 GA
+190106_000015 7.080 Rx FT8 14 0.2 689 KB0VHA KA1YQC R 539 MA
+190106_000015 7.080 Rx FT8 -5 0.1 984 W9JA N9OY RR73
+190106_000015 7.080 Rx FT8 -12 0.1 1123 VA2CZ K8GNG RR73
+190106_000015 7.080 Rx FT8 2 0.1 1240 CQ RU K7RL CN88
+190106_000015 7.080 Rx FT8 -11 0.5 1293 K4ZMW K7VZ RR73
+190106_000015 7.080 Rx FT8 2 0.1 1387 WD9IGY KX1X 73
+190106_000015 7.080 Rx FT8 -10 0.1 1536 CQ RU W0FRC DM79
+190106_000015 7.080 Rx FT8 -2 0.1 1635 K4SQC VE3RX 549 ON
+190106_000030 7.080 Rx FT8 -11 0.2 1745 CQ RU K1LOG FN56
+190106_000030 7.080 Rx FT8 3 0.8 1798 WD5DAX WS4WW 73
+190106_000030 7.080 Rx FT8 12 0.1 1895 DJ6GI KG4W 73
+190106_000030 7.080 Rx FT8 -14 0.2 2119 KF7YED KF5ZNQ 549 TX
+190106_000030 7.080 Rx FT8 -5 0.1 336 CQ RU AB5XS EM12
+190106_000030 7.080 Rx FT8 0 0.0 1415 W3KIT AA8SW RR73
+190106_000030 7.080 Rx FT8 -13 0.3 1540 NI6G W7DRW 579 AZ
+190106_000030 7.080 Rx FT8 -10 0.1 312 SHIFT W9JA
+190106_000030 7.080 Rx FT8 -16 0.1 1447 W7BOB KJ7G 549 WA
+File 2
+190106_000045 7.080 Rx FT8 -9 0.1 178 N1TRK N4FKH 569 VA
+190106_000045 7.080 Rx FT8 -9 -0.1 253 N1TRK KB7RUQ RR73
+190106_000045 7.080 Rx FT8 -8 0.1 336 CQ RU AB5XS EM12
+190106_000045 7.080 Rx FT8 16 0.3 689 KB0VHA KA1YQC R 539 MA
+190106_000045 7.080 Rx FT8 -3 0.1 984 CQ RU N9OY EN43
+190106_000045 7.080 Rx FT8 -10 0.1 1146 K1JT WB4HXE 559 GA
+190106_000045 7.080 Rx FT8 6 0.1 1240 VE3LON K7RL R 549 WA
+190106_000045 7.080 Rx FT8 -1 0.1 1386 WD9IGY KX1X 73
+190106_000045 7.080 Rx FT8 -12 0.1 1536 CQ RU W0FRC DM79
+190106_000045 7.080 Rx FT8 3 0.1 1635 K4SQC VE3RX RR73
+190106_000045 7.080 Rx FT8 -5 0.1 1688 CQ RU W1QA FN32
+190106_000045 7.080 Rx FT8 1 0.8 1797 CQ RU WS4WW FM17
+190106_000045 7.080 Rx FT8 14 0.1 1895 HB9BUN KG4W R 549 VA
+190106_000100 7.080 Rx FT8 -7 0.1 2002 W9TO KN3ILZ 529 PA
+190106_000100 7.080 Rx FT8 -9 0.1 312 W9JA PY2APK RRR
+190106_000100 7.080 Rx FT8 -12 0.1 436 NZ7P WA7JAY 589 CA
+190106_000100 7.080 Rx FT8 -13 -0.1 1380 AC6BW KR9A R 559 WI
+190106_000100 7.080 Rx FT8 -17 0.1 1448 W7BOB KJ7G RR73
+190106_000100 7.080 Rx FT8 -7 0.3 1540 NI6G W7DRW 569 AZ
+File 3
+190106_000115 7.080 Rx FT8 -13 0.2 178 N1TRK N4FKH 569 VA
+190106_000115 7.080 Rx FT8 -14 -0.1 253 N1TRK KB7RUQ RR73
+190106_000115 7.080 Rx FT8 -5 0.1 336 CQ RU AB5XS EM12
+190106_000115 7.080 Rx FT8 -7 0.1 449 NI6G KF7YED 569 MT
+190106_000115 7.080 Rx FT8 14 0.2 689 KB0VHA KA1YQC 73
+190106_000115 7.080 Rx FT8 11 0.4 852 W9TO N4QWF 569 VA
+190106_000115 7.080 Rx FT8 -3 0.1 984 W4EMB N9OY R 529 WI
+190106_000115 7.080 Rx FT8 -14 0.1 1117 WB4FAY K7PDW 549 UT
+190106_000115 7.080 Rx FT8 3 0.2 1240 VE3LON K7RL R 559 WA
+190106_000115 7.080 Rx FT8 -18 0.1 1380 AC6BW KR9A R 559 WI
+190106_000115 7.080 Rx FT8 4 0.1 1475 K4KCL KB4S 559 VA
+190106_000130 7.080 Rx FT8 -5 0.1 1612 K1JT WB4HXE RR73
+190106_000115 7.080 Rx FT8 -1 0.1 1688 KW4RTR W1QA R 539 MA
+190106_000115 7.080 Rx FT8 -15 0.2 1745 CQ RU K1LOG FN56
+190106_000115 7.080 Rx FT8 3 0.8 1798 WA1T WS4WW R 579 VA
+190106_000115 7.080 Rx FT8 14 0.1 1895 HB9BUN KG4W R 549 VA
+190106_000115 7.080 Rx FT8 -9 0.2 2125 CQ RU NF3R FN20
+190106_000130 7.080 Rx FT8 -8 0.4 976 AG1T K7VZ 569 AZ
+190106_000130 7.080 Rx FT8 -7 0.1 1434 Z36W N4KMC 529 FL
+File 4
+190106_000145 7.080 Rx FT8 -8 0.1 335 CQ RU AB5XS EM12
+190106_000145 7.080 Rx FT8 -11 0.2 388 W0ZF WW4LL 559 ME
+190106_000145 7.080 Rx FT8 -10 0.1 449 NI6G KF7YED 569 MT
+190106_000145 7.080 Rx FT8 10 0.3 689 CQ RU KA1YQC FN42
+190106_000145 7.080 Rx FT8 12 0.4 852 W9TO N4QWF RR73
+190106_000145 7.080 Rx FT8 -2 0.1 984 W4EMB N9OY R 529 WI
+190106_000145 7.080 Rx FT8 -12 0.1 1117 WB4FAY K7PDW 549 UT
+190106_000145 7.080 Rx FT8 4 0.2 1240 VE3LON K7RL 73
+190106_000145 7.080 Rx FT8 -13 0.1 1348 WW5M KO9V 559 NC
+190106_000145 7.080 Rx FT8 -14 0.1 1380 AC6BW KR9A R 559 WI
+190106_000145 7.080 Rx FT8 2 0.1 1475 K4KCL KB4S RR73
+190106_000145 7.080 Rx FT8 -9 0.1 1536 KC1HTT W0FRC 73
+190106_000145 7.080 Rx FT8 1 0.1 1688 KW4RTR W1QA R 539 MA
+190106_000200 7.080 Rx FT8 1 0.8 1797 WA1T WS4WW R 569 VA
+190106_000200 7.080 Rx FT8 15 0.1 1895 CQ RU KG4W FM17
+190106_000200 7.080 Rx FT8 -6 0.2 2125 CQ RU NF3R FN20
+190106_000200 7.080 Rx FT8 -7 0.1 311 PD8DX PY2APK 539 0081
+190106_000200 7.080 Rx FT8 -3 0.5 976 AG1T K7VZ RR73
+190106_000200 7.080 Rx FT8 -5 0.1 1432 Z36W N4KMC 529 FL
+190106_000200 7.080 Rx FT8 -7 0.3 1540 N7BT W7DRW 559 AZ
+190106_000200 7.080 Rx FT8 -16 0.3 2124 N3KCR ON9COP 529 0053
+190106_000200 7.080 Rx FT8 -12 0.1 1448 K2DH KJ7G 549 WA
+File 5
+190106_000215 7.080 Rx FT8 11 0.1 435 K1JT WV8WA 569 WV
+190106_000215 7.080 Rx FT8 -4 0.1 335 CQ RU AB5XS EM12
+190106_000215 7.080 Rx FT8 10 0.5 689 CQ RU KA1YQC FN42
+190106_000215 7.080 Rx FT8 -10 0.1 843 CQ RU AE5JH EL07
+190106_000215 7.080 Rx FT8 -3 0.1 984 W4EMB N9OY R 529 WI
+190106_000215 7.080 Rx FT8 -10 0.1 1118 WB4FAY W5MO 539 TX
+190106_000215 7.080 Rx FT8 -16 0.1 1170 K1JT K8GNG 569 MI
+190106_000215 7.080 Rx FT8 6 0.1 1240 CQ RU K7RL CN88
+190106_000215 7.080 Rx FT8 -8 0.1 1348 WW5M KO9V RR73
+190106_000215 7.080 Rx FT8 -12 0.1 1432 Z36W N4KMC 529 FL
+190106_000215 7.080 Rx FT8 2 0.1 1490 KA6BIM KB4S 529 VA
+190106_000230 7.080 Rx FT8 -1 0.1 1688 CQ RU W1QA FN32
+190106_000230 7.080 Rx FT8 15 0.1 1895 DD5ZZ KG4W R 539 VA
+190106_000230 7.080 Rx FT8 -8 0.2 2125 CQ RU NF3R FN20
+190106_000230 7.080 Rx FT8 -13 0.1 1380 AC6BW KR9A R 559 WI
+190106_000230 7.080 Rx FT8 -4 0.1 1536 CQ RU W0FRC DM79
+190106_000230 7.080 Rx FT8 -8 0.3 1540 N7BT W7DRW 559 AZ
+File 6
+190106_000245 7.080 Rx FT8 6 0.1 635 K1JT WV8WA RR73
+190106_000245 7.080 Rx FT8 -12 0.1 335 VE3RX AB5XS R 589 TX
+190106_000245 7.080 Rx FT8 -16 0.1 423 WA1T PY2APK 529 0081
+190106_000245 7.080 Rx FT8 9 0.4 507 N1TRK N4QWF RR73
+190106_000245 7.080 Rx FT8 -10 0.1 869 W7BOB W3KIT 539 MD
+190106_000245 7.080 Rx FT8 -7 0.1 984 W4EMB N9OY R 529 WI
+190106_000245 7.080 Rx FT8 -13 0.1 1170 K1JT K8GNG 569 MI
+190106_000245 7.080 Rx FT8 5 0.1 1240 W6GMT K7RL R 569 WA
+190106_000245 7.080 Rx FT8 2 0.1 1490 KA6BIM KB4S 529 VA
+190106_000245 7.080 Rx FT8 -1 0.1 1688 CQ RU W1QA FN32
+190106_000245 7.080 Rx FT8 1 0.7 1798 N3KCR WS4WW R 599 VA
+190106_000245 7.080 Rx FT8 17 0.1 1895 DD5ZZ KG4W 73
+190106_000300 7.080 Rx FT8 -10 0.2 2125 CQ RU NF3R FN20
+190106_000300 7.080 Rx FT8 8 0.1 546 W7BOB W4DHE 539 KY
+190106_000300 7.080 Rx FT8 -9 0.2 844 CQ RU AE5JH EL07
+190106_000300 7.080 Rx FT8 -5 0.1 1536 W9WLX W0FRC R 549 CO
+File 7
+190106_000315 7.080 Rx FT8 -5 0.1 335 VE3RX AB5XS 73
+190106_000315 7.080 Rx FT8 -13 0.1 424 WA1T PY2APK 529 0081
+190106_000315 7.080 Rx FT8 6 0.1 545 W7BOB W4DHE 539 KY
+190106_000315 7.080 Rx FT8 -7 0.4 600 K2DH K7VZ 549 AZ
+190106_000315 7.080 Rx FT8 9 0.1 689 VE3LON KA1YQC 73
+190106_000315 7.080 Rx FT8 -8 0.1 869 W7BOB W3KIT 539 MD
+190106_000315 7.080 Rx FT8 -1 0.1 984 W4EMB N9OY R 529 WI
+190106_000315 7.080 Rx FT8 -15 -0.1 1117 WB4FAY KB7RUQ 529 UT
+190106_000315 7.080 Rx FT8 7 -0.2 1240 W6GMT K7RL 73
+190106_000315 7.080 Rx FT8 -5 0.2 1581 VA3WW WA4DYD 559 GA
+190106_000315 7.080 Rx FT8 -8 0.1 1688 DD5ZZ W1QA R 569 MA
+190106_000315 7.080 Rx FT8 4 0.7 1798 N3KCR WS4WW 73
+190106_000315 7.080 Rx FT8 16 0.1 1895 CQ RU KG4W FM17
+190106_000315 7.080 Rx FT8 -11 0.2 2125 CQ RU NF3R FN20
+190106_000330 7.080 Rx FT8 -8 0.1 1170 K1JT K8GNG RR73
+190106_000330 7.080 Rx FT8 -13 -0.1 454 NZ7P KM7S R 549 CA
+190106_000330 7.080 Rx FT8 1 0.1 941 KW4RTR KO9V 559 NC
+190106_000330 7.080 Rx FT8 -16 0.3 1034 W9JA W9OY 539 FL
+190106_000330 7.080 Rx FT8 -2 0.1 1240 K2DH KD2GXL 559 NY
+190106_000330 7.080 Rx FT8 -5 0.1 1536 W9WLX W0FRC 73
+190106_000330 7.080 Rx FT8 -2 -0.1 918 KF6JXM W5BT 529 TX
+File 8
+190106_000345 7.080 Rx FT8 -5 0.1 335 CQ RU AB5XS EM12
+190106_000345 7.080 Rx FT8 -13 0.1 423 WA1T PY2APK 529 0081
+190106_000345 7.080 Rx FT8 6 0.2 689 CQ RU KA1YQC FN42
+190106_000345 7.080 Rx FT8 -16 0.1 852 W9TO KM4LFT RR73
+190106_000345 7.080 Rx FT8 -4 -0.1 918 KF6JXM W5BT 529 TX
+190106_000345 7.080 Rx FT8 2 0.1 984 W4EMB N9OY R 529 WI
+190106_000345 7.080 Rx FT8 -15 0.3 1034 W9JA W9OY RR73
+190106_000345 7.080 Rx FT8 -7 0.1 1175 K2DH KD2GXL 559 NY
+190106_000345 7.080 Rx FT8 6 -0.1 1240 CQ RU K7RL CN88
+190106_000345 7.080 Rx FT8 -10 0.1 1536 CQ RU W0FRC DM79
+190106_000345 7.080 Rx FT8 -7 0.2 1581 VA3WW WA4DYD RR73
+190106_000345 7.080 Rx FT8 -9 0.1 1688 DD5ZZ W1QA 73
+190106_000345 7.080 Rx FT8 17 0.1 1895 CQ RU KG4W FM17
+190106_000345 7.080 Rx FT8 -9 0.1 2002 K2DH KN3ILZ 549 PA
+190106_000400 7.080 Rx FT8 -5 0.7 2052 CQ RU WS4WW FM17
+190106_000400 7.080 Rx FT8 -9 0.2 2125 NV4G NF3R R 549 PA
+190106_000400 7.080 Rx FT8 -5 0.0 941 KW4RTR KO9V RR73
+190106_000400 7.080 Rx FT8 -7 0.2 1744 KC1HTT K1LOG R 569 ME
diff --git a/lib/ft4/subtractft4.f90 b/lib/ft4/subtractft4.f90 index 8fb16532..136848fc 100755 --- a/lib/ft4/subtractft4.f90 +++ b/lib/ft4/subtractft4.f90 @@ -1,66 +1,66 @@ -subroutine subtractft4(dd,itone,f0,dt) - -! Subtract an ft4 signal -! -! Measured signal : dd(t) = a(t)cos(2*pi*f0*t+theta(t)) -! Reference signal : cref(t) = exp( j*(2*pi*f0*t+phi(t)) ) -! Complex amp : cfilt(t) = LPF[ dd(t)*CONJG(cref(t)) ] -! Subtract : dd(t) = dd(t) - 2*REAL{cref*cfilt} - - use timer_module, only: timer - - parameter (NMAX=21*3456,NSPS=576,NFFT=NMAX,NFILT=1400) - parameter (NFRAME=(103+2)*NSPS) - real*4 dd(NMAX), window(-NFILT/2:NFILT/2), xjunk - complex cref,camp,cfilt,cw - integer itone(103) - logical first - data first/.true./ - common/heap4/cref(NFRAME),camp(NMAX),cfilt(NMAX),cw(NMAX),xjunk(NFRAME) - save first - - nstart=dt*12000+1-NSPS - nsym=103 - fs=12000.0 - icmplx=1 - bt=1.0 - nss=NSPS - call gen_ft4wave(itone,nsym,nss,fs,f0,cref,xjunk,icmplx,NFRAME) - camp=0. - do i=1,nframe - id=nstart-1+i - if(id.ge.1.and.id.le.NMAX) camp(i)=dd(id)*conjg(cref(i)) - enddo - - if(first) then -! Create and normalize the filter - pi=4.0*atan(1.0) - fac=1.0/float(nfft) - sum=0.0 - do j=-NFILT/2,NFILT/2 - window(j)=cos(pi*j/NFILT)**2 - sum=sum+window(j) - enddo - cw=0. - cw(1:NFILT+1)=window/sum - cw=cshift(cw,NFILT/2+1) - call four2a(cw,nfft,1,-1,1) - cw=cw*fac - first=.false. - endif - - cfilt=0.0 - cfilt(1:nframe)=camp(1:nframe) - call four2a(cfilt,nfft,1,-1,1) - cfilt(1:nfft)=cfilt(1:nfft)*cw(1:nfft) - call four2a(cfilt,nfft,1,1,1) - -! Subtract the reconstructed signal - do i=1,nframe - j=nstart+i-1 - if(j.ge.1 .and. j.le.NMAX) dd(j)=dd(j)-2*REAL(cfilt(i)*cref(i)) - enddo - - return -end subroutine subtractft4 - +subroutine subtractft4(dd,itone,f0,dt)
+
+! Subtract an ft4 signal
+!
+! Measured signal : dd(t) = a(t)cos(2*pi*f0*t+theta(t))
+! Reference signal : cref(t) = exp( j*(2*pi*f0*t+phi(t)) )
+! Complex amp : cfilt(t) = LPF[ dd(t)*CONJG(cref(t)) ]
+! Subtract : dd(t) = dd(t) - 2*REAL{cref*cfilt}
+
+ use timer_module, only: timer
+
+ parameter (NMAX=21*3456,NSPS=576,NFFT=NMAX,NFILT=1400)
+ parameter (NFRAME=(103+2)*NSPS)
+ real*4 dd(NMAX), window(-NFILT/2:NFILT/2), xjunk
+ complex cref,camp,cfilt,cw
+ integer itone(103)
+ logical first
+ data first/.true./
+ common/heap4/cref(NFRAME),camp(NMAX),cfilt(NMAX),cw(NMAX),xjunk(NFRAME)
+ save first
+
+ nstart=dt*12000+1-NSPS
+ nsym=103
+ fs=12000.0
+ icmplx=1
+ bt=1.0
+ nss=NSPS
+ call gen_ft4wave(itone,nsym,nss,fs,f0,cref,xjunk,icmplx,NFRAME)
+ camp=0.
+ do i=1,nframe
+ id=nstart-1+i
+ if(id.ge.1.and.id.le.NMAX) camp(i)=dd(id)*conjg(cref(i))
+ enddo
+
+ if(first) then
+! Create and normalize the filter
+ pi=4.0*atan(1.0)
+ fac=1.0/float(nfft)
+ sum=0.0
+ do j=-NFILT/2,NFILT/2
+ window(j)=cos(pi*j/NFILT)**2
+ sum=sum+window(j)
+ enddo
+ cw=0.
+ cw(1:NFILT+1)=window/sum
+ cw=cshift(cw,NFILT/2+1)
+ call four2a(cw,nfft,1,-1,1)
+ cw=cw*fac
+ first=.false.
+ endif
+
+ cfilt=0.0
+ cfilt(1:nframe)=camp(1:nframe)
+ call four2a(cfilt,nfft,1,-1,1)
+ cfilt(1:nfft)=cfilt(1:nfft)*cw(1:nfft)
+ call four2a(cfilt,nfft,1,1,1)
+
+! Subtract the reconstructed signal
+ do i=1,nframe
+ j=nstart+i-1
+ if(j.ge.1 .and. j.le.NMAX) dd(j)=dd(j)-2*REAL(cfilt(i)*cref(i))
+ enddo
+
+ return
+end subroutine subtractft4
+
diff --git a/lib/ft4/sync4d.f90 b/lib/ft4/sync4d.f90 index 50ae5d9f..8d78f66a 100755 --- a/lib/ft4/sync4d.f90 +++ b/lib/ft4/sync4d.f90 @@ -1,96 +1,96 @@ -subroutine sync4d(cd0,i0,ctwk,itwk,sync) - -! Compute sync power for a complex, downsampled FT4 signal. - - include 'ft4_params.f90' - parameter(NP=NMAX/NDOWN,NSS=NSPS/NDOWN) - complex cd0(0:NP-1) - complex csynca(2*NSS),csyncb(2*NSS),csyncc(2*NSS),csyncd(2*NSS) - complex csync2(2*NSS) - complex ctwk(2*NSS) - complex z1,z2,z3,z4 - logical first - integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3) - data icos4a/0,1,3,2/ - data icos4b/1,0,2,3/ - data icos4c/2,3,1,0/ - data icos4d/3,2,0,1/ - data first/.true./ - save first,twopi,csynca,csyncb,csyncc,csyncd,fac - - p(z1)=(real(z1*fac)**2 + aimag(z1*fac)**2)**0.5 !Statement function for power - - if( first ) then - twopi=8.0*atan(1.0) - k=1 - phia=0.0 - phib=0.0 - phic=0.0 - phid=0.0 - do i=0,3 - dphia=2*twopi*icos4a(i)/real(NSS) - dphib=2*twopi*icos4b(i)/real(NSS) - dphic=2*twopi*icos4c(i)/real(NSS) - dphid=2*twopi*icos4d(i)/real(NSS) - do j=1,NSS/2 - csynca(k)=cmplx(cos(phia),sin(phia)) - csyncb(k)=cmplx(cos(phib),sin(phib)) - csyncc(k)=cmplx(cos(phic),sin(phic)) - csyncd(k)=cmplx(cos(phid),sin(phid)) - phia=mod(phia+dphia,twopi) - phib=mod(phib+dphib,twopi) - phic=mod(phic+dphic,twopi) - phid=mod(phid+dphid,twopi) - k=k+1 - enddo - enddo - first=.false. - fac=1.0/(2.0*NSS) - endif - - i1=i0 !four Costas arrays - i2=i0+33*NSS - i3=i0+66*NSS - i4=i0+99*NSS - - z1=0. - z2=0. - z3=0. - z4=0. - - if(itwk.eq.1) csync2=ctwk*csynca !Tweak the frequency - z1=0. - if(i1.ge.0 .and. i1+4*NSS-1.le.NP-1) then - z1=sum(cd0(i1:i1+4*NSS-1:2)*conjg(csync2)) - elseif( i1.lt.0 ) then - npts=(i1+4*NSS-1)/2 - if(npts.le.16) then - z1=0. - else - z1=sum(cd0(0:i1+4*NSS-1:2)*conjg(csync2(2*NSS-npts:))) - endif - endif - - if(itwk.eq.1) csync2=ctwk*csyncb !Tweak the frequency - if(i2.ge.0 .and. i2+4*NSS-1.le.NP-1) z2=sum(cd0(i2:i2+4*NSS-1:2)*conjg(csync2)) - - if(itwk.eq.1) csync2=ctwk*csyncc !Tweak the frequency - if(i3.ge.0 .and. i3+4*NSS-1.le.NP-1) z3=sum(cd0(i3:i3+4*NSS-1:2)*conjg(csync2)) - - if(itwk.eq.1) csync2=ctwk*csyncd !Tweak the frequency - z4=0. - if(i4.ge.0 .and. i4+4*NSS-1.le.NP-1) then - z4=sum(cd0(i4:i4+4*NSS-1:2)*conjg(csync2)) - elseif( i4+4*NSS-1.gt.NP-1 ) then - npts=(NP-1-i4+1)/2 - if(npts.le.16) then - z4=0. - else - z4=sum(cd0(i4:i4+2*npts-1:2)*conjg(csync2(1:npts))) - endif - endif - - sync = p(z1) + p(z2) + p(z3) + p(z4) - - return -end subroutine sync4d +subroutine sync4d(cd0,i0,ctwk,itwk,sync)
+
+! Compute sync power for a complex, downsampled FT4 signal.
+
+ include 'ft4_params.f90'
+ parameter(NP=NMAX/NDOWN,NSS=NSPS/NDOWN)
+ complex cd0(0:NP-1)
+ complex csynca(2*NSS),csyncb(2*NSS),csyncc(2*NSS),csyncd(2*NSS)
+ complex csync2(2*NSS)
+ complex ctwk(2*NSS)
+ complex z1,z2,z3,z4
+ logical first
+ integer icos4a(0:3),icos4b(0:3),icos4c(0:3),icos4d(0:3)
+ data icos4a/0,1,3,2/
+ data icos4b/1,0,2,3/
+ data icos4c/2,3,1,0/
+ data icos4d/3,2,0,1/
+ data first/.true./
+ save first,twopi,csynca,csyncb,csyncc,csyncd,fac
+
+ p(z1)=(real(z1*fac)**2 + aimag(z1*fac)**2)**0.5 !Statement function for power
+
+ if( first ) then
+ twopi=8.0*atan(1.0)
+ k=1
+ phia=0.0
+ phib=0.0
+ phic=0.0
+ phid=0.0
+ do i=0,3
+ dphia=2*twopi*icos4a(i)/real(NSS)
+ dphib=2*twopi*icos4b(i)/real(NSS)
+ dphic=2*twopi*icos4c(i)/real(NSS)
+ dphid=2*twopi*icos4d(i)/real(NSS)
+ do j=1,NSS/2
+ csynca(k)=cmplx(cos(phia),sin(phia))
+ csyncb(k)=cmplx(cos(phib),sin(phib))
+ csyncc(k)=cmplx(cos(phic),sin(phic))
+ csyncd(k)=cmplx(cos(phid),sin(phid))
+ phia=mod(phia+dphia,twopi)
+ phib=mod(phib+dphib,twopi)
+ phic=mod(phic+dphic,twopi)
+ phid=mod(phid+dphid,twopi)
+ k=k+1
+ enddo
+ enddo
+ first=.false.
+ fac=1.0/(2.0*NSS)
+ endif
+
+ i1=i0 !four Costas arrays
+ i2=i0+33*NSS
+ i3=i0+66*NSS
+ i4=i0+99*NSS
+
+ z1=0.
+ z2=0.
+ z3=0.
+ z4=0.
+
+ if(itwk.eq.1) csync2=ctwk*csynca !Tweak the frequency
+ z1=0.
+ if(i1.ge.0 .and. i1+4*NSS-1.le.NP-1) then
+ z1=sum(cd0(i1:i1+4*NSS-1:2)*conjg(csync2))
+ elseif( i1.lt.0 ) then
+ npts=(i1+4*NSS-1)/2
+ if(npts.le.16) then
+ z1=0.
+ else
+ z1=sum(cd0(0:i1+4*NSS-1:2)*conjg(csync2(2*NSS-npts:)))
+ endif
+ endif
+
+ if(itwk.eq.1) csync2=ctwk*csyncb !Tweak the frequency
+ if(i2.ge.0 .and. i2+4*NSS-1.le.NP-1) z2=sum(cd0(i2:i2+4*NSS-1:2)*conjg(csync2))
+
+ if(itwk.eq.1) csync2=ctwk*csyncc !Tweak the frequency
+ if(i3.ge.0 .and. i3+4*NSS-1.le.NP-1) z3=sum(cd0(i3:i3+4*NSS-1:2)*conjg(csync2))
+
+ if(itwk.eq.1) csync2=ctwk*csyncd !Tweak the frequency
+ z4=0.
+ if(i4.ge.0 .and. i4+4*NSS-1.le.NP-1) then
+ z4=sum(cd0(i4:i4+4*NSS-1:2)*conjg(csync2))
+ elseif( i4+4*NSS-1.gt.NP-1 ) then
+ npts=(NP-1-i4+1)/2
+ if(npts.le.16) then
+ z4=0.
+ else
+ z4=sum(cd0(i4:i4+2*npts-1:2)*conjg(csync2(1:npts)))
+ endif
+ endif
+
+ sync = p(z1) + p(z2) + p(z3) + p(z4)
+
+ return
+end subroutine sync4d
|
