Timing for UDP Data Stream

7 views (last 30 days)
Michael
Michael on 10 Sep 2021
Answered: Michael on 22 Sep 2021
I have a software defined radio that is streaming data over a network port at 192,000 Samples per second. I want to connect to that complex data stream to work with the data. Based on my testing so far, it looks like the data packed in the UDP stream are coming in with a length of 128 complex samples.
As a prototype, I am tuning my SDR to a local FM station. My model currently has two blocks; I am currently connecting the UDP Receive block to the the FM Broadcast Demodulator block. After noodling with the message and the buffer sizes in the UDP receive block I am getting sounds, but is sometimes doesn't sound right.
I think it has to do with the UDP block sample time and the solver Fixed-step size. I am relatively new to simulink, so I am a bit confused as to the meaning of "Fixed-step size (fundamental sample time)" and the sample time in the block - even after doing some reading on the topics.
I guess my question is, if I am trying to stream live UDP data from a network connection, what simulation time setting would be needed for a sample rate of 192e3 Hz?

Accepted Answer

Michael
Michael on 22 Sep 2021
@Gavin Grant This isn't quite what I was looking for, as I was trying to get execution synchronized with wall clock time. I realized the problem has to the fact that I am trying to acquire signals in real time and to do this I need to be using Simulink Desktop Real-Time blocks. I have update the model to use Packet Input blocks rather than UDP Receive blocks. After adding those and a Real-Time Sync block, I can use the desktop real-time app to 'Run in Real-Time' and it seems to execute with the correct timing.
Do you know if those desktop real-time blocks can be used with Simulink Coder to generate an executable? I eventually want to run this model as a separate process using an executable. Thanks.

More Answers (1)

Gavin Grant
Gavin Grant on 20 Sep 2021
Michael,
Consider setting the Sample Time of the UDP Block to 1/192e3 and setting the Simulink Fixed-step size to auto.
Best regards,
Gavin

Categories

Find more on RF Blockset Models for Transceivers in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!