UDP Loopback Test in Real-Time Windows Target

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

Antworten (1)

Geoff
Geoff am 2 Apr. 2012

0 Stimmen

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 Kommentare

Geoff
Geoff am 2 Apr. 2012
Oh sorry, I missed the bit where you said 6 milliseconds! That's pretty clunky. Maybe you need to use MEX and do your own I/O without the MatLab overhead.
Andress
Andress am 2 Apr. 2012
Hi Geoff,
Thanks for your answer. Right now the delay is 6 (ms). This is too large for my application.
I want it to be smaller than 1 (ms). Can we achieve this goal with Real-Time Windows Target?
Geoff
Geoff am 2 Apr. 2012
I can't answer that, as I don't know Real-Time Windows Target. I was just chiming in to find out what you were trying to do. You might want to check your hardware is not to blame. Are you accidentally using a 100 MBit interface? Is Windows Firewall turned on? Is your network excessively busy? How big are the packets you're sending? The larger they are, the higher the latency.
Andress
Andress am 2 Apr. 2012
I would like to know the Real-Time Windows Target's capability.
anyway, thanks for your answers :)
Geoff
Geoff am 2 Apr. 2012
Like I say, it depends on many things. Have you benchmarked your machine to find out the raw speed of the loopback? If there is a fundamental problem there, you can't draw conclusions about the capabilities of Real-Time Windows Target.
Andress
Andress am 2 Apr. 2012
I have written a C# program to test the round-trip time of a udp packet on my machine. It takes about 200 micro-seconds. Therefore the bottle-neck must be in RTWT side.
Geoff
Geoff am 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 am 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Tags

Gefragt:

am 2 Apr. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by