From af1be084d49fd47da87585241b41ab02911ce1f7 Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Mon, 24 Sep 2018 15:10:57 -0500 Subject: [PATCH] Make MSK144 SWL mode work. Needs testing\! --- lib/77bit/packjt77.f90 | 24 +++++++++++++++++++++++- lib/msk144decodeframe.f90 | 3 +-- lib/msk144spd.f90 | 7 +++---- lib/msk40decodeframe.f90 | 10 +++++----- lib/msk40spd.f90 | 9 ++++----- lib/mskrtd.f90 | 21 ++++++++++----------- lib/update_hasharray.f90 | 12 ++++++------ 7 files changed, 52 insertions(+), 34 deletions(-) diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index dc6a6e4ac..6b1686537 100644 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -1,10 +1,11 @@ module packjt77 ! These variables are accessible from outside via "use packjt": - parameter (MAXHASH=1000) + parameter (MAXHASH=1000,MAXRECENT=10) character*13 callsign(MAXHASH) integer ihash10(MAXHASH),ihash12(MAXHASH),ihash22(MAXHASH) integer n28a,n28b,nzhash + character*13 recent_calls(MAXRECENT) contains @@ -358,11 +359,13 @@ subroutine unpack77(c77,msg,unpk77_success) i=index(call_1,' ') if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.1) call_1(i:i+1)='/R' if(i.ge.4 .and. ipa.eq.1 .and. i3.eq.2) call_1(i:i+1)='/P' + if(i.ge.4) call add_call_to_recent_calls(call_1) endif if(index(call_2,'<').le.0) then i=index(call_2,' ') if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.1) call_2(i:i+1)='/R' if(i.ge.4 .and. ipb.eq.1 .and. i3.eq.2) call_2(i:i+1)='/P' + if(i.ge.4) call add_call_to_recent_calls(call_2) endif if(igrid4.le.MAXGRID4) then n=igrid4 @@ -1159,5 +1162,24 @@ subroutine unpacktext77(c71,c13) return end subroutine unpacktext77 +subroutine add_call_to_recent_calls(callsign) + + character*13 callsign + logical ladd +! only add if the callsign is not already on the list + ladd=.true. + do i=1,MAXRECENT-1 ! if callsign is at the end of the list add it again + if(recent_calls(i).eq.callsign) ladd=.false. + enddo + + if(ladd) then + do i=MAXRECENT,2,-1 + recent_calls(i)=recent_calls(i-1) + enddo + recent_calls(1)=callsign + endif + + return +end subroutine add_call_to_recent_calls end module packjt77 diff --git a/lib/msk144decodeframe.f90 b/lib/msk144decodeframe.f90 index c3531673f..de039aadc 100644 --- a/lib/msk144decodeframe.f90 +++ b/lib/msk144decodeframe.f90 @@ -1,9 +1,8 @@ -subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess,recent_calls,nrecent) +subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess) ! use timer_module, only: timer use packjt77 parameter (NSPM=864) character*37 msgreceived - character*12 recent_calls(nrecent) character*77 c77 complex cb(42) complex cfac,cca,ccb diff --git a/lib/msk144spd.f90 b/lib/msk144spd.f90 index 92ed56162..2bc6dcfef 100644 --- a/lib/msk144spd.f90 +++ b/lib/msk144spd.f90 @@ -1,13 +1,13 @@ subroutine msk144spd(cbig,n,ntol,nsuccess,msgreceived,fc,fret,tret,navg,ct, & - softbits,recent_calls,nrecent) + softbits) ! MSK144 short-ping-decoder + use packjt77 use timer_module, only: timer parameter (NSPM=864, MAXSTEPS=100, NFFT=NSPM, MAXCAND=5, NPATTERNS=6) character*37 msgreceived - character*12 recent_calls(nrecent) complex cbig(n) complex cdat(3*NSPM) !Analytic signal complex c(NSPM) @@ -179,8 +179,7 @@ subroutine msk144spd(cbig,n,ntol,nsuccess,msgreceived,fc,fret,tret,navg,ct, & if( is.eq.2) ic0=max(1,ic0-1) if( is.eq.3) ic0=min(NSPM,ic0+1) ct=cshift(c,ic0-1) - call msk144decodeframe(ct,softbits,msgreceived,ndecodesuccess, & - recent_calls,nrecent) + call msk144decodeframe(ct,softbits,msgreceived,ndecodesuccess) if( ndecodesuccess .gt. 0 ) then tret=(nstart(icand)+NSPM/2)/fs fret=fest diff --git a/lib/msk40decodeframe.f90 b/lib/msk40decodeframe.f90 index 03c9c28a3..51c9346a8 100644 --- a/lib/msk40decodeframe.f90 +++ b/lib/msk40decodeframe.f90 @@ -1,19 +1,19 @@ subroutine msk40decodeframe(c,mycall,hiscall,xsnr,bswl,nhasharray, & - recent_calls,nrecent,msgreceived,nsuccess) + msgreceived,nsuccess) ! use timer_module, only: timer + use packjt77 parameter (NSPM=240) character*4 rpt(0:15) character*6 mycall,hiscall,mycall0,hiscall0 character*22 hashmsg,msgreceived - character*12 recent_calls(nrecent) complex cb(42) complex cfac,cca complex c(NSPM) integer*1 cw(32) integer*1 decoded(16) integer s8r(8),hardbits(40) - integer nhasharray(nrecent,nrecent) + integer nhasharray(MAXRECENT,MAXRECENT) real*8 dt, fs, pi, twopi real cbi(42),cbq(42) real pp(12) @@ -139,8 +139,8 @@ subroutine msk40decodeframe(c,mycall,hiscall,xsnr,bswl,nhasharray, & trim(hiscall),">",rpt(nrxrpt) return elseif(bswl .and. nhammd.le.4 .and. cord.lt.0.65 .and. nrxrpt.ge.7 ) then - do i=1,nrecent - do j=i+1,nrecent + do i=1,MAXRECENT + do j=i+1,MAXRECENT if( nrxhash .eq. nhasharray(i,j) ) then nsuccess=2 write(msgreceived,'(a1,a,1x,a,a1,1x,a4)') "<",trim(recent_calls(i)), & diff --git a/lib/msk40spd.f90 b/lib/msk40spd.f90 index c8af1a49e..337bc8cc8 100644 --- a/lib/msk40spd.f90 +++ b/lib/msk40spd.f90 @@ -1,13 +1,13 @@ -subroutine msk40spd(cbig,n,ntol,mycall,hiscall,bswl,nhasharray,recent_calls, & - nrecent,nsuccess,msgreceived,fc,fret,tret,navg) +subroutine msk40spd(cbig,n,ntol,mycall,hiscall,bswl,nhasharray, & + nsuccess,msgreceived,fc,fret,tret,navg) ! msk40 short-ping-decoder + use packjt77 use timer_module, only: timer parameter (NSPM=240, MAXSTEPS=150, NFFT=NSPM, MAXCAND=5, NPATTERNS=6) character*6 mycall,hiscall character*22 msgreceived - character*12 recent_calls(nrecent) complex cbig(n) complex cdat(3*NSPM) !Analytic signal complex c(NSPM) @@ -19,7 +19,6 @@ subroutine msk40spd(cbig,n,ntol,mycall,hiscall,bswl,nhasharray,recent_calls, & integer navpatterns(3,NPATTERNS) integer navmask(3) integer nstart(MAXCAND) - integer nhasharray(nrecent,nrecent) logical ismask(NFFT) logical*1 bswl real detmet(-2:MAXSTEPS+3) @@ -181,7 +180,7 @@ subroutine msk40spd(cbig,n,ntol,mycall,hiscall,bswl,nhasharray,recent_calls, & if( is.eq.3) ic0=min(NSPM,ic0+1) ct=cshift(c,ic0-1) call msk40decodeframe(ct,mycall,hiscall,xsnr,bswl,nhasharray, & - recent_calls,nrecent,msgreceived,ndecodesuccess) + msgreceived,ndecodesuccess) if( ndecodesuccess .gt. 0 ) then !write(*,*) icand, iav, ipk, is, tret, fret, msgreceived tret=(nstart(icand)+NSPM/2)/fs diff --git a/lib/mskrtd.f90 b/lib/mskrtd.f90 index f03fa7f63..ccb1f2406 100644 --- a/lib/mskrtd.f90 +++ b/lib/mskrtd.f90 @@ -5,11 +5,12 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & ! Analysis block size = NZ = 7168 samples, t_block = 0.597333 s ! Called from hspec() at half-block increments, about 0.3 s + use packjt77 + parameter (NZ=7168) !Block size parameter (NSPM=864) !Number of samples per message frame parameter (NFFT1=8192) !FFT size for making analytic signal parameter (NPATTERNS=4) !Number of frame averaging patterns to try - parameter (NRECENT=10) !Number of recent calls to remember parameter (NSHMEM=50) !Number of recent SWL messages to remember character*4 decsym !"&" for mskspd or "^" for long averages @@ -19,7 +20,6 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & character*80 line !Formatted line with UTC dB T Freq Msg character*12 mycall,hiscall character*6 mygrid - character*12 recent_calls(NRECENT) character*37 recent_shmsgs(NSHMEM) character*512 datadir @@ -31,7 +31,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & integer iavmask(8) integer iavpatterns(8,NPATTERNS) integer npkloc(10) - integer nhasharray(NRECENT,NRECENT) + integer nhasharray(MAXRECENT,MAXRECENT) integer nsnrlast,nsnrlastswl real d(NFFT1) @@ -55,14 +55,14 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & 1,1,1,1,1,1,1,0/ data xmc/2.0,4.5,2.5,3.5/ !Used to set time at center of averaging mask save first,tsec0,nutc00,pnoise,cdat,msglast,msglastswl, & - nsnrlast,nsnrlastswl,recent_calls,nhasharray,recent_shmsgs + nsnrlast,nsnrlastswl,nhasharray,recent_shmsgs if(first) then tsec0=tsec nutc00=nutc0 pnoise=-1.0 - do i=1,nrecent - recent_calls(i)(1:12)=' ' + do i=1,MAXRECENT + recent_calls(i)(1:13)=' ' enddo do i=1,nshmem recent_shmsgs(i)(1:37)=' ' @@ -117,10 +117,10 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & ! 3 frames along with 2- and 3-frame averages. np=8*NSPM call msk144spd(cdat,np,ntol,ndecodesuccess,msgreceived,fc,fest,tdec,navg,ct, & - softbits,recent_calls,nrecent) + softbits) if(ndecodesuccess.eq.0 .and. (bshmsg.or.bswl)) then call msk40spd(cdat,np,ntol,mycall(1:6),hiscall(1:6),bswl,nhasharray, & - recent_calls,nrecent,ndecodesuccess,msgrx22,fc,fest,tdec,navg) + ndecodesuccess,msgrx22,fc,fest,tdec,navg) if( ndecodesuccess .ge. 1 ) msgreceived(1:22)=msgrx22 endif if( ndecodesuccess .ge. 1 ) then @@ -152,8 +152,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & if(is.eq.2) ic0=max(1,ic0-1) if(is.eq.3) ic0=min(NSPM,ic0+1) ct=cshift(c,ic0-1) - call msk144decodeframe(ct,softbits,msgreceived,ndecodesuccess, & - recent_calls,nrecent) + call msk144decodeframe(ct,softbits,msgreceived,ndecodesuccess) if(ndecodesuccess .gt. 0) then tdec=tsec+xmc(iavg)*tframe goto 900 @@ -209,7 +208,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, & msglast=msgreceived nsnrlast=nsnr if(.not. bshdecode) then - call update_hasharray(recent_calls,nrecent,nhasharray) + call update_hasharray(nhasharray) endif if( .not.bshdecode ) then write(line,1020) nutc0,nsnr,tdec,nint(fest),decsym,msgreceived(1:22), & diff --git a/lib/update_hasharray.f90 b/lib/update_hasharray.f90 index 0f9c872e8..4ccbba51c 100644 --- a/lib/update_hasharray.f90 +++ b/lib/update_hasharray.f90 @@ -1,12 +1,12 @@ -subroutine update_hasharray(recent_calls,nrecent,nhasharray) - - character*12 recent_calls(nrecent) +subroutine update_hasharray(nhasharray) + + use packjt77 character*22 hashmsg - integer nhasharray(nrecent,nrecent) + integer nhasharray(MAXRECENT,MAXRECENT) nhasharray=-1 - do i=1,nrecent - do j=i+1,nrecent + do i=1,MAXRECENT + do j=i+1,MAXRECENT if( recent_calls(i)(1:1) .ne. ' ' .and. recent_calls(j)(1:1) .ne. ' ' ) then hashmsg=trim(recent_calls(i))//' '//trim(recent_calls(j)) call fmtmsg(hashmsg,iz)