mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-04 07:02:27 -04:00
Add hash test. Add phase0 loop. Implement hash test in msk144d.f90 test program. Have not yet tested short messages with hash test.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6890 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
807d5e595b
commit
b0108d59be
@ -246,7 +246,7 @@ subroutine detectmsk144(cbig,n,pchk_file,lines,nmessages,nutc)
|
|||||||
if( ibb .le. 3 ) ibb=ibb-1
|
if( ibb .le. 3 ) ibb=ibb-1
|
||||||
if( ibb .gt. 3 ) ibb=ibb-7
|
if( ibb .gt. 3 ) ibb=ibb-7
|
||||||
|
|
||||||
do id=1,3 ! slicer dither. bb is very good - may be able to remove this.
|
do id=1,1 ! slicer dither. bb is very good - may be able to remove this.
|
||||||
if( id .eq. 1 ) is=0
|
if( id .eq. 1 ) is=0
|
||||||
if( id .eq. 2 ) is=-1
|
if( id .eq. 2 ) is=-1
|
||||||
if( id .eq. 3 ) is=1
|
if( id .eq. 3 ) is=1
|
||||||
@ -314,6 +314,10 @@ subroutine detectmsk144(cbig,n,pchk_file,lines,nmessages,nutc)
|
|||||||
ffin=atan2(imag(cfac),real(cfac))/(twopi*56*6*dt)
|
ffin=atan2(imag(cfac),real(cfac))/(twopi*56*6*dt)
|
||||||
phase0=atan2(imag(cca+ccb),real(cca+ccb))
|
phase0=atan2(imag(cca+ccb),real(cca+ccb))
|
||||||
|
|
||||||
|
do ipha=1,3
|
||||||
|
if( ipha.eq.2 ) phase0=phase0+20*pi/180.0
|
||||||
|
if( ipha.eq.3 ) phase0=phase0-20*pi/180.0
|
||||||
|
|
||||||
! Remove phase error - want constellation rotated so that sample points lie on I/Q axes
|
! Remove phase error - want constellation rotated so that sample points lie on I/Q axes
|
||||||
cfac=cmplx(cos(phase0),sin(phase0))
|
cfac=cmplx(cos(phase0),sin(phase0))
|
||||||
c=c*conjg(cfac)
|
c=c*conjg(cfac)
|
||||||
@ -384,10 +388,12 @@ subroutine detectmsk144(cbig,n,pchk_file,lines,nmessages,nutc)
|
|||||||
else
|
else
|
||||||
msgreceived=' '
|
msgreceived=' '
|
||||||
ndither=-99 ! -99 is bad hash flag
|
ndither=-99 ! -99 is bad hash flag
|
||||||
! write(78,1001) nutc,t0,nsnr,ic,ipk,is,idf,iav,deltaf,fest,ferr,ferr2,ffin,bba,bbp,nbadsync1,nbadsync2, &
|
! write(78,1001) nutc,t0,nsnr,ic,ipk,is,idf,iav,ipha,deltaf,fest,ferr,ferr2, &
|
||||||
|
! ffin,bba,bbp,nbadsync1,nbadsync2, &
|
||||||
! phase0,niterations,ndither,msgreceived
|
! phase0,niterations,ndither,msgreceived
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
enddo ! phase dither
|
||||||
enddo ! frame averaging loop
|
enddo ! frame averaging loop
|
||||||
enddo ! frequency dithering loop
|
enddo ! frequency dithering loop
|
||||||
enddo ! sample-time dither loop
|
enddo ! sample-time dither loop
|
||||||
@ -397,10 +403,11 @@ subroutine detectmsk144(cbig,n,pchk_file,lines,nmessages,nutc)
|
|||||||
ndither=-98
|
ndither=-98
|
||||||
999 continue
|
999 continue
|
||||||
if( nmessages .ge. 1 ) then
|
if( nmessages .ge. 1 ) then
|
||||||
! write(78,1001) nutc,t0,nsnr,ic,ipk,is,idf,iav,deltaf,fest,ferr,ferr2,ffin,bba,bbp,nbadsync1,nbadsync2, &
|
! write(78,1001) nutc,t0,nsnr,ic,ipk,is,idf,iav,ipha,deltaf,fest,ferr,ferr2, &
|
||||||
|
! ffin,bba,bbp,nbadsync1,nbadsync2, &
|
||||||
! phase0,niterations,ndither,msgreceived
|
! phase0,niterations,ndither,msgreceived
|
||||||
call flush(78)
|
! call flush(78)
|
||||||
!1001 format(i6.6,f8.2,i5,i5,i5,i5,i5,i5,f8.2,f8.2,f8.2,f8.2,f8.2,f10.2,f8.2,i5,i5,f8.2,i5,i5,2x,a22)
|
!1001 format(i6.6,f8.2,i5,i5,i5,i5,i5,i5,i5,f8.2,f8.2,f8.2,f8.2,f8.2,f10.2,f8.2,i5,i5,f8.2,i5,i5,2x,a22)
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
@ -99,7 +99,7 @@ subroutine detectmsk32(cbig,n,mycall,partnercall,lines,nmessages,nutc)
|
|||||||
|
|
||||||
! Define the 32 likely messages
|
! Define the 32 likely messages
|
||||||
do irpt=0,31
|
do irpt=0,31
|
||||||
hashmsg=mycall//' '//partnercall//' '//rpt(irpt)
|
hashmsg=trim(mycall)//' '//trim(partnercall)//' '//rpt(irpt)
|
||||||
call fmtmsg(hashmsg,iz)
|
call fmtmsg(hashmsg,iz)
|
||||||
call hash(hashmsg,22,ihash)
|
call hash(hashmsg,22,ihash)
|
||||||
ihash=iand(ihash,127)
|
ihash=iand(ihash,127)
|
||||||
@ -107,7 +107,7 @@ subroutine detectmsk32(cbig,n,mycall,partnercall,lines,nmessages,nutc)
|
|||||||
likelymessages(irpt)=ig
|
likelymessages(irpt)=ig
|
||||||
! write(*,*) irpt,hashmsg,ig,ig24(ig)
|
! write(*,*) irpt,hashmsg,ig,ig24(ig)
|
||||||
enddo
|
enddo
|
||||||
qsocontext=.false.
|
qsocontext=.true.
|
||||||
|
|
||||||
! Fill the detmet, detferr arrays
|
! Fill the detmet, detferr arrays
|
||||||
nstepsize=48 ! 4ms steps
|
nstepsize=48 ! 4ms steps
|
||||||
@ -196,6 +196,7 @@ subroutine detectmsk32(cbig,n,mycall,partnercall,lines,nmessages,nutc)
|
|||||||
lines=char(0)
|
lines=char(0)
|
||||||
|
|
||||||
imsgbest=-99
|
imsgbest=-99
|
||||||
|
nbadsyncbest=99
|
||||||
cdbest=1e32
|
cdbest=1e32
|
||||||
cdratbest=0.0
|
cdratbest=0.0
|
||||||
|
|
||||||
@ -418,16 +419,15 @@ subroutine detectmsk32(cbig,n,mycall,partnercall,lines,nmessages,nutc)
|
|||||||
enddo ! frame averaging loop
|
enddo ! frame averaging loop
|
||||||
enddo ! frequency dithering loop
|
enddo ! frequency dithering loop
|
||||||
enddo ! sample-time dither loop
|
enddo ! sample-time dither loop
|
||||||
enddo ! peak loop - could be made more efficient by working harder to find good peaks
|
enddo ! peak loop
|
||||||
|
|
||||||
msgreceived=' '
|
|
||||||
! write(78,1001) nutc,t0,nsnr,ic,ipk,is,idf,iav,deltaf,fest,ferr,ferr2,ffin,bba,bbp,nbadsync, &
|
! write(78,1001) nutc,t0,nsnr,ic,ipk,is,idf,iav,deltaf,fest,ferr,ferr2,ffin,bba,bbp,nbadsync, &
|
||||||
! phase0,msgreceived
|
! phase0,msgreceived
|
||||||
! call flush(78)
|
! call flush(78)
|
||||||
!1001 format(i6.6,f8.2,i5,i5,i5,i5,i5,i5,f8.2,f8.2,f8.2,f8.2,f8.2,f10.2,f8.2,i5,f8.2,2x,a22)
|
!1001 format(i6.6,f8.2,i5,i5,i5,i5,i5,i5,f8.2,f8.2,f8.2,f8.2,f8.2,f10.2,f8.2,i5,f8.2,2x,a22)
|
||||||
enddo
|
enddo
|
||||||
999 continue
|
999 continue
|
||||||
if( imsgbest .ge. 0 ) then
|
msgreceived=' '
|
||||||
if( ( ihammd(imsgbest)+nbadsyncbest .le. 4 ) .and. ( (cdratbest .gt. 50.0) .and. (cdbest .le. 0.05) ) ) then
|
if( ( ihammd(imsgbest)+nbadsyncbest .le. 4 ) .and. ( (cdratbest .gt. 50.0) .and. (cdbest .le. 0.05) ) ) then
|
||||||
if( qsocontext ) then
|
if( qsocontext ) then
|
||||||
nrxrpt=iand(likelymessages(imsgbest),31)
|
nrxrpt=iand(likelymessages(imsgbest),31)
|
||||||
@ -438,8 +438,15 @@ subroutine detectmsk32(cbig,n,mycall,partnercall,lines,nmessages,nutc)
|
|||||||
nrxhash=(imsgbest-nrxrpt)/32
|
nrxhash=(imsgbest-nrxrpt)/32
|
||||||
imessage=imsgbest
|
imessage=imsgbest
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
! See if this message has a hash that is expected for a message sent to mycall by partnercall
|
||||||
|
hashmsg=trim(mycall)//' '//trim(partnercall)//' '//rpt(nrxrpt)
|
||||||
|
call fmtmsg(hashmsg,iz)
|
||||||
|
call hash(hashmsg,22,ihash)
|
||||||
|
ihash=iand(ihash,127)
|
||||||
|
if( nrxhash .eq. ihash ) then
|
||||||
nmessages=1
|
nmessages=1
|
||||||
write(msgreceived,'(a1,i3,a1,1x,a4)') "<",nrxhash,">",rpt(nrxrpt)
|
write(msgreceived,'(a1,a,1x,a,a1,1x,a4)') "<",trim(mycall),trim(partnercall),">",rpt(nrxrpt)
|
||||||
write(lines(nmessages),1020) nutc,nsnr,t0,nint(fest),msgreceived
|
write(lines(nmessages),1020) nutc,nsnr,t0,nint(fest),msgreceived
|
||||||
1020 format(i6.6,i4,f5.1,i5,' & ',a22)
|
1020 format(i6.6,i4,f5.1,i5,' & ',a22)
|
||||||
|
|
||||||
|
@ -14,14 +14,16 @@ program msk144d
|
|||||||
type(wav_header) :: wav
|
type(wav_header) :: wav
|
||||||
integer*2 id2(30*12000)
|
integer*2 id2(30*12000)
|
||||||
character*500 infile
|
character*500 infile
|
||||||
|
character*12 mycall,hiscall
|
||||||
character(len=500) optarg
|
character(len=500) optarg
|
||||||
|
|
||||||
type (option) :: long_options(2) = [ &
|
type (option) :: long_options(3) = [ &
|
||||||
option ('help',.false.,'h','Display this help message',''), &
|
option ('help',.false.,'h','Display this help message',''), &
|
||||||
option ('ntrials',.true.,'n','number of trials, default TRIALS=10000','TRIALS') &
|
option ('mycall',.true.,'c','mycall',''), &
|
||||||
|
option ('hiscall',.true.,'x','hiscall','') &
|
||||||
]
|
]
|
||||||
do
|
do
|
||||||
call getopt('hn:',long_options,c,optarg,narglen,nstat,noffset,nremain,.true.)
|
call getopt('c:hx:',long_options,c,optarg,narglen,nstat,noffset,nremain,.true.)
|
||||||
if( nstat .ne. 0 ) then
|
if( nstat .ne. 0 ) then
|
||||||
exit
|
exit
|
||||||
end if
|
end if
|
||||||
@ -30,6 +32,10 @@ program msk144d
|
|||||||
display_help = .true.
|
display_help = .true.
|
||||||
case ('n')
|
case ('n')
|
||||||
read (optarg(:narglen), *) ntrials
|
read (optarg(:narglen), *) ntrials
|
||||||
|
case ('c')
|
||||||
|
read (optarg(:narglen), *) mycall
|
||||||
|
case ('x')
|
||||||
|
read (optarg(:narglen), *) hiscall
|
||||||
end select
|
end select
|
||||||
end do
|
end do
|
||||||
|
|
||||||
@ -65,7 +71,7 @@ program msk144d
|
|||||||
read(unit=wav%lun) id2(1:npts)
|
read(unit=wav%lun) id2(1:npts)
|
||||||
close(unit=wav%lun)
|
close(unit=wav%lun)
|
||||||
call timer('read ',1)
|
call timer('read ',1)
|
||||||
call msk144_decode(id2,npts,nutc,1,pchk_file,line)
|
call msk144_decode(id2,npts,nutc,1,pchk_file,mycall,hiscall,line)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
call timer('msk144 ',1)
|
call timer('msk144 ',1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user