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

Receiver blocks have a static data length port that outputs either 0 or the frame length specified in the block mask. When the output is 0, then Simulink® runs faster than the radio hardware during simulation. An output of 0 also means that the radio hardware has no new data to send to Simulink when the sample time instance occurred. When the output is the specified frame length, the data sent by the radio hardware is valid. 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 length output serves as a convenient control signal for such an enabled subsystem.

Example

This E310 Receiver block has a data length port for validating the presence of data.

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

Conditional Execution with Receiver System Objects

When you call a receiver System object™, one of the output arguments is a value that indicates the length of data packets streaming to MATLAB® from the radio hardware. If the length is zero, then the radio hardware did not send valid data. If the length equals the specified frame length, then it sent valid data. Any processing that occurs downstream of the System object must have conditions to accept only valid data.

Example

Create a receiver System object. For example

rx = sdrrx('E310');

Receive data with receiver System object. Validate data. Then save valid data using a log.

Log = dsp.SignalSink;
for counter = 1:20
    [data,dataLength] = rx();
    if (dataLength)
        Log(data);
    end
end

See Also

Blocks

System Objects


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