How to run simulation in real time

11 views (last 30 days)
I want to run my simulation in real time so that I can manually change inputs while the simulation is running. Is there a setting to change so that it runs in real time?

Accepted Answer

Guy Rouleau
Guy Rouleau on 30 Sep 2011
To slowdown a simulation to something close to real-time, try my submission here:
As described by Jangjun, this is not accurate real-time, but if what you want is just to observe scopes and change parameters while the simulation runs, this should help.

More Answers (1)

Fangjun Jiang
Fangjun Jiang on 30 Sep 2011
You can not run a Simulink simulation on your computer in real time. "Real time" here means the clock in Simulink goes at the same speed as the clock on the wall or on your watch.
To run a real-time simulation, you need to generate the code from your model, compile it and then run it in a computer or micro-controller with a Real-Time Operation System (RTOS). The computers we use use usually don't have RTOS. That's why a real-time simulation can't be run.
However, I think you are probably asking if you can change the input or a parameter while the simulation is running, not necessarily has to be in real time. While the simulation is running, you can double click any source block (e.g. a Constatn block) and change it's value, the simulation will pause and then resume, take the new value effective. Other parameters of the model can be changed too, although it takes more advanced technique.

Categories

Find more on Simulink Real-Time in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!