From 4e0f1103b60a06ecfb306d30a715b69e0e43d460 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Fri, 17 Jul 2020 23:44:14 +0100 Subject: [PATCH] 15 and 30 minute T/R periods for FST240 & FST240W --- lib/fst240/fst240sim.f90 | 13 +++++++------ lib/fst240_decode.f90 | 28 ++++++++++++++++------------ lib/ft8/foxgen.f90 | 3 ++- lib/ft8/foxgen_wrap.f90 | 2 +- widgets/mainwindow.cpp | 10 ++++++++-- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/lib/fst240/fst240sim.f90 b/lib/fst240/fst240sim.f90 index 338c7c6ba..f687036b0 100644 --- a/lib/fst240/fst240sim.f90 +++ b/lib/fst240/fst240sim.f90 @@ -67,9 +67,10 @@ program fst240sim nz=nsps*NN txt=nz*dt !Transmission length (s) tt=nsps*dt !Duration of symbols (s) - allocate( c0(0:nmax-1) ) - allocate( c(0:nmax-1) ) - allocate( wave(nmax) ) + nwave=max(nmax,(NN+2)*nsps) + allocate( c0(0:nwave-1) ) + allocate( c(0:nwave-1) ) + allocate( wave(nwave) ) allocate( iwave(nmax) ) bandwidth_ratio=2500.0/(fs/2.0) @@ -108,7 +109,7 @@ program fst240sim fsample=12000.0 icmplx=1 f0=f00+1.5*hmod*baud - call gen_fst240wave(itone,NN,nsps,nmax,fsample,hmod,f0,icmplx,c0,wave) + call gen_fst240wave(itone,NN,nsps,nwave,fsample,hmod,f0,icmplx,c0,wave) k=nint((xdt+1.0)/dt) if(nsec.eq.15) k=nint((xdt+0.5)/dt) c0=cshift(c0,-k) @@ -117,7 +118,7 @@ program fst240sim do ifile=1,nfiles c=c0 - if(fspread.ne.0.0 .or. delay.ne.0.0) call watterson(c,nmax,NZ,fs,delay,fspread) + if(fspread.ne.0.0 .or. delay.ne.0.0) call watterson(c,nwave,NZ,fs,delay,fspread) c=sig*c wave=real(c) if(snrdb.lt.90) then @@ -135,7 +136,7 @@ program fst240sim wave=fac*wave endif if(any(abs(wave).gt.32767.0)) print*,"Warning - data will be clipped." - iwave=nint(wave) + iwave=nint(wave(:size(iwave))) h=default_header(12000,nmax) if(nmax/12000.le.30) then write(fname,1102) ifile diff --git a/lib/fst240_decode.f90 b/lib/fst240_decode.f90 index 5976f63ad..f6f8824e2 100644 --- a/lib/fst240_decode.f90 +++ b/lib/fst240_decode.f90 @@ -68,7 +68,7 @@ contains logical badsync,unpk77_success,single_decode logical first,nohiscall,lwspr,ex - integer*2 iwave(300*12000) + integer*2 iwave(30*60*12000) data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/ data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/ @@ -748,8 +748,8 @@ contains integer hmod !Modulation index (submode) integer im(1) !For maxloc real candidates(100,4) !Candidate list - real s(18000) !Low resolution power spectrum - real s2(18000) !CCF of s() with 4 tones + real, allocatable :: s(:) !Low resolution power spectrum + real, allocatable :: s2(:) !CCF of s() with 4 tones real xdb(-3:3) !Model 4-tone CCF peaks real minsync data xdb/0.25,0.50,0.75,1.0,0.75,0.50,0.25/ @@ -776,6 +776,8 @@ contains inb=nint(fh) endif + nnw=nint(48000.*nsps*2./fs) + allocate (s(nnw)) s=0. !Compute low-resloution power spectrum do i=ina,inb ! noise analysis window includes signal analysis window j0=nint(i*df2/df1) @@ -785,7 +787,8 @@ contains enddo ina=max(ina,1+3*hmod) !Don't run off the ends - inb=min(inb,18000-3*hmod) + inb=min(inb,nnw-3*hmod) + allocate (s2(nnw)) s2=0. do i=ina,inb !Compute CCF of s() and 4 tones s2(i)=s(i-hmod*3) + s(i-hmod) +s(i+hmod) +s(i+hmod*3) @@ -796,7 +799,7 @@ contains ncand=0 candidates=0 if(ia.lt.3) ia=3 - if(ib.gt.18000-2) ib=18000-2 + if(ib.gt.nnw-2) ib=nnw-2 ! Find candidates, using the CLEAN algorithm to remove a model of each one ! from s2() after it has been found. @@ -824,6 +827,7 @@ contains ! On "plotspec" special request, compute Doppler spread for a decoded signal + include 'fst240/fst240_params.f90' complex, allocatable :: cwave(:) !Reconstructed complex signal complex, allocatable :: g(:) !Channel gain, g(t) in QEX paper real,allocatable :: ss(:) !Computed power spectrum of g(t) @@ -835,15 +839,15 @@ contains ncall=ncall+1 nfft=2*nmax - allocate(cwave(0:nmax-1)) + nwave=max(nmax,(NN+2)*nsps) + allocate(cwave(0:nwave-1)) allocate(g(0:nfft-1)) wave=0 fsample=12000.0 - nsym=160 - call gen_fst240wave(itone,nsym,nsps,nmax,fsample,hmod,fc,1,cwave,wave) + call gen_fst240wave(itone,NN,nsps,nwave,fsample,hmod,fc,1,cwave,wave) cwave=cshift(cwave,-i0*ndown) fac=1.0/32768 - g(0:nmax-1)=fac*float(iwave)*conjg(cwave) + g(0:nmax-1)=fac*float(iwave)*conjg(cwave(:nmax-1)) g(nmax:)=0. call four2a(g,nfft,1,-1,1) !Forward c2c FFT @@ -861,7 +865,7 @@ contains allocate(ss(-ia:ia)) !Allocate space for +/- 10 Hz sum1=0. sum2=0. - ns=0 + nns=0 do i=-ia,ia j=i if(j.lt.0) j=i+nfft @@ -869,12 +873,12 @@ contains f=i*df if(f.ge.-4.0 .and. f.le.-2.0) then sum1=sum1 + ss(i) !Power between -2 and -4 Hz - ns=ns+1 + nns=nns+1 else if(f.ge.2.0 .and. f.le.4.0) then sum2=sum2 + ss(i) !Power between +2 and +4 Hz endif enddo - avg=min(sum1/ns,sum2/ns) !Compute avg from smaller sum + avg=min(sum1/nns,sum2/nns) !Compute avg from smaller sum sum1=0. do i=-ia,ia diff --git a/lib/ft8/foxgen.f90 b/lib/ft8/foxgen.f90 index 703da0ef9..5aa114ac4 100644 --- a/lib/ft8/foxgen.f90 +++ b/lib/ft8/foxgen.f90 @@ -15,7 +15,8 @@ subroutine foxgen() ! common block. parameter (NN=79,ND=58,NSPS=4*1920) - parameter (NWAVE=14278656,NFFT=614400,NH=NFFT/2) + parameter (NWAVE=(160+2)*134400) !the biggest waveform we generate (FST240-1800) + parameter (NFFT=614400,NH=NFFT/2) character*40 cmsg character*37 msg,msgsent integer itone(79) diff --git a/lib/ft8/foxgen_wrap.f90 b/lib/ft8/foxgen_wrap.f90 index bc8c430f7..eb489cccc 100644 --- a/lib/ft8/foxgen_wrap.f90 +++ b/lib/ft8/foxgen_wrap.f90 @@ -1,7 +1,7 @@ subroutine foxgen_wrap(msg40,msgbits,itone) parameter (NN=79,ND=58,KK=77,NSPS=4*1920) - parameter (NWAVE=NN*NSPS) + parameter (NWAVE=(160+2)*134400) !the biggest waveform we generate (FST240-1800) character*40 msg40,cmsg character*12 mycall12 diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 2487e7a46..b315c013b 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -428,7 +428,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->dxGridEntry->setValidator (new MaidenheadLocatorValidator {this}); ui->dxCallEntry->setValidator (new CallsignValidator {this}); ui->sbTR->values ({5, 10, 15, 30, 60, 120, 300}); - ui->sbTR_FST240W->values ({15, 30, 60, 120, 300}); + ui->sbTR_FST240W->values ({15, 30, 60, 120, 300, 900, 1800}); ui->decodedTextBrowser->set_configuration (&m_config, true); ui->decodedTextBrowser2->set_configuration (&m_config); @@ -3556,6 +3556,8 @@ void MainWindow::guiUpdate() if(m_TRperiod==60) txDuration=1.0 + 160*3888/12000.0; if(m_TRperiod==120) txDuration=1.0 + 160*8200/12000.0; if(m_TRperiod==300) txDuration=1.0 + 160*21504/12000.0; + if(m_TRperiod==900) txDuration=1.0 + 160*66560/12000.0; + if(m_TRperiod==1800) txDuration=1.0 + 160*134400/12000.0; } if(m_modeTx=="ISCAT" or m_mode=="MSK144" or m_bFast9) { txDuration=m_TRperiod-0.25; // ISCAT, JT9-fast, MSK144 @@ -3888,6 +3890,8 @@ void MainWindow::guiUpdate() if(m_TRperiod==60) nsps=3888; if(m_TRperiod==120) nsps=8200; if(m_TRperiod==300) nsps=21504; + if(m_TRperiod==900) nsps=66560; + if(m_TRperiod==1800) nsps=134400; nsps=4*nsps; //48000 Hz sampling int nsym=160; float fsample=48000.0; @@ -5838,7 +5842,7 @@ void MainWindow::on_actionFST240_triggered() // 0123456789012345678901234567890123 displayWidgets(nWidgets("1111110001001111000100000001000000")); setup_status_bar (bVHF); - ui->sbTR->values ({15, 30, 60, 120, 300}); + ui->sbTR->values ({15, 30, 60, 120, 300, 900, 1800}); on_sbTR_valueChanged (ui->sbTR->value()); ui->cbAutoSeq->setChecked(true); m_wideGraph->setMode(m_mode); @@ -7183,6 +7187,8 @@ void MainWindow::transmit (double snr) if(m_TRperiod==60) nsps=3888; if(m_TRperiod==120) nsps=8200; if(m_TRperiod==300) nsps=21504; + if(m_TRperiod==900) nsps=66560; + if(m_TRperiod==1800) nsps=134400; int hmod=int(pow(2.0,double(m_nSubMode))); double dfreq=hmod*12000.0/nsps; double f0=ui->WSPRfreqSpinBox->value() - m_XIT + 1.5*dfreq;