Real-Time in R2011b?

1 view (last 30 days)
John
John on 3 Nov 2011
Hi,
I have used simulink before to create an aircraft simulation that runs in what I call "simulation" time.
I now need to set up a model which runs in a real-time environment. At the moment the simulation runs faster than real-time.
Does anyone have any guidance on how to set up the model such that I can make it run in real-time in MATLAB/Simulink R2011b. I have the Simulink Coder blockset.
Thank you in advance for any help with this.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 3 Nov 2011
To make the simulation "really" in real-time, you need to run the simulation in a target (micro-controller) with a real-time operation system (RTOS). Your PC or MAC is unlikely a real-time target. xPc Target can boot your PC as a real-time target but that's a different story.
If you just want to slow down your simulation to close to real-time, you can use Guy Rouleau's S-function.
  3 Comments
Fangjun Jiang
Fangjun Jiang on 3 Nov 2011
As long as the model or code is executed in a CPU without RTOS, you can't achieve true real-time. Your input may be in real-time. But your computer does not have the capability to match or sync with it. What if your computer suddenly needs to launch the Internet Explorer, or interrupted by some background process? I think you understand this. With the high CPU power, you can slowdown it on purpose to closely match real-time. But you can't achieve the true real-time. So don't run real-time critical application using this approach.
John
John on 3 Nov 2011
I see what you're saying about CPU power. It is not totally critical it runs in real-time as I have the "real-time" time code from the other program which I can use as a reference time for analysis.
Many thanks.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!