MATLAB Answers

How do I get a compiled Simulink Model to run at real-time?

9 views (last 30 days)
Phil Littler
Phil Littler on 15 Oct 2019
Commented: Chris P on 26 May 2020
I have Simulink models that I need to run at real-time (ie 1s Model time == 1s Computer time). In 2017b I'm using the "Simulation Pace" block which works perfectly when running within Simulink.
However, when I compile my model to run as standalone application (Generic Realtime Target), it does not respect the Simulation Pace and instead runs at full speed. This is an issue for me as I need to be able to run these models as standalone.
I have tried many of the Simulation Pace blocks that are available but none of them seem to work when compiled.
Is there a way to have "Simulation Pace" behaviour in a compiled model, or is there another way to have a Standalone model that can run at real-time?


Show 2 older comments
Chris P
Chris P on 19 May 2020
Thanks, Phil!
I've downloaded the block and got the example running... however... as a trial, I can't get the example to compile to a .exe
I've got the System Target set to grt.tlc and Language C. Then build and throws an error...
gmake: *** [rt_matrix.obj] Error 1
Before delving anymore into the error, did you manage to get this to compile to standalone application?
Phil Littler
Phil Littler on 20 May 2020
Hi Chris,
Yes I did get it to compile as a standalone application and run at real-time.
I don't remember having to use any specific configuration and I was using grt.tlc as well.
This worked in both 2017b and 2019b, I've not tried it in 2020a.
Chris P
Chris P on 26 May 2020
Thanks, Phil and sorry for my slow reply.
I'll investiage more and perhaps downgrade to 2019b and give that a go.
Thanks again!

Sign in to comment.

More Answers (1)

Michele Facchinelli
Michele Facchinelli on 5 Nov 2019
Hi Phil,
To do this kind of simulations you can use Simulink Desktop Real-Time, which provides a real-time engine for executing Simulink models on a Microsoft Windows PC. It enables you to create and control a real-time system for rapid prototyping or hardware-in-the-loop simulation.
Please find some more information on this product here:
Feel free to contact Technical Support by creating a support request online if you have any questions regarding this:


Sign in to comment.




Translated by