% ltehdlSIB1Recovery model initialization script
% Generates workspace variables needed by the ltehdlSIB1Recovery model.

% Find and close any figures created by previous simulation runs
figHandles = findobj('Type','figure','-and','Name','LTE HDL SIB1 Receiver State Information');
close(figHandles);

SamplingRate = 30.72e6;
simParams.Ts = 1/SamplingRate;

loadfromfile = true;

if loadfromfile
    load('eNodeBWaveform.mat');
    dataIn = resample(rxWaveform,SamplingRate,fs);
else
    dataIn = hGenerateDLRXWaveform();
end

% scale signal level to be +/-1 with a bit of margin
dataIn = 0.95 * dataIn / max(abs(dataIn));

validIn = true(length(dataIn),1);

startIn      = false(length(dataIn),1);
startIn(10)  = true;

% Stop time
simParams.stopTime = (length(dataIn)-1)/SamplingRate;

samplecontrolbus;
[addressBus,gridDataBus,eqDataBus,~] = ltehdlDefineReceiverBuses();
