Apply Conditional Execution

You can apply conditional execution to determine whether the receiver blocks or System objects available in the Communications Toolbox™ Support Package for USRP®[1] Embedded Series Radio receive valid data from the radio hardware.

Conditional Execution with Receiver Blocks

The E3xx Receiver block has a static data valid output port returning a logical value.

  • 1 indicates that the block has received data from the radio hardware.

  • 0 indicates that the block has not received data from the radio hardware. Either Simulink® runs faster than the radio hardware during simulation or the radio hardware has no new data to send to Simulink when the sampling occurs.

Any processing that occurs downstream of the receiver block must run only on valid data. To ensure that data is valid, control the data with an enabled subsystem. The data valid output serves as a convenient control signal for such an enabled subsystem.

Example

To enable the data valid port of the E3xx Receiver block, on the Advanced tab of the block mask, update Data timeout (sec) to a value other than Inf. When this value is set to Inf, the block indefinitely waits for valid data and this port is not required.

When used in a model, the output from this port can help determine data validity.

Conditional Execution with Receiver System Objects

When you call the comm.SDRRxE3xx System object™, the second output arguments is a logical value that indicates validity of the data packets streaming to MATLAB® from the radio hardware.

  • true indicates that the System object has received data from the radio hardware.

  • false indicates that the System object has not received data from the radio hardware.

Any processing that occurs downstream of the System object must have conditions to accept only valid data. Note that if the DataTimeout property is set to Inf, the object indefinitely waits for valid data. In this case, the second output argument of the object indicating data validity is always true and can be ignored.

Example

Create a receiver System object.

rx = sdrrx('E3xx');

% Use second output argument for validation
rx.DataTimeout = 0; 

Receive data using the object. Validate data, then save valid data using a log.

Log = dsp.SignalSink;
for counter = 1:20
    [data,validData,overflow] = rx();
    if validData == 1 
        if overflow ~=1 % contiguous data
             Log(data);
        end
    else
        disp('Not valid data.');
    end
end 

See Also

Blocks

Objects


[1] USRP, USRP2, UHD, and Ettus Research are trademarks of National Instruments Corp.