Have you ever noticed an increasing delay while UDP protocol send/receive packets?
7 次查看(过去 30 天)
显示 更早的评论
Dear matlab users, I'll be thankful for the answer on the following question. Have you ever noticed an increasing delay while UDP protcol send/receive packets? It seems, that latency is going on and on during the time. I've worked with xPC real-time windows target in simulink in the external mode. I've made a closed-loop system where the embedded system receives assignment via UDP to drive a motor and sends encoder data to simulink. For example, if I send sinusoidal signal to the object with 1 ms and then send it back to the host, I will see an increasing error at the host side if I subtract the received signal from the sent signal. It seems to me that matlab puts received packets in the queue and takes it one by one with 1 ms. The delay is really increase: closed loop system is stable in the beginning of simulation and during the time it is getting more and more unstable. So, maybe there are some method to purge this queue and receive actual data? I'll be thankful for any information Host: PC Windows 7 Remote PC: Arm Cortex M3
2 个评论
Suneesh
2014-7-2
I would expect delays to occur if you are using the "UDP Send Binary" or "UDP Send Binary" blocks since these are not real time blocks and run in the background. The real time UDP blocks are in the library 'xpcrtudplib'. these do require a separate dedicated Ethernet card and do run in real time. Any kind of increasing time delay for these would cause a target CPU overload. However your description of your setup is extremely confusing:
1. You mention " xPC real-time windows target". There is no such product. It should be EITHER "xPC Target" or "Real-time Windows target"
2. Since you talk about a second machine acting as target I am assuming that you are using xPC Target. Still something sounds off here, xPC is NOT supported on Arm Cortex M3, but only for x86 PC-compatible machines
采纳的回答
Suneesh
2014-7-3
From the image of the model, you are using blocks from the product "Real-Time Windows target (RTWT)". I am not too familiar with it and recommend you contact tech support but here are my thoughts:
1. The Real-Time synchronization block is used to synchronize a normal mode simulation to the real time clock. So if you are running in external mode then perhaps this block is not required. Try the experiment without this block.
2. I also feel you should try a loop back test. Get rid of the embedded system from the loop and make the Packet output block send the packets to the Packet Input blocks. If the delay goes away, then the issue is with the embedded system. If the issue remains then perhaps RTWT is behaving differently, in which case please contact tech support.
I will have no further inputs on this.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!