diff options
| author | Christoph Berg <myon@debian.org> | 2025-09-15 23:04:33 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-09-15 23:04:33 +0200 |
| commit | e1c678ef00f0159bbeb5571e5ebb0d4697121334 (patch) | |
| tree | 6547edef81a62a812a4d0f64e03fda226b5f0a7e /lib/ft8 | |
| parent | b9daa22c4c3ad51cd4bc0ef624a19f21d01c9305 (diff) | |
| parent | 0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff) | |
Update upstream source from tag 'upstream/3.0.0_rc1+repack'
Update to upstream version '3.0.0~rc1+repack'
with Debian dir 68c212e23136fecf9ebc6f12ff355579224d27ee
Diffstat (limited to 'lib/ft8')
| -rwxr-xr-x | lib/ft8/foxgen.f90 | 27 | ||||
| -rwxr-xr-x | lib/ft8/foxgen_wrap.f90 | 4 | ||||
| -rwxr-xr-x | lib/ft8/ft8_a7.f90 | 57 | ||||
| -rwxr-xr-x | lib/ft8/ft8_a8_test.f90 | 47 | ||||
| -rwxr-xr-x | lib/ft8/ft8_a8d.f90 | 187 | ||||
| -rwxr-xr-x | lib/ft8/ft8_downsample.f90 | 9 | ||||
| -rwxr-xr-x | lib/ft8/ft8_testmsg.f90 | 7 | ||||
| -rwxr-xr-x | lib/ft8/ft8b.f90 | 69 | ||||
| -rwxr-xr-x | lib/ft8/ft8code.f90 | 6 | ||||
| -rwxr-xr-x | lib/ft8/ft8d.f90 | 2 | ||||
| -rwxr-xr-x | lib/ft8/ft8sim.f90 | 62 | ||||
| -rwxr-xr-x | lib/ft8/gen_ft8wave.f90 | 2 | ||||
| -rwxr-xr-x | lib/ft8/ldpcsim174_91.f90 | 223 | ||||
| -rwxr-xr-x | lib/ft8/sync8.f90 | 9 | ||||
| -rwxr-xr-x | lib/ft8/watterson.f90 | 2 |
15 files changed, 605 insertions, 108 deletions
diff --git a/lib/ft8/foxgen.f90 b/lib/ft8/foxgen.f90 index a2899e52..b9e39f62 100755 --- a/lib/ft8/foxgen.f90 +++ b/lib/ft8/foxgen.f90 @@ -1,4 +1,4 @@ -subroutine foxgen()
+subroutine foxgen(bSuperFox,fname)
! Called from MainWindow::foxTxSequencer() to generate the Tx waveform in
! FT8 Fox mode. The Tx message can contain up to 5 "slots", each carrying
@@ -17,7 +17,10 @@ subroutine foxgen() parameter (NN=79,ND=58,NSPS=4*1920)
parameter (NWAVE=(160+2)*134400*4) !the biggest waveform we generate (FST4-1800 at 48kHz)
parameter (NFFT=614400,NH=NFFT/2)
- character*40 cmsg
+ logical*1 bSuperFox,bMoreCQs,bSendMsg
+ character*(*) fname
+ character*40 cmsg,cmsg2
+ character*26 textMsg
character*37 msg,msgsent
integer itone(79)
integer*1 msgbits(77),msgbits2
@@ -25,10 +28,26 @@ subroutine foxgen() real x(NFFT)
real*8 dt,twopi,f0,fstep,dfreq,phi,dphi
complex cx(0:NH)
- common/foxcom/wave(NWAVE),nslots,nfreq,i3bit(5),cmsg(5),mycall(12)
+ common/foxcom/wave(NWAVE),nslots,nfreq,i3bit(5),cmsg(5),mycall(12), &
+ textMsg,bMoreCQs,bSendMsg
common/foxcom2/itone2(NN),msgbits2(77)
+ common/foxcom3/nslots2,cmsg2(5),itone3(151)
equivalence (x,cx),(y,cy)
+ if(bSuperFox) then
+ n=nslots
+ if(bMoreCQs) cmsg(1)(40:40)='1' !Set flag to include a CQ
+ if(bSendMsg) then
+ n=min(nslots+1,3)
+ cmsg(n)=textMsg
+ cmsg(n)(39:39)='1' !Set flag for text message
+ nslots=n
+ endif
+ nslots2=nslots
+ cmsg2=cmsg
+ go to 999
+ endif
+
fstep=60.d0
dfreq=6.25d0
dt=1.d0/48000.d0
@@ -66,7 +85,7 @@ subroutine foxgen() peak3=maxval(abs(wave))
wave=wave/peak3
- return
+999 return
end subroutine foxgen
! include 'plotspec.f90'
diff --git a/lib/ft8/foxgen_wrap.f90 b/lib/ft8/foxgen_wrap.f90 index 82510760..170b93fc 100755 --- a/lib/ft8/foxgen_wrap.f90 +++ b/lib/ft8/foxgen_wrap.f90 @@ -2,12 +2,12 @@ subroutine foxgen_wrap(msg40,msgbits,itone) parameter (NN=79,ND=58,KK=77,NSPS=4*1920)
parameter (NWAVE=(160+2)*134400*4) !the biggest waveform we generate (FST4-1800)
-
+ logical*1 bMoreCQs
character*40 msg40,cmsg
character*12 mycall12
integer*1 msgbits(KK),msgbits2
integer itone(NN)
- common/foxcom/wave(NWAVE),nslots,nfreq,i3bit(5),cmsg(5),mycall12
+ common/foxcom/wave(NWAVE),nslots,nfreq,i3bit(5),cmsg(5),mycall12,bMoreCQs
common/foxcom2/itone2(NN),msgbits2(KK)
nslots=1
diff --git a/lib/ft8/ft8_a7.f90 b/lib/ft8/ft8_a7.f90 index c7578edf..b77e641c 100755 --- a/lib/ft8/ft8_a7.f90 +++ b/lib/ft8/ft8_a7.f90 @@ -1,6 +1,6 @@ module ft8_a7
- parameter(MAXDEC=100)
+ parameter(MAXDEC=200)
! For the following three arrays
! First index i=decode number in this sequence
@@ -17,7 +17,7 @@ module ft8_a7 contains
-subroutine ft8_a7_save(nutc,dt,f,msg)
+subroutine ft8_a7_save(jseq,dt,f,msg)
use packjt77
character*37 msg,msg1
@@ -37,13 +37,12 @@ subroutine ft8_a7_save(nutc,dt,f,msg) call split77(msg,nwords,nw,w) !Parse msg into words
if(nwords.lt.1) go to 999
if(w(1)(1:3).eq.'CQ_') go to 999
- j=mod(nutc/5,2) !j is 0 or 1 for odd/even sequence
- jseq=j
+ j=jseq
! Add this decode to current table for this sequence
ndec(j,1)=ndec(j,1)+1 !Number of decodes in this sequence
i=ndec(j,1) !i is index of a new table entry
- if(i.ge.MAXDEC-1) return !Prevent table overflow
+ if(i.gt.MAXDEC) return !Prevent table overflow (indexes start at 1)
dt0(i,j,1)=dt !Save dt in table
f0(i,j,1)=f !Save f in table
@@ -362,9 +361,9 @@ subroutine ft8_a7d(dd0,newdat,call_1,call_2,grid4,xdt,f1,xbase,nharderrors,dmin, dmm(iloc(1))=1.e30
iloc=minloc(dmm)
dmin2=dmm(iloc(1))
- xsnr=-24.
+ xsnr=-25.
arg=pbest/xbase/3.0e6-1.0
- if(arg.gt.0.0) xsnr=max(-24.0,db(arg)-27.0)
+ if(arg.gt.0.0) xsnr=max(-25.0,db(arg)-27.0)
! write(41,3041) nharderrors,dmin,dmin2,dmin2/dmin,xsnr,trim(msgbest)
!3041 format(i3,2f7.1,f7.2,f7.1,1x,a)
if(dmin.gt.100.0 .or. dmin2/dmin.lt.1.3) nharderrors=-1
@@ -375,4 +374,48 @@ subroutine ft8_a7d(dd0,newdat,call_1,call_2,grid4,xdt,f1,xbase,nharderrors,dmin, return
end subroutine ft8_a7d
+subroutine getmsg(i,mycall,hiscall,hisgrid,msg)
+
+ character*12 mycall,hiscall
+ character*6 hisgrid
+ character*37 msg
+ logical my_std,his_std
+
+ call stdcall(mycall,my_std)
+ call stdcall(hiscall,his_std)
+
+ isnr=0
+ msg=trim(mycall)//' '//trim(hiscall)
+ if(.not.my_std) then
+ if(i.eq.1 .or. i.ge.6) msg='<'//trim(mycall)//'> '//trim(hiscall)
+ if(i.ge.2 .and. i.le.4) msg=trim(mycall)//' <'//trim(hiscall)//'>'
+ else if(.not.his_std) then
+ if(i.le.4 .or. i.eq.6) msg='<'//trim(mycall)//'> '//trim(hiscall)
+ if(i.ge.7) msg=trim(mycall)//' <'//trim(hiscall)//'>'
+ endif
+ j0=len(trim(msg))+2
+ if(i.eq.2) msg(j0:j0+2)='RRR'
+ if(i.eq.3) msg(j0:j0+3)='RR73'
+ if(i.eq.4) msg(j0:j0+1)='73'
+ if(i.eq.5) then
+ if(his_std) msg='CQ '//trim(hiscall)//' '//hisgrid(1:4)
+ if(.not.his_std) msg='CQ '//trim(hiscall)
+ endif
+ if(i.eq.6 .and. his_std) msg(j0:j0+3)=hisgrid(1:4)
+ if(i.ge.7 .and. i.le.206) then
+ isnr = -50 + (i-7)/2
+ if(iand(i,1).eq.1) then
+ write(msg(j0:j0+2),'(i3.2)') isnr
+ if(msg(j0:j0).eq.' ') msg(j0:j0)='+'
+ else
+ write(msg(j0:j0+3),'("R",i3.2)') isnr
+ if(msg(j0+1:j0+1).eq.' ') msg(j0+1:j0+1)='+'
+ endif
+ endif
+
+ if(abs(isnr).gt.30) msg=''
+
+ return
+end subroutine getmsg
+
end module ft8_a7
diff --git a/lib/ft8/ft8_a8_test.f90 b/lib/ft8/ft8_a8_test.f90 new file mode 100755 index 00000000..02777460 --- /dev/null +++ b/lib/ft8/ft8_a8_test.f90 @@ -0,0 +1,47 @@ +program ft8_a8_test
+
+! Aid for testing "a8" decodes -- those based on known MyCall, DXcall, and DXgrid.
+
+ use wavhdr
+ use ft8_a7
+ include 'ft8_params.f90' !Set various constants
+ type(hdr) h !Header for .wav file
+ character arg*12,fname*120
+ character mycall*12,dxcall*12,dxgrid*6
+ character*37 msgbest
+ character*4 apflag
+ integer*2 iwave(NMAX) !Raw data from a *.wav file, fsample = 12000 Hz
+ real dd(NMAX) !Floating point copy of iwave
+
+! Get command-line argument(s)
+ nargs=iargc()
+ if(nargs.lt.6) then
+ print*,'Usage: ft8_a8_test MyCall DXcall DXgrid f1 ndepth fname [...]'
+ print*,'Example: ft8_a8_test W3SZ DL3WDG JN68 1500 3 250804_120500.wav'
+ go to 999
+ endif
+ call getarg(1,mycall) !Message to be transmitted
+ call getarg(2,dxcall)
+ call getarg(3,dxgrid)
+ call getarg(4,arg)
+ read(arg,*) f1 !Expected Rx Freq
+ call getarg(5,arg)
+ read(arg,*) ndepth !Decoding depth
+
+ do ifile=1,nargs-5
+ call getarg(ifile+5,fname) !File name for *.wav data
+ open(10,file=trim(fname),status='old',access='stream')
+ read(10) h,iwave
+ fac=1.0/32767.0
+ dd=fac*iwave
+
+ call ft8_a8d(dd,mycall,dxcall,dxgrid,f1,xdt,fbest,xsnr,plog,msgbest)
+
+ apflag=' a8'
+ if(plog.lt.-155) apflag(1:1)='?'
+ if(len(trim(msgbest)).eq.0) apflag=' '
+ write(*,1100) ifile,xdt,fbest,xsnr,plog,msgbest,apflag
+1100 format(i4,f6.2,3f7.1,1x,a37,a4)
+ enddo
+
+999 end program ft8_a8_test
diff --git a/lib/ft8/ft8_a8d.f90 b/lib/ft8/ft8_a8d.f90 new file mode 100755 index 00000000..508e5959 --- /dev/null +++ b/lib/ft8/ft8_a8d.f90 @@ -0,0 +1,187 @@ +subroutine ft8_a8d(dd,mycall,dxcall,dxgrid,f1a,xdt,fbest,xsnr,plog,msgbest)
+
+! List decoding for FT8, activated only at nfqso (Rx Freq) +/- 10 Hz and when
+! DxCall and DxGrid are populated. Returns xdt, fbest, and msgbest.
+
+ use packjt77
+ use ft8_a7
+ use timer_module, only: timer
+ include 'ft8_params.f90' !Set various constants
+ parameter (NWAVE=NN*NSPS/NDOWN) !Length of generated cwave = 2528
+ parameter (NZZ=3200) !Length of downsampled arrays
+ parameter (NFFT=NZZ,NH=NFFT/2) !FFT length
+ parameter (NMSGS=206) !Number of messages to be tried
+ parameter (PLOG_MIN=-160.0) !Minimum log probability
+ character mycall*12,dxcall*12,dxgrid*6
+ character*37 msg,msgsent,msgbest
+ character*77 c77
+ integer*1 msgbits(77)
+ real xjunk(NZZ)
+ real s(-NH:NH) !Power spectrum of cd0
+! real s00(-NH:NH) !Raw spectrum of downsampled data
+ real s0(-NH:NH) !Best-fit re-centered spectrum for this msg
+ real s1(-NH:NH) !Overall best-fit re-centered spectrum
+ real s8(0:7) !Spectrum of a single symbol
+ real dd(NMAX) !Floating point copy of iwave
+ real a(5)
+ complex cwave(0:NZZ-1) !Complex waveform corresponding to msg
+ complex cd(0:NZZ-1) !Data from dd, now complex and sampled at 200 Hz
+ complex cd0(0:NZZ-1) !All tones in cd nominally shifted to 0 Hz
+ complex csymb(0:31)
+ integer itone(NN)
+ integer itone_best(NN)
+ integer ipk(1)
+ logical newdat
+
+ f1=f1a
+ newdat=.true.
+! Mix from f1 to baseband and downsample from dd into cd (complex, 200 Hz sampling)
+ call ft8_downsample(dd,newdat,f1,cd)
+ fac=1.e-6
+
+ fsd=200.0 !Downsampled rate (Hz)
+ bt=2.0 !Gaussian smoothing parameter
+ dt=1.0/fsd
+ df=200.0/NFFT
+ s=0.
+ ss=0.
+ sq=0.
+
+! Find the message that fits the received waveform best
+ sbest=0.
+ tbest=0.
+ fbest=0.
+ msgbest=''
+ itone_best=0
+ do imsg=1,NMSGS
+ call getmsg(imsg,mycall,dxcall,dxgrid,msg)
+
+! Source-encode the message, get itone(), and generate complex FT8 waveform.
+ i3=-1
+ n3=-1
+ call pack77(msg,i3,n3,c77)
+ call genft8(msg,i3,n3,msgsent,msgbits,itone)
+ call gen_ft8wave(itone,NN,32,bt,fsd,0.0,cwave,xjunk,1,NWAVE)
+ cwave(NWAVE:)=0.
+
+! For this message, find the best lag
+ spk=0.
+ fpk=0.
+ tpk=0.
+ lagpk=0
+ lag1=-200
+ lag2=200
+ lagstep=4
+ do iter=1,2
+ if(iter.eq.2) then
+ lag1=lagpk-8
+ lag2=lagpk+8
+ lagstep=1
+ endif
+ do lag=lag1,lag2,lagstep
+ do i=0,NWAVE-1
+ j=i+lag + 100
+ cd0(i)=0.
+ if(j.ge.0 .and. j.le.NWAVE-1) cd0(i)=cd(j)*conjg(cwave(i))
+ enddo
+
+ cd0(NWAVE:)=0.
+ call four2a(cd0,NFFT,1,-1,1) !Forward c2c FFT
+
+ do i=0,NFFT-1
+ j=i
+ if(i.gt.NH) j=i-NFFT
+ s(j)=fac*(real(cd0(i))**2 + aimag(cd0(i))**2)
+ enddo
+
+ call smo121(s,NFFT+1)
+
+ smax=0.
+ do j=-NH,NH
+ smax=max(s(j),smax)
+ if(s(j).gt.spk) then
+ spk=s(j)
+ fpk=j*df + f1
+ lagpk=lag
+ tpk=lag*dt
+ s0=s !Save best-fit spectrum for this msg
+ endif
+ enddo ! j
+ enddo ! lag
+ enddo ! iter
+
+ if(spk.gt.sbest) then
+ sbest=spk
+ fbest=fpk
+ tbest=tpk
+ msgbest=msg
+ itone_best=itone
+ s1=s0 !Save overall best-fit spectrum
+ endif
+ enddo ! imsg
+
+ a=0
+ a(1)=f1-fbest
+! if(abs(a(1)+5.0).gt.10.0) then !Effective Ftol = 10 Hz
+ if(abs(a(1)).gt.5.0) then !Effective Ftol = 5 Hz
+ msgbest=''
+ return
+ endif
+ call twkfreq1(cd,NZZ,200.0,a,cd) !Re-center the spectrum
+
+ xdt=tbest
+ ave=(sum(s1(-200:-100)) + sum(s1(100:200)))/202.0
+ s1=s1/ave - 1.0
+ s1pk=maxval(s1(-32:32))
+ sig=0.
+ nsig=0
+ do i=-32,32
+ if(s1(i).lt.0.5*s1pk) cycle
+ sig=sig+s1(i)
+ nsig=nsig+1
+ enddo
+ sig=sig/nsig
+ xsnr=db(sig)-35.0
+
+ if(msgbest.ne.'') then
+! Compute probability of successful decode.
+ plog=0.0
+ nhard=0
+ nsum=0
+ sum_sync=0.
+ sum_sig=0.
+ sum_big=0.
+ do k=1,NN
+ i0=32*(k-1) + nint((tbest+0.5)/0.005)
+ csymb=0.
+ do i=0,31
+ if(i0+i.ge.0 .and. i0+i.le.NZZ-1) csymb(i)=cd(i0+i)
+ enddo
+ call four2a(csymb,32,1,-1,1) !c2c
+ do i=0,7
+ s8(i)=real(csymb(i))**2 + aimag(csymb(i))**2
+ enddo
+ s8sum=sum(s8)
+ if(s8sum.gt.0.0) then
+ p=s8(itone_best(k))/s8sum
+ plog=plog + log(p)
+ nsum=nsum+1
+ endif
+ ipk=maxloc(s8)-1
+ if(ipk(1).ne.itone_best(k)) nhard=nhard+1
+ if(k.le.7 .or. (k.ge.37 .and. k.le.43) .or. k.ge.73) then
+ sum_sync=sum_sync + s8(itone_best(k))
+ else
+ sum_sig=sum_sig + s8(itone_best(k))
+ endif
+ sum_big=sum_big + s8(ipk(1))
+ enddo
+ if(nsum.lt.NN) plog=plog + (NN-nsum)*log(0.125)
+ sigobig=(sum_sync+sum_sig)/sum_big
+! write(60,3060) nsum,xdt,fbest,xsnr,plog,nhard,sigosync,sigobig,trim(msgbest)
+!3060 format(i2,f8.3,3f8.1,i5,2f7.2,1x,a)
+ if(nhard.gt.54 .or. plog.lt.-159.0 .or. sigobig.lt.0.71) msgbest=''
+ endif
+
+ return
+end subroutine ft8_a8d
diff --git a/lib/ft8/ft8_downsample.f90 b/lib/ft8/ft8_downsample.f90 index f3552258..a57b5324 100755 --- a/lib/ft8/ft8_downsample.f90 +++ b/lib/ft8/ft8_downsample.f90 @@ -8,10 +8,10 @@ subroutine ft8_downsample(dd,newdat,f0,c1) logical newdat,first
complex c1(0:NFFT2-1)
complex cx(0:NFFT1/2)
- real dd(NMAX),x(NFFT1),taper(0:100)
- equivalence (x,cx)
+ real dd(NMAX),x(NFFT1+2),taper(0:100)
data first/.true./
- save cx,first,taper
+ save x,cx,first,taper
+ equivalence (x,cx)
if(first) then
pi=4.0*atan(1.0)
@@ -23,11 +23,10 @@ subroutine ft8_downsample(dd,newdat,f0,c1) if(newdat) then
! Data in dd have changed, recompute the long FFT
x(1:NMAX)=dd
- x(NMAX+1:NFFT1)=0. !Zero-pad the x array
+ x(NMAX+1:NFFT1+2)=0. !Zero-pad the x array
call four2a(cx,NFFT1,1,-1,0) !r2c FFT to freq domain
newdat=.false.
endif
-
df=12000.0/NFFT1
baud=12000.0/NSPS
i0=nint(f0/df)
diff --git a/lib/ft8/ft8_testmsg.f90 b/lib/ft8/ft8_testmsg.f90 index 931df4f5..1728e39f 100755 --- a/lib/ft8/ft8_testmsg.f90 +++ b/lib/ft8/ft8_testmsg.f90 @@ -1,10 +1,8 @@ - parameter (MAXTEST=75,NTEST=48)
+ parameter (MAXTEST=75,NTEST=49)
character*37 testmsg(MAXTEST)
data testmsg(1:NTEST)/ &
"TNX BOB 73 GL", & ! 0.0
"K1ABC RR73; W9XYZ <KH1/KH7Z> -08", & ! 0.1
- "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
@@ -31,6 +29,9 @@ "<YW18FIFA> KA1ABC R-17", & ! 1.
"<YW18FIFA> KA1ABC 73", & ! 1.
"CQ G4ABC/P IO91", & ! 2.
+ "CQ TEST G4ABC/P IO91", & ! 2.
+ "<PA9XYZ> <G4ABC/P> 570123 IO91NP", & ! 2.
+ "<G4ABC/P> <PA9XYZ> R 580071 JO22DB", & ! 2.
"G4ABC/P PA9XYZ JO22", & ! 2.
"PA9XYZ G4ABC/P RR73", & ! 2.
"K1ABC W9XYZ 579 WI", & ! 3.
diff --git a/lib/ft8/ft8b.f90 b/lib/ft8/ft8b.f90 index 75b17adf..94423fff 100755 --- a/lib/ft8/ft8b.f90 +++ b/lib/ft8/ft8b.f90 @@ -1,5 +1,5 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, &
- lapcqonly,napwid,lsubtract,nagain,ncontest,iaptype,mycall12,hiscall12, &
+ lapcqonly,napwid,lsubtract,nagain,ncontest,imetric,iaptype,mycall12,hiscall12, &
f1,xdt,xbase,apsym,aph10,nharderrors,dmin,nbadcrc,ipass, &
msg37,xsnr,itone)
@@ -14,10 +14,11 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & real a(5)
real s8(0:7,NN)
real s2(0:511)
- real bmeta(174),bmetb(174),bmetc(174),bmetd(174)
- real llra(174),llrb(174),llrc(174),llrd(174),llrz(174) !Soft symbols
+ real bmeta(174),bmetb(174),bmetc(174),bmetd(174),bmete(174)
+ real llra(174),llrb(174),llrc(174),llrd(174),llre(174),llrz(174) !Soft symbols
real dd0(15*12000)
real ss(9)
+ real temp(3)
integer*1 message77(77),message91(91),apmask(174),cw(174)
integer apsym(58),aph10(10)
integer mcq(29),mcqru(29),mcqfd(29),mcqtest(29),mcqww(29)
@@ -174,7 +175,10 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & enddo
! hard sync sum - max is 21
nsync=is1+is2+is3
- if(nsync .le. 6) then ! bail out
+ syncmin=6
+ if(imetric.eq.2) syncmin=7
+ if(ndepth.le.2) syncmin=8
+ if(nsync.le.syncmin) then ! bail out
nbadcrc=1
return
endif
@@ -200,6 +204,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & print*,"Error - nsym must be 1, 2, or 3."
endif
enddo
+ if(imetric.eq.2) s2=s2**2
i32=1+(k-1)*3+(ihalf-1)*87
if(nsym.eq.1) ibmax=2
if(nsym.eq.2) ibmax=5
@@ -227,18 +232,26 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & enddo
enddo
enddo
+ do i=1,174
+ temp(1)=bmeta(i)
+ temp(2)=bmetb(i)
+ temp(3)=bmetc(i)
+ ip=maxloc(abs(temp))
+ bmete(i)=temp(ip(1))
+ enddo
+
call normalizebmet(bmeta,174)
call normalizebmet(bmetb,174)
call normalizebmet(bmetc,174)
call normalizebmet(bmetd,174)
+ call normalizebmet(bmete,174)
scalefac=2.83
llra=scalefac*bmeta
llrb=scalefac*bmetb
llrc=scalefac*bmetc
llrd=scalefac*bmetd
-
- apmag=maxval(abs(llra))*1.01
+ llre=scalefac*bmete
! pass #
!------------------------------
@@ -246,35 +259,44 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & ! 2 regular decoding, nsym=2
! 3 regular decoding, nsym=3
! 4 regular decoding, nsym=1, bit-by-bit normalized
-! 5 ap pass 1, nsym=1
-! 6 ap pass 2
-! 7 ap pass 3
-! 8 ap pass 4
+! 5 regular decoding, choose best (largest) metric from 1-3
+! 6 ap pass 1, nsym=1
+! 7 ap pass 1, nsym=2
+! 8 ap pass 2, nsym=1
+! 9 ap pass 2, nsym=2
+! 10 ap pass 3, nsym=1
+! 11 ap pass 3, nsym=2
+! 12 ap pass 4, nsym=1
+! 13 ap pass 4, nsym=2
if(lapon.or.ncontest.eq.7) then !Hounds always use AP
if(.not.lapcqonly) then
- npasses=4+nappasses(nQSOProgress)
+ npasses=5+2*nappasses(nQSOProgress)
else
- npasses=5
+ npasses=7
endif
else
- npasses=4
+ npasses=5
endif
- if(nzhsym.lt.50) npasses=4
+ if(nzhsym.lt.50) npasses=5
do ipass=1,npasses
llrz=llra
if(ipass.eq.2) llrz=llrb
if(ipass.eq.3) llrz=llrc
if(ipass.eq.4) llrz=llrd
- if(ipass.le.4) then
+ if(ipass.eq.5) llrz=llre
+ if(ipass.le.5) then
apmask=0
iaptype=0
endif
- if(ipass .gt. 4) then
+ if(ipass .gt. 5) then
llrz=llra
+ if(mod(ipass-5,2).eq.1) llrz=llra
+ if(mod(ipass-5,2).eq.0) llrz=llrc
+ apmag=maxval(abs(llrz))*1.1
if(.not.lapcqonly) then
- iaptype=naptypes(nQSOProgress,ipass-4)
+ iaptype=naptypes(nQSOProgress,(ipass-4)/2)
else
iaptype=1
endif
@@ -405,7 +427,7 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & norder=2
maxosd=2
if(ndepth.eq.1) maxosd=-1 ! BP only
- if(ndepth.eq.2) maxosd=0 ! uncoupled BP+OSD
+! if(ndepth.eq.2) maxosd=0 ! uncoupled BP+OSD
if(ndepth.eq.3 .and. &
(abs(nfqso-f1).le.napwid .or. abs(nftx-f1).le.napwid .or. ncontest.eq.7)) then
maxosd=2
@@ -427,8 +449,13 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(i3.gt.5 .or. (i3.eq.0.and.n3.gt.6)) cycle
if(i3.eq.0 .and. n3.eq.2) cycle
call unpack77(c77,1,msg37,unpk77_success)
+ if(.not.unpk77_success .or. index(msg37,'/R').gt.0 .or. &
+ msg37(1:4).eq.'TU; ') then
+ if(i3.ge.1 .and. i3.le.3 .and. ncontest.eq.0) cycle
+ endif
if(.not.unpk77_success) cycle
- nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message.
+! If we get this far: valid codeword, valid (i3,n3), nonquirky message.
+ nbadcrc=0
call get_ft8_tones_from_77bits(message77,itone)
if(lsubtract) then
call timer('sub_ft8a',0)
@@ -453,11 +480,11 @@ subroutine ft8b(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,nzhsym,lapon, & if(.not.nagain) then
xsnr=xsnr2
endif
- if(nsync.le.10 .and. xsnr.lt.-24.0) then !bail out, likely false decode
+ if(nsync.le.10 .and. xsnr.lt.-25.0) then !bail out, likely false decode
nbadcrc=1
return
endif
- if(xsnr .lt. -24.0) xsnr=-24.0
+ if(xsnr .lt. -25.0) xsnr=-25.0
return
enddo
return
diff --git a/lib/ft8/ft8code.f90 b/lib/ft8/ft8code.f90 index a7ff5793..45b0b6a6 100755 --- a/lib/ft8/ft8code.f90 +++ b/lib/ft8/ft8code.f90 @@ -23,9 +23,9 @@ program ft8code 'LDPC(174,91) encoding,'
print*,'bit and symbol ordering, and other details of the FT8 protocol.'
print*
- print*,'Usage: ft8code [-c grid] "message" # Results for specified message'
- print*,' ft8code -T # Examples of all message types'
- print*,' ft8code -t # Short format examples'
+ print*,'Usage: ft8code "message" # Results for specified message'
+ print*,' ft8code -T # Examples of all message types'
+ print*,' ft8code -t # Short format examples'
go to 999
endif
diff --git a/lib/ft8/ft8d.f90 b/lib/ft8/ft8d.f90 index b7b39fc7..28af93d1 100755 --- a/lib/ft8/ft8d.f90 +++ b/lib/ft8/ft8d.f90 @@ -42,7 +42,7 @@ program ft8d j2=index(infile,'.wav')
read(infile(j2-6:j2-1),*) nutc
datetime=infile(j2-13:j2-1)
- call sync8(iwave,nfa,nfb,nfqso,s,candidate,ncand)
+ call sync8(iwave,NMAX,nfa,nfb,nfqso,s,candidate,ncand)
syncmin=2.0
dd=iwave
do icand=1,ncand
diff --git a/lib/ft8/ft8sim.f90 b/lib/ft8/ft8sim.f90 index a12b6d60..92ee51d9 100755 --- a/lib/ft8/ft8sim.f90 +++ b/lib/ft8/ft8sim.f90 @@ -24,7 +24,8 @@ program ft8sim_gfsk nargs=iargc()
if(nargs.ne.7) then
print*,'Usage: ft8sim "message" f0 DT fdop del nfiles snr'
- print*,'Examples: ft8sim "K1ABC W9XYZ EN37" 1500.0 0.0 0.1 1.0 10 -18'
+ print*,'Examples: ft8sim "K1ABC W9XYZ EN37" 1500.0 0.0 0.5 1.0 10 -18'
+ print*,' ft8sim "K1ABC W9XYZ EN37" 1500.0 0.0 MM 1.0 10 -18'
print*,' ft8sim "WA9XYZ/R KA1ABC/R FN42" 1500.0 0.0 0.1 1.0 10 -18'
print*,' ft8sim "K1ABC RR73; W9XYZ <KH1/KH7Z> -11" 300 0 0 0 25 1 -10'
print*,' ft8sim "<G4ABC/P> <PA9XYZ> R 570007 JO22DB" 1500 0 0 0 1 -10'
@@ -36,9 +37,38 @@ program ft8sim_gfsk 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)
+ if(arg(1:2).eq.'LQ') then !ITU params for Low Latitude Quiet
+ fspread=0.5
+ delay=0.5
+ else if(arg(1:2).eq.'LM') then !Low Latitude Moderate
+ fspread=1.5
+ delay=2.0
+ else if(arg(1:2).eq.'LD') then !Low Latitude Disturbed
+ fspread=10.0
+ delay=6.0
+ else if(arg(1:2).eq.'MQ') then !Mid Latitude ... etc.
+ fspread=0.1
+ delay=0.5
+ else if(arg(1:2).eq.'MM') then
+ fspread=0.5
+ delay=1.0
+ else if(arg(1:2).eq.'MD') then
+ fspread=1.0
+ delay=2.0
+ else if(arg(1:2).eq.'HQ') then
+ fspread=0.5
+ delay=1.0
+ else if(arg(1:2).eq.'HM') then
+ fspread=10.0
+ delay=3.0
+ else if(arg(1:2).eq.'HD') then
+ fspread=30.0
+ delay=7.0
+ else
+ read(arg,*) fspread !Watterson frequency spread (Hz)
+ call getarg(5,arg)
+ read(arg,*) delay !Watterson delay (ms)
+ endif
call getarg(6,arg)
read(arg,*) nfiles !Number of files
call getarg(7,arg)
@@ -72,10 +102,12 @@ program ft8sim_gfsk call gen_ft8wave(itone,NN,NSPS,bt,fs,f0,cwave,xjunk,1,NWAVE) !Generate complex cwave
write(*,*)
- write(*,'(a23,a37,3x,a7,i1,a1,i1)') 'Decoded message: ',msgsent37,'i3.n3: ',i3,'.',n3
+ write(*,'(a,a37,3x,a7,i1,a1,i1)') 'Decoded message: ',msgsent37,'i3.n3: ',i3,'.',n3
write(*,1000) f0,xdt,txt,snrdb,bw
-1000 format('f0:',f9.3,' DT:',f6.2,' TxT:',f6.1,' SNR:',f6.1, &
- ' BW:',f4.1)
+1000 format('f0:',f9.3,' DT:',f6.2,' TxT:',f6.1,' SNR:',f6.1,' BW:',f4.1)
+ write(*,1001) fspread,delay
+1001 format('Fspread:',f7.3,' Hz Delay:',f7.3,' ms')
+
write(*,*)
if(i3.eq.1) then
write(*,*) ' mycall hiscall hisgrid'
@@ -101,14 +133,24 @@ program ft8sim_gfsk wave=imag(c)
peak=maxval(abs(wave))
nslots=1
-
+
+ psig=0.
+ pnoise=0.
if(snrdb.lt.90) then
do i=1,NMAX !Add gaussian noise at specified SNR
xnoise=gran()
+ if(i.ge.6001 .and. i.le.157692) then
+ psig=psig + wave(i)*wave(i) !Signal power
+ pnoise=pnoise + xnoise*xnoise !Noise power in signal interval
+ endif
wave(i)=wave(i) + xnoise
enddo
endif
+! Noise power in signal interval and 2500 Hz bandwidth:
+ pnoise=bandwidth_ratio*pnoise
+ snr_2500=db(psig/pnoise) !SNR in 2500 Hz bandwidth
+
gain=100.0
if(snrdb.lt.90.0) then
wave=gain*wave
@@ -125,7 +167,7 @@ program ft8sim_gfsk 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)
+ write(*,1110) ifile,xdt,f0,snrdb,fname,snr_2500
+1110 format(i4,f7.2,f8.2,f7.1,2x,a17,f8.2)
enddo
999 end program ft8sim_gfsk
diff --git a/lib/ft8/gen_ft8wave.f90 b/lib/ft8/gen_ft8wave.f90 index 1d395520..ba9fbb4e 100755 --- a/lib/ft8/gen_ft8wave.f90 +++ b/lib/ft8/gen_ft8wave.f90 @@ -49,7 +49,6 @@ subroutine gen_ft8wave(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave) if(icmplx .eq. 0) wave=0.
if(icmplx .ne. 0) cwave=0. !Avoid writing to memory we may not have access to
- call timer('gen_loop',0)
k=0
do j=nsps,nsps+nwave-1 !Don't include dummy symbols
k=k+1
@@ -61,7 +60,6 @@ subroutine gen_ft8wave(itone,nsym,nsps,bt,fsample,f0,cwave,wave,icmplx,nwave) endif
phi=mod(phi+dphi(j),twopi)
enddo
- call timer('gen_loop',1)
! Apply envelope shaping to the first and last symbols
nramp=nint(nsps/8.0)
diff --git a/lib/ft8/ldpcsim174_91.f90 b/lib/ft8/ldpcsim174_91.f90 index fc2074f6..ae16fa43 100755 --- a/lib/ft8/ldpcsim174_91.f90 +++ b/lib/ft8/ldpcsim174_91.f90 @@ -2,38 +2,50 @@ program ldpcsim174_91 ! End to end test of the (174,91)/crc14 encoder and decoder.
use packjt77
- integer, parameter:: N=174, K=91, M=N-K
- character*37 msg,msgsent,msgreceived
+ integer, parameter:: N=174, K=91, M=N-K, NN=58
+ character*37 msg,msgsent
character*77 c77
character*8 arg
- character*6 grid
- character*96 tmpchar
integer*1, allocatable :: codeword(:), decoded(:), message(:)
integer*1 msgbits(77)
- integer*1 message77(77),message91(91)
+ integer*1 message91(91)
integer*1 apmask(N), cw(N)
+ integer lmax(1)
+ integer modtype, itone(79), itonecw(58), graymap(0:7)
integer nerrtot(0:N),nerrdec(0:N)
+ integer channeltype
logical unpk77_success
+ logical one(0:511,0:8)
real*8, allocatable :: rxdata(:)
- real, allocatable :: llr(:)
+ real llr(174),llra(174),llrb(174),llrc(174),llrd(174)
+ real bmeta(174),bmetb(174),bmetc(174),bmetd(174)
+ complex cs(0:7,NN)
+ real s2(0:511)
+ data graymap/0,1,3,2,5,6,4,7/
nerrtot=0
nerrdec=0
+!
+
nargs=iargc()
- if(nargs.ne.6) then
- print*,'Usage: ldpcsim niter ndepth #trials s Keff nbposd'
- print*,'eg: ldpcsim 10 2 1000 0.84 91 1'
- print*,'niter: max BP iterations'
- print*,'ndepth: OSD order'
- print*,'s: noise sigma; if negative value is ignored and sigma is calculated from SNR.'
- print*,'nbposd=0, no coupling. nbposd>0, maxsuper=nbposd; nbposd<0, no OSD'
+ if(nargs.ne.7) then
+ print*,'Usage: ldpcsim maxosd norder #trials s Keff modtype channel'
+ print*,'eg: ldpcsim 10 2 1000 0.84 91 1 0'
+ print*,' maxosd<0: do bp only'
+ print*,' maxosd=0: do bp and then call osd once with channel llrs'
+ print*,' maxosd>1: do bp and then call osd maxosd times with saved bp outputs'
+ print*,' norder : osd decoding depth'
+ print*,' s : BPSK only, noise sigma, if s<0 value is ignored and sigma is calculated from SNR.'
+ print*,' Keff : Keff must be in the range [77,91]; Keff-77 is the # of bits to use as CRC.'
+ print*,' modtype : 0, coherent BPSK; 1 noncoherent 8FSK'
+ print*,' channel : 0, AWGN; 1, block Rayleigh (Rayleigh only works with 8FSK!)'
return
endif
call getarg(1,arg)
- read(arg,*) max_iterations
+ read(arg,*) maxosd
call getarg(2,arg)
- read(arg,*) ndepth
+ read(arg,*) norder
call getarg(3,arg)
read(arg,*) ntrials
call getarg(4,arg)
@@ -41,16 +53,24 @@ program ldpcsim174_91 call getarg(5,arg)
read(arg,*) Keff
call getarg(6,arg)
- read(arg,*) nbposd
+ read(arg,*) modtype
+ call getarg(7,arg)
+ read(arg,*) channeltype
! scale Eb/No for a (174,91) code
rate=real(K)/real(N)
write(*,*) "rate: ",rate
- write(*,*) "niter= ",max_iterations," s= ",s
allocate ( codeword(N), decoded(K), message(K) )
- allocate ( rxdata(N), llr(N) )
+ allocate ( rxdata(N) )
+
+ one=.false.
+ do i=0,511
+ do j=0,8
+ if(iand(i,2**j).ne.0) one(i,j)=.true.
+ enddo
+ enddo
msg="K9ABC K1ABC FN20"
i3=0
@@ -65,47 +85,144 @@ program ldpcsim174_91 call init_random_seed()
+ iq=1
+ if(modtype.gt.0) then ! MFSK - get tones
+ i3=-1
+ n3=-1
+ call genft8(msg,i3,n3,msgsent,msgbits,itone)
+ write(*,*) 'message tones'
+ write(*,'(79(i1,1x))') itone
+ itonecw(1:29)=itone(8:36)
+ itonecw(30:58)=itone(44:72)
+ iq=3 ! bits per symbol
+ endif
call encode174_91(msgbits,codeword)
write(*,*) 'crc14'
write(*,'(14i1)') codeword(78:91)
write(*,*) 'codeword'
write(*,'(22(8i1,1x))') codeword
-
- write(*,*) "Eb/N0 Es/N0 ngood nundetected sigma psymerr"
- do idb = 10,-4,-1
+ write(*,*) 'Eb/N0 Es/N0 SNR2500 ngood nundetected sigma psymerr pbiterr'
+ do idb = 20,-4,-1
+ nsymerr=0
+ nbiterr=0
db=idb/2.0-1.0
- sigma=1/sqrt( 2*rate*(10**(db/10.0)) )
+ sigma=1/sqrt( 2*rate*iq*(10**(db/10.0)) )
ngood=0
nue=0
nsumerr=0
-
do itrial=1, ntrials
! Create a realization of a noisy received word
- do i=1,N
- rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
- enddo
- nerr=0
- do i=1,N
- if( rxdata(i)*(2*codeword(i)-1.0) .lt. 0 ) nerr=nerr+1
- enddo
- if(nerr.ge.1) nerrtot(nerr)=nerrtot(nerr)+1
-
- rxav=sum(rxdata)/N
- rx2av=sum(rxdata*rxdata)/N
- rxsig=sqrt(rx2av-rxav*rxav)
- rxdata=rxdata/rxsig
- if( s .lt. 0 ) then
- ss=sigma
+ if(modtype.eq.0) then
+ do i=1,N
+ rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
+ enddo
+ nerr=0
+ do i=1,N
+ if( rxdata(i)*(2*codeword(i)-1.0) .lt. 0 ) nerr=nerr+1
+ enddo
+ if(nerr.ge.1) nerrtot(nerr)=nerrtot(nerr)+1
+
+ rxav=sum(rxdata)/N
+ rx2av=sum(rxdata*rxdata)/N
+ rxsig=sqrt(rx2av-rxav*rxav)
+ rxdata=rxdata/rxsig
+ if( s .lt. 0 ) then
+ ss=sigma
+ else
+ ss=s
+ endif
+ llr=2.0*rxdata/(ss*ss)
else
- ss=s
+! noncoherent MFSK
+ do i=1,58
+ do j=0,7
+ if(j.eq.itonecw(i)) then
+ if(channeltype.eq.0) then
+ A=1.0
+ elseif(channeltype.eq.1) then
+ xI=gran()**2 + gran()**2
+ A=sqrt(xI/2)
+ endif
+ cs(j,i)= A + sigma*gran() + cmplx(0,1)*sigma*gran()
+ elseif(j.ne.itonecw(i)) then
+ cs(j,i)= sigma*gran() + cmplx(0,1)*sigma*gran()
+ endif
+ enddo
+ lmax=maxloc(abs(cs(:,i)))
+ if(lmax(1)-1.ne.itonecw(i) ) nsymerr=nsymerr+1
+ enddo
+ do nsym=1,3
+ nt=2**(3*nsym)
+ do ks=1,58,nsym
+ amax=-1.0
+ do i=0,nt-1
+ i1=i/64
+ i2=iand(i,63)/8
+ i3=iand(i,7)
+ if(nsym.eq.1) then
+ s2(i)=abs(cs(graymap(i3),ks))
+ elseif(nsym.eq.2) then
+ s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i3),ks+1))
+ elseif(nsym.eq.3) then
+ if(ks.ne.58) then
+ s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks+1)+cs(graymap(i3),ks+2))
+ else
+ s2(i)=abs(cs(graymap(i1),ks))
+ endif
+ else
+ print*,"Error - nsym must be 1, 2, or 3."
+ endif
+ enddo
+
+ i32=1+(ks-1)*3
+ if(nsym.eq.1) ibmax=2
+ if(nsym.eq.2) ibmax=5
+ if(nsym.eq.3) ibmax=8
+ 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(i32+ib .gt.174) cycle
+ if(nsym.eq.1) then
+ bmeta(i32+ib)=bm
+ den=max(maxval(s2(0:nt-1),one(0:nt-1,ibmax-ib)), &
+ maxval(s2(0:nt-1),.not.one(0:nt-1,ibmax-ib)))
+ if(den.gt.0.0) then
+ cm=bm/den
+ else ! erase it
+ cm=0.0
+ endif
+ bmetd(i32+ib)=cm
+ elseif(nsym.eq.2) then
+ bmetb(i32+ib)=bm
+ elseif(nsym.eq.3) then
+ bmetc(i32+ib)=bm
+ endif
+ enddo
+ enddo
+ enddo
+ call normalizebmet(bmeta,174)
+ call normalizebmet(bmetb,174)
+ call normalizebmet(bmetc,174)
+ call normalizebmet(bmetd,174)
+
+ scalefac=2.83
+ llra=scalefac*bmeta
+ llrb=scalefac*bmetb
+ llrc=scalefac*bmetc
+ llrd=scalefac*bmetd
+
+ llr=llrc
endif
- llr=2.0*rxdata/(ss*ss)
+ do i=1, 174
+ if(llr(i)*(codeword(i)-0.5).lt.0) nbiterr=nbiterr+1
+ enddo
+
nap=0 ! number of AP bits
llr(1:nap)=5*(2.0*msgbits(1:nap)-1.0)
apmask=0
apmask(1:nap)=1
- call decode174_91(llr,Keff,nbposd,ndepth,apmask,message91,cw,ntype,nharderrors,dmin)
+ call decode174_91(llr,Keff,maxosd,norder,apmask,message91,cw,ntype,nharderrors,dmin)
! If the decoder finds a valid codeword, nharderrors will be .ge. 0.
if( nharderrors.ge.0 ) then
nhw=count(cw.ne.codeword)
@@ -119,9 +236,12 @@ program ldpcsim174_91 nsumerr=nsumerr+nerr
enddo
- esn0=db+10.0*log10(rate)
- pberr=real(nsumerr)/(real(ntrials*N))
- write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,8x,f5.2,8x,e10.3)") db,esn0,ngood,nue,ss,pberr
+ esn0=db+10.0*log10(iq*rate) ! iq=3 bits per symbol for 8FSK
+ snr2500=esn0-10.0*log10(2500/6.25)
+! pberr=real(nsumerr)/(real(ntrials*N))
+ psymerr=real(nsymerr)/(ntrials*174.0/iq)
+ pbiterr=real(nbiterr)/(ntrials*174.0)
+ write(*,"(f4.1,4x,f5.1,4x,f5.1,1x,i8,1x,i8,8x,f5.2,8x,e10.3,8x,e10.3)") db,esn0,snr2500,ngood,nue,ss,psymerr,pbiterr
enddo
@@ -132,3 +252,18 @@ program ldpcsim174_91 close(23)
end program ldpcsim174_91
+
+subroutine normalizebmet(bmet,n)
+ real bmet(n)
+
+ bmetav=sum(bmet)/real(n)
+ bmet2av=sum(bmet*bmet)/real(n)
+ var=bmet2av-bmetav*bmetav
+ if( var .gt. 0.0 ) then
+ bmetsig=sqrt(var)
+ else
+ bmetsig=sqrt(bmet2av)
+ endif
+ bmet=bmet/bmetsig
+ return
+end subroutine normalizebmet
diff --git a/lib/ft8/sync8.f90 b/lib/ft8/sync8.f90 index f93afe75..b79e416f 100755 --- a/lib/ft8/sync8.f90 +++ b/lib/ft8/sync8.f90 @@ -1,5 +1,4 @@ -subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,nzhsym,candidate, &
- ncand,sbase)
+subroutine sync8(dd,npts,nfa,nfb,syncmin,nfqso,maxcand,candidate,ncand,sbase)
include 'ft8_params.f90'
parameter (MAXPRECAND=1000)
@@ -10,13 +9,13 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,nzhsym,candidate, & real s(NH1,NHSYM)
real savg(NH1)
real sbase(NH1)
- real x(NFFT1)
+ real x(NFFT1+2)
real sync2d(NH1,-JZ:JZ)
real red(NH1)
real red2(NH1)
real candidate0(3,MAXPRECAND)
real candidate(3,maxcand)
- real dd(NMAX)
+ real dd(npts)
integer jpeak(NH1)
integer jpeak2(NH1)
integer indx(NH1)
@@ -87,7 +86,7 @@ subroutine sync8(dd,nfa,nfb,syncmin,nfqso,maxcand,nzhsym,candidate, & red=0.
red2=0.
- mlag=10
+ mlag=13
mlag2=JZ
do i=ia,ib
ii=maxloc(sync2d(i,-mlag:mlag)) - 1 - mlag
diff --git a/lib/ft8/watterson.f90 b/lib/ft8/watterson.f90 index 7c3aa35d..6fd0edf8 100755 --- a/lib/ft8/watterson.f90 +++ b/lib/ft8/watterson.f90 @@ -24,7 +24,7 @@ subroutine watterson(c,npts,nsig,fs,delay,fspread) do i=0,npts-1
f=i*df
if(i.gt.npts/2) f=(i-npts)*df
- x=(f/(0.5*fspread))**2
+ x=(f/fspread)**2
a=0.
if(x.le.50.0) then
a=exp(-x)
|
