CAN simulation delay and distortion issues

11 visualizaciones (últimos 30 días)
Fangxu
Fangxu el 11 de Dic. de 2025 a las 1:37
Respondida: Ayush el 15 de Dic. de 2025 a las 4:26
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.

Respuestas (1)

Ayush
Ayush el 15 de Dic. de 2025 a las 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!

Categorías

Más información sobre Event Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by