Add ft4sim_mult, which is basically functional.

This commit is contained in:
Joe Taylor 2019-01-30 15:33:47 -05:00
parent 3f7fb38e81
commit 189f538dc0
4 changed files with 296 additions and 1 deletions

View File

@ -509,6 +509,7 @@ set (wsjt_FSRCS
lib/msk144sim.f90
lib/mskrtd.f90
lib/ft4/ft4sim.f90
lib/ft4/ft4sim_mult.f90
lib/ft4/ft4d.f90
lib/ft4/ft4_decode.f90
lib/77bit/my_hash.f90
@ -1268,6 +1269,9 @@ target_link_libraries (msk144sim wsjt_fort wsjt_cxx)
add_executable (ft4sim lib/ft4/ft4sim.f90 wsjtx.rc)
target_link_libraries (ft4sim wsjt_fort wsjt_cxx)
add_executable (ft4sim_mult lib/ft4/ft4sim_mult.f90 wsjtx.rc)
target_link_libraries (ft4sim_mult wsjt_fort wsjt_cxx)
add_executable (ft4d lib/ft4/ft4d.f90 wsjtx.rc)
target_link_libraries (ft4d wsjt_fort wsjt_cxx)

View File

@ -9,7 +9,7 @@ parameter (NN2=NS+ND+2) !Total channel symbols (105)
parameter (NSPS=512) !Samples per symbol at 12000 S/s
parameter (NZ=NSPS*NN) !Sync and Data samples (52736)
parameter (NZ2=NSPS*NN2) !Total samples in shaped waveform (53760)
parameter (NMAX=5.0*12000) !Samples in iwave (60,000)
parameter (NMAX=5*12000) !Samples in iwave (60,000)
parameter (NFFT1=2048, NH1=NFFT1/2) !Length of FFTs for symbol spectra
parameter (NSTEP=NSPS/4) !Coarse time-sync step size
parameter (NHSYM=NMAX/NSTEP-3) !Number of symbol spectra (1/4-sym steps)

129
lib/ft4/ft4sim_mult.f90 Normal file
View File

@ -0,0 +1,129 @@
program ft4sim_mult
! Generate simulated signals for experimental "FT4" mode
use wavhdr
use packjt77
include 'ft4_params.f90' !FT4 protocol constants
parameter (NWAVE=NN*NSPS)
parameter (NZZ=15*12000) !Length of .wav file, 180,000 i*2 samples
type(hdr) h !Header for .wav file
character arg*12,fname*17,cjunk*4
character msg37*37,msgsent37*37,c77*77
real wave(NZZ)
real tmp(NZZ)
real dphi(0:NMAX-1)
real pulse(3*NSPS)
integer itone(NN)
integer*2 iwave(NZZ) !Generated full-length waveform
integer icos4(4)
data icos4/0,1,3,2/
! Get command-line argument(s)
nargs=iargc()
if(nargs.ne.2) then
print*,'Usage: ft4sim nsigs nfiles'
print*,'Example: ft4sim 20 8 '
go to 999
endif
call getarg(1,arg)
read(arg,*) nsigs !Number of signals
call getarg(2,arg)
read(arg,*) nfiles !Number of files
twopi=8.0*atan(1.0)
fs=12000.0 !Sample rate (Hz)
dt=1.0/fs !Sample interval (s)
hmod=1.0 !Modulation index (0.5 is MSK, 1.0 is FSK)
tt=NSPS*dt !Duration of unsmoothed symbols (s)
baud=1.0/tt !Keying rate (baud)
txt=NZ*dt !Transmission length (s) without ramp up/down
bandwidth_ratio=2500.0/(fs/2.0)
txt=NN*NSPS/12000.0
xdtmax=10.0 - 0.086
! Compute the filtered frequency pulse
do i=1,3*NSPS
tt=(i-1.5*NSPS)/real(NSPS)
pulse(i)=gfsk_pulse(1.0,tt)
enddo
open(10,file='messages.txt',status='old',err=998)
do ifile=1,nfiles
1 read(10,1001,end=999) cjunk,n
1001 format(a4,i2)
if(cjunk.ne.'File' .or. n.ne.ifile) go to 1
wave=0.
write(fname,1002) ifile
1002 format('000000_',i6.6,'.wav')
do isig=1,nsigs
read(10,1003,end=100) cjunk,isnr,xdt0,ifreq,msg37
1003 format(a4,30x,i3,f5.1,i5,1x,a37)
if(cjunk.eq.'File') go to 100
if(isnr.lt.-16) isnr=-16
f0=ifreq*93.75/50.0
call random_number(r)
xdt=r*xdtmax
! Source-encode, then get itone()
i3=-1
n3=-1
call pack77(msg37,i3,n3,c77)
call genft4(msg37,0,msgsent37,itone)
! Compute the smoothed frequency waveform
dphi_peak=twopi*hmod/real(NSPS)
dphi=0.0
do j=1,NN
ib=(j-1)*NSPS
ie=ib+3*NSPS-1
dphi(ib:ie)=dphi(ib:ie)+dphi_peak*pulse*itone(j)
enddo
! Calculate and insert the audio waveform
phi=0.0
dphi=dphi+twopi*f0*dt
tmp=0.
k0=nint((xdt+0.043)/dt)
k=k0-1
do j=0,NMAX-1
k=k+1
tmp(k)=sin(phi)
phi=mod(phi+dphi(j),twopi)
enddo
k1=k
! Compute the ramp-up and ramp-down symbols
tmp(k0-NSPS:k0-1)=tmp(k0-NSPS:k0-1) * &
(1.0-cos(twopi*(/(i,i=0,NSPS-1)/)/(2.0*NSPS)))/2.0
tmp(k1+1:k1+NSPS)=tmp(k1+1:k1+NSPS) * &
(1.0+cos(twopi*(/(i,i=0,NSPS-1)/)/(2.0*NSPS)))/2.0
! Insert this signal into wave() array
sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*isnr)
wave=wave + sig*tmp
write(*,1100) fname,isig,isnr,nint(f0),msg37
1100 format(a17,i4,i5,i6,2x,a37)
enddo ! isig
100 backspace 10
do i=1,NMAX !Add gaussian noise at specified SNR
xnoise=gran()
wave(i)=wave(i) + xnoise
enddo
gain=30.0
wave=gain*wave
if(any(abs(wave).gt.32767.0)) print*,"Warning - data will be clipped."
iwave=nint(wave)
h=default_header(12000,NZZ)
open(12,file=fname,status='unknown',access='stream')
write(12) h,iwave !Save to *.wav file
close(12)
print*,' '
enddo ! ifile
go to 999
998 print*,'Cannot open file "messages.txt"'
999 end program ft4sim_mult

162
lib/ft4/messages.txt Normal file
View File

@ -0,0 +1,162 @@
File 1
190106_000015 7.080 Rx FT8 -15 0.2 178 N1TRK N4FKH 569 VA
190106_000015 7.080 Rx FT8 -13 -0.1 253 N1TRK KB7RUQ 539 UT
190106_000015 7.080 Rx FT8 10 0.2 389 W0ZF N3LFC RR73
190106_000015 7.080 Rx FT8 -10 0.1 450 PY4AZ KF7YED 559 MT
190106_000015 7.080 Rx FT8 -3 0.2 507 N1TRK WA4DYD 559 GA
190106_000015 7.080 Rx FT8 14 0.2 689 KB0VHA KA1YQC R 539 MA
190106_000015 7.080 Rx FT8 -5 0.1 984 W9JA N9OY RR73
190106_000015 7.080 Rx FT8 -12 0.1 1123 VA2CZ K8GNG RR73
190106_000015 7.080 Rx FT8 2 0.1 1240 CQ RU K7RL CN88
190106_000015 7.080 Rx FT8 -11 0.5 1293 K4ZMW K7VZ RR73
190106_000015 7.080 Rx FT8 2 0.1 1387 WD9IGY KX1X 73
190106_000015 7.080 Rx FT8 -10 0.1 1536 CQ RU W0FRC DM79
190106_000015 7.080 Rx FT8 -2 0.1 1635 K4SQC VE3RX 549 ON
190106_000030 7.080 Rx FT8 -11 0.2 1745 CQ RU K1LOG FN56
190106_000030 7.080 Rx FT8 3 0.8 1798 WD5DAX WS4WW 73
190106_000030 7.080 Rx FT8 12 0.1 1895 DJ6GI KG4W 73
190106_000030 7.080 Rx FT8 -14 0.2 2119 KF7YED KF5ZNQ 549 TX
190106_000030 7.080 Rx FT8 -5 0.1 336 CQ RU AB5XS EM12
190106_000030 7.080 Rx FT8 0 0.0 1415 W3KIT AA8SW RR73
190106_000030 7.080 Rx FT8 -13 0.3 1540 NI6G W7DRW 579 AZ
190106_000030 7.080 Rx FT8 -10 0.1 312 SHIFT W9JA
190106_000030 7.080 Rx FT8 -16 0.1 1447 W7BOB KJ7G 549 WA
File 2
190106_000045 7.080 Rx FT8 -9 0.1 178 N1TRK N4FKH 569 VA
190106_000045 7.080 Rx FT8 -9 -0.1 253 N1TRK KB7RUQ RR73
190106_000045 7.080 Rx FT8 -8 0.1 336 CQ RU AB5XS EM12
190106_000045 7.080 Rx FT8 16 0.3 689 KB0VHA KA1YQC R 539 MA
190106_000045 7.080 Rx FT8 -3 0.1 984 CQ RU N9OY EN43
190106_000045 7.080 Rx FT8 -10 0.1 1146 K1JT WB4HXE 559 GA
190106_000045 7.080 Rx FT8 6 0.1 1240 VE3LON K7RL R 549 WA
190106_000045 7.080 Rx FT8 -1 0.1 1386 WD9IGY KX1X 73
190106_000045 7.080 Rx FT8 -12 0.1 1536 CQ RU W0FRC DM79
190106_000045 7.080 Rx FT8 3 0.1 1635 K4SQC VE3RX RR73
190106_000045 7.080 Rx FT8 -5 0.1 1688 CQ RU W1QA FN32
190106_000045 7.080 Rx FT8 1 0.8 1797 CQ RU WS4WW FM17
190106_000045 7.080 Rx FT8 14 0.1 1895 HB9BUN KG4W R 549 VA
190106_000100 7.080 Rx FT8 -7 0.1 2002 W9TO KN3ILZ 529 PA
190106_000100 7.080 Rx FT8 -9 0.1 312 W9JA PY2APK RRR
190106_000100 7.080 Rx FT8 -12 0.1 436 NZ7P WA7JAY 589 CA
190106_000100 7.080 Rx FT8 -13 -0.1 1380 AC6BW KR9A R 559 WI
190106_000100 7.080 Rx FT8 -17 0.1 1448 W7BOB KJ7G RR73
190106_000100 7.080 Rx FT8 -7 0.3 1540 NI6G W7DRW 569 AZ
File 3
190106_000115 7.080 Rx FT8 -13 0.2 178 N1TRK N4FKH 569 VA
190106_000115 7.080 Rx FT8 -14 -0.1 253 N1TRK KB7RUQ RR73
190106_000115 7.080 Rx FT8 -5 0.1 336 CQ RU AB5XS EM12
190106_000115 7.080 Rx FT8 -7 0.1 449 NI6G KF7YED 569 MT
190106_000115 7.080 Rx FT8 14 0.2 689 KB0VHA KA1YQC 73
190106_000115 7.080 Rx FT8 11 0.4 852 W9TO N4QWF 569 VA
190106_000115 7.080 Rx FT8 -3 0.1 984 W4EMB N9OY R 529 WI
190106_000115 7.080 Rx FT8 -14 0.1 1117 WB4FAY K7PDW 549 UT
190106_000115 7.080 Rx FT8 3 0.2 1240 VE3LON K7RL R 559 WA
190106_000115 7.080 Rx FT8 -18 0.1 1380 AC6BW KR9A R 559 WI
190106_000115 7.080 Rx FT8 4 0.1 1475 K4KCL KB4S 559 VA
190106_000130 7.080 Rx FT8 -5 0.1 1612 K1JT WB4HXE RR73
190106_000115 7.080 Rx FT8 -1 0.1 1688 KW4RTR W1QA R 539 MA
190106_000115 7.080 Rx FT8 -15 0.2 1745 CQ RU K1LOG FN56
190106_000115 7.080 Rx FT8 3 0.8 1798 WA1T WS4WW R 579 VA
190106_000115 7.080 Rx FT8 14 0.1 1895 HB9BUN KG4W R 549 VA
190106_000115 7.080 Rx FT8 -9 0.2 2125 CQ RU NF3R FN20
190106_000130 7.080 Rx FT8 -8 0.4 976 AG1T K7VZ 569 AZ
190106_000130 7.080 Rx FT8 -7 0.1 1434 Z36W N4KMC 529 FL
File 4
190106_000145 7.080 Rx FT8 -8 0.1 335 CQ RU AB5XS EM12
190106_000145 7.080 Rx FT8 -11 0.2 388 W0ZF WW4LL 559 ME
190106_000145 7.080 Rx FT8 -10 0.1 449 NI6G KF7YED 569 MT
190106_000145 7.080 Rx FT8 10 0.3 689 CQ RU KA1YQC FN42
190106_000145 7.080 Rx FT8 12 0.4 852 W9TO N4QWF RR73
190106_000145 7.080 Rx FT8 -2 0.1 984 W4EMB N9OY R 529 WI
190106_000145 7.080 Rx FT8 -12 0.1 1117 WB4FAY K7PDW 549 UT
190106_000145 7.080 Rx FT8 4 0.2 1240 VE3LON K7RL 73
190106_000145 7.080 Rx FT8 -13 0.1 1348 WW5M KO9V 559 NC
190106_000145 7.080 Rx FT8 -14 0.1 1380 AC6BW KR9A R 559 WI
190106_000145 7.080 Rx FT8 2 0.1 1475 K4KCL KB4S RR73
190106_000145 7.080 Rx FT8 -9 0.1 1536 KC1HTT W0FRC 73
190106_000145 7.080 Rx FT8 1 0.1 1688 KW4RTR W1QA R 539 MA
190106_000200 7.080 Rx FT8 1 0.8 1797 WA1T WS4WW R 569 VA
190106_000200 7.080 Rx FT8 15 0.1 1895 CQ RU KG4W FM17
190106_000200 7.080 Rx FT8 -6 0.2 2125 CQ RU NF3R FN20
190106_000200 7.080 Rx FT8 -7 0.1 311 PD8DX PY2APK 539 0081
190106_000200 7.080 Rx FT8 -3 0.5 976 AG1T K7VZ RR73
190106_000200 7.080 Rx FT8 -5 0.1 1432 Z36W N4KMC 529 FL
190106_000200 7.080 Rx FT8 -7 0.3 1540 N7BT W7DRW 559 AZ
190106_000200 7.080 Rx FT8 -16 0.3 2124 N3KCR ON9COP 529 0053
190106_000200 7.080 Rx FT8 -12 0.1 1448 K2DH KJ7G 549 WA
File 5
190106_000215 7.080 Rx FT8 11 0.1 435 K1JT WV8WA 569 WV
190106_000215 7.080 Rx FT8 -4 0.1 335 CQ RU AB5XS EM12
190106_000215 7.080 Rx FT8 10 0.5 689 CQ RU KA1YQC FN42
190106_000215 7.080 Rx FT8 -10 0.1 843 CQ RU AE5JH EL07
190106_000215 7.080 Rx FT8 -3 0.1 984 W4EMB N9OY R 529 WI
190106_000215 7.080 Rx FT8 -10 0.1 1118 WB4FAY W5MO 539 TX
190106_000215 7.080 Rx FT8 -16 0.1 1170 K1JT K8GNG 569 MI
190106_000215 7.080 Rx FT8 6 0.1 1240 CQ RU K7RL CN88
190106_000215 7.080 Rx FT8 -8 0.1 1348 WW5M KO9V RR73
190106_000215 7.080 Rx FT8 -12 0.1 1432 Z36W N4KMC 529 FL
190106_000215 7.080 Rx FT8 2 0.1 1490 KA6BIM KB4S 529 VA
190106_000230 7.080 Rx FT8 -1 0.1 1688 CQ RU W1QA FN32
190106_000230 7.080 Rx FT8 15 0.1 1895 DD5ZZ KG4W R 539 VA
190106_000230 7.080 Rx FT8 -8 0.2 2125 CQ RU NF3R FN20
190106_000230 7.080 Rx FT8 -13 0.1 1380 AC6BW KR9A R 559 WI
190106_000230 7.080 Rx FT8 -4 0.1 1536 CQ RU W0FRC DM79
190106_000230 7.080 Rx FT8 -8 0.3 1540 N7BT W7DRW 559 AZ
File 6
190106_000245 7.080 Rx FT8 6 0.1 635 K1JT WV8WA RR73
190106_000245 7.080 Rx FT8 -12 0.1 335 VE3RX AB5XS R 589 TX
190106_000245 7.080 Rx FT8 -16 0.1 423 WA1T PY2APK 529 0081
190106_000245 7.080 Rx FT8 9 0.4 507 N1TRK N4QWF RR73
190106_000245 7.080 Rx FT8 -10 0.1 869 W7BOB W3KIT 539 MD
190106_000245 7.080 Rx FT8 -7 0.1 984 W4EMB N9OY R 529 WI
190106_000245 7.080 Rx FT8 -13 0.1 1170 K1JT K8GNG 569 MI
190106_000245 7.080 Rx FT8 5 0.1 1240 W6GMT K7RL R 569 WA
190106_000245 7.080 Rx FT8 2 0.1 1490 KA6BIM KB4S 529 VA
190106_000245 7.080 Rx FT8 -1 0.1 1688 CQ RU W1QA FN32
190106_000245 7.080 Rx FT8 1 0.7 1798 N3KCR WS4WW R 599 VA
190106_000245 7.080 Rx FT8 17 0.1 1895 DD5ZZ KG4W 73
190106_000300 7.080 Rx FT8 -10 0.2 2125 CQ RU NF3R FN20
190106_000300 7.080 Rx FT8 8 0.1 546 W7BOB W4DHE 539 KY
190106_000300 7.080 Rx FT8 -9 0.2 844 CQ RU AE5JH EL07
190106_000300 7.080 Rx FT8 -5 0.1 1536 W9WLX W0FRC R 549 CO
File 7
190106_000315 7.080 Rx FT8 -5 0.1 335 VE3RX AB5XS 73
190106_000315 7.080 Rx FT8 -13 0.1 424 WA1T PY2APK 529 0081
190106_000315 7.080 Rx FT8 6 0.1 545 W7BOB W4DHE 539 KY
190106_000315 7.080 Rx FT8 -7 0.4 600 K2DH K7VZ 549 AZ
190106_000315 7.080 Rx FT8 9 0.1 689 VE3LON KA1YQC 73
190106_000315 7.080 Rx FT8 -8 0.1 869 W7BOB W3KIT 539 MD
190106_000315 7.080 Rx FT8 -1 0.1 984 W4EMB N9OY R 529 WI
190106_000315 7.080 Rx FT8 -15 -0.1 1117 WB4FAY KB7RUQ 529 UT
190106_000315 7.080 Rx FT8 7 -0.2 1240 W6GMT K7RL 73
190106_000315 7.080 Rx FT8 -5 0.2 1581 VA3WW WA4DYD 559 GA
190106_000315 7.080 Rx FT8 -8 0.1 1688 DD5ZZ W1QA R 569 MA
190106_000315 7.080 Rx FT8 4 0.7 1798 N3KCR WS4WW 73
190106_000315 7.080 Rx FT8 16 0.1 1895 CQ RU KG4W FM17
190106_000315 7.080 Rx FT8 -11 0.2 2125 CQ RU NF3R FN20
190106_000330 7.080 Rx FT8 -8 0.1 1170 K1JT K8GNG RR73
190106_000330 7.080 Rx FT8 -13 -0.1 454 NZ7P KM7S R 549 CA
190106_000330 7.080 Rx FT8 1 0.1 941 KW4RTR KO9V 559 NC
190106_000330 7.080 Rx FT8 -16 0.3 1034 W9JA W9OY 539 FL
190106_000330 7.080 Rx FT8 -2 0.1 1240 K2DH KD2GXL 559 NY
190106_000330 7.080 Rx FT8 -5 0.1 1536 W9WLX W0FRC 73
190106_000330 7.080 Rx FT8 -2 -0.1 918 KF6JXM W5BT 529 TX
File 8
190106_000345 7.080 Rx FT8 -5 0.1 335 CQ RU AB5XS EM12
190106_000345 7.080 Rx FT8 -13 0.1 423 WA1T PY2APK 529 0081
190106_000345 7.080 Rx FT8 6 0.2 689 CQ RU KA1YQC FN42
190106_000345 7.080 Rx FT8 -16 0.1 852 W9TO KM4LFT RR73
190106_000345 7.080 Rx FT8 -4 -0.1 918 KF6JXM W5BT 529 TX
190106_000345 7.080 Rx FT8 2 0.1 984 W4EMB N9OY R 529 WI
190106_000345 7.080 Rx FT8 -15 0.3 1034 W9JA W9OY RR73
190106_000345 7.080 Rx FT8 -7 0.1 1175 K2DH KD2GXL 559 NY
190106_000345 7.080 Rx FT8 6 -0.1 1240 CQ RU K7RL CN88
190106_000345 7.080 Rx FT8 -10 0.1 1536 CQ RU W0FRC DM79
190106_000345 7.080 Rx FT8 -7 0.2 1581 VA3WW WA4DYD RR73
190106_000345 7.080 Rx FT8 -9 0.1 1688 DD5ZZ W1QA 73
190106_000345 7.080 Rx FT8 17 0.1 1895 CQ RU KG4W FM17
190106_000345 7.080 Rx FT8 -9 0.1 2002 K2DH KN3ILZ 549 PA
190106_000400 7.080 Rx FT8 -5 0.7 2052 CQ RU WS4WW FM17
190106_000400 7.080 Rx FT8 -9 0.2 2125 NV4G NF3R R 549 PA
190106_000400 7.080 Rx FT8 -5 0.0 941 KW4RTR KO9V RR73
190106_000400 7.080 Rx FT8 -7 0.2 1744 KC1HTT K1LOG R 569 ME