- Soft Real Time Block for Pacing Simulink Simulations, refer to the following link for more information: https://www.mathworks.com/matlabcentral/fileexchange/67520-soft-real-time-block-for-pacing-simulink-simulations
- Simulink Desktop Real-time, refer to the following link for more information: https://www.mathworks.com/help/releases/R2022a/sldrt/getting-started-with-real-time-windows-target.html
CAN protocol not working properly when Simulation pacing is not "real-time"
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all,
I'm prototyping something, and befor implementing it on my robot, I would like to test it on a simulink model.
As a starting point, I am trying to implement a very basic CAN protocol in one very simple simulink program (see attached file). As such it works, but if the simulation pace is increased weird things happen. I know it is possible to increase it without ruining the CAN protocol because in one of your examples it works (see: ">> openExample('vnt/CANConnectivityInARoboticsApplicationExample') " )).
Question 1: I would love to know what I should change in my simple program (see attached file) to make it work at fast pace.
Question 2: Assuming I build a Matlab App that communicates through a virtual CAN with a simulink model, what should I do to make it work (at a fast pace) too? (I guess something similar to the solution of my question 1)
Thank you in advance for your help and your time.
(Just in case: I know for real-time application the simulation pace should be real time, but for prototyping it's very convenient to get results faster :) )
0 Commenti
Risposte (1)
Harimurali
il 20 Mar 2024
Modificato: Harimurali
il 25 Mar 2024
Hi Aris,
I understand that you are trying to increase the simulation pace to prototype a CAN protocol before implementing it on your robot. I assume that you are doing this by setting the simulation pace using the Simulation tab and selecting Run > Simulation Pacing.
In simulink the model runs extremelly fast, that is, 1e6 tiimes faster than clock time. Setting the simulation pace to 1000 times means that it slows down the simulation and not actually make it faster. It is still faster than a second in real-time.
In this case, it is not possible to make a model run faster just for prototyping as this is dependant on other factors like the model simplicity, solver settings, parallel computation and cannot be achieved simply by setting the simulation pace of the model.
Simulink provides infrastrucure for effectively prototyping both hard and soft real time applications which you may refer to:
Please refer to the following example that shows how to run a CAN Communication Simulink model in Simulink Desktop Real-Time:
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!