How to run serial communication in Real Time Simulink?

4 次查看(过去 30 天)
I'm using a Teensy 3.2 to send data to Simulink through the serial port. I can't directly deploy the model to hardware, because it's not supported in the list. The problem is, though I'm able to get the data, my simulation runs slow, and takes 1 second between sampling steps from the Serial Receive Block. That is, every real time second, my simulation advances 0.1 seconds.
How can I make Simulink run in real time, so that the 0.1 seconds of sampling corresponds to the true value?
I alredy tried using the Real Time Synchronization block, but it just made things worse, taking around 4 real time seconds to advance 0.1 seconds of simulation time.
Just to clarify, I'm not running anything else on my model, only the serial communication, so it's not about anything from the solver.
Any ideas?

回答(0 个)

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by