Changed Update parameter subsystem on chirp TB to pulse fc and pulse BW.

This commit is contained in:
canisio
2026-04-02 16:28:41 -03:00
parent 8e397fa41e
commit 62ab58b741
2 changed files with 36 additions and 79 deletions

View File

@@ -1,55 +1,14 @@
%% Rate setup
fs = 4096e6;
fs = 512e6; % Effective fs before interpolation / after decimation
Ts = 1/fs;
%% Host Sample Time in Simulation
TsHost = 5e-5;
%TsHost = 5e-5;
SamplesPerCycle = 16;
SamplesPerCycle = 4;
FPGAClkRate = fs/SamplesPerCycle;
TsFPGA = 1/FPGAClkRate;
%% Channelizer parameters
% Number of channels, maximally decimated channelizer M/D=1
nChan = 128;
% Taps per band
nTapsPerBand = 12;
% Create channelizer object
channelizer = dsp.Channelizer('NumFrequencyBands',nChan,...
'DecimationFactor',nChan,...
'NumTapsPerBand',nTapsPerBand);
% Channelizer coefficients
channelizerCoeffs = channelizer.coeffs.Numerator;
% Channel bandwidth
chanBW = fs/nChan;
% Starting frequency for each channel
chanFStart = chanBW/2:chanBW:(fs/2-chanBW/2);
% Number of frames out of channelzier
nFrames = nChan/SamplesPerCycle;
% Frame size after serializing x2
frameSize = SamplesPerCycle/2;
%% Detection parameters
% Moving average window length
movingAverageWindowLength = 64;
% Moving average comparison offset
movingAverageCompareOffset = 32;
% Threshold for ratio of current moving average to offset
thresholdScale = 500;
thresholdScaleDT = fixdt(1,18,-6);
thresholdScaleFi = fi(thresholdScale, thresholdScaleDT);
%% Tx signal generator parameters
% NCO accumulator word length
@@ -67,14 +26,14 @@ NCOCountIncDT = numerictype(1,NCOAccumWL*2,NCOAccumWL);
%% Test signal parameters
% Pulse width
pulseWidth = 8e-6;
pulseWidth = 10e-6;
% Pulse start/end frequencies
pulseStartFreq = 1305e6;
pulseEndFreqOffset = 15e6;
pulseCentFreq = 100e6;
pulseBw = 40e6; % Pulse bandwidth
% Number of pulses
numPulses = 2;
numPulses = 4;
% Pulse repetition interval
PRI = 50e-6;
@@ -82,41 +41,39 @@ PRI = 50e-6;
% Output gain
pulseGenGain = 1;
%% Capture parameters
% Time to capture after a detection
captureDuration = 10e-6;
captureLength = round(captureDuration*chanBW);
% Length of capture frame
% Contains I/Q data plus channel number and two words of timestamp
captureFrameLength = captureLength+3;
% Max number of capture frames in a DMA packet
captureFramesPerPacket = 50;
% Timeout to transfer a DMA packet if number of frames less than max
capturePacketTimeout = 1e-3;
%% DMA parameters
% DMA packet length
DMAPacketLength = captureFrameLength*captureFramesPerPacket;
DMAPacketSize = captureFrameLength*captureFramesPerPacket;
% Number of DMA buffers
DMANumBuffers = 8;
% DMA FIFO depth
DMAFIFODepth = 4096;
%% Software parameters
% Signal generator update rate
TsSW = 0.25;
TsSW = 0.0025;
%% Simulation parameters
% Sim run time
% stoptime = PRI*numPulses + 1e-3;
stoptime = PRI*captureFramesPerPacket + 1e-5;
stoptime = 10*TsSW;
%% Channelizer parameters
% Number of channels, maximally decimated channelizer M/D=1
%nChan = 512;
% Taps per band
%nTapsPerBand = 16;
% Create channelizer object
%channelizer = dsp.Channelizer('NumFrequencyBands',nChan,...
% 'DecimationFactor',nChan,...
% 'NumTapsPerBand',nTapsPerBand);
% Channelizer coefficients
%channelizerCoeffs = channelizer.coeffs.Numerator;
% Channel bandwidth
%chanBW = fs/nChan;
% Starting frequency for each channel
%chanFStart = chanBW/2:chanBW:(fs/2-chanBW/2);
% Number of frames out of channelzier
%nFrames = nChan/SamplesPerCycle;
% Frame size after serializing x2
%frameSize = SamplesPerCycle/2;