Simulink: Introduce delay with UDP Send/Receive

12 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Akhilesh Mishra
Akhilesh Mishra il 10 Lug 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

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by