Realtime in Simulink Coder

3 次查看(过去 30 天)
Lee Magnusson
Lee Magnusson 2017-4-12
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.

回答(1 个)

Hari Desanur
Hari Desanur 2017-4-17
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 个评论
Lee Magnusson
Lee Magnusson 2017-4-17
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by