Main Content

setCommandTime

Set time for applying changes to RF properties

Since R2025a

Add-On Required: This feature requires the Wireless Testbench™ Support Package for NI™ USRP™ Radios add-on.

Description

setCommandTime(radio,cmdTime) sets the time cmdTime for applying any subsequent changes to RF properties on the radio associated with the radio object radio.

Some NI™ USRP™ radios enable you to schedule changes to RF properties by setting the command time:

  1. Use the getRadioTime function to query the current radio time.

  2. Use the setCommandTime function to schedule a future time for updating RF properties on the radio.

  3. Make changes to any RF properties on your Wireless Testbench™ object or System object™. For example, update the TransmitCenterFrequency and ReceiveCenterFrequency property on your basebandTransceiver object.

  4. Use the clearCommandTime function to clear the currently set command time.

When you set the command time to a future time and update an RF property on your object, the command is issued to the radio and added to the command queue. The radio executes the commands in the queue in a first in, first out order:

  • When a command arrives at the front of the queue, the radio executes the command at the specified command time.

  • If multiple commands in the queue carry the same command time, the radio executes the commands serially in the order that they were placed.

  • If a command arrives at the front of the queue with a command time that is in the past, the radio executes the command immediately.

Note

To capture data with a baseband application object when there are property updates scheduled in the command queue, specify the Background name-value argument as true when you call the capture function. When you capture data in the foreground, you block the queue.

For details about radio support for this function, see Limitations.

example

Examples

collapse all

Create a radio object, specifying a radio setup configuration previously saved using the Radio Setup wizard.

radio = radioConfigurations("MyRadio");

Create a baseband transceiver object, specifying your radio object. Specify the Preload name-value argument as true to load the application onto the radio during object creation. Specify RF properties for the transmit and receive channels.

bbtrx = basebandTransceiver(radio, ...
    Preload=true, ...
    TransmitDataType="double", ...
    TransmitAntennas="RFA:TX/RX", ...
    TransmitCenterFrequency=2.4e9, ...
    TransmitRadioGain=10, ...
    CaptureAntennas="RFA:RX2", ...
    CaptureCenterFrequency=2.4e9, ...
    CaptureRadioGain=10);

Set the time for synchronously applying changes to RF properties as 2 seconds in the future.

cmdTime = getRadioTime(radio)+2
cmdTime = 
2.1484

Transmit a waveform continuously.

transmit(bbtrx,[-1;0;1;0],"continuous");

Schedule a 0.2 second long background capture to start 0.1 seconds before the scheduled command time.

capture(bbtrx,seconds(0.2),Background=true,StartTime=cmdTime-0.1);

Set the command time and verify.

setCommandTime(radio,cmdTime)
getCommandTime(radio)
ans = 
2.1484

Update the transmit and capture radio gains to 20 dB. These changes take effect synchronously at the command time.

bbtrx.TransmitRadioGain = 20;
bbtrx.CaptureRadioGain = 20;

Clear the command time. This takes effect immediately after the scheduled property updates take effect.

clearCommandTime(radio);

Wait for the capture operation to complete.

while isCapturing(bbtrx)
    pause(0.1)
end

Return the captured data to the workspace.

data = captureOutputs(bbtrx);

Plot the captured data. The plot shows the data captured 0.1 seconds either side of the command time.

plot(real(data))

Figure contains an axes object. The axes object contains an object of type line.

Input Arguments

collapse all

Radio object, specified as a radio object that corresponds to a radio setup configuration you saved using the Radio Setup wizard.

To create a radio object, call the radioConfigurations function with the name of your radio setup configuration. For example, for a radio setup configuration named MyRadio, call radio = radioConfigurations("MyRadio").

Command time in seconds, specified as a positive numeric scalar.

Data Types: double

Limitations

The setCommandTime function is honored on a limited set of supported NI USRP radios.

Radio DeviceCommand Time Support

USRP E320

Yes

USRP N300

No

USRP N310

No

USRP N320

Yes

USRP N321

Yes

USRP X300

Yes

USRP X310

Yes

USRP X410

No

Version History

Introduced in R2025a