Add subroutine sftx_sub.f90.

This commit is contained in:
Joe Taylor 2024-09-17 11:35:30 -04:00
parent f0a329c4d2
commit 11749ebef9
2 changed files with 92 additions and 2 deletions

View File

@ -1257,8 +1257,8 @@ target_link_libraries (ft8sim wsjt_fort wsjt_cxx)
#add_executable (sfrx lib/superfox/sfrx.f90)
#target_link_libraries (sfrx wsjt_fort wsjt_cxx)
add_executable (sftx lib/superfox/sftx.f90)
target_link_libraries (sftx wsjt_fort wsjt_cxx)
#add_executable (sftx lib/superfox/sftx.f90)
#target_link_libraries (sftx wsjt_fort wsjt_cxx)
add_executable (msk144sim lib/msk144sim.f90)
target_link_libraries (msk144sim wsjt_fort wsjt_cxx)

90
lib/superfox/sftx_sub.f90 Normal file
View File

@ -0,0 +1,90 @@
subroutine sftx_sub(fname,foxcall0,ckey0)
! This routine is required in order to create a SuperFox transmission.
! The present version goes through the following steps:
! 1. Read old-style Fox messages from file 'sfox_1.dat' in the WSJT-X
! writable data directory.
! 2. Parse up to NSlots=5 messages to extract MyCall, up to 9 Hound
! calls, and the report or RR73 to be sent to each Hound.
! 3. Assemble and encode a single SuperFox message to produce itone(1:151),
! the array of channel symbol values.
! 4. Write the contents of array itone to file 'sfox_2.dat'.
use qpc_mod
use sfox_mod
character*(*) fname !Corrected path for sfox_1.dat
character*120 line !List of SuperFox message pieces
character*40 cmsg(5) !Old-style Fox messages
character*26 freeTextMsg
character*2 arg
character*(*) ckey0
character*10 ckey
character*(*) foxcall0
character*11 foxcall
logical*1 bMoreCQs,bSendMsg
logical crc_ok
real py(0:127,0:127) !Probabilities for received synbol values
integer*8 n47
integer itone(151) !SuperFox channel-symbol values
integer*1 xin(0:49) !Packed message as 7-bit symbols
integer*1 xdec(0:49) !Decoded message
integer*1 y(0:127) !Encoded symbols as i*1 integers
integer*1 ydec(0:127) !Decoded codeword
integer*1 yy(0:10)
integer chansym0(127) !Transmitted symbols, data only
integer chansym(127) !Received symbols, data only
integer isync(24) !Symbol numbers for sync tones
data isync/1,2,4,7,11,16,22,29,37,39,42,43,45,48,52,57,63,70,78,80, &
83,84,86,89/
ckey=ckey0
fsample=12000.0
call sfox_init(7,127,50,'no',fspread,delay,fsample,24)
open(25,file=trim(fname),status='unknown')
do i=1,5
read(25,1000,end=10) cmsg(i)
1000 format(a40)
enddo
i=6
10 close(25)
nslots=i-1
freeTextMsg=' '
bMoreCQs=cmsg(1)(40:40).eq.'1'
bSendMsg=cmsg(nslots)(39:39).eq.'1'
if(bSendMsg) then
freeTextMsg=cmsg(nslots)(1:26)
if(nslots.gt.2) nslots=2
endif
call foxgen2(nslots,cmsg,line,foxcall) !Parse old-style Fox messages
! Pack message information and CRC into xin(0:49)
call sfox_pack(line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin)
call qpc_encode(y,xin) !Encode the message to 128 symbols
y=cshift(y,1) !Puncture the code by removing y(0)
y(127)=0
chansym0=y(0:126)
! Create the full itone sequence containing both data and sync symbols
j=1
k=0
do i=1,NDS
if(j.le.NS .and. i.eq.isync(j)) then
if(j.lt.NS) j=j+1 !Index for next sync symbol
itone(i)=0 !Insert sync symbol at tone 0
else
k=k+1
itone(i)=chansym0(k) + 1 !Symbol value 0 transmitted as tone 1, etc.
endif
enddo
100 i1=max(index(fname,'sfox_1'),1)
fname(i1:i1+9)='sfox_2.dat'
open(25,file=trim(fname),status='unknown')
write(25,1100) itone
1100 format(20i4)
close(25)
999 end subroutine sftx_sub