Realtime in Simulink Coder
3 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Hari Desanur
on 17 Apr 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.
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!