Simulink: Introduce delay with UDP Send/Receive

3 次查看(过去 30 天)
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.

采纳的回答

Akhilesh Mishra
Akhilesh Mishra 2017-7-10
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 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by