Simulate Triggered Capture Using Preamble Detection
This example shows how to simulate triggered data capture without a connected radio using a Simulink® model. The model simulates a radio that is configured as a preamble detector. The preamble detection parameters of the model are the same as the corresponding properties of the
object. Use this model to explore the behavior of custom preambles and test waveforms before using the
preambleDetector object to detect and capture live signals.
This model simulates a radio that is configured as a preamble detector.
The mask parameters of the Preamble Detector subsystem enable you to configure the preamble detector and the input test waveform inside the
dataStreamer subsystem. The WLAN simulation setup configures the model to simulate the detection of a WLAN test waveform. In the custom simulation setup, you can configure your own test waveform and preamble detector parameters. For more information on how to set the mask parameters, see the corresponding properties of the
This diagram shows how the Preamble Detector subsystem models preamble detection.
The Programmable FIR filter correlates the input signal with the preamble sequence.
The Threshold calculation component provides the threshold for the trigger point generation.
The Comparator component generates the trigger point, which is the first data sample for which the correlator output power is greater than the threshold.
The Data packaging component starts the data capture at the trigger offset relative to the trigger point.
Run WLAN Simulation Setup
Under Simulation setup, select
WLAN 20MHz. This selection models the detection and capture of a WLAN waveform that is configured with a 160 sample legacy long training field (L-LTF). The sample rate is 20 MHz. The preamble consists of the first long training symbol from the L-LTF, which is 64 samples.
Simulate the model for 0.17e-3 seconds, then click Show Results to open the Simulink Data Inspector. To see the result of the detection, select the Output, Correlator Output Power, and Threshold signals. The trigger point for detection is the first data sample for which the Correlator Output Power value is greater than the Threshold value. The
Output signal from the Preamble Detector subsystem contains samples from the test waveform. The Trigger Offset parameter specifies the first data sample in the Output signal relative to the trigger point. The Output Valid signal defines which samples in the Output signal are valid. The Output Last signal is an AXI-S signal that is not relevant in the detection analysis of this example.
Run Custom Simulation Setup
Under Simulation Setup , select
Custom . This selection enables you to configure the model to simulate the detection and capture of a custom waveform. To configure the model:
preamblevariable in the workspace as a numeric vector with values in the range [-1, 1).
inputSignalvariable in the workspace as a numeric vector of type
doublewith values in the range [-1, 1).
Set the Preamble Detector subsystem parameters.
Set the simulation stop time.
To illustrate this workflow, run the
hGenerateZadoffChuPreambleWaveform script to generate the
Configure the Preamble Detector subsystem using the values in this figure.
To enable the model to fully process the input waveform, use this formula to calculate the minimum simulation stop time.
is the length of the
is the length of the
is the sample rate parameter defined on the Preamble Detector subsystem.
For this example, the minimum stop time is (1580 + 3*(338 + 137) + 280)/20e6 = 1.6425e-04 seconds. To enable some overhead for viewing the output signals, set the stop time to 2e-4 seconds.
Run the simulation and view the output.