Realtime in Simulink Coder

5 vues (au cours des 30 derniers jours)
Lee Magnusson
Lee Magnusson le 12 Avr 2017
Commenté : Lee Magnusson le 17 Avr 2017
I am confused as to how to obtain realtime (wall clock time) simulation from Simulink Coder. I'm using the grt configuration. The documentation suggests that grt will either emulate realtime or it can be connected to a hard real time clock. I don't see where that is an option, and all I can get the executable to do is run as fast as possible. I'm connecting to it through external mode.

Réponses (1)

Hari Desanur
Hari Desanur le 17 Avr 2017
You can consider the following options to slow down the simulation -
1. If you have a licence to the Aerospace Blockset then the Simulation Pace block can be used to set the simulation speed of the model. This block will attempt to match the desired simulation pace to the specified simulation rate, it will NOT make the simulation run in real-time.
2. If you do not have a licence to the Aerospace Blockset then it is possible to slow down a simulation to a rate close to real-time using hand written code.
An example of a C MEX S-function used to slow down a model close to real-time can be found on the MATLAB Central File Exchange at the following address:
Note that the above options allow the system to run approximately in real-time, but not exactly. It should only be used to reduce the speed of a Simulink model so that a user can interact with it and observe the results in real-time.
3. For applications like Rapid Prototyping and HIL Simulation where accurate hard real-time is required, you should consider using Simulink Real Time or Simulink Desktop Real Time products.
  1 commentaire
Lee Magnusson
Lee Magnusson le 17 Avr 2017
Thanks for the help there. I think those are all options. I do like that simulink coder generates real code that I may compile on other systems.
I'm still wondering though in the help for simulink coder It lists this comment:
The default GRT and ERT rt_main files emulate execution of hard
real time, and when explicitly connected to a real-time clock
execute in hard real time.
On this help page: simulink coder help
What exactly does that mean? Where can I learn more about it.

Connectez-vous pour commenter.


En savoir plus sur Simulink Coder dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by