Simplify a few parts of code used for SuperFox simulations.

This commit is contained in:
Joe Taylor 2024-02-14 11:49:59 -05:00
parent 939eaa11ef
commit ce7d5b8d02
2 changed files with 12 additions and 15 deletions

View File

@ -7,24 +7,25 @@ contains
subroutine sfox_init(mm0,nn0,kk0,itu,fspread,delay) subroutine sfox_init(mm0,nn0,kk0,itu,fspread,delay)
character*2 itu character*2 itu
integer isps(30) integer isps(50)
integer iloc(1) integer iloc(1)
data isps/1000,1008,1024,1050,1080,1120,1152,1176,1200,1260, & data isps/1000,1008,1024,1029,1050,1080,1120,1125,1134,1152, &
1280,1296,1344,1350,1372,1400,1440,1470,1500,1512, & 1176,1200,1215,1225,1250,1260,1280,1296,1323,1344, &
1536,1568,1600,1620,1680,1728,1920,1944,1960,2000/ 1350,1372,1400,1440,1458,1470,1500,1512,1536,1568, &
1575,1600,1620,1680,1701,1715,1728,1750,1764,1792, &
1800,1875,1890,1920,1944,1960,2000,2016,2025,2048/
MM=mm0 !Bits per symbol MM=mm0 !Bits per symbol
NQ=2**MM !Q, number of MFSK tones NQ=2**MM !Q, number of MFSK tones
NN=nn0 !Channel symbols, before puncture NN=nn0 !Channel symbols, before puncture
KK=kk0 !Information symbols, before puncture KK=kk0 !Information symbols, before puncture
ND1=25 !Data symbols before sync ND1=25 !Data symbols before sync
ND2=NN-2-ND1 !Data symbols after sync ND2=NN-ND1 !Data symbols after sync
ND=ND1+ND2 !Total data symbols ND=NN !Total data symbols
NFZ=3 !First zero NFZ=3 !First zero
tsync=2.0 tsync=2.0
jsps=nint((12.6-tsync)*12000.0/ND) jsps=nint((12.8-tsync)*12000.0/ND)
iloc=minloc(abs(isps-jsps)) iloc=minloc(abs(isps-jsps))
NSPS=isps(iloc(1)) !Samples per symbol NSPS=isps(iloc(1)) !Samples per symbol
NS=nint(tsync*12000.0/NSPS) NS=nint(tsync*12000.0/NSPS)

View File

@ -96,13 +96,9 @@ program sfoxtest
! Generate a message ! Generate a message
msg0=0 msg0=0
do i=1,KK-2 do i=1,KK
! msg0(i)=i-1
msg0(i)=int(NQ*ran1(idummy)) msg0(i)=int(NQ*ran1(idummy))
! msg0(i)=0
! if(i.gt.ND1) msg0(i)=NQ-1
enddo enddo
! Append a CRC here ...
call rs_init_sf(MM,NQ,NN,KK,NFZ) !Initialize the Karn codec call rs_init_sf(MM,NQ,NN,KK,NFZ) !Initialize the Karn codec
call rs_encode_sf(msg0,parsym) !Compute parity symbols call rs_encode_sf(msg0,parsym) !Compute parity symbols
@ -115,7 +111,7 @@ program sfoxtest
! Generate cdat, the SuperFox waveform ! Generate cdat, the SuperFox waveform
call sfox_gen(chansym0,f0,fsample,syncwidth,cdat) call sfox_gen(chansym0,f0,fsample,syncwidth,cdat)
do isnr=0,-25,-1 do isnr=-8,-20,-1
snr=isnr snr=isnr
if(snrdb.ne.0.0) snr=snrdb if(snrdb.ne.0.0) snr=snrdb
sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*snr) sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*snr)
@ -142,7 +138,7 @@ program sfoxtest
f1=f0 f1=f0
if(f0.eq.0.0) then if(f0.eq.0.0) then
f1=1500.0 + 200.0*(ran1(idummy)-0.5) f1=1500.0 + 200.0*(ran1(idummy)-0.5)
xdt=2.0*(ran1(idummy)-0.5) xdt=0.6*(ran1(idummy)-0.5)
call sfox_gen(chansym0,f1,fsample,syncwidth,cdat,clo) call sfox_gen(chansym0,f1,fsample,syncwidth,cdat,clo)
endif endif