Simulink Real Time Desktop Runs too Fast?

15 views (last 30 days)
Hello all, my question is about Simulink Real Time Desktop for Matlab version 2022a. Strangely, when I specify the stop time for my simulation as 10 seconds, it only runs for 5 seconds in real time. If I change the stop time to something else, it is always exactly half the time I specify. My solver is a FixedStepDiscrete with a time step size of 1 second.
I am unsure why this is the case, but would like to change it so that if I specify 10 seconds of run time, it actually runs for 10 real seconds. Help is appreciated!
On the same topic of real-time simulations, is it possible to make the scope block auto-scale the time axis (grow it) as the simulation progresses, for the case where the stop time is set to 'inf'. I noticed there are options to 'scroll' or 'wrap' the time axis but both of these only show updates in a fixed window length.
Thanks for any suggestions.

Accepted Answer

Jan Houska
Jan Houska on 1 Nov 2022
Hi Kyle,
are you running in Connected IO or Run In Kernel mode? If Connected IO, please make sure that you have at least one of the Simulink Desktop Real Time I/O blocks or the RT Sync block present in your model. If Run In Kernel, this should never happen and you should probably contact tech support.
Good Luck, Jan
  2 Comments
Kyle Smith
Kyle Smith on 1 Nov 2022
Hi Jan, I am running in Connected IO mode. I had the RT sync block commented out, but uncommenting this seemed to solve the issue. I had it commented out initially because an example file had a comment saying "Use the Real-Time Synchronization block only if no I/O block is used".
I thought since I was using a serial receive block from the instrument control toolbox, that I was supposed to have it commented out. I'm not sure what that statement means by "I/O block".
Thanks!
Jan Houska
Jan Houska on 1 Nov 2022
Hi Kyle,
"I/O block" here means one of the Simulink Desktop Real Time I/O blocks. All these automatically synchronize to real time, but blocks from other toolboxes do not, so the RT Sync block is required for the synchronization if blocks from other toolboxes are used for I/O.
Jan

Sign in to comment.

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!