UDP Loopback Test in Real-Time Windows Target

9 views (last 30 days)
Hi friends,
I performed a UDP loopback test in Real-time Windows Target. My test configuration is as follow:
Signal Source -------------------------> Scope 0
|
|
|-----> Packet Output ----> Packet Input ---> Scope 1
I used the fixed-step solver and set it's value to 0.0001
I saw that there is a delay between the two scopes: The signal in Scope 1 lags behind the signal in Scope 0 by 6 (ms).
This delay is quite large for my application. Is there any way to reduce it?
Thanks

Answers (1)

Geoff
Geoff on 2 Apr 2012
How much is the delay? Typical round-trip for a UDP packet on the loopback is around 100 microseconds (for a ping and reply). It is also variable, so it's very hard to rely on. Could be anywhere from about 50us up to 200us.
What are you trying to achieve? Do you need real-time control, or is it okay to plan future events and/or lag behind by a few milliseconds provided your applications' clocks are synchronised
A while back I wrote some code to synchronise the clocks on multiple machines to a single master clock so that I could relate events that occurred on one machine to events on another down to a handful of microseconds. Maybe it would be useful to you.
It's written in C, and maybe this doesn't relate at all to what you want to do with MatLab, but I thought I'd check.
Have you thought of using the sound card to generate a wave, and encoding your data in that? Multimedia I/O timing ought to be more reliable than UDP.
  8 Comments
Geoff
Geoff on 2 Apr 2012
I found this old thread, which might be helpful.
http://www.mathworks.com/matlabcentral/newsreader/view_thread/282144
May I suggest you reply to one of the author's posts to get in contact with him/her?
Andress
Andress on 3 Apr 2012
Thank you for the suggestion, Geoff!
I will look at the thread and see if it contains useful information regarding my question.

Sign in to comment.

Categories

Find more on Get Started with Simulink Real-Time in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!