Simulink CAN communication not restoring after disconnecting

1 view (last 30 days)
Hello,
I have an infinitely long simmulation running in Simulink where I use CAN communication with a Peak USB PCAN device.
To read the CAN I use the simulink CAN Receive block together with the CAN Unpack block.
Now I saw that when I disconnect the CAN line from the PCAN while my simmulation is running the received CAN values obviously stopped working and were frozen to the last received value.
When I reconnect the CAN line (still while my simmulation is running) the CAN values are not restoring.
The CAN communication is only restoring when I stop my simmulation and start it again.
Is there a way to have the CAN communication in simulink working again without stopping and starting the simmulation again?

Answers (1)

Divyanshu
Divyanshu on 12 Dec 2023
Hi Damien,
I understand that you are using CAN communication with some USB PCAN device, and are looking for ways to reconnect the CAN Line without restarting the simulation, after disconnecting the CAN line.
There is no such direct way to get the CAN line connected without restarting the simulation.
However, you can try using 'ModelOperatingPoints' where you can store the states of model and can restore them. Please refer the following documentation for better understanding:

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!