! Generates data used with datasim. This is done in an include file so that
! other macros can include it as well.
!
! @author J. Czechowski IV
! @since  NeXtMidas 3.7.1

switch receiverRF  receiverRF  GET 100e6      ! RF of the simulated receiver
switch receiverBW  receiverBW  GET  10e6      ! Bandwidth of the simulated receiver (Hz)
switch signalRF1   signalRF1   GET "DEF"      ! RF of the 1st simulated signal ("DEF" for computed default)
switch signalRF2   signalRF2   GET "DEF"      ! RF of the 2nd simulated signal ("DEF" for computed default)
switch signalRF3   signalRF3   GET "DEF"      ! RF of the 3rd simulated signal ("DEF" for computed default)
switch sigFormat   sigFormat   GET "CI"       ! Format of the signal data
switch psdFormat   psdFormat   GET "SB"       ! Format of the PSD data
switch psdNFFT     psdNFFT     GET 2048       ! NFFT for PSD
switch psdAverages psdAverages GET 4          ! Number of FFT averages for PSD
switch psdOverlap  psdOverlap  GET 0.50       ! Percentage of FFT overlap for PSD (0.00 to 1.00)
switch psdThin     psdThin     GET 128        ! Thinning factor for the PSD and spectral display
switch showPlots   showPlots   GET false true ! Show plots?

if (signalRF1 EQS "DEF") then calc signalRF1 receiverRF receiverBW -0.10 * +
if (signalRF2 EQS "DEF") then calc signalRF2 receiverRF receiverBW +0.30 * +
if (signalRF3 EQS "DEF") then calc signalRF3 receiverRF receiverBW +0.40 * +

waveform/rt _signal1 FORM=^sigFormat DURATION=Inf SHAPE=Sine  RF=^signalRF1  VRF=^receiverRF BW=^receiverBW
waveform/rt _signal2 FORM=^sigFormat DURATION=Inf SHAPE=Sine  RF=^signalRF2  VRF=^receiverRF BW=^receiverBW
waveform/rt _signal3 FORM=^sigFormat DURATION=Inf SHAPE=Sine  RF=^signalRF3  VRF=^receiverRF BW=^receiverBW
waveform/rt _noise   FORM=^sigFormat DURATION=Inf SHAPE=White RF=^receiverBW VRF=^receiverRF BW=^receiverBW
fcalculator _pred    _signal1 _signal2 _signal3 _noise 5 * + + +

fft/dbf _pred  _psd{FORM=^psdFormat} NFFT=psdNFFT OVER=psdOverlap NAVG=psdAverages

status    _psd   XSTART=xstart
headermod _psd   XSTART=xstart+^{receiverRF}

thin _psd _psdThin INC=^{psdThin}

