CAN protocol not working properly when Simulation pacing is not "real-time"

9 ビュー (過去 30 日間)
Aris Papasavvas
Aris Papasavvas 2022 年 6 月 3 日
編集済み: Harimurali 2024 年 3 月 25 日
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 :) )

回答 (1 件)

Harimurali
Harimurali 2024 年 3 月 20 日
編集済み: Harimurali 2024 年 3 月 25 日
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:

カテゴリ

Help Center および File ExchangeVehicle Network Toolbox についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by