From f06f5d77a58005de10178faf13fd94894b3e7eae Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Wed, 24 Jun 2020 15:15:20 -0500 Subject: [PATCH] New frame format, new symbol lengths and ndown values, gen_fst280wave now returns a waveform aligned so that first message symbol starts at t=1s. --- lib/fst280/fst280sim.f90 | 8 ++-- lib/fst280/gen_fst280wave.f90 | 3 ++ lib/fst280/genfst280.f90 | 14 +++++-- lib/fst280_decode.f90 | 72 ++++++++++++++++++++++++----------- 4 files changed, 66 insertions(+), 31 deletions(-) diff --git a/lib/fst280/fst280sim.f90 b/lib/fst280/fst280sim.f90 index 7c29d4298..a11bcc7e4 100644 --- a/lib/fst280/fst280sim.f90 +++ b/lib/fst280/fst280sim.f90 @@ -49,9 +49,9 @@ program fst280sim nsps=0 if(nsec.eq.15) nsps=800 if(nsec.eq.30) nsps=1680 - if(nsec.eq.60) nsps=4000 - if(nsec.eq.120) nsps=8400 - if(nsec.eq.300) nsps=21504 + if(nsec.eq.60) nsps=3888 + if(nsec.eq.120) nsps=8200 + if(nsec.eq.300) nsps=21168 if(nsps.eq.0) then print*,'Invalid TR sequence length.' go to 999 @@ -99,7 +99,7 @@ program fst280sim icmplx=1 f0=f00+1.5*hmod*baud call gen_fst280wave(itone,NN,nsps,nmax,fsample,hmod,f0,icmplx,c0,wave) - k=nint((xdt+1.0)/dt)-nsps + k=nint(xdt/dt) c0=cshift(c0,-k) if(k.gt.0) c0(0:k-1)=0.0 if(k.lt.0) c0(nmax+k:nmax-1)=0.0 diff --git a/lib/fst280/gen_fst280wave.f90 b/lib/fst280/gen_fst280wave.f90 index 8485b99d8..7a27ca90c 100644 --- a/lib/fst280/gen_fst280wave.f90 +++ b/lib/fst280/gen_fst280wave.f90 @@ -68,6 +68,7 @@ subroutine gen_fst280wave(itone,nsym,nsps,nwave,fsample,hmod,f0, & enddo ! Compute the ramp-up and ramp-down symbols + kshift=nsps-nint(fsample) if(icmplx.eq.0) then wave(1:nsps/2)=0.0 wave(nsps/2+1:nsps)=wave(nsps/2+1:nsps) * & @@ -76,6 +77,7 @@ subroutine gen_fst280wave(itone,nsym,nsps,nwave,fsample,hmod,f0, & wave(k1+nsps/2:)=0.0 wave(k1:k1+nsps/2-1)=wave(k1:k1+nsps/2-1) * & (1.0+cos(twopi*(/(i,i=0,nsps/2-1)/)/real(nsps)))/2.0 + wave=cshift(wave,kshift) else cwave(1:nsps/2)=0.0 cwave(nsps/2+1:nsps)=cwave(nsps/2+1:nsps) * & @@ -84,6 +86,7 @@ subroutine gen_fst280wave(itone,nsym,nsps,nwave,fsample,hmod,f0, & cwave(k1+nsps/2:)=0.0 cwave(k1:k1+nsps/2-1)=cwave(k1:k1+nsps/2-1) * & (1.0+cos(twopi*(/(i,i=0,nsps/2-1)/)/real(nsps)))/2.0 + cwave=cshift(cwave,kshift) endif ! call system_clock(count1,clkfreq) diff --git a/lib/fst280/genfst280.f90 b/lib/fst280/genfst280.f90 index a0adf5611..919dd2197 100644 --- a/lib/fst280/genfst280.f90 +++ b/lib/fst280/genfst280.f90 @@ -92,11 +92,17 @@ subroutine genfst280(msg0,ichk,msgsent,msgbits,i4tone,iwspr) if(is.eq.3) itmp(i)=2 enddo - i4tone(1:8)=isyncword - i4tone(9:78)=itmp(1:70) + i4tone(1:7)=itmp(1:7) + i4tone(8:14)=itmp(15:21) + i4tone(15:35)=itmp(29:49) + i4tone(36:43)=isyncword + i4tone(44:78)=itmp(50:84) i4tone(79:86)=isyncword - i4tone(87:156)=itmp(71:140) - i4tone(157:164)=isyncword + i4tone(87:121)=itmp(85:119) + i4tone(122:129)=isyncword + i4tone(130:150)=itmp(120:140) + i4tone(151:157)=itmp(22:28) + i4tone(158:164)=itmp(8:14) 999 return diff --git a/lib/fst280_decode.f90 b/lib/fst280_decode.f90 index b05b56894..622b241e0 100644 --- a/lib/fst280_decode.f90 +++ b/lib/fst280_decode.f90 @@ -72,18 +72,19 @@ contains if(hmod.eq.4) ndown=10 if(hmod.eq.8) ndown=5 else if(ntrperiod.eq.60) then - nsps=4000 + nsps=3888 nmax=60*12000 - ndown=100/hmod - if(hmod.eq.8) ndown=16 + ndown=96/hmod + if(hmod.eq.1) ndown=108 else if(ntrperiod.eq.120) then - nsps=8400 + nsps=8200 nmax=120*12000 - ndown=200/hmod + if(hmod.eq.1) ndown=205 + ndown=100/hmod else if(ntrperiod.eq.300) then - nsps=21504 + nsps=21168 nmax=300*12000 - ndown=512/hmod + ndown=504/hmod end if nss=nsps/ndown fs=12000.0 !Sample rate @@ -239,7 +240,7 @@ contains ncand=ic do icand=1,ncand fc_synced=candidates(icand,3) - isbest=nint(candidates(icand,4)) + isbest=nint(candidates(icand,4)) xdt=(isbest-nspsec)/fs2 call fst280_downsample(c_bigfft,nfft1,ndown,fc_synced,c2) @@ -256,26 +257,51 @@ contains hbits=0 where(bitmetrics(:,1).ge.0) hbits=1 - ns1=count(hbits( 1: 8).eq.(/0,0,0,1,1,0,1,1/)) - ns2=count(hbits( 9: 16).eq.(/0,1,0,0,1,1,1,0/)) + ns1=count(hbits( 71: 78).eq.(/0,0,0,1,1,0,1,1/)) + ns2=count(hbits( 79: 86).eq.(/0,1,0,0,1,1,1,0/)) ns3=count(hbits(157:164).eq.(/0,0,0,1,1,0,1,1/)) ns4=count(hbits(165:172).eq.(/0,1,0,0,1,1,1,0/)) - ns5=count(hbits(313:320).eq.(/0,0,0,1,1,0,1,1/)) - ns6=count(hbits(321:328).eq.(/0,1,0,0,1,1,1,0/)) + ns5=count(hbits(243:250).eq.(/0,0,0,1,1,0,1,1/)) + ns6=count(hbits(251:258).eq.(/0,1,0,0,1,1,1,0/)) nsync_qual=ns1+ns2+ns3+ns4+ns5+ns6 if(nsync_qual.lt. 26) cycle !### Value ?? ### + scalefac=2.83 - llra( 1:140)=bitmetrics( 17:156, 1) - llra(141:280)=bitmetrics(173:312, 1) + llra( 1: 14)=bitmetrics( 1: 14, 1) + llra( 15: 28)=bitmetrics(315:328, 1) + llra( 29: 42)=bitmetrics( 15: 28, 1) + llra( 43: 56)=bitmetrics(301:314, 1) + llra( 57: 98)=bitmetrics( 29: 70, 1) + llra( 99:168)=bitmetrics( 87:156, 1) + llra(169:238)=bitmetrics(173:242, 1) + llra(239:280)=bitmetrics(259:300, 1) llra=scalefac*llra - llrb( 1:140)=bitmetrics( 17:156, 2) - llrb(141:280)=bitmetrics(173:312, 2) + llrb( 1: 14)=bitmetrics( 1: 14, 2) + llrb( 15: 28)=bitmetrics(315:328, 2) + llrb( 29: 42)=bitmetrics( 15: 28, 2) + llrb( 43: 56)=bitmetrics(301:314, 2) + llrb( 57: 98)=bitmetrics( 29: 70, 2) + llrb( 99:168)=bitmetrics( 87:156, 2) + llrb(169:238)=bitmetrics(173:242, 2) + llrb(239:280)=bitmetrics(259:300, 2) llrb=scalefac*llrb - llrc( 1:140)=bitmetrics( 17:156, 3) - llrc(141:280)=bitmetrics(173:312, 3) + llrc( 1: 14)=bitmetrics( 1: 14, 3) + llrc( 15: 28)=bitmetrics(315:328, 3) + llrc( 29: 42)=bitmetrics( 15: 28, 3) + llrc( 43: 56)=bitmetrics(301:314, 3) + llrc( 57: 98)=bitmetrics( 29: 70, 3) + llrc( 99:168)=bitmetrics( 87:156, 3) + llrc(169:238)=bitmetrics(173:242, 3) + llrc(239:280)=bitmetrics(259:300, 3) llrc=scalefac*llrc - llrd( 1:140)=bitmetrics( 17:156, 4) - llrd(141:280)=bitmetrics(173:312, 4) + llrd( 1: 14)=bitmetrics( 1: 14, 4) + llrd( 15: 28)=bitmetrics(315:328, 4) + llrd( 29: 42)=bitmetrics( 15: 28, 4) + llrd( 43: 56)=bitmetrics(301:314, 4) + llrd( 57: 98)=bitmetrics( 29: 70, 4) + llrd( 99:168)=bitmetrics( 87:156, 4) + llrd(169:238)=bitmetrics(173:242, 4) + llrd(239:280)=bitmetrics(259:300, 4) llrd=scalefac*llrd apmask=0 @@ -329,7 +355,7 @@ contains else xsnr=-99.9 endif -!write(*,*) xsig,base,arg,xsnr +!write(*,*) xsig,base,arg,xsnr,nsync_qual,ntype,nharderrors,dmin,msg endif nsnr=nint(xsnr) iaptype=0 @@ -400,9 +426,9 @@ contains f0save=f0 endif - i1=i0 !Costas arrays + i1=i0+35*nss !Costas arrays i2=i0+78*nss - i3=i0+156*nss + i3=i0+121*nss s1=0.0 s2=0.0