From 1cebbd2cdde79b8c01e3571ced623188fd78f8df Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 17 Jun 2020 19:28:44 -0400 Subject: [PATCH] Enable decoding of FST280 for other T/R sequence lengths. Needs testing! --- lib/jt9.f90 | 35 ++++++++++++++--------------------- lib/symspec.f90 | 7 ++++--- widgets/mainwindow.cpp | 5 ++--- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/lib/jt9.f90 b/lib/jt9.f90 index e2ced6542..3c5a3f9c2 100644 --- a/lib/jt9.f90 +++ b/lib/jt9.f90 @@ -17,19 +17,20 @@ program jt9 integer(C_INT) iret type(wav_header) wav real*4 s(NSMAX) + real*8 TRperiod character c character(len=500) optarg, infile character wisfile*80 !### ndepth was defined as 60001. Why??? integer :: arglen,stat,offset,remain,mode=0,flow=200,fsplit=2700, & - fhigh=4000,nrxfreq=1500,ntrperiod=1,ndepth=1,nexp_decode=0 + fhigh=4000,nrxfreq=1500,ndepth=1,nexp_decode=0 logical :: read_files = .true., tx9 = .false., display_help = .false., & bLowSidelobes = .false. type (option) :: long_options(27) = [ & 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 MINUTES=1', & - 'MINUTES'), & + option ('tr-period', .true., 'p', 'Tx/Rx period, default SECONDS=60', & + 'SECONDS'), & option ('executable-path', .true., 'e', & 'Location of subordinate executables (KVASD) default PATH="."', & 'PATH'), & @@ -78,6 +79,7 @@ program jt9 data npatience/1/,nthreads/1/ nsubmode = 0 + TRperiod=60.d0 do call getopt('hs:e:a:b:r:m:p:d:f:w:t:987654qTL:S:H:c:G:x:g:X:', & @@ -102,7 +104,7 @@ program jt9 case ('m') read (optarg(:arglen), *) nthreads case ('p') - read (optarg(:arglen), *) ntrperiod + read (optarg(:arglen), *) TRperiod case ('d') read (optarg(:arglen), *) ndepth case ('f') @@ -200,29 +202,20 @@ program jt9 go to 2 1 nutc=0 2 nsps=0 - if(ntrperiod.eq.1) then + if(TRperiod.eq.60.d0) then nsps=6912 shared_data%params%nzhsym=181 - else if(ntrperiod.eq.2) then - nsps=15360 - shared_data%params%nzhsym=178 - else if(ntrperiod.eq.5) then - nsps=40960 - shared_data%params%nzhsym=172 - else if(ntrperiod.eq.10) then - nsps=82944 - shared_data%params%nzhsym=171 - else if(ntrperiod.eq.30) then - nsps=252000 - shared_data%params%nzhsym=167 + endif + if(mode.eq.280) then + nsps=6912 + npts=TRperiod*12000.d0 endif if(nsps.eq.0) stop 'Error: bad TRperiod' kstep=nsps/2 k=0 nhsym0=-999 - npts=(60*ntrperiod-6)*12000 - if(mode.eq.280) npts=60*ntrperiod*12000 + npts=(TRperiod-6.d0)*12000.d0 if(iarg .eq. offset + 1) then call init_timer (trim(data_dir)//'/timer.out') call timer('jt9 ',0) @@ -246,8 +239,8 @@ program jt9 ingain=0 call timer('symspec ',0) nminw=1 - call symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes,nminw,pxdb, & - s,df3,ihsym,npts8,pxdbmax) + call symspec(shared_data,k,Tperiod,nsps,ingain, & + bLowSidelobes,nminw,pxdb,s,df3,ihsym,npts8,pxdbmax) call timer('symspec ',1) endif nhsym0=nhsym diff --git a/lib/symspec.f90 b/lib/symspec.f90 index b9f5e2088..f97757778 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -1,9 +1,9 @@ -subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes, & +subroutine symspec(shared_data,k,TRperiod,nsps,ingain,bLowSidelobes, & nminw,pxdb,s,df3,ihsym,npts8,pxdbmax) ! Input: ! k pointer to the most recent new data -! ntrperiod T/R sequence length, minutes +! TRperiod T/R sequence length, seconds ! nsps samples per symbol, at 12000 Hz ! bLowSidelobes true to use windowed FFTs ! ndiskdat 0/1 to indicate if data from disk @@ -23,6 +23,7 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes, & include 'jt9com.f90' type(dec_data) :: shared_data + real*8 TRperiod real*4 w3(MAXFFT3) real*4 s(NSMAX) real*4 ssum(NSMAX) @@ -38,7 +39,7 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,bLowSidelobes, & equivalence (xc,cx) save - if(ntrperiod.eq.-999) stop !Silence compiler warning + if(TRperiod.lt.0.d0) stop !Silence compiler warning nfft3=16384 !df=12000.0/16384 = 0.732422 jstep=nsps/2 !Step size = half-symbol in id2() if(k.gt.NMAX) go to 900 diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index c56ccaaf5..4fdc12850 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -89,7 +89,7 @@ extern "C" { //----------------------------------------------------- C and Fortran routines - void symspec_(struct dec_data *, int* k, int* ntrperiod, int* nsps, int* ingain, + void symspec_(struct dec_data *, int* k, double* trperiod, int* nsps, int* ingain, bool* bLowSidelobes, int* minw, float* px, float s[], float* df3, int* nhsym, int* npts8, float *m_pxmax); @@ -1373,14 +1373,13 @@ void MainWindow::dataSink(qint64 frames) } // Get power, spectrum, and ihsym - int trmin=m_TRperiod/60.0; dec_data.params.nfa=m_wideGraph->nStartFreq(); dec_data.params.nfb=m_wideGraph->Fmax(); int nsps=m_nsps; if(m_bFastMode) nsps=6912; int nsmo=m_wideGraph->smoothYellow()-1; bool bLowSidelobes=m_config.lowSidelobes(); - symspec_(&dec_data,&k,&trmin,&nsps,&m_inGain,&bLowSidelobes,&nsmo,&m_px,s, + symspec_(&dec_data,&k,&m_TRperiod,&nsps,&m_inGain,&bLowSidelobes,&nsmo,&m_px,s, &m_df3,&m_ihsym,&m_npts8,&m_pxmax); if(m_mode=="WSPR") wspr_downsample_(dec_data.d2,&k); if(m_ihsym <=0) return;