mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-28 12:22:32 -04:00
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:
parent
ac77a0a5de
commit
4bc4c11b66
@ -1,23 +1,17 @@
|
|||||||
subroutine genqra65(msg0,ichk,msgsent,itone,itype)
|
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
|
use packjt
|
||||||
character*22 msg0
|
character*22 msg0
|
||||||
character*22 message !Message to be generated
|
character*22 message !Message to be generated
|
||||||
character*22 msgsent !Message as it will be received
|
character*22 msgsent !Message as it will be received
|
||||||
integer itone(126)
|
integer itone(84)
|
||||||
character*3 cok !' ' or 'OOO'
|
character*3 cok !' ' or 'OOO'
|
||||||
integer dgen(13)
|
integer dgen(13)
|
||||||
integer sent(63)
|
integer sent(63)
|
||||||
integer nprc(126)
|
integer icos7(0:6)
|
||||||
data nprc/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
|
data icos7/2,5,6,0,4,1,3/ !Defines a 7x7 Costas array
|
||||||
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/
|
|
||||||
save
|
save
|
||||||
|
|
||||||
if(msg0(1:1).eq.'@') then
|
if(msg0(1:1).eq.'@') then
|
||||||
@ -40,36 +34,16 @@ subroutine genqra65(msg0,ichk,msgsent,itone,itype)
|
|||||||
enddo
|
enddo
|
||||||
|
|
||||||
call chkmsg(message,cok,nspecial,flip)
|
call chkmsg(message,cok,nspecial,flip)
|
||||||
if(nspecial.eq.0) then
|
call packmsg(message,dgen,itype) !Pack message into 72 bits
|
||||||
call packmsg(message,dgen,itype) !Pack message into 72 bits
|
call unpackmsg(dgen,msgsent) !Unpack to get message sent
|
||||||
call unpackmsg(dgen,msgsent) !Unpack to get message sent
|
if(ichk.ne.0) go to 999 !Return if checking only
|
||||||
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
|
itone(1:7)=icos7 !Insert 7x7 Costas array in 3 places
|
||||||
nsym=126 !Symbols per transmission
|
itone(8:39)=sent(1:32)
|
||||||
k=0
|
itone(40:46)=icos7
|
||||||
do j=1,nsym
|
itone(47:77)=sent(33:63)
|
||||||
if(nprc(j).eq.0) then
|
itone(78:84)=icos7
|
||||||
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
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
999 return
|
999 return
|
||||||
|
@ -9,7 +9,8 @@ program qra65sim
|
|||||||
parameter (NFFT=10*65536,NH=NFFT/2)
|
parameter (NFFT=10*65536,NH=NFFT/2)
|
||||||
type(hdr) h !Header for .wav file
|
type(hdr) h !Header for .wav file
|
||||||
integer*2 iwave(NMAX) !Generated waveform
|
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 dgen(12) !Twelve 6-bit data symbols
|
||||||
integer sent(63) !RS(63,12) codeword
|
integer sent(63) !RS(63,12) codeword
|
||||||
real*4 xnoise(NMAX) !Generated random noise
|
real*4 xnoise(NMAX) !Generated random noise
|
||||||
@ -19,6 +20,7 @@ program qra65sim
|
|||||||
complex z
|
complex z
|
||||||
real*8 f0,dt,twopi,phi,dphi,baud,fsample,freq,sps
|
real*8 f0,dt,twopi,phi,dphi,baud,fsample,freq,sps
|
||||||
character msg*22,fname*11,csubmode*1,c,optarg*500,numbuf*32
|
character msg*22,fname*11,csubmode*1,c,optarg*500,numbuf*32
|
||||||
|
character msgsent*22
|
||||||
logical :: display_help=.false.,seed_prngs=.true.
|
logical :: display_help=.false.,seed_prngs=.true.
|
||||||
type (option) :: long_options(8) = [ &
|
type (option) :: long_options(8) = [ &
|
||||||
option ('help',.false.,'h','Display this help message',''), &
|
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 ('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') ]
|
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:
|
! Default parameters:
|
||||||
csubmode='A'
|
csubmode='A'
|
||||||
mode65=1
|
mode65=1
|
||||||
@ -115,14 +108,15 @@ program qra65sim
|
|||||||
dt=1.d0/fsample !Sample interval (s)
|
dt=1.d0/fsample !Sample interval (s)
|
||||||
twopi=8.d0*atan(1.d0)
|
twopi=8.d0*atan(1.d0)
|
||||||
npts=54*12000 !Total samples in .wav file
|
npts=54*12000 !Total samples in .wav file
|
||||||
baud=11025.d0/4096.d0 !Keying rate
|
nsps=6912
|
||||||
sps=12000.d0/baud !Samples per symbol, at fsample=12000 Hz
|
! baud=11025.d0/4096.d0 !Keying rate
|
||||||
nsym=126 !Number of channel symbols
|
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)
|
h=default_header(12000,npts)
|
||||||
dfsig=2000.0/nsigs !Freq spacing between sigs in file (Hz)
|
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
|
do ifile=1,nfiles !Loop over requested number of files
|
||||||
write(fname,1002) ifile !Output filename
|
write(fname,1002) ifile !Output filename
|
||||||
1002 format('000000_',i4.4)
|
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.'B' .and. snrdb.eq.0.0) xsnr=-21 - isig
|
||||||
if(csubmode.eq.'C' .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
|
xsnr=xsnr+5 !### TEMPORARY ###
|
||||||
call qra65_enc(dgen,sent) !Encode using QRA65
|
|
||||||
! call qra65_dec(sent,dgen,ierr) !Decode (### for test only ###)
|
|
||||||
! write(*,3001) sent
|
|
||||||
!3001 format(21i3)
|
|
||||||
|
|
||||||
k=0
|
call genqra65(msg,ichk,msgsent,itone,itype)
|
||||||
do j=1,nsym !Insert sync and data into itone()
|
|
||||||
if(nprc(j).eq.0) then
|
! call packmsg(msg,dgen,itype) !Pack message into 12 six-bit bytes
|
||||||
k=k+1
|
! call qra65_enc(dgen,sent) !Encode using QRA65
|
||||||
itone(j)=sent(k)+2
|
!! call qra65_dec(sent,dgen,ierr) !Decode (### for test only ###)
|
||||||
else
|
!! write(*,3001) sent
|
||||||
itone(j)=0
|
!!3001 format(21i3)
|
||||||
endif
|
|
||||||
enddo
|
|
||||||
|
|
||||||
bandwidth_ratio=2500.0/6000.0
|
bandwidth_ratio=2500.0/6000.0
|
||||||
sig=sqrt(2*bandwidth_ratio)*10.0**(0.05*xsnr)
|
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
|
k=12000 + xdt*12000 !Start audio at t = xdt + 1.0 s
|
||||||
isym0=-99
|
isym0=-99
|
||||||
do i=1,npts !Add this signal into cdat()
|
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.gt.nsym) exit
|
||||||
if(isym.ne.isym0) then
|
if(isym.ne.isym0) then
|
||||||
freq=f0 + itone(isym)*baud*mode65
|
freq=f0 + itone(isym)*baud*mode65
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
subroutine slope(y,npts,xpk)
|
subroutine slope(y,npts,xpk)
|
||||||
|
|
||||||
! Remove best-fit slope from data in y(i). When fitting the straight line,
|
! 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)
|
real y(npts)
|
||||||
|
|
||||||
|
52
lib/t1.f90
52
lib/t1.f90
@ -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
|
|
Loading…
x
Reference in New Issue
Block a user