2018-07-27 09:45:14 -04:00
|
|
|
subroutine hspec(id2,k,nutc0,ntrpdepth,nrxfreq,ntol,ncontest,bmsk144, &
|
2017-03-06 10:52:09 -05:00
|
|
|
btrain,pcoeffs,ingain,mycall,hiscall,bshmsg,bswl,datadir,green,s, &
|
|
|
|
jh,pxmax,dbNoGain,line1,mygrid)
|
2015-11-17 20:28:12 -05:00
|
|
|
|
|
|
|
! Input:
|
|
|
|
! k pointer to the most recent new data
|
2016-09-29 10:46:12 -04:00
|
|
|
! nutc0 UTC for display of decode(s)
|
|
|
|
! ntrpdepth TR period and 1000*ndepth
|
|
|
|
! nrxfreq Rx audio center frequency
|
|
|
|
! ntol Decoding range is +/- ntol
|
2018-07-27 09:45:14 -04:00
|
|
|
! ncontest Contest type (0=NONE 1=NA_VHF 2=EU_VHF 3=FIELD_DAY 4=RTTY)
|
2016-09-29 10:46:12 -04:00
|
|
|
! bmsk144 Boolean, true if in MSK144 mode
|
2017-01-15 16:43:40 -05:00
|
|
|
! btrain Boolean, turns on training in MSK144 mode
|
2016-09-29 10:46:12 -04:00
|
|
|
! ingain Relative gain for spectra
|
2015-11-17 20:28:12 -05:00
|
|
|
|
|
|
|
! Output:
|
|
|
|
! green() power
|
|
|
|
! s() spectrum for horizontal spectrogram
|
|
|
|
! jh index of most recent data in green(), s()
|
|
|
|
|
|
|
|
parameter (JZ=703)
|
2016-09-20 12:25:25 -04:00
|
|
|
character*80 line1
|
2017-01-21 22:20:46 -05:00
|
|
|
character*512 datadir
|
2016-10-04 10:01:02 -04:00
|
|
|
character*12 mycall,hiscall
|
2016-12-17 16:18:47 -05:00
|
|
|
character*6 mygrid
|
2015-11-17 20:28:12 -05:00
|
|
|
integer*2 id2(0:120*12000-1)
|
2018-07-10 15:09:42 -04:00
|
|
|
logical*1 bmsk144,bshmsg,btrain,bswl
|
2015-11-17 20:28:12 -05:00
|
|
|
real green(0:JZ-1)
|
|
|
|
real s(0:63,0:JZ-1)
|
|
|
|
real x(512)
|
2017-02-23 11:21:26 -05:00
|
|
|
real*8 pcoeffs(5)
|
2015-11-17 20:28:12 -05:00
|
|
|
complex cx(0:256)
|
|
|
|
data rms/999.0/,k0/99999999/
|
|
|
|
equivalence (x,cx)
|
|
|
|
save ja,rms0
|
|
|
|
|
2016-09-28 16:41:41 -04:00
|
|
|
ndepth=ntrpdepth/1000
|
|
|
|
ntrperiod=ntrpdepth - 1000*ndepth
|
2015-11-17 20:28:12 -05:00
|
|
|
gain=10.0**(0.1*ingain)
|
|
|
|
nfft=512
|
2016-09-16 10:18:40 -04:00
|
|
|
nstep=nfft
|
|
|
|
nblks=7
|
|
|
|
if(ntrperiod.lt.30) then
|
|
|
|
nstep=256
|
|
|
|
nblks=14
|
|
|
|
endif
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
if(k.gt.30*12000) go to 900
|
|
|
|
if(k.lt.nfft) then
|
|
|
|
jh=0
|
|
|
|
go to 900 !Wait for enough samples to start
|
|
|
|
endif
|
|
|
|
|
|
|
|
if(k.lt.k0) then !Start a new data block
|
2016-09-16 10:18:40 -04:00
|
|
|
ja=-nstep
|
2015-11-17 20:28:12 -05:00
|
|
|
jh=-1
|
|
|
|
rms0=0.0
|
|
|
|
endif
|
|
|
|
|
2017-03-06 09:34:25 -05:00
|
|
|
pxmax = 0;
|
2016-09-16 10:18:40 -04:00
|
|
|
do iblk=1,nblks
|
2015-11-17 20:28:12 -05:00
|
|
|
if(jh.lt.JZ-1) jh=jh+1
|
2016-09-16 10:18:40 -04:00
|
|
|
ja=ja+nstep
|
2015-11-17 20:28:12 -05:00
|
|
|
jb=ja+nfft-1
|
|
|
|
x=id2(ja:jb)
|
|
|
|
sq=dot_product(x,x)
|
2017-03-06 09:34:25 -05:00
|
|
|
xmax = maxval(x);
|
|
|
|
xmin = abs(minval(x));
|
|
|
|
if (xmin > xmax) xmax = xmin;
|
|
|
|
if (xmax.gt.0.0) pxmax=20.0*log10(xmax);
|
2015-11-17 20:28:12 -05:00
|
|
|
rms=sqrt(gain*sq/nfft)
|
2017-03-06 09:34:25 -05:00
|
|
|
rms2=sqrt(sq/nfft);
|
2015-11-17 20:28:12 -05:00
|
|
|
green(jh)=0.
|
2017-03-06 09:34:25 -05:00
|
|
|
if(rms.gt.0.0) then
|
|
|
|
green(jh)=20.0*log10(rms)
|
2017-03-06 10:52:09 -05:00
|
|
|
dbNoGain=20.0*log10(rms2);
|
2017-03-06 09:34:25 -05:00
|
|
|
endif
|
2015-11-17 20:28:12 -05:00
|
|
|
call four2a(x,nfft,1,-1,0) !Real-to-complex FFT
|
|
|
|
df=12000.0/nfft
|
|
|
|
fac=(1.0/nfft)**2
|
|
|
|
do i=1,64
|
|
|
|
j=2*i
|
|
|
|
sx=real(cx(j))**2 + aimag(cx(j))**2 + real(cx(j-1))**2 + &
|
|
|
|
aimag(cx(j-1))**2
|
|
|
|
s(i-1,jh)=fac*gain*sx
|
|
|
|
enddo
|
|
|
|
if(ja+2*nfft.gt.k) exit
|
|
|
|
enddo
|
|
|
|
k0=k
|
|
|
|
|
2016-09-20 12:25:25 -04:00
|
|
|
if(bmsk144) then
|
|
|
|
if(k.ge.7168) then
|
2016-09-21 20:03:44 -04:00
|
|
|
tsec=(k-7168)/12000.0
|
2016-10-19 16:03:05 -04:00
|
|
|
k0=k-7168
|
|
|
|
tt1=sum(float(abs(id2(k0:k0+3583))))
|
|
|
|
k0=k-3584
|
|
|
|
tt2=sum(float(abs(id2(k0:k0+3583))))
|
2016-10-19 16:31:18 -04:00
|
|
|
if(tt1.ne.0.0 .and. tt2.ne.0) then
|
2016-10-19 16:06:09 -04:00
|
|
|
call mskrtd(id2(k-7168+1:k),nutc0,tsec,ntol,nrxfreq,ndepth, &
|
2018-07-10 15:09:42 -04:00
|
|
|
mycall,mygrid,hiscall,bshmsg,btrain,pcoeffs,bswl, &
|
2017-02-20 21:13:13 -05:00
|
|
|
datadir,line1)
|
2016-10-19 16:06:09 -04:00
|
|
|
endif
|
2016-09-20 12:25:25 -04:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
900 return
|
|
|
|
end subroutine hspec
|