diff options
| author | Christoph Berg <myon@debian.org> | 2020-11-16 21:54:50 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2020-11-16 21:54:50 +0100 |
| commit | 77922fa33547ce24535f2e514c9a112dcb496f18 (patch) | |
| tree | 9f82b0ee01281b315f43a4c60d678927b4c6ca59 /lib | |
| parent | 7aa3c56b01768ba7d38fccedc17b30a4046b3fbb (diff) | |
New upstream version 2.3.0~rc2+repackupstream/2.3.0_rc2+repack
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/fst4_decode.f90 | 6 | ||||
| -rw-r--r-- | lib/ft8/foxgen_wrap.f90 | 2 | ||||
| -rw-r--r-- | lib/jt9.f90 | 32 | ||||
| -rw-r--r-- | lib/msk144sync.f90 | 2 | ||||
| -rw-r--r-- | lib/wsprd/wspr_params.f90 | 20 | ||||
| -rw-r--r-- | lib/wsprd/wspr_wav.f90 | 49 | ||||
| -rw-r--r-- | lib/wsprd/wsprsimf.f90 | 113 |
7 files changed, 213 insertions, 11 deletions
diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index e97d8f09..ba49fb54 100644 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -227,7 +227,7 @@ contains ndropmax=1 single_decode=iand(nexp_decode,32).ne.0 npct=0 - nb=nexp_decode/256 - 2 + nb=nexp_decode/256 - 3 if(nb.ge.0) npct=nb inb1=20 inb2=5 @@ -235,6 +235,8 @@ contains inb2=5 !Try NB = 0, 5, 10, 15, 20% else if(nb.eq.-2) then inb2=2 !Try NB = 0, 2, 4,... 20% + else if(nb.eq.-3) then + inb2=1 !Try NB = 0, 1, 2,... 20% else inb1=0 !Fixed NB value, 0 to 25% ipct(0)=npct @@ -900,6 +902,6 @@ contains enddo return - end subroutine dopspread + end subroutine dopspread end module fst4_decode diff --git a/lib/ft8/foxgen_wrap.f90 b/lib/ft8/foxgen_wrap.f90 index fec9f37c..82510760 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=(160+2)*134400) !the biggest waveform we generate (FST4-1800)
+ parameter (NWAVE=(160+2)*134400*4) !the biggest waveform we generate (FST4-1800)
character*40 msg40,cmsg
character*12 mycall12
diff --git a/lib/jt9.f90 b/lib/jt9.f90 index a08a20cb..77ad5b9f 100644 --- a/lib/jt9.f90 +++ b/lib/jt9.f90 @@ -25,11 +25,11 @@ program jt9 integer :: arglen,stat,offset,remain,mode=0,flow=200,fsplit=2700, & fhigh=4000,nrxfreq=1500,ndepth=1,nexp_decode=0,nQSOProg=0 logical :: read_files = .true., tx9 = .false., display_help = .false., & - bLowSidelobes = .false. - type (option) :: long_options(29) = [ & + bLowSidelobes = .false., nexp_decode_set = .false. + type (option) :: long_options(30) = [ & 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', & + option ('tr-period', .true., 'p', 'Tx/Rx period, default SECONDS=60', & 'SECONDS'), & option ('executable-path', .true., 'e', & 'Location of subordinate executables (KVASD) default PATH="."', & @@ -46,6 +46,8 @@ program jt9 'Lowest JT9 frequency decoded, default HERTZ=2700', 'HERTZ'), & option ('rx-frequency', .true., 'f', & 'Receive frequency offset, default HERTZ=1500', 'HERTZ'), & + option ('freq-tolerance', .true., 'F', & + 'Receive frequency tolerance, default HERTZ=20', 'HERTZ'), & option ('patience', .true., 'w', & 'FFTW3 planing patience (0-4), default PATIENCE=1', 'PATIENCE'), & option ('fft-threads', .true., 'm', & @@ -54,8 +56,8 @@ program jt9 option ('jt4', .false., '4', 'JT4 mode', ''), & option ('ft4', .false., '5', 'FT4 mode', ''), & option ('jt65', .false.,'6', 'JT65 mode', ''), & - option ('fst4', .false., '7', 'FST4 mode', ''), & - option ('fst4w', .false., 'W', 'FST4W mode', ''), & + option ('fst4', .false., '7', 'FST4 mode', ''), & + option ('fst4w', .false., 'W', 'FST4W mode', ''), & option ('ft8', .false., '8', 'FT8 mode', ''), & option ('jt9', .false., '9', 'JT9 mode', ''), & option ('qra64', .false., 'q', 'QRA64 mode', ''), & @@ -83,10 +85,11 @@ program jt9 iwspr=0 nsubmode = 0 + ntol = 20 TRperiod=60.d0 do - call getopt('hs:e:a:b:r:m:p:d:f:w:t:987654WqTL:S:H:c:G:x:g:X:Q:', & + call getopt('hs:e:a:b:r:m:p:d:f:F:w:t:987654WqTL:S:H:c:G:x:g:X:Q:', & long_options,c,optarg,arglen,stat,offset,remain,.true.) if (stat .ne. 0) then exit @@ -113,6 +116,8 @@ program jt9 read (optarg(:arglen), *) ndepth case ('f') read (optarg(:arglen), *) nrxfreq + case ('F') + read (optarg(:arglen), *) ntol case ('L') read (optarg(:arglen), *) flow case ('S') @@ -153,6 +158,7 @@ program jt9 read (optarg(:arglen), *) hisgrid case ('X') read (optarg(:arglen), *) nexp_decode + nexp_decode_set = .true. end select end do @@ -195,6 +201,18 @@ program jt9 go to 999 endif + if (mode .eq. 241) then + ntol = min (ntol, 100) + else if (mode .eq. 65 + 9) then + ntol = 20 + else + ntol = min (ntol, 1000) + end if + if (.not. nexp_decode_set) then + if (mode .eq. 240 .or. mode .eq. 241) then + nexp_decode = 3 * 256 ! single decode off and nb=0 + end if + end if allocate(shared_data) nflatten=0 do iarg = offset + 1, offset + remain @@ -258,7 +276,7 @@ program jt9 shared_data%params%nfa=flow shared_data%params%nfsplit=fsplit shared_data%params%nfb=fhigh - shared_data%params%ntol=20 + shared_data%params%ntol=ntol shared_data%params%kin=64800 if(mode.eq.240) shared_data%params%kin=720000 !### 60 s periods ### shared_data%params%nzhsym=nhsym diff --git a/lib/msk144sync.f90 b/lib/msk144sync.f90 index dfae9a21..cfcd8c92 100644 --- a/lib/msk144sync.f90 +++ b/lib/msk144sync.f90 @@ -57,7 +57,7 @@ subroutine msk144sync(cdat,nframes,ntol,delf,navmask,npeaks,fc,fest, & xm=0.0 bf=0.0 nthreads=1 -!$ nthreads=min(8,int(OMP_GET_MAX_THREADS(),4)) +!$ nthreads=min(4,int(OMP_GET_MAX_THREADS(),4)) nstep=nfreqs/nthreads !$OMP PARALLEL NUM_THREADS(nthreads) PRIVATE(id,if1,if2) diff --git a/lib/wsprd/wspr_params.f90 b/lib/wsprd/wspr_params.f90 new file mode 100644 index 00000000..ebfc4cf7 --- /dev/null +++ b/lib/wsprd/wspr_params.f90 @@ -0,0 +1,20 @@ +parameter (NN=162) +parameter (NSPS0=8192) !Samples per symbol at 12000 S/s +parameter (NDOWN=32) +parameter (NSPS=NSPS0/NDOWN) +parameter (NZ=NSPS*NN) !Samples in waveform at 12000 S/s +parameter (NZ0=NSPS0*NN) !Samples in waveform at 375 S/s +parameter (NMAX=120*12000) !Samples in waveform at 375 S/s + +! Define the sync vector: +integer*1 sync(162) +data sync/ & + 1,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0, & + 0,1,0,1,1,1,1,0,0,0,0,0,0,0,1,0,0,1,0,1, & + 0,0,0,0,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1, & + 1,0,1,0,0,0,0,1,1,0,1,0,1,0,1,0,1,0,0,1, & + 0,0,1,0,1,1,0,0,0,1,1,0,1,0,1,0,0,0,1,0, & + 0,0,0,0,1,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1, & + 0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,1,0,0,1,1, & + 0,0,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,1,1,0, & + 0,0/ diff --git a/lib/wsprd/wspr_wav.f90 b/lib/wsprd/wspr_wav.f90 new file mode 100644 index 00000000..99ba70c5 --- /dev/null +++ b/lib/wsprd/wspr_wav.f90 @@ -0,0 +1,49 @@ +subroutine wspr_wav(baud,xdt,h,f0,itone,snrdb,iwave) + +! Generate iwave() from itone(). + + include 'wspr_params.f90' + integer itone(NN) + integer*2 iwave(NMAX) + real*8 twopi,dt,dphi0,dphi1,dphi,phi + real dat(NMAX) + + twopi=8.d0*atan(1.d0) + dt=1.d0/12000.d0 + baud=375.0/256.0 + + dat=0. + if(snrdb.lt.90) then + do i=1,NMAX + dat(i)=gran() !Generate gaussian noise + enddo + bandwidth_ratio=2500.0/6000.0 + sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*snrdb) + else + sig=1.0 + endif + + phi=0.d0 + k=nint(xdt/dt) + do j=1,NN + dphi=twopi*(f0+h*(itone(j)-1.5)*baud)*dt + do i=1,NSPS0 + k=k+1 + phi=mod(phi+dphi,twopi) + if(k.gt.0 .and. k.le.NMAX) dat(k)=dat(k) + sig*sin(phi) + enddo + enddo + + rms=100.0 + if(snrdb.lt.90.0) then + dat=rms*dat; + if(maxval(abs(dat)).gt.32767.0) print*,"Warning - data will be clipped." + else + datpk=maxval(abs(dat)) + fac=32767.9/datpk + dat=fac*dat + endif + iwave=nint(dat) + + return +end subroutine wspr_wav diff --git a/lib/wsprd/wsprsimf.f90 b/lib/wsprd/wsprsimf.f90 new file mode 100644 index 00000000..d6ee25d4 --- /dev/null +++ b/lib/wsprd/wsprsimf.f90 @@ -0,0 +1,113 @@ +!------------------------------------------------------------------------------- +! +! This file is part of the WSPR application, Weak Signal Propagation Reporter +! +!------------------------------------------------------------------------------- + +program wsprsim + + use wavhdr + include 'wspr_params.f90' + type(hdr) hwav + character arg*12,fname14*14,fname15*15 + character*22 msg,msgsent + complex c0(0:NMAX/NDOWN-1) + complex c(0:NMAX/NDOWN-1) + integer itone(NN) + integer*2 iwave(NMAX) + real*8 fMHz + +! Get command-line argument(s) + nargs=iargc() + if(nargs.ne.8) then + print*,'Usage: wsprsim "message" f0 DT fsp del nwav nfiles snr' + print*,'Example: wsprsim "K1ABC FN42 30" 50 0.0 0.1 1.0 1 10 -33' + go to 999 + endif + call getarg(1,msg) !Message to be transmitted + call getarg(2,arg) + read(arg,*) f0 !Freq relative to WSPR-band center (Hz) + 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) + call getarg(6,arg) + read(arg,*) nwav !1 for *.wav file, 0 for *.c2 file + call getarg(7,arg) + read(arg,*) nfiles !Number of files + call getarg(8,arg) + read(arg,*) snrdb !SNR_2500 + + twopi=8.0*atan(1.0) + fs=12000.0/NDOWN + dt=1.0/fs + tt=NSPS*dt + baud=12000.0/8192.0 + + txt=NZ*dt !Transmission length (s) + bandwidth_ratio=2500.0/(fs/2.0) + sig=sqrt(bandwidth_ratio) * 10.0**(0.05*snrdb) + if(snrdb.gt.90.0) sig=1.0 + txt=NN*NSPS0/12000.0 + + call genwspr(msg,msgsent,itone) !Encode the message, get itone + + write(*,1000) f0,xdt,txt,snrdb,fspread,delay,nfiles,msgsent +1000 format('f0:',f9.3,' DT:',f6.2,' txt:',f6.1,' SNR:',f6.1, & + ' fspread:',f6.1,' delay:',f6.1,' nfiles:',i3,2x,a22) +! write(*,*) "Channel symbols: " +! write(*,'(162i2)') itone + + h=1.0 + phi=0.0 + c0=0. + k=-1 + nint(xdt/dt) + do j=1,NN + dphi=-twopi*(f0+h*(itone(j)-1.5)*baud)*dt + do i=1,NSPS + k=k+1 + phi=mod(phi+dphi,twopi) + if(k.ge.0 .and. k.lt.NMAX/NDOWN) c0(k)=cmplx(cos(phi),sin(phi)) + enddo + enddo + call sgran() + do ifile=1,nfiles + c=c0 + if(nwav.eq.0) then + if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then + call watterson(c,NMAX/NDOWN,NN*NSPS,fs,delay,fspread) + endif + c=c*sig + if(snrdb.lt.90) then + do i=0,NMAX/NDOWN-1 !Add gaussian noise at specified SNR + xnoise=gran() + ynoise=gran() + c(i)=c(i) + cmplx(xnoise,ynoise) + enddo + endif + write(fname14,1100) ifile +1100 format('000000_',i4.4,'.c2') + open(10,file=fname14,status='unknown',access='stream') + fMHz=10.1387d0 + nmin=2 + write(10) fname14,nmin,fMHz,c !Save to *.c2 file + close(10) + write(*,1108) ifile,xdt,f0,snrdb,fname14 +1108 format(i4,f7.2,f8.2,f7.1,2x,a14) + else + freq=1500.0+f0 + call wspr_wav(baud,xdt,h,freq,itone,snrdb,iwave) + hwav=default_header(12000,NMAX) + write(fname15,1102) ifile +1102 format('000000_',i4.4,'.wav') + open(10,file=fname15,status='unknown',access='stream') + write(10) hwav,iwave !Save to *.wav file + close(10) + write(*,1110) ifile,xdt,f0,snrdb,fname15 +1110 format(i4,f7.2,f8.2,f7.1,2x,a15) + endif + enddo + +999 end program wsprsim |
