Simulink: Introduce delay with UDP Send/Receive
3 views (last 30 days)
Show older comments
Arun Adiththan
on 6 Jul 2017
Answered: Akhilesh Mishra
on 10 Jul 2017
I'm building a client/server-type subsystem in a control system application using UDP Send/Receive blocks in Simulink. Data x is sent to the server via UDPSend block which is then processed at the server that returns output y.
Currently, I've both the client (a Simulink model) and the server (processing logic return in Java) resides in the localhost. Therefore, the packet exchanges essentially take near-zero time. I'd like to introduce network delay such that the packet exchanges take a varying amount of time (say due to changes in bandwidth availability), effectively simulating a scenario where the server node is located in a different geographical location.
Could someone guide me on how to achieve this? Thanks.
0 Comments
Accepted Answer
Akhilesh Mishra
on 10 Jul 2017
It is not possible to simulate the network delay after sending as the data has already been sent out of the host. However, we can add a 'Variable Delay' block after the 'UDP Receive' block to simulate the delay and observe the response of the control system application. Please refer to the attached sample demo model (created using MATLAB R2017a).
The documentation link to the 'Variable Time Delay' block can be found in the link below - https://www.mathworks.com/help/physmod/sps/powersys/ref/discretevariabletimedelay.html
0 Comments
More Answers (0)
See Also
Categories
Find more on Simulink Functions 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!