- Use a clock source that is common to both models, you can use System Clock block to generate the clock signal and use it as a trigger for both models. https://in.mathworks.com/help/simulink/ref_extras/clock.html
- You can also use a buffer block in simulink to store the signals produced by Simulink 1 before sending it to Simulink 2.https://in.mathworks.com/help/dsp/ref/buffer.html
UDP communication issue between two Simulink models on a single machine
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
Currently, I am working on a project that requires to execute two simulink models on a single machine; let's name them Simulink 1 and Simulink 2. Simulink 1 sends signals to Simulink 2 through UDP Send/Receive of DSP System Toolbox. The tricky part of this project is Simulink 1 runs in non-real time, but Simulink 2 runs in real-time.
To test the UDP communication, I sent sine wave from Simulink 1 to Simulink 2. The attached image shows the sine wave in Simulink 1, the plot at the top, and Simulink 2, the bottom one. Since the two Simulink models run in different time scale, the plots does not match in x-axis. The issue is that the received sine wave is not smooth. It seems like Simulink 2 repeats receiving and stopping to receive signals periodically. I guess this is because time is not synchronized between the two models, but I cannot explain it reason clearly.
I would appreciate it if someone could explain what couses this issue and give me some soggestions to solve it.
Best,
0 comentarios
Respuestas (1)
Sai Kiran
el 10 de Mzo. de 2023
Hi,
As per my understanding you are facing this issue due to asynchronous execution of two Simulink models. Simulink 1 runs in non-real time and Simulink 2 runs in real-time, which means that Simulink 1 may produce signals at a different rate than the Simulink 2 can consume them, leading to loss of data.
To solve this issue you have to ensure that the two models are synchronized.
This can be achieved in a couple of ways:-
I hope it helps!
Thanks!
0 comentarios
Ver también
Categorías
Más información sobre Get Started with DSP System Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!