Starting the transition from QRA01 to QRA02.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6824 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-06-29 19:10:57 +00:00
parent ac77a0a5de
commit 4bc4c11b66
4 changed files with 32 additions and 122 deletions

View File

@ -1,23 +1,17 @@
subroutine genqra65(msg0,ichk,msgsent,itone,itype)
! Encodes a QRA65 message to yieild itone(1:126)
! Encodes a QRA65 message to yield itone(1:84)
use packjt
character*22 msg0
character*22 message !Message to be generated
character*22 msgsent !Message as it will be received
integer itone(126)
integer itone(84)
character*3 cok !' ' or 'OOO'
integer dgen(13)
integer sent(63)
integer nprc(126)
data nprc/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
1,1,1,1,1,1/
integer icos7(0:6)
data icos7/2,5,6,0,4,1,3/ !Defines a 7x7 Costas array
save
if(msg0(1:1).eq.'@') then
@ -40,36 +34,16 @@ subroutine genqra65(msg0,ichk,msgsent,itone,itype)
enddo
call chkmsg(message,cok,nspecial,flip)
if(nspecial.eq.0) then
call packmsg(message,dgen,itype) !Pack message into 72 bits
call unpackmsg(dgen,msgsent) !Unpack to get message sent
if(ichk.ne.0) go to 999 !Return if checking only
call packmsg(message,dgen,itype) !Pack message into 72 bits
call unpackmsg(dgen,msgsent) !Unpack to get message sent
if(ichk.ne.0) go to 999 !Return if checking only
call qra65_enc(dgen,sent) !Encode using QRA65
call qra65_enc(dgen,sent) !Encode using QRA65
nsym=126 !Symbols per transmission
k=0
do j=1,nsym
if(nprc(j).eq.0) then
k=k+1
itone(j)=sent(k)+2
else
itone(j)=0
endif
enddo
else
nsym=32
k=0
do j=1,nsym
do n=1,4
k=k+1
if(iand(j,1).eq.1) itone(k)=0
if(iand(j,1).eq.0) itone(k)=10*nspecial
if(k.eq.126) go to 10
enddo
enddo
10 msgsent=message
itype=7
endif
itone(1:7)=icos7 !Insert 7x7 Costas array in 3 places
itone(8:39)=sent(1:32)
itone(40:46)=icos7
itone(47:77)=sent(33:63)
itone(78:84)=icos7
endif
999 return

View File

@ -9,7 +9,8 @@ program qra65sim
parameter (NFFT=10*65536,NH=NFFT/2)
type(hdr) h !Header for .wav file
integer*2 iwave(NMAX) !Generated waveform
integer*4 itone(126) !Channel symbols (values 0-65)
! integer*4 itone(126) !Channel symbols (values 0-65)
integer*4 itone(84) !Channel symbols (values 0-63)
integer dgen(12) !Twelve 6-bit data symbols
integer sent(63) !RS(63,12) codeword
real*4 xnoise(NMAX) !Generated random noise
@ -19,6 +20,7 @@ program qra65sim
complex z
real*8 f0,dt,twopi,phi,dphi,baud,fsample,freq,sps
character msg*22,fname*11,csubmode*1,c,optarg*500,numbuf*32
character msgsent*22
logical :: display_help=.false.,seed_prngs=.true.
type (option) :: long_options(8) = [ &
option ('help',.false.,'h','Display this help message',''), &
@ -30,15 +32,6 @@ program qra65sim
option ('no-prng-seed',.false.,'p','Do not seed PRNGs (use for reproducible tests)',''), &
option ('strength',.true.,'s','S/N in dB (2500Hz reference b/w), default SNR=0','SNR') ]
integer nprc(126) !Sync pattern
data nprc/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
1,1,1,1,1,1/
! Default parameters:
csubmode='A'
mode65=1
@ -115,14 +108,15 @@ program qra65sim
dt=1.d0/fsample !Sample interval (s)
twopi=8.d0*atan(1.d0)
npts=54*12000 !Total samples in .wav file
baud=11025.d0/4096.d0 !Keying rate
sps=12000.d0/baud !Samples per symbol, at fsample=12000 Hz
nsym=126 !Number of channel symbols
nsps=6912
! baud=11025.d0/4096.d0 !Keying rate
baud=12000.d0/6912 !Keying rate = 1.7361111111
! sps=12000.d0/baud !Samples per symbol, at fsample=12000 Hz
! nsym=126 !Number of channel symbols
nsym=84 !Number of channel symbols
h=default_header(12000,npts)
dfsig=2000.0/nsigs !Freq spacing between sigs in file (Hz)
print*,'A',nsigs,nfiles
do ifile=1,nfiles !Loop over requested number of files
write(fname,1002) ifile !Output filename
1002 format('000000_',i4.4)
@ -145,21 +139,15 @@ program qra65sim
if(csubmode.eq.'B' .and. snrdb.eq.0.0) xsnr=-21 - isig
if(csubmode.eq.'C' .and. snrdb.eq.0.0) xsnr=-21 - isig
call packmsg(msg,dgen,itype) !Pack message into 12 six-bit bytes
call qra65_enc(dgen,sent) !Encode using QRA65
! call qra65_dec(sent,dgen,ierr) !Decode (### for test only ###)
! write(*,3001) sent
!3001 format(21i3)
xsnr=xsnr+5 !### TEMPORARY ###
k=0
do j=1,nsym !Insert sync and data into itone()
if(nprc(j).eq.0) then
k=k+1
itone(j)=sent(k)+2
else
itone(j)=0
endif
enddo
call genqra65(msg,ichk,msgsent,itone,itype)
! call packmsg(msg,dgen,itype) !Pack message into 12 six-bit bytes
! call qra65_enc(dgen,sent) !Encode using QRA65
!! call qra65_dec(sent,dgen,ierr) !Decode (### for test only ###)
!! write(*,3001) sent
!!3001 format(21i3)
bandwidth_ratio=2500.0/6000.0
sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*xsnr)
@ -172,7 +160,7 @@ program qra65sim
k=12000 + xdt*12000 !Start audio at t = xdt + 1.0 s
isym0=-99
do i=1,npts !Add this signal into cdat()
isym=floor(i/sps)+1
isym=i/nsps + 1
if(isym.gt.nsym) exit
if(isym.ne.isym0) then
freq=f0 + itone(isym)*baud*mode65

View File

@ -1,7 +1,7 @@
subroutine slope(y,npts,xpk)
! Remove best-fit slope from data in y(i). When fitting the straight line,
! ignore the peak around xpk +/- nhw
! ignore the peak around xpk +/- 2 bins
real y(npts)

View File

@ -1,52 +0,0 @@
program t1
parameter (NFFT=1024,NH=NFFT/2)
real w(-24:24)
real x(0:NFFT-1)
complex cx(0:NH)
equivalence (x,cx)
! FIR lowpass filter designed using ScopeFIR
! fsample = 48000 Hz
! Ntaps = 49
! fc = 4500 Hz
! fstop = 6000 Hz
! Ripple = 1 dB
! Stop Atten = 40 dB
! fout = 12000 Hz
! Filter coefficients:
data w/ &
0.000861074040, 0.010051920210, 0.010161983649, 0.011363155076, &
0.008706594219, 0.002613872664,-0.005202883094,-0.011720748164, &
-0.013752163325,-0.009431602741, 0.000539063909, 0.012636767098, &
0.021494659597, 0.021951235065, 0.011564169382,-0.007656470131, &
-0.028965787341,-0.042637874109,-0.039203309748,-0.013153301537, &
0.034320769178, 0.094717832646, 0.154224604789, 0.197758325022, &
0.213715139513, 0.197758325022, 0.154224604789, 0.094717832646, &
0.034320769178,-0.013153301537,-0.039203309748,-0.042637874109, &
-0.028965787341,-0.007656470131, 0.011564169382, 0.021951235065, &
0.021494659597, 0.012636767098, 0.000539063909,-0.009431602741, &
-0.013752163325,-0.011720748164,-0.005202883094, 0.002613872664, &
0.008706594219, 0.011363155076, 0.010161983649, 0.010051920210, &
0.000861074040/
x=0.
do i=-24,24
j=i
if(j.lt.0) j=j+NFFT
x(j)=w(i)
enddo
call four2a(x,NFFT,1,-1,0) !r2c FFT
df=48000.0/NFFT
do i=0,NH
y=abs(cx(i))
s=y*y
f=i*df
write(13,1000) f,y,s,db(s),cx(i)
1000 format(6f12.6)
enddo
end program t1