How to run simulation in real time
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Guy Rouleau
2011-9-30
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.
0 个评论
更多回答(1 个)
Fangjun Jiang
2011-9-30
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!