Fix utc issue in msk144d and other small changes related to msk144.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6729 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2016-06-05 16:02:26 +00:00
parent eec8ef436a
commit f7572dcc4e
2 changed files with 20 additions and 14 deletions

View File

@ -12,7 +12,6 @@ program msk144d
logical :: display_help=.false. logical :: display_help=.false.
type(wav_header) :: wav type(wav_header) :: wav
integer*2 id2(15*12000) integer*2 id2(15*12000)
integer narg(0:14)
character*80 infile character*80 infile
character(len=500) optarg character(len=500) optarg
@ -58,7 +57,7 @@ program msk144d
call wav%read (infile) call wav%read (infile)
i1=index(infile,'.wav') i1=index(infile,'.wav')
if( i1 .eq. 0 ) i1=index(infile,'.WAV') if( i1 .eq. 0 ) i1=index(infile,'.WAV')
read(infile(i1-4:i1-1),*,err=998) nutc read(infile(i1-6:i1-1),*,err=998) nutc
npts=15*12000 npts=15*12000
read(unit=wav%lun) id2(1:npts) read(unit=wav%lun) id2(1:npts)
close(unit=wav%lun) close(unit=wav%lun)

View File

@ -8,8 +8,6 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
character*22 msgreceived character*22 msgreceived
character*85 pchk_file,gen_file character*85 pchk_file,gen_file
complex cdat(npts) !Analytic signal complex cdat(npts) !Analytic signal
complex cdat2(npts) !Analytic signal
complex cav(NSPM) !Analytic signal
complex c(NSPM) complex c(NSPM)
complex ctmp(6000) complex ctmp(6000)
complex cb(42) !Complex waveform for sync word complex cb(42) !Complex waveform for sync word
@ -27,13 +25,14 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
integer*1, allocatable :: message(:) integer*1, allocatable :: message(:)
integer*1 i1hashdec integer*1 i1hashdec
integer ipeaks(10) integer ipeaks(10)
integer metric
logical ismask(6000) logical ismask(6000)
real cbi(42),cbq(42) real cbi(42),cbq(42)
real tonespec(6000) real tonespec(6000)
real rcw(12) real rcw(12)
real dd(npts) real dd(npts)
real pp(12) !Half-sine pulse shape real pp(12) !Half-sine pulse shape
real*8 dt, df, fs, twopi real*8 dt, df, fs, pi, twopi
real softbits(144) real softbits(144)
real*8 unscrambledsoftbits(128) real*8 unscrambledsoftbits(128)
real lratio(128) real lratio(128)
@ -41,8 +40,8 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
data first/.true./ data first/.true./
data s8/0,1,1,1,0,0,1,0/ data s8/0,1,1,1,0,0,1,0/
! save first,cb,cd,pi,twopi,dt,f0,f1 save first,cb,pi,twopi,dt,f0,f1
save ! save
if(first) then if(first) then
! These files can be found in /lib/ldpc/jtmode_codes directory ! These files can be found in /lib/ldpc/jtmode_codes directory
@ -76,7 +75,7 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
! Coarse carrier frequency sync ! Coarse carrier frequency sync
! look for tones near 2k and 4k in the (analytic signal)**2 spectrum ! look for tones near 2k and 4k in the (analytic signal)**2 spectrum
! search range for coarse frequency error is +/- 100 Hz ! search range for coarse frequency error is +/- 200 Hz
fs=12000.0 fs=12000.0
nfft=6000 !using a zero-padded fft to get 2 Hz bins nfft=6000 !using a zero-padded fft to get 2 Hz bins
df=fs/nfft df=fs/nfft
@ -90,11 +89,13 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
ismask=.false. ismask=.false.
ismask(1901:2101)=.true. ! high tone search window ismask(1901:2101)=.true. ! high tone search window
! ismask(1801:2201)=.true. ! high tone search window
iloc=maxloc(tonespec,ismask) iloc=maxloc(tonespec,ismask)
ihpk=iloc(1) ihpk=iloc(1)
ah=tonespec(ihpk) ah=tonespec(ihpk)
ismask=.false. ismask=.false.
ismask(901:1101)=.true. ! window for low tone ismask(901:1101)=.true. ! window for low tone
! ismask(801:1201)=.true. ! window for low tone
iloc=maxloc(tonespec,ismask) iloc=maxloc(tonespec,ismask)
ilpk=iloc(1) ilpk=iloc(1)
al=tonespec(ilpk) al=tonespec(ilpk)
@ -141,13 +142,17 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
do ii=1,5 do ii=1,5
do jj=ii+1,5 do jj=ii+1,5
if( (ii .ne. jj) .and. (abs( abs(ipeaks(ii)-ipeaks(jj))-864) .le. 5) ) then if( (ii .ne. jj) .and. (abs( abs(ipeaks(ii)-ipeaks(jj))-864) .le. 5) ) then
write(78,*) "closed brackets: ",ii,jj,ipeaks(ii),ipeaks(jj),abs(ipeaks(ii)-ipeaks(jj)) ! write(78,*) "closed brackets: ",ii,jj,ipeaks(ii),ipeaks(jj),abs(ipeaks(ii)-ipeaks(jj))
endif endif
enddo enddo
enddo enddo
do iav=0,1 do iav=0,1
do ipk=1,5 do ipk=1,5
do id=1,3
if( id .eq. 1 ) is=0
if( id .eq. 2 ) is=-1
if( id .eq. 3 ) is=1
! we want ic to be the index of the first sample of the message ! we want ic to be the index of the first sample of the message
ic=ipeaks(ipk) ic=ipeaks(ipk)
@ -167,7 +172,7 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
ibb=iloc(1) ibb=iloc(1)
! write(*,*) 'ic0: ',ic,'bb peak is at : ',ibb ! write(*,*) 'ic0: ',ic,'bb peak is at : ',ibb
! Adjust frame index to place peak of bb at desired lag ! Adjust frame index to place peak of bb at desired lag
ic=ic + ibb-2 ic=ic + ibb-2+is
! Sanity check - recompute bb and verify that peak is now at designated lag. ! Sanity check - recompute bb and verify that peak is now at designated lag.
! do i=1,6 ! do i=1,6
@ -200,7 +205,7 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
! Final estimate of the carrier frequency - returned to the calling program ! Final estimate of the carrier frequency - returned to the calling program
fest=1500+ferr+ferr2 fest=1500+ferr+ferr2
! Remove fine frequency error and put the results in cdat2 ! Remove fine frequency error
call tweak1(c,npts,-ferr2,c) call tweak1(c,npts,-ferr2,c)
! Estimate final frequency error and carrier phase. ! Estimate final frequency error and carrier phase.
@ -238,7 +243,6 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
unscrambledhardbits(1:127:2)=hardword(1:64) unscrambledhardbits(1:127:2)=hardword(1:64)
unscrambledhardbits(2:128:2)=hardword(65:128) unscrambledhardbits(2:128:2)=hardword(65:128)
! normalize the softsymbols before submitting to decoder ! normalize the softsymbols before submitting to decoder
sav=sum(softbits)/144 sav=sum(softbits)/144
s2av=sum(softbits*softbits)/144 s2av=sum(softbits*softbits)/144
@ -266,6 +270,7 @@ subroutine syncmsk144(cdat,npts,metric,msgreceived,fest)
endif endif
enddo enddo
enddo enddo
enddo
msgreceived=' ' msgreceived=' '
goto 999 goto 999
@ -298,10 +303,12 @@ goto 999
i4Dec6BitWords(ibyte)=itmp i4Dec6BitWords(ibyte)=itmp
enddo enddo
call unpackmsg(i4Dec6BitWords,msgreceived) call unpackmsg(i4Dec6BitWords,msgreceived)
else
msgreceived=' '
endif endif
write(78,1001) iav,ipk,is,fest,nbadsync,phase0,niterations,ndither,i1hashdec,i1Dec8BitBytes(10),msgreceived write(78,1001) iav,ipk,is,fdiff,fest,nbadsync,phase0,niterations,ndither,i1hashdec,i1Dec8BitBytes(10),msgreceived
1001 format(i6,i6,i6,f10.1,i6,f10.2,i6,i6,i6,i6,4x,a22) 1001 format(i6,i6,i6,f10.1,f10.1,i6,f10.2,i6,i6,i6,i6,4x,a22)
999 return 999 return
end subroutine syncmsk144 end subroutine syncmsk144