Why do I see timing differences in arrival of UDP packges sent from xPC Target?
1 view (last 30 days)
Show older comments
I am using xPC Target to send UDP packages to another machine. I set the sample time property of the block correctly, but notice timing differences between the packages. As my receiving machine expects the packages to arrive within a certain time slot I miss many packages.
Accepted Answer
MathWorks Support Team
on 20 Oct 2009
This behavior is due to the way that UDP is implemented in xPC Target. The UDP blocks execute in the background after executing the real-time code. So depending on how much time the execution of your real-time model costs, the UDP traffic will be delayed.
In order to work around this issue you can consider 'keeping the target busy' for a fixed amount of time for each time step, i.e.: ensuring a fixed TET. The attached model contains a set of blocks that can help you achieve this goal:
1) Copy the blocks from the attached model to the root level of your own model
2) Set the block priority of all the blocks of your own model to '2'
3) Fill out the processor speed and desired time of the UDP package (relative to the beginning of the time step) in the UDP delayer block
While using this solution, note the following:
- This solution just tries to delay your UDP traffic, but can not guarantee exact timing
- Other sources may be influencing the UDP traffic as well (network layout etc.)
- If you set the UDP time value too high there may be no CPU time left for xPC Target to execute its background tasks
0 Comments
More Answers (0)
See Also
Categories
Find more on Development Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!