diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /lib/qra | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'lib/qra')
| -rw-r--r-- | lib/qra/q65/genq65.f90 | 20 | ||||
| -rw-r--r-- | lib/qra/q65/normrnd.c | 2 | ||||
| -rw-r--r-- | lib/qra/q65/q65.c | 10 | ||||
| -rw-r--r-- | lib/qra/q65/q65.f90 | 8 | ||||
| -rw-r--r-- | lib/qra/q65/q65.h | 5 | ||||
| -rw-r--r-- | lib/qra/q65/q65_ap.f90 | 32 | ||||
| -rw-r--r-- | lib/qra/q65/q65_encoding_modules.f90 | 31 | ||||
| -rw-r--r-- | lib/qra/q65/q65_ftn_test.f90 | 9 | ||||
| -rw-r--r-- | lib/qra/q65/q65_loops.f90 | 24 | ||||
| -rw-r--r-- | lib/qra/q65/q65_set_list.f90 | 2 | ||||
| -rw-r--r-- | lib/qra/q65/q65_set_list2.f90 | 36 | ||||
| -rw-r--r-- | lib/qra/q65/q65_workspace.f90 | 43 | ||||
| -rw-r--r-- | lib/qra/q65/q65code.f90 | 11 | ||||
| -rw-r--r-- | lib/qra/q65/q65sim.f90 | 14 |
14 files changed, 180 insertions, 67 deletions
diff --git a/lib/qra/q65/genq65.f90 b/lib/qra/q65/genq65.f90 index 4c555748..1705ce82 100644 --- a/lib/qra/q65/genq65.f90 +++ b/lib/qra/q65/genq65.f90 @@ -1,4 +1,4 @@ -subroutine genq65(msg0,ichk,msgsent,itone,i3,n3) +subroutine genq65(msg0,ichk,msgsent,itone,i3,n3,iflag) ! Encodes a Q65 message to yield itone(1:85) @@ -25,13 +25,16 @@ subroutine genq65(msg0,ichk,msgsent,itone,i3,n3) endif i3=-1 n3=-1 - call pack77(msg0,i3,n3,c77) - read(c77(60:74),'(b15)') ng15 + c77=' ' + unpk77_success=.false. + call pack77_legacy_truncating_fallback(msg0,i3,n3,c77) + if(i3.lt.0 .or. n3.lt.0) go to 998 + read(c77(60:74),'(b15)',err=998) ng15 if(ng15.eq.32373) c77(60:74)='111111010010011' !Message is RR73 call unpack77(c77,0,msgsent,unpk77_success) !Unpack to get msgsent - read(c77,1001) dgen + read(c77,1001,err=998) dgen 1001 format(12b6.6,b5.5) - dgen(13)=2*dgen(13) !Convert 77-bit to 78-bit payload + dgen(13)=2*dgen(13)+iflag !Convert 77-bit to 78-bit payload; iflag is the spare 78th bit if(ichk.eq.1) go to 999 !Return if checking only call q65_enc(dgen,sent) !Encode message, dgen(1:13) ==> sent(1:63) @@ -47,5 +50,12 @@ subroutine genq65(msg0,ichk,msgsent,itone,i3,n3) endif enddo + go to 999 +998 dgen=0 + sent=0 + itone=0 + i3=-1 + n3=-1 + msgsent='*** bad message *** ' 999 return end subroutine genq65 diff --git a/lib/qra/q65/normrnd.c b/lib/qra/q65/normrnd.c index 90abfa42..29d7e243 100644 --- a/lib/qra/q65/normrnd.c +++ b/lib/qra/q65/normrnd.c @@ -33,7 +33,7 @@ #elif _SVID_SOURCE || _XOPEN_SOURCE || __unix__ || (defined (__APPLE__) && defined(__MACH__)) /* POSIX or Unix or Apple */ #include <stdlib.h> #define rand_s(x) (*x)=(unsigned int)lrand48() // returns unsigned integers in the range 0..0x7FFFFFFF - #define K_RAND_MAX 0x7FFFFFFF // that's the max number + #define K_RAND_MAX 2147483647.0f // that's the max number // generated by lrand48 #else #error "No good quality PRNG found" diff --git a/lib/qra/q65/q65.c b/lib/qra/q65/q65.c index fb08dd13..a88c1e4e 100644 --- a/lib/qra/q65/q65.c +++ b/lib/qra/q65/q65.c @@ -30,11 +30,12 @@ #define Q65_LLH_THRESHOLD -260.0f // This value produce the same WER performance in decode_fullaplist -// #define Q65_LLH_THRESHOLD -262.0f +// #define Q65_LLH_THRESHOLD -262.0f static int _q65_crc6(int *x, int sz); static void _q65_crc12(int *y, int *x, int sz); +static void _q65_mask(const qracode *pcode, float *ix, const int *mask, const int *x); float q65_llh; @@ -665,7 +666,12 @@ int q65_check_llh(float *llh, const int* ydec, const int nN, const int nM, const int k; float t = 0; + if (llh != NULL) + *llh = -INFINITY; + for (k=0;k<nN;k++) { + if (ydec[k] < 0 || ydec[k] >= nM) + return 0; float x=pIntrin[ydec[k]]; if(x < 1.0e-36) x = 1.0e-36; t+=logf(x); @@ -805,7 +811,7 @@ int _q65_get_bits_per_symbol(const qracode *pCode) { return pCode->m; } -static void _q65_mask(const qracode *pcode, float *ix, const int *mask, const int *x) +void _q65_mask(const qracode *pcode, float *ix, const int *mask, const int *x) { // mask intrinsic information ix with available a priori knowledge diff --git a/lib/qra/q65/q65.f90 b/lib/qra/q65/q65.f90 index d73ded61..5718243c 100644 --- a/lib/qra/q65/q65.f90 +++ b/lib/qra/q65/q65.f90 @@ -9,7 +9,7 @@ module q65 integer apmask(13),apsymbols(13) integer,dimension(22) :: isync = (/1,9,12,13,15,22,23,26,27,33,35, & 38,46,50,55,60,62,66,69,74,76,85/) - integer codewords(63,206) + integer codewords(63,411) !See MAX_NCW in q65_set_list2.f90 integer ibwa,ibwb,ncw,nsps,mode_q65,nfa,nfb,nqd integer idfbest,idtbest,ibw,ndistbest,maxiters,max_drift integer istep,nsmo,lag1,lag2,npasses,iseq,ncand,nrc @@ -367,7 +367,7 @@ subroutine q65_dec_q012(s3,LL,snr2,dat4,idec,decoded) apsymbols=0 if(ipass.ge.1) then ! Subsequent passes use AP information appropiate for nQSOprogress - call q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, & + call q65_ap(nQSOprogress,ipass,ncontest,.false.,lapcqonly,iaptype, & apsym0,apmask1,apsymbols1) write(c78,1050) apmask1 1050 format(78i1) @@ -527,7 +527,7 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ntol,ipk,jpk,f0,xdt,ccf2) if(ccfmax.gt.ccfbest .and. abs(i*df-nfqso).le.ftol) then ccfbest=ccfmax - snrbest=snr +! snrbest=snr ! snrbest not used. snr may be uninitialized. ibest=i lagbest=lagpk idrift_best=idrift_max @@ -848,7 +848,7 @@ subroutine q65_hist2(nfreq,msg0,callers,nhist2) use types use prog_args - parameter (MAX_CALLERS=40) !For multiple q3 decodes in NA VHf Contest mode + parameter (MAX_CALLERS=50) !For multiple q3 decodes in NA VHF Contest mode character*37 msg0,msg type(q3list) callers(MAX_CALLERS) character*6 c6 diff --git a/lib/qra/q65/q65.h b/lib/qra/q65/q65.h index d0a04d4e..ab1b389d 100644 --- a/lib/qra/q65/q65.h +++ b/lib/qra/q65/q65.h @@ -34,7 +34,9 @@ // Verify loglikelihood after successful decoding #define Q65_CHECKLLH // Max codeword list size in q65_decode_fullaplist -#define Q65_FULLAPLIST_SIZE 256 +// See MAX_NCW in q65_set_list2.f90 (not required to be a power of 2 -- +// this value is only ever used in a plain bounds check). +#define Q65_FULLAPLIST_SIZE 411 // maximum number of weights for the fast-fading metric evaluation #define Q65_FASTFADING_MAXWEIGTHS 65 @@ -113,7 +115,6 @@ int q65_esnodb_fastfading( int _q65_get_message_length(const qracode *pCode); int _q65_get_codeword_length(const qracode *pCode); float _q65_get_code_rate(const qracode *pCode); -static void _q65_mask(const qracode *pcode, float *ix, const int *mask, const int *x); int _q65_get_alphabet_size(const qracode *pCode); int _q65_get_bits_per_symbol(const qracode *pCode); diff --git a/lib/qra/q65/q65_ap.f90 b/lib/qra/q65/q65_ap.f90 index 32e26a4e..e6568676 100644 --- a/lib/qra/q65/q65_ap.f90 +++ b/lib/qra/q65/q65_ap.f90 @@ -1,4 +1,4 @@ -subroutine q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, & +subroutine q65_ap(nQSOprogress,ipass,ncontest,lq65pileup,lapcqonly,iaptype, & apsym0,apmask,apsymbols) integer apsym0(58),aph10(10) @@ -6,7 +6,7 @@ subroutine q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, & integer naptypes(0:5,4) ! (nQSOProgress, ipass) maximum of 4 passes for now integer mcqru(29),mcqfd(29),mcqtest(29),mcqww(29) integer mcq(29),mrrr(19),m73(19),mrr73(19) - logical lapcqonly,first + logical lq65pileup,lapcqonly,first 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 mcqru/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0/ data mcqfd/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,1,0/ @@ -120,25 +120,31 @@ subroutine q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, & endif endif - if(iaptype.eq.3) then ! MyCall,DxCall,??? + if(iaptype.eq.3) then ! MyCall,DxCall,??? apmask=0 +! Q65 Pileup uses bit 78 for the copied-last-transmission indication. +! Other Q65 AP decodes retain the normal known-zero bit. if(ncontest.eq.0.or.ncontest.eq.1.or.ncontest.eq.2.or.ncontest.eq.5.or.ncontest.eq.7) then - apmask(1:58)=1 + apmask(1:58)=1 apsymbols(1:58)=apsym0 - apmask(75:78)=1 - apsymbols(75:78)=(/0,0,1,0/) + apmask(75:77)=1 + apsymbols(75:77)=(/0,0,1/) + if(.not.lq65pileup) then + apmask(78)=1 + apsymbols(78)=0 + endif else if(ncontest.eq.3) then ! Field Day - apmask(1:56)=1 + apmask(1:56)=1 apsymbols(1:28)=apsym0(1:28) apsymbols(29:56)=apsym0(30:57) - apmask(72:78)=1 - apsymbols(75:78)=0 - else if(ncontest.eq.4) then - apmask(2:57)=1 + apmask(72:77)=1 + apsymbols(75:77)=0 + else if(ncontest.eq.4) then + apmask(2:57)=1 apsymbols(2:29)=apsym0(1:28) apsymbols(30:57)=apsym0(30:57) - apmask(75:78)=1 - apsymbols(75:78)=(/0,0,1,0/) + apmask(75:77)=1 + apsymbols(75:77)=(/0,0,1/) endif endif diff --git a/lib/qra/q65/q65_encoding_modules.f90 b/lib/qra/q65/q65_encoding_modules.f90 index 4988dd4d..3f749d5b 100644 --- a/lib/qra/q65/q65_encoding_modules.f90 +++ b/lib/qra/q65/q65_encoding_modules.f90 @@ -164,10 +164,10 @@ subroutine get_q65crc12(mc2,ncrc1,ncrc2) end subroutine get_q65crc12 -subroutine get_q65_tones(msg37,codeword,itone) +subroutine get_q65_tones(msg37,codeword,itone,msgsent,success) use packjt77 implicit none - character*37 msg37 + character*37 msg37,msgsent character*77 c77 character*6 c6 integer codeword(65) @@ -175,16 +175,36 @@ subroutine get_q65_tones(msg37,codeword,itone) integer message(15) integer shortcodeword(63) integer itone(85) - integer i,j,k + integer i,j,k,ios,pack_status,ng15 integer*1 mbits(90) integer i3,n3,ncrc1,ncrc2 + logical success,unpk77_success data sync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/ i3=-1 n3=-1 - call pack77(msg37,i3,n3,c77) + c77=' ' + codeword=0 + itone=0 + msgsent='*** bad message *** ' + success=.false. + call pack77_legacy_truncating_fallback(msg37,i3,n3,c77, & + status=pack_status) + if(pack_status.ne.PACK77_STATUS_ENCODED) return + read(c77(60:74),'(b15)',iostat=ios) ng15 + if(ios.ne.0) return + if(ng15.eq.32373) c77(60:74)='111111010010011' !Message is RR73 + call unpack77(c77,0,msgsent,unpk77_success) + if(.not.unpk77_success) then + msgsent='*** bad message *** ' + return + endif mbits=0 - read(c77,'(77i1)') mbits(1:77) + read(c77,'(77i1)',iostat=ios) mbits(1:77) + if(ios.ne.0) then + msgsent='*** bad message *** ' + return + endif ! Message is 77 bits long. Add a 0 bit to create a 78-bit message and pad with ! 12 zeros to create 90-bit mbit array for CRC calculation. @@ -216,6 +236,7 @@ subroutine get_q65_tones(msg37,codeword,itone) itone(i)=shortcodeword(k)+1 endif enddo + success=.true. end subroutine get_q65_tones end module q65_encoding diff --git a/lib/qra/q65/q65_ftn_test.f90 b/lib/qra/q65/q65_ftn_test.f90 index 607d0f5b..3f5c47c0 100644 --- a/lib/qra/q65/q65_ftn_test.f90 +++ b/lib/qra/q65/q65_ftn_test.f90 @@ -21,8 +21,12 @@ program q65_ftn_test endif call getarg(1,msg0) call pack77(msg0,i3,n3,c77) + if(i3.lt.0) then + print*,'Cannot pack message: ',trim(msg0) + go to 999 + endif call unpack77(c77,0,msgsent,unpk77_success) !Unpack to get msgsent - read(c77,1000) x + read(c77,1000,err=990) x 1000 format(12b6.6,b5.5) call q65_enc(x,y) !Encode message, x(1:13) ==> y(1:63) @@ -48,4 +52,7 @@ program q65_ftn_test write(*,1100) xdec,trim(msg) 1100 format(/'Decoded message:'/13i3,2x,a) + go to 999 + +990 print*,'Cannot read packed message bits: ',trim(msg0) 999 end program q65_ftn_test diff --git a/lib/qra/q65/q65_loops.f90 b/lib/qra/q65/q65_loops.f90 index 3220648e..4a5bc34f 100644 --- a/lib/qra/q65/q65_loops.f90 +++ b/lib/qra/q65/q65_loops.f90 @@ -1,24 +1,23 @@ -subroutine q65_loops(c00,npts2,nsps2,nsubmode,ndepth,jpk0, & +subroutine q65_loops(workspace,c00,npts2,nsps2,nsubmode,ndepth,jpk0, & xdt0,f0,iaptype,xdt1,f1,snr2,dat4,idec) use packjt77 use timer_module, only: timer use q65 + use q65_workspace, only: q65_workspace_type parameter (NN=63) parameter (LN=2176*63) !LN=LL*NN; LL=64*(mode_q65+2), NN=63 + type(q65_workspace_type), intent(inout) :: workspace complex c00(0:npts2-1) !Analytic representation of dd(), 6000 Hz - complex ,allocatable :: c0(:) !Ditto, with freq shift character decoded*37 real a(3) !twkfreq params f,f1,f2 - real,allocatable :: s3(:) !Symbol spectra integer dat4(13) !Decoded message (as 13 six-bit integers) integer nap(0:11) !AP return codes data nap/0,2,3,2,3,4,2,3,6,4,6,6/ LL=64*(mode_q65+2) - allocate(s3(LL*NN)) - allocate(c0(0:npts2-1)) + call workspace%ensure(npts2,LL) idec=-1 ircbest=9999 irc=-99 @@ -54,18 +53,19 @@ subroutine q65_loops(c00,npts2,nsps2,nsubmode,ndepth,jpk0, & a(1)=-(f0+0.5*baud*ndf) ! Variable 'drift' is frequency increase over full TxT. Therefore we want: a(2)=-0.5*drift - call twkfreq(c00,c0,npts2,6000.0,a) + call twkfreq(c00,workspace%c0(0:npts2-1),npts2,6000.0,a) do idt=1,idtmax ndt=idt/2 if(mod(idt,2).eq.0) ndt=-ndt jpk=jpk0 + nsps2*ndt/16 !tsym/16 jpk=max(0,jpk) jpk=min(29000,jpk) - call spec64(c0,npts2,nsps2,mode_q65,jpk,s3,LL,NN) - call pctile(s3,LL*NN,40,base) - s3=s3/base - where(s3(1:LL*NN)>s3lim) s3(1:LL*NN)=s3lim - call q65_bzap(s3,LL) !Zap birdies + call spec64(workspace%c0(0:npts2-1),workspace%cs,npts2,nsps2, & + mode_q65,jpk,workspace%s3(1:LL*NN),LL,NN) + call pctile(workspace%s3(1:LL*NN),LL*NN,40,base) + workspace%s3(1:LL*NN)=workspace%s3(1:LL*NN)/base + where(workspace%s3(1:LL*NN)>s3lim) workspace%s3(1:LL*NN)=s3lim + call q65_bzap(workspace%s3(1:LL*NN),LL) !Zap birdies do ibw=ibwa,ibwb ndist=ndf**2 + ndt**2 + (ibw-ibw0)**2 if(ndist.gt.maxdist) cycle @@ -73,7 +73,7 @@ subroutine q65_loops(c00,npts2,nsps2,nsubmode,ndepth,jpk0, & if(b90.gt.345.0) cycle b90ts = b90/baud call timer('dec2 ',0) - call q65_dec2(s3,nsubmode,b90ts,esnodb,irc,dat4,decoded) + call q65_dec2(workspace%s3(1:LL*NN),nsubmode,b90ts,esnodb,irc,dat4,decoded) call timer('dec2 ',1) ! irc > 0 ==> number of iterations required to decode ! -1 = invalid params diff --git a/lib/qra/q65/q65_set_list.f90 b/lib/qra/q65/q65_set_list.f90 index 0b836bde..2bb9c1f3 100644 --- a/lib/qra/q65/q65_set_list.f90 +++ b/lib/qra/q65/q65_set_list.f90 @@ -45,7 +45,7 @@ subroutine q65_set_list(mycall,hiscall,hisgrid,codewords,ncw) endif endif - call genq65(msg,0,msgsent,itone,i3,n3) + call genq65(msg,0,msgsent,itone,i3,n3,0) i0=1 j=0 do k=1,85 diff --git a/lib/qra/q65/q65_set_list2.f90 b/lib/qra/q65/q65_set_list2.f90 index 39147e61..433802fb 100644 --- a/lib/qra/q65/q65_set_list2.f90 +++ b/lib/qra/q65/q65_set_list2.f90 @@ -1,8 +1,8 @@ subroutine q65_set_list2(mycall,hiscall,hisgrid,callers,nhist2,codewords,ncw) use types - parameter (MAX_NCW=206) - parameter (MAX_CALLERS=40) !For multiple q3 decodes in NA VHf Contest mode + parameter (MAX_NCW=411) !1 + 40 stored callers plus the current call, 5 kinds, 2 flags + parameter (MAX_CALLERS=50) !For multiple q3 decodes in NA VHF Contest mode character*12 mycall,hiscall character*6 hisgrid,c6 character*4 g4 @@ -41,7 +41,6 @@ subroutine q65_set_list2(mycall,hiscall,hisgrid,callers,nhist2,codewords,ncw) g4=hisgrid(1:4) endif do k=1,5 - i=i+1 msg=trim(mycall)//' '//trim(c6) j0=len(trim(msg))+1 if(k.eq.1) msg=msg(1:j0)//g4 @@ -49,19 +48,26 @@ subroutine q65_set_list2(mycall,hiscall,hisgrid,callers,nhist2,codewords,ncw) if(k.eq.3) msg(j0:j0+3)=' RRR' if(k.eq.4) msg(j0:j0+4)=' RR73' if(k.eq.5) msg(j0:j0+2)=' 73' - call genq65(msg,0,msgsent,itone,i3,n3) - i0=1 - jj=0 - do kk=1,85 - if(kk.eq.isync(i0)) then - i0=i0+1 - cycle - endif - jj=jj+1 - codewords(jj,i)=itone(kk) - 1 + ! Generate both flag values: a caller may or may not have set + ! bit78 (copied our last transmission), and both must be + ! present as exact candidates for the full-AP list match to + ! recognize either with full sensitivity. + do iflag=0,1 + i=i+1 + call genq65(msg,0,msgsent,itone,i3,n3,iflag) + i0=1 + jj=0 + do kk=1,85 + if(kk.eq.isync(i0)) then + i0=i0+1 + cycle + endif + jj=jj+1 + codewords(jj,i)=itone(kk) - 1 + enddo +! write(71,3001) i,j,k,iflag,codewords(1:13,i),trim(msg) +!3001 format(4i3,2x,13i3,2x,a) enddo -! write(71,3001) i,j,k,codewords(1:13,i),trim(msg) -!3001 format(3i3,2x,13i3,2x,a) enddo enddo ncw=i diff --git a/lib/qra/q65/q65_workspace.f90 b/lib/qra/q65/q65_workspace.f90 new file mode 100644 index 00000000..321bdfd4 --- /dev/null +++ b/lib/qra/q65/q65_workspace.f90 @@ -0,0 +1,43 @@ +module q65_workspace + + implicit none + + integer, parameter :: Q65_NN=63 + integer, parameter :: Q65_MAXFFT=20736 + + type :: q65_workspace_type + complex, allocatable :: c0(:) + real, allocatable :: s3(:) + complex, allocatable :: cs(:) + contains + procedure :: ensure => ensure_q65_workspace + end type q65_workspace_type + +contains + + subroutine ensure_q65_workspace(this,npts2,ll) + class(q65_workspace_type), intent(inout) :: this + integer, intent(in) :: npts2,ll + integer n3 + + ! Keep the largest capacity so repeated searches do not churn the allocator. + n3=ll*Q65_NN + + if(.not.allocated(this%c0)) then + allocate(this%c0(0:npts2-1)) + else if(size(this%c0).lt.npts2) then + deallocate(this%c0) + allocate(this%c0(0:npts2-1)) + endif + + if(.not.allocated(this%s3)) then + allocate(this%s3(1:n3)) + else if(size(this%s3).lt.n3) then + deallocate(this%s3) + allocate(this%s3(1:n3)) + endif + + if(.not.allocated(this%cs)) allocate(this%cs(0:Q65_MAXFFT-1)) + end subroutine ensure_q65_workspace + +end module q65_workspace diff --git a/lib/qra/q65/q65code.f90 b/lib/qra/q65/q65code.f90 index d61cba91..f4a94d00 100644 --- a/lib/qra/q65/q65code.f90 +++ b/lib/qra/q65/q65code.f90 @@ -2,9 +2,11 @@ program q65code use q65_encoding implicit none - character*37 msg37 + character*37 msg37,msgsent integer nargs integer codeword(65),tones(85) + integer iargc + logical success nargs=iargc() if(nargs .ne. 1) then @@ -13,8 +15,13 @@ program q65code endif call getarg(1,msg37) - call get_q65_tones(msg37,codeword,tones) + call get_q65_tones(msg37,codeword,tones,msgsent,success) + if(.not.success) then + print*,'Cannot encode message: ',trim(msg37) + stop 1 + endif + write(*,*) 'Message sent: ',trim(msgsent) write(*,*) 'Generated message plus CRC (90 bits)' write(*,'(a8,15i4)') '6 bit : ',codeword(1:15) write(*,'(a8,15b6.6)') 'binary: ',codeword(1:15) diff --git a/lib/qra/q65/q65sim.f90 b/lib/qra/q65/q65sim.f90 index 827cf55c..53d6ca84 100644 --- a/lib/qra/q65/q65sim.f90 +++ b/lib/qra/q65/q65sim.f90 @@ -23,8 +23,8 @@ program q65sim character*37 msg,msgsent,imsg(10) nargs=iargc() - if(nargs.ne.11) then - print*,'Usage: q65sim "msg" A-F freq fDop DT f1 Stp TRp Nsig Nfile SNR' + if(nargs.ne.11 .and. nargs.ne.12) then + print*,'Usage: q65sim "msg" A-F freq fDop DT f1 Stp TRp Nsig Nfile SNR [Flag]' print*,'Example: q65sim "K1ABC W9XYZ EN37" A 1500 0.0 0.0 0.0 1 60 1 1 -26' print*,'Example: q65sim "ST" A 1500 0.0 0.0 0.0 1 60 1 -26' print*,' fDop = Doppler spread' @@ -32,6 +32,7 @@ program q65sim print*,' Stp = Step size (Hz)' print*,' Stp = 0 implies no Doppler tracking' print*,' Nsig = number of generated signals, 1 - 10' + print*,' Flag = optional, sets the spare 78th bit (0 or 1); default 0' print*,' Creates filenames which increment to permit averaging in first period' print*,' If msg = ST program produces a single tone at freq' go to 999 @@ -57,6 +58,11 @@ program q65sim read(arg,*) nfiles call getarg(11,arg) read(arg,*) snrdb + iflag=0 + if(nargs.eq.12) then + call getarg(12,arg) + read(arg,*) iflag + endif if(ntrperiod.eq.15) then nsps=1800 @@ -97,7 +103,7 @@ program q65sim ichk=0 do i=1,nsig msg=imsg(i) - call genq65(msg,ichk,msgsent,itone,i3,n3) + call genq65(msg,ichk,msgsent,itone,i3,n3,iflag) ntone(:,i)=itone enddo @@ -135,7 +141,7 @@ program q65sim 1106 format('000000_',i4.4,'.wav') endif - open(10,file=trim(fname),access='stream',status='unknown') + open(10,file=trim(fname),access='stream',status='replace') xnoise=0. if(snrdb.lt.90) then do i=1,npts |
