CAN simulation delay and distortion issues
10 次查看(过去 30 天)
显示 更早的评论
Using the most basic CAN receiving and sending model that comes with Simulink without any modifications, without setting the message cycle, with a sampling time of 0.01s, the two simulation results are completely different. The official explanation for the case is delay. After setting the message cycle to 0.01s, the result is completely distorted. No matter how the sampling time and message cycle are changed, it will always be like this.
I don't understand why the result is so distorted and the message sending cycle is completely wrong.Any help is appriciated.


0 个评论
回答(1 个)
Ayush
2025-12-15,4:26
Hi Fangxu,
I understand your concern about the distorted results when setting the CAN message cycle in Simulink.
This happens because, in Simulink, the simulation step (sampling time) and the CAN message cycle need to be perfectly aligned. If they are not, messages may be sent or received at unexpected times, causing data to appear distorted or out of sync. When the message cycle is left unset, messages are sent every simulation step, so everything stays synchronized. But when you set the message cycle, especially if it doesn’t exactly match the simulation step, timing mismatches and buffering can occur, leading to the issues you’re seeing.
To avoid this, make sure your sampling time and message cycle are set to the same value or are integer multiples of each other. You can refer the following documentation to know more about CAN transmission and reception:
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Event Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!