Main Content

Evaluate Host Capture Performance

This example shows how to check your host performance capability for capturing data using the baseband receiver.

Introduction

The basebandReceiver capture function has two operating modes depending on the size of capture that you request. If you request a capture length less than or equal to the onboard radio memory buffer size, the radio buffers the data before transferring it to your host computer. This ensures contiguous data capture, that is, no dropped samples. If you request a capture length that exceeds the capacity of the onboard radio memory buffer size, the radio directly transfers the data over the Ethernet connection to your host computer, bypassing the onboard radio buffer.

Many factors can have an impact on your ability to transfer data over your Ethernet connection to your host computer at high rates without dropping samples. You can use this example to evaluate the capability of your host to capture data.

Set Up Radio

Call the radioConfigurations function. The function returns all available radio setup configurations that you saved using the Radio Setup wizard. For more information, see Connect and Set Up NI USRP Radios.

savedRadioConfigurations = radioConfigurations;

To update the dropdown menu with your saved radio setup configuration names, click Update. Then select the radio to use with this example.

savedRadioConfigurationNames = [string({savedRadioConfigurations.Name})];
radio = savedRadioConfigurationNames(1) ;

Configure Baseband Receiver

Create a baseband receiver object with the specified radio. Because the object requires exclusive access to radio hardware resources, before running this example for the first time, clear any other object associated with the specified radio. In subsequent runs, to speed up the execution time of the example, reuse your new workspace object.

if ~exist("bbrx","var")
    bbrx = basebandReceiver(radio);
end

Configure Behavior upon Dropped Samples

Set the DroppedSamplesAction property to 'none'. The default setting is 'error', which stops the capture with an error message when samples are dropped.

bbrx.DroppedSamplesAction = 'none';

Evaluate Performance at Multiple Sample Rates

Set the capture length equivalent to 5 GB, which exceeds the memory buffer size on all supported radios.

captureLength = 5*2^28;

Select a set of sample rates based on the network connection you have configured using the Radio Setup wizard. If you have a 10 Gigabit NIC, set the highest sample rate to be the highest supported rate of your radio. If you have a 1 Gigabit NIC, set the highest sample rate to be 25 MHz. The test iterates from the selected highest rate and go down based on the intervalRate until a capture completes without dropping samples. Large captures at lower sample rates can take some time. For example, a single 5 GB capture at a sample rate of 10MHz will take over 135 seconds.

highSpeedTest = true;
if ~highSpeedTest
    highRate = 25e6;
    intervalRate = 5e6;
    lowRate = 1e6;
    sampleRates = (highRate:-intervalRate:lowRate)';
else
    % Get maximum sample rate supported by the radio.
    highRate = hMaxSampleRate(radio);
    intervalRate = 10e6;
    lowRate = 1e6;
    sampleRates = [highRate, (highRate/2:-intervalRate:lowRate)]';
end

To retry captures automatically if samples are dropped, set retryUnsuccessfulCaptures to true.

retryUnsuccessfulCaptures = true;

Iterate through the sample rates, starting with the highest sample rate, until you successfully capture data without dropping samples.

successfulCapture = zeros(size(sampleRates));
for n = 1:length(sampleRates)
    bbrx.SampleRate = sampleRates(n);
    disp("Capturing at "+ bbrx.SampleRate/1e6 + " MHz");
    [~,~,droppedSamples] = capture(bbrx, captureLength);
    if retryUnsuccessfulCaptures && droppedSamples
        disp("Retrying capture at " + bbrx.SampleRate/1e6 + " MHz due to dropped samples");
        [~,~,droppedSamples] = capture(bbrx, captureLength);
    end
    successfulCapture(n) = ~droppedSamples;
    if ~droppedSamples
        % Trim the results
        sampleRates = sampleRates(1:n);
        successfulCapture = successfulCapture(1:n);
        break;
    end
end
Capturing at 250 MHz
Retrying capture at 250 MHz due to dropped samples
Capturing at 125 MHz
Retrying capture at 125 MHz due to dropped samples
Capturing at 115 MHz

Tabulate Capture Results

sampleRatesMHz = sampleRates/1e6;
captureResultsTable = table(sampleRatesMHz,successfulCapture);
disp(captureResultsTable)
    sampleRatesMHz    successfulCapture
    ______________    _________________

         250                  0        
         125                  0        
         115                  1        

The results show you the highest sample rate at which contiguous IQ data has been captured with your hardware setup. This number can vary between runs. For more information about how to optimize the transfer speed between the host computer and the radio, see Data Transfer Optimization.

See Also

Functions

Objects

Related Topics