diff options
| author | tony mancill <tmancill@debian.org> | 2023-09-03 19:46:43 -0700 |
|---|---|---|
| committer | tony mancill <tmancill@debian.org> | 2023-09-03 19:46:43 -0700 |
| commit | 393a486ee1d7e308a49f8e0b8c3a4b2f43223248 (patch) | |
| tree | 6a6e8a56ace360795e1cf1a310d5652bb23f1386 /lib | |
| parent | 6a285ab382ebff18c88e52bec75dc1773ac33b74 (diff) | |
New upstream version 2.7.0~rc2+repackupstream/2.7.0_rc2+repack
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/77bit/hash22calc.f90 | 42 | ||||
| -rwxr-xr-x | lib/77bit/packjt77.f90 | 22 | ||||
| -rwxr-xr-x | lib/decoder.f90 | 37 | ||||
| -rwxr-xr-x | lib/fst4/fst4sim.f90 | 4 | ||||
| -rwxr-xr-x | lib/fst4_decode.f90 | 22 | ||||
| -rwxr-xr-x | lib/ft8/sync8.f90 | 3 | ||||
| -rwxr-xr-x | lib/ft8_decode.f90 | 8 | ||||
| -rwxr-xr-x | lib/get_q3list.f90 | 132 | ||||
| -rwxr-xr-x | lib/go_chkfft.cmd | 2 | ||||
| -rwxr-xr-x | lib/jt9.f90 | 18 | ||||
| -rwxr-xr-x | lib/map65_mmdec.f90 | 13 | ||||
| -rwxr-xr-x | lib/q65_decode.f90 | 189 | ||||
| -rwxr-xr-x | lib/qra/q65/q65.f90 | 168 | ||||
| -rwxr-xr-x | lib/qra/q65/q65_encoding_modules.f90 | 4 | ||||
| -rwxr-xr-x | lib/qra/q65/q65_loops.f90 | 2 | ||||
| -rwxr-xr-x | lib/qra/q65/q65_set_list.f90 | 4 | ||||
| -rwxr-xr-x | lib/qra/q65/q65_set_list2.f90 | 70 | ||||
| -rwxr-xr-x | lib/qra/q65/q65sim.f90 | 124 | ||||
| -rwxr-xr-x | lib/sumsim.f90 | 2 | ||||
| -rwxr-xr-x | lib/test_qra64.f90 | 129 | ||||
| -rwxr-xr-x | lib/types.f90 | 8 | ||||
| -rwxr-xr-x | lib/wsprd/wsprd.c | 2 |
22 files changed, 694 insertions, 311 deletions
diff --git a/lib/77bit/hash22calc.f90 b/lib/77bit/hash22calc.f90 new file mode 100755 index 00000000..46581a98 --- /dev/null +++ b/lib/77bit/hash22calc.f90 @@ -0,0 +1,42 @@ +program hash22calc
+! Given a valid callsign, calculate and print its 22-bit hash.
+
+ use packjt77
+
+ character*13 callsign
+ character*1 c
+ character*6 basecall
+ logical cok
+
+ nargs=iargc()
+ if(nargs.ne.1) then
+ print*,'Given a valid callsign, print its 22-bit hash.'
+ print*,'Usage: hash22calc <callsign>'
+ print*,' e.g. hash22calc W9ABC'
+ go to 999
+ endif
+ call getarg(1,callsign)
+
+! convert to upper case
+ ilen=len(trim(callsign))
+ do i=1, ilen
+ c=callsign(i:i)
+ if(c.ge.'a' .and. c.le.'z') c=char(ichar(c)-32) !Force upper case
+ callsign(i:i)=c
+ enddo
+
+! check for a valid callsign
+ call chkcall(callsign,basecall,cok)
+ if(.not.cok) then
+ print*,'Invalid callsign'
+ print*,'Usage: hash22calc <callsign>'
+ goto 999
+ endif
+
+! calculate the hash
+ n22 = ihashcall(callsign,22)
+ write(*,'(a,i7.7)') callsign,n22
+
+999 end program hash22calc
+
+include '../chkcall.f90'
diff --git a/lib/77bit/packjt77.f90 b/lib/77bit/packjt77.f90 index af655723..67ee4ba7 100755 --- a/lib/77bit/packjt77.f90 +++ b/lib/77bit/packjt77.f90 @@ -370,15 +370,28 @@ subroutine unpack77(c77,nrx,msg,unpk77_success) msg=adjustl(msg)
else if(i3.eq.0 .and. n3.eq.6) then
- read(c77(49:50),'(2b1)') j2a,j2b
- itype=2
- if(j2b.eq.0 .and. j2a.eq.0) itype=1
- if(j2b.eq.0 .and. j2a.eq.1) itype=3
+ read(c77(48:50),'(3b1)') j48,j49,j50
+! bits 48:50
+! itype=1: x00
+! itype=2: xx1
+! itype=3: 010
+ if(j50.eq.1) then
+ itype=2
+ else if(j49.eq.0) then
+ itype=1
+ else if(j48.eq.0) then
+ itype=3
+ else
+ itype=-1
+ unpk77_success=.false.
+ endif
+
if(itype.eq.1) then
! WSPR Type 1
read(c77,2010) n28,igrid4,idbm
2010 format(b28.28,b15.15,b5.5)
idbm=nint(idbm*10.0/3.0)
+ if(idbm.lt.0 .or. idbm.gt.60) unpk77_success=.false.
call unpack28(n28,call_1,unpk28_success)
if(.not.unpk28_success) unpk77_success=.false.
call to_grid4(igrid4,grid4,unpkg4_success)
@@ -392,6 +405,7 @@ subroutine unpack77(c77,nrx,msg,unpk77_success) read(c77,2020) n28,npfx,idbm
2020 format(b28.28,b16.16,b5.5)
idbm=nint(idbm*10.0/3.0)
+ if(idbm.lt.0 .or. idbm.gt.60) unpk77_success=.false.
call unpack28(n28,call_1,unpk28_success)
if(.not.unpk28_success) unpk77_success=.false.
write(crpt,'(i3)') idbm
diff --git a/lib/decoder.f90 b/lib/decoder.f90 index baf3ddbf..fc23cd2f 100755 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -44,7 +44,9 @@ subroutine multimode_decoder(ss,id2,params,nfsample) real ss(184,NSMAX)
logical baddata,newdat65,newdat9,single_decode,bVHF,bad0,newdat,ex
+ logical lprinthash22
integer*2 id2(NTMAX*12000)
+ integer nqf(20)
type(params_block) :: params
real*4 dd(NTMAX*12000)
character(len=20) :: datetime
@@ -211,7 +213,28 @@ subroutine multimode_decoder(ss,id2,params,nfsample) params%nfa,params%nfb,logical(params%nclearave), &
single_decode,logical(params%nagain),params%max_drift, &
logical(params%newdat),params%emedelay,mycall,hiscall,hisgrid, &
- params%nQSOProgress,ncontest,logical(params%lapcqonly),navg0)
+ params%nQSOProgress,ncontest,logical(params%lapcqonly),navg0,nqf)
+ params%nclearave=.false.
+
+ if(.not.params%nagain) then
+! Go through identified candidates again, treating each as if it had been
+! double-clicked on the waterfall.
+ do k=1,20
+ if(nqf(k).eq.0) exit
+ if(params%nagain .and. abs(nqf(k)-params%nfqso).gt.params%ntol) cycle
+ nqd=1
+ navg0=0
+ ntol=5
+ call my_q65%decode(q65_decoded,id2,nqd,params%nutc,params%ntr, &
+ params%nsubmode,nqf(k),ntol,params%ndepth, &
+ params%nfa,params%nfb,logical(params%nclearave), &
+ .true.,.true.,params%max_drift, &
+ .false.,params%emedelay,mycall,hiscall,hisgrid, &
+ params%nQSOProgress,ncontest,logical(params%lapcqonly), &
+ navg0,nqf)
+ enddo
+ endif
+
call timer('dec_q65 ',1)
close(17)
go to 800
@@ -221,27 +244,30 @@ subroutine multimode_decoder(ss,id2,params,nfsample) ! We're in FST4 mode
ndepth=iand(params%ndepth,3)
iwspr=0
+ lprinthash22=.false.
params%nsubmode=0
call timer('dec_fst4',0)
call my_fst4%decode(fst4_decoded,id2,params%nutc, &
params%nQSOProgress,params%nfa,params%nfb, &
params%nfqso,ndepth,params%ntr,params%nexp_decode, &
params%ntol,params%emedelay,logical(params%nagain), &
- logical(params%lapcqonly),mycall,hiscall,iwspr)
+ logical(params%lapcqonly),mycall,hiscall,iwspr,lprinthash22)
call timer('dec_fst4',1)
go to 800
endif
- if(params%nmode.eq.241) then
+ if(params%nmode.eq.241 .or. params%nmode.eq.242) then
! We're in FST4W mode
ndepth=iand(params%ndepth,3)
iwspr=1
+ lprinthash22=.false.
+ if(params%nmode.eq.242) lprinthash22=.true.
call timer('dec_fst4',0)
call my_fst4%decode(fst4_decoded,id2,params%nutc, &
params%nQSOProgress,params%nfa,params%nfb, &
params%nfqso,ndepth,params%ntr,params%nexp_decode, &
params%ntol,params%emedelay,logical(params%nagain), &
- logical(params%lapcqonly),mycall,hiscall,iwspr)
+ logical(params%lapcqonly),mycall,hiscall,iwspr,lprinthash22)
call timer('dec_fst4',1)
go to 800
endif
@@ -705,7 +731,7 @@ contains end subroutine ft4_decoded
subroutine fst4_decoded (this,nutc,sync,nsnr,dt,freq,decoded,nap, &
- qual,ntrperiod,lwspr,fmid,w50)
+ qual,ntrperiod,fmid,w50)
use fst4_decode
implicit none
@@ -720,7 +746,6 @@ contains integer, intent(in) :: nap
real, intent(in) :: qual
integer, intent(in) :: ntrperiod
- logical, intent(in) :: lwspr
real, intent(in) :: fmid
real, intent(in) :: w50
diff --git a/lib/fst4/fst4sim.f90 b/lib/fst4/fst4sim.f90 index 8ae7ec70..4bb85f42 100755 --- a/lib/fst4/fst4sim.f90 +++ b/lib/fst4/fst4sim.f90 @@ -93,6 +93,10 @@ program fst4sim 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)
+ elseif(i3.eq.0 .and. n3.eq.6) then
+ write(*,'(a15,37x,a5)') '50-bit message','CRC24'
+ write(*,'(50i1,1x,24i1)') msgbits(1:50),msgbits(51:74)
+ write(*,'(a50)') '01234567890123456789012345678901234567890123456789'
else
write(*,'(a14)') 'Message bits: '
write(*,'(77i1,1x,24i1)') msgbits
diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index d3b8af73..2db64e27 100755 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -8,7 +8,7 @@ module fst4_decode abstract interface
subroutine fst4_decode_callback (this,nutc,sync,nsnr,dt,freq, &
- decoded,nap,qual,ntrperiod,lwspr,fmid,w50)
+ decoded,nap,qual,ntrperiod,fmid,w50)
import fst4_decoder
implicit none
class(fst4_decoder), intent(inout) :: this
@@ -21,7 +21,6 @@ module fst4_decode integer, intent(in) :: nap
real, intent(in) :: qual
integer, intent(in) :: ntrperiod
- logical, intent(in) :: lwspr
real, intent(in) :: fmid
real, intent(in) :: w50
end subroutine fst4_decode_callback
@@ -31,7 +30,7 @@ contains subroutine decode(this,callback,iwave,nutc,nQSOProgress,nfa,nfb,nfqso, &
ndepth,ntrperiod,nexp_decode,ntol,emedelay,lagain,lapcqonly,mycall, &
- hiscall,iwspr)
+ hiscall,iwspr,lprinthash22)
use prog_args
use timer_module, only: timer
@@ -67,9 +66,10 @@ contains integer mcq(29),mrrr(19),m73(19),mrr73(19)
logical badsync,unpk77_success,single_decode
- logical first,nohiscall,lwspr
+ logical first,nohiscall
logical new_callsign,plotspec_exists,wcalls_exists,do_k50_decode
logical decdata_exists
+ logical lprinthash22
integer*2 iwave(30*60*12000)
@@ -88,7 +88,8 @@ contains dxcall13=hiscall ! initialize for use in packjt77
mycall13=mycall
- if(iwspr.ne.0.and.iwspr.ne.1) return
+ if(iwspr.ne.0 .and. iwspr.ne.1) return
+
if(lagain) continue ! use lagain to keep compiler happy
if(first) then
@@ -503,6 +504,13 @@ contains write(c77,'(50i1)') message74(1:50)
c77(51:77)='000000000000000000000110000'
call unpack77(c77,1,msg,unpk77_success)
+ if(lprinthash22 .and. unpk77_success .and. index(msg,'<...>').gt.0) then
+ read(c77,'(b22.22)') n22tmp
+ i1=index(msg,' ')
+ wpart=trim(msg(i1+1:))
+ write(msg,'(a1,i7.7,a1)') '<',n22tmp,'>'
+ msg=trim(msg)//' '//trim(wpart)
+ endif
if(unpk77_success .and. do_k50_decode) then
! If decode was obtained with Keff=66, save call/grid in fst4w_calls.txt if not there already.
i1=index(msg,' ')
@@ -602,6 +610,7 @@ contains case(1800)
snr_calfac=320.0
case default
+ snr_calfac=430.0
end select
arg=snr_calfac*xsig/base - 1.0
if(arg.gt.0.0) then
@@ -626,8 +635,7 @@ contains close(21)
endif
call this%callback(nutc,smax1,nsnr,xdt,fsig,msg, &
- iaptype,qual,ntrperiod,lwspr,fmid,w50)
-! if(iwspr.eq.0 .and. nb.lt.0) go to 900
+ iaptype,qual,ntrperiod,fmid,w50)
goto 800
endif
enddo ! metrics
diff --git a/lib/ft8/sync8.f90 b/lib/ft8/sync8.f90 index f93afe75..7aff8f09 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,nfa,nfb,syncmin,nfqso,maxcand,candidate,ncand,sbase)
include 'ft8_params.f90'
parameter (MAXPRECAND=1000)
diff --git a/lib/ft8_decode.f90 b/lib/ft8_decode.f90 index fdad82aa..ca38e454 100755 --- a/lib/ft8_decode.f90 +++ b/lib/ft8_decode.f90 @@ -46,7 +46,6 @@ contains procedure(ft8_decode_callback) :: callback
parameter (MAXCAND=600,MAX_EARLY=100)
real*8 tsec,tseq
- real s(NH1,NHSYM)
real sbase(NH1)
real candidate(3,MAXCAND)
real dd(15*12000),dd1(15*12000)
@@ -61,14 +60,14 @@ contains character datetime*13,msg37*37
character*37 allmessages(200)
character*12 ctime
- integer allsnrs(100)
+ integer allsnrs(200)
integer itone(NN)
integer itone_save(NN,MAX_EARLY)
real f1_save(MAX_EARLY)
real xdt_save(MAX_EARLY)
data nutc0/-1/
- save s,dd,dd1,nutc0,ndec_early,itone_save,f1_save,xdt_save,lsubtracted,&
+ save dd,dd1,nutc0,ndec_early,itone_save,f1_save,xdt_save,lsubtracted, &
allmessages
this%callback => callback
@@ -193,8 +192,7 @@ contains endif
call timer('sync8 ',0)
maxc=MAXCAND
- call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,nzhsym,candidate, &
- ncand,sbase)
+ call sync8(dd,ifa,ifb,syncmin,nfqso,maxc,candidate,ncand,sbase)
call timer('sync8 ',1)
do icand=1,ncand
sync=candidate(3,icand)
diff --git a/lib/get_q3list.f90 b/lib/get_q3list.f90 new file mode 100755 index 00000000..54199148 --- /dev/null +++ b/lib/get_q3list.f90 @@ -0,0 +1,132 @@ +subroutine get_q3list(fname,bDiskData,nlist,list)
+
+ type q3list
+ character*6 call
+ character*4 grid
+ integer nsec
+ integer nfreq
+ integer moonel
+ end type q3list
+
+ parameter (MAX_CALLERS=40)
+ character*(*) fname
+ character*36 list(40)
+ character*8 grid6
+ logical*1 bDiskData
+ integer time
+ integer nt(8)
+ integer indx(MAX_CALLERS)
+ type(q3list) ctmp(MAX_CALLERS),callers(MAX_CALLERS)
+ character*256 jpleph_file_name,file24name
+ common/jplcom/jpleph_file_name
+ common/lu24com/file24name
+
+ nhist2=0
+ open(24,file=fname,status='unknown',form='unformatted')
+ read(24,end=1) nhist2
+ if(nhist2.ge.1 .and. nhist2.le.40) then
+ read(24,end=1) ctmp(1:nhist2)
+ else
+ nhist2=0
+ endif
+1 rewind 24
+ if(nhist2.eq.0) go to 900
+
+ now=time()
+ call date_and_time(values=nt)
+ uth=nt(5) + (nt(6)-nt(4))/60.0 + nt(7)/3600.0
+ j=0
+
+ do i=1,nhist2
+ age=(now - ctmp(i)%nsec)/3600.0
+ if(age.gt.24.0) cycle
+ grid6=ctmp(i)%grid//'mm'
+ call grid2deg(grid6,xlon,xlat)
+ call sun(nt(1),nt(2),nt(3),uth,-xlon,xlat,RASun,DecSun,xLST, &
+ AzSun,ElSun,mjd,day)
+ call moondopjpl(nt(1),nt(2),nt(3),uth,-xlon,xlat,RAMoon,DecMoon, &
+ xLST,HA,AzMoon,ElMoon,vr,techo)
+ if(ElMoon.lt.-5.0 .and. (.not.bDiskData)) cycle
+ j=j+1 !Keep this one...
+ callers(j)=ctmp(i)
+ callers(j)%moonel=nint(ElMoon) !... and save its current moonel
+ enddo
+
+ nhist2=j
+ write(24) nhist2
+ write(24) callers(1:nhist2)
+
+ call indexx(callers(1:nhist2)%nfreq,nhist2,indx)
+ do i=1,nhist2
+ j=indx(i)
+ moon_el=nint(ElMoon)
+ age=(now - callers(j)%nsec)/3600.0
+ write(list(i),1000) i,callers(j)%nfreq,callers(j)%call, &
+ callers(j)%grid,callers(j)%moonel,age,char(0)
+1000 format(i2,'.',i6,2x,a6,2x,a4,i5,f7.1,a1)
+
+! h1=mod(now,86400)/3600.0
+! h2=mod(callers(i)%nsec,86400)/3600.0
+! hd=h1-h2
+! if(hd.lt.0.0) hd=hd+24.0
+! write(*,3301) i,callers(i)%call,now,callers(i)%nsec,h1,h2,hd
+!3301 format(i3,2x,a6,2i12,3f10.6)
+
+ enddo
+
+900 close(24)
+ nlist=nhist2
+ file24name=fname
+
+ return
+end subroutine get_q3list
+
+subroutine rm_q3list(dxcall0)
+
+ parameter (MAX_CALLERS=40)
+ type q3list
+ character*6 call
+ character*4 grid
+ integer nsec
+ integer nfreq
+ integer moonel
+ end type q3list
+ character*(*) dxcall0
+ character*6 dxcall
+ character*256 file24name
+ type(q3list) callers(MAX_CALLERS)
+ common/lu24com/file24name
+
+ dxcall=dxcall0
+ open(24,file=trim(file24name),status='unknown',form='unformatted')
+ read(24) nhist2
+ read(24) callers(1:nhist2)
+
+ if(nhist2.eq.MAX_CALLERS .and. dxcall.eq.callers(nhist2)%call) then
+ nhist2=MAX_CALLERS - 1
+ go to 10
+ endif
+
+ iz=nhist2
+ do i=1,iz
+ if(callers(i)%call .eq. dxcall) then
+ nhist2=nhist2-1
+ callers(i:nhist2)=callers(i+1:nhist2+1) !Remove dxcall from q3list
+ exit
+ endif
+ enddo
+
+10 rewind 24
+ write(24) nhist2
+ write(24) callers(1:nhist2)
+ close(24)
+
+ return
+end subroutine rm_q3list
+
+subroutine jpl_setup(fname)
+ character*256 fname,jpleph_file_name
+ common/jplcom/jpleph_file_name
+ jpleph_file_name=fname
+ return
+end subroutine jpl_setup
diff --git a/lib/go_chkfft.cmd b/lib/go_chkfft.cmd index 375a194e..f07411d6 100755 --- a/lib/go_chkfft.cmd +++ b/lib/go_chkfft.cmd @@ -1 +1 @@ -gfortran -o chkfft chkfft3.f90 four2a.f90 gran.c /jtsdk/fftw3f/libfftw3f-3.dll
+gfortran -o chkfft3 chkfft3.f90 four2a.f90 gran.c libfftw3f-3.dll
diff --git a/lib/jt9.f90 b/lib/jt9.f90 index fbe57c1c..56249dec 100755 --- a/lib/jt9.f90 +++ b/lib/jt9.f90 @@ -27,7 +27,7 @@ program jt9 logical :: read_files = .true., tx9 = .false., display_help = .false., &
bLowSidelobes = .false., nexp_decode_set = .false., &
have_ntol = .false.
- type (option) :: long_options(31) = [ &
+ type (option) :: long_options(32) = [ &
option ('help', .false., 'h', 'Display this help message', ''), &
option ('shmem',.true.,'s','Use shared memory for sample data','KEY'), &
option ('tr-period', .true., 'p', 'Tx/Rx period, default SECONDS=60', &
@@ -60,6 +60,7 @@ program jt9 option ('jt65', .false.,'6', 'JT65 mode', ''), &
option ('fst4', .false., '7', 'FST4 mode', ''), &
option ('fst4w', .false., 'W', 'FST4W mode', ''), &
+ option ('fst4w', .false., 'Y', 'FST4W mode, print hash22 values', ''), &
option ('ft8', .false., '8', 'FT8 mode', ''), &
option ('jt9', .false., '9', 'JT9 mode', ''), &
option ('qra64', .false., 'q', 'QRA64 mode', ''), &
@@ -85,13 +86,12 @@ program jt9 common/decstats/ntry65a,ntry65b,n65a,n65b,num9,numfano
data npatience/1/,nthreads/1/,wisfile/' '/
- iwspr=0
nsubmode = 0
ntol = 20
TRperiod=60.d0
do
- call getopt('hs:e:a:b:r:m:p:d:f:F:w:t:9876543WqTL:S:H:c:G:x:g:X:Q:', &
+ call getopt('hs:e:a:b:r:m:p:d:f:F:w:t:9876543WYqTL:S:H:c:G:x:g:X:Q:', &
long_options,c,optarg,arglen,stat,offset,remain,.true.)
if (stat .ne. 0) then
exit
@@ -141,7 +141,6 @@ program jt9 if (mode.lt.65) mode = mode + 65
case ('7')
mode = 240
- iwspr=0
case ('8')
mode = 8
case ('9')
@@ -152,7 +151,8 @@ program jt9 read (optarg(:arglen), *) npatience
case ('W')
mode = 241
- iwspr=1
+ case ('Y')
+ mode = 242
case ('c')
read (optarg(:arglen), *) mycall
case ('G')
@@ -212,7 +212,7 @@ program jt9 hisgrid=' '
endif
- if (mode .eq. 241) then
+ if (mode .eq. 241 .or. mode .eq. 242) then
ntol = min (ntol, 100)
else if (mode .eq. 65 + 9 .and. .not. have_ntol) then
ntol = 20
@@ -222,7 +222,7 @@ program jt9 ntol = min (ntol, 1000)
end if
if (.not. nexp_decode_set) then
- if (mode .eq. 240 .or. mode .eq. 241) then
+ if (mode .eq. 240 .or. mode .eq. 241 .or. mode .eq. 242) then
nexp_decode = 3 * 256 ! single decode off and nb=0
end if
end if
@@ -277,7 +277,8 @@ program jt9 call timer('symspec ',1)
endif
nhsym0=nhsym
- if(nhsym.ge.181 .and. mode.ne.240 .and. mode.ne.241 .and. mode.ne.66) exit
+ if(nhsym.ge.181 .and. mode.ne.240 .and. mode.ne.241 .and. &
+ mode.ne.242 .and. mode.ne.66) exit
endif
enddo
close(unit=wav%lun)
@@ -294,7 +295,6 @@ program jt9 shared_data%params%kin=64800
if(mode.eq.240) shared_data%params%kin=720000 !### 60 s periods ###
shared_data%params%nzhsym=nhsym
- if(mode.eq.240 .and. iwspr.eq.1) ndepth=ior(ndepth,128)
shared_data%params%ndepth=ndepth
shared_data%params%lft8apon=.true.
shared_data%params%ljt65apon=.true.
diff --git a/lib/map65_mmdec.f90 b/lib/map65_mmdec.f90 index 2b642f96..fcc7092e 100755 --- a/lib/map65_mmdec.f90 +++ b/lib/map65_mmdec.f90 @@ -1,5 +1,5 @@ subroutine map65_mmdec(nutc,id2,nqd,nsubmode,nfa,nfb,nfqso,ntol,newdat, &
- nagain,max_drift,mycall,hiscall,hisgrid)
+ nagain,max_drift,ndepth,mycall,hiscall,hisgrid)
use prog_args
use timer_module, only: timer
@@ -14,8 +14,8 @@ subroutine map65_mmdec(nutc,id2,nqd,nsubmode,nfa,nfb,nfqso,ntol,newdat, & logical single_decode,bVHF,lnewdat,lagain,lclearave,lapcqonly
integer*2 id2(300*12000)
+ integer nqf(20)
! type(params_block) :: params
- character(len=20) :: datetime
character(len=12) :: mycall, hiscall
character(len=6) :: hisgrid
data ntr0/-1/
@@ -28,8 +28,7 @@ subroutine map65_mmdec(nutc,id2,nqd,nsubmode,nfa,nfb,nfqso,ntol,newdat, & ! hiscall=transfer(params%hiscall,hiscall)
! mygrid=transfer(params%mygrid,mygrid)
! hisgrid=transfer(params%hisgrid,hisgrid)
- datetime=' '
-
+
my_q65%decoded = 0
ncontest=0
nQSOprogress=0
@@ -40,16 +39,12 @@ subroutine map65_mmdec(nutc,id2,nqd,nsubmode,nfa,nfb,nfqso,ntol,newdat, & lagain=(nagain.ne.0)
bVHF=.true.
emedelay=2.5
- ndepth=1
ntrperiod=60
- open(17,file=trim(temp_dir)//'/red.dat',status='unknown')
- open(14,file=trim(temp_dir)//'/avemsg.txt',status='unknown')
-
call timer('dec_q65 ',0)
call my_q65%decode(q65_decoded,id2,nqd,nutc,ntrperiod,nsubmode,nfqso, &
ntol,ndepth,nfa,nfb,lclearave,single_decode,lagain,max_drift,lnewdat, &
- emedelay,mycall,hiscall,hisgrid,nQSOProgress,ncontest,lapcqonly,navg0)
+ emedelay,mycall,hiscall,hisgrid,nQSOProgress,ncontest,lapcqonly,navg0,nqf)
call timer('dec_q65 ',1)
return
diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 7af3a368..47b25765 100755 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -33,7 +33,7 @@ contains subroutine decode(this,callback,iwave,nqd0,nutc,ntrperiod,nsubmode,nfqso, &
ntol,ndepth,nfa0,nfb0,lclearave,single_decode,lagain,max_drift0, &
lnewdat0,emedelay,mycall,hiscall,hisgrid,nQSOprogress,ncontest, &
- lapcqonly,navg0)
+ lapcqonly,navg0,nqf)
! Top-level routine that organizes the decoding of Q65 signals
! Input: iwave Raw data, i*2
@@ -55,9 +55,13 @@ contains use, intrinsic :: iso_c_binding
use q65 !Shared variables
use prog_args
+ use types
- parameter (NMAX=300*12000) !Max TRperiod is 300 s
+ parameter (NMAX=300*12000) !Max TRperiod is 300 s
+ parameter (MAX_CALLERS=40) !For multiple q3 decodes in NA VHf Contest mode
+
class(q65_decoder), intent(inout) :: this
+
procedure(q65_decode_callback) :: callback
character(len=12) :: mycall, hiscall !Used for AP decoding
character(len=6) :: hisgrid
@@ -70,19 +74,26 @@ contains character*80 fmt
integer*2 iwave(NMAX) !Raw data
real, allocatable :: dd(:) !Raw data
+ real xdtdecodes(100)
+ real f0decodes(100)
integer dat4(13) !Decoded message as 12 6-bit integers
integer dgen(13)
+ integer nqf(20)
+ integer stageno !Added by W3SZ
+ integer time
logical lclearave,lnewdat0,lapcqonly,unpk77_success
logical single_decode,lagain
complex, allocatable :: c00(:) !Analytic signal, 6000 Sa/s
complex, allocatable :: c0(:) !Analytic signal, 6000 Sa/s
- integer stageno !Added by W3SZ
- stageno=0
+ type(q3list) callers(MAX_CALLERS)
! Start by setting some parameters and allocating storage for large arrays
call sec0(0,tdecode)
+ stageno=0
ndecodes=0
decodes=' '
+ f0decodes=0.
+ xdtdecodes=0.
nfa=nfa0
nfb=nfb0
nqd=nqd0
@@ -97,9 +108,30 @@ contains nfft1=ntrperiod*12000
nfft2=ntrperiod*6000
npasses=1
+ nhist2=0
if(lagain) ndepth=ior(ndepth,3) !Use 'Deep' for manual Q65 decodes
dxcall13=hiscall ! initialize for use in packjt77
mycall13=mycall
+ if(ncontest.eq.1) then
+! NA VHF, WW-Digi, or ARRL Digi Contest
+ open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', &
+ form='unformatted')
+ read(24,end=2) nhist2
+ if(nhist2.ge.1 .and. nhist2.le.40) then
+ read(24,end=2) callers(1:nhist2)
+ now=time()
+ do i=1,nhist2
+ hours=(now - callers(i)%nsec)/3600.0
+ if(hours.gt.24.0) then
+ callers(i:nhist2-1)=callers(i+1:nhist2)
+ nhist2=nhist2-1
+ endif
+ enddo
+ else
+ nhist2=0
+ endif
+2 close(24)
+ endif
! Determine the T/R sequence: iseq=0 (even), or iseq=1 (odd)
n=nutc
@@ -132,25 +164,37 @@ contains baud=12000.0/nsps
this%callback => callback
nFadingModel=1
- maxiters=33
- ibwa=max(1,int(1.8*log(baud*mode_q65)) + 1)
- ibwb=min(10,ibwa+2)
- if(iand(ndepth,3).ge.2) then
- ibwa=max(1,int(1.8*log(baud*mode_q65)) + 1)
- ibwb=min(10,ibwa+5)
- maxiters=67
- endif
+
+! ibwa=max(1,int(1.8*log(baud*mode_q65)) + 5)
+!### This needs work!
+ ibwa=1 !Q65-60A
+ if(mode_q65.eq.2) ibwa=3 !Q65-60B
+ if(mode_q65.eq.4) ibwa=8 !Q65-60C
+ if(mode_q65.eq.8) ibwa=8 !Q65-60D
+ if(mode_q65.eq.16) ibwa=8 !Q65-60E
+!###
+
+! ibwb=min(15,ibwa+4)
+ ibwb=min(15,ibwa+6)
+ maxiters=40
+ if(iand(ndepth,3).eq.2) maxiters=60
if(iand(ndepth,3).eq.3) then
- ibwa=max(1,ibwa-1)
- ibwb=min(10,ibwb+1)
+ ibwa=max(1,ibwa-2)
+ ibwb=min(15,ibwb+2)
maxiters=100
endif
+
! Generate codewords for full-AP list decoding
if(ichar(hiscall(1:1)).eq.0) hiscall=' '
if(ichar(hisgrid(1:1)).eq.0) hisgrid=' '
ncw=0
- if(nqd.eq.1 .or. lagain) then
- call q65_set_list(mycall,hiscall,hisgrid,codewords,ncw)
+ if(nqd.eq.1 .or. lagain .or. ncontest.eq.1) then
+ if(ncontest.eq.1) then
+ call q65_set_list2(mycall,hiscall,hisgrid,callers,nhist2, &
+ codewords,ncw)
+ else
+ call q65_set_list(mycall,hiscall,hisgrid,codewords,ncw)
+ endif
endif
dgen=0
call q65_enc(dgen,codewords) !Initialize the Q65 codec
@@ -166,11 +210,9 @@ contains call timer('q65_dec0',0)
! Call top-level routine in q65 module: establish sync and try for a
! q3 or q0 decode.
- call q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, &
+ call q65_dec0(iavg,iwave,ntrperiod,nfqso,ntol,lclearave, &
emedelay,xdt,f0,snr1,width,dat4,snr2,idec,stageno)
call timer('q65_dec0',1)
-! write(*,3001) '=a',nfqso,ntol,ndepth,xdt,f0,idec
-!3001 format(a2,3i5,f7.2,f7.1,i5)
if(idec.ge.0) then
dtdec=xdt !We have a q3 or q0 decode at nfqso
@@ -178,6 +220,9 @@ contains go to 100
endif
+ if(ncontest.eq.1 .and. lagain .and. iand(ndepth,16).eq.16) go to 50
+ if(ncontest.eq.1 .and. lagain .and. iand(ndepth,16).eq.0) go to 100
+
! Prepare for a single-period decode with iaptype = 0, 1, 2, or 4
jpk0=(xdt+1.0)*6000 !Index of nominal start of signal
if(ntrperiod.le.30) jpk0=(xdt+0.5)*6000 !For shortest sequences
@@ -200,11 +245,10 @@ contains read(c78,1060) apsymbols
endif
- call timer('q65loops',0)
+ call timer('q65loop1',0)
call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, &
xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec)
- call timer('q65loops',1)
-! write(*,3001) '=b',nfqso,ntol,ndepth,xdt,f0,idec
+ call timer('q65loop1',1)
if(idec.ge.0) then
dtdec=xdt1
f0dec=f1
@@ -215,11 +259,11 @@ contains if(iand(ndepth,16).eq.0 .or. navg(iseq).lt.2) go to 100
! There was no single-transmission decode. Try for an average 'q3n' decode.
-50 call timer('list_avg',0)
+50 iavg=1
+ call timer('list_avg',0)
! Call top-level routine in q65 module: establish sync and try for a q3
! decode, this time using the cumulative 's1a' symbol spectra.
- iavg=1
- call q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, &
+ call q65_dec0(iavg,iwave,ntrperiod,nfqso,ntol,lclearave, &
emedelay,xdt,f0,snr1,width,dat4,snr2,idec,stageno)
call timer('list_avg',1)
@@ -236,7 +280,7 @@ contains call timer('q65_avg ',0)
iavg=2
- call q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, &
+ call q65_dec0(iavg,iwave,ntrperiod,nfqso,ntol,lclearave, &
emedelay,xdt,f0,snr1,width,dat4,snr2,idec,stageno)
call timer('q65_avg ',1)
if(idec.ge.0) then
@@ -250,7 +294,7 @@ contains call timer('q65_dec0',0)
! Call top-level routine in q65 module: establish sync and try for a
! q3 or q0 decode.
- call q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, &
+ call q65_dec0(iavg,iwave,ntrperiod,nfqso,ntol,lclearave, &
emedelay,xdt,f0,snr1,width,dat4,snr2,idec,stageno)
call timer('q65_dec0',1)
if(idec.ge.0) then
@@ -280,15 +324,21 @@ contains if(idupe.eq.0) then
ndecodes=min(ndecodes+1,100)
decodes(ndecodes)=decoded
- call q65_snr(dat4,dtdec,f0dec,mode_q65,nused,snr2)
+ f0decodes(ndecodes)=f0dec
+ xdtdecodes(ndecodes)=dtdec
+ call q65_snr(dat4,dtdec,f0dec,mode_q65,snr2)
nsnr=nint(snr2)
call this%callback(nutc,snr1,nsnr,dtdec,f0dec,decoded, &
idec,nused,ntrperiod)
- call q65_hist(nint(f0dec),msg0=decoded)
+ if(ncontest.eq.1) then
+ call q65_hist2(nint(f0dec),decoded,callers,nhist2)
+ else
+ call q65_hist(nint(f0dec),msg0=decoded)
+ endif
if(iand(ndepth,128).ne.0 .and. .not.lagain .and. &
int(abs(f0dec-nfqso)).le.ntol ) call q65_clravg !AutoClrAvg
call sec0(1,tdecode)
- open(22,file=trim(data_dir)//'/q65_decodes.dat',status='unknown', &
+ open(22,file=trim(data_dir)//'/q65_decodes.txt',status='unknown', &
position='append',iostat=ios)
if(ios.eq.0) then
! Save decoding parameters to q65_decoded.dat, for later analysis.
@@ -298,13 +348,13 @@ contains if(c6.eq.' ') c6='<b> '
c4=hisgrid(1:4)
if(c4.eq.' ') c4='<b> '
- fmt='(i6.4,1x,a4,i5,4i2,6i3,i4,f6.2,f7.1,f6.1,f7.1,f6.2,'// &
+ fmt='(i6.4,1x,a4,i5,4i2,8i3,i4,f6.2,f7.1,f6.1,f7.1,f6.2,'// &
'1x,a6,1x,a6,1x,a4,1x,a)'
if(ntrperiod.le.30) fmt(5:5)='6'
if(idec.eq.3) nrc=0
write(22,fmt) nutc,cmode,nfqso,nQSOprogress,idec,idfbest,idtbest, &
- ibw,ndistbest,nused,icand,ncand,nrc,ndepth,xdt,f0,snr2,plog, &
- tdecode,mycall(1:6),c6,c4,trim(decoded)
+ ibwa,ibwb,ibw,ndistbest,nused,icand,ncand,nrc,ndepth,xdt, &
+ f0,snr2,plog,tdecode,mycall(1:6),c6,c4,trim(decoded)
close(22)
endif
endif
@@ -317,6 +367,26 @@ contains snr1=candidates(icand,1)
xdt= candidates(icand,2)
f0 = candidates(icand,3)
+ do i=1,ndecodes
+ fdiff=f0-f0decodes(i)
+ if(fdiff.gt.-baud*mode_q65 .and. fdiff.lt.65*baud*mode_q65) go to 800
+ enddo
+
+!### TEST REGION
+ if(ncontest.eq.-1) then
+ call timer('q65_dec0',0)
+! Call top-level routine in q65 module: establish sync and try for a
+! q3 or q0 decode.
+ call q65_dec0(iavg,iwave,ntrperiod,nint(f0),ntol,lclearave, &
+ emedelay,xdt,f0,snr1,width,dat4,snr2,idec,stageno)
+ call timer('q65_dec0',1)
+ if(idec.ge.0) then
+ dtdec=xdt !We have a q3 or q0 decode at f0
+ f0dec=f0
+ go to 200
+ endif
+ endif
+!###
jpk0=(xdt+1.0)*6000 !Index of nominal start of signal
if(ntrperiod.le.30) jpk0=(xdt+0.5)*6000 !For shortest sequences
if(jpk0.lt.0) jpk0=0
@@ -329,6 +399,8 @@ contains if(lapcqonly) npasses=1
iaptype=0
do ipass=0,npasses !Loop over AP passes
+! write(*,3001) nutc,icand,ipass,f0,xdt,snr1
+!3001 format('a',i5.4,2i3,3f7.1)
apmask=0 !Try first with no AP information
apsymbols=0
if(ipass.ge.1) then
@@ -341,10 +413,10 @@ contains read(c78,1060) apsymbols
endif
- call timer('q65loops',0)
+ call timer('q65loop2',0)
call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, &
xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec)
- call timer('q65loops',1)
+ call timer('q65loop2',1)
! write(*,3001) '=e',nfqso,ntol,ndepth,xdt,f0,idec
if(idec.ge.0) then
dtdec=xdt1
@@ -365,15 +437,21 @@ contains if(idupe.eq.0) then
ndecodes=min(ndecodes+1,100)
decodes(ndecodes)=decoded
- call q65_snr(dat4,dtdec,f0dec,mode_q65,nused,snr2)
+ f0decodes(ndecodes)=f0dec
+ call q65_snr(dat4,dtdec,f0dec,mode_q65,snr2)
nsnr=nint(snr2)
call this%callback(nutc,snr1,nsnr,dtdec,f0dec,decoded, &
idec,nused,ntrperiod)
- call q65_hist(nint(f0dec),msg0=decoded)
+ if(ncontest.eq.1) then
+ call q65_hist2(nint(f0dec),decoded,callers,nhist2)
+ else
+ call q65_hist(nint(f0dec),msg0=decoded)
+ endif
if(iand(ndepth,128).ne.0 .and. .not.lagain .and. &
int(abs(f0dec-nfqso)).le.ntol ) call q65_clravg !AutoClrAvg
call sec0(1,tdecode)
- open(22,file=trim(data_dir)//'/q65_decodes.dat',status='unknown', &
+ ios=1
+ open(22,file=trim(data_dir)//'/q65_decodes.txt',status='unknown',&
position='append',iostat=ios)
if(ios.eq.0) then
! Save decoding parameters to q65_decoded.dat, for later analysis.
@@ -383,20 +461,45 @@ contains if(c6.eq.' ') c6='<b> '
c4=hisgrid(1:4)
if(c4.eq.' ') c4='<b> '
- fmt='(i6.4,1x,a4,i5,4i2,6i3,i4,f6.2,f7.1,f6.1,f7.1,f6.2,'// &
+ fmt='(i6.4,1x,a4,i5,4i2,8i3,i4,f6.2,f7.1,f6.1,f7.1,f6.2,'// &
'1x,a6,1x,a6,1x,a4,1x,a)'
if(ntrperiod.le.30) fmt(5:5)='6'
if(idec.eq.3) nrc=0
- write(22,fmt) nutc,cmode,nfqso,nQSOprogress,idec,idfbest,idtbest, &
- ibw,ndistbest,nused,icand,ncand,nrc,ndepth,xdt,f0,snr2,plog, &
- tdecode,mycall(1:6),c6,c4,trim(decoded)
+ write(22,fmt) nutc,cmode,nfqso,nQSOprogress,idec,idfbest, &
+ idtbest,ibwa,ibwb,ibw,ndistbest,nused,icand,ncand,nrc, &
+ ndepth,xdt,f0,snr2,plog,tdecode,mycall(1:6),c6,c4, &
+ trim(decoded)
close(22)
endif
endif
endif
+800 continue
enddo ! icand
if(iavg.eq.0 .and.navg(iseq).ge.2 .and. iand(ndepth,16).ne.0) go to 50
-900 return
+
+900 if(ncontest.ne.1 .or. lagain) go to 999
+ if(ntrperiod.ne.60 .or. nsubmode.ne.0) go to 999
+
+! This is first time here, and we're running Q65-60A in NA VHF Contest mode.
+! Return a list of potential sync frequencies at which to try q3 decoding.
+
+ k=0
+ nqf=0
+ bw=baud*mode_q65*65
+ do i=1,ncand
+! snr1=candidates(i,1)
+! xdt= candidates(i,2)
+ f0 = candidates(i,3)
+ do j=1,ndecodes ! Already decoded one at or near this frequency?
+ fj=f0decodes(j)
+ if(f0.gt.fj-5.0 .and. f0.lt.fj+bw+5.0) go to 990
+ enddo
+ k=k+1
+ nqf(k)=nint(f0)
+990 continue
+ enddo
+
+999 return
end subroutine decode
end module q65_decode
diff --git a/lib/qra/q65/q65.f90 b/lib/qra/q65/q65.f90 index 3cb27545..49c0977b 100755 --- a/lib/qra/q65/q65.f90 +++ b/lib/qra/q65/q65.f90 @@ -2,8 +2,8 @@ module q65 parameter (NSTEP=8) !Number of time bins per symbol in s1, s1a, s1b
parameter (PLOG_MIN=-242.0) !List decoding threshold
- integer nsave,nlist,LL0,iz0,jz0
- integer listutc(10)
+ integer iz0,jz0
+! integer listutc(10)
integer apsym0(58),aph10(10)
integer apmask1(78),apsymbols1(78)
integer apmask(13),apsymbols(13)
@@ -12,23 +12,23 @@ module q65 integer codewords(63,206)
integer ibwa,ibwb,ncw,nsps,mode_q65,nfa,nfb,nqd
integer idfbest,idtbest,ibw,ndistbest,maxiters,max_drift
- integer istep,nsmo,lag1,lag2,npasses,nused,iseq,ncand,nrc
+ integer istep,nsmo,lag1,lag2,npasses,iseq,ncand,nrc
integer i0,j0
integer navg(0:1)
logical lnewdat
real candidates(20,3) !snr, xdt, and f0 of top candidates
real, allocatable :: s1raw(:,:) !Symbol spectra, 1/8-symbol steps
real, allocatable :: s1(:,:) !Symbol spectra w/suppressed peaks
- real, allocatable :: s1w(:,:) !Symbol spectra w/suppressed peaks !w3sz added
+ real, allocatable :: s1w(:,:) !Symbol spectra w/suppressed peaks (W3SZ)
real, allocatable,save :: s1a(:,:,:) !Cumulative symbol spectra
- real, allocatable,save :: ccf2(:) !Max CCF(freq) at any lag, single seq
- real, allocatable,save :: ccf2_avg(:) !Like ccf2, but for accumulated average
+ real, allocatable,save :: ccf2(:) !Max CCF(freq) at any lag (orange curve)
+ real, allocatable,save :: ccf2_avg(:) !Like ccf2, but for avg (red curve)
real sync(85) !sync vector
real df,dtstep,dtdec,f0dec,ftol,plog,drift
contains
-subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, &
+subroutine q65_dec0(iavg,iwave,ntrperiod,nfqso,ntol,lclearave, &
emedelay,xdt,f0,snr1,width,dat4,snr2,idec,stageno)
! Top-level routine in q65 module
@@ -41,7 +41,6 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & ! ntrperiod T/R sequence length (s)
! nfqso Target frequency (Hz)
! ntol Search range around nfqso (Hz)
-! ndepth Requested decoding depth
! lclearave Flag to clear the accumulating array
! emedelay Extra delay for EME signals
! Output: xdt Time offset from nominal (s)
@@ -68,7 +67,7 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & real, allocatable :: s3(:,:) !Data-symbol energies s3(LL,63)
real, allocatable :: ccf1(:) !CCF(freq) at fixed lag (red)
data first/.true./
- save first
+ save first,LL0
integer w3t
integer w3f
@@ -76,7 +75,6 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & integer stageno
NN=63
- if(nutc+ndepth.eq.-999) stop !Silence compiler warnings
! Set some parameters and allocate storage for large arrays
irc=-2
@@ -95,7 +93,8 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & ftol=ntol
ia=ntol/df
ia2=max(ia,10*mode_q65,nint(100.0/df))
- nsmo=int(0.7*mode_q65*mode_q65)
+! nsmo=int(0.7*mode_q65*mode_q65)
+ nsmo=int(0.5*mode_q65*mode_q65)
if(nsmo.lt.1) nsmo=1
if(first) then !Generate the sync vector
sync=-22.0/63.0 !Sync tone OFF
@@ -126,7 +125,7 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & lclearave=.false.
endif
ccf1=0.
- if(iavg.eq.0) ccf2_avg=0.
+ if(iavg.eq.0) ccf2=0.
dtstep=nsps/(NSTEP*12000.0) !Step size in seconds
lag1=-1.0/dtstep
lag2=1.0/dtstep + 0.9999
@@ -135,11 +134,13 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & if(nsps.ge.7200) j0=1.0/dtstep !Nominal start-signal index
s3=0.
+! if(iavg.eq.0 .and. lnewdat) then
if(iavg.eq.0) then
call timer('q65_syms',0)
! Compute symbol spectra with NSTEP time bins per symbol
call q65_symspec(iwave,ntrperiod*12000,iz,jz,s1)
call timer('q65_syms',1)
+! lnewdat=.false.
else
s1=s1a(:,:,iseq)
endif
@@ -148,15 +149,15 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & ii1=max(1,i0-64)
ii2=i0-65+LL
call pctile(s1(ii1:ii2,1:jz),ii2-ii1+1*jz,45,base)
- s1=s1/base
+! s1=s1/base
s1raw=s1
! Apply fast AGC to the symbol spectra
- s1max=20.0 !Empirical choice
- do j=1,jz !### Maybe wrong way? ###
- smax=maxval(s1(ii1:ii2,j))
- if(smax.gt.s1max) s1(ii1:ii2,j)=s1(ii1:ii2,j)*s1max/smax
- enddo
+! s1max=20.0 !Empirical choice
+! do j=1,jz !### Maybe wrong way? ###
+! smax=maxval(s1(ii1:ii2,j))
+! if(smax.gt.s1max) s1(ii1:ii2,j)=s1(ii1:ii2,j)*s1max/smax
+! enddo
dat4=0
if(ncw.gt.0 .and. iavg.le.1) then
@@ -178,7 +179,7 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & ! Get 2d CCF and ccf2 using sync symbols only
if(iavg.eq.0) then
call timer('ccf_22a ',0)
- call q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, &
+ call q65_ccf_22(s1,iz,jz,nfqso,ntol,iavg,ipk,jpk, &
f0a,xdta,ccf2)
call timer('ccf_22a ',1)
endif
@@ -186,7 +187,7 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & ! Get 2d CCF and ccf2_avg using sync symbols only
if(iavg.ge.1) then
call timer('ccf_22b ',0)
- call q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, &
+ call q65_ccf_22(s1,iz,jz,nfqso,ntol,iavg,ipk,jpk, &
f0a,xdta,ccf2_avg)
call timer('ccf_22b ',1)
endif
@@ -217,10 +218,8 @@ subroutine q65_dec0(iavg,nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & if(i2.eq.-9999 .and. ccf1(-i).ge.0.5*smax) i2=-i
enddo
width=df*(i2-i1)
-
if(ncw.eq.0) ccf1=0.
-
- call q65_write_red(iz,xdt,ccf2_avg,ccf2)
+ call q65_write_red(iz,xdt,ccf2_avg,ccf2) !### Need this call for WSJT-X
if(idec.lt.0 .and. (iavg.eq.0 .or. iavg.eq.2)) then
call q65_dec_q012(s3,LL,snr2,dat4,idec,decoded)
@@ -291,7 +290,7 @@ subroutine q65_symspec(iwave,nmax,iz,jz,s1) allocate(c0(0:nsps-1))
nfft=nsps
fac=1/32767.0
- do j=1,jz !Compute symbol spectra at step size
+ do j=1,jz,2 !Compute symbol spectra at 2*step size
i1=(j-1)*istep
i2=i1+nsps-1
k=-1
@@ -311,6 +310,8 @@ subroutine q65_symspec(iwave,nmax,iz,jz,s1) do i=1,nsmo
call smo121(s1(1:iz,j),iz)
enddo
+! Interpolate to fill in the skipped-over spectra.
+ if(j.ge.3) s1(1:iz,j-1)=0.5*(s1(1:iz,j-2)+s1(1:iz,j))
enddo
if(lnewdat) then
navg(iseq)=navg(iseq) + 1
@@ -481,7 +482,7 @@ subroutine q65_ccf_85(s1,iz,jz,nfqso,ia,ia2,ipk,jpk,f0,xdt,imsg_best, & return
end subroutine q65_ccf_85
-subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, &
+subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,iavg,ipk,jpk, &
f0,xdt,ccf2)
! Attempt synchronization using only the 22 sync symbols. Return ccf2
@@ -489,6 +490,7 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, & real s1(iz,jz)
real ccf2(iz) !Orange sync curve
+ real tmp(20,3)
real, allocatable :: xdt2(:)
real, allocatable :: s1avg(:)
integer, allocatable :: indx(:)
@@ -499,7 +501,7 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, & ia=max(nfa,100)/df
ib=min(nfb,4900)/df
- if(nqd.ne.1 .or. iavg.ne.0) max_drift=0
+! if(nqd.ne.1 .or. iavg.ne.0) max_drift=0 !### Disabled March 22, 2023
if(max_drift.ne.0) then
ia=max(nint(100/df),nint((nfqso-ntol)/df))
ib=min(nint(4900/df),nint((nfqso+ntol)/df))
@@ -509,11 +511,14 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, & s1avg(i)=sum(s1(i,1:jz))
enddo
+ call pctile(s1avg(ia:ib),ib-ia+1,40,base0)
ccfbest=0.
ibest=0
lagpk=0
lagbest=0
+ idrift_max=0
idrift_best=0
+
do i=ia,ib
ccfmax=0.
do lag=lag1,lag2
@@ -535,10 +540,13 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, & endif
enddo ! idrift
enddo ! lag
+
ccf2(i)=ccfmax
xdt2(i)=lagpk*dtstep
+
if(ccfmax.gt.ccfbest .and. abs(i*df-nfqso).le.ftol) then
ccfbest=ccfmax
+ snrbest=snr
ibest=i
lagbest=lagpk
idrift_best=idrift_max
@@ -556,28 +564,39 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,ndepth,ntrperiod,iavg,ipk,jpk, & ! Save parameters for best candidates
jzz=ib-ia+1
- call pctile(ccf2(ia:ib),jzz,40,base)
- ccf2=ccf2/base
call indexx(ccf2(ia:ib),jzz,indx)
+
+ call pctile(ccf2(ia:ib),jzz,50,ave)
+ call pctile(ccf2(ia:ib),jzz,84,base)
+ rms=base-ave
ncand=0
maxcand=20
do j=1,20
k=jzz-j+1
if(k.lt.1 .or. k.gt.iz) cycle
i=indx(k)+ia-1
- if(ccf2(i).lt.3.3) exit !Candidate limit
f=i*df
i3=max(1, i-mode_q65)
i4=min(iz,i+mode_q65)
biggest=maxval(ccf2(i3:i4))
if(ccf2(i).ne.biggest) cycle
+ snr=(ccf2(i)-ave)/rms
+ if(snr.lt.6.0) exit
ncand=ncand+1
- candidates(ncand,1)=ccf2(i)
+ candidates(ncand,1)=snr
candidates(ncand,2)=xdt2(i)
candidates(ncand,3)=f
if(ncand.ge.maxcand) exit
enddo
+! Resort the candidates back into frequency order
+ tmp(1:ncand,1:3)=candidates(1:ncand,1:3)
+ candidates=0.
+ call indexx(tmp(1:ncand,3),ncand,indx)
+ do i=1,ncand
+ candidates(i,1:3)=tmp(indx(i),1:3)
+ enddo
+
return
end subroutine q65_ccf_22
@@ -591,7 +610,7 @@ subroutine q65_dec1(s3,nsubmode,b90ts,esnodb,irc,dat4,decoded) integer dat4(13)
character c77*77,decoded*37
logical unpk77_success
-
+
nFadingModel=1
decoded=' '
call q65_intrinsics_ff(s3,nsubmode,b90ts,nFadingModel,s3prob)
@@ -605,7 +624,7 @@ subroutine q65_dec1(s3,nsubmode,b90ts,esnodb,irc,dat4,decoded) irc=-1
endif
nrc=irc
-
+
return
end subroutine q65_dec1
@@ -672,16 +691,21 @@ subroutine q65_write_red(iz,xdt,ccf2_avg,ccf2) call q65_sync_curve(ccf2_avg,1,iz,rms1)
call q65_sync_curve(ccf2,1,iz,rms2)
+ i1=max(1,nint(nfa/df))
+ i2=min(iz,int(nfb/df))
+ y0=minval(ccf2(i1:i2))
+ y0_avg=minval(ccf2_avg(i1:i2))
+ g=0.4
+ g_avg=0.
+ if(navg(iseq).ge.2) g_avg=g
rewind 17
- write(17,1000) xdt,minval(ccf2_avg),maxval(ccf2_avg)
- do i=max(1,nint(nfa/df)),min(iz,int(nfb/df))
+ write(17,1000) xdt,g_avg*minval(ccf2_avg),g_avg*maxval(ccf2_avg)
+ do i=i1,i2
freq=i*df
- y1=ccf2_avg(i)
- if(y1.gt.10.0) y1=10.0 + 2.0*log10(y1/10.0)
- y2=ccf2(i)
- if(y2.gt.10.0) y2=10.0 + 2.0*log10(y2/10.0)
+ y1=g_avg*(ccf2_avg(i)-y0_avg)
+ y2=g*(ccf2(i)-y0)
write(17,1000) freq,y1,y2
-1000 format(3f10.3)
+1000 format(f10.3,2f15.6)
enddo
flush(17)
@@ -733,7 +757,7 @@ subroutine q65_bzap(s3,LL) return
end subroutine q65_bzap
-subroutine q65_snr(dat4,dtdec,f0dec,mode_q65,nused,snr2)
+subroutine q65_snr(dat4,dtdec,f0dec,mode_q65,snr2)
! Estimate SNR of a decoded transmission by aligning the spectra of
! all 85 symbols.
@@ -781,8 +805,6 @@ subroutine q65_snr(dat4,dtdec,f0dec,mode_q65,nused,snr2) sig_area=sum(spec(ia+nsum:ib-nsum)-1.0)
w_equiv=sig_area/(smax-1.0)
snr2=db(max(1.0,sig_area)) - db(2500.0/df)
-! NB: No adjustment to SNR is now made for nused>1, because that process did
-! not seem to work as expected.
return
end subroutine q65_snr
@@ -841,4 +863,66 @@ subroutine q65_hist(if0,msg0,dxcall,dxgrid) 900 return
end subroutine q65_hist
+subroutine q65_hist2(nfreq,msg0,callers,nhist2)
+
+ use types
+ use prog_args
+ parameter (MAX_CALLERS=40) !For multiple q3 decodes in NA VHf Contest mode
+ character*37 msg0,msg
+ type(q3list) callers(MAX_CALLERS)
+ character*6 c6
+ character*4 g4
+ logical newcall,isgrid
+
+ isgrid(g4)=g4(1:1).ge.'A' .and. g4(1:1).le.'R' .and. g4(2:2).ge.'A' .and. &
+ g4(2:2).le.'R' .and. g4(3:3).ge.'0' .and. g4(3:3).le.'9' .and. &
+ g4(4:4).ge.'0' .and. g4(4:4).le.'9' .and. g4(1:4).ne.'RR73'
+
+ msg=msg0
+ if(index(msg,'/').gt.0) goto 900 !Ignore messages with compound calls
+ i0=index(msg,' R ')
+ if(i0.ge.7) msg=msg(1:i0)//msg(i0+3:)
+ i1=index(msg,' ')
+ c6=' '
+ g4=' '
+ if(i1.ge.4 .and. i1.le.13) then
+ i2=index(msg(i1+1:),' ') + i1
+ c6=msg(i1+1:i2-1) !Extract DX call
+ g4=msg(i2+1:i2+4) !Extract DX grid
+ endif
+
+ newcall=.true.
+ do i=1,nhist2
+ if(callers(i)%call .eq. c6) then
+ newcall=.false.
+ callers(i)%nsec=time()
+ callers(i)%nfreq=nfreq
+ exit
+ endif
+ enddo
+
+ if(newcall .and. isgrid(g4)) then
+ if(nhist2.eq.MAX_CALLERS) then
+! Purge the oldest caller
+ callers(1:MAX_CALLERS-1)=callers(2:MAX_CALLERS)
+ nhist2=nhist2-1
+ endif
+ nhist2=nhist2+1
+ callers(nhist2)%call=c6
+ callers(nhist2)%grid=g4
+ callers(nhist2)%nsec=time()
+ callers(nhist2)%nfreq=nfreq
+ endif
+
+ if(nhist2.ge.1 .and. nhist2.le.40) then
+ open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', &
+ form='unformatted')
+ write(24) nhist2
+ write(24) callers(1:nhist2)
+ close(24)
+ endif
+
+900 return
+end subroutine q65_hist2
+
end module q65
diff --git a/lib/qra/q65/q65_encoding_modules.f90 b/lib/qra/q65/q65_encoding_modules.f90 index dc65588d..c1f765df 100755 --- a/lib/qra/q65/q65_encoding_modules.f90 +++ b/lib/qra/q65/q65_encoding_modules.f90 @@ -135,10 +135,9 @@ end subroutine get_q65crc12(mc2,ncrc1,ncrc2)
!
- character c12*12,c6*6
+ character c6*6
integer*1 mc(90),mc2(90),tmp(6)
integer*1 r(13),p(13)
- integer ncrc
! polynomial for 12-bit CRC 0xF01
data p/1,1,0,0,0,0,0,0,0,1,1,1,1/
@@ -170,7 +169,6 @@ subroutine get_q65_tones(msg37,codeword,itone) implicit none
character*37 msg37
character*77 c77
- character*12 c12
character*6 c6
integer codeword(65)
integer sync(22)
diff --git a/lib/qra/q65/q65_loops.f90 b/lib/qra/q65/q65_loops.f90 index 0fc987c9..c4f3f2f6 100755 --- a/lib/qra/q65/q65_loops.f90 +++ b/lib/qra/q65/q65_loops.f90 @@ -37,7 +37,7 @@ subroutine q65_loops(c00,npts2,nsps2,nsubmode,ndepth,jpk0, & if(iand(ndepth,3).eq.3) then
idfmax=5
idtmax=5
- maxdist=15
+ maxdist=5
endif
napmin=99
diff --git a/lib/qra/q65/q65_set_list.f90 b/lib/qra/q65/q65_set_list.f90 index 790c7f0c..0debe2c6 100755 --- a/lib/qra/q65/q65_set_list.f90 +++ b/lib/qra/q65/q65_set_list.f90 @@ -3,7 +3,7 @@ subroutine q65_set_list(mycall,hiscall,hisgrid,codewords,ncw) parameter (MAX_NCW=206)
character*12 mycall,hiscall
character*6 hisgrid
- character*37 msg0,msg,msgsent
+ character*37 msg,msgsent
logical my_std,his_std
integer codewords(63,MAX_NCW)
integer itone(85)
@@ -45,7 +45,7 @@ subroutine q65_set_list(mycall,hiscall,hisgrid,codewords,ncw) endif
endif
-10 call genq65(msg,0,msgsent,itone,i3,n3)
+ call genq65(msg,0,msgsent,itone,i3,n3)
i0=1
j=0
do k=1,85
diff --git a/lib/qra/q65/q65_set_list2.f90 b/lib/qra/q65/q65_set_list2.f90 new file mode 100755 index 00000000..76797a0e --- /dev/null +++ b/lib/qra/q65/q65_set_list2.f90 @@ -0,0 +1,70 @@ +subroutine q65_set_list2(mycall,hiscall,hisgrid,callers,nhist2,codewords,ncw)
+
+ use types
+ parameter (MAX_NCW=206)
+ parameter (MAX_CALLERS=40) !For multiple q3 decodes in NA VHf Contest mode
+ character*12 mycall,hiscall
+ character*6 hisgrid,c6
+ character*4 g4
+ character*37 msg,msgsent
+ logical std,isgrid
+ integer codewords(63,MAX_NCW)
+ integer itone(85)
+ integer isync(22)
+ type(q3list) callers(MAX_CALLERS)
+
+ data isync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/
+
+ isgrid(g4)=g4(1:1).ge.'A' .and. g4(1:1).le.'R' .and. g4(2:2).ge.'A' .and. &
+ g4(2:2).le.'R' .and. g4(3:3).ge.'0' .and. g4(3:3).le.'9' .and. &
+ g4(4:4).ge.'0' .and. g4(4:4).le.'9' .and. g4(1:4).ne.'RR73'
+
+ call stdcall(hiscall,std)
+ jmax=nhist2
+ if(std .and. isgrid(hisgrid(1:4))) then
+ jmax=min(MAX_CALLERS,nhist2+1)
+ do j=1,nhist2
+ if(callers(j)%call .eq. hiscall(1:6)) then
+ jmax=nhist2
+ exit
+ endif
+ enddo
+ endif
+
+ codewords(:,1)=0
+ i=1
+ do j=1,jmax
+ c6=callers(j)%call
+ g4=callers(j)%grid
+ if(j.eq.nhist2+1) then
+ c6=hiscall(1:6)
+ g4=hisgrid(1:4)
+ endif
+ do k=1,5
+ i=i+1
+ msg=trim(mycall)//' '//trim(c6)
+ j0=len(trim(msg))+1
+ if(k.eq.1) msg=msg(1:j0)//g4
+ if(k.eq.2) msg=msg(1:j0)//'R '//g4
+ if(k.eq.3) msg(j0:j0+3)=' RRR'
+ if(k.eq.4) msg(j0:j0+4)=' RR73'
+ if(k.eq.5) msg(j0:j0+2)=' 73'
+ call genq65(msg,0,msgsent,itone,i3,n3)
+ i0=1
+ jj=0
+ do kk=1,85
+ if(kk.eq.isync(i0)) then
+ i0=i0+1
+ cycle
+ endif
+ jj=jj+1
+ codewords(jj,i)=itone(kk) - 1
+ enddo
+! write(71,3001) i,j,k,codewords(1:13,i),trim(msg)
+!3001 format(3i3,2x,13i3,2x,a)
+ enddo
+ enddo
+ ncw=i
+
+ return
+end subroutine q65_set_list2
diff --git a/lib/qra/q65/q65sim.f90 b/lib/qra/q65/q65sim.f90 index fbbc68dd..b9462939 100755 --- a/lib/qra/q65/q65sim.f90 +++ b/lib/qra/q65/q65sim.f90 @@ -8,6 +8,7 @@ program q65sim type(hdr) h !Header for .wav file
integer*2 iwave(NMAX) !Generated waveform
integer itone(85) !Channel symbols (values 0-65)
+ integer ntone(85,10) !Channel symbols for up to 10 messages
integer y(63) !Codeword
integer istart !averaging compatible start seconds
integer imins !minutes for 15s period timestamp
@@ -17,19 +18,20 @@ program q65sim complex cdat(NMAX) !Generated complex waveform
complex cspread(0:NMAX-1) !Complex amplitude for Rayleigh fading
complex z
- real*8 f0,dt,twopi,phi,dphi,baud,fsample,freq
- character msg*37,fname*17,csubmode*1,arg*12
- character msgsent*37
+ real*8 f00,f0,dt,twopi,phi,dphi,baud,fsample,freq
+ character fname*17,csubmode*1,arg*12,c2*2
+ character*37 msg,msgsent,imsg(10)
nargs=iargc()
- if(nargs.ne.10) then
- print*,'Usage: q65sim "msg" A-E freq fDop DT f1 Stp TRp Nfile SNR'
- print*,'Example: q65sim "K1ABC W9XYZ EN37" A 1500 0.0 0.0 0.0 1 60 1 -26'
+ if(nargs.ne.11) then
+ print*,'Usage: q65sim "msg" A-E freq fDop DT f1 Stp TRp Nsig Nfile SNR'
+ print*,'Example: q65sim "K1ABC W9XYZ EN37" A 1500 0.0 0.0 0.0 1 60 1 1 -26'
print*,'Example: q65sim "ST" A 1500 0.0 0.0 0.0 1 60 1 -26'
print*,' fDop = Doppler spread'
print*,' f1 = Drift or Doppler rate (Hz/min)'
print*,' Stp = Step size (Hz)'
print*,' Stp = 0 implies no Doppler tracking'
+ print*,' Nsig = number of generated signals, 1 - 10'
print*,' Creates filenames which increment to permit averaging in first period'
print*,' If msg = ST program produces a single tone at freq'
go to 999
@@ -38,7 +40,7 @@ program q65sim call getarg(2,csubmode)
mode65=2**(ichar(csubmode)-ichar('A'))
call getarg(3,arg)
- read(arg,*) f0
+ read(arg,*) f00
call getarg(4,arg)
read(arg,*) fspread
call getarg(5,arg)
@@ -50,8 +52,10 @@ program q65sim call getarg(8,arg)
read(arg,*) ntrperiod
call getarg(9,arg)
- read(arg,*) nfiles
+ read(arg,*) nsig
call getarg(10,arg)
+ read(arg,*) nfiles
+ call getarg(11,arg)
read(arg,*) snrdb
if(ntrperiod.eq.15) then
@@ -79,22 +83,39 @@ program q65sim nsym=85 !Number of channel symbols
mode65=2**(ichar(csubmode) - ichar('A'))
- ichk=0
- call genq65(msg,ichk,msgsent,itone,i3,n3)
+
+ imsg(1)=msg
+ if(nsig.ge.2) then
+ i0=index(msg,' ')
+ i0=i0 + index(msg(i0+1:),' ')-2
+ do i=1,nsig
+ c2=char(ichar('A')+i-1)//char(ichar('A')+i-1)
+ imsg(i)=msg(1:i0-1)//c2//msg(i0+2:)
+ enddo
+ endif
- j=0
- do i=1,85
- if(itone(i).gt.0) then
- j=j+1
- y(j)=itone(i)-1
- endif
+ ichk=0
+ do i=1,nsig
+ msg=imsg(i)
+ call genq65(msg,ichk,msgsent,itone,i3,n3)
+ ntone(:,i)=itone
enddo
- write(*,1001) y(1:13),y(1:13)
+
+ if(nsig.eq.1) then
+ j=0
+ do i=1,85
+ if(itone(i).gt.0) then
+ j=j+1
+ y(j)=itone(i)-1
+ endif
+ enddo
+ write(*,1001) y(1:13),y(1:13)
1001 format('Generated message'/'6-bit: ',13i3/'binary: ',13b6.6)
- write(*,1002) y
+ write(*,1002) y
1002 format(/'Codeword:'/(20i3))
- write(*,1003) itone
+ write(*,1003) itone
1003 format(/'Channel symbols:'/(20i3))
+ endif
baud=12000.d0/nsps !Keying rate (6.67 baud fot 15-s sequences)
h=default_header(12000,npts)
@@ -116,43 +137,54 @@ program q65sim open(10,file=trim(fname),access='stream',status='unknown')
xnoise=0.
- cdat=0.
if(snrdb.lt.90) then
do i=1,npts
xnoise(i)=gran() !Generate gaussian noise
enddo
endif
+ cdat=0.
bandwidth_ratio=2500.0/6000.0
sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*snrdb)
if(snrdb.gt.90.0) sig=1.0
- write(*,1020) ifile,ntrperiod,f0,csubmode,snrdb,fspread,xdt,f1,nstp,trim(msgsent)
-1020 format(i4,i6,f7.1,2x,a1,2x,f5.1,1x,f6.2,2f6.1,i4,2x,a)
- phi=0.d0
- dphi=0.d0
- k=(xdt+0.5)*12000 !Start audio at t=xdt+0.5 s (TR=15 and 30 s)
- if(ntrperiod.ge.60) k=(xdt+1.0)*12000 !TR 60+ at t = xdt + 1.0 s
- isym0=-99
- do i=1,npts !Add this signal into cdat()
- isym=i/nsps + 1
- if(isym.gt.nsym) exit
- if(isym.ne.isym0) then
- freq_drift=f1*i*dt/60.0
- if(nstp.ne.0) freq_drift=freq_drift - nstp*nint(freq_drift/nstp)
- if (msg(1:2).eq.'ST') then
- freq = f0 + freq_drift
- else
- freq = f0 + freq_drift + itone(isym)*baud*mode65
- endif
- dphi=twopi*freq*dt
- isym0=isym
+ write(*,1020) ifile,ntrperiod,f00,csubmode,snrdb,fspread,xdt,f1,nstp,trim(msgsent)
+1020 format(i4,i6,f7.1,2x,a1,2x,f5.1,1x,f6.2,2f6.1,i4,2x,a)
+
+ n=65.0*baud*mode65/100.0 + 0.9999
+ nfstep=100*n
+ nf1=1500 - nfstep*(nsig-1)/2
+ do n=1,nsig
+ f0=f00
+ if(nsig.ge.2) then
+ f0=nf1 + (n-1)*nfstep
+ itone=ntone(:,n)
endif
- phi=phi + dphi
- if(phi.gt.twopi) phi=phi-twopi
- xphi=phi
- z=cmplx(cos(xphi),sin(xphi))
- k=k+1
- if(k.ge.1) cdat(k)=cdat(k) + sig*z
+ phi=0.d0
+ dphi=0.d0
+ k=(xdt+0.5)*12000 !Start audio at t=xdt+0.5 s (TR=15 and 30 s)
+ if(ntrperiod.ge.60) k=(xdt+1.0)*12000 !TR 60+ at t = xdt + 1.0 s
+ isym0=-99
+ do i=1,npts !Add this signal into cdat()
+ isym=i/nsps + 1
+ if(isym.gt.nsym) exit
+ if(isym.ne.isym0) then
+ freq_drift=f1*i*dt/60.0
+ if(nstp.ne.0) freq_drift=freq_drift - nstp*nint(freq_drift/nstp)
+ if (msg(1:2).eq.'ST') then
+ freq = f0 + freq_drift
+ else
+ freq = f0 + freq_drift + itone(isym)*baud*mode65
+ endif
+ dphi=twopi*freq*dt
+ isym0=isym
+ endif
+ phi=phi + dphi
+ if(phi.gt.twopi) phi=phi-twopi
+ xphi=phi
+ z=cmplx(cos(xphi),sin(xphi))
+ k=k+1
+ if(k.ge.1) cdat(k)=cdat(k) + sig*z
+ enddo
enddo
if(fspread.ne.0) then !Apply specified Doppler spread
diff --git a/lib/sumsim.f90 b/lib/sumsim.f90 index f07d2ec3..24cca29a 100755 --- a/lib/sumsim.f90 +++ b/lib/sumsim.f90 @@ -35,7 +35,7 @@ program sumsim fac=1.0/nargs
iwave(1:npts)=nint(fac*wave(1:npts))
- open(12,file='000000_0000.wav',access='stream',status='unknown')
+ open(12,file='000001_0000.wav',access='stream',status='unknown')
write(12) h,iwave(1:npts)
close(12)
diff --git a/lib/test_qra64.f90 b/lib/test_qra64.f90 deleted file mode 100755 index eb6543cb..00000000 --- a/lib/test_qra64.f90 +++ /dev/null @@ -1,129 +0,0 @@ -program test_qra64
-
- character*71 cmd1,cmd2,line
- character*22 msg
- character*8 arg
- character*1 csubmode
- integer nretcode(0:11)
- logical decok
-
- nargs=iargc()
- if(nargs.ne.9) then
- print*,'Usage: test_qra64 "msg" A-D depth freq DT fDop TRp nfiles SNR'
- print*,'Example: test_qra64 "K1ABC W9XYZ EN37" A 3 1000 0.0 5.0 60 100 -20'
- print*,' SNR = 0 to loop over all relevant SNRs'
- go to 999
- endif
- call getarg(1,msg)
- call getarg(2,csubmode)
- call getarg(3,arg)
- read(arg,*) ndepth
- call getarg(4,arg)
- read(arg,*) nf0
- call getarg(5,arg)
- read(arg,*) dt
- call getarg(6,arg)
- read(arg,*) fDop
- call getarg(7,arg)
- read(arg,*) ntrperiod
- call getarg(8,arg)
- read(arg,*) nfiles
- call getarg(9,arg)
- read(arg,*) nsnr
-
- nsps=6192
- i50=-28
- ia=-20
- ib=-33
- if(nsnr.ne.0) then
- ia=nsnr
- ib=nsnr
- endif
-
- baud=12000.0/nsps
- tsym=1.0/baud
-
-! 1 2 3 4 5 6 7
-! 12345678901234567890123456789012345678901234567890123456789012345678901'
- cmd1='qra64sim "K1ABC W9XYZ EN37 " A 1 0.2 0.00 100 F -20 > junk0'
-
- cmd2='jt9 -q -L 300 -H 3000 -f 1000 -d 3 -b A *.wav > junk'
-
- write(cmd1(10:33),'(a)') '"'//msg//'"'
- cmd1(35:35)=csubmode
- write(cmd1(40:43),'(f4.1)') fDop
- write(cmd1(44:48),'(f5.2)') dt
- write(cmd1(49:53),'(i5)') nfiles
-
- write(cmd2(26:29),'(i4)') nf0
- write(cmd2(34:34),'(i1)') ndepth
- cmd2(39:39)=csubmode
-
- call system('rm -f *.wav')
-
- write(*,1000) (j,j=0,11)
- write(12,1000) (j,j=0,11)
-1000 format(/'SNR d Dop Sync Dec Bad',i6,11i4,' tdec'/80('-'))
-
- dterr=tsym/4.0
- nferr=max(1,nint(0.5*baud),nint(fdop/3.0))
- ndecodes0=nfiles
-
- do nsnr=ia,ib,-1
- nsync=0
- ndecodes=0
- nfalse=0
- nretcode=0
- write(cmd1(57:59),'(i3)') nsnr
- call system(cmd1)
- call sec0(0,tdec)
- call system(cmd2)
- call sec0(1,tdec)
- open(10,file='junk',status='unknown')
- n=0
- do iline=1,9999
- read(10,'(a71)',end=10) line
- if(index(line,'<Decode').eq.1) cycle
- read(line(11:20),*) xdt,nf
- irc=-1
- if(line(23:23).ne.' ') read(line(45:46),*) irc
- decok=index(line,'W9XYZ').gt.0
- if((abs(xdt-dt).le.dterr .and. abs(nf-nf0).le.nferr) .or. decok) then
- nsync=nsync+1
- endif
- if(irc.lt.0) cycle
- if(decok) then
- i=irc
- if(i.le.11) then
- ndecodes=ndecodes + 1
- else
- i=mod(i,10)
- endif
- nretcode(i)=nretcode(i) + 1
- else
- nfalse=nfalse + 1
- print*,'False: ',line
- endif
- enddo ! iline
-10 close(10)
- write(*,1100) nsnr,ndepth,fDop,nsync,ndecodes,nfalse,nretcode, &
- tdec/nfiles
- write(12,1100) nsnr,ndepth,fDop,nsync,ndecodes,nfalse,nretcode, &
- tdec/nfiles
-1100 format(i3,i2,f5.1,2i5,i4,i6,11i4,f6.2)
- if(ndecodes.lt.nfiles/2 .and. ndecodes0.ge.nfiles/2) then
- snr_thresh=nsnr + float(nfiles/2 - ndecodes)/(ndecodes0-ndecodes)
- write(13,1200) ndepth,fdop,csubmode,snr_thresh
-1200 format(i1,f6.1,2x,a1,f7.1)
- flush(13)
- endif
- flush(6)
- flush(12)
- if(ndecodes.eq.0) exit !Bail out if no decodes at this SNR
- ndecodes0=ndecodes
- enddo ! nsnr
-
-999 end program test_qra64
-
- include 'sec0.f90'
-
diff --git a/lib/types.f90 b/lib/types.f90 index 88fb1cfe..456938b4 100755 --- a/lib/types.f90 +++ b/lib/types.f90 @@ -7,4 +7,12 @@ module types integer, parameter :: dp = REAL64
integer, parameter :: qp = REAL128
+ type q3list
+ character*6 call
+ character*4 grid
+ integer nsec
+ integer nfreq
+ integer moonel
+ end type q3list
+
end module types
diff --git a/lib/wsprd/wsprd.c b/lib/wsprd/wsprd.c index e0109da8..0f6e903e 100755 --- a/lib/wsprd/wsprd.c +++ b/lib/wsprd/wsprd.c @@ -1165,7 +1165,7 @@ int main(int argc, char *argv[]) for (k=0; k<162; k++) { //Sum over symbols
ifd=ifr+((float)k-81.0)/81.0*( (float)idrift )/(2.0*df);
kindex=k0+2*k;
- if( kindex < nffts ) {
+ if( kindex >= 0 && kindex < nffts ) {
p0=ps[ifd-3][kindex];
p1=ps[ifd-1][kindex];
p2=ps[ifd+1][kindex];
|
