Main Content

getRadioTime

Get current USRP radio time

Since R2023b

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

    Description

    getRadioTime(radio) returns the current USRP™ radio time associated with the radio System object™ radio.

    example

    Examples

    collapse all

    Create an SDRu receiver System object. Set the pulse per second (PPS) signal source to be the PPS signal from a GPSDO.

    rx = comm.SDRuReceiver( ...
        Platform="N320/N321", ...
        IPAddress="192.168.20.2", ...
        PPSSource="GPSDO", ...
        ClockSource="GPSDO", ...
        EnforceGPSTimeSync=true, ...
        SamplesPerFrame=20000);

    Get the current USRP radio time.

    GPSLockStatus = 0;
        while ~GPSLockStatus 
            disp("Trying to lock to GPS constellation ...");
            GPSLockStatus =  gpsLockedStatus(rx);
        end  
    Trying to lock to GPS constellation ...
    
    disp("GPS Locked");
    GPS Locked
    
    rx_data = rx();
    USRP time synchronized to GPS time
    
    radTime = getRadioTime(rx);
    d = datetime(radTime, ...
        ConvertFrom='posixtime', ...
        Format='MM/dd/uuuu HH:mm:ss', ...
        TimeZone='Europe/London');
    fprintf('The current USRP radio time is %s',d)
    The current USRP radio time is 07/27/2023 16:29:31
    
    release(rx); 

    Input Arguments

    collapse all

    USRP radio, specified as a comm.SDRuTransmitter or comm.SDRuReceiver System object. The associated radio must be connected to the host computer.

    Version History

    Introduced in R2023b

    expand all