unpack77 now returns logical variable unpk77_success, which will be .false. if there is something obviously wrong with the message. Still to do: set the flag if the unpacked message contains CQ in an implausible place.

This commit is contained in:
Steve Franke 2018-09-12 15:06:26 -05:00
parent 629d061e30
commit 642540ff8f
7 changed files with 22 additions and 14 deletions

View File

@ -194,7 +194,7 @@ subroutine pack77(msg0,i3,n3,c77)
900 return
end subroutine pack77
subroutine unpack77(c77,msg)
subroutine unpack77(c77,msg,unpk77_success)
parameter (NSEC=84) !Number of ARRL Sections
parameter (NUSCAN=65) !Number of US states and Canadian provinces
@ -211,6 +211,7 @@ subroutine unpack77(c77,msg)
character*4 grid4,cserial
character*3 csec(NSEC)
character*38 c
logical unpk77_success
data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/
data csec/ &
@ -232,10 +233,13 @@ subroutine unpack77(c77,msg)
"NB ","NS ","QC ","ON ","MB ","SK ","AB ","BC ","NWT","NF ", &
"LB ","NU ","VT ","PEI","DC "/
unpk77_success=.true.
! Check for bad data
do i=1,77
if(c77(i:i).ne.'0' .and. c77(i:i).ne.'1') then
msg='QUIRK 2'
msg='failed unpack'
unpk77_success=.false.
return
endif
enddo
@ -297,9 +301,10 @@ subroutine unpack77(c77,msg)
else if(i3.eq.0 .and. (n3.eq.3 .or. n3.eq.4)) then
! 0.3 WA9XYZ KA1ABC R 16A EMA 28 28 1 4 3 7 71 ARRL Field Day
! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day
! 0.4 WA9XYZ KA1ABC R 32A EMA 28 28 1 4 3 7 71 ARRL Field Day
read(c77,1030) n28a,n28b,ir,intx,nclass,isec
1030 format(2b28,b1,b4,b3,b7)
if(isec.gt.NSEC .or. isec.lt.1) unpk77_success=.false.
if(isec.gt.NSEC) isec=NSEC !### Check range for other params? ###
if(isec.lt.1) isec=1 !### Flag these so they aren't printed? ###
call unpack28(n28a,call_1)

View File

@ -14,6 +14,7 @@ integer*1 msgbits(77)
integer*1 message77(77)
integer*1 apmask(N), cw(N)
integer nerrtot(0:N),nerrdec(0:N)
logical unpk77_success
real*8, allocatable :: rxdata(:)
real, allocatable :: llr(:)
@ -51,7 +52,7 @@ allocate ( rxdata(N), llr(N) )
i3=0
n3=1
call pack77(msg,i3,n3,c77) !Pack into 12 6-bit bytes
call unpack77(c77,msgsent) !Unpack to get msgsent
call unpack77(c77,msgsent,unpk77_success) !Unpack to get msgsent
write(*,*) "message sent ",msgsent
read(c77,'(77i1)') msgbits(1:77)

View File

@ -36,7 +36,7 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
complex ctwk(32)
complex csymb(32)
complex cs(0:7,NN)
logical first,newdat,lsubtract,lapon,lapcqonly,nagain
logical first,newdat,lsubtract,lapon,lapcqonly,nagain,unpk77_success
data icos7/3,1,4,0,6,5,2/ ! Flipped w.r.t. original FT8 sync array
data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/
data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/
@ -321,8 +321,8 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
if(i3.gt.4 .or. (i3.eq.0.and.n3.gt.5)) then
cycle
endif
call unpack77(c77,msg37)
if(index(msg37,'QU1RK').gt.0) then
call unpack77(c77,msg37,unpk77_success)
if(.not.unpk77_success) then
cycle
endif
nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message.

View File

@ -10,11 +10,12 @@ subroutine genft8_174_91(msg,i3,n3,msgsent,msgbits,itone)
integer itone(79)
integer icos7(0:6)
integer graymap(0:7)
logical unpk77_success
data icos7/3,1,4,0,6,5,2/ !Costas 7x7 tone pattern
data graymap/0,1,3,2,5,6,4,7/
call pack77(msg,i3,n3,c77)
call unpack77(c77,msgsent)
call unpack77(c77,msgsent,unpk77_success)
read(c77,'(77i1)',err=1) msgbits
go to 2

View File

@ -32,7 +32,7 @@ subroutine genmsk_128_90(msg0,ichk,msgsent,i4tone,itype)
real*8 xi(864),xq(864),pi,twopi
data s8/0,1,1,1,0,0,1,0/
equivalence (ihash,i1hash)
logical first
logical first,unpk77_success
data first/.true./
save
@ -73,7 +73,7 @@ subroutine genmsk_128_90(msg0,ichk,msgsent,i4tone,itype)
endif
call pack77(message,i3,n3,c77)
call unpack77(c77,msgsent) !Unpack to get msgsent
call unpack77(c77,msgsent,unpk77_success) !Unpack to get msgsent
if(ichk.eq.1) go to 999
read(c77,"(77i1)") msgbits
call encode_128_90(msgbits,codeword)

View File

@ -14,6 +14,7 @@ program ldpcsim128_90
integer*1 msgbits(77)
integer*4 i4Msg6BitWords(13)
integer nerrtot(0:N),nerrdec(0:N)
logical unpk77_success
real*8 rxdata(N), rxavgd(N)
real llr(N)
@ -47,7 +48,7 @@ program ldpcsim128_90
i3=0
n3=1
call pack77(msg,i3,n3,c77)
call unpack77(c77,msgsent)
call unpack77(c77,msgsent,unpk77_success)
read(c77,'(77i1)') msgbits
write(*,*) "message sent ",msgsent
@ -107,7 +108,7 @@ program ldpcsim128_90
! If the decoder finds a valid codeword, nharderrors will be .ge. 0.
if( nharderrors .ge. 0 ) then
write(c77,'(77i1)') message77
call unpack77(c77,msgreceived)
call unpack77(c77,msgreceived,unpk77_success)
nhw=count(cw.ne.codeword)
if(nhw.eq.0) then ! this is a good decode
ngood=ngood+1

View File

@ -15,7 +15,7 @@ subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess,recent_calls,nrecen
real pp(12)
real softbits(144)
real llr(128)
logical first
logical first,unpk77_success
data first/.true./
data s8/0,1,1,1,0,0,1,0/
save first,cb,fs,pi,twopi,dt,s8,pp
@ -101,7 +101,7 @@ subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess,recent_calls,nrecen
if( nharderror .ge. 0 .and. nharderror .lt. 18 ) then
nsuccess=1
write(c77,'(77i1)') decoded77
call unpack77(c77,msgreceived)
call unpack77(c77,msgreceived,unpk77_success)
endif
return